4 * sets current selected server, table and db (called from footer.inc.php)
6 function setDb( new_db
) {
7 //alert('setDb(' + new_db + ')');
10 //alert( new_db + '(' + new_db.length + ') : ' + db );
14 if ( window
.frames
[0].document
.getElementById( db
) == null ) {
15 // db is unknown, reload complete left frame
19 // TODO: add code to expand db in lightview mode
21 // refresh querywindow
26 function refreshMain( url
) {
34 goTo( url
+ '?&server=' + server
+
38 '&collation_connection=' + collation_connection
,
42 function refreshLeft() {
43 goTo('left.php?&server=' + server
+
47 '&collation_connection=' + collation_connection
52 * sets current selected server, table and db (called from footer.inc.php)
54 function setAll( new_lang
, new_collation_connection
, new_server
, new_db
, new_table
) {
55 //alert('setAll( ' + new_lang + ', ' + new_collation_connection + ', ' + new_server + ', ' + new_db + ', ' + new_table + ' )');
56 if ( new_server
!= server
|| new_lang
!= lang
57 || new_collation_connection
!= collation_connection
) {
58 // something important has changed
62 collation_connection
= new_collation_connection
;
66 else if ( new_db
!= db
|| new_table
!= table
) {
67 // save new db and table
71 if ( window
.frames
[0].document
.getElementById( db
) == null
72 && window
.frames
[0].document
.getElementById( db
+ '.' + table
) == null ) {
73 // table or db is unknown, reload complete left frame
77 // TODO: add code to expand db in lightview mode
79 // refresh querywindow
84 function reload_querywindow( db
, table
, sql_query
) {
85 if ( ! querywindow
.closed
&& querywindow
.location
) {
86 if ( ! querywindow
.document
.sqlform
.LockFromUpdate
87 || ! querywindow
.document
.sqlform
.LockFromUpdate
.checked
) {
88 querywindow
.document
.querywindow
.db
.value
= db
;
89 querywindow
.document
.querywindow
.query_history_latest_db
.value
= db
;
90 querywindow
.document
.querywindow
.table
.value
= table
;
91 querywindow
.document
.querywindow
.query_history_latest_table
.value
= table
;
94 querywindow
.document
.querywindow
.query_history_latest
.value
= sql_query
;
97 querywindow
.document
.querywindow
.submit();
102 function focus_querywindow( sql_query
) {
103 if ( querywindow
&& !querywindow
.closed
&& querywindow
.location
) {
104 var querywindow
= querywindow
;
105 if ( querywindow
.document
.querywindow
.querydisplay_tab
!= 'sql' ) {
106 querywindow
.document
.querywindow
.querydisplay_tab
.value
= "sql";
107 querywindow
.document
.querywindow
.query_history_latest
.value
= sql_query
;
108 querywindow
.document
.querywindow
.submit();
114 url
= 'querywindow.php?' + common_query
+ '&db=' + db
+ '&table=' + table
+ '&sql_query=' + sql_query
;
115 open_querywindow( url
);
119 function open_querywindow( url
) {
121 url
= 'querywindow.php?' + common_query
+ '&db=' + db
+ '&table=' + table
;
124 if (!querywindow
.closed
&& querywindow
.location
) {
125 goTo( url
, 'query' );
128 querywindow
=window
.open( url
, '',
129 'toolbar=0,location=0,directories=0,status=1,menubar=0,' +
130 'scrollbars=yes,resizable=yes,' +
131 'width=' + querywindow_width
+ ',' +
132 'height=' + querywindow_height
);
135 if ( ! querywindow
.opener
) {
136 querywindow
.opener
= window
.window
;
139 if ( window
.focus
) {
146 function refreshQuerywindow( url
) {
147 if ( ! querywindow
.closed
&& querywindow
.location
) {
148 open_querywindow( url
)
153 * opens new url in target frame, with default beeing left frame
154 * valid is 'main' and 'querywindow' all others leads to 'left'
156 * @param string targeturl new url to load
157 * @param string target frame where to load the new url
159 function goTo( targeturl
, target
) {
161 if ( target
== 'main' ) {
162 target
= window
.frames
[1];
163 } else if ( target
== 'query' ) {
164 target
= querywindow
;
165 //return open_querywindow( targeturl );
166 } else if ( ! target
) {
167 target
= window
.frames
[0];
171 if ( target
.location
.href
== targeturl
) {
173 } else if ( target
.location
.href
== pma_absolute_uri
+ targeturl
) {
177 if ( safari_browser
) {
178 target
.location
.href
= targeturl
;
180 target
.location
.replace(targeturl
);
187 // opens selected db in main frame
188 function openDb( new_db
) {
189 //alert('opendb(' + new_db + ')');
191 refreshMain( opendb_url
);
195 function updateTableTitle( table_link_id
, new_title
) {
196 //alert('updateTableTitle');
197 if ( window
.parent
.frames
[0].document
.getElementById(table_link_id
) ) {
198 var left
= window
.parent
.frames
[0].document
;
199 left
.getElementById(table_link_id
).title
= new_title
;
200 new_title
= left
.getElementById('icon_' + table_link_id
).alt
+ ': ' + new_title
;
201 left
.getElementById('browse_' + table_link_id
).title
= new_title
;