123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307 |
- <php>
- if (!function_exists('_parse_plugin_config')) {
- function _parse_plugin_config($pluginConfig){
- </php>
- <foreach name="pluginConfig" item="form">
- <switch name="form.type">
- <case value="explain">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="{$key}">
- {$form.title|default=''}
- <notempty name="form.rule.require">
- <span class="form-required">*</span>
- </notempty>
- </label>
- <div class="col-md-6 col-sm-10">
- <p class="form-control-static">{$form.value}</p>
- <present name="form.tip">
- <p class="help-block">{$form.tip}</p>
- </present>
- </div>
- </div>
- </case>
- <case value="text">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="{$key}">
- {$form.title|default=''}
- <notempty name="form.rule.require">
- <span class="form-required">*</span>
- </notempty>
- </label>
- <div class="col-md-6 col-sm-10">
- <input type="text" name="config[{$key}]" class="form-control" {$form.disabled?'disabled':''} value="{$form.value}" id="{$key}">
- <present name="form.tip">
- <p class="help-block">{$form.tip}</p>
- </present>
- </div>
- </div>
- </case>
- <case value="password">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="{$key}">
- {$form.title|default=''}
- <notempty name="form.rule.require">
- <span class="form-required">*</span>
- </notempty>
- </label>
- <div class="col-md-6 col-sm-10">
- <input type="password" name="config[{$key}]" class="form-control" value="{$form.value}"
- id="{$key}">
- <present name="form.tip">
- <p class="help-block">{$form.tip}</p>
- </present>
- </div>
- </div>
- </case>
- <case value="number">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="{$key}">
- {$form.title|default=''}
- <notempty name="form.rule.require">
- <span class="form-required">*</span>
- </notempty>
- </label>
- <div class="col-md-6 col-sm-10">
- <input type="number" name="config[{$key}]" class="form-control" {$form.disabled?'disabled':''} value="{$form.value}"
- id="{$key}">
- <present name="form.tip">
- <p class="help-block">{$form.tip}</p>
- </present>
- </div>
- </div>
- </case>
- <case value="hidden">
- <input type="hidden" name="config[{$key}]" value="{$form.value}">
- </case>
- <case value="radio">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="{$key}">
- {$form.title|default=''}
- <notempty name="form.rule.require">
- <span class="form-required">*</span>
- </notempty>
- </label>
- <div class="col-md-6 col-sm-10">
- <foreach name="form.options" item="opt" key="opt_k">
- <label class="radio-inline">
- <php>$radio_checked=$opt_k==$form['value']?"checked":"";</php>
- <input type="radio" name="config[{$key}]" value="{$opt_k}" {$radio_checked}>{$opt}
- </label>
- </foreach>
- <present name="form.tip">
- <p class="help-block">{$form.tip}</p>
- </present>
- </div>
- </div>
- </case>
- <case value="checkbox">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="{$key}">
- {$form.title|default=''}
- <notempty name="form.rule.require">
- <span class="form-required">*</span>
- </notempty>
- </label>
- <div class="col-md-6 col-sm-10">
- <foreach name="form.options" item="opt" key="opt_k">
- <label class="checkbox-inline">
- <php>
- is_null($form["value"]) && $form["value"] = array();
- </php>
- <input type="checkbox" name="config[{$key}][]" value="{$opt_k}"
- <in name="opt_k" value="$form.value"> checked</in>
- >{$opt}
- </label>
- </foreach>
- <present name="form.tip">
- <p class="help-block">{$form.tip}</p>
- </present>
- </div>
- </div>
- </case>
- <case value="select">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="{$key}">
- {$form.title|default=''}
- <notempty name="form.rule.require">
- <span class="form-required">*</span>
- </notempty>
- </label>
- <div class="col-md-6 col-sm-10">
- <select class="form-control" name="config[{$key}]" id="{$key}">
- <foreach name="form.options" item="opt" key="opt_k">
- <option value="{$opt_k}"
- <eq name="form.value" value="$opt_k"> selected</eq>
- >{$opt}</option>
- </foreach>
- </select>
- <present name="form.tip">
- <p class="help-block">{$form.tip}</p>
- </present>
- </div>
- </div>
- </case>
- <case value="textarea">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="{$key}">
- {$form.title|default=''}
- <notempty name="form.rule.require">
- <span class="form-required">*</span>
- </notempty>
- </label>
- <div class="col-md-6 col-sm-10">
- <textarea class="form-control" name="config[{$key}]" {$form.disabled?'disabled':''} id="{$key}">{$form.value}</textarea>
- <present name="form.tip">
- <p class="help-block">{$form.tip}</p>
- </present>
- </div>
- </div>
- </case>
- <case value="group">
- <div>
- <ul class="nav nav-tabs" role="tablist">
- <foreach name="form.options" item="groupItem" key="groupKey" index="groupIndex">
- <li role="presentation" class="{$groupIndex==1?'active':''}">
- <a href="#tab-{$groupKey}" role="tab" data-toggle="tab" aria-controls="home"
- aria-expanded="true">{$groupItem.title|default=''}</a>
- </li>
- </foreach>
- </ul>
- <div class="tab-content margin-top-20">
- <foreach name="form.options" item="groupItem" key="groupKey" index="groupIndex">
- <div role="tabpanel" class="tab-pane fade in {$groupIndex==1?'active':''}" id="tab-{$groupKey}"
- aria-labelledby="home-tab">
- {:_parse_plugin_config($groupItem.options)}
- </div>
- </foreach>
- </div>
- </div>
- </case>
- <case value="date">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="{$key}">
- {$form.title|default=''}
- <notempty name="form.rule.require">
- <span class="form-required">*</span>
- </notempty>
- </label>
- <div class="col-md-6 col-sm-10">
- <input class="form-control js-bootstrap-date" name="config[{$key}]" id="{$key}"
- value="{$form.value}">
- <present name="form.tip">
- <p class="help-block">{$form.tip}</p>
- </present>
- </div>
- </div>
- </case>
- <case value="datetime">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="{$key}">
- {$form.title|default=''}
- <notempty name="form.rule.require">
- <span class="form-required">*</span>
- </notempty>
- </label>
- <div class="col-md-6 col-sm-10">
- <input class="form-control js-bootstrap-datetime" name="config[{$key}]" id="{$key}"
- value="{$form.value}">
- <present name="form.tip">
- <p class="help-block">{$form.tip}</p>
- </present>
- </div>
- </div>
- </case>
- <case value="color">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="{$key}">
- {$form.title|default=''}
- <notempty name="form.rule.require">
- <span class="form-required">*</span>
- </notempty>
- </label>
- <div class="col-md-6 col-sm-10">
- <input class="form-control js-color" name="config[{$key}]" id="{$key}"
- value="{$form.value}">
- <present name="form.tip">
- <p class="help-block">{$form.tip}</p>
- </present>
- </div>
- </div>
- </case>
- <case value="image">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="{$key}">
- {$form.title|default=''}
- <notempty name="form.rule.require">
- <span class="form-required">*</span>
- </notempty>
- </label>
- <div class="col-md-6 col-sm-10">
- <input type="hidden" name="config[{$key}]" class="form-control"
- value="{$form.value}" id="js-{$key}-input">
- <div>
- <a href="javascript:uploadOneImage('图片上传','#js-{$key}-input');">
- <if condition="empty($form['value'])">
- <img src="__TMPL__/public/assets/images/default-thumbnail.png"
- id="js-{$key}-input-preview"
- width="135" style="cursor: pointer"/>
- <else/>
- <img src="{:cmf_get_image_preview_url($form['value'])}"
- id="js-{$key}-input-preview"
- width="135" style="cursor: pointer"/>
- </if>
- </a>
- </div>
- <present name="form.tip">
- <p class="help-block">{$form.tip}</p>
- </present>
- </div>
- </div>
- </case>
- <case value="file">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="{$key}">
- {$form.title|default=''}
- <notempty name="form.rule.require">
- <span class="form-required">*</span>
- </notempty>
- </label>
- <div class="col-md-6 col-sm-10">
- <div>
- <input class="form-control" id="js-{$key}-input" type="text" name="config[{$key}]" value="{$form['value']}"
- style="width: 300px;display: inline-block;" title="文件名称">
- <a href="javascript:uploadOne('文件上传','#js-{$key}-input','file');">上传文件</a>
- </div>
- <present name="form.tip">
- <p class="help-block">{$form.tip}</p>
- </present>
- </div>
- </div>
- </case>
- <case value="location">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="{$key}">
- {$form.title|default=''}
- <notempty name="form.rule.require">
- <span class="form-required">*</span>
- </notempty>
- </label>
- <div class="col-md-6 col-sm-10">
- <input class="form-control" name="config[{$key}]" id="{$key}" value="{$form.value}"
- onclick="doSelectLocation(this)"
- data-title="请选择{$form.title|default=''}">
- <present name="form.tip">
- <p class="help-block">{$form.tip}</p>
- </present>
- </div>
- </div>
- </case>
- </switch>
- </foreach>
- <php>
- }
- }
- </php>
|