function more_or_less($sort, $rev, $show_all) { echo "<p>"; if ($show_all) { $url = link_url($sort, $rev, 0); echo "Show: All computers | <a href={$url}>Only computers active in past 30 days</a>"; } else { $url = link_url($sort, $rev, 1); echo "Show: <a href={$url}>All computers</a> | Only computers active in past 30 days"; } echo "<p>"; }
$(function(){ $('.tagsinput').tagsInput({ "width": "90%", 'height':'42px', 'minChars':2, 'onAddTag':function(tag){callback_tags( tag, 1, $(this) )}, //增加标签的回调函数 'onRemoveTag':function(tag){callback_tags( tag, 2, $(this) )}, //删除标签的回调函数 }); }) function callback_tags(tag,type,obj) { var att_id = obj.attr('data-id'); var tags_new = obj.val();//处理过后的新标签内容 var api = '<?php echo link_url(array('v' => 'tags')); ?> '; $.get(api, { tags: tags_new, tag: tag, att_id:att_id, _su:'<?php echo _SU; ?> ', act_type:type }, function(data){ if(data != 1){ msg = data; var d = top.dialog({ content: msg, title: '<?php echo L('tips'); ?>
/** * 附件上传 * * @author tuzwu * @createtime * @modifytime * @param bool $is_thumb 是否为缩略图,这里需要直接显示缩略图片 * @return */ public static function attachment($ext = 'png|jpg|gif|doc|docx', $limit = 1, $formname = 'file', $default_val = '', $callback = 'callback_thumb_dialog', $is_thumb = 0, $width = '', $height = '', $cut = 0) { if ($ext == '') { $ext = 'png|jpg|gif|doc|docx'; } $id = preg_match("/\\[(.*)\\]/", $formname, $m) ? $m[1] : $formname; $str = ''; if (!defined('PUPLOAD_INIT')) { define('PUPLOAD_INIT', TRUE); $str = '<script src="' . R . 'js/dialog/dialog-plus.js"></script>'; $str .= '<script type="text/javascript" src="' . R . 'js/json2.js"></script>'; $str .= '<script type="text/javascript" src="' . R . 'js/html5upload/plupload.full.min.js"></script>'; $str .= '<script type="text/javascript" src="' . R . 'js/html5upload/extension.js"></script>'; } $limit = $limit ? $limit : 1; if ($is_thumb) { $limit = 1; } if ($limit == 1) { if ($is_thumb) { $input_type = 'hidden'; $default_thumb = $default_val ? $default_val : R . 'images/upload-thumb.png'; $thumb_w = $width ? $width : '135'; $thumb_h = $height ? $height : '113'; $str .= '<img class="attachment_thumb" id="' . $id . '_thumb" src="' . $default_thumb . '" onclick="img_view(this.src);" width="' . $thumb_w . '" height="' . $thumb_h . '" style="margin-bottom: 10px;" />'; } else { $input_type = 'text'; } $str .= '<input type="' . $input_type . '" value="' . $default_val . '" ondblclick="img_view(\'?m=core&f=image_privew&imgurl=\'+this.value);" class="form-control" id="' . $id . '" name="' . $formname . '" size="100">'; } else { $default_multiple = ''; if ($default_val && is_array($default_val)) { foreach ($default_val as $k => $v) { $default_multiple .= '<li id="file_node_' . $k . '"><input type="hidden" name="' . $formname . '[' . $k . '][url]" value="' . $v['url'] . '"> <img src="' . $v['url'] . '" alt="' . $v['alt'] . '" onclick="img_view(this.src);"> <textarea name="' . $formname . '[' . $k . '][alt]" >' . $v['alt'] . '</textarea> <a class="btn btn-danger btn-xs" href="javascript:remove_file(' . $k . ');">移除</a></li>'; } } $str .= '<div id="' . $id . '"><ul id="' . $id . '_ul">' . $default_multiple . '</ul></div>'; } $token = md5($ext . _KEY); $up_url = '/index.php' . link_url(array('m' => 'attachment', 'f' => 'index', 'v' => 'upload_dialog', 'callback' => $callback, 'htmlid' => $id, '_su' => '', 'limit' => $limit, 'is_thumb' => $is_thumb, 'width' => $width, 'height' => $height, 'htmlname' => $formname, 'ext' => $ext, 'token' => $token, 'cut' => $cut)); $str .= '<span class="input-group-btn"><button type="button" class="btn btn-white" onclick="openiframe(\'' . $up_url . '\',\'' . $id . '\',\'loading...\',810,400,' . $limit . ')"><i class="icon-paperclip"></i>上传文件</button></span>'; return $str; }
"><img src="<?php echo R; ?> images/icon/folder-upload.png" class="pull-left" /><span class="col-lg-2 col-sm-4">返回上级目录</span></a></div></li> <?php } //循环目录 $files_list = array(); foreach ($lists as $k => $v) { $file = basename($v); if (stripos($file, '.php') !== false) { continue; } $is_dir = false; if (is_dir($v)) { $file = '<a href="' . link_url(array('dir' => ($dir ? $dir . '/' : '') . $file)) . '"><img src="' . R . 'images/icon/dir.png" class="pull-left"> <span class="col-lg-2 col-sm-4"> ' . $file . ' </span></a>'; $is_dir = true; } else { $files_list[] = $v; continue; } ?> <li> <div class="task-title"> <span class="task-title-sp"> <?php echo $file; ?> </span> </div>
/** * 批量静态化生成 * * @author tuzwu */ public function html() { if (output($this->_cache, 'rewrite') == 1) { MSG(L('no_html'), HTTP_REFERER, 3000); } $html_tags = load_class('html_tags', M); $tid = intval(output($GLOBALS, 'tid')); if ($tid) { $html_tags->show($tid); MSG(L('operation_success'), HTTP_REFERER, 3000); } else { $action = output($GLOBALS, 'action'); switch ($action) { case 'show': //内页批量静态化 $pagesize = 10; //每次生成50个tag内页 $page = max(1, output($GLOBALS, 'page')); $list = $this->db->get_list('tag', ' number > 0 and isshow = 1 ', '*', 0, $pagesize, $page); $pagenum = ceil($this->db->number / $pagesize); if ($page <= $pagenum) { foreach ($list as $k => $v) { if (!$v['url']) { continue; } $html_tags->show($v['tid'], $v); } $next_page_url = link_url(array('action' => 'show', 'page' => $page + 1)); MSG(round($page / $pagenum, 2) * 100 . '%:' . L('next_round') . $page . '-' . $pagenum, $next_page_url, 3000); } break; case 'letter': //列表页 $html_tags->letter(); break; case 'index': //模块首页 $html_tags->index(5); break; default: //加载模板 include $this->template('html', M); exit; break; } } MSG(L('operation_success'), link_url(array('v' => V, 'action' => 'false')), 3000); }
"><img src="<?php echo R; ?> images/icon/folder-upload.png" /> 返回上级目录</a></div></li> <?php } //循环目录 $files_list = array(); foreach ($lists as $k => $v) { $file = basename($v); if (stripos($file, '.php') !== false) { continue; } $is_dir = false; if (is_dir($v)) { $file = '<a href="' . link_url(array('dir' => ($dir ? $dir . '/' : '') . $file)) . '"><img src="' . R . 'images/icon/dir.png"> ' . $file . '</a>'; $is_dir = true; } else { $files_list[] = $v; continue; } ?> <li> <div class="task-title"> <span class="task-title-sp"> <?php echo $file; ?> </span> </div>
<div class="form-group"> <div class="col-sm-3"> <input class="btn btn-info" type="submit" onclick="location.href='<?php echo link_url(array('action' => 'index')); ?> '" value="<?php echo L('html_index'); ?> " /> </div> <div class="col-sm-3"> <input class="btn btn-info" type="submit" onclick="location.href='<?php echo link_url(array('action' => 'letter')); ?> '" value="<?php echo L('html_letter'); ?> " /> </div> <div class="col-sm-3"> <input class="btn btn-info" type="submit" onclick="location.href='<?php echo link_url(array('action' => 'show')); ?> '" value="<?php echo L('html_show'); ?> " /> </div> </div> </div>
/** * 文件上传2,支持更多参数设置 * @param string $ext 允许的文件扩展名 * @param int $limit 数据限制 * @param string $formname 表单字段名 * @param string $default_val 默认值 * @param string $callback 回调js函数名 * @param bool $is_thumb 是否为缩略图,这里需要直接显示缩略图片 * @param string $width 图像宽度 * @param string $height 图像高度 * @param int $cut 是否裁剪 * @author tuzwu * @return string */ public static function attachment($ext = 'png|jpg|gif|doc|docx', $limit = 1, $formname = 'file', $default_val = '', $callback = 'callback_thumb_dialog', $is_thumb = 0, $width = '', $height = '', $cut = 0, $is_water = false, $is_allow_show_img = false, $ext_code = '') { if ($ext == '') { $ext = 'png|jpg|gif|doc|docx'; } $id = preg_match("/\\[(.*)\\]/", $formname, $m) ? $m[1] : $formname; $str = ''; if (!defined('PUPLOAD_INIT')) { define('PUPLOAD_INIT', TRUE); $str = '<script src="' . R . 'js/dialog/dialog-plus.js"></script>'; $str .= '<script type="text/javascript" src="' . R . 'js/json2.js"></script>'; $str .= '<script type="text/javascript" src="' . R . 'js/html5upload/plupload.full.min.js"></script>'; $str .= '<script type="text/javascript" src="' . R . 'js/html5upload/extension.js"></script>'; } $limit = $limit ? $limit : 1; if ($is_thumb) { $limit = 1; } if ($limit == 1) { if ($is_thumb) { $input_type = 'hidden'; $default_thumb = $default_val ? $default_val : R . 'images/upload-thumb.png'; $thumb_w = $width ? $width : '135'; $thumb_h = $height ? $height : '113'; $str .= '<img class="attachment_thumb" id="' . $id . '_thumb" src="' . $default_thumb . '" onclick="img_view(this.src);" width="' . $thumb_w . '" height="' . $thumb_h . '" />'; } else { $input_type = 'text'; } $str .= '<input type="' . $input_type . '" value="' . $default_val . '" ondblclick="img_view(\'?m=core&f=image_privew&imgurl=\'+this.value);" class="form-control" id="' . $id . '" name="' . $formname . '" size="100" ' . $ext_code . '>'; } else { } $token = md5($ext . _KEY); $up_url = '/index.php' . link_url(array('m' => 'attachment', 'f' => 'index', 'v' => 'upload_dialog', 'callback' => $callback, 'htmlid' => $id, '_su' => '', 'limit' => $limit, 'is_thumb' => $is_thumb, 'width' => $width, 'height' => $height, 'htmlname' => $formname, 'ext' => $ext, 'token' => $token, 'cut' => $cut, 'is_water' => $is_water, 'is_allow_show_img' => $is_allow_show_img)); $str .= '<span class="input-group-btn"><button type="button" class="btn btn-white" onclick="openiframe(\'' . $up_url . '\',\'' . $id . '\',\'loading...\',810,400,' . $limit . ')">上传文件</button></span>'; return $str; }
$file = '<a href="' . ATTACHMENT_URL . $dir . '/' . $file . '" title="' . L('look_big') . ':' . $file . '" alt="' . $file . '" class="fancybox-button" rel="fancybox-button">' . $file . '</a>'; } ?> <li> <div class="task-title"> <span class="task-title-sp"><?php echo $file; ?> </span> <?php if (isset($path)) { ?> <div class="pull-right hidden-phone"> <a href="javascript:makedo('<?php echo link_url(array('v' => 'del', 'url' => $path)); ?> ', '<?php echo L('confirm_del'); ?> ')" class="btn btn-danger btn-xs"><i class="icon-x "></i></a> </div> <?php } ?> </div> </li> <?php } ?>