Example #1
0
function tpl_input_date($params, $ctl)
{
    if (!$params['id']) {
        $params['id'] = $ctl->new_dom_id();
    }
    if (!$params['type']) {
        $params['type'] = 'date';
    }
    if (!$params['vtype']) {
        $params['vtype'] = 'date';
    }
    if (is_numeric($params['value'])) {
        $params['value'] = mydate('Y-m-d', $params['value']);
    }
    if (isset($params['concat'])) {
        $params['name'] .= $params['concat'];
        unset($params['concat']);
    }
    if (!$params['format'] || $params['format'] == 'timestamp') {
        $prefix = '<input type="hidden" name="_DTYPE_' . strtoupper($params['type']) . '[]" value="' . htmlspecialchars($params['name']) . '" />';
    } else {
        $prefix = '';
    }
    $params['type'] = 'text';
    $return = buildTag($params, 'input class="cal ' . $params['class'] . '" size="10" maxlength="10" autocomplete="off"');
    return $prefix . $return . '<script>$("' . $params['id'] . '").makeCalable();</script>';
}
Example #2
0
function smarty_function_img($params, &$smarty)
{
    $imgLib = array('images/bundle/mopen.jpg' => 'width:18px;height:18px;background-image:url(images/ImageBundle.jpg);background-repeat:no-repeat;background-position:0 -0px;', 'images/bundle/action-tools.gif' => 'width:14px;height:14px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -0px;', 'images/bundle/addcate.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -14px;', 'images/bundle/addcate_1.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -30px;', 'images/bundle/blue-dot.gif' => 'width:12px;height:12px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -46px;', 'images/bundle/closeBtn.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -58px;', 'images/bundle/close_btn.gif' => 'width:17px;height:17px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -74px;', 'images/bundle/delecate.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -91px;', 'images/bundle/delecate_1.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -107px;', 'images/bundle/disabled.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -123px;', 'images/bundle/editcate.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -139px;', 'images/bundle/enabled.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -155px;', 'images/bundle/handle-hide.gif' => 'width:12px;height:12px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -171px;', 'images/bundle/handle-show.gif' => 'width:12px;height:12px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -183px;', 'images/bundle/help-about.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -195px;', 'images/bundle/hidden.gif' => 'width:24px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -211px;', 'images/bundle/ico-buy.gif' => 'width:14px;height:18px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -227px;', 'images/bundle/ico-chat.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -245px;', 'images/bundle/ico_help.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -261px;', 'images/bundle/layout.gif' => 'width:19px;height:15px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -277px;', 'images/bundle/mceico_0.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -292px;', 'images/bundle/mceico_1.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -308px;', 'images/bundle/mceico_10.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -324px;', 'images/bundle/mceico_11.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -340px;', 'images/bundle/mceico_12.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -356px;', 'images/bundle/mceico_13.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -372px;', 'images/bundle/mceico_14.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -388px;', 'images/bundle/mceico_15.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -404px;', 'images/bundle/mceico_16.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -420px;', 'images/bundle/mceico_17.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -436px;', 'images/bundle/mceico_18.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -452px;', 'images/bundle/mceico_19.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -468px;', 'images/bundle/mceico_2.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -484px;', 'images/bundle/mceico_20.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -500px;', 'images/bundle/mceico_21.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -516px;', 'images/bundle/mceico_22.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -532px;', 'images/bundle/mceico_23.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -548px;', 'images/bundle/mceico_24.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -564px;', 'images/bundle/mceico_25.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -580px;', 'images/bundle/mceico_26.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -596px;', 'images/bundle/mceico_27.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -612px;', 'images/bundle/mceico_28.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -628px;', 'images/bundle/mceico_29.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -644px;', 'images/bundle/mceico_3.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -660px;', 'images/bundle/mceico_30.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -676px;', 'images/bundle/mceico_31.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -692px;', 'images/bundle/mceico_32.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -708px;', 'images/bundle/mceico_33.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -724px;', 'images/bundle/mceico_34.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -740px;', 'images/bundle/mceico_35.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -756px;', 'images/bundle/mceico_36.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -772px;', 'images/bundle/mceico_37.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -788px;', 'images/bundle/mceico_38.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -804px;', 'images/bundle/mceico_39.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -820px;', 'images/bundle/mceico_4.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -836px;', 'images/bundle/mceico_40.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -852px;', 'images/bundle/mceico_41.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -868px;', 'images/bundle/mceico_42.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -884px;', 'images/bundle/mceico_43.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -900px;', 'images/bundle/mceico_44.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -916px;', 'images/bundle/mceico_45.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -932px;', 'images/bundle/mceico_46.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -948px;', 'images/bundle/mceico_47.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -964px;', 'images/bundle/mceico_48.gif' => 'width:30px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -980px;', 'images/bundle/mceico_5.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -996px;', 'images/bundle/mceico_6.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1012px;', 'images/bundle/mceico_7.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1028px;', 'images/bundle/mceico_8.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1044px;', 'images/bundle/mceico_9.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1060px;', 'images/bundle/minus.gif' => 'width:12px;height:12px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1076px;', 'images/bundle/node-action.gif' => 'width:12px;height:12px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1088px;', 'images/bundle/node-articles.gif' => 'width:12px;height:12px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1100px;', 'images/bundle/node-goodsCat.gif' => 'width:12px;height:12px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1112px;', 'images/bundle/node-page.gif' => 'width:12px;height:12px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1124px;', 'images/bundle/node-pageurl.gif' => 'width:14px;height:12px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1136px;', 'images/bundle/opguide_ico.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1148px;', 'images/bundle/plus.gif' => 'width:12px;height:12px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1164px;', 'images/bundle/printer.gif' => 'width:64px;height:64px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1176px;', 'images/bundle/recover.gif' => 'width:10px;height:10px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1240px;', 'images/bundle/recyclebin.gif' => 'width:11px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1250px;', 'images/bundle/return.gif' => 'width:10px;height:10px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1266px;', 'images/bundle/row_add.gif' => 'width:11px;height:11px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1276px;', 'images/bundle/row_minus.gif' => 'width:11px;height:11px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1287px;', 'images/bundle/showcate.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1298px;', 'images/bundle/sidemaps-action.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1314px;', 'images/bundle/sidemaps-articles.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1330px;', 'images/bundle/sidemaps-goodpackage.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1346px;', 'images/bundle/sidemaps-goodsCat.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1362px;', 'images/bundle/sidemaps-layouts.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1378px;', 'images/bundle/sidemaps-links.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1394px;', 'images/bundle/sidemaps-page.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1410px;', 'images/bundle/sidemaps-pageurl.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1426px;', 'images/bundle/sitemap-closed.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1442px;', 'images/bundle/sitemapclosed.gif' => 'width:9px;height:9px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1458px;', 'images/bundle/sitemapopened.gif' => 'width:9px;height:9px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1467px;', 'images/bundle/sitemaps-opened.gif' => 'width:16px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1476px;', 'images/bundle/tag-1.gif' => 'width:26px;height:26px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1492px;', 'images/bundle/tips.gif' => 'width:18px;height:18px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1518px;', 'images/bundle/tips_help.gif' => 'width:15px;height:15px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1536px;', 'images/bundle/tips_help_mid.gif' => 'width:14px;height:14px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1551px;', 'images/bundle/tips_help_small.gif' => 'width:12px;height:12px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1565px;', 'images/bundle/tips_info.gif' => 'width:14px;height:14px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1577px;', 'images/bundle/visible.gif' => 'width:24px;height:16px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1591px;', 'images/bundle/zoom_btn.gif' => 'width:18px;height:19px;background-image:url(images/ImageBundle.gif);background-repeat:no-repeat;background-position:0 -1607px;', 'images/bundle/tips_help.png' => 'width:15px;height:15px;background-image:url(images/ImageBundle.png);background-repeat:no-repeat;background-position:0 -0px;', 'images/bundle/tips_help_mid.png' => 'width:14px;height:14px;background-image:url(images/ImageBundle.png);background-repeat:no-repeat;background-position:0 -15px;', 'images/bundle/tips_help_small.png' => 'width:12px;height:12px;background-image:url(images/ImageBundle.png);background-repeat:no-repeat;background-position:0 -29px;', 'images/bundle/tips_info.png' => 'width:18px;height:18px;background-image:url(images/ImageBundle.png);background-repeat:no-repeat;background-position:0 -41px;');
    if (isset($imgLib[$params['src']])) {
        $params['style'] = $imgLib[$params['src']] . $params['style'];
        $params['src'] = 'images/transparent.gif';
    }
    return buildTag($params, 'img border="none"');
}
Example #3
0
function tpl_input_fontset($params, $ctl)
{
    $params['type'] = 'fontset';
    $options = array('0' => '', '1' => '粗体', '2' => '斜体', '3' => '中线');
    $html = buildTag($params, 'select class="x-input-select inputstyle"', false);
    foreach ($options as $k => $item) {
        $html .= '<option' . ($params['value'] === $k ? ' selected="selected"' : '') . ' value="' . htmlspecialchars($k) . '">' . htmlspecialchars($item) . '</option>';
    }
    $html .= '</select>';
    return $html;
}
Example #4
0
function tpl_input_bool($params, $ctl)
{
    $params['type'] = 'radio';
    $value = $params['value'];
    unset($params['value']);
    $id = $params['id'] ? $params['id'] : $ctl->new_dom_id();
    $params['id'] = $id . '-t';
    $return = buildTag($params, 'input value="' . ($params['name'] == "is_sec" ? "false" : "true") . '"' . ($value !== 'false' && $value !== '0' && $value ? ' checked="checked"' : '')) . '<label for="' . $params['id'] . __('">是</label>');
    $params['id'] = $id . '-f';
    $return .= '&nbsp' . buildTag($params, 'input value="' . ($params['name'] == "is_sec" ? "true" : "false") . '"' . ($value === 'false' || !$value ? ' checked="checked"' : '')) . '<label for="' . $params['id'] . __('">否</label>');
    return $return . '<input type="hidden" name="_DTYPE_BOOL[]" value="' . htmlspecialchars($params['name']) . '" />';
}
Example #5
0
function tpl_input_gender($params, $ctl)
{
    $params['type'] = 'radio';
    $value = $params['value'];
    unset($params['value']);
    $id = $params['id'] ? $params['id'] : $ctl->new_dom_id();
    $params['id'] = $id . '-m';
    $return = buildTag($params, 'input value="male"' . ($value == 'male' ? ' checked="checked"' : '')) . '<label for="' . $params['id'] . __('">男</label>');
    $params['id'] = $id . '-fm';
    $return .= '&nbsp' . buildTag($params, 'input value="female"' . ($value == 'female' ? ' checked="checked"' : '')) . '<label for="' . $params['id'] . __('">女</label>');
    return $return;
}
Example #6
0
function tpl_input_intbool($params, $ctl)
{
    $params['type'] = 'radio';
    $value = $params['value'];
    unset($params['value']);
    $id = $params['id'] ? $params['id'] : $ctl->new_dom_id();
    $params['id'] = $id . '-t';
    $return = buildTag($params, 'input value="1"' . ($value == 1 ? ' checked="checked"' : '')) . '<label for="' . $params['id'] . __('">是</label>');
    $params['id'] = $id . '-f';
    $return .= '&nbsp' . buildTag($params, 'input value="0"' . ($value == 0 ? ' checked="checked"' : '')) . '<label for="' . $params['id'] . __('">否</label>');
    return $return;
}
Example #7
0
function tpl_input_select($params, $ctl)
{
    if ($params['stype'] == 'arrow') {
        $params['options'] = array('arrow_1.gif' => '箭头1', 'arrow_2.gif' => '箭头2', 'arrow_3.gif' => '箭头3', 'arrow_4.gif' => '箭头4', 'arrow_5.gif' => '箭头5', 6 => '自定义');
    }
    if ($params['stype'] == 'rank') {
        $params['options'] = array('view_w_count' => '周访问次数', 'view_count' => '总访问次数', 'buy_w_count' => '周购买次数', 'buy_count' => '总购买次数', 'comments_count' => '评论次数');
    }
    if ($params['stype'] == 'fontset') {
        $params['options'] = array('0' => '默认', '1' => '粗体', '2' => '斜体', '3' => '中线');
    }
    $class = $params['class'];
    if (is_string($params['options'])) {
        if (!$params['id']) {
            $params['id'] = $ctl->new_dom_id();
        }
        $params['remote_url'] = $params['options'];
        $params['options'] = array($params['value'] => $params['value']);
        $script = '<script>$(\'' . $params['id'] . '\').addEvent(\'focus\',window.init_select)</script>';
    }
    if ($params['rows']) {
        foreach ($params['rows'] as $r) {
            $step[$r[$params['valueColumn']]] = intval($r['step']);
            $options[$r[$params['valueColumn']]] = $r[$params['labelColumn']];
        }
        unset($params['valueColumn'], $params['labelColumn'], $params['rows']);
    } else {
        $options = $params['options'];
        unset($params['options']);
    }
    $params['name'] = $params['search'] ? '_' . $params['name'] . '_search' : $params['name'];
    $value = $params['value'];
    unset($params['value']);
    $html = buildTag($params, 'select class="x-input-select ' . $class . ' inputstyle"', false);
    if ($params['nulloption'] == 1) {
        $html .= '<option value="">请选择</option>';
    }
    if ($params['nulloption'] == 0) {
        $html .= '';
    }
    foreach ($options as $k => $item) {
        if ($k === '0' || $k === 0) {
            $selected = $value === '0' || $value === 0;
        } else {
            $selected = $value == $k;
        }
        $t_step = $step[$k] ? str_repeat('&nbsp;', ($step[$k] - 1) * 3) : '';
        $html .= '<option' . ($selected ? ' selected="selected"' : '') . ' value="' . htmlspecialchars($k) . '">' . $t_step . htmlspecialchars($item) . '</option>';
    }
    $html .= '</select>';
    return $html . $script;
}
Example #8
0
function tpl_input_textarea($params, $ctl)
{
    $value = $params['value'];
    if ($params['width']) {
        $params['style'] .= ';width:' . $params['width'];
        unset($params['width']);
    }
    if ($params['height']) {
        $params['style'] .= ';height:' . $params['height'];
        unset($params['height']);
    }
    unset($params['value']);
    return buildTag($params, 'textarea', false) . htmlspecialchars($value) . '</textarea>';
}
Example #9
0
function smarty_function_img($params, &$smarty)
{
    if ($params['path']) {
        $params['src'] = 'statics/' . $params['path'] . '/' . $params['src'];
    }
    $params['src'] = str_replace('//', '/', $params['src']);
    unset($params['path']);
    $imgLib = array('statics/icons/arrow_1.gif' => 'width:11px;height:11px;background-image:url(statics/icons.gif);background-repeat:no-repeat;background-position:0 -0px;', 'statics/icons/arrow_10.gif' => 'width:9px;height:9px;background-image:url(statics/icons.gif);background-repeat:no-repeat;background-position:0 -11px;', 'statics/icons/arrow_11.gif' => 'width:12px;height:8px;background-image:url(statics/icons.gif);background-repeat:no-repeat;background-position:0 -20px;', 'statics/icons/arrow_2.gif' => 'width:7px;height:7px;background-image:url(statics/icons.gif);background-repeat:no-repeat;background-position:0 -28px;', 'statics/icons/arrow_3.gif' => 'width:7px;height:7px;background-image:url(statics/icons.gif);background-repeat:no-repeat;background-position:0 -35px;', 'statics/icons/arrow_4.gif' => 'width:9px;height:9px;background-image:url(statics/icons.gif);background-repeat:no-repeat;background-position:0 -42px;', 'statics/icons/arrow_5.gif' => 'width:11px;height:11px;background-image:url(statics/icons.gif);background-repeat:no-repeat;background-position:0 -51px;', 'statics/icons/arrow_6.gif' => 'width:17px;height:7px;background-image:url(statics/icons.gif);background-repeat:no-repeat;background-position:0 -62px;', 'statics/icons/arrow_7.gif' => 'width:5px;height:5px;background-image:url(statics/icons.gif);background-repeat:no-repeat;background-position:0 -69px;', 'statics/icons/arrow_8.gif' => 'width:18px;height:14px;background-image:url(statics/icons.gif);background-repeat:no-repeat;background-position:0 -74px;', 'statics/icons/arrow_9.gif' => 'width:11px;height:11px;background-image:url(statics/icons.gif);background-repeat:no-repeat;background-position:0 -88px;', 'statics/icons/btn_adj_buy.gif' => 'width:64px;height:25px;background-image:url(statics/icons.gif);background-repeat:no-repeat;background-position:0 -99px;', 'statics/icons/btn_goods_gallery.gif' => 'width:101px;height:26px;background-image:url(statics/icons.gif);background-repeat:no-repeat;background-position:0 -124px;', 'statics/icons/btn_pkg_buy.gif' => 'width:64px;height:24px;background-image:url(statics/icons.gif);background-repeat:no-repeat;background-position:0 -150px;', 'statics/icons/icon_asc.gif' => 'width:13px;height:12px;background-image:url(statics/icons.gif);background-repeat:no-repeat;background-position:0 -174px;', 'statics/icons/icon_asc_gray.gif' => 'width:13px;height:12px;background-image:url(statics/icons.gif);background-repeat:no-repeat;background-position:0 -186px;', 'statics/icons/icon_delete.gif' => 'width:13px;height:12px;background-image:url(statics/icons.gif);background-repeat:no-repeat;background-position:0 -198px;', 'statics/icons/icon_desc.gif' => 'width:13px;height:12px;background-image:url(statics/icons.gif);background-repeat:no-repeat;background-position:0 -210px;', 'statics/icons/icon_desc_gray.gif' => 'width:13px;height:12px;background-image:url(statics/icons.gif);background-repeat:no-repeat;background-position:0 -222px;', 'statics/icons/pic6.gif' => 'width:30px;height:30px;background-image:url(statics/icons.gif);background-repeat:no-repeat;background-position:0 -234px;', 'statics/bundle/arrow-down.gif' => 'width:11px;height:11px;background-image:url(statics/bundle.gif);background-repeat:no-repeat;background-position:0 -0px;', 'statics/bundle/cart.gif' => 'width:16px;height:16px;background-image:url(statics/bundle.gif);background-repeat:no-repeat;background-position:0 -11px;', 'statics/bundle/ico_comment_1.gif' => 'width:10px;height:10px;background-image:url(statics/bundle.gif);background-repeat:no-repeat;background-position:0 -27px;', 'statics/bundle/ico_comment_2.gif' => 'width:10px;height:10px;background-image:url(statics/bundle.gif);background-repeat:no-repeat;background-position:0 -37px;', 'statics/bundle/spacer.gif' => 'width:2px;height:2px;background-image:url(statics/bundle.gif);background-repeat:no-repeat;background-position:0 -47px;', 'statics/bundle/wheel.gif' => 'width:24px;height:27px;background-image:url(statics/bundle.gif);background-repeat:no-repeat;background-position:0 -49px;');
    if (isset($imgLib[$params['src']])) {
        $system =& $GLOBALS['system'];
        $params['style'] = $imgLib[$params['src']] . $params['style'];
        $params['src'] = $system->base_url() . '/statics/transparent.gif';
    }
    return buildTag($params, 'img border="none"');
}
Example #10
0
function tpl_input_default($params, $ctl)
{
    $ignore = array('password' => 1, 'file' => 1, 'hidden' => 1);
    if (!isset($ignore[$params['type']])) {
        if (!isset($params['vtype'])) {
            $params['vtype'] = $params['type'];
        }
        $params['type'] = 'text';
    }
    if (isset($params['emptytext'])) {
        if (!$params['value']) {
            $params['value'] = $params['emptytext'];
            $params['class'] = 'emptytext';
        }
        $params['onclick'] = '$(this).clearEmptyText()';
    }
    return buildTag($params, 'input autocomplete="off" class="x-input ' . $params['class'] . '"');
}
Example #11
0
function tpl_input_color($params, $ctl)
{
    if (!$params['id']) {
        $domid = 'colorPicker_' . substr(md5(rand(0, time())), 0, 6);
        $params['id'] = $domid;
    } else {
        $domid = $params['id'];
    }
    if ($params['value'] == '') {
        $params['value'] = 'default';
    }
    return buildTag($params, 'input autocomplete="off"') . ' <input type="button" id="c_' . $domid . '" style="width:22px;height:22px;background-color:' . $params['value'] . ';border:0px #ccc solid;cursor:pointer"/><script>
    new GoogColorPicker("c_' . $domid . '",{
       onSelect:function(hex,rgb,el){
          $("' . $domid . '").set("value",hex);
          el.setStyle("background-color",hex);
       }
    })</script>';
}
Example #12
0
function tpl_input_radio($params, $ctl)
{
    $params['type'] = 'radio';
    $options = $params['options'];
    $value = $params['value'];
    unset($params['options'], $params['value']);
    $input_tpl = buildTag($params, 'input ', true);
    $id_base = $params['id'] ? $params['id'] : $ctl->new_dom_id();
    foreach ($options as $k => $item) {
        $id = $id_base . $i++;
        if ($value == $k) {
            $html .= str_replace('/>', ' id="' . $id . '" value="' . htmlspecialchars($k) . '" checked="checked" />', $input_tpl);
        } else {
            $html .= str_replace('/>', ' id="' . $id . '" value="' . htmlspecialchars($k) . '" />', $input_tpl);
        }
        $params['separator'] = $params['separator'] ? $params['separator'] : '<br>';
        $html .= '<label for="' . $id . '">' . htmlspecialchars($item) . '</label>' . $params['separator'];
    }
    return $html;
}
Example #13
0
function tpl_input_money($params, $ctl)
{
    if (!isset($params['vtype'])) {
        $params['vtype'] = 'number';
    }
    $params['type'] = 'text';
    $system =& $GLOBALS['system'];
    $oCur =& $system->loadModel('system/cur');
    $aCur = $oCur->getFormat();
    if (isset($params['value']) && $params['value'] !== '') {
        $params['value'] = number_format($params['value'], $aCur['decimals'], '.', '');
    }
    if (isset($params['emptytext'])) {
        if (!$params['value']) {
            $params['value'] = $params['emptytext'];
            $params['class'] = 'emptytext';
        }
        $parmas['onfocus'] = '$(this).emptyText()';
    }
    return $aCur['sign'] . buildTag($params, 'input autocomplete="off" class="x-input ' . $params['class'] . '"');
}
Example #14
0
function smarty_function_input($params, &$smarty)
{
    if (isset($params['attributes'])) {
        $params = $params['attributes'];
    }
    $params['class'] = $params['class'] ? $params['class'] . ' _x_ipt' : '_x_ipt' . ' ' . $params['type'];
    $params['vtype'] = isset($params['vtype']) ? $params['vtype'] : $params['type'];
    if (isset($params['default']) && !$params['value']) {
        $params['value'] = $params['default'];
    }
    switch ($params['type']) {
        case 'text':
            return buildTag($params, 'input autocomplete="off"');
            break;
        case 'password':
            return buildTag($params, 'input autocomplete="off"');
            break;
        case 'search':
            return buildTag($params, 'input autocomplete="off"');
            break;
        case 'date':
            if (!$params['id']) {
                $domid = 'mce_' . substr(md5(rand(0, time())), 0, 6);
                $params['id'] = $domid;
            } else {
                $domid = $params['id'];
            }
            $params['value'] = mydate('Y-m-d', $params['value']);
            $params['type'] = 'text';
            return buildTag($params, 'input autocomplete="off"') . '<script>$("' . $domid . '").makeCalable();</script>';
            break;
        case 'time':
            $params['value'] = mydate('Y-m-d H:i', $params['value']);
            return buildTag($params, 'input autocomplete="off"');
            break;
        case 'file':
            if ($params['backend'] == 'public') {
                if (!$GLOBALS['storager']) {
                    $system =& $GLOBALS['system'];
                    $GLOBALS['storager'] = $system->loadModel('system/storager');
                }
                $storager =& $GLOBALS['storager'];
                $url = $storager->getUrl($params['value']);
                $img = array('png' => 1, 'gif' => 1, 'jpg' => 1, 'jpeg' => 1);
                if ($img[strtolower(substr($url, strrpos($url, '.') + 1))]) {
                    $html = '<img src="' . $url . '" />';
                } else {
                    $html = $url;
                }
            } else {
                $html = '';
            }
            return buildTag($params, 'input autocomplete="off"') . $html;
            break;
        case 'bool':
            $params['type'] = 'checkbox';
            if ($value == 'true') {
                $params['checked'] = 'checked';
            }
            $params['value'] = "true";
            return buildTag($params, 'input');
            break;
        case 'combox':
            return buildTag($params, 'input autocomplete="off"');
            break;
        case 'textarea':
            $value = $params['value'];
            if ($params['width']) {
                $params['style'] .= ';width:' . $params['width'];
                unset($params['width']);
            }
            if ($params['height']) {
                $params['style'] .= ';height:' . $params['height'];
                unset($params['height']);
            }
            unset($params['value']);
            return buildTag($params, 'textarea', false) . htmlspecialchars($value) . '</textarea>';
            break;
        case 'checkbox':
            $params['selected'] = $params['value'];
            smarty_core_load_plugins(array('plugins' => array(array('function', 'html_checkboxes', $smarty->_current_file, $smarty->_current_line_no, 20, false))), $smarty);
            return smarty_function_html_checkboxes($params, $smarty);
            break;
        case 'radio':
            $params['selected'] = $params['value'];
            smarty_core_load_plugins(array('plugins' => array(array('function', 'html_radios', $smarty->_current_file, $smarty->_current_line_no, 20, false))), $smarty);
            return smarty_function_html_radios($params, $smarty);
            break;
        case 'select':
            if (isset($params['rows'])) {
                foreach ($params['rows'] as $item) {
                    $params['options'][$item[$params['valueColumn']]] = $item[$params['labelColumn']];
                }
            }
            if ($params['nulloption']) {
                $params['options'] = array_merge2(array('' => __('- 请选择 -')), $params['options']);
            }
            $params['selected'] = $params['value'];
            $t = buildTag($params, 'select', false);
            unset($params['name']);
            smarty_core_load_plugins(array('plugins' => array(array('function', 'html_options', $smarty->_current_file, $smarty->_current_line_no, 20, false))), $smarty);
            return $t . smarty_function_html_options($params, $smarty) . '</select>';
            break;
        case 'color':
            $params['selected'] = $params['value'] == '' ? '#000000' : $params['value'];
            $params['style'] = 'width:50px;background-color:' . $params['selected'];
            $params['onChange'] = "this.style.backgroundColor=this.options[this.selectedIndex].value;";
            $t = buildTag($params, 'select', false);
            unset($params['name']);
            $params['color'] = array('#00ffff' => '&nbsp;', '#000000' => '&nbsp;', '#ff00ff' => '&nbsp;', '#800000' => '&nbsp;', '#008000' => '&nbsp;', '#00ff00' => '&nbsp;', '#800000' => '&nbsp;', '#000080' => '&nbsp;', '#808000' => '&nbsp;', '#800080' => '&nbsp;', '#ff0000' => '&nbsp;', '#c0c0c0' => '&nbsp;', '#008080' => '&nbsp;', '#ffffff' => '&nbsp;', '#ffff00' => '&nbsp;', '#0000ff' => '&nbsp;');
            return $t . _build_color_options($params) . '</select>';
            break;
        case 'region':
            $SYSTEM =& $GLOBALS['system'];
            $loc =& $SYSTEM->loadModel('system/local');
            if ($params['required'] == 'true') {
                $req = ' vtype="area"';
            } else {
                $req = ' vtype=' . $params['vtype'];
            }
            if (!$params['value']) {
                $package = $params['package'] ? $params['package'] : $SYSTEM->getConf('system.location');
                return '<span package="' . $package . '" class="span _x_ipt"' . $req . '><input ' . ($params['id'] ? ' id="' . $params['id'] . '"  ' : '') . ' type="hidden" name="' . $params['name'] . '" />' . $loc->get_area_select(null, $params) . '</span>';
            } else {
                list($package, $regions, $region_id) = explode(':', $params['value']);
                if (!is_numeric($region_id)) {
                    if (!$package) {
                        $package = $SYSTEM->getConf('system.location');
                    }
                    return '<span package="' . $package . '" class="span _x_ipt"' . $req . '><input type="hidden" name="' . $params['name'] . '" />' . $loc->get_area_select(null, $params) . '</span>';
                } else {
                    $arr_regions = array();
                    $ret = '';
                    while ($region_id && ($region = $loc->instance($region_id, 'region_id,local_name,p_region_id'))) {
                        array_unshift($arr_regions, $region);
                        if ($region_id = $region['p_region_id']) {
                            $notice = "-";
                            $data = $loc->get_area_select($region['p_region_id'], $params, $region['region_id']);
                            if (!$data) {
                                $notice = "";
                            }
                            $ret = '<span class="x-region-child">&nbsp;' . $notice . '&nbsp' . $loc->get_area_select($region['p_region_id'], $params, $region['region_id']) . $ret . '</span>';
                        } else {
                            $ret = '<span package="' . $package . '" class="span _x_ipt"' . $req . '><input type="hidden" value="' . $params['value'] . '" name="' . $params['name'] . '" />' . $loc->get_area_select(null, $params, $region['region_id']) . $ret . '</span>';
                        }
                    }
                    if (!$ret) {
                        $ret = '<span package="' . $package . '" class="span _x_ipt"' . $req . '><input type="hidden" value="" name="' . $params['name'] . '" />' . $loc->get_area_select(null, $params, $region['region_id']) . '</span>';
                    }
                    return $ret;
                }
            }
            break;
        case 'fontset':
            $params['options'] = array('0' => '', '1' => '粗体', '2' => '斜体', '3' => '中线');
            $params['selected'] = $params['value'];
            $t = buildTag($params, 'select', false);
            unset($params['name']);
            smarty_core_load_plugins(array('plugins' => array(array('function', 'html_options', $smarty->_current_file, $smarty->_current_line_no, 20, false))), $smarty);
            return $t . smarty_function_html_options($params, $smarty) . '</select>';
            //return '<select id="'.$params['name'].'" name="'.$params['name'].'">'._comset_set($params['value'],$params['font']).'</select>';
            break;
        case 'arrow':
            $params['selected'] = $params['value'];
            $params['options'] = array('arrow_1.gif' => '箭头1', 'arrow_2.gif' => '箭头2', 'arrow_3.gif' => '箭头3', 'arrow_4.gif' => '箭头4', 'arrow_5.gif' => '箭头5', 6 => '自定义');
            //return '<select id="'.$params['name'].'" name="'.$params['name'].'" onClick="choosePic()">'._comset_set($params['value'],$params['arrow']).'</select>';
            $t = buildTag($params, 'select', false);
            unset($params['name']);
            smarty_core_load_plugins(array('plugins' => array(array('function', 'html_options', $smarty->_current_file, $smarty->_current_line_no, 20, false))), $smarty);
            return $t . smarty_function_html_options($params, $smarty) . '</select>';
            break;
        case 'com_select':
            $params['from'] = intval($params['from']);
            $params['options'] = array();
            $params['to'] = intval($params['to']);
            for ($i = $params['from']; $i <= $params['to']; $i++) {
                array_push($params['options'], $i);
            }
            $params['selected'] = $params['value'];
            $t = buildTag($params, 'select', false);
            unset($params['name']);
            smarty_core_load_plugins(array('plugins' => array(array('function', 'html_options', $smarty->_current_file, $smarty->_current_line_no, 20, false))), $smarty);
            return $t . smarty_function_html_options($params, $smarty) . '</select>';
            break;
        default:
            return buildTag($params, 'input autocomplete="off"');
    }
}
Example #15
0
function tpl_input_combox($params, $ctl)
{
    return buildTag($params, 'input autocomplete="off"');
}
Example #16
0
 function inputElement($params)
 {
     $ident = md5(print_r($params['filter'], true));
     $max = 1000;
     if ($params['data']) {
         $this->_input[$ident] = $params['data'];
     }
     if (!isset($this->_input[$ident])) {
         $this->_input[$ident] = $this->getList($this->idColumn . ',' . $this->textColumn, $params['filter'], 0, $max, $this->_input[$ident . '_c']);
     }
     unset($params['filter']);
     $html = buildTag($params, 'select', true);
     if (!$params['value']) {
         $html .= '<option></option>';
     }
     foreach ($this->_input[$ident] as $r) {
         $html .= '<option value="' . $r[$this->idColumn] . '"' . ($r[$this->idColumn] == $params['value'] ? ' selected="selected"' : '') . '>' . $r[$this->textColumn] . '</option>';
     }
     if ($this->_input[$ident . '_c'] > $max) {
         $html .= '<option>更多' . $this->_input[$ident . '_c'] - $max . '...</option>';
     }
     return $html .= '</select>';
 }
Example #17
0
function smarty_function_input($params, &$smarty)
{
    if (isset($params['attributes'])) {
        $params = $params['attributes'];
    }
    $params['style'] .= '';
    if (isset($params['width'])) {
        $params['style'] = 'width:' . $params['width'] . 'px;' . $params['style'];
        unset($params['width']);
    }
    $params['class'] = $params['class'] ? $params['class'] . ' _x_ipt' : '_x_ipt' . ' ' . $params['type'];
    $params['vtype'] = isset($params['vtype']) ? $params['vtype'] : $params['type'];
    if (isset($smarty->_tpl_vars['disabledElement']) && $smarty->_tpl_vars['disabledElement']) {
        $params['disabled'] = 'disabled';
    }
    if (substr($params['type'], 0, 4) == 'enum') {
        $params['type'] = $params['inputType'] ? $params['inputType'] : 'select';
        $params['vtype'] = $params['inputType'] ? $params['inputType'] : 'select';
    } elseif (substr($params['type'], 0, 7) != 'object:') {
        $params['type'] = $params['inputType'] ? $params['inputType'] : $params['type'];
        $params['vtype'] = $params['inputType'] ? $params['inputType'] : $params['type'];
    }
    if (substr($params['type'], 0, 7) == 'object:') {
        include 'objects.php';
        $aTmp = explode(':', $params['type']);
        $params['filter'] = $params['options'];
        //传递filter参数 added by Ever 20080701
        if (!$smarty->_loaded_object_module[$aTmp[1]][$aTmp[2]]['data']) {
            $mod =& $smarty->system->loadModel($objects[$aTmp[1]]);
            if ($aTmp[2]) {
                $params['data'] = $mod->{$aTmp}[2]();
                $smarty->_loaded_object_module[$aTmp[1]][$aTmp[2]]['data'] = $params['data'];
            }
        } else {
            $mod =& $smarty->system->loadModel($objects[$aTmp[1]]);
            $params['data'] = $smarty->_loaded_object_module[$aTmp[1]][$aTmp[2]]['data'];
        }
        return $mod->inputElement($params);
    } else {
        switch ($params['type']) {
            case 'text':
                return buildTag($params, 'input autocomplete="off"');
                break;
            case 'password':
                return buildTag($params, 'input autocomplete="off"');
                break;
            case 'search':
                return buildTag($params, 'input autocomplete="off"');
                break;
            case 'date':
                if (!$params['id']) {
                    $domid = 'mce_' . substr(md5(rand(0, time())), 0, 6);
                    $params['id'] = $domid;
                } else {
                    $domid = $params['id'];
                }
                if (is_int($params['value'])) {
                    $params['value'] = mydate('Y-m-d', $params['value']);
                }
                //            $params['value'] = mydate('Y-m-d',$params['value']);
                $params['type'] = 'text';
                return buildTag($params, 'input autocomplete="off"') . '<script>$("' . $domid . '").makeCalable();</script>';
                break;
            case 'color':
                if (!$params['id']) {
                    $domid = 'colorPicker_' . substr(md5(rand(0, time())), 0, 6);
                    $params['id'] = $domid;
                } else {
                    $domid = $params['id'];
                }
                if ($params['value'] == '') {
                    $params['value'] = 'default';
                    //          $params['style']='background-color:#ffffff;cursor:pointer';
                } else {
                    //        $params['style']='background-color:'.$params['value'].';cursor:pointer';
                }
                //           $params['readonly']='false';
                return buildTag($params, 'input autocomplete="off"') . ' <input type="button" id="c_' . $domid . '" style="width:22px;height:22px;background-color:' . $params['value'] . ';border:0px #ccc solid;cursor:pointer"/><script>
            new GoogColorPicker("c_' . $domid . '",{
               onSelect:function(hex,rgb,el){
                  $("' . $domid . '").set("value",hex);
                  el.setStyle("background-color",hex);
               }
            })</script>';
                break;
            case 'time':
                if (is_int($params['value'])) {
                    $params['value'] = mydate('Y-m-d H:i', $params['value']);
                }
                return buildTag($params, 'input autocomplete="off"');
                break;
            case 'file':
                if ($params['backend'] == 'public') {
                    if (!$GLOBALS['storager']) {
                        $system =& $GLOBALS['system'];
                        $GLOBALS['storager'] = $system->loadModel('system/storager');
                    }
                    $storager =& $GLOBALS['storager'];
                    $url = $storager->getUrl($params['value']);
                    $img = array('png' => 1, 'gif' => 1, 'jpg' => 1, 'jpeg' => 1);
                    if ($img[strtolower(substr($url, strrpos($url, '.') + 1))]) {
                        $html = '<img src="' . $url . '?' . time() . '" style="float:none" />';
                    } else {
                        $html = $url;
                    }
                } else {
                    $html = '';
                }
                return $html . buildTag($params, 'input autocomplete="off"');
                break;
            case 'bool':
                $params['type'] = 'checkbox';
                if ($params['value'] == 'true' || intval($params['value']) > 0) {
                    $params['checked'] = 'checked';
                }
                if ($params['value'] === '0' || $params['value'] === '1') {
                    $params['value'] = 1;
                } else {
                    $params['value'] = 'true';
                }
                return buildTag($params, 'input');
                break;
            case 'combox':
                return buildTag($params, 'input autocomplete="off"');
                break;
            case 'html':
                $id = 'mce_' . substr(md5(rand(0, time())), 0, 6);
                $system =& $GLOBALS['system'];
                $editor_type = $system->getConf("system.editortype");
                $editor_type == '' ? $editor_type = 'textarea' : ($editor_type = 'wysiwyg');
                if ($editor_type == 'textarea' || $params['editor_type'] == 'textarea') {
                    $smarty->_smarty_include(array('smarty_include_tpl_file' => 'editor/style_2.html', 'smarty_include_vars' => array('var' => $id, 'for' => $id)));
                } else {
                    $smarty->_smarty_include(array('smarty_include_tpl_file' => 'editor/style_1.html', 'smarty_include_vars' => array('var' => $id, 'for' => $id, 'includeBase' => $params['includeBase'] ? $params['includeBase'] : true)));
                }
                $params['id'] = $id;
                $params['editor_type'] = $params['editor_type'] ? $params['editor_type'] : $editor_type;
                $smarty->_smarty_include(array('smarty_include_tpl_file' => 'editor/body.html', 'smarty_include_vars' => $params));
                break;
            case 'textarea':
                $value = $params['value'];
                if ($params['width']) {
                    $params['style'] .= ';width:' . $params['width'];
                    unset($params['width']);
                }
                if ($params['height']) {
                    $params['style'] .= ';height:' . $params['height'];
                    unset($params['height']);
                }
                unset($params['value']);
                return buildTag($params, 'textarea', false) . htmlspecialchars($value) . '</textarea>';
                break;
            case 'checkbox':
                $params['selected'] = $params['value'];
                smarty_core_load_plugins(array('plugins' => array(array('function', 'html_checkboxes', $smarty->_current_file, $smarty->_current_line_no, 20, false))), $smarty);
                return smarty_function_html_checkboxes($params, $smarty);
                break;
            case 'radio':
                $params['selected'] = $params['value'];
                unset($params['value']);
                smarty_core_load_plugins(array('plugins' => array(array('function', 'html_radios', $smarty->_current_file, $smarty->_current_line_no, 20, false))), $smarty);
                return smarty_function_html_radios($params, $smarty);
                break;
            case 'select':
                if (isset($params['rows'])) {
                    foreach ($params['rows'] as $item) {
                        $params['options'][$item[$params['valueColumn']]] = $item[$params['labelColumn']] . $out;
                    }
                }
                if ($params['nulloption']) {
                    $params['options'] = array_merge2(array('' => __('- 请选择 -')), $params['options']);
                }
                $params['selected'] = $params['value'];
                $t = buildTag($params, 'select', false);
                unset($params['name']);
                smarty_core_load_plugins(array('plugins' => array(array('function', 'html_options', $smarty->_current_file, $smarty->_current_line_no, 20, false))), $smarty);
                return $t . smarty_function_html_options($params, $smarty) . '</select>';
                break;
            case 'fontset':
                $params['options'] = array('0' => '默认', '1' => '粗体', '2' => '斜体', '3' => '中线');
                $params['selected'] = $params['value'];
                $t = buildTag($params, 'select', false);
                unset($params['name']);
                smarty_core_load_plugins(array('plugins' => array(array('function', 'html_options', $smarty->_current_file, $smarty->_current_line_no, 20, false))), $smarty);
                return $t . smarty_function_html_options($params, $smarty) . '</select>';
                //return '<select id="'.$params['name'].'" name="'.$params['name'].'">'._comset_set($params['value'],$params['font']).'</select>';
                break;
            case 'region':
                $SYSTEM =& $GLOBALS['system'];
                $loc =& $SYSTEM->loadModel('system/local');
                if ($params['required'] == 'true') {
                    $req = ' vtype="area"';
                } else {
                    $req = ' vtype=' . $params['pptype'];
                }
                if (!$params['value']) {
                    $package = $params['package'] ? $params['package'] : $SYSTEM->getConf('system.location');
                    $package = $package ? $package : 'mainland';
                    return '<span package="' . $package . '" class="span _x_ipt"' . $req . '><input type="hidden" name="' . $params['name'] . '" />' . $loc->get_area_select(null, $params) . '</span>';
                } else {
                    list($package, $regions, $region_id) = explode(':', $params['value']);
                    if (!is_numeric($region_id)) {
                        if (!$package) {
                            $package = $SYSTEM->getConf('system.location');
                        }
                        return '<span package="' . $package . '" class="span _x_ipt"' . $req . '><input type="hidden" name="' . $params['name'] . '" />' . $loc->get_area_select(null, $params) . '</span>';
                    } else {
                        $arr_regions = array();
                        $ret = '';
                        while ($region_id && ($region = $loc->instance($region_id, 'region_id,local_name,p_region_id'))) {
                            array_unshift($arr_regions, $region);
                            if ($region_id = $region['p_region_id']) {
                                $ret = '<span class="x-region-child">&nbsp;-&nbsp' . $loc->get_area_select($region['p_region_id'], $params, $region['region_id']) . $ret . '</span>';
                            } else {
                                $ret = '<span package="' . $package . '" class="span _x_ipt"' . $req . '><input type="hidden" value="' . $params['value'] . '" name="' . $params['name'] . '" />' . $loc->get_area_select(null, $params, $region['region_id']) . $ret . '</span>';
                            }
                        }
                        return $ret;
                    }
                }
                break;
            case 'arrow':
                $params['selected'] = $params['value'];
                $params['options'] = array('arrow_1.gif' => '箭头1', 'arrow_2.gif' => '箭头2', 'arrow_3.gif' => '箭头3', 'arrow_4.gif' => '箭头4', 'arrow_5.gif' => '箭头5', 6 => '自定义');
                //return '<select id="'.$params['name'].'" name="'.$params['name'].'" onClick="choosePic()">'._comset_set($params['value'],$params['arrow']).'</select>';
                $t = buildTag($params, 'select', false);
                unset($params['name']);
                smarty_core_load_plugins(array('plugins' => array(array('function', 'html_options', $smarty->_current_file, $smarty->_current_line_no, 20, false))), $smarty);
                return $t . smarty_function_html_options($params, $smarty) . '</select>';
                break;
            case 'rank':
                $params['selected'] = $params['value'];
                $params['options'] = array('view_w_count' => '周访问次数', 'view_count' => '总访问次数', 'buy_w_count' => '周购买次数', 'buy_count' => '总购买次数', 'comments_count' => '评论次数');
                //return '<select id="'.$params['name'].'" name="'.$params['name'].'" onClick="choosePic()">'._comset_set($params['value'],$params['arrow']).'</select>';
                $t = buildTag($params, 'select', false);
                unset($params['name']);
                smarty_core_load_plugins(array('plugins' => array(array('function', 'html_options', $smarty->_current_file, $smarty->_current_line_no, 20, false))), $smarty);
                return $t . smarty_function_html_options($params, $smarty) . '</select>';
                break;
            case 'com_select':
                $params['from'] = intval($params['from']);
                $params['options'] = array();
                $params['to'] = intval($params['to']);
                for ($i = $params['from']; $i <= $params['to']; $i++) {
                    array_push($params['options'], $i);
                }
                $params['selected'] = $params['value'];
                $t = buildTag($params, 'select', false);
                unset($params['name']);
                smarty_core_load_plugins(array('plugins' => array(array('function', 'html_options', $smarty->_current_file, $smarty->_current_line_no, 20, false))), $smarty);
                return $t . smarty_function_html_options($params, $smarty) . '</select>';
                break;
            case 'viewIMG':
                return "<a style='text-decoration:none;' class='viewIMG' href='javascript:void(0);' onclick='viewIMG(\"" . $params['value'] . "\",this);this.blur();'  title='点击查看图片'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
                break;
            default:
                return buildTag($params, 'input autocomplete="off"');
        }
    }
}