* Ajdust openApp logic.
This commit is contained in:
@@ -961,6 +961,13 @@ class baseControl
|
||||
*/
|
||||
public function locate($url)
|
||||
{
|
||||
/* If openApp is set, use it next visit. */
|
||||
$module = $this->app->rawModule;
|
||||
if(isset($this->lang->navGroup->$module) and $this->lang->navGroup->$module != $this->app->openApp)
|
||||
{
|
||||
setCookie('openApp', $this->app->openApp);
|
||||
}
|
||||
|
||||
header("location: $url");
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -376,7 +376,6 @@ class baseRouter
|
||||
$this->loadClass('dao', $static = true);
|
||||
$this->loadClass('mobile', $static = true);
|
||||
|
||||
$this->setOpenApp();
|
||||
$this->setSuperVars();
|
||||
$this->setDebug();
|
||||
$this->setErrorHandler();
|
||||
@@ -862,7 +861,16 @@ class baseRouter
|
||||
*/
|
||||
public function setOpenApp()
|
||||
{
|
||||
if(isset($_COOKIE['openApp'])) $this->openApp = $_COOKIE['openApp'];
|
||||
if(isset($_COOKIE['openApp']) and $_COOKIE['openApp'])
|
||||
{
|
||||
$this->openApp = $_COOKIE['openApp'];
|
||||
setCookie('openApp', '');
|
||||
}
|
||||
else
|
||||
{
|
||||
$module = $this->rawModule;
|
||||
$this->openApp = $this->lang->navGroup->$module;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,6 +33,8 @@ class control extends baseControl
|
||||
{
|
||||
parent::__construct($moduleName, $methodName, $appName);
|
||||
|
||||
$this->app->setOpenApp();
|
||||
|
||||
if(defined('IN_USE') or (defined('RUN_MODE') and RUN_MODE == 'api')) $this->setPreference();
|
||||
|
||||
if(!isset($this->config->bizVersion)) return false;
|
||||
|
||||
@@ -539,3 +539,5 @@ $lang->navGroup->dev = 'admin';
|
||||
$lang->navGroup->entry = 'admin';
|
||||
$lang->navGroup->extension = 'admin';
|
||||
$lang->navGroup->action = 'admin';
|
||||
|
||||
$lang->navGroup->tree = 'tree';
|
||||
|
||||
+7
-20
@@ -33,7 +33,6 @@ class commonModel extends model
|
||||
$this->loadCustomFromDB();
|
||||
if(!$this->checkIP()) die($this->lang->ipLimited);
|
||||
$this->app->loadLang('company');
|
||||
$this->setOpenApp();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,21 +115,6 @@ class commonModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set openApp.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function setOpenApp()
|
||||
{
|
||||
$openApp = $this->app->openApp;
|
||||
if(isset($this->lang->navGroup->$openApp))
|
||||
{
|
||||
$this->app->openApp = $this->lang->navGroup->$openApp;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load configs from database and save it to config->system and config->personal.
|
||||
*
|
||||
@@ -829,7 +813,7 @@ class commonModel extends model
|
||||
}
|
||||
if($module == $currentModule and ($method == $currentMethod or strpos(",$alias,", ",$currentMethod,") !== false)) $active = 'active';
|
||||
|
||||
$label = $menuItem->text;
|
||||
$label = $menuItem->text;
|
||||
$dropMenu = '';
|
||||
/* Print sub menus. */
|
||||
if(isset($menuItem->dropMenu))
|
||||
@@ -851,7 +835,8 @@ class commonModel extends model
|
||||
|
||||
if($currentModule == strtolower($subModule) && $currentMethod == strtolower($subMethod)) $subActive = 'active';
|
||||
|
||||
$dropMenu .= "<li class='$subActive' data-id='$dropMenuItem->name'>" . html::a($subLink, $subLabel) . '</li>';
|
||||
$misc = (isset($lang->navGroup->$subModule) and $openApp != $lang->navGroup->$subModule) ? "data-app='$openApp'" : '';
|
||||
$dropMenu .= "<li class='$subActive' data-id='$dropMenuItem->name'>" . html::a($subLink, $subLabel, '', $misc) . '</li>';
|
||||
}
|
||||
|
||||
if(empty($dropMenu)) continue;
|
||||
@@ -860,8 +845,10 @@ class commonModel extends model
|
||||
$dropMenu = "<ul class='dropdown-menu'>{$dropMenu}</ul>";
|
||||
}
|
||||
|
||||
$menuItemHtml = "<li class='$class $active' data-id='$menuItem->name'>" . html::a($link, $label, $target) . $dropMenu . "</li>\n";
|
||||
if($isMobile) $menuItemHtml = html::a($link, $menuItem->text, $target, "class='$class $active'") . "\n";
|
||||
$misc = (isset($lang->navGroup->$module) and $openApp != $lang->navGroup->$module) ? "data-app='$openApp'" : '';
|
||||
$menuItemHtml = "<li class='$class $active' data-id='$menuItem->name'>" . html::a($link, $label, $target, $misc) . $dropMenu . "</li>\n";
|
||||
|
||||
if($isMobile) $menuItemHtml = html::a($link, $menuItem->text, $target, $misc . " class='$class $active'") . "\n";
|
||||
echo $menuItemHtml;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -548,8 +548,8 @@
|
||||
{
|
||||
defaultOpenUrl = decodeURIComponent(location.hash.substr(5));
|
||||
}
|
||||
if(defaultOpenUrl) openApp(defaultOpenUrl);
|
||||
else openApp(defaultApp);
|
||||
|
||||
openApp(defaultOpenUrl ? defaultOpenUrl : defaultApp);
|
||||
|
||||
/* Refresh more menu on window resize */
|
||||
$(window).on('resize', refreshMoreMenu);
|
||||
|
||||
@@ -655,7 +655,8 @@ class project extends control
|
||||
{
|
||||
$uri = $this->app->getURI(true);
|
||||
$this->app->session->set('executionList', $uri, 'project');
|
||||
$this->locate($this->createLink('execution', 'all', "status=all&projectID=$projectID", '', false));
|
||||
|
||||
echo $this->fetch('execution', 'all', "status=all&projectID=$projectID");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -61,7 +61,7 @@ class repo extends control
|
||||
$this->repo->setMenu($this->repos, $repoID);
|
||||
}
|
||||
|
||||
if(empty($this->repos) and $this->methodName != 'create') die(js::locate($this->repo->createLink('create', "objectID=$objectID")));
|
||||
if(empty($this->repos) and $this->methodName != 'create') die($this->locate($this->repo->createLink('create', "objectID=$objectID")));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user