';
}
this.content = content;
},
_pop:function(){
var html = '';
html += '';
html += '
';
html += '
';
html += '
';
html += '
'+this.opt.title+'
';
html += '
';
html += '
';
if(this.opt.win_min){
html += '
';
}
if(this.opt.win_max){
html += '
';
}
if(this.opt.win_close){
html += '
';
}
html += '
';
html += '
';
html += '
';
html += '
';
html += this.content;
html += '
';
html += '
';
$(html).appendTo("body");
},
_taskbar:function(id){
if(!id || id == 'undefined')
{
id = this.id;
}
var arg = this._arg(id);
if(arg.taskbar == 'false')
{
return true;
}
var ul_id = this.prefix+'taskbar';
var html = '
'+this.opt.title+'
';
$(html).appendTo("#"+ul_id);
return true;
},
_vlayer: function(id){
if(!id)
{
return false;
}
var width = $("#"+id).width();
var height = $("#"+id).height();
var left = parseInt($("#"+id).css('left'),10);
var top = parseInt($("#"+id).css('top'),10);
var css = "width:"+width+"px;height:"+height+"px;left:"+left+"px;top:"+top+'px;position:absolute;';
var zindex = $("#"+id).css("z-index");
css += "z-index:"+parseInt(zindex+1)+";";
//css += "background:#FFF;"
var html = '
';
$(html).appendTo('body');
},
//关闭移动时的触发
_vlayer_close: function(id){
var arg = this._arg(id);
var top = parseInt($("#vlayer-"+id).css("top"),10);
var left = parseInt($("#vlayer-"+id).css('left'),10);
$("#"+id).css({'top':top+"px",'left':left+"px"});//控件新位置
if(arg.lock != 1)
{
$("#"+id+"-lock").css({'top':top+"px",'left':left+"px"});//控件新位置
}
arg.left = left;
arg.top = top;
this._save(arg,id);
$("#vlayer-"+id).remove();
return true;
},
//绑定相应的动作
_action:function(){
var _x,_y;//鼠标离控件左上角的相对位置
var _move = false;
var self = this;
var id = this.id;
var arg = this._arg(id);
//存在关闭窗口执行的触发
if(this.opt.win_close){
$("#close-"+id).click(function(){
if(self.opt.func_close){
var obj = (self.opt.func_close)();
if(!obj){
return false;
}else{
self.close(id);
}
}else{
self.close(id);
}
});
}
//有最大化最小化按钮时
if(this.opt.win_max)
{
$("#title-"+id).dblclick(function(){self.max(id);});
$("#max-"+id).click(function(){self.max(id);});
}
//有最小化时的按钮信息
if(this.opt.win_min)
{
$("#min-"+id).click(function(){self.min(id);});
}
//如果有启用taskbar
if(this.opt.taskbar)
{
$("#taskbar-"+id).click(function(){
//判断是否最小化了
var is_hidden = $("#"+id).is(":hidden");
if(is_hidden)
{
$("#"+id).show();
$("#"+id+"-lock").show();
self.zindex(id);
}
else
{
var z_id = $("#"+id).css("z-index");
var z_max = self.max_zindex();
if(z_max != z_id)
{
self.zindex(id);
}
else
{
self.min(id);
}
}
self._taskbar_on();
});
}
//如果默认启用了is_max
if(this.opt.is_max)
{
this.max(id);
}
//移动
$("#title-"+id).mousedown(function(e){
e = e || window.event;
var zindex = self.zindex(id);
//创建一个虚拟的DIV层
_x = e.pageX-parseInt($("#"+id).css("left"));
_y = e.pageY-parseInt($("#"+id).css("top"));
if(arg.move == 1)
{
_move = true;
self._vlayer(id);
}
e.preventDefault && e.preventDefault();
}).mouseup(function(e){
e = e || window.event;
_move = false;
self._vlayer_close(id);
e.preventDefault && e.preventDefault();
});
$(document).mousemove(function(e){
e = e || window.event;
if(!_move)
{
return false;
}
var x = e.pageX - _x;
var y = e.pageY - _y;
if(self.opt.taskbar == 'top' && y < parseInt(self.opt.exheight,10))
{
y = parseInt(self.opt.exheight,10);
}
else
{
if(y<0)
{
y = 0;
}
}
if(self.opt.taskbar == 'left' && x < parseInt(self.opt.exwidth,10))
{
x = parseInt(obj.opt.exwidth,10);
}
else
{
if(x < 0)
{
x = 0;
}
}
var max_width = $(window).width();
var max_height = $(window).height();
var width = $("#"+id).width();
var height = $("#"+id).height();
if( (max_width - width) < x)
{
x = max_width - width;
}
if((max_height - height) < y)
{
y = max_height - height;
}
$("#vlayer-"+id).css({'top':y+"px",'left':x+"px"});//控件新位置
e.preventDefault && e.preventDefault();
}).mouseup(function(e){
e = e || window.event;
_move = false;
self._vlayer_close(id);
e.preventDefault && e.preventDefault();
});
}
};
$.win = function(title,url,opts){
//检查是否窗口已存在
var open_id = false;
$("ul#phpok-taskbar li").each(function(i){
var txt = $(this).text();
if(txt == title){
open_id = $(this).attr('id');
}
});
if(open_id){
$("#"+open_id).click();
return false;
}
var max = $('body').width() - 770;
var this_max = 90;
$("ul.head_tab li").each(function(i){
this_max += parseInt($(this).outerWidth(true));
});
if(max <= this_max)
{
$.dialog.alert('您弹出的窗口太多了,请先关闭几个没有用的窗口');
return false;
}
var height = parseInt(($(window).height() - 45) * 0.8);
var exwidth = $('.c_left').parent().width();
if(!exwidth || exwidth == 'null' || exwidth == null){
exwidth = 0;
}
var defaults = {
'iframe':url,
'title':title,
'lock':false,
'taskbar':'top',
'exheight':45,
'exwidth':exwidth,
'height':height,
'move':true,
'win_max':true,
'win_min':true,
'is_max':true
}
if($.win2.opt){
var opt = $.extend({},defaults,$.win2.opt, opts);
}else{
var opt = $.extend({},defaults, opts);
}
$.desktop.init(opt);
$.desktop.win_id();
$.desktop.win();
};
$.win2 = {
init:function(opts){
this.opt = opts;
}
};
})(jQuery);
(function($) {
$.fn.wresize = function(f) {
version = '1.1';
wresize = {
fired: false,
width: 0
};
function resizeOnce() {
if ($.browser.msie) {
if (!wresize.fired) {
wresize.fired = true;
} else {
var version = parseInt($.browser.version, 10);
wresize.fired = false;
if (version < 7) {
return false;
} else if (version == 7) {
//a vertical resize is fired once, an horizontal resize twice
var width = $(window).width();
if (width != wresize.width) {
wresize.width = width;
return false;
}
}
}
}
return true;
}
function handleWResize(e) {
if (resizeOnce()) {
return f.apply(this, [e]);
}
}
this.each(function() {
if (this == window) {
//alert("ttt");
$(this).resize(handleWResize);
} else {
$(this).resize(f);
}
});
return this;
};
})(jQuery);
/***********************************************************
Filename: {phpok}js/global.admin.js
Note : 后台公共JS
Version : 4.0
Web : www.phpok.com
Author : qinggan
Update : 2013年9月12日
***********************************************************/
function alt_open(id,note)
{
if(!id || id == "undefined") return false;
if(!note || note == "undefined")
{
note = $("#"+id).attr("alt") ? $("#"+id).attr("alt") : $("#"+id).attr("title");
if(!note || note == "undefined")
{
return false;
}
}
$.dialog({
"id": "phpok_alt",
"title": false,
"cancel":false,
"padding":"10px 10px",
"follow": document.getElementById(id),
"content":note
});
}
function alt_close()
{
$.dialog.list["phpok_alt"].close();
}
//通用更新排序
function taxis(baseurl,default_value)
{
var url = baseurl;
if(!default_value || default_value == "undefined") default_value = "0";
var id_string = $.input.checkbox_join();
if(!id_string || id_string == "undefined")
{
alert("没有指定要更新的排序ID!");
return false;
}
//取得排序值信息
var id_list = id_string.split(",");
var id_leng = id_list.length;
for(var i=0;i0)
{
input.val(list[key]);
}
else if(textarea.length>0)
{
var edit = $("textarea[name="+key+"][phpok_id=htmledit]");
if(edit.length>0)
{
var my_edit = eval(key+"_editor");
my_edit.html(list[key]);
}
else
{
textarea.val(list[key]);
}
}
}
}
}
});
}
//弹出图片选择窗口
function phpok_pic(id)
{
if(!id || id == "undefined"){
$.dialog.alert(p_lang('未指定ID'));
return false;
}
var url = get_url("open","input",'id='+id);
$.dialog.open(url,{
title: p_lang('图片管理器'),
lock : true,
width: "650px",
height: "450px"
});
}
// 预览图片
function phpok_pic_view(id)
{
var url = $("#"+id).val();
if(!url || url == "undefined"){
$.dialog.alert("图片不存在,请在表单中填写图片地址");
}else{
top.$.dialog({
'title':'预览',
'content':'',
'lock':true,
'ok':function(){},
'height':350,
'width':500,
'okVal':'关闭预览'
});
}
}
//弹出窗口,选择模板
function phpok_tpl_open(id)
{
var url = get_url("tpl","open") + "&id="+id;
$.dialog.open(url,{
title: "模板选择",
lock : true,
width: "700px",
height: "400px",
resize: false
});
}
function p_lang(str)
{
if(!str || str == 'undefined'){
return false;
}
if(lang && lang[str]){
return lang[str];
}
return str;
}
function phpok_admin_orderby(id,val)
{
$.dialog({
"title":"排序设置",
"content":'',
'lock':true,
"ok":function(){
var desc_asc = $("input[name=_phpok_tmp_desc_asc_"+id+"]:checked").val();
if(!desc_asc)
{
alert("请选择排序方式");
return false;
}
val += " "+desc_asc;
var str = $("#"+id).val();
if(str)
{
str += ","+val;
}
else
{
str = val;
}
$("#"+id).val(str);
}
});
}
function goto_site(id,oldid)
{
$.dialog.confirm("确定要切换到网站 "+$('#top_site_id').find("option:selected").text()+" 吗?",function(){
var url = get_url("index","site") + "&id="+id.toString();
direct(url);
},function(){
$("#top_site_id").val(oldid);
});
}
//前台常用JS函数封装
;(function($){
$.admin = {
//更换Tab设置
tab:function(val){
$("#float_tab li").each(function(i){
var name = $(this).attr("name");
if(name == val)
{
$(this).removeClass("tab_out").addClass("tab_over");
$("#"+val+"_setting").show();
}
else
{
$(this).removeClass("tab_over").addClass("tab_out");
$("#"+name+"_setting").hide();
}
});
},
group:function(obj){
var val = $(obj).attr('name');
$.each($(obj).parent().find('li'),function(i){
var name = $(this).attr('name');
$(this).removeClass('on');
$("#"+name+"_setting").hide();
});
//显示当前的
$(obj).addClass('on');
$("#"+val+"_setting").show();
}
};
})(jQuery);
(function(a){var t=a(document).data("func",{});a.smartMenu=a.noop;a.fn.smartMenu=function(e,i){var n=a("body"),r={name:"",offsetX:2,offsetY:2,textLimit:6,beforeShow:a.noop,afterShow:a.noop};var s=a.extend(r,i||{});var o=function(i){var n=i||e,r=i?Math.random().toString():s.name,l="",c="",d="smart_menu_";if(a.isArray(n)&&n.length){l='