Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAtul Pratap Singh <atulpratapsingh05@gmail.com>2013-08-26 16:45:48 +0400
committerAtul Pratap Singh <atulpratapsingh05@gmail.com>2013-08-26 16:45:48 +0400
commit3dd1c765047cc44f650644448c1126e4d99585b7 (patch)
tree8163570b3d4c2ae8686871961539f012cd81e2a5 /js
parent77c4cbed7fa8a425e4d6b45aae01423af10671b7 (diff)
parent15d03b227305a46c6ab9b6c1b9ad8c38c35f558f (diff)
Merge commit '15d03b2'
Diffstat (limited to 'js')
-rw-r--r--js/common.js20
-rw-r--r--js/navigation.js31
2 files changed, 37 insertions, 14 deletions
diff --git a/js/common.js b/js/common.js
index b18229d8f4..f7405b7a8e 100644
--- a/js/common.js
+++ b/js/common.js
@@ -43,19 +43,7 @@ var PMA_commonParams = (function () {
}
// To expand the database in use and collapse the previous one
if(i == 'db' && obj[i] !== '') {
- var $expandElem, $icon;
- if(params['db'] !== '' && params['db'] !== obj[i]) {
- $expandElem = $('#pma_navigation_tree a.dbLink:contains("' + params['db'] + '")')
- .parent().find('a.expander').eq(0);
- $icon = $expandElem.find('img');
- if ($icon.is('.ic_b_minus'))
- PMA_expandNavigationTree($expandElem);
- }
- $expandElem = $('#pma_navigation_tree a.dbLink:contains("' + obj[i] + '")')
- .parent().find('a.expander').eq(0);
- $icon = $expandElem.find('img');
- if ($icon.is('.ic_b_plus'))
- PMA_expandNavigationTree($expandElem);
+ PMA_autoExpandDatabaseInUse(params['db'], obj[i]);
}
params[i] = obj[i];
}
@@ -87,6 +75,9 @@ var PMA_commonParams = (function () {
PMA_querywindow.refresh();
PMA_reloadNavigation();
}
+ if(name == 'db' && value !== '') {
+ PMA_autoExpandDatabaseInUse(params['db'], value);
+ }
params[name] = value;
return this;
},
@@ -124,6 +115,9 @@ var PMA_commonActions = {
*/
setDb: function (new_db) {
if (new_db != PMA_commonParams.get('db')) {
+ if(new_db !== '') {
+ PMA_autoExpandDatabaseInUse(PMA_commonParams.get('db'), new_db);
+ }
PMA_commonParams.set('db', new_db);
PMA_querywindow.refresh();
}
diff --git a/js/navigation.js b/js/navigation.js
index 998d9c85eb..af7f39e544 100644
--- a/js/navigation.js
+++ b/js/navigation.js
@@ -226,7 +226,7 @@ $(function () {
});
/**
- * Expands/collapses the navigation tree
+ * Expands/collapses the navigation tree and sets to view the expanded
*
* @param object $expandElem the element that initiated the expanding
* @return void
@@ -238,6 +238,9 @@ function PMA_expandNavigationTree($expandElem) {
if ($icon.is('.ic_b_plus')) {
$icon.removeClass('ic_b_plus').addClass('ic_b_minus');
$children.show('fast');
+ $('#pma_navigation').animate({
+ scrollTop: $children.offset().top
+ });
} else {
$icon.removeClass('ic_b_minus').addClass('ic_b_plus');
$children.hide('fast');
@@ -278,6 +281,9 @@ function PMA_expandNavigationTree($expandElem) {
.find('a.expander.container')
.click();
}
+ $('#pma_navigation').animate({
+ scrollTop: $destination.children('div.list_container').offset().top
+ });
} else {
PMA_ajaxShowMessage(data.error, false);
}
@@ -288,6 +294,29 @@ function PMA_expandNavigationTree($expandElem) {
$expandElem.blur();
}
+/*
+ * Auto-expands the newly chosen database
+ *
+ * @param string $oldDb
+ * @param string $newDb
+ *
+ */
+function PMA_autoExpandDatabaseInUse($oldDb, $newDb) {
+ var $expandElem, $icon;
+ if($oldDb !== '' && $oldDb !== $newDb) {
+ $expandElem = $('#pma_navigation_tree a.dbLink:contains("' + $oldDb + '")')
+ .parent().find('a.expander').eq(0);
+ $icon = $expandElem.find('img');
+ if ($icon.is('.ic_b_minus'))
+ PMA_expandNavigationTree($expandElem);
+ }
+ $expandElem = $('#pma_navigation_tree a.dbLink:contains("' + $newDb + '")')
+ .parent().find('a.expander').eq(0);
+ $icon = $expandElem.find('img');
+ if ($icon.is('.ic_b_plus'))
+ PMA_expandNavigationTree($expandElem);
+}
+
/**
* Reloads the whole navigation tree while preserving its state
*