BUG 0000 "The activation of a tab in ADMIN does not work with URL" SOLVED

- The activation of a tab in ADMIN does not work with URL (setup/main?s=PMENTERPRISE or setup/main_init?s=PMENTERPRISE)
- Solved the problem, now looks for the variable "s" in the menu to set the active tab
This commit is contained in:
Victor Saisa Lopez
2012-05-15 09:09:13 -04:00
parent fc9690c526
commit b636c91a28
2 changed files with 86 additions and 39 deletions

View File

@@ -23,50 +23,83 @@
*
*/
$RBAC->requirePermissions('PM_SETUP', 'PM_USERS');
$RBAC->requirePermissions("PM_SETUP", "PM_USERS");
$oHeadPublisher =& headPublisher::getSingleton();
///////
$adminSelected = null;
global $G_TMP_MENU;
$oMenu = new Menu();
$oMenu->load('setup');
$items = Array();
if (isset($_REQUEST["s"])) {
$adminSelected = $_REQUEST["s"];
}
else {
if (isset($_SESSION["ADMIN_SELECTED"])) {
$adminSelected = $_SESSION["ADMIN_SELECTED"];
}
}
$menuTypes = array_unique($oMenu->Types);
foreach($menuTypes as $i=>$v){
if( $v == 'admToolsContent'){
unset($menuTypes[$i]);
///////
$oHeadPublisher = &headPublisher::getSingleton();
global $G_TMP_MENU;
$oMenu = new Menu();
$oMenu->load("setup");
$items = array();
$menuTypes = array_unique($oMenu->Types);
foreach ($menuTypes as $i => $v) {
if ($v == "admToolsContent") {
unset($menuTypes[$i]);
break;
}
}
//sort($menuTypes);
$tabItems = array();
$i = 0;
foreach ($menuTypes as $menuType) {
$tabItems[$i]->id = $menuType;
$LABEL_TRANSLATION = G::LoadTranslation("ID_" . strtoupper($menuType));
if (substr($LABEL_TRANSLATION, 0, 2) !== "**") {
$title = $LABEL_TRANSLATION;
}
else {
$title = str_replace("_", " ", ucwords($menuType));
}
$tabItems[$i]->title = $title;
$i++;
}
///////
$tabActive = "";
if ($adminSelected != null) {
foreach ($oMenu->Options as $i => $option) {
if ($oMenu->Id[$i] == $adminSelected) {
$tabActive = (in_array($oMenu->Types[$i], array("", "admToolsContent")))? "plugins" : $oMenu->Types[$i];
break;
}
}
//sort($menuTypes);
}
$tabItems = Array();
$i=0;
foreach( $menuTypes as $menuType ){
$tabItems[$i]->id = $menuType;
$LABEL_TRANSLATION = G::LoadTranslation("ID_".strtoupper($menuType));
if( substr($LABEL_TRANSLATION,0,2) !== '**' ){
$title = $LABEL_TRANSLATION;
} else {
$title = str_replace('_', ' ', ucwords($menuType));
}
$tabItems[$i]->title = $title;
$i++;
}
///////
$oHeadPublisher->addExtJsScript("setup/main", true); //adding a javascript file .js
$oHeadPublisher->addContent("setup/main"); //adding a html file .html.
$oHeadPublisher->assign("tabActive", $tabActive);
$oHeadPublisher->assign("tabItems", $tabItems);
$oHeadPublisher->assign("_item_selected", (($adminSelected != null)? $adminSelected : ""));
$oHeadPublisher->addExtJsScript('setup/main', true); //adding a javascript file .js
$oHeadPublisher->addContent('setup/main'); //adding a html file .html.
$oHeadPublisher->assign('tabItems', $tabItems);
$oHeadPublisher->assign('_item_selected', (isset($_SESSION['ADMIN_SELECTED'])?$_SESSION['ADMIN_SELECTED']:''));
G::RenderPage("publish", "extJs");
G::RenderPage('publish', 'extJs');
// this patch enables the load of the plugin list panel inside de main admin panel iframe
if (isset($_GET['action'])&&$_GET['action']=='pluginsList'){
print "
<script>
document.getElementById('setup-frame').src = 'pluginsList';
</script>
";
}
//this patch enables the load of the plugin list panel inside de main admin panel iframe
if (isset($_GET["action"]) && $_GET["action"] == "pluginsList") {
echo "
<script type=\"text/javascript\">
document.getElementById(\"setup-frame\").src = \"pluginsList\";
</script>
";
}

View File

@@ -5,11 +5,21 @@
var _NODE_SELECTED;
var main = function(){
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
var cookiep = new Ext.state.CookieProvider();
var items = [];
var nodeLoad = [];
var i;
if (tabActive != "") {
for(i = 0; i<= tabItems.length - 1; i++) {
if (tabItems[i].id == tabActive) {
cookiep.set("admin-tabpanel", {"activeTab": i});
}
}
}
Ext.state.Manager.setProvider(cookiep);
for(i=0; i<tabItems.length; i++){
@@ -47,6 +57,10 @@ var main = function(){
loader.on("load", function () {
if (_item_selected != "") {
node = tp.getNodeById(_item_selected);
if (typeof node == "undefined") {
node = tp.getRootNode().childNodes[0];
}
}
else {
node = tp.getRootNode().childNodes[0];