diff --git a/framework/helper.class.php b/framework/helper.class.php index d1414e0fe4..7d836596fd 100644 --- a/framework/helper.class.php +++ b/framework/helper.class.php @@ -20,4 +20,39 @@ include dirname(__FILE__) . '/base/helper.class.php'; class helper extends baseHelper { + public static function getViewType() + { + global $config, $app; + if($config->requestType != 'GET') + { + $pathInfo = $app->getPathInfo(); + if(!empty($pathInfo)) + { + $dotPos = strrpos($pathInfo, '.'); + if($dotPos) + { + $viewType = substr($pathInfo, $dotPos + 1); + } + else + { + $config->default->view = $config->default->view == 'mhtml' ? 'html' : $config->default->view; + } + } + } + elseif($config->requestType == 'GET') + { + if(isset($_GET[$config->viewVar])) + { + $viewType = $_GET[$config->viewVar]; + } + else + { + /* Set default view when url has not module name. such as only domain. */ + $config->default->view = ($config->default->view == 'mhtml' and isset($_GET[$config->moduleVar])) ? 'html' : $config->default->view; + } + } + + if(isset($viewType) and strpos($config->views, ',' . $viewType . ',') === false) $viewType = $config->default->view; + return isset($viewType) ? $viewType : $config->default->view; + } } diff --git a/module/common/model.php b/module/common/model.php index 0f9095e267..58d7c9db36 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -319,8 +319,8 @@ class commonModel extends model $task = $this->lang->my->menu->task['link']; $story = $this->lang->my->menu->story['link']; $bug = $this->lang->my->menu->bug['link']; - $project = $this->lang->menu->project . '|locate=no&&status=isdoing'; - $product = $this->lang->menu->product . '|locate=no'; + $project = $this->lang->projectCommon . '|project|all|status=isdoing'; + $product = $this->lang->productCommon . '|product|all'; $menu = array('todo' => $todo, 'task' => $task, 'bug' => $bug, 'project' => $project, 'product' => $product); if($role and strpos('dev,td,pm', $role) !== false) $menu = array('todo' => $todo, 'task' => $task, 'bug' => $bug, 'product' => $product, 'project' => $project); diff --git a/module/product/view/m.index.html.php b/module/product/view/m.all.html.php similarity index 100% rename from module/product/view/m.index.html.php rename to module/product/view/m.all.html.php diff --git a/module/project/view/m.index.html.php b/module/project/view/m.all.html.php similarity index 100% rename from module/project/view/m.index.html.php rename to module/project/view/m.all.html.php diff --git a/www/index.php b/www/index.php index 739363c022..3af80e32fe 100644 --- a/www/index.php +++ b/www/index.php @@ -35,7 +35,7 @@ if(!isset($config->installed) or !$config->installed) die(header('location: inst if($app->clientDevice == 'mobile' and $config->default->view == 'html') { $config->default->view = 'mhtml'; - helper::setViewType(); + $app->viewType = helper::getViewType(); } /* Run the app. */