diff --git a/module/program/ui/browse.html.php b/module/program/ui/browse.html.php index 0e3464e346..8dff3d7e6a 100644 --- a/module/program/ui/browse.html.php +++ b/module/program/ui/browse.html.php @@ -3,13 +3,14 @@ namespace zin; \commonModel::setMainMenu(); -$mainMenus = array(); +$navItems = array(); foreach(\customModel::getMainMenu() as $menuItem) { - $mainMenus[] = btn( - $menuItem->text, - set('url', \commonModel::createMenuLink($menuItem, $app->tab)), - setClass('primary'), + $navItems[] = array + ( + 'text' => $menuItem->text, + 'url' => \commonModel::createMenuLink($menuItem, $app->tab), + 'active' => $menuItem->order === 1, ); } @@ -26,38 +27,27 @@ page ), pagenavbar ( - set('menus', $mainMenus) + zuinav + ( + set('items', $navItems), + ), + ), + toolbar + ( + setId('toolbar'), + set('items', array + ( + array('icon' => 'icon-plus'), + array('icon' => 'icon-group'), + array('text' => '研发综合界面'), + ) + ), ), ), - h ('h1', 'hello2')->setClass('text-danger'), - btn - ( - 'Primary', - set('.', array('text-danger' => true)), - set('active', true), - set('icon', 'flag'), + + pagemain( + ), - icon('project'), - icon(set('name', 'project')), - div - ( - icon('star'), - setClass ('primary-pale'), - h2 ('Headings2'), - h3 ('Headings3'), - html ('
test
'), - p - ( - 'lorem', - strong('bold'), - ) - ), - to - ( - 'body', - html(''), - ), - //$listChildren ); /* diff --git a/zin/wg.func.php b/zin/wg.func.php index 8817621fb8..be306ac74b 100755 --- a/zin/wg.func.php +++ b/zin/wg.func.php @@ -30,12 +30,14 @@ function data() return core\data::$global; } -function btn() {return createWg('btn', func_get_args());} -function icon() {return createWg('icon', func_get_args());} -function pagebase() {return createWg('pagebase', func_get_args());} -function page() {return createWg('page', func_get_args());} -function dtable() {return createWg('dtable', func_get_args());} - +function btn() {return createWg('btn', func_get_args());} +function icon() {return createWg('icon', func_get_args());} +function pagebase() {return createWg('pagebase', func_get_args());} +function page() {return createWg('page', func_get_args());} +function dtable() {return createWg('dtable', func_get_args());} function pageheader() {return createWg('pageheader', func_get_args());} function pageheading() {return createWg('pageheading', func_get_args());} function pagenavbar() {return createWg('pagenavbar', func_get_args());} +function zuinav() {return createWg('zuinav', func_get_args());} +function toolbar() {return createWg('toolbar', func_get_args());} +function pagemain() {return createWg('pagemain', func_get_args());} diff --git a/zin/wg/pageheader/v1.php b/zin/wg/pageheader/v1.php index 981c597cd2..3e77691085 100644 --- a/zin/wg/pageheader/v1.php +++ b/zin/wg/pageheader/v1.php @@ -41,7 +41,7 @@ class pageheader extends \zin\core\wg return NULL; } - if(class_exists('\zin\wg\pagetoolbar') and $child instanceof \zin\wg\pagetoolbar) + if(class_exists('\zin\wg\toolbar') and $child instanceof \zin\wg\toolbar) { $this->toolbar = $child; return NULL; @@ -71,7 +71,7 @@ class pageheader extends \zin\core\wg { $builder = parent::build($isPrint, $parent); - $container = h5::div()->addClass('container'); + $container = h5::div()->addClass('container main-header'); /* Heading. */ $container->append($this->heading); diff --git a/zin/wg/pagemain/v1.php b/zin/wg/pagemain/v1.php new file mode 100644 index 0000000000..d15158055b --- /dev/null +++ b/zin/wg/pagemain/v1.php @@ -0,0 +1,20 @@ + 'main'); + + function build($isPrint = false, $parent = null) + { + $builder = parent::build($isPrint, $parent); + $builder->append(h5::div()->addClass('container')); + return $builder; + } +} diff --git a/zin/wg/pagenavbar/v1.php b/zin/wg/pagenavbar/v1.php index 31d898aa08..6a9f527cd9 100644 --- a/zin/wg/pagenavbar/v1.php +++ b/zin/wg/pagenavbar/v1.php @@ -13,44 +13,44 @@ class pagenavbar extends \zin\core\wg static $customProps = 'text,menus'; - /** - * Accept child node. - * - * @param object $child - * @param bool $strAsHtml - * @access protected - * @return mixed object|string - */ - protected function acceptChild($child, $strAsHtml = false) - { - /* Invoke parent method; */ - $child = parent::acceptChild($child, $strAsHtml); + // /** + // * Accept child node. + // * + // * @param object $child + // * @param bool $strAsHtml + // * @access protected + // * @return mixed object|string + // */ + // protected function acceptChild($child, $strAsHtml = false) + // { + // /* Invoke parent method; */ + // $child = parent::acceptChild($child, $strAsHtml); - if(!$strAsHtml && is_string($child) && !$this->props->has('text')) - { - $this->prop('text', $child); - return NULL; - } + // if(!$strAsHtml && is_string($child) && !$this->props->has('text')) + // { + // $this->prop('text', $child); + // return NULL; + // } - return $child; - } + // return $child; + // } - /** - * Build builder. - * - * @param bool $isPrint - * @param object $parent - * @access protected - * @return object - */ - protected function build($isPrint = false, $parent = NULL) - { - $builder = parent::build($isPrint, $this); + // /** + // * Build builder. + // * + // * @param bool $isPrint + // * @param object $parent + // * @access protected + // * @return object + // */ + // protected function build($isPrint = false, $parent = NULL) + // { + // $builder = parent::build($isPrint, $this); - $menu = h5::menu(\zin\setClass('nav')); - foreach($this->prop('menus') as $item) $menu->append(h5::li(\zin\setClass('nav-item'), $item)); - $builder->append($menu); + // $menu = h5::menu(\zin\setClass('nav')); + // foreach($this->prop('menus') as $item) $menu->append(h5::li(\zin\setClass('nav-item'), $item)); + // $builder->append($menu); - return $builder; - } + // return $builder; + // } } diff --git a/zin/wg/toolbar/v1.php b/zin/wg/toolbar/v1.php index e0d8ef13cd..df94f82429 100644 --- a/zin/wg/toolbar/v1.php +++ b/zin/wg/toolbar/v1.php @@ -5,12 +5,23 @@ require_once dirname(dirname(__DIR__)) . DS . 'core' . DS . 'wg.class.php'; class toolbar extends \zin\core\wg { - static $tag = 'nav'; + static $tag = 'div'; - static $defaultProps = array('class' => 'toolbar'); + static $defaultProps = array('class' => 'toolbar', 'id' => 'toolbar'); - static buildItem($item) + static $customProps = 'wrap,gap,items,btnProps,itemRender,beforeRender,afterRender,firstRender'; + + protected function build($isPrint = false, $parent = null) { - + $builder = parent::build($isPrint, $parent); + + $id = $this->prop('id'); + $builder->jsVar('options', $this->props->data); + $builder->js(<< { + const toolbar = new zui.Toolbar('#$id', options); + }); + END); + return $builder; } } diff --git a/zin/wg/zuinav/v1.php b/zin/wg/zuinav/v1.php new file mode 100755 index 0000000000..4b2ddc0e1a --- /dev/null +++ b/zin/wg/zuinav/v1.php @@ -0,0 +1,32 @@ + 'nav'); + + static $customProps = 'className,items,hasIcons,onRenderItem,afterRender'; + + /** + * @return builder + */ + protected function build($isPrint = false, $parent = NULL) + { + $builder = parent::build($isPrint, $parent); + + $id = $this->prop('id'); + $builder->jsVar('options', $this->props->data); + $builder->js(<< { + const nav = new zui.Nav('#$id', options); + }); + END); + return $builder; + } +}