diff --git a/module/doc/control.php b/module/doc/control.php index 47939b5b50..e841c5e332 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -175,10 +175,12 @@ class doc extends control /** * Create a library. * + * @param string $type + * @param int $objectID * @access public * @return void */ - public function createLib() + public function createLib($type = '', $objectID = 0) { if(!empty($_POST)) { @@ -197,6 +199,8 @@ class doc extends control $this->view->users = $this->user->getPairs('nocode'); $this->view->products = $this->product->getPairs('nocode'); $this->view->projects = $this->project->getPairs('nocode'); + $this->view->type = $type; + $this->view->objectID = $objectID; die($this->display()); } @@ -616,7 +620,8 @@ class doc extends control { $this->view->product = $this->product->getById($product); $libName = $this->view->product->name; - $crumb = html::a(inlink('objectLibs', "type=product&objectID=$product"), $this->view->product->name); + $crumb = html::a(inlink('allLibs', "type=product"), $this->lang->productCommon) . $this->lang->arrow; + $crumb .= html::a(inlink('objectLibs', "type=product&objectID=$product"), $this->view->product->name); $crumb .= $this->lang->arrow . html::a(inlink('allLibs', "type=$type&product=$product"), $this->lang->doclib->main[$type]); } @@ -676,7 +681,8 @@ class doc extends control } else { - $crumb = html::a(inlink('objectLibs', "type=$type&objectID=$objectID"), $object->name); + $crumb = html::a(inlink('allLibs', "type=$type"), $type == 'product' ? $this->lang->productCommon : $this->lang->projectCommon) . $this->lang->arrow; + $crumb .= html::a(inlink('objectLibs', "type=$type&objectID=$objectID"), $object->name); $this->doc->setMenu($libID = 0, $moduleID = 0, $crumb); } @@ -726,7 +732,8 @@ class doc extends control } else { - $crumb = html::a(inlink('objectLibs', "type=$type&objectID=$objectID"), $object->name); + $crumb = html::a(inlink('allLibs', "type=$type"), $type == 'product' ? $this->lang->productCommon : $this->lang->projectCommon) . $this->lang->arrow; + $crumb .= html::a(inlink('objectLibs', "type=$type&objectID=$objectID"), $object->name); $this->doc->setMenu($libID = 0, $moduleID = 0, $crumb); } diff --git a/module/doc/css/objectlibs.css b/module/doc/css/objectlibs.css index 8cc1949f0d..2af3b9d879 100644 --- a/module/doc/css/objectlibs.css +++ b/module/doc/css/objectlibs.css @@ -1 +1,4 @@ .lib {width:130px; margin-bottom:10px;} +.addbtn{padding-top:22px;height:63px; border:1px dashed #ddd; width:60px;} +.addbtn .icon-plus {font-size: 18px; display: block; opacity: 0.5; transition: opacity .2s; text-shadow: 1px 1px 3px rgba(0,0,0,.2);} +.addbtn:hover .icon-plus {opacity: .9; animation: flash-icon 1s linear alternate infinite} diff --git a/module/doc/js/createlib.js b/module/doc/js/createlib.js index 30445cd5b5..1bcfaa6aeb 100644 --- a/module/doc/js/createlib.js +++ b/module/doc/js/createlib.js @@ -3,21 +3,27 @@ $(function() $('#libType').change(function() { var libType = $(this).val(); - if(libType == 'product') - { - $('table tr.product').removeClass('hidden'); - $('table tr.project').addClass('hidden'); - } - else if(libType == 'project') - { - $('table tr.product').addClass('hidden'); - $('table tr.project').removeClass('hidden'); - } - else - { - $('table tr.product').addClass('hidden'); - $('table tr.project').addClass('hidden'); - } + changeByLibType(libType); }) + changeByLibType($('#libType').val()); toggleAcl($('#acl').val()); }); + +function changeByLibType(libType) +{ + if(libType == 'product') + { + $('table tr.product').removeClass('hidden'); + $('table tr.project').addClass('hidden'); + } + else if(libType == 'project') + { + $('table tr.product').addClass('hidden'); + $('table tr.project').removeClass('hidden'); + } + else + { + $('table tr.product').addClass('hidden'); + $('table tr.project').addClass('hidden'); + } +} diff --git a/module/doc/model.php b/module/doc/model.php index b772741ecc..b9d397404b 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -1182,17 +1182,22 @@ class docModel extends model die(js::locate('back')); } + $type = $lib->product ? 'product' : 'custom'; + $type = $lib->project ? 'project' : $type; + + $mainLib = $type == 'product' ? $this->lang->productCommon : $this->lang->doc->customAB; + $mainLib = $type == 'project' ? $this->lang->projectCommon : $mainLib; + $crumb = html::a(helper::createLink('doc', 'allLibs', "type=$type"), $mainLib) . $this->lang->arrow; if($lib->product or $lib->project) { - $table = $lib->product ? TABLE_PRODUCT : TABLE_PROJECT; - $objectID = $lib->product ? $lib->product : $lib->project; - $object = $this->dao->select('id,name')->from($table)->where('id')->eq($objectID)->fetch(); - $lib->name = $object->name . ' / ' . $lib->name; + $table = $lib->product ? TABLE_PRODUCT : TABLE_PROJECT; + $objectID = $lib->product ? $lib->product : $lib->project; + $object = $this->dao->select('id,name')->from($table)->where('id')->eq($objectID)->fetch(); + if($object) $crumb .= html::a(helper::createLink('doc', 'objectLibs', "type=$type&objectID=$objectID"), $object->name) . $this->lang->arrow; } - $parents = $moduleID ? $this->loadModel('tree')->getParents($moduleID) : array(); - $crumb = html::a(helper::createLink('doc', 'browse', "libID=$libID&browseType=all¶m=0&orderBy=id_desc"), $lib->name); + $crumb .= html::a(helper::createLink('doc', 'browse', "libID=$libID&browseType=all¶m=0&orderBy=id_desc"), $lib->name); foreach($parents as $module) $crumb .= $this->lang->arrow . html::a(helper::createLink('doc', 'browse', "libID=$libID&browseType=byModule¶m=$module->id&orderBy=id_desc"), $module->name); return $crumb; } diff --git a/module/doc/view/createlib.html.php b/module/doc/view/createlib.html.php index f5110612d7..36bf2c51ef 100644 --- a/module/doc/view/createlib.html.php +++ b/module/doc/view/createlib.html.php @@ -23,15 +23,15 @@ - + - + - + diff --git a/module/doc/view/objectlibs.html.php b/module/doc/view/objectlibs.html.php index 7ed522662e..06e1d19326 100644 --- a/module/doc/view/objectlibs.html.php +++ b/module/doc/view/objectlibs.html.php @@ -30,6 +30,7 @@
+ id}"), "", '', "class='lib addbtn' data-toggle='modal' data-type='iframe' title='{$lang->doc->createLib}'")?>
doc->libType?>doc->libTypeList, 'product', "class='form-control'")?>doc->libTypeList, $type, "class='form-control'")?>
doc->product?>
doclib->name?>