pedro_morgan
2007-08-19 a44efae424f6cdca4e0d11d59631bb6f8558d069
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
redirect = '';
 
function loadContentRefresh(pagename) {
    var pageContentCallbackRefresh = {
        success: function(o) {
            document.getElementById('pageContent').innerHTML = o.responseText;
        },
        failure: function(o) {
            alert('Ajax Request was not successful.');
        }
    }
    
  if(document.getElementById('refreshinterval').value > 0) {
      var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename+"&refresh="+document.getElementById('refreshinterval').value, pageContentCallbackRefresh);
      setTimeout( "loadContentRefresh('"+pagename+"&refresh="+document.getElementById('refreshinterval').value+"')", document.getElementById('refreshinterval').value*1000 );
  }
}
 
function capp(module) {
    var cappCallback = {
        success: function(o) {
            if(o.responseText != '') {
                if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) {
                    var parts = o.responseText.split(':');
                    loadContent(parts[1]);
                } else {
                    alert(o.responseText);
                }
            }
            loadMenus();
        },
        failure: function(o) {
            alert('Ajax Request was not successful.');
        }
    }
    var submitFormObj = YAHOO.util.Connect.asyncRequest('GET', 'capp.php?mod='+module, cappCallback);
}
 
function submitLoginForm(formname) {
    
    var submitFormCallback = {
        success: function(o) {
            if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) {
                var parts = o.responseText.split(':');
                //alert(parts[1]);
                loadContent(parts[1]);
                //redirect = parts[1];
                //window.setTimeout('loadContent(redirect)', 1000);
            } else {
                document.getElementById('pageContent').innerHTML = o.responseText;
            }
            loadMenus();
        },
        failure: function(o) {
            alert('Ajax Request was not successful.');
        }
    }
    
    //* Validate form. TODO: username and password with strip();
    var frm = document.getElementById(formname);
    var userNameObj = frm.username;
    if(userNameObj.value == ''){
        userNameObj.focus();
        return;q
    }
    var passwordObj = frm.passwort;
    if(passwordObj.value == ''){
        passwordObj.focus();
        return;
    }   
    YAHOO.util.Connect.setForm(formname);
    var submitFormObj = YAHOO.util.Connect.asyncRequest('POST', 'content.php', submitFormCallback);
    /*
    if(redirect != '') {
        loadContent(redirect);
        redirect = '';
    }
    */
}
 
function submitForm(formname,target) {
    
    var submitFormCallback = {
        success: function(o) {
            if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) {
                var parts = o.responseText.split(':');
                //alert(parts[1]);
                loadContent(parts[1]);
                //redirect = parts[1];
                //window.setTimeout('loadContent(redirect)', 1000);
            } else {
                document.getElementById('pageContent').innerHTML = o.responseText;
            }
        },
        failure: function(o) {
            alert('Ajax Request was not successful. 1');
        }
    }
    
    YAHOO.util.Connect.setForm(formname);
    var submitFormObj = YAHOO.util.Connect.asyncRequest('POST', target, submitFormCallback);
    /*
    if(redirect != '') {
        loadContent(redirect);
        redirect = '';
    }
    */
}
 
function loadContent(pagename) {
    var pageContentCallback2 = {
        success: function(o) {
                if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) {
                var parts = o.responseText.split(':');
                loadContent(parts[1]);
            } else {
                document.getElementById('pageContent').innerHTML = o.responseText;
            }
        },
        failure: function(o) {
            alert('Ajax Request was not successful.');
        }
    }
    
 
  var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, pageContentCallback2);
}
 
 
function loadInitContent() {
 
  var pageContentCallback = {
        success: function(o) {
            if(o.responseText.indexOf('HEADER_REDIRECT:') > -1) {
                var parts = o.responseText.split(":");
                loadContent(parts[1]);
            } else {
                document.getElementById('pageContent').innerHTML = o.responseText;
            }
            
            /*
            var items = document.getElementsByTagName('input');
            for(i=0;i<items.length;i++) {
                //var oButton = new YAHOO.widget.Button(items[i].id);
                if(items[i].type == 'button') {
                    //alert(items[i].id);
                    var oButton = new YAHOO.widget.Button(items[i].id);
                    oButton.addListener("click",submitLoginForm);
                }
            }
            //var oButton = new YAHOO.widget.Button("submit");
            */
        },
        failure: function(o) {
            alert('Ajax Request was not successful.');
        }
    }
    
  var pageContentObject = YAHOO.util.Connect.asyncRequest('GET', 'content.php?s_mod=login&s_pg=index', pageContentCallback);
  
  loadMenus();
 
}
 
function loadMenus() {
    
    var sideNavCallback = {
        success: function(o) {
            document.getElementById('sideNav').innerHTML = o.responseText;
        },
        failure: function(o) {
            alert('Ajax Request was not successful.');
        }
    }
    
  var sideNavObject = YAHOO.util.Connect.asyncRequest('GET', 'nav.php?nav=side', sideNavCallback);
    
    var topNavCallback = {
        success: function(o) {
            document.getElementById('topNav').innerHTML = o.responseText;
        },
        failure: function(o) {
            alert('Ajax Request was not successful.');
        }
    }
    
  var topNavObject = YAHOO.util.Connect.asyncRequest('GET', 'nav.php?nav=top', topNavCallback);
 
}
 
function changeTab(tab,target) {
    //document.forms[0].next_tab.value = tab;
    document.pageForm.next_tab.value = tab;
    submitForm('pageForm',target);
}
 
 
 
function reportError(request)
    {
        alert('Sorry. There was an error.');
    }
    
    function del_record(link) {
  if(window.confirm("<tmpl_var name='delete_confirmation'>")) {
          loadContent(link);
  }
}
 
function loadContentInto(elementid,pagename) {
    var itemContentCallback = {
        success: function(o) {
            document.getElementById(elementid).innerHTML = o.responseText;
        },
        failure: function(o) {
            alert('Ajax Request was not successful.');
        }
    }
    
 
  var pageContentObject2 = YAHOO.util.Connect.asyncRequest('GET', pagename, itemContentCallback);
}