From bf9ad2a7354a3e9e2141446c61005ec63acf9d23 Mon Sep 17 00:00:00 2001 From: sunhao Date: Tue, 29 Aug 2023 17:56:05 +0800 Subject: [PATCH] * zin: refactor to compatible with php 5.4. --- lib/zin/core/props.class.php | 4 +- lib/zin/core/set.class.php | 10 +- lib/zin/utils/classlist.class.php | 32 +---- lib/zin/utils/dataset.class.php | 2 +- lib/zin/utils/hx.class.php | 126 ------------------- lib/zin/utils/style.class.php | 23 ---- lib/zin/wg/checkbox/v1.php | 4 +- lib/zin/wg/control/v1.php | 2 +- lib/zin/wg/featurebar/v1.php | 2 +- lib/zin/wg/formbase/v1.php | 6 +- lib/zin/wg/formbatchitem/v1.php | 4 +- lib/zin/wg/formgroup/v1.php | 6 +- lib/zin/wg/formpanel/v1.php | 2 +- lib/zin/wg/formrow/v1.php | 2 +- lib/zin/wg/main/v1.php | 4 +- lib/zin/wg/mindmap/v1.php | 2 +- lib/zin/wg/modalheader/v1.php | 4 +- lib/zin/wg/pagebase/v1.php | 4 +- lib/zin/wg/searchtoggle/v1.php | 2 +- lib/zin/wg/sidebar/v1.php | 2 +- lib/zin/wg/stepseditor/v1.php | 8 +- lib/zin/wg/tablechart/v1.php | 8 +- lib/zin/wg/tabs/v1.php | 2 +- module/account/ui/view.html.php | 2 +- module/compile/ui/logs.html.php | 2 +- module/gitea/ui/binduser.html.php | 2 +- module/gitlab/ui/binduser.html.php | 2 +- module/gogs/ui/binduser.html.php | 2 +- module/host/ui/view.html.php | 2 +- module/instance/ui/view.html.php | 10 +- module/job/ui/view.html.php | 2 +- module/mr/ui/diff.html.php | 16 +-- module/repo/ui/ajaxgeteditorcontent.html.php | 20 +-- module/repo/ui/browse.html.php | 16 +-- module/repo/ui/diffeditor.html.php | 12 +- module/repo/ui/monaco.html.php | 12 +- module/repo/ui/showsynccommit.html.php | 2 +- module/search/ui/savezinquery.html.php | 6 +- module/serverroom/ui/view.html.php | 2 +- 39 files changed, 100 insertions(+), 271 deletions(-) delete mode 100644 lib/zin/utils/hx.class.php diff --git a/lib/zin/core/props.class.php b/lib/zin/core/props.class.php index 184847f0b3..34653dce15 100644 --- a/lib/zin/core/props.class.php +++ b/lib/zin/core/props.class.php @@ -50,8 +50,8 @@ class props extends \zin\utils\dataset */ public function __construct(array $props = array()) { - $this->style = style::new(); - $this->class = classlist::new(); + $this->style = new style(); + $this->class = new classlist(); parent::__construct($props); } diff --git a/lib/zin/core/set.class.php b/lib/zin/core/set.class.php index e65ad61e2a..d3de9e076c 100644 --- a/lib/zin/core/set.class.php +++ b/lib/zin/core/set.class.php @@ -18,13 +18,13 @@ class set { public static function __callStatic($prop, $args) { + if($prop === 'class' || strtolower($prop) === 'classname') + { + return directive('prop', array('class' => $args)); + } + $value = array_shift($args); if(is_object($value)) $value = (array)$value; return directive('prop', array($prop => $value)); } - - public static function class(/* ...$args */) - { - return directive('prop', array('class' => func_get_args())); - } } diff --git a/lib/zin/utils/classlist.class.php b/lib/zin/utils/classlist.class.php index 1c765d979e..0bda01bdca 100644 --- a/lib/zin/utils/classlist.class.php +++ b/lib/zin/utils/classlist.class.php @@ -25,28 +25,6 @@ class classlist */ private array $list = array(); - /** - * Create an classlist instance - * - * @param string|array|null $names - A string or a class name list - * @return classlist - */ - public static function new(string|array|null $names = array()): classlist - { - return new classlist($names); - } - - /** - * Stringify class list - * - * @param string|array $names - A string or a class name list - * @return string - */ - public static function str(string|array $names): string - { - return classlist::new($names)->toStr(); - } - /** * Create classname instance * @@ -76,7 +54,7 @@ class classlist * Example: * * // Set class names - * $classlist = classlist::new(); + * $classlist = new classlist(); * $classlist->set('btn primary rounded'); * * // Set multiple classnames by string list @@ -133,7 +111,7 @@ class classlist * * Example: * - * $classlist = classlist::new(); + * $classlist = new classlist(); * $classlist->add('btn primary rounded'); * * // Add multiple classnames by string list @@ -153,7 +131,7 @@ class classlist * * Example: * - * $classlist = classlist::new('btn primary rounded'); + * $classlist = new classlist('btn primary rounded'); * $classlist->remove('btn primary'); * * // Add multiple classnames by string list @@ -183,7 +161,7 @@ class classlist * * Example: * - * $classlist = classlist::new('btn'); + * $classlist = new classlist('btn'); * $classlist->toggle('btn'); // class list is "" * * // Toggle class name by flag @@ -209,7 +187,7 @@ class classlist * * Example: * - * $classlist = classlist::new('btn primary rounded'); + * $classlist = new classlist('btn primary rounded'); * echo $classlist->has('btn'); // Output true * * // Check multiple names diff --git a/lib/zin/utils/dataset.class.php b/lib/zin/utils/dataset.class.php index 679813f7fa..7a90a775fa 100644 --- a/lib/zin/utils/dataset.class.php +++ b/lib/zin/utils/dataset.class.php @@ -182,7 +182,7 @@ class dataset * @access public * @return object */ - public function clone() + public function copy() { $className = get_called_class(); return new $className($this->data); diff --git a/lib/zin/utils/hx.class.php b/lib/zin/utils/hx.class.php deleted file mode 100644 index 231504b0c8..0000000000 --- a/lib/zin/utils/hx.class.php +++ /dev/null @@ -1,126 +0,0 @@ - - * @package zin - * @version $Id - * @link https://www.zentao.net - */ - -namespace zin\utils; - -require_once __DIR__ . DS . 'dataset.class.php'; - -/** - * Manage hx for html element and widgets - * - * Example: - * - * // Create a hx object an convert to str string - * $hx = hx::new()->boost(); - * - * echo $hx(); // Output 'hx-boost="true"' - * - * @see https://htmx.org/ - * @todo @sunhao: Validate hx properties on modifying - */ -class hx extends dataset -{ - /** - * Method for sub class to modify value on setting it - * - * @access public - * @param array|string $prop - Property name or properties list - * @param mixed $value - Property value - * @param bool $removeEmpty - Whether to remove empty value - * @return hx - */ - protected function setVal($prop, $value, $removeEmpty = false) - { - if(str_starts_with($prop, 'hx-')) $prop = substr($prop, 3); - return parent::setVal($prop, $value); - } - - /** - * Set ajax request - * - * @access public - * @param string $url - The request url - * @param string $trigger - The trigget - * @param string $target - A css selector to specific a element to load remote content - * @param string $method - The request method, default value is "get" - * @return hx - * @see https://htmx.org/docs/#ajax - */ - public function ajax($url, $trigger = '', $target = '', $method = 'get') - { - if(is_array($url)) return $this->set($url); - - return $this->set(array('url' => $url, 'trigger' => $trigger, 'target' => $target, 'method' => $method)); - } - - /** - * Set ajax post request - * - * @access public - * @param string $url - The request url - * @param string $trigger - The trigget - * @param string $target - A css selector to specific a element to load remote content - * @return hx - * @see https://htmx.org/docs/#ajax - */ - public function post($url, $trigger = '', $target = '') - { - return $this->ajax($url, $trigger, $target, 'post'); - } - - /** - * Convert hx properties to str string - * - * @access public - * @return string - */ - public function toStr() - { - $pairs = array(); - - foreach($this->data as $name => $value) - { - /* Skip any null value */ - if($value === null) continue; - - /* Convert non-string to json */ - if(!is_string($value)) $value = json_encode($value); - - $pairs[] = 'hx-' . $name . '="' . htmlspecialchars($value) . '"'; - } - - return implode(' ', $pairs); - } - - /** - * Create an instance - * - * @param string $hx - CSS hx list - * @return hx - */ - static public function new($hx) - { - return new hx($hx); - } - - /** - * Create properties string from hx list - * - * @access public - * @param string $hx - CSS hx list - * @return string - */ - static public function str($props) - { - return (new hx($props))->toStr(); - } -} diff --git a/lib/zin/utils/style.class.php b/lib/zin/utils/style.class.php index 709790902d..d8260e504c 100644 --- a/lib/zin/utils/style.class.php +++ b/lib/zin/utils/style.class.php @@ -43,29 +43,6 @@ require_once __DIR__ . DS . 'dataset.class.php'; */ class style extends dataset { - /** - * Create an instance - * - * @param array $style - CSS style list - * @return style - */ - public static function new(array $style = array()): style - { - return new style($style); - } - - /** - * Create css from style list - * - * @access public - * @param array $style - CSS style list - * @return string - */ - public static function str(array $style): string - { - return (new style($style))->toStr(); - } - /** * Format CSS variable name with prefix "--" * diff --git a/lib/zin/wg/checkbox/v1.php b/lib/zin/wg/checkbox/v1.php index c1cb7af0e5..359c6834fe 100644 --- a/lib/zin/wg/checkbox/v1.php +++ b/lib/zin/wg/checkbox/v1.php @@ -47,7 +47,7 @@ class checkbox extends wg ), h::label ( - set::for($id), + set('for', $id), setClass($labelClass), $text, ), @@ -68,7 +68,7 @@ class checkbox extends wg set::type($type), set($this->props->skip('text,primary,typeClass')), ), - is_string($text) ? span($text, set::class('text')) : $text, + is_string($text) ? span($text, set::className('text')) : $text, $this->children() ); } diff --git a/lib/zin/wg/control/v1.php b/lib/zin/wg/control/v1.php index 215b56a420..074ef6f2ce 100644 --- a/lib/zin/wg/control/v1.php +++ b/lib/zin/wg/control/v1.php @@ -50,7 +50,7 @@ class control extends wg { return div ( - set::class('form-control-static'), + set::className('form-control-static'), set($this->props->skip(array('type', 'name', 'value', 'required', 'disabled', 'placeholder', 'items', 'required'))), set('data-name', $this->prop('name')), $this->prop('value') diff --git a/lib/zin/wg/featurebar/v1.php b/lib/zin/wg/featurebar/v1.php index d32901b4af..be99ce7f65 100644 --- a/lib/zin/wg/featurebar/v1.php +++ b/lib/zin/wg/featurebar/v1.php @@ -129,7 +129,7 @@ class featureBar extends wg if(!empty($nav) && $nav[0] instanceof nav) return $nav; return new nav ( - set::class('nav-feature'), + set::className('nav-feature'), set::items($this->getItems()), divorce($this->children()) ); diff --git a/lib/zin/wg/formbase/v1.php b/lib/zin/wg/formbase/v1.php index f3a0e3faa1..36dafd0ca4 100644 --- a/lib/zin/wg/formbase/v1.php +++ b/lib/zin/wg/formbase/v1.php @@ -66,7 +66,7 @@ class formBase extends wg return toolbar ( - set::class('form-actions', $this->prop('actionsClass')), + set::className('form-actions', $this->prop('actionsClass')), set::items($actions) ); } @@ -80,8 +80,8 @@ class formBase extends wg { list($url, $target, $method, $id) = $this->prop(array('url', 'target', 'method', 'id')); return array( - set::class('form load-indicator'), - $target === 'ajax' ? set::class('form-ajax') : null, + set::className('form load-indicator'), + $target === 'ajax' ? set::className('form-ajax') : null, set(array( 'id' => $id, 'action' => empty($url) ? $_SERVER['REQUEST_URI'] : $url, diff --git a/lib/zin/wg/formbatchitem/v1.php b/lib/zin/wg/formbatchitem/v1.php index ba885d053e..4ddeab50a8 100644 --- a/lib/zin/wg/formbatchitem/v1.php +++ b/lib/zin/wg/formbatchitem/v1.php @@ -96,13 +96,13 @@ class formBatchItem extends wg set($this->getRestProps()), span ( - set::class('form-label form-batch-label', $labelClass, $strong ? 'font-bold' : null, $required ? 'required' : null), + set::className('form-label form-batch-label', $labelClass, $strong ? 'font-bold' : null, $required ? 'required' : null), set($labelProps), $label ), empty($tip) ? null : new btn ( - set::class('form-batch-tip state text-gray', $tipClass), + set::className('form-batch-tip state text-gray', $tipClass), set::size('sm'), set::type('ghost'), toggle('tooltip', array('title' => $tip)), diff --git a/lib/zin/wg/formgroup/v1.php b/lib/zin/wg/formgroup/v1.php index 044e2df19a..11ae6104c2 100644 --- a/lib/zin/wg/formgroup/v1.php +++ b/lib/zin/wg/formgroup/v1.php @@ -49,13 +49,13 @@ class formGroup extends wg return div ( - set::class('form-group', $required ? 'required' : null, ($label === false || $label === null) ? 'no-label' : null, empty($width) ? null : 'grow-0'), + set::className('form-group', $required ? 'required' : null, ($label === false || $label === null) ? 'no-label' : null, empty($width) ? null : 'grow-0'), zui::width($width), set($this->getRestProps()), setCssVar('form-grid-label-width', $labelWidth), empty($label) ? null : new formLabel ( - set::class($labelClass, $strong ? 'font-bold' : null), + set::className($labelClass, $strong ? 'font-bold' : null), set::required($required), set($labelProps), $label @@ -65,7 +65,7 @@ class formGroup extends wg $this->children(), empty($tip) ? null : div ( - set::class($tipClass), + set::className($tipClass), set($tipProps), $tip ) diff --git a/lib/zin/wg/formpanel/v1.php b/lib/zin/wg/formpanel/v1.php index d1c62a7904..d6735380c8 100644 --- a/lib/zin/wg/formpanel/v1.php +++ b/lib/zin/wg/formpanel/v1.php @@ -163,7 +163,7 @@ class formPanel extends panel return new form ( - set::class($this->prop('formClass')), + set::className($this->prop('formClass')), set($this->props->pick(array_keys(form::definedPropsList()))), $this->children(), $hiddenFields ? jsVar('hiddenFields', $hiddenFields) : null, diff --git a/lib/zin/wg/formrow/v1.php b/lib/zin/wg/formrow/v1.php index 86fda43654..7943eabf2a 100644 --- a/lib/zin/wg/formrow/v1.php +++ b/lib/zin/wg/formrow/v1.php @@ -29,7 +29,7 @@ class formRow extends wg return div ( - set::class('form-row', empty($width) ? null : 'grow-0', $hidden ? 'hidden' : ''), + set::className('form-row', empty($width) ? null : 'grow-0', $hidden ? 'hidden' : ''), zui::width($width), is_array($items) ? array_map(array($this, 'onBuildItem'), $items) : null, set($this->getRestProps()), diff --git a/lib/zin/wg/main/v1.php b/lib/zin/wg/main/v1.php index 5c094745f3..528e49cb3a 100644 --- a/lib/zin/wg/main/v1.php +++ b/lib/zin/wg/main/v1.php @@ -91,7 +91,7 @@ class main extends wg ( set::id('mainContent'), $leftSides, - set::class(empty($leftSides) && empty($rightSides) ? '' : 'row', empty($leftSides) ? '' : 'has-sidebar-left', empty($rightSides) ? '' : 'has-sidebar-right'), + set::className(empty($leftSides) && empty($rightSides) ? '' : 'row', empty($leftSides) ? '' : 'has-sidebar-left', empty($rightSides) ? '' : 'has-sidebar-right'), $this->children(), $rightSides ); @@ -125,7 +125,7 @@ class main extends wg $this->buildMainNavbar(), div ( - set::class('container'), + set::className('container'), $this->buildMenu(), $this->buildContent() ) diff --git a/lib/zin/wg/mindmap/v1.php b/lib/zin/wg/mindmap/v1.php index df1262a3a8..beb34bde9e 100644 --- a/lib/zin/wg/mindmap/v1.php +++ b/lib/zin/wg/mindmap/v1.php @@ -60,7 +60,7 @@ class mindmap extends wg ( h::iframe ( - set::class('mindmap-iframe'), + set::className('mindmap-iframe'), set::src($mindmapPath), set::allowfullscreen(true), set::allowtransparency(true), diff --git a/lib/zin/wg/modalheader/v1.php b/lib/zin/wg/modalheader/v1.php index 6146626843..62b743d889 100644 --- a/lib/zin/wg/modalheader/v1.php +++ b/lib/zin/wg/modalheader/v1.php @@ -45,7 +45,7 @@ class modalHeader extends wg $title ? div ( $title, - set::class($this->prop('titleClass')), + set::className($this->prop('titleClass')), ) : null, ($entityText || $entityID) ? entityLabel ( @@ -62,7 +62,7 @@ class modalHeader extends wg return h::div ( - set::class('modal-header panel-form rounded-md canvas mx-auto'), + set::className('modal-header panel-form rounded-md canvas mx-auto'), set::style(array('margin-bottom' => '0px')), $header ); diff --git a/lib/zin/wg/pagebase/v1.php b/lib/zin/wg/pagebase/v1.php index 9ebb5b502a..b2d9317086 100644 --- a/lib/zin/wg/pagebase/v1.php +++ b/lib/zin/wg/pagebase/v1.php @@ -95,7 +95,7 @@ class pageBase extends wg ( before(html('')), set($attrs), - set::class("theme-$themeName"), + set::className("theme-$themeName"), set::lang($currentLang), h::head ( @@ -108,7 +108,7 @@ class pageBase extends wg h::body ( set($bodyProps), - set::class($bodyClass), + set::className($bodyClass), empty($imports) ? null : h::import($imports), h::css($css, setClass('zin-page-css')), $body, diff --git a/lib/zin/wg/searchtoggle/v1.php b/lib/zin/wg/searchtoggle/v1.php index 86c066062c..6a01e43626 100644 --- a/lib/zin/wg/searchtoggle/v1.php +++ b/lib/zin/wg/searchtoggle/v1.php @@ -29,7 +29,7 @@ class searchToggle extends wg if(is_null($open) && !empty($_GET['browseType'])) $open = $_GET['browseType'] === 'bySearch'; return btn ( - set::class('ghost search-form-toggle'), + set::className('ghost search-form-toggle'), set::icon('search'), set::text($lang->searchAB), set('data-module', $this->prop('module')), diff --git a/lib/zin/wg/sidebar/v1.php b/lib/zin/wg/sidebar/v1.php index ca0419e011..7abcc98456 100644 --- a/lib/zin/wg/sidebar/v1.php +++ b/lib/zin/wg/sidebar/v1.php @@ -29,7 +29,7 @@ class sidebar extends wg $this->children(), $showToggle ? div ( - set::class("sidebar-toggle sidebar-$side-toggle"), + set::className("sidebar-toggle sidebar-$side-toggle"), icon("angle-$side"), on::click("zui.toggleSidebar({side: '$side'})") ) : null diff --git a/lib/zin/wg/stepseditor/v1.php b/lib/zin/wg/stepseditor/v1.php index 6b10c1e78d..e72c447796 100644 --- a/lib/zin/wg/stepseditor/v1.php +++ b/lib/zin/wg/stepseditor/v1.php @@ -77,25 +77,25 @@ class stepsEditor extends wg setClass('steps-editor-row'), cell ( - set::class('steps-editor-col steps-editor-col-step'), + set::className('steps-editor-col steps-editor-col-step'), $stepText ), cell ( - set::class('steps-editor-col steps-editor-col-add'), + set::className('steps-editor-col steps-editor-col-add'), div($sameLevelText), div($subLevelText), ), cell ( - set::class('steps-editor-col steps-editor-col-expect'), + set::className('steps-editor-col steps-editor-col-expect'), $expectText ) ) ), div ( - set::class('steps-editor-body') + set::className('steps-editor-body') ), zui::stepsEditor ( diff --git a/lib/zin/wg/tablechart/v1.php b/lib/zin/wg/tablechart/v1.php index 5fe9fea3e5..13910cffe4 100644 --- a/lib/zin/wg/tablechart/v1.php +++ b/lib/zin/wg/tablechart/v1.php @@ -54,7 +54,7 @@ class tableChart extends wg $chartOption[] = array('name' => $data->name, 'value' => $type == 'pie' ? $data->value : array('value' => $data->value, 'itemStyle' => array('color' => $color))); $tableTR[] = h::tr ( - h::td(label(set::class('label-dot mr-2'), set::style(array('background-color' => $color, '--tw-ring-color' => $color))), $data->name), + h::td(label(set::className('label-dot mr-2'), set::style(array('background-color' => $color, '--tw-ring-color' => $color))), $data->name), h::td($data->value), h::td(($data->percent * 100) . '%') ); @@ -66,11 +66,11 @@ class tableChart extends wg $overflow = $this->prop('overflow', true); return div ( - set::class('flex border py-2'), + set::className('flex border py-2'), cell ( setClass('border-r chart flex-auto'), - div(set::class('center text-base font-bold py-2'), $title), + div(set::className('center text-base font-bold py-2'), $title), echarts ( set::color($colorList), @@ -105,7 +105,7 @@ class tableChart extends wg $overflow ? setStyle('max-height', ($chartHeight + 50) .'px') : null, h::table ( - set::class('table'), + set::className('table'), $this->genTableHeaders(), $tableTR ) diff --git a/lib/zin/wg/tabs/v1.php b/lib/zin/wg/tabs/v1.php index 1b525a38ba..ee14c1efd8 100644 --- a/lib/zin/wg/tabs/v1.php +++ b/lib/zin/wg/tabs/v1.php @@ -120,7 +120,7 @@ class tabs extends wg $titleViews[] = $this->buildTitleView($tabPane); $divider = $tabPane->block('divider'); - if($divider) $titleViews[] = div(set::class('divider')); + if($divider) $titleViews[] = div(set::className('divider')); $contentViews[] = $tabPane; } diff --git a/module/account/ui/view.html.php b/module/account/ui/view.html.php index e3f077c566..d2cd5e6c53 100644 --- a/module/account/ui/view.html.php +++ b/module/account/ui/view.html.php @@ -77,7 +77,7 @@ detailBody floatToolbar ( set::object($account), - isAjaxRequest('modal') ? null : to::prefix(backBtn(set::icon('back'), set::class('ghost text-white'), $lang->goback)), + isAjaxRequest('modal') ? null : to::prefix(backBtn(set::icon('back'), set::className('ghost text-white'), $lang->goback)), set::suffix($actions['suffixActions']) ), ); diff --git a/module/compile/ui/logs.html.php b/module/compile/ui/logs.html.php index 76f533ed3b..b2c1d224e2 100644 --- a/module/compile/ui/logs.html.php +++ b/module/compile/ui/logs.html.php @@ -21,7 +21,7 @@ detailHeader( $job->engine == 'gitlab' ? btn ( set::id('refreshBtn'), - set::class('mr-3 secondary'), + set::className('mr-3 secondary'), set::icon('eye'), set::text($lang->compile->refresh), set::url(helper::createLink('ci', "checkCompileStatus", "compileID={$build->id}")) diff --git a/module/gitea/ui/binduser.html.php b/module/gitea/ui/binduser.html.php index 1688b2830f..39505c6713 100644 --- a/module/gitea/ui/binduser.html.php +++ b/module/gitea/ui/binduser.html.php @@ -15,7 +15,7 @@ namespace zin; /* zin: Define the set::module('compile') feature bar on main menu. */ featureBar ( - to::leading(array(backBtn(set::icon('back'), set::class('secondary'), $lang->goback))), + to::leading(array(backBtn(set::icon('back'), set::className('secondary'), $lang->goback))), set::current($type), set::link($this->createLink('gitea', 'binduser', "giteaID=$giteaID&type={key}")), ); diff --git a/module/gitlab/ui/binduser.html.php b/module/gitlab/ui/binduser.html.php index 3953fb8c1d..0f55a2c74a 100644 --- a/module/gitlab/ui/binduser.html.php +++ b/module/gitlab/ui/binduser.html.php @@ -15,7 +15,7 @@ namespace zin; /* zin: Define the set::module('compile') feature bar on main menu. */ featureBar ( - to::leading(array(backBtn(set::icon('back'), set::class('secondary'), $lang->goback))), + to::leading(array(backBtn(set::icon('back'), set::className('secondary'), $lang->goback))), set::current($type), set::link($this->createLink('gitlab', 'binduser', "gitlabID=$gitlabID&type={key}")), ); diff --git a/module/gogs/ui/binduser.html.php b/module/gogs/ui/binduser.html.php index 311b44d89e..e63d922aea 100644 --- a/module/gogs/ui/binduser.html.php +++ b/module/gogs/ui/binduser.html.php @@ -15,7 +15,7 @@ namespace zin; /* zin: Define the set::module('compile') feature bar on main menu. */ featureBar ( - to::leading(array(backBtn(set::icon('back'), set::class('secondary'), $lang->goback))), + to::leading(array(backBtn(set::icon('back'), set::className('secondary'), $lang->goback))), set::current($type), set::link($this->createLink('gogs', 'binduser', "gogsID=$gogsID&type={key}")), ); diff --git a/module/host/ui/view.html.php b/module/host/ui/view.html.php index 8edbd3cd34..c44b2a4a9b 100644 --- a/module/host/ui/view.html.php +++ b/module/host/ui/view.html.php @@ -102,7 +102,7 @@ detailBody floatToolbar ( set::object($host), - isAjaxRequest('modal') ? null : to::prefix(backBtn(set::icon('back'), set::class('ghost text-white'), $lang->goback)), + isAjaxRequest('modal') ? null : to::prefix(backBtn(set::icon('back'), set::className('ghost text-white'), $lang->goback)), set::suffix($actions['suffixActions']) ), ); diff --git a/module/instance/ui/view.html.php b/module/instance/ui/view.html.php index 45ce25a31e..97e04d978b 100644 --- a/module/instance/ui/view.html.php +++ b/module/instance/ui/view.html.php @@ -44,7 +44,7 @@ foreach($dbList as $db) $db->ready ? $lang->instance->dbReady : $lang->instance->dbWaiting, setClass('text-' . ($db->ready ? 'success' : 'danger')) ), - + h::td ( btn @@ -187,12 +187,12 @@ div !empty($defaultAccount->password) ? h::td ( input(set::type('text'), set::value($defaultAccount->password), set::name('password'), setStyle('display', 'none')), - btn(set::class('copy-btn ghost'),set::icon('copy')) + btn(set::className('copy-btn ghost'),set::icon('copy')) ): null, !empty($defaultAccount->token) ? h::td ( input(set::type('text'), set::value($defaultAccount->token), set::name('token'), setStyle('display', 'none')), - btn(set::class('copy-btn ghost'),set::icon('copy')) + btn(set::className('copy-btn ghost'),set::icon('copy')) ): null, $type === 'store' ? null : h::td ( @@ -228,7 +228,7 @@ div floatToolbar ( set::object($instance), - isAjaxRequest('modal') ? null : to::prefix(backBtn(set::icon('back'), set::class('ghost text-white'), $lang->goback)), + isAjaxRequest('modal') ? null : to::prefix(backBtn(set::icon('back'), set::className('ghost text-white'), $lang->goback)), set::main($actions['mainActions']), set::suffix($actions['suffixActions']) ), @@ -242,4 +242,4 @@ div set::commentUrl(createLink('action', 'comment', array('objectType' => $type === 'store' ? 'instance' : $instance->type, 'objectID' => $instance->id))), ) ) -); \ No newline at end of file +); diff --git a/module/job/ui/view.html.php b/module/job/ui/view.html.php index 0660ce6db2..8498f761a6 100644 --- a/module/job/ui/view.html.php +++ b/module/job/ui/view.html.php @@ -137,7 +137,7 @@ detailBody ( div ( - set::class('mt-4'), + set::className('mt-4'), html(nl2br($compile->logs)) ) ) diff --git a/module/mr/ui/diff.html.php b/module/mr/ui/diff.html.php index d18dbc565a..3844cf28a0 100644 --- a/module/mr/ui/diff.html.php +++ b/module/mr/ui/diff.html.php @@ -92,7 +92,7 @@ panel tabs ( set::id('monacoTabs'), - set::class('relative'), + set::className('relative'), div(setStyle(array('position' => 'absolute', 'width' => '100%', 'height' => '35px', 'background' => '#efefef', 'top' => '0px'))), tabPane ( @@ -104,7 +104,7 @@ panel icon ( 'close', - set::class('monaco-close'), + set::className('monaco-close'), ) ), div(set::id('tab-' . $currentEntry)), @@ -113,7 +113,7 @@ panel ( set::arrow(false), set::staticMenu(true), - set::class('absolute top-0 right-0 z-10 monaco-dropmenu'), + set::className('absolute top-0 right-0 z-10 monaco-dropmenu'), btn ( setClass('ghost text-black pull-right'), @@ -124,11 +124,11 @@ panel $dropMenus ), ), - div(set::class('absolute top-0 left-0 z-20 arrow-left btn-left'), icon('chevron-left')), - div(set::class('absolute top-0 right-0 z-20 arrow-right btn-right'), icon('chevron-right')), + div(set::className('absolute top-0 left-0 z-20 arrow-left btn-left'), icon('chevron-left')), + div(set::className('absolute top-0 right-0 z-20 arrow-right btn-right'), icon('chevron-right')), ) ), - + sidebar ( set::side('left'), @@ -144,8 +144,8 @@ panel set::onClickItem(jsRaw('window.treeClick')), ) ), - a(set::class('iframe'), setData('size', '1000px'), setData('toggle', 'modal'), set::id('linkObject')) + a(set::className('iframe'), setData('size', '1000px'), setData('toggle', 'modal'), set::id('linkObject')) ) ); -render(); \ No newline at end of file +render(); diff --git a/module/repo/ui/ajaxgeteditorcontent.html.php b/module/repo/ui/ajaxgeteditorcontent.html.php index afa47d8a2d..e2c20ad4a9 100644 --- a/module/repo/ui/ajaxgeteditorcontent.html.php +++ b/module/repo/ui/ajaxgeteditorcontent.html.php @@ -46,7 +46,7 @@ if(strpos($config->repo->images, "|$suffix|") !== false) { $wg = div ( - set::class('image'), + set::className('image'), img(set::src('data:image/' . $suffix . ';base64,' . $content)) ); } @@ -54,7 +54,7 @@ elseif($suffix == 'binary') { $wg = div ( - set::class('binary'), + set::className('binary'), a ( set::href($this->repo->createLink('download', "repoID=$repoID&path=" . $this->repo->encodePath($entry) . "&fromRevision=$revision")), @@ -102,11 +102,11 @@ if($canLinkTask) $dropMenus[] = array('id' => 'linkTask', 'text' => $this->lan $logWg = div ( set::id('log'), - div(set::class('history')), + div(set::className('history')), div ( - set::class('action-btn pull-right'), - div(set::class('btn btn-close pull-right ghost text-black bg-light bg-opacity-50'), icon('close')), + set::className('action-btn pull-right'), + div(set::className('btn btn-close pull-right ghost text-black bg-light bg-opacity-50'), icon('close')), !empty($dropMenus) ? dropdown ( set::arrow(false), @@ -127,11 +127,11 @@ $logWg = div $relatedWg = div ( set::id('related'), - div(set::class('btn btn-left pull-left'), icon('chevron-left')), - div(set::class('btn btn-right pull-right'), icon('chevron-right')), + div(set::className('btn btn-left pull-left'), icon('chevron-left')), + div(set::className('btn btn-right pull-right'), icon('chevron-right')), div ( - set::class('panel-title'), + set::className('panel-title'), tabs ( set::id('relationTabs'), @@ -143,13 +143,13 @@ $relatedWg = div ), ), ), - div(set::class('table-empty-tip'), p($this->lang->repo->notRelated)) + div(set::className('table-empty-tip'), p($this->lang->repo->notRelated)) ); div ( set::id('monacoEditor'), - set::class('repoCode'), + set::className('repoCode'), $wg, $logWg, $relatedWg diff --git a/module/repo/ui/browse.html.php b/module/repo/ui/browse.html.php index 56ff63c2ff..5ca7d823f7 100644 --- a/module/repo/ui/browse.html.php +++ b/module/repo/ui/browse.html.php @@ -69,7 +69,7 @@ if($fileName) $breadcrumbItems[] = h::span($fileName); featureBar( formGroup ( - set::class('repo-select'), + set::className('repo-select'), set::required(true), dropmenu ( @@ -97,7 +97,7 @@ $downloadWg = div on('click', '', array('capture' => true, 'prevent' => true, 'stop' => true)), !empty($cloneUrl->svn) ? div ( - p(set::class('repo-downloadCode'), $lang->repo->cloneUrl), + p(set::className('repo-downloadCode'), $lang->repo->cloneUrl), formRow ( formGroup @@ -124,7 +124,7 @@ $downloadWg = div !empty($cloneUrl->ssh) ? div ( - p(set::class('repo-downloadCode'), $lang->repo->sshClone), + p(set::className('repo-downloadCode'), $lang->repo->sshClone), formRow ( formGroup @@ -143,7 +143,7 @@ $downloadWg = div set::width('50px'), btn ( - set::class('copy-btn'), + set::className('copy-btn'), set::icon('copy'), ) ) @@ -152,7 +152,7 @@ $downloadWg = div !empty($cloneUrl->http) ? div ( - p(set::class('repo-downloadCode'), $lang->repo->httpClone), + p(set::className('repo-downloadCode'), $lang->repo->httpClone), formRow ( formGroup @@ -171,7 +171,7 @@ $downloadWg = div set::width('50px'), btn ( - set::class('copy-btn'), + set::className('copy-btn'), set::icon('copy'), ) ) @@ -184,7 +184,7 @@ $downloadWg = div btn ( set::icon('down-circle'), - set::class('downloadZip-btn'), + set::className('downloadZip-btn'), set::text($lang->repo->downloadZip), ) ), @@ -193,7 +193,7 @@ $downloadWg = div toolbar ( span( - set::class('last-sync-time'), + set::className('last-sync-time'), $lang->repo->notice->lastSyncTime . $cacheTime ), item(set($refreshItem)), diff --git a/module/repo/ui/diffeditor.html.php b/module/repo/ui/diffeditor.html.php index 70432e5042..2d1dcf7653 100644 --- a/module/repo/ui/diffeditor.html.php +++ b/module/repo/ui/diffeditor.html.php @@ -39,7 +39,7 @@ div( tabs ( set::id('monacoTabs'), - set::class('relative'), + set::className('relative'), div(setStyle(array('position' => 'absolute', 'width' => '100%', 'height' => '35px', 'background' => '#efefef', 'top' => '0px'))), tabPane ( @@ -51,7 +51,7 @@ div( icon ( 'close', - set::class('monaco-close'), + set::className('monaco-close'), ) ), div(set::id('tab-' . $currentEntry)), @@ -60,7 +60,7 @@ div( ( set::arrow(false), set::staticMenu(true), - set::class('absolute top-0 right-0 z-10 monaco-dropmenu'), + set::className('absolute top-0 right-0 z-10 monaco-dropmenu'), btn ( setClass('ghost text-black pull-right'), @@ -71,8 +71,8 @@ div( $dropMenus ), ), - div(set::class('absolute top-0 left-0 z-20 arrow-left btn-left'), icon('chevron-left')), - div(set::class('absolute top-0 right-0 z-20 arrow-right btn-right'), icon('chevron-right')), + div(set::className('absolute top-0 left-0 z-20 arrow-left btn-left'), icon('chevron-left')), + div(set::className('absolute top-0 right-0 z-20 arrow-right btn-right'), icon('chevron-right')), ) ); @@ -92,4 +92,4 @@ sidebar ) ); -a(set::class('iframe'), setData('size', '1000px'), setData('toggle', 'modal'), set::id('linkObject')); \ No newline at end of file +a(set::className('iframe'), setData('size', '1000px'), setData('toggle', 'modal'), set::id('linkObject')); diff --git a/module/repo/ui/monaco.html.php b/module/repo/ui/monaco.html.php index d48782e5f9..65098163d0 100644 --- a/module/repo/ui/monaco.html.php +++ b/module/repo/ui/monaco.html.php @@ -44,7 +44,7 @@ div( tabs ( set::id('monacoTabs'), - set::class('relative'), + set::className('relative'), div(setStyle(array('position' => 'absolute', 'width' => '100%', 'height' => '40px', 'background' => '#efefef', 'top' => '0px'))), tabPane ( @@ -56,7 +56,7 @@ div( icon ( 'close', - set::class('monaco-close'), + set::className('monaco-close'), ) ), div(set::id('tab-' . $file)), @@ -66,7 +66,7 @@ div( set::arrow(false), set::staticMenu(true), set::key('dropdown'), - set::class('absolute top-0 right-0 z-10 monaco-dropmenu'), + set::className('absolute top-0 right-0 z-10 monaco-dropmenu'), btn ( setClass('ghost text-black pull-right'), @@ -77,8 +77,8 @@ div( $monacoDropMenus ), ), - div(set::class('absolute top-0 left-0 z-20 arrow-left btn-left'), icon('chevron-left')), - div(set::class('absolute top-0 right-0 z-20 arrow-right btn-right'), icon('chevron-right')), + div(set::className('absolute top-0 left-0 z-20 arrow-left btn-left'), icon('chevron-left')), + div(set::className('absolute top-0 right-0 z-20 arrow-right btn-right'), icon('chevron-right')), ) ); @@ -107,4 +107,4 @@ sidebar ) ); -a(set::class('iframe'), setData('size', 'lg'), setData('toggle', 'modal'), set::id('linkObject')); +a(set::className('iframe'), setData('size', 'lg'), setData('toggle', 'modal'), set::id('linkObject')); diff --git a/module/repo/ui/showsynccommit.html.php b/module/repo/ui/showsynccommit.html.php index a928eaa759..33563d4180 100644 --- a/module/repo/ui/showsynccommit.html.php +++ b/module/repo/ui/showsynccommit.html.php @@ -31,7 +31,7 @@ div setClass('sync-main-content'), div ( - set::class('sync-content'), + set::className('sync-content'), div ( setClass('alert light-pale flex items-center'), diff --git a/module/search/ui/savezinquery.html.php b/module/search/ui/savezinquery.html.php index de0f9f173e..c30a989216 100644 --- a/module/search/ui/savezinquery.html.php +++ b/module/search/ui/savezinquery.html.php @@ -14,7 +14,7 @@ form set::id('title'), set::name('title'), set::type('text'), - set::class('form-control w-5/12'), + set::className('form-control w-5/12'), set::placeholder($lang->search->setCondName) ), checkbox @@ -22,14 +22,14 @@ form set::id('common'), set::name('common'), set::value(1), - set::class('w-3/12'), + set::className('w-3/12'), $lang->search->setCommon ), checkbox ( set::id('onMenuBar'), set::name('onMenuBar'), - set::class('w-3/12'), + set::className('w-3/12'), $lang->search->onMenuBar ), btn( diff --git a/module/serverroom/ui/view.html.php b/module/serverroom/ui/view.html.php index f64c8c5cbd..23cfb647ff 100644 --- a/module/serverroom/ui/view.html.php +++ b/module/serverroom/ui/view.html.php @@ -81,7 +81,7 @@ detailBody floatToolbar ( set::object($serverRoom), - isAjaxRequest('modal') ? null : to::prefix(backBtn(set::icon('back'), set::class('ghost text-white'), $lang->goback)), + isAjaxRequest('modal') ? null : to::prefix(backBtn(set::icon('back'), set::className('ghost text-white'), $lang->goback)), set::suffix($actions['suffixActions']) ), );