From 0f1d1dd275372ab606586cef1867098a4c2204df Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 5 Apr 2017 09:51:33 +0800 Subject: [PATCH] * change for web. --- module/common/model.php | 10 ++++---- module/custom/config.php | 3 +++ module/custom/model.php | 5 +++- module/doc/view/showfiles.html.php | 34 +++++++++++++++++++++++++++- module/product/control.php | 4 ++-- module/product/model.php | 13 +++++++++-- module/product/view/dynamic.html.php | 1 - tools/syncext.sh | 4 ++-- 8 files changed, 61 insertions(+), 13 deletions(-) diff --git a/module/common/model.php b/module/common/model.php index 6f9bd54cde..1972173ea2 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -440,6 +440,7 @@ class commonModel extends model foreach($menu as $menuItem) { if(isset($menuItem->hidden) && $menuItem->hidden) continue; + if($isMobile and empty($menuItem->link)) continue; /* Init the these vars. */ if($menuItem->link) @@ -565,6 +566,7 @@ class commonModel extends model if(empty($module)) $module = $app->getModuleName(); if(empty($method)) $method = $app->getMethodName(); $className = 'header'; + $isMobile = $app->viewType === 'mhtml'; $order = explode('_', $orderBy); $order[0] = trim($order[0], '`'); @@ -573,12 +575,12 @@ class commonModel extends model if(isset($order[1]) and $order[1] == 'asc') { $orderBy = "{$order[0]}_desc"; - $className = 'headerSortDown'; + $className = $isMobile ? 'SortDown' : 'headerSortDown'; } else { $orderBy = "{$order[0]}_asc"; - $className = 'headerSortUp'; + $className = $isMobile ? 'SortUp' : 'headerSortUp'; } } else @@ -587,7 +589,7 @@ class commonModel extends model $className = 'header'; } $link = helper::createLink($module, $method, sprintf($vars, $orderBy)); - echo "
" . html::a($link, $label) . '
'; + echo $isMobile ? html::a($link, $label, '', "class='$className'") : "
" . html::a($link, $label) . '
'; } /** @@ -715,7 +717,7 @@ class commonModel extends model { if($app->getViewType() == 'mhtml') { - return html::a($link, $title, $target, "class='$extraClass' data-role='button' data-mini='true' data-inline='true' data-theme='b'", true); + return "$title"; } if($type == 'button') { diff --git a/module/custom/config.php b/module/custom/config.php index 1b04fa8303..e0da77e4ef 100644 --- a/module/custom/config.php +++ b/module/custom/config.php @@ -8,3 +8,6 @@ $config->custom->canAdd['testtask'] = 'priList'; $config->custom->canAdd['todo'] = 'priList,typeList'; $config->custom->canAdd['user'] = 'roleList'; $config->custom->canAdd['block'] = ''; + +$config->custom->moblieHidden['main'] = array('repo'); +$config->custom->moblieHidden['product'] = array('branch', 'module', 'create'); diff --git a/module/custom/model.php b/module/custom/model.php index 8fd0c7734a..a792f34d21 100644 --- a/module/custom/model.php +++ b/module/custom/model.php @@ -134,6 +134,7 @@ class customModel extends model { global $app, $lang, $config; $menu = array(); + $menuModuleName = $module; $order = 1; $customMenuMap = array(); $isTutorialMode = commonModel::isTutorialMode(); @@ -254,6 +255,9 @@ class customModel extends model if($hidden) $menuItem->hidden = $hidden; if($isTutorialMode) $menuItem->tutorial = true; + /* Hidden menu by config in mobile. */ + if($app->viewType == 'mhtml' and isset($config->custom->moblieHidden[$menuModuleName]) and in_array($name, $config->custom->moblieHidden[$menuModuleName])) $menuItem->hidden = 1; + while(isset($menu[$menuItem->order])) $menuItem->order++; $menu[$menuItem->order] = $menuItem; } @@ -283,7 +287,6 @@ class customModel extends model $customMenu = isset($config->customMenu->$module) ? $config->customMenu->$module : array(); if(commonModel::isTutorialMode() && $module === 'main')$customMenu = 'my,product,project,qa,company'; if(!empty($customMenu) && is_string($customMenu) && substr($customMenu, 0, 1) === '[') $customMenu = json_decode($customMenu); - if($app->viewType == 'mhtml') $customMenu = array(); $menu = self::setMenuByConfig($allMenu, $customMenu, $module); diff --git a/module/doc/view/showfiles.html.php b/module/doc/view/showfiles.html.php index 3486858804..2338f88ada 100644 --- a/module/doc/view/showfiles.html.php +++ b/module/doc/view/showfiles.html.php @@ -20,7 +20,15 @@ pathname)) continue;?>
show();?>
+ diff --git a/module/product/control.php b/module/product/control.php index a04fdee596..43c9f2a44b 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -564,7 +564,7 @@ class product extends control $this->view->method = $method; $this->view->extra = $extra; - $products = $this->dao->select('*')->from(TABLE_PRODUCT)->where('id')->in(array_keys($this->products))->orderBy('`order` desc')->fetchAll(); + $products = $this->dao->select('*')->from(TABLE_PRODUCT)->where('id')->in(array_keys($this->products))->orderBy('`order` desc')->fetchAll('id'); $productPairs = array(); foreach($products as $product) $productPairs[$product->id] = $product->name; $productsPinyin = common::convert2Pinyin($productPairs); @@ -629,7 +629,7 @@ class product extends control { $this->session->set('productList', $this->app->getURI(true)); $productID = $this->product->saveState($productID, $this->products); - if($this->app->getViewType() != 'mhtml') $this->product->setMenu($this->products, $productID); + $this->product->setMenu($this->products, $productID); /* Load pager and get tasks. */ $this->app->loadClass('pager', $static = true); diff --git a/module/product/model.php b/module/product/model.php index 2358b0656e..70ecbb84fa 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -66,11 +66,13 @@ class productModel extends model unset($this->lang->product->menu->branch); return; } + $isMobile = $this->app->viewType == 'mhtml'; setCookie("lastProduct", $productID, $this->config->cookieLife, $this->config->webRoot); $currentProduct = $this->getById($productID); $this->session->set('currentProductType', $currentProduct->type); $output = "
{$currentProduct->name}
"; + if($isMobile) $output = "{$currentProduct->name} "; if($currentProduct->type == 'normal') unset($this->lang->product->menu->branch); if($currentProduct->type != 'normal') { @@ -78,8 +80,15 @@ class productModel extends model $this->lang->product->menu->branch = str_replace('@branch@', $this->lang->product->branchName[$currentProduct->type], $this->lang->product->menu->branch); $branches = $this->loadModel('branch')->getPairs($productID); $branchName = isset($branches[$branch]) ? $branches[$branch] : $branches[0]; - $output .= '
  • '; - $output .= "{$branchName}
    "; + if(!$isMobile) + { + $output .= '
  • '; + $output .= "{$branchName}
    "; + } + else + { + $output .= "{$branchName} "; + } } return $output; } diff --git a/module/product/view/dynamic.html.php b/module/product/view/dynamic.html.php index 4c2eec0b98..c18dd79ca1 100755 --- a/module/product/view/dynamic.html.php +++ b/module/product/view/dynamic.html.php @@ -41,7 +41,6 @@ - objectType == 'case' ? 'testcase' : $action->objectType;?> date;?> actor]) ? print($users[$action->actor]) : print($action->actor);?> diff --git a/tools/syncext.sh b/tools/syncext.sh index 9ebc46b7f8..5758d28219 100755 --- a/tools/syncext.sh +++ b/tools/syncext.sh @@ -24,7 +24,7 @@ src=$1/ dest=$2/ # Rsync when the shell load first. -rsync -aqP --exclude="db/" --exclude="doc/" $src $dest +rsync -aqP --exclude="db/" $src $dest echo `date "+%H:%M:%S"` sync $src to $dest succssfully. # Watch the $src directory, and sync files to destination. @@ -56,7 +56,7 @@ while read watcher event file ; do else echo `date "+%H:%M:%S"` $path2process copied. - rsync -aqP --exclude='db/' --exclude='doc/' $src/ $dest + rsync -aqP --exclude='db/' $src/ $dest fi done