* change for web.

This commit is contained in:
wangyidong
2017-04-05 09:51:33 +08:00
parent a0aac0368e
commit 0f1d1dd275
8 changed files with 61 additions and 13 deletions

View File

@@ -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 "<div class='$className'>" . html::a($link, $label) . '</div>';
echo $isMobile ? html::a($link, $label, '', "class='$className'") : "<div class='$className'>" . html::a($link, $label) . '</div>';
}
/**
@@ -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 "<a data-remote='$link' class='$extraClass' $misc>$title</a>";
}
if($type == 'button')
{

View File

@@ -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');

View File

@@ -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);

View File

@@ -20,7 +20,15 @@
<?php if(empty($file->pathname)) continue;?>
<div class='col-md-3'>
<div class='card lib-file'>
<a class='media-wrapper' title='<?php echo $file->title . '.' . $file->extension?>' target='_blank' href='<?php echo $this->createLink('file', 'download', "fileID=$file->id&mouse=left") ?>'>
<?php
$imageWidth = 0;
if(stripos('jpg|jpeg|gif|png|bmp', $file->extension) !== false and file_exists($file->realPath))
{
$imageSize = getimagesize($file->realPath);
$imageWidth = $imageSize ? $imageSize[0] : 0;
}
?>
<a class='media-wrapper' href='###' title='<?php echo $file->title . '.' . $file->extension?>' target='_blank' onclick="return downloadFile(<?php echo $file->id?>, '<?php echo $file->extension?>', <?php echo $imageWidth?>)">
<?php
$downloadLink = $this->createLink('file', 'download', "fileID=$file->id&mouse=left");
if(in_array($file->extension, $config->file->imageExtensions))
@@ -54,4 +62,28 @@
</div>
<div class='clearfix pager-wrapper'><?php $pager->show();?></div>
<?php js::set('type', 'doc');?>
<script>
<?php
$sessionString = $config->requestType == 'PATH_INFO' ? '?' : '&';
$sessionString .= session_name() . '=' . session_id();
?>
function downloadFile(fileID, extension, imageWidth)
{
if(!fileID) return;
var fileTypes = 'txt,jpg,jpeg,gif,png,bmp';
var sessionString = '<?php echo $sessionString;?>';
var windowWidth = $(window).width();
var url = createLink('file', 'download', 'fileID=' + fileID + '&mouse=left') + sessionString;
width = (windowWidth > imageWidth) ? ((imageWidth < windowWidth*0.5) ? windowWidth*0.5 : imageWidth) : windowWidth;
if(fileTypes.indexOf(extension) >= 0)
{
$('<a>').modalTrigger({url: url, type: 'iframe', width: width}).trigger('click');
}
else
{
window.open(url, '_blank');
}
return false;
}
</script>
<?php include '../../common/view/footer.html.php';?>

View File

@@ -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);

View File

@@ -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 = "<a id='currentItem' href=\"javascript:showSearchMenu('product', '$productID', '$currentModule', '$currentMethod', '$extra')\">{$currentProduct->name} <span class='icon-caret-down'></span></a><div id='dropMenu'><i class='icon icon-spin icon-spinner'></i></div>";
if($isMobile) $output = "<a id='currentItem' href=\"javascript:showSearchMenu('product', '$productID', '$currentModule', '$currentMethod', '$extra')\">{$currentProduct->name} <span class='icon-caret-down'></span></a><div id='currentItemDropMenu' class='hidden affix enter-from-bottom layer'></div>";
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 .= '</li><li>';
$output .= "<a id='currentBranch' href=\"javascript:showSearchMenu('branch', '$productID', '$currentModule', '$currentMethod', '$extra')\">{$branchName} <span class='icon-caret-down'></span></a><div id='dropMenu'><i class='icon icon-spin icon-spinner'></i></div>";
if(!$isMobile)
{
$output .= '</li><li>';
$output .= "<a id='currentBranch' href=\"javascript:showSearchMenu('branch', '$productID', '$currentModule', '$currentMethod', '$extra')\">{$branchName} <span class='icon-caret-down'></span></a><div id='dropMenu'><i class='icon icon-spin icon-spinner'></i></div>";
}
else
{
$output .= "<a id='currentBranch' href=\"javascript:showSearchMenu('branch', '$productID', '$currentModule', '$currentMethod', '$extra')\">{$branchName} <span class='icon-caret-down'></span></a><div id='currentBranchDropMenu' class='hidden affix enter-from-bottom layer'></div>";
}
}
return $output;
}

View File

@@ -41,7 +41,6 @@
</thead>
<tbody>
<?php foreach($actions as $action):?>
<?php $module = $action->objectType == 'case' ? 'testcase' : $action->objectType;?>
<tr class='text-center'>
<td><?php echo $action->date;?></td>
<td><?php isset($users[$action->actor]) ? print($users[$action->actor]) : print($action->actor);?></td>

View File

@@ -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