diff --git a/module/cron/model.php b/module/cron/model.php
index 83fcaf2555..fab061af6c 100644
--- a/module/cron/model.php
+++ b/module/cron/model.php
@@ -121,7 +121,8 @@ class cronModel extends model
*/
public function getLastTime()
{
- return $this->dao->select('*')->from(TABLE_CRON)->orderBy('lastTime desc')->limit(1)->fetch('lastTime');
+ $cron = $this->dao->select('*')->from(TABLE_CRON)->orderBy('lastTime desc')->limit(1)->fetch();
+ return isset($cron->lastTime) ? $cron->lastTime : $cron->lasttime;
}
/**
diff --git a/module/dev/model.php b/module/dev/model.php
index c46d651d88..959db50767 100644
--- a/module/dev/model.php
+++ b/module/dev/model.php
@@ -137,16 +137,16 @@ class devModel extends model
$apis = array();
foreach($methods as $method)
{
- if($method->class == 'control' or $method->name == '__construct') continue;
+ if($method->class == 'baseControl' or $method->class == 'control' or $method->name == '__construct') continue;
$api = array('name' => $method->name, 'post' => false, 'default' => array());
$methodReflect = new ReflectionMethod($module, $method->name);
foreach($methodReflect->getParameters() as $key => $param)
{
- if($param->isOptional())
+ try
{
$api['default'][$param->getName()] = $param->getDefaultValue();
- }
+ }catch(ReflectionException $e){}
}
$startLine = $methodReflect->getStartLine();
$endLine = $methodReflect->getEndLine();
diff --git a/module/doc/control.php b/module/doc/control.php
index 946462c3af..77f2d56096 100644
--- a/module/doc/control.php
+++ b/module/doc/control.php
@@ -41,9 +41,9 @@ class doc extends control
unset($this->lang->doc->menu->index);
$this->doc->setMenu(array($this->lang->doclib->select));
- $products = $this->doc->getLimitLibs('product');
- $projects = $this->doc->getLimitLibs('project');
- $customLibs = $this->doc->getLimitLibs('custom');
+ $products = $this->doc->getLimitLibs('product', '9');
+ $projects = $this->doc->getLimitLibs('project', '9');
+ $customLibs = $this->doc->getLimitLibs('custom', '9');
$subLibs['product'] = $this->doc->getSubLibGroups('product', array_keys($products));
$subLibs['project'] = $this->doc->getSubLibGroups('project', array_keys($projects));
@@ -645,6 +645,17 @@ class doc extends control
die(js::reload('parent'));
}
+ /**
+ * Ajax get all libs
+ *
+ * @access public
+ * @return void
+ */
+ public function ajaxGetAllLibs()
+ {
+ die(json_encode($this->doc->getAllLibGroups()));
+ }
+
/**
* Show all libs by type.
*
@@ -656,7 +667,7 @@ class doc extends control
* @access public
* @return void
*/
- public function allLibs($type, $extra = '', $recTotal = 0, $recPerPage = 30, $pageID = 1)
+ public function allLibs($type, $extra = '', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$libName = isset($this->lang->doc->systemLibs[$type]) ? $this->lang->doc->systemLibs[$type] : $this->lang->doc->custom;
$this->doc->setMenu(array($this->lang->doclib->select), 0, $type);
@@ -668,7 +679,7 @@ class doc extends control
$this->app->loadClass('pager', $static = true);
$pager = new pager($recTotal, $recPerPage, $pageID);
- $libs = $this->doc->getAllLibs($type, $pager, $extra);
+ $libs = $this->doc->getAllLibsByType($type, $pager, $extra);
$subLibs = array();
if($type == 'product' or $type == 'project') $subLibs = $this->doc->getSubLibGroups($type, array_keys($libs));
if($extra)
diff --git a/module/doc/css/alllibs.css b/module/doc/css/alllibs.css
index e4ef269299..69889454da 100644
--- a/module/doc/css/alllibs.css
+++ b/module/doc/css/alllibs.css
@@ -1,2 +1,3 @@
-#libs table td{border-right:1px solid #ddd; width:33%;vertical-align: top; padding:0px; overflow:hidden}
-#libs table td.none{border-right:0px}
+#libs .libs-group-heading{border:1px solid #ddd;overflow:hidden}
+#libs .libs-group{border:1px solid #ddd; border-top:0px;overflow:hidden; margin-bottom:20px;}
+#libs .lib-custom{width:130px; margin-bottom:10px;}
diff --git a/module/doc/css/common.css b/module/doc/css/common.css
index 5d699e79e9..3db09226aa 100644
--- a/module/doc/css/common.css
+++ b/module/doc/css/common.css
@@ -1,12 +1,16 @@
-.libs-group-heading {color: #808080; border-bottom:1px solid #ddd; padding:8px; text-align:center; background:#DDF3F5}
-.libs-group-heading a{display:block;width:100%;height:100%; overflow: hidden; white-space: nowrap;}
+.libs-group-heading {color: #808080; border-bottom:1px solid #ddd; padding:8px;}
+.libs-group-heading a{overflow: hidden; white-space: nowrap;}
.libs-group{padding:10px 10px 10px 10px;}
.lib {float: left; display: block; width:80px; padding: 5px; margin:0px 3px; text-align: center; color: #333; overflow: hidden; text-overflow: ellipsis;}
-.lib .file-icon{font-size:30px;}
-.lib .lib-name{height: 2em; line-height: 14px; overflow: hidden;}
+.lib .file-icon{margin-bottom:5px;}
+.lib .lib-name{overflow: hidden; white-space: nowrap;}
.lib:hover, .lib:focus, .lib:active {border-color: #2e6dad; background-color: #EBF2F9; color: #2e6dad}
.crumb{margin-right:10px;}
+.w-lib-p100{width:100%;}
+.w-lib-p50{width:47%;}
+.w-lib-p33{width:31%;}
#titlebar > .heading > strong > i{display:inline;}
#modulemenu .nav > li > .dropdown > a#libType{display:inline-block;}
#modulemenu .nav > li > .dropdown.open > a#libType{background:#e5e5e5;}
+#groups_chosen .chosen-choices {border-right:0px;}
diff --git a/module/doc/css/index.css b/module/doc/css/index.css
index 98cf3d7588..674e43389d 100644
--- a/module/doc/css/index.css
+++ b/module/doc/css/index.css
@@ -1,11 +1,10 @@
.lib-heading{border-right:1px solid #ddd;}
-#libs table td.row{padding:0px;}
-#libs table td.none{border-right:0px}
-#libs table td.lib-more{border-left:1px solid #ddd;}
-#libs table td.lib-more a.more{display:block;width:100%;height:100%}
-.table.project,.table.product{border:0px;}
-.table.project tbody td,.table.product tbody td{border-right:1px solid #ddd; width:33.3%;vertical-align: top; padding:0px;}
-.table.project tbody tr > td:first-child,.table.product tbody tr > td:first-child{padding:0px;}
-.table.project tbody tr > td:last-child,.table.product tbody tr > td:last-child{padding:0px;}
-.table.project td:last-child,.table.product td:last-child{border-right:0px;}
-.table.project tbody > tr:last-child td,.table.product tbody > tr:last-child td{border-bottom:0px;}
+.lib-more a.more{font-weight:bold; display:block;}
+#libs .libs-group-heading{border:1px solid #ddd;}
+#libs .libs-group{border:1px solid #ddd; border-top:0px; margin-bottom:20px;}
+#libs .libs-group.lib-more{border:0px; text-align:center; height:128px; line-height:110px;}
+#libs .libs-group.lib-more:hover{background-color: #EBF2F9}
+#libs .libs-custom-heading{text-align:left; height:128px;}
+#libs .libs-custom-heading:hover{background-color: #EBF2F9}
+#libs .libs-custom-heading a{display:block;height:100%;}
+#libs hr {margin-top:0px;}
diff --git a/module/doc/css/objectlibs.css b/module/doc/css/objectlibs.css
new file mode 100644
index 0000000000..8cc1949f0d
--- /dev/null
+++ b/module/doc/css/objectlibs.css
@@ -0,0 +1 @@
+.lib {width:130px; margin-bottom:10px;}
diff --git a/module/doc/lang/en.php b/module/doc/lang/en.php
index 15a3def223..9e05b61d54 100644
--- a/module/doc/lang/en.php
+++ b/module/doc/lang/en.php
@@ -58,6 +58,7 @@ $lang->doc->addType = 'Add Type';
$lang->doc->libName = 'Library Name';
$lang->doc->libType = 'Library Type';
$lang->doc->custom = 'Custom Library';
+$lang->doc->customAB = 'Custom';
$lang->doc->createLib = 'Create Library';
$lang->doc->allLibs = 'Library List';
$lang->doc->objectLibs = "{$lang->productCommon}/{$lang->projectCommon} Library List";
diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php
index e189d668a4..fdfbd2ccb7 100644
--- a/module/doc/lang/zh-cn.php
+++ b/module/doc/lang/zh-cn.php
@@ -58,6 +58,7 @@ $lang->doc->addType = '增加分类';
$lang->doc->libName = '文档库名称';
$lang->doc->libType = '文档库类型';
$lang->doc->custom = '自定义文档库';
+$lang->doc->customAB = '自定义';
$lang->doc->createLib = '创建文档库';
$lang->doc->allLibs = '文档库列表';
$lang->doc->objectLibs = "{$lang->productCommon}/{$lang->projectCommon}库列表";
diff --git a/module/doc/model.php b/module/doc/model.php
index 37c53b4752..cf1113014e 100644
--- a/module/doc/model.php
+++ b/module/doc/model.php
@@ -634,9 +634,9 @@ class docModel extends model
* @param int $pager
* @param string $extra
* @access public
- * @return void
+ * @return array
*/
- public function getAllLibs($type, $pager = null, $extra = '')
+ public function getAllLibsByType($type, $pager = null, $extra = '')
{
if($extra)
{
@@ -658,7 +658,7 @@ class docModel extends model
if(isset($projects)) $stmt = $stmt->andWhere('project')->in($projects);
$condition = $this->buildConditionSQL();
- $idList = $stmt->beginIF($condition)->andWhere("($condition)")->fi()->orderBy("{$key}_desc")->page($pager)->fetchPairs($key, $key);
+ $idList = $stmt->beginIF($condition)->andWhere("($condition)")->fi()->orderBy("{$key}_desc")->page($pager, $key)->fetchPairs($key, $key);
if($type == 'product' or $type == 'project')
{
@@ -673,6 +673,65 @@ class docModel extends model
return $libs;
}
+ /**
+ * Get all lib groups.
+ *
+ * @access public
+ * @return array
+ */
+ public function getAllLibGroups()
+ {
+ $condition = $this->buildConditionSQL();
+ $stmt = $this->dao->select("id,product,project,name")->from(TABLE_DOCLIB)
+ ->where('deleted')->eq(0)
+ ->beginIF($condition)->andWhere("($condition)")->fi()
+ ->orderBy("product desc,project desc, id asc")
+ ->query();
+
+ $customLibs = array();
+ $productLibs = array();
+ $projectLibs = array();
+ while($lib = $stmt->fetch())
+ {
+ if($lib->product)
+ {
+ $productLibs[$lib->product][$lib->id] = $lib->name;
+ }
+ elseif($lib->project)
+ {
+ $projectLibs[$lib->project][$lib->id] = $lib->name;
+ }
+ else
+ {
+ $customLibs[$lib->id] = $lib->name;
+ }
+ }
+ $productIdList = array_keys($productLibs);
+ $products = $this->dao->select('id,name')->from(TABLE_PRODUCT)->where('id')->in($productIdList)->andWhere('deleted')->eq('0')->orderBy('`order`_desc')->fetchPairs('id', 'name');
+ $hasProject = $this->dao->select('DISTINCT product')->from(TABLE_PROJECTPRODUCT)->alias('t1')
+ ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id')
+ ->where('t1.product')->in($productIdList)
+ ->andWhere('t2.deleted')->eq(0)
+ ->fetchPairs('product', 'product');
+
+ $hasLibsPriv = common::hasPriv('doc', 'allLibs');
+ $hasFilesPriv = common::hasPriv('doc', 'showFiles');
+ foreach($products as $productID => $productName)
+ {
+ foreach($productLibs[$productID] as $libID => $libName) $productLibs[$productID][$libID] = $productName . ' / ' . $libName;
+ if(isset($hasProject[$productID]) and $hasLibsPriv) $productLibs[$productID]['project'] = $productName . ' / ' . $this->lang->doc->systemLibs['project'];
+ if($hasFilesPriv) $productLibs[$productID]['files'] = $productName . ' / ' . $this->lang->doclib->files;
+ }
+ $projects = $this->dao->select('id,name')->from(TABLE_PROJECT)->where('id')->in(array_keys($projectLibs))->andWhere('deleted')->eq('0')->orderBy('`order`_desc')->fetchPairs('id', 'name');
+ foreach($projects as $projectID => $projectName)
+ {
+ foreach($projectLibs[$projectID] as $libID => $libName) $projectLibs[$projectID][$libID] = $projectName . ' / ' . $libName;
+ if($hasFilesPriv) $projectLibs[$projectID]['files'] = $productName . ' / ' . $this->lang->doclib->files;
+ }
+
+ return array('product' => $productLibs, 'project' => $projectLibs, 'custom' => $customLibs);
+ }
+
/**
* Get limit libs.
*
@@ -681,7 +740,7 @@ class docModel extends model
* @access public
* @return array
*/
- public function getLimitLibs($type, $limit = 6)
+ public function getLimitLibs($type, $limit = 4)
{
if($type == 'product' or $type == 'project')
{
diff --git a/module/doc/view/alllibs.html.php b/module/doc/view/alllibs.html.php
index b0e7741177..07c5ec4a14 100644
--- a/module/doc/view/alllibs.html.php
+++ b/module/doc/view/alllibs.html.php
@@ -14,48 +14,49 @@
doc->systemLibs[$type]) ? $lang->doc->systemLibs[$type] : $lang->doc->custom?>
-
-
+
id])): ?>
- "?>
-
- id&from=doc"), $lib->name, '', "title='{$lib->name}'")?>
+
+ id]);
+ ?>
+
+ id&from=doc"), $lib->name, '', "title='{$lib->name}'");
+ if($subLibCount > 3) echo html::a(inlink('objectLibs', "type=$type&objectID=$lib->id&from=doc"), "{$lang->more}", '', "title='{$lang->more}' class='pull-right'");
+ ?>
+
+ = 3) $widthClass = 'w-lib-p33';
+ ?>
id] as $subLibID => $subLibName):?>
id");
elseif($subLibID == 'files') $libLink = inlink('showFiles', "type=$type&objectID=$lib->id");
else $libLink = inlink('browse', "libID=$subLibID");
?>
-
-
+
+ ' class='file-icon' />
+ = 2) break;?>
+
- |
-
- "?>
+
- ";
- $i++;
- }
- echo "";
- }
- ?>
-
+
-
+
+
diff --git a/module/doc/view/browse.html.php b/module/doc/view/browse.html.php
index efe653aaa2..a68be44854 100644
--- a/module/doc/view/browse.html.php
+++ b/module/doc/view/browse.html.php
@@ -25,7 +25,7 @@ var browseType = '';
-
+
- doc->allDoc)?>
- doc->openedByMe)?>
@@ -36,7 +36,7 @@ var browseType = '';