fields_4_12.html 12.0 KB
<style>
    .font-bold {
        font-weight: bold;
    }

    .font-underline {
        font-weight: bold;
    }

    .radio-inline, .checkbox-inline {
        padding-left: 0;
    }
</style>
<!--@formatter:off-->
{foreach $fields as $item}

<div class="form-group col-md-4 col-xs-12">
    <div class="control-label col-xs-12 col-sm-2">{$item.title|htmlentities}:</div>
    <div class="col-xs-12 col-sm-8">
        {switch $item.type}
        {case string}
        <input {$item.extend_html|htmlentities} type="text" name="row[{$item.name|htmlentities}]" id="c-{$item.name|htmlentities}" value="{$item.value|htmlentities}" class="form-control" data-rule="{$item.rule|htmlentities}" data-tip="{$item.tip|htmlentities}" />
        {/case}
        {case value="text" break="0"}{/case}
        {case editor}
        <textarea {$item.extend_html|htmlentities} name="row[{$item.name|htmlentities}]" id="c-{$item.name|htmlentities}" class="form-control {eq name='$item.type' value='editor'}editor{/eq}" data-rule="{$item.rule|htmlentities}" rows="5" data-tip="{$item.tip|htmlentities}">{$item.value|htmlentities}</textarea>
        {/case}
        {case array}
        {if $item.name=='downloadurl'}
        {php}$item['value']=isset($values[$item['name']])?$item['value']:$item['download_list'];{/php}
        <dl {$item.extend_html|htmlentities} class="fieldlist downloadlist" data-name="row[{$item.name|htmlentities}]" data-template="downloadurltpl">
            <dd>
                <ins style="width:70px;">来源</ins>
                <ins style="width:250px;">地址</ins>
                <ins>密码(可为空)</ins>
            </dd>
            <dd><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
            <textarea name="row[{$item.name|htmlentities}]" class="form-control hide" cols="30" rows="5">{$item.value|htmlentities}</textarea>
        </dl>
        {else /}
        {php}$arrList=isset($values[$item['name']])?(array)json_decode($item['value'],true):$item['content_list'];{/php}
        <dl {$item.extend_html|htmlentities} class="fieldlist" data-name="row[{$item.name|htmlentities}]">
            <dd>
                <ins>{:isset($item["setting"]["key"])&&$item["setting"]["key"]?$item["setting"]["key"]:__('Array key')}</ins>
                <ins>{:isset($item["setting"]["value"])&&$item["setting"]["value"]?$item["setting"]["value"]:__('Array value')}</ins>
            </dd>

            <dd><a href="javascript:;" class="append btn btn-sm btn-success"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
            <textarea name="row[{$item.name|htmlentities}]" class="form-control hide" cols="30" rows="5">{$arrList|json_encode|htmlentities}</textarea>
        </dl>
        {/if}
        {/case}
        {case date}
        <input {$item.extend_html|htmlentities} type="text" name="row[{$item.name|htmlentities}]" id="c-{$item.name|htmlentities}" value="{$item.value|htmlentities}" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-tip="{$item.tip|htmlentities}" data-rule="{$item.rule|htmlentities}" />
        {/case}
        {case time}
        <input {$item.extend_html|htmlentities} type="text" name="row[{$item.name|htmlentities}]" id="c-{$item.name|htmlentities}" value="{$item.value|htmlentities}" class="form-control datetimepicker" data-date-format="HH:mm:ss" data-tip="{$item.tip|htmlentities}" data-rule="{$item.rule|htmlentities}" />
        {/case}
        {case datetime}
        <input {$item.extend_html|htmlentities} type="text" name="row[{$item.name|htmlentities}]" id="c-{$item.name|htmlentities}" value="{$item.value|htmlentities}" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-tip="{$item.tip|htmlentities}" data-rule="{$item.rule|htmlentities}" />
        {/case}
        {case datetimerange}
        <input {$item.extend_html|htmlentities} type="text" name="row[{$item.name|htmlentities}]" id="c-{$item.name|htmlentities}" value="{$item.value|htmlentities}" class="form-control datetimerange" data-tip="{$item.tip|htmlentities}" data-rule="{$item.rule|htmlentities}"/>
        {/case}
        {case number}
        <input {$item.extend_html|htmlentities} type="number" name="row[{$item.name|htmlentities}]" id="c-{$item.name|htmlentities}" value="{$item.value|htmlentities}" class="form-control" data-tip="{$item.tip|htmlentities}" data-rule="{$item.rule|htmlentities}" />
        {/case}
        {case checkbox}
        {foreach name="item.content_list" item="vo"}
        <div class="checkbox checkbox-inline">
            <label for="row[{$item.name|htmlentities}][]-{$key|htmlentities}"><input id="row[{$item.name|htmlentities}][]-{$key|htmlentities}" name="row[{$item.name|htmlentities}][]" type="checkbox" value="{$key|htmlentities}" data-rule="{$item.rule|htmlentities}" data-tip="{$item.tip|htmlentities}" {in name="key" value="$item.value" }checked{/in} /> {$vo|htmlentities}</label>
        </div>
        {/foreach}
        {/case}
        {case radio}
        {foreach name="item.content_list" item="vo"}
        <div class="radio radio-inline">
            <label for="row[{$item.name|htmlentities}]-{$key|htmlentities}"><input id="row[{$item.name|htmlentities}]-{$key|htmlentities}" name="row[{$item.name|htmlentities}]" type="radio" value="{$key|htmlentities}" data-rule="{$item.rule|htmlentities}" data-tip="{$item.tip|htmlentities}" {in name="key" value="$item.value" }checked{/in} /> {$vo|htmlentities}</label>
        </div>
        {/foreach}
        {/case}
        {case value="select" break="0"}{/case}
        {case value="selects"}
        <select {$item.extend_html|htmlentities} name="row[{$item.name|htmlentities}]{$item.type=='selects'?'[]':''}" class="form-control selectpicker" data-rule="{$item.rule|htmlentities}" data-tip="{$item.tip|htmlentities}" {$item.type=='selects'?'multiple':''}>
            {foreach name="item.content_list" item="vo"}
            <option value="{$key|htmlentities}" {in name="key" value="$item.value" }selected{/in}>{$vo|htmlentities}</option>
            {/foreach}
        </select>
        {/case}
        {case value="image" break="0"}{/case}
        {case value="images"}
        <div class="input-group">
            <input id="c-{$item.name|htmlentities}" class="form-control" name="row[{$item.name|htmlentities}]" type="text" value="{$item.value|htmlentities}" data-rule="{$item.rule|htmlentities}" data-tip="{$item.tip|htmlentities}">
            <div class="input-group-addon no-border no-padding">
                <span><button type="button" id="plupload-{$item.name|htmlentities}" class="btn btn-danger plupload" data-input-id="c-{$item.name|htmlentities}" data-preview-id="p-{$item.name|htmlentities}" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="{$item.type=='file'?'false':'true'}" {if $item.maximum}data-maxcount="{$item.maximum|htmlentities}" {/if}><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                <span><button type="button" id="fachoose-{$item.name|htmlentities}" class="btn btn-primary fachoose" data-input-id="c-{$item.name|htmlentities}" data-preview-id="p-{$item.name|htmlentities}" data-mimetype="image/*" data-multiple="{$item.type=='file'?'false':'true'}" {if $item.maximum}data-maxcount="{$item.maximum|htmlentities}" {/if}><i class="fa fa-list"></i> {:__('Choose')}</button></span>
            </div>
            <span class="msg-box n-right" for="c-{$item.name|htmlentities}"></span>
        </div>
        <ul class="row list-inline plupload-preview" id="p-{$item.name|htmlentities}"></ul>
        {/case}
        {case value="file" break="0"}{/case}
        {case value="files"}
        <div class="input-group">
            <input id="c-{$item.name|htmlentities}" class="form-control" name="row[{$item.name|htmlentities}]" type="text" value="{$item.value|htmlentities}" data-rule="{$item.rule|htmlentities}" data-tip="{$item.tip|htmlentities}">
            <div class="input-group-addon no-border no-padding">
                <span><button type="button" id="plupload-{$item.name|htmlentities}" class="btn btn-danger plupload" data-input-id="c-{$item.name|htmlentities}" data-preview-id="p-{$item.name|htmlentities}" data-multiple="{$item.type=='file'?'false':'true'}" {if $item.maximum}data-maxcount="{$item.maximum|htmlentities}" {/if}><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                <span><button type="button" id="fachoose-{$item.name|htmlentities}" class="btn btn-primary fachoose" data-input-id="c-{$item.name|htmlentities}" data-multiple="{$item.type=='file'?'false':'true'}" {if $item.maximum}data-maxcount="{$item.maximum|htmlentities}" {/if}><i class="fa fa-list"></i> {:__('Choose')}</button></span>
            </div>
            <span class="msg-box n-right" for="c-{$item.name|htmlentities}"></span>
        </div>
         <ul class="row list-inline plupload-preview" id="p-{$item.name|htmlentities}"></ul>
        {/case}
        {case switch}
        <input id="c-{$item.name|htmlentities}" name="row[{$item.name|htmlentities}]" type="hidden" value="{:$item.value?1:0}">
        <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-{$item.name|htmlentities}" data-yes="1" data-no="0">
            <i class="fa fa-toggle-on text-success {if !$item.value}fa-flip-horizontal text-gray{/if} fa-2x"></i>
        </a>
        {/case}
        {case bool}
        <label for="row[{$item.name|htmlentities}]-yes"><input id="row[{$item.name|htmlentities}]-yes" name="row[{$item.name|htmlentities}]" type="radio" value="1" {$item.value?'checked':''} data-tip="{$item.tip|htmlentities}" /> {:__('Yes')}</label>
        <label for="row[{$item.name|htmlentities}]-no"><input id="row[{$item.name|htmlentities}]-no" name="row[{$item.name|htmlentities}]" type="radio" value="0" {$item.value?'':'checked'} data-tip="{$item.tip|htmlentities}" /> {:__('No')}</label>
        {/case}
        {case city}
        <div style="position:relative">
        <input {$item.extend_html|htmlentities} type="text" name="row[{$item.name|htmlentities}]" id="c-{$item.name|htmlentities}" value="{$item.value|htmlentities}" class="form-control" data-toggle="city-picker" data-tip="{$item.tip|htmlentities}" data-rule="{$item.rule|htmlentities}" />
        </div>
        {/case}
        {case value="selectpage" break="0"}{/case}
        {case value="selectpages"}
        <input {$item.extend_html|htmlentities} type="text" name="row[{$item.name|htmlentities}]" id="c-{$item.name|htmlentities}" value="{$item.value|htmlentities}" class="form-control selectpage" data-source="{:url('facrm/fields/selectpage')}?id={$item.id|htmlentities}&admin=1" data-primary-key="{$item.setting.primarykey|htmlentities}" data-field="{$item.setting.field|htmlentities}" data-multiple="{$item.type=='selectpage'?'false':'true'}" data-tip="{$item.tip|htmlentities}" data-rule="{$item.rule|htmlentities}" />
        {/case}
        {case custom}
        {$item.extend_html|htmlentities}
        {/case}
        {/switch}
    </div>
</div>
{/foreach}
<!--@formatter:on-->

<script type="text/html" id="downloadurltpl">
    <dd class="form-inline">
        <input type="text" name="<%=name%>[<%=index%>][name]" class="form-control" value="<%=row.name%>" style="width:70px;"/>
        <input type="text" name="<%=name%>[<%=index%>][url]" id="c-downloadurl-<%=index%>" class="form-control" value="<%=row.url%>" style="width:170px;"/>
        <div class="btn-group">
            <button type="button" id="plupload-downloadurl-<%=index%>" class="btn btn-danger plupload" data-input-id="c-downloadurl-<%=index%>" data-mimetype="*" data-multiple="false"><i class="fa fa-upload"></i></button>
            <button type="button" id="fachoose-downloadurl-<%=index%>" class="btn btn-primary fachoose" data-input-id="c-downloadurl-<%=index%>" data-mimetype="*" data-multiple="false"><i class="fa fa-list"></i></button>
        </div>
        <input type="text" name="<%=name%>[<%=index%>][password]" class="form-control" value="<%=row.password%>" style="width:70px;"/>
        <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>
    </dd>
</script>