code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
myFocus.extend({ mF_liuzg:function(par,F){//*********************绚丽切片风格****************** var box=F.$(par.id); F.addList(box,['txt','num']);//添加ul列表 var pics=F.$c('pic',box),pic=F.$li('pic',box),n=pic.length; var c=par.height%par.chip?8:par.chip,h=par.height/c,html=[]; for(var i=0;i<c;i++){ html.push('<li><div>'); for(var j=0;j<n;j++) html.push(pic[j].innerHTML); html.push('</div></li>'); } pics.innerHTML=html.join(''); //CSS var pic=F.$li('pic',box),txt=F.$li('txt',box),btn=F.$li('num',box),wrap=F.$$('div',pics); for(var i=0;i<c;i++){//初始化样式设置 pic[i].style.cssText='width:'+par.width+'px;height:'+h+'px;'; wrap[i].style.cssText='height:'+par.height*n+'px;top:'+-i*h+'px;'; F.$$('a',pic[i])[0].style.height=par.height+'px'; } //PLAY eval(F.switchMF(function(){ txt[index].style.display='none'; btn[index].className = ''; },function(){ var tt=par.type===4?Math.round(1+(Math.random()*(3-1))):par.type;//效果选择 var dur=tt===1?1200:300; for(var i=0;i<c;i++){ F.slide(wrap[i],{top:-next*c*h-i*h},tt===3?Math.round(300+(Math.random()*(1200-300))):dur); dur=tt===1?dur-150:dur+150; } txt[next].style.display='block'; btn[next].className = 'current'; })) eval(F.bind('btn','par.trigger',par.delay)); } }); myFocus.set.params('mF_liuzg',{//可选个性参数 chip:8,//图片切片数量,能被焦点图的高整除才有效,默认为8片 type:4////切片效果,可选:1(甩头) | 2(甩尾) | 3(凌乱) | 4(随机) });
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/script/pattern/mF_liuzg.js
JavaScript
oos
1,588
myFocus.extend({//*********************fscreen****************** mF_fscreen_tb:function(par,F){ var box=F.$(par.id); F.addList(box,['thu-bg','thumb','txt','prev','next']);F.wrap([F.$c('thumb',box)],'win'); var pics=F.$c('pic',box),thuBg=F.$c('thu-bg',box),win=F.$c('win',box),thus=F.$c('thumb',box),thu=F.$li('thumb',box),txt=F.$li('txt',box),pre=F.$c('prev',box),nex=F.$c('next',box),n=txt.length; pre.innerHTML='<a href="javascript:;">&#8249;</a>';nex.innerHTML='<a href="javascript:;">&#8250;</a>';//前后箭头 //CSS var pic=F.$li('pic',box),winW=par.width-20,sw=Math.floor(winW/4),sh=par.height/par.width*(sw-36)+16;//参考*按比例求高 thuBg.style.height=sh+'px'; win.style.cssText='width:'+winW+'px;height:'+sh+'px;'; thus.style.width=sw*n+'px'; for(var i=0;i<n;i++){ thu[i].style.cssText=F.$$('span',thu[i])[0].style.cssText='width:'+(sw-36)+'px;height:'+(sh-16)+'px';//减去总padding(*) txt[i].style.left=-par.width+'px'; } pre.style.cssText=nex.style.cssText='height:'+(sh-16)+'px;line-height:'+(sh-20)+'px;';//-padding //PLAY eval(F.switchMF(function(){ for(var i=0;i<n;i++){ F.stop(txt[i]); txt[i].style.left=-par.width+'px'; } pic[index].style.display='none'; thu[index].className = ''; },function(){ F.fadeIn(pic[next],300,function(){F.slide(txt[next],{left:0})}); thu[next].className = 'current'; eval(F.scroll('thus','"left"','sw',4)); })); eval(F.bind('thu','"click"'));//让其只支持click点击 eval(F.turn('pre','nex')); } });
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/script/pattern/mF_fscreen_tb.js
JavaScript
oos
1,560
/*=========mF_fscreen_tb========*/ .mF_fscreen_tb_wrap{padding:8px;border:1px solid #999;float:left;background:#fff;}/*背景边框*/ .mF_fscreen_tb { background:#333;} .mF_fscreen_tb .pic { position:absolute; top:0; left:0; } .mF_fscreen_tb .pic li { position:absolute; width:100%; height:100%; overflow:hidden; display:none; } .mF_fscreen_tb .win { position:absolute; bottom:0; left:0; margin:0 10px; overflow:hidden; } .mF_fscreen_tb .win .thumb { position:absolute; top:0; left:0; } .mF_fscreen_tb .win .thumb li { position:relative; float:left; padding:8px 18px; overflow:hidden; cursor:pointer; }/*pad*/ .mF_fscreen_tb .win .thumb li img { position:relative; z-index:1; width:100%; height:100%; filter:alpha(opacity=80); opacity:0.8; } .mF_fscreen_tb .win .thumb li span { position:absolute; top:7px; left:17px; border:1px solid #999; }/*top=pad-border=8-1=7*/ .mF_fscreen_tb .win .thumb li.current img { filter:alpha(opacity=100); opacity:1; } .mF_fscreen_tb .win .thumb li.current span,.mF_fscreen_tb .win .thumb li.hover span { border-color:#fff; } .mF_fscreen_tb .thu-bg { position:absolute; bottom:0; left:0; width:100%; background:#000; filter:alpha(opacity=40); opacity:0.4; overflow:hidden; border-top:1px solid #fff;} .mF_fscreen_tb .txt li { position:absolute; z-index:2; top:26px; width:100%; line-height:20px; font-family:'微软雅黑'; }/*标题*/ .mF_fscreen_tb .txt li a { display:block; color:#fff; padding-left:16px; font-weight:bold; font-size:16px; text-decoration:none; }/*标题样式*/ .mF_fscreen_tb .txt li p { padding-left:16px; color:#fff; }/*详细描述文字样式*/ .mF_fscreen_tb .prev, .mF_fscreen_tb .next { font:bold 38px arial; width:28px; overflow:hidden; position:absolute; z-index:4; left:0; bottom:8px; cursor:pointer; }/*width=margin+pad=10+18=28;bottom=pad=8;*/ .mF_fscreen_tb .next { left:auto; right:0; } .mF_fscreen_tb .prev a, .mF_fscreen_tb .next a { display:block; color:#f1f1f1; text-align:center; text-decoration:none; } .mF_fscreen_tb .prev a:hover, .mF_fscreen_tb .next a:hover { color:#f60; }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/script/pattern/mF_fscreen_tb.css
CSS
oos
2,070
/*=========mF_ladyQ========*/ .mF_ladyQ .pic li{width:100%;height:100%;overflow:hidden;position:absolute;display:none;} .mF_ladyQ .txt li{position:absolute;z-index:2;left:0;bottom:28px;height:58px;line-height:30px;display:none;font-family:'微软雅黑';} .mF_ladyQ .txt li a{display:block;position:relative;z-index:1;color:#fff;margin-top:2px;padding-left:10px;font-size:16px;text-decoration:none;}/*标题样式*/ .mF_ladyQ .txt li p{position:relative;z-index:1;padding-left:11px;line-height:22px;font-size:14px;color:#eee;} .mF_ladyQ .txt li span{display:block;height:100%;position:absolute;top:0;left:0;background:#000;filter:alpha(opacity=40);opacity:0.4;} .mF_ladyQ .cout{position:absolute;left:0;height:20px;overflow:hidden;background:#333;} .mF_ladyQ .num_box{position:relative;height:28px;background:#000;}/*按钮样式*/ .mF_ladyQ .num_box .num{position:absolute;right:6px;top:4px;} .mF_ladyQ .num_box .num li{float:left;display:inline;margin-left:3px;width:20px;height:20px;line-height:20px;overflow:hidden;text-align:center;cursor:pointer;} .mF_ladyQ .num_box .num li a{color:#B1B1B1;display:block;background:#333;text-decoration:none;} .mF_ladyQ .num_box .num li.current a,.mF_ladyQ .num_box .num li.hover a{color:#fff;background:#f60;}/*当前/悬停按钮样式*/
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/script/pattern/mF_ladyQ.css
CSS
oos
1,290
/*! * jquery.scrollLoading.js * by zhangxinxu http://www.zhangxinxu.com * 2010-11-19 v1.0 * 2012-01-13 v1.1 偏移值计算修改 position → offset */ (function($) { $.fn.scrollLoading = function(options) { var defaults = { attr: "data-url" }; var params = $.extend({}, defaults, options || {}); params.cache = []; $(this).each(function() { var node = this.nodeName.toLowerCase(), url = $(this).attr(params["attr"]); if (!url) { return; } //重组 var data = { obj: $(this), tag: node, url: url }; params.cache.push(data); }); //动态显示数据 var loading = function() { var st = $(window).scrollTop(), sth = st + $(window).height(); $.each(params.cache, function(i, data) { var o = data.obj, tag = data.tag, url = data.url; if (o) { post = o.offset().top; posb = post + o.height(); if ((post > st && post < sth) || (posb > st && posb < sth)) { //在浏览器窗口内 if (tag === "img") { //图片,改变src o.attr("src", url); } else { o.load(url); } data.obj = null; } } }); return false; }; //事件触发 //加载完毕即执行 loading(); //滚动执行 $(window).bind("scroll", loading); }; })(jQuery);
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/script/jquery.scrollLoading.js
JavaScript
oos
1,289
/* * Translated default messages for the jQuery validation plugin. * Locale: CN */ jQuery.extend(jQuery.validator.messages, { required: "必填信息", remote: "请修正该信息", email: "电子邮件格式有误", url: "请输入合法的网址", date: "请输入合法的日期", dateISO: "请输入合法的日期 (ISO).", number: "请输入合法的数字", digits: "只能输入整数", creditcard: "请输入合法的信用卡号", equalTo: "请再次输入相同的值", accept: "请输入拥有合法后缀名的字符串", maxlength: jQuery.validator.format("长度最多 {0} 个字符"), minlength: jQuery.validator.format("长度最少 {0} 个字符"), rangelength: jQuery.validator.format("长度要在 {0} 和 {1} 之间"), range: jQuery.validator.format("请输入一个介于 {0} 和 {1} 之间的值"), max: jQuery.validator.format("请输入一个最大为 {0} 的值"), min: jQuery.validator.format("请输入一个最小为 {0} 的值") });
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/script/messages_cn.js
JavaScript
oos
1,035
/** * jQuery Validation Plugin 1.9.0 * * http://bassistance.de/jquery-plugins/jquery-plugin-validation/ * http://docs.jquery.com/Plugins/Validation * * Copyright (c) 2006 - 2011 Jörn Zaefferer * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html */ (function() { function stripHtml(value) { // remove html tags and space chars return value.replace(/<.[^<>]*?>/g, ' ').replace(/&nbsp;|&#160;/gi, ' ') // remove numbers and punctuation .replace(/[0-9.(),;:!?%#$'"_+=\/-]*/g,''); } jQuery.validator.addMethod("maxWords", function(value, element, params) { return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length < params; }, jQuery.validator.format("Please enter {0} words or less.")); jQuery.validator.addMethod("minWords", function(value, element, params) { return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length >= params; }, jQuery.validator.format("Please enter at least {0} words.")); jQuery.validator.addMethod("rangeWords", function(value, element, params) { return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length >= params[0] && value.match(/bw+b/g).length < params[1]; }, jQuery.validator.format("Please enter between {0} and {1} words.")); })(); jQuery.validator.addMethod("letterswithbasicpunc", function(value, element) { return this.optional(element) || /^[a-z-.,()'\"\s]+$/i.test(value); }, "Letters or punctuation only please"); jQuery.validator.addMethod("alphanumeric", function(value, element) { return this.optional(element) || /^\w+$/i.test(value); }, "Letters, numbers, spaces or underscores only please"); jQuery.validator.addMethod("lettersonly", function(value, element) { return this.optional(element) || /^[a-z]+$/i.test(value); }, "Letters only please"); jQuery.validator.addMethod("nowhitespace", function(value, element) { return this.optional(element) || /^\S+$/i.test(value); }, "No white space please"); jQuery.validator.addMethod("ziprange", function(value, element) { return this.optional(element) || /^90[2-5]\d\{2}-\d{4}$/.test(value); }, "Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx"); jQuery.validator.addMethod("integer", function(value, element) { return this.optional(element) || /^-?\d+$/.test(value); }, "A positive or negative non-decimal number please"); /** * Return true, if the value is a valid vehicle identification number (VIN). * * Works with all kind of text inputs. * * @example <input type="text" size="20" name="VehicleID" class="{required:true,vinUS:true}" /> * @desc Declares a required input element whose value must be a valid vehicle identification number. * * @name jQuery.validator.methods.vinUS * @type Boolean * @cat Plugins/Validate/Methods */ jQuery.validator.addMethod( "vinUS", function(v){ if (v.length != 17) return false; var i, n, d, f, cd, cdv; var LL = ["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"]; var VL = [1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9]; var FL = [8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2]; var rs = 0; for(i = 0; i < 17; i++){ f = FL[i]; d = v.slice(i,i+1); if(i == 8){ cdv = d; } if(!isNaN(d)){ d *= f; } else{ for(n = 0; n < LL.length; n++){ if(d.toUpperCase() === LL[n]){ d = VL[n]; d *= f; if(isNaN(cdv) && n == 8){ cdv = LL[n]; } break; } } } rs += d; } cd = rs % 11; if(cd == 10){cd = "X";} if(cd == cdv){return true;} return false; }, "The specified vehicle identification number (VIN) is invalid." ); /** * Return true, if the value is a valid date, also making this formal check dd/mm/yyyy. * * @example jQuery.validator.methods.date("01/01/1900") * @result true * * @example jQuery.validator.methods.date("01/13/1990") * @result false * * @example jQuery.validator.methods.date("01.01.1900") * @result false * * @example <input name="pippo" class="{dateITA:true}" /> * @desc Declares an optional input element whose value must be a valid date. * * @name jQuery.validator.methods.dateITA * @type Boolean * @cat Plugins/Validate/Methods */ jQuery.validator.addMethod( "dateITA", function(value, element) { var check = false; var re = /^\d{1,2}\/\d{1,2}\/\d{4}$/; if( re.test(value)){ var adata = value.split('/'); var gg = parseInt(adata[0],10); var mm = parseInt(adata[1],10); var aaaa = parseInt(adata[2],10); var xdata = new Date(aaaa,mm-1,gg); if ( ( xdata.getFullYear() == aaaa ) && ( xdata.getMonth () == mm - 1 ) && ( xdata.getDate() == gg ) ) check = true; else check = false; } else check = false; return this.optional(element) || check; }, "Please enter a correct date" ); jQuery.validator.addMethod("dateNL", function(value, element) { return this.optional(element) || /^\d\d?[\.\/-]\d\d?[\.\/-]\d\d\d?\d?$/.test(value); }, "Vul hier een geldige datum in." ); jQuery.validator.addMethod("time", function(value, element) { return this.optional(element) || /^([01]\d|2[0-3])(:[0-5]\d){0,2}$/.test(value); }, "Please enter a valid time, between 00:00 and 23:59"); jQuery.validator.addMethod("time12h", function(value, element) { return this.optional(element) || /^((0?[1-9]|1[012])(:[0-5]\d){0,2}(\ [AP]M))$/i.test(value); }, "Please enter a valid time, between 00:00 am and 12:00 pm"); /** * matches US phone number format * * where the area code may not start with 1 and the prefix may not start with 1 * allows '-' or ' ' as a separator and allows parens around area code * some people may want to put a '1' in front of their number * * 1(212)-999-2345 * or * 212 999 2344 * or * 212-999-0983 * * but not * 111-123-5434 * and not * 212 123 4567 */ jQuery.validator.addMethod("phoneUS", function(phone_number, element) { phone_number = phone_number.replace(/\s+/g, ""); return this.optional(element) || phone_number.length > 9 && phone_number.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/); }, "Please specify a valid phone number"); jQuery.validator.addMethod('phoneUK', function(phone_number, element) { return this.optional(element) || phone_number.length > 9 && phone_number.match(/^(\(?(0|\+44)[1-9]{1}\d{1,4}?\)?\s?\d{3,4}\s?\d{3,4})$/); }, 'Please specify a valid phone number'); jQuery.validator.addMethod('mobileUK', function(phone_number, element) { return this.optional(element) || phone_number.length > 9 && phone_number.match(/^((0|\+44)7(5|6|7|8|9){1}\d{2}\s?\d{6})$/); }, 'Please specify a valid mobile number'); // TODO check if value starts with <, otherwise don't try stripping anything jQuery.validator.addMethod("strippedminlength", function(value, element, param) { return jQuery(value).text().length >= param; }, jQuery.validator.format("Please enter at least {0} characters")); // same as email, but TLD is optional jQuery.validator.addMethod("email2", function(value, element, param) { return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value); }, jQuery.validator.messages.email); // same as url, but TLD is optional jQuery.validator.addMethod("url2", function(value, element, param) { return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value); }, jQuery.validator.messages.url); // NOTICE: Modified version of Castle.Components.Validator.CreditCardValidator // Redistributed under the the Apache License 2.0 at http://www.apache.org/licenses/LICENSE-2.0 // Valid Types: mastercard, visa, amex, dinersclub, enroute, discover, jcb, unknown, all (overrides all other settings) jQuery.validator.addMethod("creditcardtypes", function(value, element, param) { if (/[^0-9-]+/.test(value)) return false; value = value.replace(/\D/g, ""); var validTypes = 0x0000; if (param.mastercard) validTypes |= 0x0001; if (param.visa) validTypes |= 0x0002; if (param.amex) validTypes |= 0x0004; if (param.dinersclub) validTypes |= 0x0008; if (param.enroute) validTypes |= 0x0010; if (param.discover) validTypes |= 0x0020; if (param.jcb) validTypes |= 0x0040; if (param.unknown) validTypes |= 0x0080; if (param.all) validTypes = 0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010 | 0x0020 | 0x0040 | 0x0080; if (validTypes & 0x0001 && /^(51|52|53|54|55)/.test(value)) { //mastercard return value.length == 16; } if (validTypes & 0x0002 && /^(4)/.test(value)) { //visa return value.length == 16; } if (validTypes & 0x0004 && /^(34|37)/.test(value)) { //amex return value.length == 15; } if (validTypes & 0x0008 && /^(300|301|302|303|304|305|36|38)/.test(value)) { //dinersclub return value.length == 14; } if (validTypes & 0x0010 && /^(2014|2149)/.test(value)) { //enroute return value.length == 15; } if (validTypes & 0x0020 && /^(6011)/.test(value)) { //discover return value.length == 16; } if (validTypes & 0x0040 && /^(3)/.test(value)) { //jcb return value.length == 16; } if (validTypes & 0x0040 && /^(2131|1800)/.test(value)) { //jcb return value.length == 15; } if (validTypes & 0x0080) { //unknown return true; } return false; }, "Please enter a valid credit card number."); jQuery.validator.addMethod("ipv4", function(value, element, param) { return this.optional(element) || /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i.test(value); }, "Please enter a valid IP v4 address."); jQuery.validator.addMethod("ipv6", function(value, element, param) { return this.optional(element) || /^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test(value); }, "Please enter a valid IP v6 address."); /** * Return true if the field value matches the given format RegExp * * @example jQuery.validator.methods.pattern("AR1004",element,/^AR\d{4}$/) * @result true * * @example jQuery.validator.methods.pattern("BR1004",element,/^AR\d{4}$/) * @result false * * @name jQuery.validator.methods.pattern * @type Boolean * @cat Plugins/Validate/Methods */ jQuery.validator.addMethod("pattern", function(value, element, param) { return this.optional(element) || param.test(value); }, "Invalid format."); /** * 自定义验证规则——增加对select的验证 */ jQuery.validator.addMethod( "selectNone", // name验证方法名 function (value, element) // 验证规则 { if (value=="") // select默认值需要设置为"none"(当然可以自定义其他值) { return false; } else { return true; } }, "请选择正确的选项!" // 默认验证消息(自定义规则信息的国际化是否不起作用?) ); jQuery.validator.addMethod( "selectZero", // name验证方法名 function (value, element) // 验证规则 { if (value == "0") // select默认值需要设置为"none"(当然可以自定义其他值) { return false; } else { return true; } }, "请选择正确的选项!" // 默认验证消息(自定义规则信息的国际化是否不起作用?) ); jQuery.validator.addMethod("isTel", function (value, element) { var tel = /^\d{3,4}-?\d{7,9}$/; //电话号码格式010-12345678 return this.optional(element) || (tel.test(value)); }, "请正确填写您的电话号码");
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/script/additional-methods.js
JavaScript
oos
15,350
/*! * jQuery Form Plugin * version: 2.96 (16-FEB-2012) * @requires jQuery v1.3.2 or later * * Examples and documentation at: http://malsup.com/jquery/form/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html */ ;(function($) { /* Usage Note: ----------- Do not use both ajaxSubmit and ajaxForm on the same form. These functions are mutually exclusive. Use ajaxSubmit if you want to bind your own submit handler to the form. For example, $(document).ready(function() { $('#myForm').bind('submit', function(e) { e.preventDefault(); // <-- important $(this).ajaxSubmit({ target: '#output' }); }); }); Use ajaxForm when you want the plugin to manage all the event binding for you. For example, $(document).ready(function() { $('#myForm').ajaxForm({ target: '#output' }); }); You can also use ajaxForm with delegation (requires jQuery v1.7+), so the form does not have to exist when you invoke ajaxForm: $('#myForm').ajaxForm({ delegation: true, target: '#output' }); When using ajaxForm, the ajaxSubmit function will be invoked for you at the appropriate time. */ /** * ajaxSubmit() provides a mechanism for immediately submitting * an HTML form using AJAX. */ $.fn.ajaxSubmit = function(options) { // fast fail if nothing selected (http://dev.jquery.com/ticket/2752) if (!this.length) { log('ajaxSubmit: skipping submit process - no element selected'); return this; } var method, action, url, $form = this; if (typeof options == 'function') { options = { success: options }; } method = this.attr('method'); action = this.attr('action'); url = (typeof action === 'string') ? $.trim(action) : ''; url = url || window.location.href || ''; if (url) { // clean url (don't include hash vaue) url = (url.match(/^([^#]+)/)||[])[1]; } options = $.extend(true, { url: url, success: $.ajaxSettings.success, type: method || 'GET', iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' }, options); // hook for manipulating the form data before it is extracted; // convenient for use with rich editors like tinyMCE or FCKEditor var veto = {}; this.trigger('form-pre-serialize', [this, options, veto]); if (veto.veto) { log('ajaxSubmit: submit vetoed via form-pre-serialize trigger'); return this; } // provide opportunity to alter form data before it is serialized if (options.beforeSerialize && options.beforeSerialize(this, options) === false) { log('ajaxSubmit: submit aborted via beforeSerialize callback'); return this; } var traditional = options.traditional; if ( traditional === undefined ) { traditional = $.ajaxSettings.traditional; } var qx,n,v,a = this.formToArray(options.semantic); if (options.data) { options.extraData = options.data; qx = $.param(options.data, traditional); } // give pre-submit callback an opportunity to abort the submit if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) { log('ajaxSubmit: submit aborted via beforeSubmit callback'); return this; } // fire vetoable 'validate' event this.trigger('form-submit-validate', [a, this, options, veto]); if (veto.veto) { log('ajaxSubmit: submit vetoed via form-submit-validate trigger'); return this; } var q = $.param(a, traditional); if (qx) { q = ( q ? (q + '&' + qx) : qx ); } if (options.type.toUpperCase() == 'GET') { options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q; options.data = null; // data is null for 'get' } else { options.data = q; // data is the query string for 'post' } var callbacks = []; if (options.resetForm) { callbacks.push(function() { $form.resetForm(); }); } if (options.clearForm) { callbacks.push(function() { $form.clearForm(options.includeHidden); }); } // perform a load on the target only if dataType is not provided if (!options.dataType && options.target) { var oldSuccess = options.success || function(){}; callbacks.push(function(data) { var fn = options.replaceTarget ? 'replaceWith' : 'html'; $(options.target)[fn](data).each(oldSuccess, arguments); }); } else if (options.success) { callbacks.push(options.success); } options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg var context = options.context || options; // jQuery 1.4+ supports scope context for (var i=0, max=callbacks.length; i < max; i++) { callbacks[i].apply(context, [data, status, xhr || $form, $form]); } }; // are there files to upload? var fileInputs = $('input:file:enabled[value]', this); // [value] (issue #113) var hasFileInputs = fileInputs.length > 0; var mp = 'multipart/form-data'; var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp); var fileAPI = !!(hasFileInputs && fileInputs.get(0).files && window.FormData); log("fileAPI :" + fileAPI); var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI; // options.iframe allows user to force iframe mode // 06-NOV-09: now defaulting to iframe mode if file input is detected if (options.iframe !== false && (options.iframe || shouldUseFrame)) { // hack to fix Safari hang (thanks to Tim Molendijk for this) // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d if (options.closeKeepAlive) { $.get(options.closeKeepAlive, function() { fileUploadIframe(a); }); } else { fileUploadIframe(a); } } else if ((hasFileInputs || multipart) && fileAPI) { options.progress = options.progress || $.noop; fileUploadXhr(a); } else { $.ajax(options); } // fire 'notify' event this.trigger('form-submit-notify', [this, options]); return this; // XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz) function fileUploadXhr(a) { var formdata = new FormData(); for (var i=0; i < a.length; i++) { if (a[i].type == 'file') continue; formdata.append(a[i].name, a[i].value); } $form.find('input:file:enabled').each(function(){ var name = $(this).attr('name'), files = this.files; if (name) { for (var i=0; i < files.length; i++) formdata.append(name, files[i]); } }); if (options.extraData) { for (var k in options.extraData) formdata.append(k, options.extraData[k]) } options.data = null; var s = $.extend(true, {}, $.ajaxSettings, options, { contentType: false, processData: false, cache: false, type: 'POST' }); //s.context = s.context || s; s.data = null; var beforeSend = s.beforeSend; s.beforeSend = function(xhr, o) { o.data = formdata; if(xhr.upload) { // unfortunately, jQuery doesn't expose this prop (http://bugs.jquery.com/ticket/10190) xhr.upload.onprogress = function(event) { o.progress(event.position, event.total); }; } if(beforeSend) beforeSend.call(o, xhr, options); }; $.ajax(s); } // private function for handling file uploads (hat tip to YAHOO!) function fileUploadIframe(a) { var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle; var useProp = !!$.fn.prop; if (a) { if ( useProp ) { // ensure that every serialized input is still enabled for (i=0; i < a.length; i++) { el = $(form[a[i].name]); el.prop('disabled', false); } } else { for (i=0; i < a.length; i++) { el = $(form[a[i].name]); el.removeAttr('disabled'); } }; } if ($(':input[name=submit],:input[id=submit]', form).length) { // if there is an input with a name or id of 'submit' then we won't be // able to invoke the submit fn on the form (at least not x-browser) alert('Error: Form elements must not have name or id of "submit".'); return; } s = $.extend(true, {}, $.ajaxSettings, options); s.context = s.context || s; id = 'jqFormIO' + (new Date().getTime()); if (s.iframeTarget) { $io = $(s.iframeTarget); n = $io.attr('name'); if (n == null) $io.attr('name', id); else id = n; } else { $io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />'); $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' }); } io = $io[0]; xhr = { // mock object aborted: 0, responseText: null, responseXML: null, status: 0, statusText: 'n/a', getAllResponseHeaders: function() {}, getResponseHeader: function() {}, setRequestHeader: function() {}, abort: function(status) { var e = (status === 'timeout' ? 'timeout' : 'aborted'); log('aborting upload... ' + e); this.aborted = 1; $io.attr('src', s.iframeSrc); // abort op in progress xhr.error = e; s.error && s.error.call(s.context, xhr, e, status); g && $.event.trigger("ajaxError", [xhr, s, e]); s.complete && s.complete.call(s.context, xhr, e); } }; g = s.global; // trigger ajax global events so that activity/block indicators work like normal if (g && ! $.active++) { $.event.trigger("ajaxStart"); } if (g) { $.event.trigger("ajaxSend", [xhr, s]); } if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) { if (s.global) { $.active--; } return; } if (xhr.aborted) { return; } // add submitting element to data if we know it sub = form.clk; if (sub) { n = sub.name; if (n && !sub.disabled) { s.extraData = s.extraData || {}; s.extraData[n] = sub.value; if (sub.type == "image") { s.extraData[n+'.x'] = form.clk_x; s.extraData[n+'.y'] = form.clk_y; } } } var CLIENT_TIMEOUT_ABORT = 1; var SERVER_ABORT = 2; function getDoc(frame) { var doc = frame.contentWindow ? frame.contentWindow.document : frame.contentDocument ? frame.contentDocument : frame.document; return doc; } // Rails CSRF hack (thanks to Yvan Barthelemy) var csrf_token = $('meta[name=csrf-token]').attr('content'); var csrf_param = $('meta[name=csrf-param]').attr('content'); if (csrf_param && csrf_token) { s.extraData = s.extraData || {}; s.extraData[csrf_param] = csrf_token; } // take a breath so that pending repaints get some cpu time before the upload starts function doSubmit() { // make sure form attrs are set var t = $form.attr('target'), a = $form.attr('action'); // update form attrs in IE friendly way form.setAttribute('target',id); if (!method) { form.setAttribute('method', 'POST'); } if (a != s.url) { form.setAttribute('action', s.url); } // ie borks in some cases when setting encoding if (! s.skipEncodingOverride && (!method || /post/i.test(method))) { $form.attr({ encoding: 'multipart/form-data', enctype: 'multipart/form-data' }); } // support timout if (s.timeout) { timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout); } // look for server aborts function checkState() { try { var state = getDoc(io).readyState; log('state = ' + state); if (state.toLowerCase() == 'uninitialized') setTimeout(checkState,50); } catch(e) { log('Server abort: ' , e, ' (', e.name, ')'); cb(SERVER_ABORT); timeoutHandle && clearTimeout(timeoutHandle); timeoutHandle = undefined; } } // add "extra" data to form if provided in options var extraInputs = []; try { if (s.extraData) { for (var n in s.extraData) { extraInputs.push( $('<input type="hidden" name="'+n+'">').attr('value',s.extraData[n]) .appendTo(form)[0]); } } if (!s.iframeTarget) { // add iframe to doc and submit the form $io.appendTo('body'); io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false); } setTimeout(checkState,15); form.submit(); } finally { // reset attrs and remove "extra" input elements form.setAttribute('action',a); if(t) { form.setAttribute('target', t); } else { $form.removeAttr('target'); } $(extraInputs).remove(); } } if (s.forceSync) { doSubmit(); } else { setTimeout(doSubmit, 10); // this lets dom updates render } var data, doc, domCheckCount = 50, callbackProcessed; function cb(e) { if (xhr.aborted || callbackProcessed) { return; } try { doc = getDoc(io); } catch(ex) { log('cannot access response document: ', ex); e = SERVER_ABORT; } if (e === CLIENT_TIMEOUT_ABORT && xhr) { xhr.abort('timeout'); return; } else if (e == SERVER_ABORT && xhr) { xhr.abort('server abort'); return; } if (!doc || doc.location.href == s.iframeSrc) { // response not received yet if (!timedOut) return; } io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false); var status = 'success', errMsg; try { if (timedOut) { throw 'timeout'; } var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc); log('isXml='+isXml); if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) { if (--domCheckCount) { // in some browsers (Opera) the iframe DOM is not always traversable when // the onload callback fires, so we loop a bit to accommodate log('requeing onLoad callback, DOM not available'); setTimeout(cb, 250); return; } // let this fall through because server response could be an empty document //log('Could not access iframe DOM after mutiple tries.'); //throw 'DOMException: not available'; } //log('response detected'); var docRoot = doc.body ? doc.body : doc.documentElement; xhr.responseText = docRoot ? docRoot.innerHTML : null; xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc; if (isXml) s.dataType = 'xml'; xhr.getResponseHeader = function(header){ var headers = {'content-type': s.dataType}; return headers[header]; }; // support for XHR 'status' & 'statusText' emulation : if (docRoot) { xhr.status = Number( docRoot.getAttribute('status') ) || xhr.status; xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText; } var dt = (s.dataType || '').toLowerCase(); var scr = /(json|script|text)/.test(dt); if (scr || s.textarea) { // see if user embedded response in textarea var ta = doc.getElementsByTagName('textarea')[0]; if (ta) { xhr.responseText = ta.value; // support for XHR 'status' & 'statusText' emulation : xhr.status = Number( ta.getAttribute('status') ) || xhr.status; xhr.statusText = ta.getAttribute('statusText') || xhr.statusText; } else if (scr) { // account for browsers injecting pre around json response var pre = doc.getElementsByTagName('pre')[0]; var b = doc.getElementsByTagName('body')[0]; if (pre) { xhr.responseText = pre.textContent ? pre.textContent : pre.innerText; } else if (b) { xhr.responseText = b.textContent ? b.textContent : b.innerText; } } } else if (dt == 'xml' && !xhr.responseXML && xhr.responseText != null) { xhr.responseXML = toXml(xhr.responseText); } try { data = httpData(xhr, dt, s); } catch (e) { status = 'parsererror'; xhr.error = errMsg = (e || status); } } catch (e) { log('error caught: ',e); status = 'error'; xhr.error = errMsg = (e || status); } if (xhr.aborted) { log('upload aborted'); status = null; } if (xhr.status) { // we've set xhr.status status = (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) ? 'success' : 'error'; } // ordering of these callbacks/triggers is odd, but that's how $.ajax does it if (status === 'success') { s.success && s.success.call(s.context, data, 'success', xhr); g && $.event.trigger("ajaxSuccess", [xhr, s]); } else if (status) { if (errMsg == undefined) errMsg = xhr.statusText; s.error && s.error.call(s.context, xhr, status, errMsg); g && $.event.trigger("ajaxError", [xhr, s, errMsg]); } g && $.event.trigger("ajaxComplete", [xhr, s]); if (g && ! --$.active) { $.event.trigger("ajaxStop"); } s.complete && s.complete.call(s.context, xhr, status); callbackProcessed = true; if (s.timeout) clearTimeout(timeoutHandle); // clean up setTimeout(function() { if (!s.iframeTarget) $io.remove(); xhr.responseXML = null; }, 100); } var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+) if (window.ActiveXObject) { doc = new ActiveXObject('Microsoft.XMLDOM'); doc.async = 'false'; doc.loadXML(s); } else { doc = (new DOMParser()).parseFromString(s, 'text/xml'); } return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null; }; var parseJSON = $.parseJSON || function(s) { return window['eval']('(' + s + ')'); }; var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4 var ct = xhr.getResponseHeader('content-type') || '', xml = type === 'xml' || !type && ct.indexOf('xml') >= 0, data = xml ? xhr.responseXML : xhr.responseText; if (xml && data.documentElement.nodeName === 'parsererror') { $.error && $.error('parsererror'); } if (s && s.dataFilter) { data = s.dataFilter(data, type); } if (typeof data === 'string') { if (type === 'json' || !type && ct.indexOf('json') >= 0) { data = parseJSON(data); } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) { $.globalEval(data); } } return data; }; } }; /** * ajaxForm() provides a mechanism for fully automating form submission. * * The advantages of using this method instead of ajaxSubmit() are: * * 1: This method will include coordinates for <input type="image" /> elements (if the element * is used to submit the form). * 2. This method will include the submit element's name/value data (for the element that was * used to submit the form). * 3. This method binds the submit() method to the form for you. * * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely * passes the options argument along after properly binding events for submit elements and * the form itself. */ $.fn.ajaxForm = function(options) { options = options || {}; options.delegation = options.delegation && $.isFunction($.fn.on); // in jQuery 1.3+ we can fix mistakes with the ready state if (!options.delegation && this.length === 0) { var o = { s: this.selector, c: this.context }; if (!$.isReady && o.s) { log('DOM not ready, queuing ajaxForm'); $(function() { $(o.s,o.c).ajaxForm(options); }); return this; } // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready() log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)')); return this; } if ( options.delegation ) { $(document) .off('submit.form-plugin', this.selector, doAjaxSubmit) .off('click.form-plugin', this.selector, captureSubmittingElement) .on('submit.form-plugin', this.selector, options, doAjaxSubmit) .on('click.form-plugin', this.selector, options, captureSubmittingElement); return this; } return this.ajaxFormUnbind() .bind('submit.form-plugin', options, doAjaxSubmit) .bind('click.form-plugin', options, captureSubmittingElement); }; // private event handlers function doAjaxSubmit(e) { var options = e.data; if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed e.preventDefault(); $(this).ajaxSubmit(options); } } function captureSubmittingElement(e) { var target = e.target; var $el = $(target); if (!($el.is(":submit,input:image"))) { // is this a child element of the submit el? (ex: a span within a button) var t = $el.closest(':submit'); if (t.length == 0) { return; } target = t[0]; } var form = this; form.clk = target; if (target.type == 'image') { if (e.offsetX != undefined) { form.clk_x = e.offsetX; form.clk_y = e.offsetY; } else if (typeof $.fn.offset == 'function') { var offset = $el.offset(); form.clk_x = e.pageX - offset.left; form.clk_y = e.pageY - offset.top; } else { form.clk_x = e.pageX - target.offsetLeft; form.clk_y = e.pageY - target.offsetTop; } } // clear form vars setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100); }; // ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm $.fn.ajaxFormUnbind = function() { return this.unbind('submit.form-plugin click.form-plugin'); }; /** * formToArray() gathers form element data into an array of objects that can * be passed to any of the following ajax functions: $.get, $.post, or load. * Each object in the array has both a 'name' and 'value' property. An example of * an array for a simple login form might be: * * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ] * * It is this array that is passed to pre-submit callback functions provided to the * ajaxSubmit() and ajaxForm() methods. */ $.fn.formToArray = function(semantic) { var a = []; if (this.length === 0) { return a; } var form = this[0]; var els = semantic ? form.getElementsByTagName('*') : form.elements; if (!els) { return a; } var i,j,n,v,el,max,jmax; for(i=0, max=els.length; i < max; i++) { el = els[i]; n = el.name; if (!n) { continue; } if (semantic && form.clk && el.type == "image") { // handle image inputs on the fly when semantic == true if(!el.disabled && form.clk == el) { a.push({name: n, value: $(el).val(), type: el.type }); a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y}); } continue; } v = $.fieldValue(el, true); if (v && v.constructor == Array) { for(j=0, jmax=v.length; j < jmax; j++) { a.push({name: n, value: v[j]}); } } else if (v !== null && typeof v != 'undefined') { a.push({name: n, value: v, type: el.type}); } } if (!semantic && form.clk) { // input type=='image' are not found in elements array! handle it here var $input = $(form.clk), input = $input[0]; n = input.name; if (n && !input.disabled && input.type == 'image') { a.push({name: n, value: $input.val()}); a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y}); } } return a; }; /** * Serializes form data into a 'submittable' string. This method will return a string * in the format: name1=value1&amp;name2=value2 */ $.fn.formSerialize = function(semantic) { //hand off to jQuery.param for proper encoding return $.param(this.formToArray(semantic)); }; /** * Serializes all field elements in the jQuery object into a query string. * This method will return a string in the format: name1=value1&amp;name2=value2 */ $.fn.fieldSerialize = function(successful) { var a = []; this.each(function() { var n = this.name; if (!n) { return; } var v = $.fieldValue(this, successful); if (v && v.constructor == Array) { for (var i=0,max=v.length; i < max; i++) { a.push({name: n, value: v[i]}); } } else if (v !== null && typeof v != 'undefined') { a.push({name: this.name, value: v}); } }); //hand off to jQuery.param for proper encoding return $.param(a); }; /** * Returns the value(s) of the element in the matched set. For example, consider the following form: * * <form><fieldset> * <input name="A" type="text" /> * <input name="A" type="text" /> * <input name="B" type="checkbox" value="B1" /> * <input name="B" type="checkbox" value="B2"/> * <input name="C" type="radio" value="C1" /> * <input name="C" type="radio" value="C2" /> * </fieldset></form> * * var v = $(':text').fieldValue(); * // if no values are entered into the text inputs * v == ['',''] * // if values entered into the text inputs are 'foo' and 'bar' * v == ['foo','bar'] * * var v = $(':checkbox').fieldValue(); * // if neither checkbox is checked * v === undefined * // if both checkboxes are checked * v == ['B1', 'B2'] * * var v = $(':radio').fieldValue(); * // if neither radio is checked * v === undefined * // if first radio is checked * v == ['C1'] * * The successful argument controls whether or not the field element must be 'successful' * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls). * The default value of the successful argument is true. If this value is false the value(s) * for each element is returned. * * Note: This method *always* returns an array. If no valid value can be determined the * array will be empty, otherwise it will contain one or more values. */ $.fn.fieldValue = function(successful) { for (var val=[], i=0, max=this.length; i < max; i++) { var el = this[i]; var v = $.fieldValue(el, successful); if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) { continue; } v.constructor == Array ? $.merge(val, v) : val.push(v); } return val; }; /** * Returns the value of the field element. */ $.fieldValue = function(el, successful) { var n = el.name, t = el.type, tag = el.tagName.toLowerCase(); if (successful === undefined) { successful = true; } if (successful && (!n || el.disabled || t == 'reset' || t == 'button' || (t == 'checkbox' || t == 'radio') && !el.checked || (t == 'submit' || t == 'image') && el.form && el.form.clk != el || tag == 'select' && el.selectedIndex == -1)) { return null; } if (tag == 'select') { var index = el.selectedIndex; if (index < 0) { return null; } var a = [], ops = el.options; var one = (t == 'select-one'); var max = (one ? index+1 : ops.length); for(var i=(one ? index : 0); i < max; i++) { var op = ops[i]; if (op.selected) { var v = op.value; if (!v) { // extra pain for IE... v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value; } if (one) { return v; } a.push(v); } } return a; } return $(el).val(); }; /** * Clears the form data. Takes the following actions on the form's input fields: * - input text fields will have their 'value' property set to the empty string * - select elements will have their 'selectedIndex' property set to -1 * - checkbox and radio inputs will have their 'checked' property set to false * - inputs of type submit, button, reset, and hidden will *not* be effected * - button elements will *not* be effected */ $.fn.clearForm = function(includeHidden) { return this.each(function() { $('input,select,textarea', this).clearFields(includeHidden); }); }; /** * Clears the selected form elements. */ $.fn.clearFields = $.fn.clearInputs = function(includeHidden) { var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list return this.each(function() { var t = this.type, tag = this.tagName.toLowerCase(); if (re.test(t) || tag == 'textarea' || (includeHidden && /hidden/.test(t)) ) { this.value = ''; } else if (t == 'checkbox' || t == 'radio') { this.checked = false; } else if (tag == 'select') { this.selectedIndex = -1; } }); }; /** * Resets the form data. Causes all form elements to be reset to their original value. */ $.fn.resetForm = function() { return this.each(function() { // guard against an input with the name of 'reset' // note that IE reports the reset function as an 'object' if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) { this.reset(); } }); }; /** * Enables or disables any matching elements. */ $.fn.enable = function(b) { if (b === undefined) { b = true; } return this.each(function() { this.disabled = !b; }); }; /** * Checks/unchecks any matching checkboxes or radio buttons and * selects/deselects and matching option elements. */ $.fn.selected = function(select) { if (select === undefined) { select = true; } return this.each(function() { var t = this.type; if (t == 'checkbox' || t == 'radio') { this.checked = select; } else if (this.tagName.toLowerCase() == 'option') { var $sel = $(this).parent('select'); if (select && $sel[0] && $sel[0].type == 'select-one') { // deselect all other options $sel.find('option').selected(false); } this.selected = select; } }); }; // expose debug var $.fn.ajaxSubmit.debug = false; // helper fn for console logging function log() { if (!$.fn.ajaxSubmit.debug) return; var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,''); if (window.console && window.console.log) { window.console.log(msg); } else if (window.opera && window.opera.postError) { window.opera.postError(msg); } }; })(jQuery);
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/script/jquery.form.js
JavaScript
oos
29,142
// plugin author : chenjinfa@gmail.com // plugin name : $.include // $.include('file/ajaxa.js');$.include('file/ajaxa.css'); // or $.includePath = 'file/';$.include(['ajaxa.js','ajaxa.css']); $.extend({ includePath: '', include: function (file) { var files = typeof file == "string" ? [file] : file; for (var i = 0; i < files.length; i++) { var name = files[i].replace(/^\s|\s$/g, ""); var att = name.split('.'); var ext = att[att.length - 1].toLowerCase(); var isCSS = ext == "css"; var tag = isCSS ? "link" : "script"; var attr = isCSS ? " type='text/css' rel='stylesheet' " : " language='javascript' type='text/javascript' "; var link = (isCSS ? "href" : "src") + "='" + $.includePath + name + "'"; if ($(tag + "[" + link + "]").length == 0) document.write("<" + tag + attr + link + "></" + tag + ">"); } } });
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/script/jquery.getcss.js
JavaScript
oos
976
 //上传事件 function _upfile(i) { $(".seeupfile").remove(); var obj1 = $(i); var fid = i.form.id; var strUrl = _strBasePath() + "ajaxtools/fileupload.ashx?f=" + $(obj1).attr("name") + "&t=add"; $("#" + fid).ajaxSubmit({ beforeSubmit: function (formData, jqForm, options) { _fileuploadEffect('display', i); }, success: function (data) { _fileuploadEffect('hide', i); if ($(obj1).parent().parent().find("input.filedisplay").attr("value") != "") { $(obj1).parent().parent().parent().find("input[type='hidden']").val().replace($(obj1).parent().parent().find("input.filedisplay").attr("value"), data.msbox); } else { if ($(obj1).parent().parent().parent().find("input[type='hidden']").val() == "") { $(obj1).parent().parent().parent().find("input[type='hidden']").val(data.msbox + ","); } else { $(obj1).parent().parent().parent().find("input[type='hidden']").val($(obj1).parent().parent().parent().find("input[type='hidden']").val() + data.msbox + ","); } } if ($(obj1).parent().parent().parent().hasClass("m")) { $(obj1).parent().parent().parent().append(_jsfileuploadInputHtml(_jsfileuploadGetNewName($(obj1).attr("name")))); } $(obj1).parent().parent().find("input.filedisplay").attr("value", data.msbox); //$(obj1).attr("disabled", "false"); getHtmlTools(obj1, "up"); }, error: function (data, status, e) { alert("上传失败,错误信息:" + e); }, url: strUrl, dataType: "json", timeout: 600000 }); } function _updel(i,t) { var obj1 = $(i); //$(obj1).parent().find("input[type='file']").attr("disabled", "true"); var submitUrl = _strBasePath() + "ajaxtools/fileupload.ashx?f=" + $(obj1).parent().find("input.filedisplay").attr("value") + "&t=del&dt=" + t; $.ajax({ url: submitUrl, timeout: 600000, dataType: "json", success: function (data) { if (data.msg == "1") { $(obj1).parent().parent().find("input[type='hidden']").val($(obj1).parent().parent().find("input[type='hidden']").val().replace($(obj1).parent().find("input.filedisplay").attr("value") + ",", "")); if ($(obj1).parent().parent().hasClass("m")) { $(obj1).parent().remove(); } else { $(obj1).parent().parent().find("input[type='hidden']").val(""); $(obj1).parent().find("input.filedisplay").attr("value", ""); $(i).next().remove(); $(i).remove(); } } else { alert(data.msbox); } } }); } function _upsee(i, t) { if ($(i).text() == "预") { $("a._filesee").text("预"); $(i).text("关"); $(".seeupfile").remove(); var obj1 = $(i); var cHtml = ""; var objImg; if (t.indexOf("edit_") < 0) { objImg = _strBasePath() + "/upload/temp/" + $(obj1).parent().find("input.filedisplay").attr("value"); } else { objImg = _strBasePath() + t.replace("edit_", "") + $(obj1).parent().find("input.filedisplay").attr("value"); } var ni = new Image(); ni.onload = function () { var width = ni.width; } ni.src = objImg; cHtml = "<div class=\"seeupfile\" name=\"1\" width='" + ni.width + "' height='" + ni.width + "' >"; cHtml += "<img src=\"" + objImg + "\" alter=\"点击关闭\" />"; cHtml += "</div>" $(obj1).append(cHtml); } else { if ($(i).text() == "关") { $($(i)).find("div").remove(); $(i).text("预") } } } $(function () { var j = 0; $.each($(".fileUpload"), function () { //alert($(this).html()) if ($(this).find("input[type='hidden']").attr("value") != "" && $(this).find("input[type='hidden']").attr("value").length > 0) { var arrFileList = new Array(); arrFileList = $(this).find("input[type='hidden']").attr("value").split(","); //alert($(this).html()) if (!$(this).hasClass("m")) { $(this).find(".filedisplay").val(arrFileList[0]); getHtmlTools($(this).find("input[type='file']"), "edit_" + $(this).attr("path")); } else { for (var n = 0; n < arrFileList.length; n++) { if (arrFileList[n] != "") { $(_jsfileuploadInputHtml("nf" + "_" + j + "_" + n)).insertBefore($(this).find(".fileTools:eq(" + n + ")")); //$(this).append(); //$(this).parent().find(".filedisplay").attr("value", arrFileList[n]); $(this).find("input[name='" + "nf" + "_" + j + "_" + n + "']").parent().parent().find(".filedisplay").val(arrFileList[n]); getHtmlTools($(this).find("input[name='" + "nf" + "_" + j + "_" + n + "']"), "edit_" + $(this).attr("path")); } } } } j++; }); }) ///生成新的上传工具 function _jsfileuploadInputHtml(o) { var inputHtml = "<div class=\"fileTools\">"; inputHtml += "<input type=\"text\" class=\"input w160 filedisplay\" />"; inputHtml += "<a href=\"javascript:void(0);\" class=\"files\">"; inputHtml += "<input type=\"file\" onchange=\"_upfile(this)\" class=\"upload\" name=\"" + o + "\" runat=\"server\" />"; inputHtml += "上传</a>"; inputHtml += "<span class=\"uploading\">正在上传,请稍候...</span>"; inputHtml += "</div>"; return inputHtml; } ///多个上传时生成新地ID function _jsfileuploadGetNewName(name) { if (name == null) { name = "newt"; } var lastPlace = name.lastIndexOf("_"); var oldname = name.substr(lastPlace + 1, name.length - lastPlace - 1); var r = /^[0-9]*[1-9][0-9]*$/; //正整数 if (!r.test(oldname)) { newName = name + "_1"; } else { var _name = name.substr(0, lastPlace); if (!isNaN(parseInt(oldname))) { var i = parseInt(oldname); newName = _name + "_" + (i + 1).toString(); } else { newName = name + "_1"; } } return newName; } //loading按钮 function _fileuploadEffect(type, i) { if (type == 'display') { //隐藏上传按钮 $($(i)).parent().nextAll(".files").eq(0).hide(); //显示LOADING图片 $($(i)).parent().nextAll(".uploading").eq(0).show(); } if (type == 'hide') { $($(i)).parent().nextAll(".files").eq(0).show(); $($(i)).parent().nextAll(".uploading").eq(0).hide(); } } //工具 function getHtmlTools(o,t) { $(o).parent().parent().find("a._filedel,a._filesee").remove(); $(o).parent().parent().append("<a href=\"javascript:;\" class=\"_filedel\" onclick=\"_updel(this,'" + t + "')\">删</a><a href=\"javascript:;\" class=\"_filesee\" onclick=\"_upsee(this,'" + t + "')\">预</a>"); } ///上传ajax处理文件路径 function _strBasePath() { var baseUrl = document.domain; var port = document.location.port; if (port != "") { port = ":" + port; } return "http://" + baseUrl + port + "/"; }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/script/fileupload.js
JavaScript
oos
7,766
/* http://www.JSON.org/json2.js 2011-02-23 Public Domain. NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. See http://www.JSON.org/js.html This code should be minified before deployment. See http://javascript.crockford.com/jsmin.html USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO NOT CONTROL. This file creates a global JSON object containing two methods: stringify and parse. JSON.stringify(value, replacer, space) value any JavaScript value, usually an object or array. replacer an optional parameter that determines how object values are stringified for objects. It can be a function or an array of strings. space an optional parameter that specifies the indentation of nested structures. If it is omitted, the text will be packed without extra whitespace. If it is a number, it will specify the number of spaces to indent at each level. If it is a string (such as '\t' or '&nbsp;'), it contains the characters used to indent at each level. This method produces a JSON text from a JavaScript value. When an object value is found, if the object contains a toJSON method, its toJSON method will be called and the result will be stringified. A toJSON method does not serialize: it returns the value represented by the name/value pair that should be serialized, or undefined if nothing should be serialized. The toJSON method will be passed the key associated with the value, and this will be bound to the value For example, this would serialize Dates as ISO strings. Date.prototype.toJSON = function (key) { function f(n) { // Format integers to have at least two digits. return n < 10 ? '0' + n : n; } return this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z'; }; You can provide an optional replacer method. It will be passed the key and value of each member, with this bound to the containing object. The value that is returned from your method will be serialized. If your method returns undefined, then the member will be excluded from the serialization. If the replacer parameter is an array of strings, then it will be used to select the members to be serialized. It filters the results such that only members with keys listed in the replacer array are stringified. Values that do not have JSON representations, such as undefined or functions, will not be serialized. Such values in objects will be dropped; in arrays they will be replaced with null. You can use a replacer function to replace those with JSON values. JSON.stringify(undefined) returns undefined. The optional space parameter produces a stringification of the value that is filled with line breaks and indentation to make it easier to read. If the space parameter is a non-empty string, then that string will be used for indentation. If the space parameter is a number, then the indentation will be that many spaces. Example: text = JSON.stringify(['e', {pluribus: 'unum'}]); // text is '["e",{"pluribus":"unum"}]' text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' text = JSON.stringify([new Date()], function (key, value) { return this[key] instanceof Date ? 'Date(' + this[key] + ')' : value; }); // text is '["Date(---current time---)"]' JSON.parse(text, reviver) This method parses a JSON text to produce an object or array. It can throw a SyntaxError exception. The optional reviver parameter is a function that can filter and transform the results. It receives each of the keys and values, and its return value is used instead of the original value. If it returns what it received, then the structure is not modified. If it returns undefined then the member is deleted. Example: // Parse the text. Values that look like ISO date strings will // be converted to Date objects. myData = JSON.parse(text, function (key, value) { var a; if (typeof value === 'string') { a = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); if (a) { return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], +a[5], +a[6])); } } return value; }); myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { var d; if (typeof value === 'string' && value.slice(0, 5) === 'Date(' && value.slice(-1) === ')') { d = new Date(value.slice(5, -1)); if (d) { return d; } } return value; }); This is a reference implementation. You are free to copy, modify, or redistribute. */ /*jslint evil: true, strict: false, regexp: false */ /*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, lastIndex, length, parse, prototype, push, replace, slice, stringify, test, toJSON, toString, valueOf */ // Create a JSON object only if one does not already exist. We create the // methods in a closure to avoid creating global variables. var JSON; if (!JSON) { JSON = {}; } (function () { "use strict"; function f(n) { // Format integers to have at least two digits. return n < 10 ? '0' + n : n; } if (typeof Date.prototype.toJSON !== 'function') { Date.prototype.toJSON = function (key) { return isFinite(this.valueOf()) ? this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z' : null; }; String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function (key) { return this.valueOf(); }; } var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, gap, indent, meta = { // table of character substitutions '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\' }, rep; function quote(string) { // If the string contains no control characters, no quote characters, and no // backslash characters, then we can safely slap some quotes around it. // Otherwise we must also replace the offending characters with safe escape // sequences. escapable.lastIndex = 0; return escapable.test(string) ? '"' + string.replace(escapable, function (a) { var c = meta[a]; return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); }) + '"' : '"' + string + '"'; } function str(key, holder) { // Produce a string from holder[key]. var i, // The loop counter. k, // The member key. v, // The member value. length, mind = gap, partial, value = holder[key]; // If the value has a toJSON method, call it to obtain a replacement value. if (value && typeof value === 'object' && typeof value.toJSON === 'function') { value = value.toJSON(key); } // If we were called with a replacer function, then call the replacer to // obtain a replacement value. if (typeof rep === 'function') { value = rep.call(holder, key, value); } // What happens next depends on the value's type. switch (typeof value) { case 'string': return quote(value); case 'number': // JSON numbers must be finite. Encode non-finite numbers as null. return isFinite(value) ? String(value) : 'null'; case 'boolean': case 'null': // If the value is a boolean or null, convert it to a string. Note: // typeof null does not produce 'null'. The case is included here in // the remote chance that this gets fixed someday. return String(value); // If the type is 'object', we might be dealing with an object or an array or // null. case 'object': // Due to a specification blunder in ECMAScript, typeof null is 'object', // so watch out for that case. if (!value) { return 'null'; } // Make an array to hold the partial results of stringifying this object value. gap += indent; partial = []; // Is the value an array? if (Object.prototype.toString.apply(value) === '[object Array]') { // The value is an array. Stringify every element. Use null as a placeholder // for non-JSON values. length = value.length; for (i = 0; i < length; i += 1) { partial[i] = str(i, value) || 'null'; } // Join all of the elements together, separated with commas, and wrap them in // brackets. v = partial.length === 0 ? '[]' : gap ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : '[' + partial.join(',') + ']'; gap = mind; return v; } // If the replacer is an array, use it to select the members to be stringified. if (rep && typeof rep === 'object') { length = rep.length; for (i = 0; i < length; i += 1) { if (typeof rep[i] === 'string') { k = rep[i]; v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ': ' : ':') + v); } } } } else { // Otherwise, iterate through all of the keys in the object. for (k in value) { if (Object.prototype.hasOwnProperty.call(value, k)) { v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ': ' : ':') + v); } } } } // Join all of the member texts together, separated with commas, // and wrap them in braces. v = partial.length === 0 ? '{}' : gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : '{' + partial.join(',') + '}'; gap = mind; return v; } } // If the JSON object does not yet have a stringify method, give it one. if (typeof JSON.stringify !== 'function') { JSON.stringify = function (value, replacer, space) { // The stringify method takes a value and an optional replacer, and an optional // space parameter, and returns a JSON text. The replacer can be a function // that can replace values, or an array of strings that will select the keys. // A default replacer method can be provided. Use of the space parameter can // produce text that is more easily readable. var i; gap = ''; indent = ''; // If the space parameter is a number, make an indent string containing that // many spaces. if (typeof space === 'number') { for (i = 0; i < space; i += 1) { indent += ' '; } // If the space parameter is a string, it will be used as the indent string. } else if (typeof space === 'string') { indent = space; } // If there is a replacer, it must be a function or an array. // Otherwise, throw an error. rep = replacer; if (replacer && typeof replacer !== 'function' && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) { throw new Error('JSON.stringify'); } // Make a fake root object containing our value under the key of ''. // Return the result of stringifying the value. return str('', {'': value}); }; } // If the JSON object does not yet have a parse method, give it one. if (typeof JSON.parse !== 'function') { JSON.parse = function (text, reviver) { // The parse method takes a text and an optional reviver function, and returns // a JavaScript value if the text is a valid JSON text. var j; function walk(holder, key) { // The walk method is used to recursively walk the resulting structure so // that modifications can be made. var k, v, value = holder[key]; if (value && typeof value === 'object') { for (k in value) { if (Object.prototype.hasOwnProperty.call(value, k)) { v = walk(value, k); if (v !== undefined) { value[k] = v; } else { delete value[k]; } } } } return reviver.call(holder, key, value); } // Parsing happens in four stages. In the first stage, we replace certain // Unicode characters with escape sequences. JavaScript handles many characters // incorrectly, either silently deleting them, or treating them as line endings. text = String(text); cx.lastIndex = 0; if (cx.test(text)) { text = text.replace(cx, function (a) { return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); }); } // In the second stage, we run the text against regular expressions that look // for non-JSON patterns. We are especially concerned with '()' and 'new' // because they can cause invocation, and '=' because it can cause mutation. // But just to be safe, we want to reject all unexpected forms. // We split the second stage into 4 regexp operations in order to work around // crippling inefficiencies in IE's and Safari's regexp engines. First we // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we // replace all simple value tokens with ']' characters. Third, we delete all // open brackets that follow a colon or comma or that begin the text. Finally, // we look to see that the remaining characters are only whitespace or ']' or // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. if (/^[\],:{}\s]*$/ .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { // In the third stage we use the eval function to compile the text into a // JavaScript structure. The '{' operator is subject to a syntactic ambiguity // in JavaScript: it can begin a block or an object literal. We wrap the text // in parens to eliminate the ambiguity. j = eval('(' + text + ')'); // In the optional fourth stage, we recursively walk the new structure, passing // each name/value pair to a reviver function for possible transformation. return typeof reviver === 'function' ? walk({'': j}, '') : j; } // If the text is not JSON parseable, then a SyntaxError is thrown. throw new SyntaxError('JSON.parse'); }; } }());
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/script/json2.js
JavaScript
oos
17,416
/** * jQuery Initial input value replacer * * Sets input value attribute to a starting value * @author Marco "DWJ" Solazzi - hello@dwightjack.com * @license Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * @copyright Copyright (c) 2008 Marco Solazzi * @version 0.1 * @requires jQuery 1.2.x */ (function (jQuery) { /** * Setting input initialization * * @param {String|Object|Bool} text Initial value of the field. Can be either a string, a jQuery reference (example: $("#element")), or boolean false (default) to search for related label * @param {Object} [opts] An object containing options: * color (initial text color, default : "#666"), * e (event which triggers initial text clearing, default: "focus"), * force (execute this script even if input value is not empty, default: false) * keep (if value of field is empty on blur, re-apply initial text, default: true) */ jQuery.fn.inputLabel = function(text,opts) { o = jQuery.extend({ color: "#666", e:"focus", force : false, keep : true}, opts || {}); var clearInput = function (e) { var target = jQuery(e.target); var value = jQuery.trim(target.val()); if (e.type == e.data.obj.e && value == e.data.obj.innerText) { jQuery(target).css("color", "").val(""); if (!e.data.obj.keep) { jQuery(target).unbind(e.data.obj.e+" blur",clearInput); } } else if (e.type == "blur" && value == "" && e.data.obj.keep) { jQuery(this).css("color", e.data.obj.color).val(e.data.obj.innerText); } }; return this.each(function () { o.innerText = (text || false); if (!o.innerText) { var id = jQuery(this).attr("id"); o.innerText = jQuery(this).parents("form").find("label[for=" + id + "]").hide().text(); } else if (typeof o.innerText != "string") { o.innerText = jQuery(o.innerText).text(); } o.innerText = jQuery.trim(o.innerText); if (o.force || jQuery(this).val() == "") { jQuery(this).css("color", o.color).val(o.innerText); } jQuery(this).bind(o.e+" blur",{obj:o},clearInput); }); }; })(jQuery);
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/script/jquery.inputlabel.js
JavaScript
oos
2,231
; (function ($) { $.fn.extend({ hasScrollBarX: function () { return this[0].scrollWidth > this[0].clientWidth; }, hasScrollBarY: function () { return this[0].scrollHeight > this[0].clientHeight; }, hasScrollBar: function () { return this.hasScrollBarX() || this.hasScrollBarY(); }, params: function(a,b){ return a + b; } }); })(jQuery) ;(function ($) { $.fn.oms_autocomplate = function (options) { var timer; var childindex = -1; var _seft = this; $(_seft).attr("autocomplete", "off"); var defaults = { url: null, maxHeight: 412, paramTypeSelector: "", select: function (event, ui) { this.value = ui.item.value; if (ui.item.redirecturl != undefined && $.trim(ui.item.redirecturl) != '') { window.top.location = $.trim(ui.item.redirecturl); } } }; var opt = $.extend({}, defaults, options); function search_keyup(e) { var the = this; if ((e.keyCode == 38 || e.keyCode == 40) && this.value != "") { window.clearInterval(timer); } if (e.keyCode == 13) { if (childindex > -1) { getElem().css("display", "none"); $(the).trigger('selected', [{ item: getElem().find('li:eq(' + childindex + ')').data('data')}]); childindex = -1; } } else { if (the.value != "") { if(!getElem().filter(":hidden")[0] && (e.keyCode == 38 || e.keyCode == 40)) { return; } $.get(opt.url, { key: the.value, type: (opt.paramTypeSelector != '' ? $(opt.paramTypeSelector).attr('title') : "") ,time:new Date().toString()}, function (serverdata) { getElem().children("ul").empty(); var data = eval(serverdata); $.each(data, function (i) { var li = $('<li style="padding:2px 0px 2px 5px; height:16px; line-height:16px; cursor:pointer;overflow:hidden;position:relative;">' + this.label + '</li>'); li.data('value', this.value); li.data('label', this.label); li.data('data', this); li.bind('click', function () { $(the).trigger('selected', [{ item: data[i]}]); }); getElem().children("ul").append(li).css("overflow", "auto"); }); if (getElem().find("li").length == 0) { getElem().css("display", "none"); return false; } else { childindex = -1; getElem().find("li").each(function (i) { $(this).hover(function () { childindex = i; getElem().find("li").css({ backgroundColor: "", color: "#666666" }); this.style.backgroundColor = "#FA8F5C"; this.style.color = "#FFF"; }, function () { }); }); } if (getElem().filter(":hidden")[0]) { getElem().css({ height: "0px", display: "block" }); } var tw = opt.inputWidth != null && opt.inputWidth > 0 ? opt.inputWidth : $(the).outerWidth(); var th = opt.inputHeight != null && opt.inputHeight > 0 ? opt.inputHeight : $(the).outerHeight(); var h = Math.min(opt.maxHeight, getElem().find("li").outerHeight() * $("#oms_autocomplate").find("li").length + 10); var l = parseInt($(the).offset().left) - parseInt($(the).css("marginLeft")); var tt = parseInt($(the).offset().top) - parseInt($(the).css("marginTop")); var t = tt + parseInt(th); var clientH = $(document).height(); getElem().css({ width: tw, left: l }).children("ul").height(h - 10); if (clientH - t >= h) { getElem().stop().css({ top: t }).animate({ height: h }, 0); } else { if (getElem().height() == 0) { getElem().stop().css({ top: tt, height: "0px" }).animate({ top: tt - h - 2, height: h }, 0); } else { getElem().stop().animate({ top: tt - h - 2, height: h }, 0); } } }); } else { getElem().css("display", "none"); } } } function search_keydown(e) { var len = getElem().find("li").length; if (e.keyCode == 38) { window.clearInterval(timer); if (len > 0) { if (childindex <= 0) { childindex = len - 1; } else { childindex--; } getElem().find("li").css({ backgroundColor: "", color: "#666666" }).eq(childindex).css({ backgroundColor: "#FA8F5C", color: "#FFF" }); scrollUL(getElem().children("ul")[0], childindex, e.keyCode); timer = window.setInterval(function () { if (childindex <= 0) { childindex = len - 1; } else { childindex--; } getElem().find("li").css({ backgroundColor: "", color: "#666666" }).eq(childindex).css({ backgroundColor: "#FA8F5C", color: "#FFF" }); scrollUL(getElem().children("ul")[0], childindex, e.keyCode); }, 850); } } else if (e.keyCode == 40) { window.clearInterval(timer); if (len > 0) { if (childindex >= len - 1) { childindex = 0; } else { childindex++; } getElem().find("li").css({ backgroundColor: "", color: "#666666" }).eq(childindex).css({ backgroundColor: "#FA8F5C", color: "#FFF" }); scrollUL(getElem().children("ul")[0], childindex, e.keyCode); timer = window.setInterval(function () { if (childindex >= len - 1) { childindex = 0; } else { childindex++; } getElem().find("li").css({ backgroundColor: "", color: "#666666" }).eq(childindex).css({ backgroundColor: "#FA8F5C", color: "#FFF" }); scrollUL(getElem().children("ul")[0], childindex, e.keyCode); }, 850); } } else if (e.keyCode == 13) { if (childindex > -1) { return false; } } } function scrollUL(ul, index, keyCode) { var liTop = $(ul).find('li').eq(index).offset().top; var liHeight = $(ul).find('li').eq(index).outerHeight(); var ulTop = $(ul).offset().top; var ulscroTop = $(ul).scrollTop(); var ulborderTop = $(ul).css("border-top-width").replace('px', ''); var ulheight = $(ul).height(); var lioffsetulTop = liTop - ulTop - ulborderTop + ulscroTop; if ($(ul).hasScrollBarY()) { if (!(lioffsetulTop > ulscroTop && ulscroTop + ulheight > lioffsetulTop + liHeight)) { switch (keyCode) { case 38: $(ul).scrollTop(lioffsetulTop); break; case 40: $(ul).scrollTop(lioffsetulTop - ulheight + liHeight); break; } } } } function getElem() { var el = $("#oms_autocomplate"); if (el.length == 0) { el = $('<ul id="oms_autocomplate" style="display:none;position:absolute;list-style-type:none;margin:0;padding:0;border:1px solid #e12b29;overflow:hidden; background-color:#FFFFFF;z-index:10010;max-height:' + opt.maxHeight + 'px;"><ul style="border:5px solid #f8f1cf;margin:0;padding:0;overflow:auto;position:relative;"></ul></ul>').appendTo(document.body); } return el; } $('html,body').click(function () { getElem().css("display", "none"); childindex = -1; }); return this.each(function () { $(this).keyup(search_keyup).keydown(search_keydown).bind('selected', opt.select); }); }; })(jQuery); ;(function ($) { $.fn.oms_autocomplateV2 = function (options) { var timer; var childindex = -1; var _seft = this; $(_seft).attr("autocomplete", "off"); var defaults = { url: null, maxHeight: 412, paramTypeSelector: "", clickDown: false, select: function (event, ui) { this.value = ui.item.value; if (ui.item.redirecturl != undefined && $.trim(ui.item.redirecturl) != '') { window.top.location = $.trim(ui.item.redirecturl); } }, beforeajaxfunc: function (event) {} }; var opt = $.extend({}, defaults, options); function search_keyup(e) { var the = this; if (e.keyCode == 38 || e.keyCode == 40) { window.clearInterval(timer); } if (e.keyCode == 13) { if (childindex > -1) { getElem().css("display", "none"); $(the).trigger('selected', [{ item: getElem().find('li:eq(' + childindex + ')').data('data')}]); childindex = -1; } } else { if (the.value != "" || opt.clickDown) { if(!getElem().filter(":hidden")[0] && (e.keyCode == 38 || e.keyCode == 40)) { return; } $(the).trigger('beforeajaxfunc'); $.get(opt.url, { key: the.value, type: (opt.paramTypeSelector != '' ? $(opt.paramTypeSelector).attr('title') : "") ,time:new Date().toString()}, function (serverdata) { getElem().children("ul").empty(); var data = eval(serverdata); $.each(data, function (i) { var li = $('<li style="padding:2px 0px 2px 5px; height:16px; line-height:16px; cursor:pointer;overflow:hidden;position:relative;">' + this.label + '</li>'); li.data('value', this.value); li.data('label', this.label); li.data('data', this); li.bind('click', function () { $(the).trigger('selected', [{ item: data[i]}]); }); getElem().children("ul").append(li).css("overflow", "auto"); }); if (getElem().find("li").length == 0) { getElem().css("display", "none"); return false; } else { childindex = -1; getElem().find("li").each(function (i) { $(this).hover(function () { childindex = i; getElem().find("li").css({ backgroundColor: "", color: "#666666" }); this.style.backgroundColor = "#FA8F5C"; this.style.color = "#FFF"; }, function () { }); }); } if (getElem().filter(":hidden")[0]) { getElem().css({ height: "0px", display: "block" }); } var tw = opt.inputWidth != null && opt.inputWidth > 0 ? opt.inputWidth : $(the).outerWidth(); var th = opt.inputHeight != null && opt.inputHeight > 0 ? opt.inputHeight : $(the).outerHeight(); var h = Math.min(opt.maxHeight, getElem().find("li").outerHeight() * $("#oms_autocomplate").find("li").length + 10); var l = parseInt($(the).offset().left) - parseInt($(the).css("marginLeft")); var tt = parseInt($(the).offset().top) - parseInt($(the).css("marginTop")); var t = tt + parseInt(th); var clientH = $(document).height(); getElem().css({ width: tw, left: l }).children("ul").height(h - 10); if (clientH - t >= h) { getElem().stop().css({ top: t }).animate({ height: h }, 0); } else { if (getElem().height() == 0) { getElem().stop().css({ top: tt, height: "0px" }).animate({ top: tt - h - 2, height: h }, 0); } else { getElem().stop().animate({ top: tt - h - 2, height: h }, 0); } } }); } else { getElem().css("display", "none"); } } } function search_keydown(e) { var len = getElem().find("li").length; if (e.keyCode == 38) { window.clearInterval(timer); if (len > 0) { if (childindex <= 0) { childindex = len - 1; } else { childindex--; } getElem().find("li").css({ backgroundColor: "", color: "#666666" }).eq(childindex).css({ backgroundColor: "#FA8F5C", color: "#FFF" }); scrollUL(getElem().children("ul")[0], childindex, e.keyCode); timer = window.setInterval(function () { if (childindex <= 0) { childindex = len - 1; } else { childindex--; } getElem().find("li").css({ backgroundColor: "", color: "#666666" }).eq(childindex).css({ backgroundColor: "#FA8F5C", color: "#FFF" }); scrollUL(getElem().children("ul")[0], childindex, e.keyCode); }, 850); } } else if (e.keyCode == 40) { window.clearInterval(timer); if (len > 0) { if (childindex >= len - 1) { childindex = 0; } else { childindex++; } getElem().find("li").css({ backgroundColor: "", color: "#666666" }).eq(childindex).css({ backgroundColor: "#FA8F5C", color: "#FFF" }); scrollUL(getElem().children("ul")[0], childindex, e.keyCode); timer = window.setInterval(function () { if (childindex >= len - 1) { childindex = 0; } else { childindex++; } getElem().find("li").css({ backgroundColor: "", color: "#666666" }).eq(childindex).css({ backgroundColor: "#FA8F5C", color: "#FFF" }); scrollUL(getElem().children("ul")[0], childindex, e.keyCode); }, 850); } } else if (e.keyCode == 13) { if (childindex > -1) { return false; } } } function scrollUL(ul, index, keyCode) { var liTop = $(ul).find('li').eq(index).offset().top; var liHeight = $(ul).find('li').eq(index).outerHeight(); var ulTop = $(ul).offset().top; var ulscroTop = $(ul).scrollTop(); var ulborderTop = $(ul).css("border-top-width").replace('px', ''); var ulheight = $(ul).height(); var lioffsetulTop = liTop - ulTop - ulborderTop + ulscroTop; if ($(ul).hasScrollBarY()) { if (!(lioffsetulTop > ulscroTop && ulscroTop + ulheight > lioffsetulTop + liHeight)) { switch (keyCode) { case 38: $(ul).scrollTop(lioffsetulTop); break; case 40: $(ul).scrollTop(lioffsetulTop - ulheight + liHeight); break; } } } } function getElem() { var el = $("#oms_autocomplate"); if (el.length == 0) { el = $('<div id="oms_autocomplate" style="display:none;position:absolute;list-style-type:none;margin:0;padding:0;border:1px solid #e12b29;overflow:hidden; background-color:#FFFFFF;z-index:10010;max-height:' + opt.maxHeight + 'px;"><ul style="border:5px solid #f8f1cf;margin:0;padding:0;overflow:auto;position:relative;"></ul></div>').appendTo(document.body); } return el; } $('html,body').click(function () { getElem().css("display", "none"); childindex = -1; }); return this.each(function () { $(this).keydown(search_keydown).keyup(search_keyup).bind('selected', opt.select).bind('beforeajaxfunc', opt.beforeajaxfunc); if(opt.clickDown){ $(this).click(search_keyup); } }); }; })(jQuery);
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/script/oms_autocomplate.js
JavaScript
oos
18,946
function setTab(name, cursel, n) { for (i = 1; i <= n; i++) { var menu = document.getElementById(name + i); var con = document.getElementById("con_" + name + "_" + i); menu.className = i == cursel ? "hover" : ""; con.style.display = i == cursel ? "block" : "none"; } } $(function () { SoFolderCondition(); //点击收起 SoGetMoreBrand(); //点击更多品牌 SoAlpha(); SoAjaxThumbViews(); //点击Views Tab SoThumbViewsHover('div.dealerLiMc,div.brandsDealer,div.productPic,div.braAbout1,div.brandsgc'); SoAjaxTab('products'); SoSlider("#infiniteCarousel"); SoAjaxViewTab(".searchBrand"); $("#searchTypeList").find("a").click(function () { $("#searchTypeList").hide(); }) $(".topSearch1").hover(function () { $(this).find("ol").show(); }, function () { $(this).find("ol").hide(); }) //搜索选择 $("#searchTypeList > a").click(function () { $("#searchTypeDisplay").html($(this).text()); $("#searchTypeList > a").removeClass("Searcha"); $(this).addClass("Searcha"); }) }); function SoFolderCondition() { $('div.prlifl1>div.prsq>a').toggle(function () { var o = $(this); o.parents('div.prlifl1').siblings('div.prlifl2').find('div.prlifl20').slideUp('slow'); o.addClass('on'); o.text("展开"); return false; }, function () { var o = $(this); o.parents('div.prlifl1').siblings('div.prlifl2').find('div.prlifl20').slideDown('slow'); o.removeClass('on'); o.text("收起"); return false; }); } function SoGetMoreBrand() { $('dt.prWhole>a').toggle(function() { var o = $(this); o.parent('dt.prWhole').siblings('dt.dt1').find('a.ahide').show(); o.addClass('on'); return false; }, function() { var o = $(this); o.parent('dt.prWhole').siblings('dt.dt1').find('a.ahide').hide(); o.removeClass('on'); return false; }); } function SoAlpha() { $('div.prlifl1>div.pren li').hover(function() { var o = $(this); var oa = o.find('a.a1') var oText = oa.text(); oa.addClass('prena'); $("div.prentc[alphaid='" + oText + "' ]").show(); }, function() { var o = $(this); var oa = o.find('a.a1') var oText = oa.text(); oa.removeClass('prena'); $("div.prentc[alphaid='" + oText + "' ]").hide(); }); $('div.prlifl1>div.pren a').click(function() { return false; }); } function SoAjaxThumbViews() { SoAjaxViewTab('productView'); } function SoAjaxViewTab(obj) { $('.' + obj + '>.hd>ul>li').click(function () { var o = $(this); var objPa = o.parent('ul'); var objSib = objPa.find('li'); var index = objSib.index(o); objSib.not(o).removeClass('on'); var objItemList = objPa.parent('.hd').siblings('.bd'); var itemTarget = objItemList.find('.item').eq(index); objItemList.find('.item').not(itemTarget).hide(); //如果已经ajax 请求过 //暂时注释掉,静态页面无AJAX 方法 否则IE6 测试报错 // var ajaxid = o.attr('ajaxid'); // if (itemTarget.html().length <= 0) { // $.ajax({ // type: "GET", // cache: true, // url: "/xxx/somepage.aspx?ajax=" + ajaxid, // error: function () { // }, // beforeSend: function () { // }, // success: function (d) { // } // }); // } //存在on属性 if (o.attr('class') == 'on') { o.removeClass('on'); itemTarget.slideUp('slow'); itemTarget.parent('div.bd').css({ "padding-bottom": "0px" }); } else { o.addClass('on'); itemTarget.show(); itemTarget.parent('div.bd').css({ "padding-bottom": "10px" }); } $(this).find('a').blur(); return false; }); } function SoThumbViewsHover(obj) { var config = { over: makeShow, // timeout: 200, // out: makeHide // }; if ($('div.productView').get(0) != null) { $(obj).hoverIntent(config); } } function makeShow() { var o = $(this); if (o.find('li.on').size() > 0) { o.find('div.bd').css({ "padding-bottom": "10px" }).show(); } else { o.find('div.bd').css({ "padding-bottom": "0" }).show(); } o.css({ "padding-bottom": "0" }).find('div.productView').fadeIn("slow"); } function makeHide() { var o = $(this); if (o.find('li.on').size() > 0) { } else { o.find('div.bd').css({ "padding-bottom": "10px" }).hide(); o.css({ "padding-bottom": "35px" }).find('div.productView').hide(); } } function SoAjaxTab(obj) { $('.' + obj + '>.hd>ul>li').click(function () { var o = $(this); var objPa = o.parent('ul'); var objSib = objPa.find('li'); var index = objSib.index(o); objSib.removeClass('on'); o.addClass('on'); var objItemList = objPa.parent('.hd').siblings('.bd'); objItemList.find('.item').hide(); var itemTarget = objItemList.find('.item').eq(index); var ajaxid = o.attr('ajaxid'); var ajaxGetType = o.attr('name'); //如果已经ajax 请求过 //暂时注释掉,静态页面无AJAX 方法 否则IE6 测试报错 if (itemTarget.html().length <= 0) { $.ajax({ type: "GET", cache: true, url: "../ashx/ajaxCommon.ashx?type=" + ajaxGetType + "&v=" + ajaxid, error: function () { }, beforeSend: function () { itemTarget.html("") }, success: function (d) { itemTarget.html(d); } }); } itemTarget.show(); $(this).find('a').blur(); return false; }); } function SoSlider(obj) { var autoscrolling = true; if ($(obj).get(0) != null) { $(obj).infiniteCarousel().mouseover(function () { autoscrolling = false; }).mouseout(function () { autoscrolling = true; }); setInterval(function () { if (autoscrolling) { $(obj).trigger('next'); } }, 5000); } } String.prototype.format = function (args) { var result = this; if (arguments.length > 0) { if (arguments.length == 1 && typeof (args) == "object") { for (var key in args) { if (args[key] != undefined) { var reg = new RegExp("({" + key + "})", "g"); result = result.replace(reg, args[key]); } } } else { for (var i = 0; i < arguments.length; i++) { if (arguments[i] != undefined) { var reg = new RegExp("({[" + i + "]})", "g"); result = result.replace(reg, arguments[i]); } } } } return result; }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/script/socommon.js
JavaScript
oos
8,519
$(function () { var baseUrl = document.domain; var port = document.location.port; if (port != "") { port = ":" + port; } baseurl = "http://" + baseUrl + port + "/"; $("._droparea").html(); var objid = $("._droparea").attr("id"); var pid = $("._droparea").attr("id") + "_province"; var cid = $("._droparea").attr("id") + "_city"; var did = $("._droparea").attr("id") + "_district"; var tid = $("._droparea").attr("id") + "_town"; var vid = $("._droparea").attr("id") + "_value"; $("._droparea").html("<select id=\"" + pid + "\" name=\"" + pid + "\" ></select>"); $("._droparea").append("<select id=\"" + cid + "\" name=\"" + cid + "\" ></select>"); $("._droparea").append("<select id=\"" + did + "\" name=\"" + did + "\" ></select>"); $("._droparea").append("<select id=\"" + tid + "\" name=\"" + tid + "\" ></select>"); $("._droparea").append("<input type=\"hidden\" id=\"" + vid + "\" name=\"" + vid + "\" value=\"" + $("#" + objid).attr("title") + "\" runat=\"server\" />"); $.ajax({ url: baseurl+"/ajaxtools/ajaxarea.ashx", data: "type=p&s=" + $("#" + objid).attr("title"), async: false, success: function (data) { $("#" + pid).html(data); $("#" + tid).hide(); $("#" + cid).html("<option value=\"\">请选择省份</option>"); $("#" + did).html("<option value=\"\">请选择城市</option>"); }, error: function (d, m) { alert(m); } }); if ($("#" + objid).attr("title") != null && $("#" + objid).attr("title") != "" && $("#" + objid).attr("title").length == 6) { $.ajax({ url: baseurl+"/ajaxtools/ajaxarea.ashx", data: "type=edit&s=" + $("#" + objid).attr("title"), dataType: "json", async: false, success: function (data) { $.each(data, function (i) { if (data[i].type == "city") { $("#" + cid).append("<option value=\"" + data[i].areacode + "\" selected=\"true\">" + data[i].areaname + "</option>"); } if (data[i].type == "district") { $("#" + did).append("<option value=\"" + data[i].areacode + "\" selected=\"true\">" + data[i].areaname + "</option>"); } if (data[i].type != null && data[i].type == "town") { $("#" + tid).show(); $("#" + tid).append("<option value=\"" + data[i].areacode + "\" selected=\"true\">" + data[i].areaname + "</option>"); } else { $("#" + tid).hide(); } }); }, error: function (d, m) { alert(m); } }); } $("#" + pid).live("change", function () { if ($(this).val() != "" && $(this).val() != "0") { $.ajax({ url: baseurl + "/ajaxtools/ajaxarea.ashx", data: "type=c&p=" + $(this).val(), success: function (data) { $("#" + cid).hide(); $("#" + cid).show(); $("#" + cid).html(""); $("#" + cid).html(data); $("#" + did).html("<option value=\"\">请选择城市</option>"); $("#" + tid).hide(); }, error: function (d, m) { alert(m); } }); $("#" + vid).attr("value", $(this).val()); } }) $("#" + cid).live("change", function () { if ($(this).val() != "" && $(this).val() != "0") { $.ajax({ url: baseurl + "/ajaxtools/ajaxarea.ashx", data: "type=d&c=" + $(this).val(), success: function (data) { $("#" + did).html(""); $("#" + did).hide(); $("#" + did).show(); $("#" + did).html(data); $("#" + tid).hide(); }, error: function (d, m) { alert(m); } }); $("#" + vid).attr("value", $(this).val()); } }) $("#" + did).live("change", function () { if ($(this).val() != "" && $(this).val() != "0") { $.ajax({ url: baseurl + "/ajaxtools/ajaxarea.ashx", data: "type=t&d=" + $(this).val(), success: function (data) { if ($(data).html() != null || $(data).html() != "") { $("#" + tid).html(""); $("#" + tid).hide(); $("#" + tid).show(); $("#" + tid).html(data); } else { $("#" + tid).hide(); } }, error: function (d, m) { alert(m); } }); $("#" + vid).attr("value", $(this).val()); } else { $("#" + tid).hide(); } }); $("#" + tid).live("change", function () { if ($(this).val() != "" && $(this).val() != "0") { $("#" + vid).attr("value", $(this).val()); } }); })
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/script/jquery.area.js
JavaScript
oos
5,567
<%@ webhandler Language="C#" class="FileManager" %> /** * KindEditor ASP.NET * * 本ASP.NET程序是演示程序,建议不要直接在实际项目中使用。 * 如果您确定直接使用本程序,使用之前请仔细确认相关安全设置。 * */ using System; using System.Collections; using System.Web; using System.IO; using System.Text.RegularExpressions; using LitJson; using System.Collections.Generic; public class FileManager : IHttpHandler { public void ProcessRequest(HttpContext context) { String aspxUrl = context.Request.Path.Substring(0, context.Request.Path.LastIndexOf("/") + 1); //根目录路径,相对路径 String rootPath = ""; //根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/ String rootUrl = ""; if (context.Request.QueryString["m"] != null && context.Request.QueryString["id"] != null && context.Request.QueryString["m"].ToString() != "" && context.Request.QueryString["id"].ToString() != "") { switch (context.Request.QueryString["m"].ToString()) { case "company": rootPath = string.Format(TREC.Entity.EnFilePath.Company, context.Request.QueryString["id"].ToString(),TREC.Entity.EnFilePath.ConImage); rootUrl = rootPath; break; case "dealer": rootPath = string.Format(TREC.Entity.EnFilePath.Dealer, context.Request.QueryString["id"].ToString(), TREC.Entity.EnFilePath.ConImage); rootUrl = rootPath; break; case "market": rootPath = string.Format(TREC.Entity.EnFilePath.Market, context.Request.QueryString["id"].ToString(), TREC.Entity.EnFilePath.ConImage); rootUrl = rootPath; break; case "shop": rootPath = string.Format(TREC.Entity.EnFilePath.Shop, context.Request.QueryString["id"].ToString(), TREC.Entity.EnFilePath.ConImage); rootUrl = rootPath; break; case "brand": rootPath = string.Format(TREC.Entity.EnFilePath.Brand, context.Request.QueryString["id"].ToString(), TREC.Entity.EnFilePath.ConImage); rootUrl = rootPath; break; case "brands": rootPath = string.Format(TREC.Entity.EnFilePath.Brands, context.Request.QueryString["id"].ToString(), TREC.Entity.EnFilePath.ConImage); rootUrl = rootPath; break; case "article": rootPath = string.Format(TREC.Entity.EnFilePath.Article, context.Request.QueryString["id"].ToString(), TREC.Entity.EnFilePath.ConImage); rootUrl = rootPath; break; case "promotion": rootPath = string.Format(TREC.Entity.EnFilePath.Promotion, context.Request.QueryString["id"].ToString(), TREC.Entity.EnFilePath.ConImage); rootUrl = rootPath; break; case "groupon": rootPath = string.Format(TREC.Entity.EnFilePath.Groupon, context.Request.QueryString["id"].ToString(), TREC.Entity.EnFilePath.ConImage); rootUrl = rootPath; break; case "product": rootPath = string.Format(TREC.Entity.EnFilePath.Product, context.Request.QueryString["id"].ToString(), TREC.Entity.EnFilePath.ConImage); rootUrl = rootPath; break; default: rootPath = TREC.Entity.EnFilePath.tmpRootPath; rootUrl = TREC.Entity.EnFilePath.tmpRootPath; break; } } else { rootPath = TREC.Entity.EnFilePath.tmpRootPath; rootUrl = TREC.Entity.EnFilePath.tmpRootPath; } if(!Directory.Exists(context.Server.MapPath(rootPath))) { Directory.CreateDirectory(context.Server.MapPath(rootPath)); } //图片扩展名 String fileTypes = "gif,jpg,jpeg,png,bmp"; String currentPath = ""; String currentUrl = ""; String currentDirPath = ""; String moveupDirPath = ""; String dirPath = context.Server.MapPath(rootPath); String dirName = context.Request.QueryString["dir"]; //if (!String.IsNullOrEmpty(dirName)) { // if (Array.IndexOf("image,flash,media,file".Split(','), dirName) == -1) { // context.Response.Write("Invalid Directory name."); // context.Response.End(); // } // dirPath += dirName + "/"; // rootUrl += dirName + "/"; // if (!Directory.Exists(dirPath)) { // Directory.CreateDirectory(dirPath); // } //} //根据path参数,设置各路径和URL String path = context.Request.QueryString["path"]; path = String.IsNullOrEmpty(path) ? "" : path; if (path == "") { currentPath = dirPath; currentUrl = rootUrl; currentDirPath = ""; moveupDirPath = ""; } else { currentPath = dirPath + path; currentUrl = rootUrl + path; currentDirPath = path; moveupDirPath = Regex.Replace(currentDirPath, @"(.*?)[^\/]+\/$", "$1"); } //排序形式,name or size or type String order = context.Request.QueryString["order"]; order = String.IsNullOrEmpty(order) ? "" : order.ToLower(); //不允许使用..移动到上一级目录 if (Regex.IsMatch(path, @"\.\.")) { context.Response.Write("Access is not allowed."); context.Response.End(); } //最后一个字符不是/ if (path != "" && !path.EndsWith("/")) { context.Response.Write("Parameter is not valid."); context.Response.End(); } //目录不存在或不是目录 if (!Directory.Exists(currentPath)) { context.Response.Write("Directory does not exist."); context.Response.End(); } //遍历目录取得文件信息 string[] dirList = Directory.GetDirectories(currentPath); string[] fileList = Directory.GetFiles(currentPath); switch (order) { case "size": Array.Sort(dirList, new NameSorter()); Array.Sort(fileList, new SizeSorter()); break; case "type": Array.Sort(dirList, new NameSorter()); Array.Sort(fileList, new TypeSorter()); break; case "name": default: Array.Sort(dirList, new NameSorter()); Array.Sort(fileList, new NameSorter()); break; } Hashtable result = new Hashtable(); result["moveup_dir_path"] = moveupDirPath; result["current_dir_path"] = currentDirPath; result["current_url"] = currentUrl; result["total_count"] = dirList.Length + fileList.Length; List<Hashtable> dirFileList = new List<Hashtable>(); result["file_list"] = dirFileList; for (int i = 0; i < dirList.Length; i++) { DirectoryInfo dir = new DirectoryInfo(dirList[i]); Hashtable hash = new Hashtable(); hash["is_dir"] = true; hash["has_file"] = (dir.GetFileSystemInfos().Length > 0); hash["filesize"] = 0; hash["is_photo"] = false; hash["filetype"] = ""; hash["filename"] = dir.Name; hash["datetime"] = dir.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss"); dirFileList.Add(hash); } for (int i = 0; i < fileList.Length; i++) { FileInfo file = new FileInfo(fileList[i]); Hashtable hash = new Hashtable(); hash["is_dir"] = false; hash["has_file"] = false; hash["filesize"] = file.Length; hash["is_photo"] = (Array.IndexOf(fileTypes.Split(','), file.Extension.Substring(1).ToLower()) >= 0); hash["filetype"] = file.Extension.Substring(1); hash["filename"] = file.Name; hash["datetime"] = file.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss"); dirFileList.Add(hash); } context.Response.AddHeader("Content-Type", "application/json; charset=UTF-8"); context.Response.Write(JsonMapper.ToJson(result)); context.Response.End(); } public class NameSorter : IComparer { public int Compare(object x, object y) { if (x == null && y == null) { return 0; } if (x == null) { return -1; } if (y == null) { return 1; } FileInfo xInfo = new FileInfo(x.ToString()); FileInfo yInfo = new FileInfo(y.ToString()); return xInfo.FullName.CompareTo(yInfo.FullName); } } public class SizeSorter : IComparer { public int Compare(object x, object y) { if (x == null && y == null) { return 0; } if (x == null) { return -1; } if (y == null) { return 1; } FileInfo xInfo = new FileInfo(x.ToString()); FileInfo yInfo = new FileInfo(y.ToString()); return xInfo.Length.CompareTo(yInfo.Length); } } public class TypeSorter : IComparer { public int Compare(object x, object y) { if (x == null && y == null) { return 0; } if (x == null) { return -1; } if (y == null) { return 1; } FileInfo xInfo = new FileInfo(x.ToString()); FileInfo yInfo = new FileInfo(y.ToString()); return xInfo.Extension.CompareTo(yInfo.Extension); } } public bool IsReusable { get { return true; } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/ashx/file_manager_json.ashx
ASP.NET
oos
9,522
<%@ webhandler Language="C#" class="Upload" %> /** * KindEditor ASP.NET * * 本ASP.NET程序是演示程序,建议不要直接在实际项目中使用。 * 如果您确定直接使用本程序,使用之前请仔细确认相关安全设置。 * */ using System; using System.Collections; using System.Web; using System.IO; using System.Globalization; using LitJson; public class Upload : IHttpHandler { private HttpContext context; public void ProcessRequest(HttpContext context) { String aspxUrl = context.Request.Path.Substring(0, context.Request.Path.LastIndexOf("/") + 1); //文件保存目录路径 String savePath = TREC.Entity.EnFilePath.tmpRootPath; //文件保存目录URL String saveUrl = TREC.Entity.EnFilePath.tmpRootPath; //定义允许上传的文件扩展名 Hashtable extTable = new Hashtable(); extTable.Add("image", "gif,jpg,jpeg,png,bmp"); extTable.Add("flash", "swf,flv"); extTable.Add("media", "swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb"); extTable.Add("file", "doc,docx,xls,xlsx,ppt,htm,html,txt,zip,rar,gz,bz2"); //最大文件大小 int maxSize = 1000000; this.context = context; HttpPostedFile imgFile = context.Request.Files["imgFile"]; if (imgFile == null) { showError("请选择文件。"); } String dirPath = context.Server.MapPath(savePath); if (!Directory.Exists(dirPath)) { showError("上传目录不存在。"); } //按类型存放 String dirName = context.Request.QueryString["dir"]; //if (String.IsNullOrEmpty(dirName)) { // dirName = "image"; //} //if (!extTable.ContainsKey(dirName)) { // showError("目录名不正确。"); //} String fileName = imgFile.FileName; String fileExt = Path.GetExtension(fileName).ToLower(); if (imgFile.InputStream == null || imgFile.InputStream.Length > maxSize) { showError("上传文件大小超过限制。"); } if (String.IsNullOrEmpty(fileExt) || Array.IndexOf(((String)extTable[dirName]).Split(','), fileExt.Substring(1).ToLower()) == -1) { showError("上传文件扩展名是不允许的扩展名。\n只允许" + ((String)extTable[dirName]) + "格式。"); } //创建文件夹 //dirPath += dirName + "/"; //saveUrl += dirName + "/"; if (!Directory.Exists(dirPath)) { Directory.CreateDirectory(dirPath); } //按日期存放 //String ymd = DateTime.Now.ToString("yyyyMMdd", DateTimeFormatInfo.InvariantInfo); //dirPath += ymd + "/"; //saveUrl += ymd + "/"; //if (!Directory.Exists(dirPath)) { // Directory.CreateDirectory(dirPath); //} String newFileName = DateTime.Now.ToString("yyyyMMddHHmmssffff", DateTimeFormatInfo.InvariantInfo) + fileExt; String filePath = dirPath + newFileName; imgFile.SaveAs(filePath); String fileUrl = saveUrl + newFileName; Hashtable hash = new Hashtable(); hash["error"] = 0; hash["url"] = fileUrl; context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8"); context.Response.Write(JsonMapper.ToJson(hash)); context.Response.End(); } private void showError(string message) { Hashtable hash = new Hashtable(); hash["error"] = 1; hash["message"] = message; context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8"); context.Response.Write(JsonMapper.ToJson(hash)); context.Response.End(); } public bool IsReusable { get { return true; } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/ashx/upload_json.ashx
ASP.NET
oos
3,641
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php *******************************************************************************/ KindEditor.lang({ source : 'Source', preview : 'Preview', undo : 'Undo(Ctrl+Z)', redo : 'Redo(Ctrl+Y)', cut : 'Cut(Ctrl+X)', copy : 'Copy(Ctrl+C)', paste : 'Paste(Ctrl+V)', plainpaste : 'Paste as plain text', wordpaste : 'Paste from Word', selectall : 'Select all', justifyleft : 'Align left', justifycenter : 'Align center', justifyright : 'Align right', justifyfull : 'Align full', insertorderedlist : 'Ordered list', insertunorderedlist : 'Unordered list', indent : 'Increase indent', outdent : 'Decrease indent', subscript : 'Subscript', superscript : 'Superscript', formatblock : 'Paragraph format', fontname : 'Font family', fontsize : 'Font size', forecolor : 'Text color', hilitecolor : 'Highlight color', bold : 'Bold(Ctrl+B)', italic : 'Italic(Ctrl+I)', underline : 'Underline(Ctrl+U)', strikethrough : 'Strikethrough', removeformat : 'Remove format', image : 'Image', flash : 'Flash', media : 'Embeded media', table : 'Table', tablecell : 'Cell', hr : 'Insert horizontal line', emoticons : 'Insert emoticon', link : 'Link', unlink : 'Unlink', fullscreen : 'Toggle fullscreen mode(Esc)', about : 'About', print : 'Print', filemanager : 'File Manager', code : 'Insert code', map : 'Google Maps', lineheight : 'Line height', clearhtml : 'Clear HTML code', pagebreak : 'Insert Page Break', quickformat : 'Quick Format', insertfile : 'Insert file', template : 'Insert Template', anchor : 'Anchor', yes : 'OK', no : 'Cancel', close : 'Close', editImage : 'Image properties', deleteImage : 'Delete image', editFlash : 'Flash properties', deleteFlash : 'Delete flash', editMedia : 'Media properties', deleteMedia : 'Delete media', editLink : 'Link properties', deleteLink : 'Unlink', tableprop : 'Table properties', tablecellprop : 'Cell properties', tableinsert : 'Insert table', tabledelete : 'Delete table', tablecolinsertleft : 'Insert column left', tablecolinsertright : 'Insert column right', tablerowinsertabove : 'Insert row above', tablerowinsertbelow : 'Insert row below', tablerowmerge : 'Merge down', tablecolmerge : 'Merge right', tablerowsplit : 'Split row', tablecolsplit : 'Split column', tablecoldelete : 'Delete column', tablerowdelete : 'Delete row', noColor : 'Default', invalidImg : "Please type valid URL.\nAllowed file extension: jpg,gif,bmp,png", invalidMedia : "Please type valid URL.\nAllowed file extension: swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb", invalidWidth : "The width must be number.", invalidHeight : "The height must be number.", invalidBorder : "The border must be number.", invalidUrl : "Please type valid URL.", invalidRows : 'Invalid rows.', invalidCols : 'Invalid columns.', invalidPadding : 'The padding must be number.', invalidSpacing : 'The spacing must be number.', invalidJson : 'Invalid JSON string.', uploadSuccess : 'Upload success.', cutError : 'Currently not supported by your browser, use keyboard shortcut(Ctrl+X) instead.', copyError : 'Currently not supported by your browser, use keyboard shortcut(Ctrl+C) instead.', pasteError : 'Currently not supported by your browser, use keyboard shortcut(Ctrl+V) instead.', ajaxLoading : 'Loading ...', uploadLoading : 'Uploading ...', uploadError : 'Upload Error', 'plainpaste.comment' : 'Use keyboard shortcut(Ctrl+V) to paste the text into the window.', 'wordpaste.comment' : 'Use keyboard shortcut(Ctrl+V) to paste the text into the window.', 'link.url' : 'URL', 'link.linkType' : 'Target', 'link.newWindow' : 'New window', 'link.selfWindow' : 'Same window', 'flash.url' : 'URL', 'flash.width' : 'Width', 'flash.height' : 'Height', 'flash.upload' : 'Upload', 'flash.viewServer' : 'Browse', 'media.url' : 'URL', 'media.width' : 'Width', 'media.height' : 'Height', 'media.autostart' : 'Auto start', 'media.upload' : 'Upload', 'media.viewServer' : 'Browse', 'image.remoteImage' : 'Insert URL', 'image.localImage' : 'Upload', 'image.remoteUrl' : 'URL', 'image.localUrl' : 'File', 'image.size' : 'Size', 'image.width' : 'Width', 'image.height' : 'Height', 'image.resetSize' : 'Reset dimensions', 'image.align' : 'Align', 'image.defaultAlign' : 'Default', 'image.leftAlign' : 'Left', 'image.rightAlign' : 'Right', 'image.imgTitle' : 'Title', 'image.viewServer' : 'Browse', 'filemanager.emptyFolder' : 'Blank', 'filemanager.moveup' : 'Parent folder', 'filemanager.viewType' : 'Display: ', 'filemanager.viewImage' : 'Thumbnails', 'filemanager.listImage' : 'List', 'filemanager.orderType' : 'Sorting: ', 'filemanager.fileName' : 'By name', 'filemanager.fileSize' : 'By size', 'filemanager.fileType' : 'By type', 'insertfile.url' : 'URL', 'insertfile.title' : 'Title', 'insertfile.upload' : 'Upload', 'insertfile.viewServer' : 'Browse', 'table.cells' : 'Cells', 'table.rows' : 'Rows', 'table.cols' : 'Columns', 'table.size' : 'Dimensions', 'table.width' : 'Width', 'table.height' : 'Height', 'table.percent' : '%', 'table.px' : 'px', 'table.space' : 'Space', 'table.padding' : 'Padding', 'table.spacing' : 'Spacing', 'table.align' : 'Align', 'table.textAlign' : 'Horizontal', 'table.verticalAlign' : 'Vertical', 'table.alignDefault' : 'Default', 'table.alignLeft' : 'Left', 'table.alignCenter' : 'Center', 'table.alignRight' : 'Right', 'table.alignTop' : 'Top', 'table.alignMiddle' : 'Middle', 'table.alignBottom' : 'Bottom', 'table.alignBaseline' : 'Baseline', 'table.border' : 'Border', 'table.borderWidth' : 'Width', 'table.borderColor' : 'Color', 'table.backgroundColor' : 'Background', 'map.address' : 'Address: ', 'map.search' : 'Search', 'anchor.name' : 'Anchor name', 'formatblock.formatBlock' : { h1 : 'Heading 1', h2 : 'Heading 2', h3 : 'Heading 3', h4 : 'Heading 4', p : 'Normal' }, 'fontname.fontName' : { 'Arial' : 'Arial', 'Arial Black' : 'Arial Black', 'Comic Sans MS' : 'Comic Sans MS', 'Courier New' : 'Courier New', 'Garamond' : 'Garamond', 'Georgia' : 'Georgia', 'Tahoma' : 'Tahoma', 'Times New Roman' : 'Times New Roman', 'Trebuchet MS' : 'Trebuchet MS', 'Verdana' : 'Verdana' }, 'lineheight.lineHeight' : [ {'1' : 'Line height 1'}, {'1.5' : 'Line height 1.5'}, {'2' : 'Line height 2'}, {'2.5' : 'Line height 2.5'}, {'3' : 'Line height 3'} ], 'template.selectTemplate' : 'Template', 'template.replaceContent' : 'Replace current content', 'template.fileList' : { '1.html' : 'Image and Text', '2.html' : 'Table', '3.html' : 'List' } }, 'en');
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/lang/en.js
JavaScript
oos
7,072
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php *******************************************************************************/ KindEditor.lang({ source : '原始碼', preview : '預覽', undo : '復原(Ctrl+Z)', redo : '重複(Ctrl+Y)', cut : '剪下(Ctrl+X)', copy : '複製(Ctrl+C)', paste : '貼上(Ctrl+V)', plainpaste : '貼為純文字格式', wordpaste : '自Word貼上', selectall : '全選(Ctrl+A)', justifyleft : '靠左對齊', justifycenter : '置中', justifyright : '靠右對齊', justifyfull : '左右對齊', insertorderedlist : '編號清單', insertunorderedlist : '項目清單', indent : '增加縮排', outdent : '減少縮排', subscript : '下標', superscript : '上標', formatblock : '標題', fontname : '字體', fontsize : '文字大小', forecolor : '文字顏色', hilitecolor : '背景顏色', bold : '粗體(Ctrl+B)', italic : '斜體(Ctrl+I)', underline : '底線(Ctrl+U)', strikethrough : '刪除線', removeformat : '清除格式', image : '影像', flash : 'Flash', media : '多媒體', table : '表格', hr : '插入水平線', emoticons : '插入表情', link : '超連結', unlink : '移除超連結', fullscreen : '最大化', about : '關於', print : '列印(Ctrl+P)', fileManager : '瀏覽伺服器', code : '插入程式代碼', map : 'Google地圖', lineheight : '行距', clearhtml : '清理HTML代碼', pagebreak : '插入分頁符號', quickformat : '快速排版', insertfile : '插入文件', template : '插入樣板', anchor : '錨點', yes : '確定', no : '取消', close : '關閉', editImage : '影像屬性', deleteImage : '刪除影像', editFlash : 'Flash屬性', deleteFlash : '删除Flash', editMedia : '多媒體屬性', deleteMedia : '删除多媒體', editLink : '超連結屬性', deleteLink : '移除超連結', tableprop : '表格屬性', tablecellprop : '儲存格屬性', tableinsert : '插入表格', tabledelete : '刪除表格', tablecolinsertleft : '向左插入列', tablecolinsertright : '向右插入列', tablerowinsertabove : '向上插入欄', tablerowinsertbelow : '下方插入欄', tablerowmerge : '向下合併單元格', tablecolmerge : '向右合併單元格', tablerowsplit : '分割欄', tablecolsplit : '分割列', tablecoldelete : '删除列', tablerowdelete : '删除欄', noColor : '自動', invalidImg : "請輸入有效的URL。\n只允許jpg,gif,bmp,png格式。", invalidMedia : "請輸入有效的URL。\n只允許swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb格式。", invalidWidth : "寬度必須是數字。", invalidHeight : "高度必須是數字。", invalidBorder : "邊框必須是數字。", invalidUrl : "請輸入有效的URL。", invalidRows : '欄數是必須輸入項目,只允許輸入大於0的數字。', invalidCols : '列數是必須輸入項目,只允許輸入大於0的數字。', invalidPadding : '內距必須是數字。', invalidSpacing : '間距必須是數字。', invalidBorder : '边框必须为数字。', pleaseInput : "請輸入內容。", invalidJson : '伺服器發生故障。', cutError : '您的瀏覽器安全設置不允許使用剪下操作,請使用快捷鍵(Ctrl+X)完成。', copyError : '您的瀏覽器安全設置不允許使用剪下操作,請使用快捷鍵(Ctrl+C)完成。', pasteError : '您的瀏覽器安全設置不允許使用剪下操作,請使用快捷鍵(Ctrl+V)完成。', ajaxLoading : '加載中,請稍候 ...', uploadLoading : '上傳中,請稍候 ...', uploadError : '上傳錯誤', 'plainpaste.comment' : '請使用快捷鍵(Ctrl+V)把內容貼到下方區域裡。', 'wordpaste.comment' : '請使用快捷鍵(Ctrl+V)把內容貼到下方區域裡。', 'link.url' : 'URL', 'link.linkType' : '打開類型', 'link.newWindow' : '新窗口', 'link.selfWindow' : '本頁窗口', 'flash.url' : 'URL', 'flash.width' : '寬度', 'flash.height' : '高度', 'flash.upload' : '上傳', 'flash.viewServer' : '瀏覽', 'media.url' : 'URL', 'media.width' : '寬度', 'media.height' : '高度', 'media.autostart' : '自動播放', 'media.upload' : '上傳', 'media.viewServer' : '瀏覽', 'image.remoteImage' : '影像URL', 'image.localImage' : '上傳影像', 'image.remoteUrl' : '影像URL', 'image.localUrl' : '影像URL', 'image.size' : '影像大小', 'image.width' : '寬度', 'image.height' : '高度', 'image.resetSize' : '原始大小', 'image.align' : '對齊方式', 'image.defaultAlign' : '未設定', 'image.leftAlign' : '向左對齊', 'image.rightAlign' : '向右對齊', 'image.imgTitle' : '影像說明', 'image.viewServer' : '瀏覽...', 'filemanager.emptyFolder' : '空文件夾', 'filemanager.moveup' : '至上一級文件夾', 'filemanager.viewType' : '顯示方式:', 'filemanager.viewImage' : '縮略圖', 'filemanager.listImage' : '詳細信息', 'filemanager.orderType' : '排序方式:', 'filemanager.fileName' : '名稱', 'filemanager.fileSize' : '大小', 'filemanager.fileType' : '類型', 'insertfile.url' : 'URL', 'insertfile.title' : '文件說明', 'insertfile.upload' : '上傳', 'insertfile.viewServer' : '瀏覽', 'table.cells' : '儲存格數', 'table.rows' : '欄數', 'table.cols' : '列數', 'table.size' : '表格大小', 'table.width' : '寬度', 'table.height' : '高度', 'table.percent' : '%', 'table.px' : 'px', 'table.space' : '內距間距', 'table.padding' : '內距', 'table.spacing' : '間距', 'table.align' : '對齊方式', 'table.textAlign' : '水平對齊', 'table.verticalAlign' : '垂直對齊', 'table.alignDefault' : '未設定', 'table.alignLeft' : '向左對齊', 'table.alignCenter' : '置中', 'table.alignRight' : '向右對齊', 'table.alignTop' : '靠上', 'table.alignMiddle' : '置中', 'table.alignBottom' : '靠下', 'table.alignBaseline' : '基線', 'table.border' : '表格邊框', 'table.borderWidth' : '邊框', 'table.borderColor' : '顏色', 'table.backgroundColor' : '背景顏色', 'map.address' : '住所: ', 'map.search' : '尋找', 'anchor.name' : '錨點名稱', 'formatblock.formatBlock' : { h1 : '標題 1', h2 : '標題 2', h3 : '標題 3', h4 : '標題 4', p : '一般' }, 'fontname.fontName' : { 'MingLiU' : '細明體', 'PMingLiU' : '新細明體', 'DFKai-SB' : '標楷體', 'SimSun' : '宋體', 'NSimSun' : '新宋體', 'FangSong' : '仿宋體', 'Arial' : 'Arial', 'Arial Black' : 'Arial Black', 'Times New Roman' : 'Times New Roman', 'Courier New' : 'Courier New', 'Tahoma' : 'Tahoma', 'Verdana' : 'Verdana' }, 'lineheight.lineHeight' : [ {'1' : '单倍行距'}, {'1.5' : '1.5倍行距'}, {'2' : '2倍行距'}, {'2.5' : '2.5倍行距'}, {'3' : '3倍行距'} ], 'template.selectTemplate' : '可選樣板', 'template.replaceContent' : '取代當前內容', 'template.fileList' : { '1.html' : '影像和文字', '2.html' : '表格', '3.html' : '项目清單' } }, 'zh_TW');
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/lang/zh_TW.js
JavaScript
oos
7,420
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php *******************************************************************************/ KindEditor.lang({ source : 'HTML代码', preview : '预览', undo : '后退(Ctrl+Z)', redo : '前进(Ctrl+Y)', cut : '剪切(Ctrl+X)', copy : '复制(Ctrl+C)', paste : '粘贴(Ctrl+V)', plainpaste : '粘贴为无格式文本', wordpaste : '从Word粘贴', selectall : '全选(Ctrl+A)', justifyleft : '左对齐', justifycenter : '居中', justifyright : '右对齐', justifyfull : '两端对齐', insertorderedlist : '编号', insertunorderedlist : '项目符号', indent : '增加缩进', outdent : '减少缩进', subscript : '下标', superscript : '上标', formatblock : '段落', fontname : '字体', fontsize : '文字大小', forecolor : '文字颜色', hilitecolor : '文字背景', bold : '粗体(Ctrl+B)', italic : '斜体(Ctrl+I)', underline : '下划线(Ctrl+U)', strikethrough : '删除线', removeformat : '删除格式', image : '图片', flash : 'Flash', media : '视音频', table : '表格', tablecell : '单元格', hr : '插入横线', emoticons : '插入表情', link : '超级链接', unlink : '取消超级链接', fullscreen : '全屏显示(Esc)', about : '关于', print : '打印(Ctrl+P)', filemanager : '浏览服务器', code : '插入程序代码', map : 'Google地图', lineheight : '行距', clearhtml : '清理HTML代码', pagebreak : '插入分页符', quickformat : '一键排版', insertfile : '插入文件', template : '插入模板', anchor : '锚点', yes : '确定', no : '取消', close : '关闭', editImage : '图片属性', deleteImage : '删除图片', editFlash : 'Flash属性', deleteFlash : '删除Flash', editMedia : '视音频属性', deleteMedia : '删除视音频', editLink : '超级链接属性', deleteLink : '取消超级链接', editAnchor : '锚点属性', deleteAnchor : '删除锚点', tableprop : '表格属性', tablecellprop : '单元格属性', tableinsert : '插入表格', tabledelete : '删除表格', tablecolinsertleft : '左侧插入列', tablecolinsertright : '右侧插入列', tablerowinsertabove : '上方插入行', tablerowinsertbelow : '下方插入行', tablerowmerge : '向下合并单元格', tablecolmerge : '向右合并单元格', tablerowsplit : '拆分行', tablecolsplit : '拆分列', tablecoldelete : '删除列', tablerowdelete : '删除行', noColor : '无颜色', invalidImg : "请输入有效的URL地址。\n只允许jpg,gif,bmp,png格式。", invalidMedia : "请输入有效的URL地址。\n只允许swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb格式。", invalidWidth : "宽度必须为数字。", invalidHeight : "高度必须为数字。", invalidBorder : "边框必须为数字。", invalidUrl : "请输入有效的URL地址。", invalidRows : '行数为必选项,只允许输入大于0的数字。', invalidCols : '列数为必选项,只允许输入大于0的数字。', invalidPadding : '边距必须为数字。', invalidSpacing : '间距必须为数字。', invalidJson : '服务器发生故障。', uploadSuccess : '上传成功。', cutError : '您的浏览器安全设置不允许使用剪切操作,请使用快捷键(Ctrl+X)来完成。', copyError : '您的浏览器安全设置不允许使用复制操作,请使用快捷键(Ctrl+C)来完成。', pasteError : '您的浏览器安全设置不允许使用粘贴操作,请使用快捷键(Ctrl+V)来完成。', ajaxLoading : '加载中,请稍候 ...', uploadLoading : '上传中,请稍候 ...', uploadError : '上传错误', 'plainpaste.comment' : '请使用快捷键(Ctrl+V)把内容粘贴到下面的方框里。', 'wordpaste.comment' : '请使用快捷键(Ctrl+V)把内容粘贴到下面的方框里。', 'link.url' : 'URL', 'link.linkType' : '打开类型', 'link.newWindow' : '新窗口', 'link.selfWindow' : '当前窗口', 'flash.url' : 'URL', 'flash.width' : '宽度', 'flash.height' : '高度', 'flash.upload' : '上传', 'flash.viewServer' : '浏览', 'media.url' : 'URL', 'media.width' : '宽度', 'media.height' : '高度', 'media.autostart' : '自动播放', 'media.upload' : '上传', 'media.viewServer' : '浏览', 'image.remoteImage' : '远程图片', 'image.localImage' : '本地上传', 'image.remoteUrl' : '图片地址', 'image.localUrl' : '图片地址', 'image.size' : '图片大小', 'image.width' : '宽', 'image.height' : '高', 'image.resetSize' : '重置大小', 'image.align' : '对齐方式', 'image.defaultAlign' : '默认方式', 'image.leftAlign' : '左对齐', 'image.rightAlign' : '右对齐', 'image.imgTitle' : '图片说明', 'image.viewServer' : '浏览...', 'filemanager.emptyFolder' : '空文件夹', 'filemanager.moveup' : '移到上一级文件夹', 'filemanager.viewType' : '显示方式:', 'filemanager.viewImage' : '缩略图', 'filemanager.listImage' : '详细信息', 'filemanager.orderType' : '排序方式:', 'filemanager.fileName' : '名称', 'filemanager.fileSize' : '大小', 'filemanager.fileType' : '类型', 'insertfile.url' : 'URL', 'insertfile.title' : '文件说明', 'insertfile.upload' : '上传', 'insertfile.viewServer' : '浏览', 'table.cells' : '单元格数', 'table.rows' : '行数', 'table.cols' : '列数', 'table.size' : '大小', 'table.width' : '宽度', 'table.height' : '高度', 'table.percent' : '%', 'table.px' : 'px', 'table.space' : '边距间距', 'table.padding' : '边距', 'table.spacing' : '间距', 'table.align' : '对齐方式', 'table.textAlign' : '水平对齐', 'table.verticalAlign' : '垂直对齐', 'table.alignDefault' : '默认', 'table.alignLeft' : '左对齐', 'table.alignCenter' : '居中', 'table.alignRight' : '右对齐', 'table.alignTop' : '顶部', 'table.alignMiddle' : '中部', 'table.alignBottom' : '底部', 'table.alignBaseline' : '基线', 'table.border' : '边框', 'table.borderWidth' : '边框', 'table.borderColor' : '颜色', 'table.backgroundColor' : '背景颜色', 'map.address' : '地址: ', 'map.search' : '搜索', 'anchor.name' : '锚点名称', 'formatblock.formatBlock' : { h1 : '标题 1', h2 : '标题 2', h3 : '标题 3', h4 : '标题 4', p : '正 文' }, 'fontname.fontName' : { 'SimSun' : '宋体', 'NSimSun' : '新宋体', 'FangSong_GB2312' : '仿宋_GB2312', 'KaiTi_GB2312' : '楷体_GB2312', 'SimHei' : '黑体', 'Microsoft YaHei' : '微软雅黑', 'Arial' : 'Arial', 'Arial Black' : 'Arial Black', 'Times New Roman' : 'Times New Roman', 'Courier New' : 'Courier New', 'Tahoma' : 'Tahoma', 'Verdana' : 'Verdana' }, 'lineheight.lineHeight' : [ {'1' : '单倍行距'}, {'1.5' : '1.5倍行距'}, {'2' : '2倍行距'}, {'2.5' : '2.5倍行距'}, {'3' : '3倍行距'} ], 'template.selectTemplate' : '可选模板', 'template.replaceContent' : '替换当前内容', 'template.fileList' : { '1.html' : '图片和文字', '2.html' : '表格', '3.html' : '项目编号' } }, 'zh_CN');
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/lang/zh_CN.js
JavaScript
oos
7,502
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php * Arabic Translation By daif alotaibi (http://daif.net/) *******************************************************************************/ KindEditor.lang({ source : 'عرض المصدر', preview : 'معاينة الصفحة', undo : 'تراجع(Ctrl+Z)', redo : 'إعادة التراجع(Ctrl+Y)', cut : 'قص(Ctrl+X)', copy : 'نسخ(Ctrl+C)', paste : 'لصق(Ctrl+V)', plainpaste : 'لصق كنص عادي', wordpaste : 'لصق من مايكروسفت ورد', selectall : 'تحديد الكل', justifyleft : 'محاذاه لليسار', justifycenter : 'محاذاه للوسط', justifyright : 'محاذاه لليمين', justifyfull : 'محاذاه تلقائية', insertorderedlist : 'قائمة مرقمه', insertunorderedlist : 'قائمة نقطية', indent : 'إزاحه النص', outdent : 'إلغاء الازاحة', subscript : 'أسفل النص', superscript : 'أعلى النص', formatblock : 'Paragraph format', fontname : 'نوع الخط', fontsize : 'حجم الخط', forecolor : 'لون النص', hilitecolor : 'لون خلفية النص', bold : 'عريض(Ctrl+B)', italic : 'مائل(Ctrl+I)', underline : 'خط تحت النص(Ctrl+U)', strikethrough : 'خط على النص', removeformat : 'إزالة التنسيق', image : 'إدراج صورة', flash : 'إدراج فلاش', media : 'إدراج وسائط متعددة', table : 'إدراج جدول', tablecell : 'خلية', hr : 'إدراج خط أفقي', emoticons : 'إدراج وجه ضاحك', link : 'رابط', unlink : 'إزالة الرابط', fullscreen : 'محرر ملئ الشاشة(Esc)', about : 'حول', print : 'طباعة', filemanager : 'مدير الملفات', code : 'إدراج نص برمجي', map : 'خرائط قووقل', lineheight : 'إرتفاع السطر', clearhtml : 'مسح كود HTML', pagebreak : 'إدراج فاصل صفحات', quickformat : 'تنسيق سريع', insertfile : 'إدراج ملف', template : 'إدراج قالب', anchor : 'رابط', yes : 'موافق', no : 'إلغاء', close : 'إغلاق', editImage : 'خصائص الصورة', deleteImage : 'حذفالصورة', editFlash : 'خصائص الفلاش', deleteFlash : 'حذف الفلاش', editMedia : 'خصائص الوسائط', deleteMedia : 'حذف الوسائط', editLink : 'خصائص الرابط', deleteLink : 'إزالة الرابط', tableprop : 'خصائص الجدول', tablecellprop : 'خصائص الخلية', tableinsert : 'إدراج جدول', tabledelete : 'حذف جدول', tablecolinsertleft : 'إدراج عمود لليسار', tablecolinsertright : 'إدراج عمود لليسار', tablerowinsertabove : 'إدراج صف للأعلى', tablerowinsertbelow : 'إدراج صف للأسفل', tablerowmerge : 'دمج للأسفل', tablecolmerge : 'دمج لليمين', tablerowsplit : 'تقسم الصف', tablecolsplit : 'تقسيم العمود', tablecoldelete : 'حذف العمود', tablerowdelete : 'حذف الصف', noColor : 'إفتراضي', invalidImg : "الرجاء إدخال رابط صحيح.\nالملفات المسموح بها: jpg,gif,bmp,png", invalidMedia : "الرجاء إدخال رابط صحيح.\nالملفات المسموح بها: swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb", invalidWidth : "العرض يجب أن يكون رقم.", invalidHeight : "الإرتفاع يجب أن يكون رقم.", invalidBorder : "عرض الحد يجب أن يكون رقم.", invalidUrl : "الرجاء إدخال رابط حيح.", invalidRows : 'صفوف غير صحيح.', invalidCols : 'أعمدة غير صحيحة.', invalidPadding : 'The padding must be number.', invalidSpacing : 'The spacing must be number.', invalidJson : 'Invalid JSON string.', uploadSuccess : 'تم رفع الملف بنجاح.', cutError : 'حاليا غير مدعومة من المتصفح, إستخدم إختصار لوحة المفاتيح (Ctrl+X).', copyError : 'حاليا غير مدعومة من المتصفح, إستخدم إختصار لوحة المفاتيح (Ctrl+C).', pasteError : 'حاليا غير مدعومة من المتصفح, إستخدم إختصار لوحة المفاتيح (Ctrl+V).', ajaxLoading : 'Loading ...', uploadLoading : 'Uploading ...', uploadError : 'Upload Error', 'plainpaste.comment' : 'إستخدم إختصار لوحة المفاتيح (Ctrl+V) للصق داخل النافذة.', 'wordpaste.comment' : 'إستخدم إختصار لوحة المفاتيح (Ctrl+V) للصق داخل النافذة.', 'link.url' : 'الرابط', 'link.linkType' : 'الهدف', 'link.newWindow' : 'نافذة جديدة', 'link.selfWindow' : 'نفس النافذة', 'flash.url' : 'الرابط', 'flash.width' : 'العرض', 'flash.height' : 'الإرتفاع', 'flash.upload' : 'رفع', 'flash.viewServer' : 'أستعراض', 'media.url' : 'الرابط', 'media.width' : 'العرض', 'media.height' : 'الإرتفاع', 'media.autostart' : 'تشغيل تلقائي', 'media.upload' : 'رفع', 'media.viewServer' : 'أستعراض', 'image.remoteImage' : 'إدراج الرابط', 'image.localImage' : 'رفع', 'image.remoteUrl' : 'الرابط', 'image.localUrl' : 'الملف', 'image.size' : 'الحجم', 'image.width' : 'العرض', 'image.height' : 'الإرتفاع', 'image.resetSize' : 'إستعادة الأبعاد', 'image.align' : 'محاذاة', 'image.defaultAlign' : 'الإفتراضي', 'image.leftAlign' : 'اليسار', 'image.rightAlign' : 'اليمين', 'image.imgTitle' : 'العنوان', 'image.viewServer' : 'أستعراض', 'filemanager.emptyFolder' : 'فارغ', 'filemanager.moveup' : 'المجلد الأب', 'filemanager.viewType' : 'العرض: ', 'filemanager.viewImage' : 'مصغرات', 'filemanager.listImage' : 'قائمة', 'filemanager.orderType' : 'الترتيب: ', 'filemanager.fileName' : 'بالإسم', 'filemanager.fileSize' : 'بالحجم', 'filemanager.fileType' : 'بالنوع', 'insertfile.url' : 'الرابط', 'insertfile.title' : 'العنوان', 'insertfile.upload' : 'رفع', 'insertfile.viewServer' : 'أستعراض', 'table.cells' : 'خلايا', 'table.rows' : 'صفوف', 'table.cols' : 'أعمدة', 'table.size' : 'الأبعاد', 'table.width' : 'العرض', 'table.height' : 'الإرتفاع', 'table.percent' : '%', 'table.px' : 'px', 'table.space' : 'الخارج', 'table.padding' : 'الداخل', 'table.spacing' : 'الفراغات', 'table.align' : 'محاذاه', 'table.textAlign' : 'افقى', 'table.verticalAlign' : 'رأسي', 'table.alignDefault' : 'إفتراضي', 'table.alignLeft' : 'يسار', 'table.alignCenter' : 'وسط', 'table.alignRight' : 'يمين', 'table.alignTop' : 'أعلى', 'table.alignMiddle' : 'منتصف', 'table.alignBottom' : 'أسفل', 'table.alignBaseline' : 'Baseline', 'table.border' : 'الحدود', 'table.borderWidth' : 'العرض', 'table.borderColor' : 'اللون', 'table.backgroundColor' : 'الخلفية', 'map.address' : 'العنوان: ', 'map.search' : 'بحث', 'anchor.name' : 'إسم الرابط', 'formatblock.formatBlock' : { h1 : 'عنوان 1', h2 : 'عنوان 2', h3 : 'عنوان 3', h4 : 'عنوان 4', p : 'عادي' }, 'fontname.fontName' : { 'Arial' : 'Arial', 'Arial Black' : 'Arial Black', 'Comic Sans MS' : 'Comic Sans MS', 'Courier New' : 'Courier New', 'Garamond' : 'Garamond', 'Georgia' : 'Georgia', 'Tahoma' : 'Tahoma', 'Times New Roman' : 'Times New Roman', 'Trebuchet MS' : 'Trebuchet MS', 'Verdana' : 'Verdana' }, 'lineheight.lineHeight' : [ {'1' : 'إرتفاع السطر 1'}, {'1.5' : 'إرتفاع السطر 1.5'}, {'2' : 'إرتفاع السطر 2'}, {'2.5' : 'إرتفاع السطر 2.5'}, {'3' : 'إرتفاع السطر 3'} ], 'template.selectTemplate' : 'قالب', 'template.replaceContent' : 'إستبدال المحتوى الحالي', 'template.fileList' : { '1.html' : 'صورة ونص', '2.html' : 'جدول', '3.html' : 'قائمة' } }, 'ar');
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/lang/ar.js
JavaScript
oos
8,658
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2012 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @website http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php * @version 4.0.5 (2012-01-15) *******************************************************************************/ (function (window, undefined) { if (window.KindEditor) { return; } if (!window.console) { window.console = {}; } if (!console.log) { console.log = function () {}; } var _VERSION = '4.0.5 (2012-01-15)', _ua = navigator.userAgent.toLowerCase(), _IE = _ua.indexOf('msie') > -1 && _ua.indexOf('opera') == -1, _GECKO = _ua.indexOf('gecko') > -1 && _ua.indexOf('khtml') == -1, _WEBKIT = _ua.indexOf('applewebkit') > -1, _OPERA = _ua.indexOf('opera') > -1, _MOBILE = _ua.indexOf('mobile') > -1, _IOS = /ipad|iphone|ipod/.test(_ua), _QUIRKS = document.compatMode != 'CSS1Compat', _matches = /(?:msie|firefox|webkit|opera)[\/:\s](\d+)/.exec(_ua), _V = _matches ? _matches[1] : '0', _TIME = new Date().getTime(); function _isArray(val) { if (!val) { return false; } return Object.prototype.toString.call(val) === '[object Array]'; } function _isFunction(val) { if (!val) { return false; } return Object.prototype.toString.call(val) === '[object Function]'; } function _inArray(val, arr) { for (var i = 0, len = arr.length; i < len; i++) { if (val === arr[i]) { return i; } } return -1; } function _each(obj, fn) { if (_isArray(obj)) { for (var i = 0, len = obj.length; i < len; i++) { if (fn.call(obj[i], i, obj[i]) === false) { break; } } } else { for (var key in obj) { if (obj.hasOwnProperty(key)) { if (fn.call(obj[key], key, obj[key]) === false) { break; } } } } } function _trim(str) { return str.replace(/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g, ''); } function _inString(val, str, delimiter) { delimiter = delimiter === undefined ? ',' : delimiter; return (delimiter + str + delimiter).indexOf(delimiter + val + delimiter) >= 0; } function _addUnit(val, unit) { unit = unit || 'px'; return val && /^\d+$/.test(val) ? val + 'px' : val; } function _removeUnit(val) { var match; return val && (match = /(\d+)/.exec(val)) ? parseInt(match[1], 10) : 0; } function _escape(val) { return val.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;'); } function _unescape(val) { return val.replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"').replace(/&amp;/g, '&'); } function _toCamel(str) { var arr = str.split('-'); str = ''; _each(arr, function(key, val) { str += (key > 0) ? val.charAt(0).toUpperCase() + val.substr(1) : val; }); return str; } function _toHex(val) { function hex(d) { var s = parseInt(d, 10).toString(16).toUpperCase(); return s.length > 1 ? s : '0' + s; } return val.replace(/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/ig, function($0, $1, $2, $3) { return '#' + hex($1) + hex($2) + hex($3); } ); } function _toMap(val, delimiter) { delimiter = delimiter === undefined ? ',' : delimiter; var map = {}, arr = _isArray(val) ? val : val.split(delimiter), match; _each(arr, function(key, val) { if ((match = /^(\d+)\.\.(\d+)$/.exec(val))) { for (var i = parseInt(match[1], 10); i <= parseInt(match[2], 10); i++) { map[i.toString()] = true; } } else { map[val] = true; } }); return map; } function _toArray(obj, offset) { return Array.prototype.slice.call(obj, offset || 0); } function _undef(val, defaultVal) { return val === undefined ? defaultVal : val; } function _invalidUrl(url) { return !url || /[<>"]/.test(url); } function _addParam(url, param) { return url.indexOf('?') >= 0 ? url + '&' + param : url + '?' + param; } function _extend(child, parent, proto) { if (!proto) { proto = parent; parent = null; } var childProto; if (parent) { var fn = function () {}; fn.prototype = parent.prototype; childProto = new fn(); _each(proto, function(key, val) { childProto[key] = val; }); } else { childProto = proto; } childProto.constructor = child; child.prototype = childProto; child.parent = parent ? parent.prototype : null; } function _json(text) { var match; if ((match = /\{[\s\S]*\}|\[[\s\S]*\]/.exec(text))) { text = match[0]; } var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; cx.lastIndex = 0; if (cx.test(text)) { text = text.replace(cx, function (a) { return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); }); } if (/^[\],:{}\s]*$/. test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@'). replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']'). replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { return eval('(' + text + ')'); } throw 'JSON parse error'; } var _round = Math.round; var K = { DEBUG : false, VERSION : _VERSION, IE : _IE, GECKO : _GECKO, WEBKIT : _WEBKIT, OPERA : _OPERA, V : _V, TIME : _TIME, each : _each, isArray : _isArray, isFunction : _isFunction, inArray : _inArray, inString : _inString, trim : _trim, addUnit : _addUnit, removeUnit : _removeUnit, escape : _escape, unescape : _unescape, toCamel : _toCamel, toHex : _toHex, toMap : _toMap, toArray : _toArray, undef : _undef, invalidUrl : _invalidUrl, addParam : _addParam, extend : _extend, json : _json }; var _INLINE_TAG_MAP = _toMap('a,abbr,acronym,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,img,input,ins,kbd,label,map,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var'), _BLOCK_TAG_MAP = _toMap('address,applet,blockquote,body,center,dd,dir,div,dl,dt,fieldset,form,frameset,h1,h2,h3,h4,h5,h6,head,hr,html,iframe,ins,isindex,li,map,menu,meta,noframes,noscript,object,ol,p,pre,script,style,table,tbody,td,tfoot,th,thead,title,tr,ul'), _SINGLE_TAG_MAP = _toMap('area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed'), _STYLE_TAG_MAP = _toMap('b,basefont,big,del,em,font,i,s,small,span,strike,strong,sub,sup,u'), _CONTROL_TAG_MAP = _toMap('img,table,input,textarea,button'), _PRE_TAG_MAP = _toMap('pre,style,script'), _NOSPLIT_TAG_MAP = _toMap('html,head,body,td,tr,table,ol,ul,li'), _AUTOCLOSE_TAG_MAP = _toMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr'), _FILL_ATTR_MAP = _toMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected'), _VALUE_TAG_MAP = _toMap('input,button,textarea,select'); function _getBasePath() { var els = document.getElementsByTagName('script'), src; for (var i = 0, len = els.length; i < len; i++) { src = els[i].src || ''; if (/kindeditor[\w\-\.]*\.js/.test(src)) { return src.substring(0, src.lastIndexOf('/') + 1); } } return ''; } K.basePath = _getBasePath(); K.options = { designMode : true, fullscreenMode : false, filterMode : false, wellFormatMode : true, shadowMode : true, loadStyleMode : true, basePath : K.basePath, themesPath : K.basePath + 'themes/', langPath : K.basePath + 'lang/', pluginsPath : K.basePath + 'plugins/', themeType : 'default', langType : 'zh_CN', urlType : '', newlineTag : 'p', resizeType : 2, syncType : 'form', pasteType : 2, dialogAlignType : 'page', useContextmenu : true, bodyClass : 'ke-content', indentChar : '\t', cssPath : '', cssData : '', minWidth : 650, minHeight : 100, minChangeSize : 5, items : [ 'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'cut', 'copy', 'paste', 'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript', 'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/', 'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'map', 'code', 'pagebreak', 'anchor', 'link', 'unlink', '|', 'about' ], noDisableItems : ['source', 'fullscreen'], colorTable : [ ['#E53333', '#E56600', '#FF9900', '#64451D', '#DFC5A4', '#FFE500'], ['#009900', '#006600', '#99BB00', '#B8D100', '#60D978', '#00D5FF'], ['#337FE5', '#003399', '#4C33E5', '#9933E5', '#CC33E5', '#EE33EE'], ['#FFFFFF', '#CCCCCC', '#999999', '#666666', '#333333', '#000000'] ], fontSizeTable : ['9px', '10px', '12px', '14px', '16px', '18px', '24px', '32px'], htmlTags : { font : ['color', 'size', 'face', '.background-color'], span : [ '.color', '.background-color', '.font-size', '.font-family', '.background', '.font-weight', '.font-style', '.text-decoration', '.vertical-align', '.line-height' ], div : [ 'align', '.border', '.margin', '.padding', '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.font-weight', '.background', '.font-style', '.text-decoration', '.vertical-align', '.margin-left' ], table: [ 'border', 'cellspacing', 'cellpadding', 'width', 'height', 'align', 'bordercolor', '.padding', '.margin', '.border', 'bgcolor', '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.font-weight', '.font-style', '.text-decoration', '.background', '.width', '.height', '.border-collapse' ], 'td,th': [ 'align', 'valign', 'width', 'height', 'colspan', 'rowspan', 'bgcolor', '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.font-weight', '.font-style', '.text-decoration', '.vertical-align', '.background', '.border' ], a : ['href', 'target', 'name'], embed : ['src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess'], img : ['src', 'width', 'height', 'border', 'alt', 'title', 'align', '.width', '.height', '.border'], 'p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : [ 'align', '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.background', '.font-weight', '.font-style', '.text-decoration', '.vertical-align', '.text-indent', '.margin-left' ], pre : ['class'], hr : ['class', '.page-break-after'], 'br,tbody,tr,strong,b,sub,sup,em,i,u,strike,s,del' : [] }, layout : '<div class="container"><div class="toolbar"></div><div class="edit"></div><div class="statusbar"></div></div>' }; var _useCapture = false; var _INPUT_KEY_MAP = _toMap('8,9,13,32,46,48..57,59,61,65..90,106,109..111,188,190..192,219..222'); var _CURSORMOVE_KEY_MAP = _toMap('33..40'); var _CHANGE_KEY_MAP = {}; _each(_INPUT_KEY_MAP, function(key, val) { _CHANGE_KEY_MAP[key] = val; }); _each(_CURSORMOVE_KEY_MAP, function(key, val) { _CHANGE_KEY_MAP[key] = val; }); function _bindEvent(el, type, fn) { if (el.addEventListener){ el.addEventListener(type, fn, _useCapture); } else if (el.attachEvent){ el.attachEvent('on' + type, fn); } } function _unbindEvent(el, type, fn) { if (el.removeEventListener){ el.removeEventListener(type, fn, _useCapture); } else if (el.detachEvent){ el.detachEvent('on' + type, fn); } } var _EVENT_PROPS = ('altKey,attrChange,attrName,bubbles,button,cancelable,charCode,clientX,clientY,ctrlKey,currentTarget,' + 'data,detail,eventPhase,fromElement,handler,keyCode,metaKey,newValue,offsetX,offsetY,originalTarget,pageX,' + 'pageY,prevValue,relatedNode,relatedTarget,screenX,screenY,shiftKey,srcElement,target,toElement,view,wheelDelta,which').split(','); function KEvent(el, event) { this.init(el, event); } _extend(KEvent, { init : function(el, event) { var self = this, doc = el.ownerDocument || el.document || el; self.event = event; _each(_EVENT_PROPS, function(key, val) { self[val] = event[val]; }); if (!self.target) { self.target = self.srcElement || doc; } if (self.target.nodeType === 3) { self.target = self.target.parentNode; } if (!self.relatedTarget && self.fromElement) { self.relatedTarget = self.fromElement === self.target ? self.toElement : self.fromElement; } if (self.pageX == null && self.clientX != null) { var d = doc.documentElement, body = doc.body; self.pageX = self.clientX + (d && d.scrollLeft || body && body.scrollLeft || 0) - (d && d.clientLeft || body && body.clientLeft || 0); self.pageY = self.clientY + (d && d.scrollTop || body && body.scrollTop || 0) - (d && d.clientTop || body && body.clientTop || 0); } if (!self.which && ((self.charCode || self.charCode === 0) ? self.charCode : self.keyCode)) { self.which = self.charCode || self.keyCode; } if (!self.metaKey && self.ctrlKey) { self.metaKey = self.ctrlKey; } if (!self.which && self.button !== undefined) { self.which = (self.button & 1 ? 1 : (self.button & 2 ? 3 : (self.button & 4 ? 2 : 0))); } switch (self.which) { case 186 : self.which = 59; break; case 187 : case 107 : case 43 : self.which = 61; break; case 189 : case 45 : self.which = 109; break; case 42 : self.which = 106; break; case 47 : self.which = 111; break; case 78 : self.which = 110; break; } if (self.which >= 96 && self.which <= 105) { self.which -= 48; } }, preventDefault : function() { var ev = this.event; if (ev.preventDefault) { ev.preventDefault(); } ev.returnValue = false; }, stopPropagation : function() { var ev = this.event; if (ev.stopPropagation) { ev.stopPropagation(); } ev.cancelBubble = true; }, stop : function() { this.preventDefault(); this.stopPropagation(); } }); var _eventExpendo = 'kindeditor_' + _TIME, _eventId = 0, _eventData = {}; function _getId(el) { return el[_eventExpendo] || null; } function _setId(el) { el[_eventExpendo] = ++_eventId; return _eventId; } function _removeId(el) { try { delete el[_eventExpendo]; } catch(e) { if (el.removeAttribute) { el.removeAttribute(_eventExpendo); } } } function _bind(el, type, fn) { if (type.indexOf(',') >= 0) { _each(type.split(','), function() { _bind(el, this, fn); }); return; } var id = _getId(el); if (!id) { id = _setId(el); } if (_eventData[id] === undefined) { _eventData[id] = {}; } var events = _eventData[id][type]; if (events && events.length > 0) { _unbindEvent(el, type, events[0]); } else { _eventData[id][type] = []; _eventData[id].el = el; } events = _eventData[id][type]; if (events.length === 0) { events[0] = function(e) { var kevent = e ? new KEvent(el, e) : undefined; _each(events, function(i, event) { if (i > 0 && event) { event.call(el, kevent); } }); }; } if (_inArray(fn, events) < 0) { events.push(fn); } _bindEvent(el, type, events[0]); } function _unbind(el, type, fn) { if (type && type.indexOf(',') >= 0) { _each(type.split(','), function() { _unbind(el, this, fn); }); return; } var id = _getId(el); if (!id) { return; } if (type === undefined) { if (id in _eventData) { _each(_eventData[id], function(key, events) { if (key != 'el' && events.length > 0) { _unbindEvent(el, key, events[0]); } }); delete _eventData[id]; _removeId(el); } return; } if (!_eventData[id]) { return; } var events = _eventData[id][type]; if (events && events.length > 0) { if (fn === undefined) { _unbindEvent(el, type, events[0]); delete _eventData[id][type]; } else { _each(events, function(i, event) { if (i > 0 && event === fn) { events.splice(i, 1); } }); if (events.length == 1) { _unbindEvent(el, type, events[0]); delete _eventData[id][type]; } } var count = 0; _each(_eventData[id], function() { count++; }); if (count < 2) { delete _eventData[id]; _removeId(el); } } } function _fire(el, type) { if (type.indexOf(',') >= 0) { _each(type.split(','), function() { _fire(el, this); }); return; } var id = _getId(el); if (!id) { return; } var events = _eventData[id][type]; if (_eventData[id] && events && events.length > 0) { events[0](); } } function _ctrl(el, key, fn) { var self = this; key = /^\d{2,}$/.test(key) ? key : key.toUpperCase().charCodeAt(0); _bind(el, 'keydown', function(e) { if (e.ctrlKey && e.which == key && !e.shiftKey && !e.altKey) { fn.call(el); e.stop(); } }); } function _ready(fn) { var loaded = false; function readyFunc() { if (!loaded) { loaded = true; fn(KindEditor); } } function ieReadyFunc() { if (!loaded) { try { document.documentElement.doScroll('left'); } catch(e) { setTimeout(ieReadyFunc, 100); return; } readyFunc(); } } function ieReadyStateFunc() { if (document.readyState === 'complete') { readyFunc(); } } if (document.addEventListener) { _bind(document, 'DOMContentLoaded', readyFunc); } else if (document.attachEvent) { _bind(document, 'readystatechange', ieReadyStateFunc); if (document.documentElement.doScroll && window.frameElement === undefined) { ieReadyFunc(); } } _bind(window, 'load', readyFunc); } if (_IE) { window.attachEvent('onunload', function() { _each(_eventData, function(key, events) { if (events.el) { _unbind(events.el); } }); }); } K.ctrl = _ctrl; K.ready = _ready; function _getCssList(css) { var list = {}, reg = /\s*([\w\-]+)\s*:([^;]*)(;|$)/g, match; while ((match = reg.exec(css))) { var key = _trim(match[1].toLowerCase()), val = _trim(_toHex(match[2])); list[key] = val; } return list; } function _getAttrList(tag) { var list = {}, reg = /\s+(?:([\w\-:]+)|(?:([\w\-:]+)=([^\s"'<>]+))|(?:([\w\-:"]+)="([^"]*)")|(?:([\w\-:"]+)='([^']*)'))(?=(?:\s|\/|>)+)/g, match; while ((match = reg.exec(tag))) { var key = (match[1] || match[2] || match[4] || match[6]).toLowerCase(), val = (match[2] ? match[3] : (match[4] ? match[5] : match[7])) || ''; list[key] = val; } return list; } function _addClassToTag(tag, className) { if (/\s+class\s*=/.test(tag)) { tag = tag.replace(/(\s+class=["']?)([^"']*)(["']?[\s>])/, function($0, $1, $2, $3) { if ((' ' + $2 + ' ').indexOf(' ' + className + ' ') < 0) { return $2 === '' ? $1 + className + $3 : $1 + $2 + ' ' + className + $3; } else { return $0; } }); } else { tag = tag.substr(0, tag.length - 1) + ' class="' + className + '">'; } return tag; } function _formatCss(css) { var str = ''; _each(_getCssList(css), function(key, val) { str += key + ':' + val + ';'; }); return str; } function _formatUrl(url, mode, host, pathname) { mode = _undef(mode, '').toLowerCase(); if (_inArray(mode, ['absolute', 'relative', 'domain']) < 0) { return url; } host = host || location.protocol + '//' + location.host; if (pathname === undefined) { var m = location.pathname.match(/^(\/.*)\//); pathname = m ? m[1] : ''; } var match; if ((match = /^(\w+:\/\/[^\/]*)/.exec(url))) { if (match[1] !== host) { return url; } } else if (/^\w+:/.test(url)) { return url; } function getRealPath(path) { var parts = path.split('/'), paths = []; for (var i = 0, len = parts.length; i < len; i++) { var part = parts[i]; if (part == '..') { if (paths.length > 0) { paths.pop(); } } else if (part !== '' && part != '.') { paths.push(part); } } return '/' + paths.join('/'); } if (/^\//.test(url)) { url = host + getRealPath(url.substr(1)); } else if (!/^\w+:\/\//.test(url)) { url = host + getRealPath(pathname + '/' + url); } function getRelativePath(path, depth) { if (url.substr(0, path.length) === path) { var arr = []; for (var i = 0; i < depth; i++) { arr.push('..'); } var prefix = '.'; if (arr.length > 0) { prefix += '/' + arr.join('/'); } if (pathname == '/') { prefix += '/'; } return prefix + url.substr(path.length); } else { if ((match = /^(.*)\//.exec(path))) { return getRelativePath(match[1], ++depth); } } } if (mode === 'relative') { url = getRelativePath(host + pathname, 0).substr(2); } else if (mode === 'absolute') { if (url.substr(0, host.length) === host) { url = url.substr(host.length); } } return url; } function _formatHtml(html, htmlTags, urlType, wellFormatted, indentChar) { urlType = urlType || ''; wellFormatted = _undef(wellFormatted, false); indentChar = _undef(indentChar, '\t'); var fontSizeList = 'xx-small,x-small,small,medium,large,x-large,xx-large'.split(','); html = html.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/ig, function($0, $1, $2, $3) { return $1 + $2.replace(/<(?:br|br\s[^>]*)>/ig, '\n') + $3; }); html = html.replace(/<(?:br|br\s[^>]*)\s*\/?>\s*<\/p>/ig, '</p>'); html = html.replace(/(<(?:p|p\s[^>]*)>)\s*(<\/p>)/ig, '$1<br />$2'); html = html.replace(/\u200B/g, ''); var htmlTagMap = {}; if (htmlTags) { _each(htmlTags, function(key, val) { var arr = key.split(','); for (var i = 0, len = arr.length; i < len; i++) { htmlTagMap[arr[i]] = _toMap(val); } }); if (!htmlTagMap.script) { html = html.replace(/(<(?:script|script\s[^>]*)>)([\s\S]*?)(<\/script>)/ig, ''); } if (!htmlTagMap.style) { html = html.replace(/(<(?:style|style\s[^>]*)>)([\s\S]*?)(<\/style>)/ig, ''); } } var re = /(\s*)<(\/)?([\w\-:]+)((?:\s+|(?:\s+[\w\-:]+)|(?:\s+[\w\-:]+=[^\s"'<>]+)|(?:\s+[\w\-:"]+="[^"]*")|(?:\s+[\w\-:"]+='[^']*'))*)(\/)?>(\s*)/g; var tagStack = []; html = html.replace(re, function($0, $1, $2, $3, $4, $5, $6) { var full = $0, startNewline = $1 || '', startSlash = $2 || '', tagName = $3.toLowerCase(), attr = $4 || '', endSlash = $5 ? ' ' + $5 : '', endNewline = $6 || ''; if (htmlTags && !htmlTagMap[tagName]) { return ''; } if (endSlash === '' && _SINGLE_TAG_MAP[tagName]) { endSlash = ' /'; } if (_INLINE_TAG_MAP[tagName]) { if (startNewline) { startNewline = ' '; } if (endNewline) { endNewline = ' '; } } if (_PRE_TAG_MAP[tagName]) { if (startSlash) { endNewline = '\n'; } else { startNewline = '\n'; } } if (wellFormatted && tagName == 'br') { endNewline = '\n'; } if (_BLOCK_TAG_MAP[tagName] && !_PRE_TAG_MAP[tagName]) { if (wellFormatted) { if (startSlash && tagStack.length > 0 && tagStack[tagStack.length - 1] === tagName) { tagStack.pop(); } else { tagStack.push(tagName); } startNewline = '\n'; endNewline = '\n'; for (var i = 0, len = startSlash ? tagStack.length : tagStack.length - 1; i < len; i++) { startNewline += indentChar; if (!startSlash) { endNewline += indentChar; } } if (endSlash) { tagStack.pop(); } else if (!startSlash) { endNewline += indentChar; } } else { startNewline = endNewline = ''; } } if (attr !== '') { var attrMap = _getAttrList(full); if (tagName === 'font') { var fontStyleMap = {}, fontStyle = ''; _each(attrMap, function(key, val) { if (key === 'color') { fontStyleMap.color = val; delete attrMap[key]; } if (key === 'size') { fontStyleMap['font-size'] = fontSizeList[parseInt(val, 10) - 1] || ''; delete attrMap[key]; } if (key === 'face') { fontStyleMap['font-family'] = val; delete attrMap[key]; } if (key === 'style') { fontStyle = val; } }); if (fontStyle && !/;$/.test(fontStyle)) { fontStyle += ';'; } _each(fontStyleMap, function(key, val) { if (val === '') { return; } if (/\s/.test(val)) { val = "'" + val + "'"; } fontStyle += key + ':' + val + ';'; }); attrMap.style = fontStyle; } _each(attrMap, function(key, val) { if (_FILL_ATTR_MAP[key]) { attrMap[key] = key; } if (_inArray(key, ['src', 'href']) >= 0) { attrMap[key] = _formatUrl(val, urlType); } if (htmlTags && key !== 'style' && !htmlTagMap[tagName]['*'] && !htmlTagMap[tagName][key] || tagName === 'body' && key === 'contenteditable' || /^kindeditor_\d+$/.test(key)) { delete attrMap[key]; } if (key === 'style' && val !== '') { var styleMap = _getCssList(val); _each(styleMap, function(k, v) { if (htmlTags && !htmlTagMap[tagName].style && !htmlTagMap[tagName]['.' + k]) { delete styleMap[k]; } }); var style = ''; _each(styleMap, function(k, v) { style += k + ':' + v + ';'; }); attrMap.style = style; } }); attr = ''; _each(attrMap, function(key, val) { if (key === 'style' && val === '') { return; } val = val.replace(/"/g, '&quot;'); attr += ' ' + key + '="' + val + '"'; }); } if (tagName === 'font') { tagName = 'span'; } return startNewline + '<' + startSlash + tagName + attr + endSlash + '>' + endNewline; }); html = html.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/ig, function($0, $1, $2, $3) { return $1 + $2.replace(/\n/g, '<span id="__kindeditor_pre_newline__">\n') + $3; }); html = html.replace(/\n\s*\n/g, '\n'); html = html.replace(/<span id="__kindeditor_pre_newline__">\n/g, '\n'); return _trim(html); } function _clearMsWord(html, htmlTags) { html = html.replace(/<meta[\s\S]*?>/ig, '') .replace(/<![\s\S]*?>/ig, '') .replace(/<style[^>]*>[\s\S]*?<\/style>/ig, '') .replace(/<script[^>]*>[\s\S]*?<\/script>/ig, '') .replace(/<w:[^>]+>[\s\S]*?<\/w:[^>]+>/ig, '') .replace(/<o:[^>]+>[\s\S]*?<\/o:[^>]+>/ig, '') .replace(/<xml>[\s\S]*?<\/xml>/ig, '') .replace(/<(?:table|td)[^>]*>/ig, function(full) { return full.replace(/border-bottom:([#\w\s]+)/ig, 'border:$1'); }); return _formatHtml(html, htmlTags); } function _mediaType(src) { if (/\.(rm|rmvb)(\?|$)/i.test(src)) { return 'audio/x-pn-realaudio-plugin'; } if (/\.(swf|flv)(\?|$)/i.test(src)) { return 'application/x-shockwave-flash'; } return 'video/x-ms-asf-plugin'; } function _mediaClass(type) { if (/realaudio/i.test(type)) { return 'ke-rm'; } if (/flash/i.test(type)) { return 'ke-flash'; } return 'ke-media'; } function _mediaAttrs(srcTag) { return _getAttrList(unescape(srcTag)); } function _mediaEmbed(attrs) { var html = '<embed '; _each(attrs, function(key, val) { html += key + '="' + val + '" '; }); html += '/>'; return html; } function _mediaImg(blankPath, attrs) { var width = attrs.width, height = attrs.height, type = attrs.type || _mediaType(attrs.src), srcTag = _mediaEmbed(attrs), style = ''; if (width > 0) { style += 'width:' + width + 'px;'; } if (height > 0) { style += 'height:' + height + 'px;'; } var html = '<img class="' + _mediaClass(type) + '" src="' + blankPath + '" '; if (style !== '') { html += 'style="' + style + '" '; } html += 'data-ke-tag="' + escape(srcTag) + '" alt="" />'; return html; } K.formatUrl = _formatUrl; K.formatHtml = _formatHtml; K.getCssList = _getCssList; K.getAttrList = _getAttrList; K.mediaType = _mediaType; K.mediaAttrs = _mediaAttrs; K.mediaEmbed = _mediaEmbed; K.mediaImg = _mediaImg; K.clearMsWord = _clearMsWord; function _contains(nodeA, nodeB) { if (nodeA.nodeType == 9 && nodeB.nodeType != 9) { return true; } while ((nodeB = nodeB.parentNode)) { if (nodeB == nodeA) { return true; } } return false; } var _getSetAttrDiv = document.createElement('div'); _getSetAttrDiv.setAttribute('className', 't'); var _GET_SET_ATTRIBUTE = _getSetAttrDiv.className !== 't'; function _getAttr(el, key) { key = key.toLowerCase(); var val = null; if (!_GET_SET_ATTRIBUTE && el.nodeName.toLowerCase() != 'script') { var div = el.ownerDocument.createElement('div'); div.appendChild(el.cloneNode(false)); var list = _getAttrList(_unescape(div.innerHTML)); if (key in list) { val = list[key]; } } else { try { val = el.getAttribute(key, 2); } catch(e) { val = el.getAttribute(key, 1); } } if (key === 'style' && val !== null) { val = _formatCss(val); } return val; } function _queryAll(expr, root) { var exprList = expr.split(','); if (exprList.length > 1) { var mergedResults = []; _each(exprList, function() { _each(_queryAll(this, root), function() { if (_inArray(this, mergedResults) < 0) { mergedResults.push(this); } }); }); return mergedResults; } root = root || document; function escape(str) { if (typeof str != 'string') { return str; } return str.replace(/([^\w\-])/g, '\\$1'); } function stripslashes(str) { return str.replace(/\\/g, ''); } function cmpTag(tagA, tagB) { return tagA === '*' || tagA.toLowerCase() === escape(tagB.toLowerCase()); } function byId(id, tag, root) { var arr = [], doc = root.ownerDocument || root, el = doc.getElementById(stripslashes(id)); if (el) { if (cmpTag(tag, el.nodeName) && _contains(root, el)) { arr.push(el); } } return arr; } function byClass(className, tag, root) { var doc = root.ownerDocument || root, arr = [], els, i, len, el; if (root.getElementsByClassName) { els = root.getElementsByClassName(stripslashes(className)); for (i = 0, len = els.length; i < len; i++) { el = els[i]; if (cmpTag(tag, el.nodeName)) { arr.push(el); } } } else if (doc.querySelectorAll) { els = doc.querySelectorAll((root.nodeName !== '#document' ? root.nodeName + ' ' : '') + tag + '.' + className); for (i = 0, len = els.length; i < len; i++) { el = els[i]; if (_contains(root, el)) { arr.push(el); } } } else { els = root.getElementsByTagName(tag); className = ' ' + className + ' '; for (i = 0, len = els.length; i < len; i++) { el = els[i]; if (el.nodeType == 1) { var cls = el.className; if (cls && (' ' + cls + ' ').indexOf(className) > -1) { arr.push(el); } } } } return arr; } function byName(name, tag, root) { var arr = [], doc = root.ownerDocument || root, els = doc.getElementsByName(stripslashes(name)), el; for (var i = 0, len = els.length; i < len; i++) { el = els[i]; if (cmpTag(tag, el.nodeName) && _contains(root, el)) { if (el.getAttributeNode('name')) { arr.push(el); } } } return arr; } function byAttr(key, val, tag, root) { var arr = [], els = root.getElementsByTagName(tag), el; for (var i = 0, len = els.length; i < len; i++) { el = els[i]; if (el.nodeType == 1) { if (val === null) { if (_getAttr(el, key) !== null) { arr.push(el); } } else { if (val === escape(_getAttr(el, key))) { arr.push(el); } } } } return arr; } function select(expr, root) { var arr = [], matches; matches = /^((?:\\.|[^.#\s\[<>])+)/.exec(expr); var tag = matches ? matches[1] : '*'; if ((matches = /#((?:[\w\-]|\\.)+)$/.exec(expr))) { arr = byId(matches[1], tag, root); } else if ((matches = /\.((?:[\w\-]|\\.)+)$/.exec(expr))) { arr = byClass(matches[1], tag, root); } else if ((matches = /\[((?:[\w\-]|\\.)+)\]/.exec(expr))) { arr = byAttr(matches[1].toLowerCase(), null, tag, root); } else if ((matches = /\[((?:[\w\-]|\\.)+)\s*=\s*['"]?((?:\\.|[^'"]+)+)['"]?\]/.exec(expr))) { var key = matches[1].toLowerCase(), val = matches[2]; if (key === 'id') { arr = byId(val, tag, root); } else if (key === 'class') { arr = byClass(val, tag, root); } else if (key === 'name') { arr = byName(val, tag, root); } else { arr = byAttr(key, val, tag, root); } } else { var els = root.getElementsByTagName(tag), el; for (var i = 0, len = els.length; i < len; i++) { el = els[i]; if (el.nodeType == 1) { arr.push(el); } } } return arr; } var parts = [], arr, re = /((?:\\.|[^\s>])+|[\s>])/g; while ((arr = re.exec(expr))) { if (arr[1] !== ' ') { parts.push(arr[1]); } } var results = []; if (parts.length == 1) { return select(parts[0], root); } var isChild = false, part, els, subResults, val, v, i, j, k, length, len, l; for (i = 0, lenth = parts.length; i < lenth; i++) { part = parts[i]; if (part === '>') { isChild = true; continue; } if (i > 0) { els = []; for (j = 0, len = results.length; j < len; j++) { val = results[j]; subResults = select(part, val); for (k = 0, l = subResults.length; k < l; k++) { v = subResults[k]; if (isChild) { if (val === v.parentNode) { els.push(v); } } else { els.push(v); } } } results = els; } else { results = select(part, root); } if (results.length === 0) { return []; } } return results; } function _query(expr, root) { var arr = _queryAll(expr, root); return arr.length > 0 ? arr[0] : null; } K.query = _query; K.queryAll = _queryAll; function _get(val) { return K(val)[0]; } function _getDoc(node) { if (!node) { return document; } return node.ownerDocument || node.document || node; } function _getWin(node) { if (!node) { return window; } var doc = _getDoc(node); return doc.parentWindow || doc.defaultView; } function _setHtml(el, html) { if (el.nodeType != 1) { return; } var doc = _getDoc(el); try { el.innerHTML = '<img id="__kindeditor_temp_tag__" width="0" height="0" style="display:none;" />' + html; var temp = doc.getElementById('__kindeditor_temp_tag__'); temp.parentNode.removeChild(temp); } catch(e) { K(el).empty(); K('@' + html, doc).each(function() { el.appendChild(this); }); } } function _hasClass(el, cls) { return _inString(cls, el.className, ' '); } function _setAttr(el, key, val) { if (_IE && _V < 8 && key.toLowerCase() == 'class') { key = 'className'; } el.setAttribute(key, '' + val); } function _removeAttr(el, key) { if (_IE && _V < 8 && key.toLowerCase() == 'class') { key = 'className'; } _setAttr(el, key, ''); el.removeAttribute(key); } function _getNodeName(node) { if (!node || !node.nodeName) { return ''; } return node.nodeName.toLowerCase(); } function _computedCss(el, key) { var self = this, win = _getWin(el), camelKey = _toCamel(key), val = ''; if (win.getComputedStyle) { var style = win.getComputedStyle(el, null); val = style[camelKey] || style.getPropertyValue(key) || el.style[camelKey]; } else if (el.currentStyle) { val = el.currentStyle[camelKey] || el.style[camelKey]; } return val; } function _hasVal(node) { return !!_VALUE_TAG_MAP[_getNodeName(node)]; } function _docElement(doc) { doc = doc || document; return _QUIRKS ? doc.body : doc.documentElement; } function _docHeight(doc) { var el = _docElement(doc); return Math.max(el.scrollHeight, el.clientHeight); } function _docWidth(doc) { var el = _docElement(doc); return Math.max(el.scrollWidth, el.clientWidth); } function _getScrollPos(doc) { doc = doc || document; var x, y; if (_IE || _OPERA) { x = _docElement(doc).scrollLeft; y = _docElement(doc).scrollTop; } else { x = _getWin(doc).scrollX; y = _getWin(doc).scrollY; } return {x : x, y : y}; } function KNode(node) { this.init(node); } _extend(KNode, { init : function(node) { var self = this; for (var i = 0, len = node.length; i < len; i++) { self[i] = node[i].constructor === KNode ? node[i][0] : node[i]; } self.length = node.length; self.doc = _getDoc(self[0]); self.name = _getNodeName(self[0]); self.type = self.length > 0 ? self[0].nodeType : null; self.win = _getWin(self[0]); self._data = {}; }, each : function(fn) { var self = this; for (var i = 0; i < self.length; i++) { if (fn.call(self[i], i, self[i]) === false) { return self; } } return self; }, bind : function(type, fn) { this.each(function() { _bind(this, type, fn); }); return this; }, unbind : function(type, fn) { this.each(function() { _unbind(this, type, fn); }); return this; }, fire : function(type) { if (this.length < 1) { return this; } _fire(this[0], type); return this; }, hasAttr : function(key) { if (this.length < 1) { return false; } return !!_getAttr(this[0], key); }, attr : function(key, val) { var self = this; if (key === undefined) { return _getAttrList(self.outer()); } if (typeof key === 'object') { _each(key, function(k, v) { self.attr(k, v); }); return self; } if (val === undefined) { val = self.length < 1 ? null : _getAttr(self[0], key); return val === null ? '' : val; } self.each(function() { _setAttr(this, key, val); }); return self; }, removeAttr : function(key) { this.each(function() { _removeAttr(this, key); }); return this; }, get : function(i) { if (this.length < 1) { return null; } return this[i || 0]; }, hasClass : function(cls) { if (this.length < 1) { return false; } return _hasClass(this[0], cls); }, addClass : function(cls) { this.each(function() { if (!_hasClass(this, cls)) { this.className = _trim(this.className + ' ' + cls); } }); return this; }, removeClass : function(cls) { this.each(function() { if (_hasClass(this, cls)) { this.className = _trim(this.className.replace(new RegExp('(^|\\s)' + cls + '(\\s|$)'), ' ')); } }); return this; }, html : function(val) { var self = this; if (val === undefined) { if (self.length < 1 || self.type != 1) { return ''; } return _formatHtml(self[0].innerHTML); } self.each(function() { _setHtml(this, val); }); return self; }, text : function() { var self = this; if (self.length < 1) { return ''; } return _IE ? self[0].innerText : self[0].textContent; }, hasVal : function() { if (this.length < 1) { return false; } return _hasVal(this[0]); }, val : function(val) { var self = this; if (val === undefined) { if (self.length < 1) { return ''; } return self.hasVal() ? self[0].value : self.attr('value'); } else { self.each(function() { if (_hasVal(this)) { this.value = val; } else { _setAttr(this, 'value' , val); } }); return self; } }, css : function(key, val) { var self = this; if (key === undefined) { return _getCssList(self.attr('style')); } if (typeof key === 'object') { _each(key, function(k, v) { self.css(k, v); }); return self; } if (val === undefined) { if (self.length < 1) { return ''; } return self[0].style[_toCamel(key)] || _computedCss(self[0], key) || ''; } self.each(function() { this.style[_toCamel(key)] = val; }); return self; }, width : function(val) { var self = this; if (val === undefined) { if (self.length < 1) { return 0; } return self[0].offsetWidth; } return self.css('width', _addUnit(val)); }, height : function(val) { var self = this; if (val === undefined) { if (self.length < 1) { return 0; } return self[0].offsetHeight; } return self.css('height', _addUnit(val)); }, opacity : function(val) { this.each(function() { if (this.style.opacity === undefined) { this.style.filter = val == 1 ? '' : 'alpha(opacity=' + (val * 100) + ')'; } else { this.style.opacity = val == 1 ? '' : val; } }); return this; }, data : function(key, val) { var self = this; if (val === undefined) { return self._data[key]; } self._data[key] = val; return self; }, pos : function() { var self = this, node = self[0], x = 0, y = 0; if (node) { if (node.getBoundingClientRect) { var box = node.getBoundingClientRect(), pos = _getScrollPos(self.doc); x = box.left + pos.x; y = box.top + pos.y; } else { while (node) { x += node.offsetLeft; y += node.offsetTop; node = node.offsetParent; } } } return {x : _round(x), y : _round(y)}; }, clone : function(bool) { if (this.length < 1) { return new KNode([]); } return new KNode([this[0].cloneNode(bool)]); }, append : function(expr) { this.each(function() { if (this.appendChild) { this.appendChild(_get(expr)); } }); return this; }, appendTo : function(expr) { this.each(function() { _get(expr).appendChild(this); }); return this; }, before : function(expr) { this.each(function() { this.parentNode.insertBefore(_get(expr), this); }); return this; }, after : function(expr) { this.each(function() { if (this.nextSibling) { this.parentNode.insertBefore(_get(expr), this.nextSibling); } else { this.parentNode.appendChild(_get(expr)); } }); return this; }, replaceWith : function(expr) { var nodes = []; this.each(function(i, node) { _unbind(node); var newNode = _get(expr); node.parentNode.replaceChild(newNode, node); nodes.push(newNode); }); return K(nodes); }, empty : function() { var self = this; self.each(function(i, node) { var child = node.firstChild; while (child) { if (!node.parentNode) { return; } var next = child.nextSibling; child.parentNode.removeChild(child); child = next; } }); return self; }, remove : function(keepChilds) { var self = this; self.each(function(i, node) { if (!node.parentNode) { return; } _unbind(node); if (keepChilds) { var child = node.firstChild; while (child) { var next = child.nextSibling; node.parentNode.insertBefore(child, node); child = next; } } node.parentNode.removeChild(node); delete self[i]; }); self.length = 0; self._data = {}; return self; }, show : function(val) { return this.css('display', val === undefined ? 'block' : val); }, hide : function() { return this.css('display', 'none'); }, outer : function() { var self = this; if (self.length < 1) { return ''; } var div = self.doc.createElement('div'), html; div.appendChild(self[0].cloneNode(true)); html = _formatHtml(div.innerHTML); div = null; return html; }, isSingle : function() { return !!_SINGLE_TAG_MAP[this.name]; }, isInline : function() { return !!_INLINE_TAG_MAP[this.name]; }, isBlock : function() { return !!_BLOCK_TAG_MAP[this.name]; }, isStyle : function() { return !!_STYLE_TAG_MAP[this.name]; }, isControl : function() { return !!_CONTROL_TAG_MAP[this.name]; }, contains : function(otherNode) { if (this.length < 1) { return false; } return _contains(this[0], _get(otherNode)); }, parent : function() { if (this.length < 1) { return null; } var node = this[0].parentNode; return node ? new KNode([node]) : null; }, children : function() { if (this.length < 1) { return []; } var list = [], child = this[0].firstChild; while (child) { if (child.nodeType != 3 || _trim(child.nodeValue) !== '') { list.push(new KNode([child])); } child = child.nextSibling; } return list; }, first : function() { var list = this.children(); return list.length > 0 ? list[0] : null; }, last : function() { var list = this.children(); return list.length > 0 ? list[list.length - 1] : null; }, index : function() { if (this.length < 1) { return -1; } var i = -1, sibling = this[0]; while (sibling) { i++; sibling = sibling.previousSibling; } return i; }, prev : function() { if (this.length < 1) { return null; } var node = this[0].previousSibling; return node ? new KNode([node]) : null; }, next : function() { if (this.length < 1) { return null; } var node = this[0].nextSibling; return node ? new KNode([node]) : null; }, scan : function(fn, order) { if (this.length < 1) { return; } order = (order === undefined) ? true : order; function walk(node) { var n = order ? node.firstChild : node.lastChild; while (n) { var next = order ? n.nextSibling : n.previousSibling; if (fn(n) === false) { return false; } if (walk(n) === false) { return false; } n = next; } } walk(this[0]); return this; } }); _each(('blur,focus,focusin,focusout,load,resize,scroll,unload,click,dblclick,' + 'mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,' + 'change,select,submit,keydown,keypress,keyup,error,contextmenu').split(','), function(i, type) { KNode.prototype[type] = function(fn) { return fn ? this.bind(type, fn) : this.fire(type); }; }); var _K = K; K = function(expr, root) { if (expr === undefined || expr === null) { return; } function newNode(node) { if (!node[0]) { node = []; } return new KNode(node); } if (typeof expr === 'string') { if (root) { root = _get(root); } var length = expr.length; if (expr.charAt(0) === '@') { expr = expr.substr(1); } if (expr.length !== length || /<.+>/.test(expr)) { var doc = root ? root.ownerDocument || root : document, div = doc.createElement('div'), list = []; div.innerHTML = '<img id="__kindeditor_temp_tag__" width="0" height="0" style="display:none;" />' + expr; for (var i = 0, len = div.childNodes.length; i < len; i++) { var child = div.childNodes[i]; if (child.id == '__kindeditor_temp_tag__') { continue; } list.push(child); } return newNode(list); } return newNode(_queryAll(expr, root)); } if (expr && expr.constructor === KNode) { return expr; } if (_isArray(expr)) { return newNode(expr); } return newNode(_toArray(arguments)); }; _each(_K, function(key, val) { K[key] = val; }); window.KindEditor = K; var _START_TO_START = 0, _START_TO_END = 1, _END_TO_END = 2, _END_TO_START = 3, _BOOKMARK_ID = 0; function _updateCollapsed(range) { range.collapsed = (range.startContainer === range.endContainer && range.startOffset === range.endOffset); return range; } function _copyAndDelete(range, isCopy, isDelete) { var doc = range.doc, nodeList = []; function splitTextNode(node, startOffset, endOffset) { var length = node.nodeValue.length, centerNode; if (isCopy) { var cloneNode = node.cloneNode(true); if (startOffset > 0) { centerNode = cloneNode.splitText(startOffset); } else { centerNode = cloneNode; } if (endOffset < length) { centerNode.splitText(endOffset - startOffset); } } if (isDelete) { var center = node; if (startOffset > 0) { center = node.splitText(startOffset); range.setStart(node, startOffset); } if (endOffset < length) { var right = center.splitText(endOffset - startOffset); range.setEnd(right, 0); } nodeList.push(center); } return centerNode; } function removeNodes() { if (isDelete) { range.up().collapse(true); } for (var i = 0, len = nodeList.length; i < len; i++) { var node = nodeList[i]; if (node.parentNode) { node.parentNode.removeChild(node); } } } var copyRange = range.cloneRange().down(); var start = -1, incStart = -1, incEnd = -1, end = -1, ancestor = range.commonAncestor(), frag = doc.createDocumentFragment(); if (ancestor.nodeType == 3) { var textNode = splitTextNode(ancestor, range.startOffset, range.endOffset); if (isCopy) { frag.appendChild(textNode); } removeNodes(); return isCopy ? frag : range; } function extractNodes(parent, frag) { var node = parent.firstChild, nextNode; while (node) { var testRange = new KRange(doc).selectNode(node); start = testRange.compareBoundaryPoints(_START_TO_END, range); if (start >= 0 && incStart <= 0) { incStart = testRange.compareBoundaryPoints(_START_TO_START, range); } if (incStart >= 0 && incEnd <= 0) { incEnd = testRange.compareBoundaryPoints(_END_TO_END, range); } if (incEnd >= 0 && end <= 0) { end = testRange.compareBoundaryPoints(_END_TO_START, range); } if (end >= 0) { return false; } nextNode = node.nextSibling; if (start > 0) { if (node.nodeType == 1) { if (incStart >= 0 && incEnd <= 0) { if (isCopy) { frag.appendChild(node.cloneNode(true)); } if (isDelete) { nodeList.push(node); } } else { var childFlag; if (isCopy) { childFlag = node.cloneNode(false); frag.appendChild(childFlag); } if (extractNodes(node, childFlag) === false) { return false; } } } else if (node.nodeType == 3) { var textNode; if (node == copyRange.startContainer) { textNode = splitTextNode(node, copyRange.startOffset, node.nodeValue.length); } else if (node == copyRange.endContainer) { textNode = splitTextNode(node, 0, copyRange.endOffset); } else { textNode = splitTextNode(node, 0, node.nodeValue.length); } if (isCopy) { try { frag.appendChild(textNode); } catch(e) {} } } } node = nextNode; } } extractNodes(ancestor, frag); if (isDelete) { range.up().collapse(true); } for (var i = 0, len = nodeList.length; i < len; i++) { var node = nodeList[i]; if (node.parentNode) { node.parentNode.removeChild(node); } } return isCopy ? frag : range; } function _moveToElementText(range, el) { var node = el; while (node) { var knode = K(node); if (knode.name == 'marquee' || knode.name == 'select') { return; } node = node.parentNode; } try { range.moveToElementText(el); } catch(e) {} } function _getStartEnd(rng, isStart) { var doc = rng.parentElement().ownerDocument, pointRange = rng.duplicate(); pointRange.collapse(isStart); var parent = pointRange.parentElement(), nodes = parent.childNodes; if (nodes.length === 0) { return {node: parent.parentNode, offset: K(parent).index()}; } var startNode = doc, startPos = 0, cmp = -1; var testRange = rng.duplicate(); _moveToElementText(testRange, parent); for (var i = 0, len = nodes.length; i < len; i++) { var node = nodes[i]; cmp = testRange.compareEndPoints('StartToStart', pointRange); if (cmp === 0) { return {node: node.parentNode, offset: i}; } if (node.nodeType == 1) { var nodeRange = rng.duplicate(), dummy, knode = K(node), newNode = node; if (knode.isControl()) { dummy = doc.createElement('span'); knode.after(dummy); newNode = dummy; startPos += knode.text().replace(/\r\n|\n|\r/g, '').length; } _moveToElementText(nodeRange, newNode); testRange.setEndPoint('StartToEnd', nodeRange); if (cmp > 0) { startPos += nodeRange.text.replace(/\r\n|\n|\r/g, '').length; } else { startPos = 0; } if (dummy) { K(dummy).remove(); } } else if (node.nodeType == 3) { testRange.moveStart('character', node.nodeValue.length); startPos += node.nodeValue.length; } if (cmp < 0) { startNode = node; } } if (cmp < 0 && startNode.nodeType == 1) { return {node: parent, offset: K(parent.lastChild).index() + 1}; } if (cmp > 0) { while (startNode.nextSibling && startNode.nodeType == 1) { startNode = startNode.nextSibling; } } testRange = rng.duplicate(); _moveToElementText(testRange, parent); testRange.setEndPoint('StartToEnd', pointRange); startPos -= testRange.text.replace(/\r\n|\n|\r/g, '').length; if (cmp > 0 && startNode.nodeType == 3) { var prevNode = startNode.previousSibling; while (prevNode && prevNode.nodeType == 3) { startPos -= prevNode.nodeValue.length; prevNode = prevNode.previousSibling; } } return {node: startNode, offset: startPos}; } function _getEndRange(node, offset) { var doc = node.ownerDocument || node, range = doc.body.createTextRange(); if (doc == node) { range.collapse(true); return range; } if (node.nodeType == 1 && node.childNodes.length > 0) { var children = node.childNodes, isStart, child; if (offset === 0) { child = children[0]; isStart = true; } else { child = children[offset - 1]; isStart = false; } if (!child) { return range; } if (K(child).name === 'head') { if (offset === 1) { isStart = true; } if (offset === 2) { isStart = false; } range.collapse(isStart); return range; } if (child.nodeType == 1) { var kchild = K(child), span; if (kchild.isControl()) { span = doc.createElement('span'); if (isStart) { kchild.before(span); } else { kchild.after(span); } child = span; } _moveToElementText(range, child); range.collapse(isStart); if (span) { K(span).remove(); } return range; } node = child; offset = isStart ? 0 : child.nodeValue.length; } var dummy = doc.createElement('span'); K(node).before(dummy); _moveToElementText(range, dummy); range.moveStart('character', offset); K(dummy).remove(); return range; } function _toRange(rng) { var doc, range; function tr2td(start) { if (K(start.node).name == 'tr') { start.node = start.node.cells[start.offset]; start.offset = 0; } } if (_IE) { if (rng.item) { doc = _getDoc(rng.item(0)); range = new KRange(doc); range.selectNode(rng.item(0)); return range; } doc = rng.parentElement().ownerDocument; var start = _getStartEnd(rng, true), end = _getStartEnd(rng, false); tr2td(start); tr2td(end); range = new KRange(doc); range.setStart(start.node, start.offset); range.setEnd(end.node, end.offset); return range; } var startContainer = rng.startContainer; doc = startContainer.ownerDocument || startContainer; range = new KRange(doc); range.setStart(startContainer, rng.startOffset); range.setEnd(rng.endContainer, rng.endOffset); return range; } function KRange(doc) { this.init(doc); } _extend(KRange, { init : function(doc) { var self = this; self.startContainer = doc; self.startOffset = 0; self.endContainer = doc; self.endOffset = 0; self.collapsed = true; self.doc = doc; }, commonAncestor : function() { function getParents(node) { var parents = []; while (node) { parents.push(node); node = node.parentNode; } return parents; } var parentsA = getParents(this.startContainer), parentsB = getParents(this.endContainer), i = 0, lenA = parentsA.length, lenB = parentsB.length, parentA, parentB; while (++i) { parentA = parentsA[lenA - i]; parentB = parentsB[lenB - i]; if (!parentA || !parentB || parentA !== parentB) { break; } } return parentsA[lenA - i + 1]; }, setStart : function(node, offset) { var self = this, doc = self.doc; self.startContainer = node; self.startOffset = offset; if (self.endContainer === doc) { self.endContainer = node; self.endOffset = offset; } return _updateCollapsed(this); }, setEnd : function(node, offset) { var self = this, doc = self.doc; self.endContainer = node; self.endOffset = offset; if (self.startContainer === doc) { self.startContainer = node; self.startOffset = offset; } return _updateCollapsed(this); }, setStartBefore : function(node) { return this.setStart(node.parentNode || this.doc, K(node).index()); }, setStartAfter : function(node) { return this.setStart(node.parentNode || this.doc, K(node).index() + 1); }, setEndBefore : function(node) { return this.setEnd(node.parentNode || this.doc, K(node).index()); }, setEndAfter : function(node) { return this.setEnd(node.parentNode || this.doc, K(node).index() + 1); }, selectNode : function(node) { return this.setStartBefore(node).setEndAfter(node); }, selectNodeContents : function(node) { var knode = K(node); if (knode.type == 3 || knode.isSingle()) { return this.selectNode(node); } var children = knode.children(); if (children.length > 0) { return this.setStartBefore(children[0][0]).setEndAfter(children[children.length - 1][0]); } return this.setStart(node, 0).setEnd(node, 0); }, collapse : function(toStart) { if (toStart) { return this.setEnd(this.startContainer, this.startOffset); } return this.setStart(this.endContainer, this.endOffset); }, compareBoundaryPoints : function(how, range) { var rangeA = this.get(), rangeB = range.get(); if (_IE) { var arr = {}; arr[_START_TO_START] = 'StartToStart'; arr[_START_TO_END] = 'EndToStart'; arr[_END_TO_END] = 'EndToEnd'; arr[_END_TO_START] = 'StartToEnd'; var cmp = rangeA.compareEndPoints(arr[how], rangeB); if (cmp !== 0) { return cmp; } var nodeA, nodeB, nodeC, posA, posB; if (how === _START_TO_START || how === _END_TO_START) { nodeA = this.startContainer; posA = this.startOffset; } if (how === _START_TO_END || how === _END_TO_END) { nodeA = this.endContainer; posA = this.endOffset; } if (how === _START_TO_START || how === _START_TO_END) { nodeB = range.startContainer; posB = range.startOffset; } if (how === _END_TO_END || how === _END_TO_START) { nodeB = range.endContainer; posB = range.endOffset; } if (nodeA === nodeB) { var diff = posA - posB; return diff > 0 ? 1 : (diff < 0 ? -1 : 0); } nodeC = nodeB; while (nodeC && nodeC.parentNode !== nodeA) { nodeC = nodeC.parentNode; } if (nodeC) { return K(nodeC).index() >= posA ? -1 : 1; } nodeC = nodeA; while (nodeC && nodeC.parentNode !== nodeB) { nodeC = nodeC.parentNode; } if (nodeC) { return K(nodeC).index() >= posB ? 1 : -1; } nodeC = K(nodeB).next(); if (nodeC && nodeC.contains(nodeA)) { return 1; } nodeC = K(nodeA).next(); if (nodeC && nodeC.contains(nodeB)) { return -1; } } else { return rangeA.compareBoundaryPoints(how, rangeB); } }, cloneRange : function() { return new KRange(this.doc).setStart(this.startContainer, this.startOffset).setEnd(this.endContainer, this.endOffset); }, toString : function() { var rng = this.get(), str = _IE ? rng.text : rng.toString(); return str.replace(/\r\n|\n|\r/g, ''); }, cloneContents : function() { return _copyAndDelete(this, true, false); }, deleteContents : function() { return _copyAndDelete(this, false, true); }, extractContents : function() { return _copyAndDelete(this, true, true); }, insertNode : function(node) { var self = this, sc = self.startContainer, so = self.startOffset, ec = self.endContainer, eo = self.endOffset, firstChild, lastChild, c, nodeCount = 1; if (node.nodeName.toLowerCase() === '#document-fragment') { firstChild = node.firstChild; lastChild = node.lastChild; nodeCount = node.childNodes.length; } if (sc.nodeType == 1) { c = sc.childNodes[so]; if (c) { sc.insertBefore(node, c); if (sc === ec) { eo += nodeCount; } } else { sc.appendChild(node); } } else if (sc.nodeType == 3) { if (so === 0) { sc.parentNode.insertBefore(node, sc); if (sc.parentNode === ec) { eo += nodeCount; } } else if (so >= sc.nodeValue.length) { if (sc.nextSibling) { sc.parentNode.insertBefore(node, sc.nextSibling); } else { sc.parentNode.appendChild(node); } } else { if (so > 0) { c = sc.splitText(so); } else { c = sc; } sc.parentNode.insertBefore(node, c); if (sc === ec) { ec = c; eo -= so; } } } if (firstChild) { self.setStartBefore(firstChild).setEndAfter(lastChild); } else { self.selectNode(node); } if (self.compareBoundaryPoints(_END_TO_END, self.cloneRange().setEnd(ec, eo)) >= 1) { return self; } return self.setEnd(ec, eo); }, surroundContents : function(node) { node.appendChild(this.extractContents()); return this.insertNode(node).selectNode(node); }, isControl : function() { var self = this, sc = self.startContainer, so = self.startOffset, ec = self.endContainer, eo = self.endOffset, rng; return sc.nodeType == 1 && sc === ec && so + 1 === eo && K(sc.childNodes[so]).isControl(); }, get : function(hasControlRange) { var self = this, doc = self.doc, node, rng; if (!_IE) { rng = doc.createRange(); try { rng.setStart(self.startContainer, self.startOffset); rng.setEnd(self.endContainer, self.endOffset); } catch (e) {} return rng; } if (hasControlRange && self.isControl()) { rng = doc.body.createControlRange(); rng.addElement(self.startContainer.childNodes[self.startOffset]); return rng; } var range = self.cloneRange().down(); rng = doc.body.createTextRange(); rng.setEndPoint('StartToStart', _getEndRange(range.startContainer, range.startOffset)); rng.setEndPoint('EndToStart', _getEndRange(range.endContainer, range.endOffset)); return rng; }, html : function() { return K(this.cloneContents()).outer(); }, down : function() { var self = this; function downPos(node, pos, isStart) { if (node.nodeType != 1) { return; } var children = K(node).children(); if (children.length === 0) { return; } var left, right, child, offset; if (pos > 0) { left = children[pos - 1]; } if (pos < children.length) { right = children[pos]; } if (left && left.type == 3) { child = left[0]; offset = child.nodeValue.length; } if (right && right.type == 3) { child = right[0]; offset = 0; } if (!child) { return; } if (isStart) { self.setStart(child, offset); } else { self.setEnd(child, offset); } } downPos(self.startContainer, self.startOffset, true); downPos(self.endContainer, self.endOffset, false); return self; }, up : function() { var self = this; function upPos(node, pos, isStart) { if (node.nodeType != 3) { return; } if (pos === 0) { if (isStart) { self.setStartBefore(node); } else { self.setEndBefore(node); } } else if (pos == node.nodeValue.length) { if (isStart) { self.setStartAfter(node); } else { self.setEndAfter(node); } } } upPos(self.startContainer, self.startOffset, true); upPos(self.endContainer, self.endOffset, false); return self; }, enlarge : function(toBlock) { var self = this; self.up(); function enlargePos(node, pos, isStart) { var knode = K(node), parent; if (knode.type == 3 || _NOSPLIT_TAG_MAP[knode.name] || !toBlock && knode.isBlock()) { return; } if (pos === 0) { while (!knode.prev()) { parent = knode.parent(); if (!parent || _NOSPLIT_TAG_MAP[parent.name] || !toBlock && parent.isBlock()) { break; } knode = parent; } if (isStart) { self.setStartBefore(knode[0]); } else { self.setEndBefore(knode[0]); } } else if (pos == knode.children().length) { while (!knode.next()) { parent = knode.parent(); if (!parent || _NOSPLIT_TAG_MAP[parent.name] || !toBlock && parent.isBlock()) { break; } knode = parent; } if (isStart) { self.setStartAfter(knode[0]); } else { self.setEndAfter(knode[0]); } } } enlargePos(self.startContainer, self.startOffset, true); enlargePos(self.endContainer, self.endOffset, false); return self; }, shrink : function() { var self = this, child, collapsed = self.collapsed; while (self.startContainer.nodeType == 1 && (child = self.startContainer.childNodes[self.startOffset]) && child.nodeType == 1 && !K(child).isSingle()) { self.setStart(child, 0); } if (collapsed) { return self.collapse(collapsed); } while (self.endContainer.nodeType == 1 && self.endOffset > 0 && (child = self.endContainer.childNodes[self.endOffset - 1]) && child.nodeType == 1 && !K(child).isSingle()) { self.setEnd(child, child.childNodes.length); } return self; }, createBookmark : function(serialize) { var self = this, doc = self.doc, endNode, startNode = K('<span style="display:none;"></span>', doc)[0]; startNode.id = '__kindeditor_bookmark_start_' + (_BOOKMARK_ID++) + '__'; if (!self.collapsed) { endNode = startNode.cloneNode(true); endNode.id = '__kindeditor_bookmark_end_' + (_BOOKMARK_ID++) + '__'; } if (endNode) { self.cloneRange().collapse(false).insertNode(endNode).setEndBefore(endNode); } self.insertNode(startNode).setStartAfter(startNode); return { start : serialize ? '#' + startNode.id : startNode, end : endNode ? (serialize ? '#' + endNode.id : endNode) : null }; }, moveToBookmark : function(bookmark) { var self = this, doc = self.doc, start = K(bookmark.start, doc), end = bookmark.end ? K(bookmark.end, doc) : null; if (!start || start.length < 1) { return self; } self.setStartBefore(start[0]); start.remove(); if (end && end.length > 0) { self.setEndBefore(end[0]); end.remove(); } else { self.collapse(true); } return self; }, dump : function() { console.log('--------------------'); console.log(this.startContainer.nodeType == 3 ? this.startContainer.nodeValue : this.startContainer, this.startOffset); console.log(this.endContainer.nodeType == 3 ? this.endContainer.nodeValue : this.endContainer, this.endOffset); } }); function _range(mixed) { if (!mixed.nodeName) { return mixed.constructor === KRange ? mixed : _toRange(mixed); } return new KRange(mixed); } K.range = _range; K.START_TO_START = _START_TO_START; K.START_TO_END = _START_TO_END; K.END_TO_END = _END_TO_END; K.END_TO_START = _END_TO_START; function _nativeCommand(doc, key, val) { try { doc.execCommand(key, false, val); } catch(e) {} } function _nativeCommandValue(doc, key) { var val = ''; try { val = doc.queryCommandValue(key); } catch (e) {} if (typeof val !== 'string') { val = ''; } return val; } function _getSel(doc) { var win = _getWin(doc); return doc.selection || win.getSelection(); } function _getRng(doc) { var sel = _getSel(doc), rng; try { if (sel.rangeCount > 0) { rng = sel.getRangeAt(0); } else { rng = sel.createRange(); } } catch(e) {} if (_IE && (!rng || (!rng.item && rng.parentElement().ownerDocument !== doc))) { return null; } return rng; } function _singleKeyMap(map) { var newMap = {}, arr, v; _each(map, function(key, val) { arr = key.split(','); for (var i = 0, len = arr.length; i < len; i++) { v = arr[i]; newMap[v] = val; } }); return newMap; } function _hasAttrOrCss(knode, map) { return _hasAttrOrCssByKey(knode, map, '*') || _hasAttrOrCssByKey(knode, map); } function _hasAttrOrCssByKey(knode, map, mapKey) { mapKey = mapKey || knode.name; if (knode.type !== 1) { return false; } var newMap = _singleKeyMap(map); if (!newMap[mapKey]) { return false; } var arr = newMap[mapKey].split(','); for (var i = 0, len = arr.length; i < len; i++) { var key = arr[i]; if (key === '*') { return true; } var match = /^(\.?)([^=]+)(?:=([^=]*))?$/.exec(key); var method = match[1] ? 'css' : 'attr'; key = match[2]; var val = match[3] || ''; if (val === '' && knode[method](key) !== '') { return true; } if (val !== '' && knode[method](key) === val) { return true; } } return false; } function _removeAttrOrCss(knode, map) { if (knode.type != 1) { return; } _removeAttrOrCssByKey(knode, map, '*'); _removeAttrOrCssByKey(knode, map); } function _removeAttrOrCssByKey(knode, map, mapKey) { mapKey = mapKey || knode.name; if (knode.type !== 1) { return; } var newMap = _singleKeyMap(map); if (!newMap[mapKey]) { return; } var arr = newMap[mapKey].split(','), allFlag = false; for (var i = 0, len = arr.length; i < len; i++) { var key = arr[i]; if (key === '*') { allFlag = true; break; } var match = /^(\.?)([^=]+)(?:=([^=]*))?$/.exec(key); key = match[2]; if (match[1]) { key = _toCamel(key); if (knode[0].style[key]) { knode[0].style[key] = ''; } } else { knode.removeAttr(key); } } if (allFlag) { knode.remove(true); } } function _getInnerNode(knode) { var inner = knode; while (inner.first()) { inner = inner.first(); } return inner; } function _isEmptyNode(knode) { return knode.type == 1 && knode.html().replace(/<[^>]+>/g, '') === ''; } function _mergeWrapper(a, b) { a = a.clone(true); var lastA = _getInnerNode(a), childA = a, merged = false; while (b) { while (childA) { if (childA.name === b.name) { _mergeAttrs(childA, b.attr(), b.css()); merged = true; } childA = childA.first(); } if (!merged) { lastA.append(b.clone(false)); } merged = false; b = b.first(); } return a; } function _wrapNode(knode, wrapper) { wrapper = wrapper.clone(true); if (knode.type == 3) { _getInnerNode(wrapper).append(knode.clone(false)); knode.replaceWith(wrapper); return wrapper; } var nodeWrapper = knode, child; while ((child = knode.first()) && child.children().length == 1) { knode = child; } child = knode.first(); var frag = knode.doc.createDocumentFragment(); while (child) { frag.appendChild(child[0]); child = child.next(); } wrapper = _mergeWrapper(nodeWrapper, wrapper); if (frag.firstChild) { _getInnerNode(wrapper).append(frag); } nodeWrapper.replaceWith(wrapper); return wrapper; } function _mergeAttrs(knode, attrs, styles) { _each(attrs, function(key, val) { if (key !== 'style') { knode.attr(key, val); } }); _each(styles, function(key, val) { knode.css(key, val); }); } function _inPreElement(knode) { while (knode && knode.name != 'body') { if (_PRE_TAG_MAP[knode.name] || knode.name == 'div' && knode.hasClass('ke-script')) { return true; } knode = knode.parent(); } return false; } function KCmd(range) { this.init(range); } _extend(KCmd, { init : function(range) { var self = this, doc = range.doc; self.doc = doc; self.win = _getWin(doc); self.sel = _getSel(doc); self.range = range; }, selection : function(forceReset) { var self = this, doc = self.doc, rng = _getRng(doc); self.sel = _getSel(doc); if (rng) { self.range = _range(rng); if (K(self.range.startContainer).name == 'html') { self.range.selectNodeContents(doc.body).collapse(false); } return self; } if (forceReset) { self.range.selectNodeContents(doc.body).collapse(false); } return self; }, select : function(hasDummy) { hasDummy = _undef(hasDummy, true); var self = this, sel = self.sel, range = self.range.cloneRange().shrink(), sc = range.startContainer, so = range.startOffset, ec = range.endContainer, eo = range.endOffset, doc = _getDoc(sc), win = self.win, rng, hasU200b = false; if (hasDummy && sc.nodeType == 1 && range.collapsed) { if (_IE) { var dummy = K('<span>&nbsp;</span>', doc); range.insertNode(dummy[0]); rng = doc.body.createTextRange(); try { rng.moveToElementText(dummy[0]); } catch(ex) {} rng.collapse(false); rng.select(); dummy.remove(); win.focus(); return self; } if (_WEBKIT) { var children = sc.childNodes; if (K(sc).isInline() || so > 0 && K(children[so - 1]).isInline() || children[so] && K(children[so]).isInline()) { range.insertNode(doc.createTextNode('\u200B')); hasU200b = true; } } } if (_IE) { try { rng = range.get(true); rng.select(); } catch(e) {} } else { if (hasU200b) { range.collapse(false); } rng = range.get(true); sel.removeAllRanges(); sel.addRange(rng); } win.focus(); return self; }, wrap : function(val) { var self = this, doc = self.doc, range = self.range, wrapper; wrapper = K(val, doc); if (range.collapsed) { range.shrink(); range.insertNode(wrapper[0]).selectNodeContents(wrapper[0]); return self; } if (wrapper.isBlock()) { var copyWrapper = wrapper.clone(true), child = copyWrapper; while (child.first()) { child = child.first(); } child.append(range.extractContents()); range.insertNode(copyWrapper[0]).selectNode(copyWrapper[0]); return self; } range.enlarge(); var bookmark = range.createBookmark(), ancestor = range.commonAncestor(), isStart = false; K(ancestor).scan(function(node) { if (!isStart && node == bookmark.start) { isStart = true; return; } if (isStart) { if (node == bookmark.end) { return false; } var knode = K(node); if (_inPreElement(knode)) { return; } if (knode.type == 3 && _trim(node.nodeValue).length > 0) { var parent; while ((parent = knode.parent()) && parent.isStyle() && parent.children().length == 1) { knode = parent; } _wrapNode(knode, wrapper); } } }); range.moveToBookmark(bookmark); return self; }, split : function(isStart, map) { var range = this.range, doc = range.doc; var tempRange = range.cloneRange().collapse(isStart); var node = tempRange.startContainer, pos = tempRange.startOffset, parent = node.nodeType == 3 ? node.parentNode : node, needSplit = false, knode; while (parent && parent.parentNode) { knode = K(parent); if (map) { if (!knode.isStyle()) { break; } if (!_hasAttrOrCss(knode, map)) { break; } } else { if (_NOSPLIT_TAG_MAP[knode.name]) { break; } } needSplit = true; parent = parent.parentNode; } if (needSplit) { var dummy = doc.createElement('span'); range.cloneRange().collapse(!isStart).insertNode(dummy); if (isStart) { tempRange.setStartBefore(parent.firstChild).setEnd(node, pos); } else { tempRange.setStart(node, pos).setEndAfter(parent.lastChild); } var frag = tempRange.extractContents(), first = frag.firstChild, last = frag.lastChild; if (isStart) { tempRange.insertNode(frag); range.setStartAfter(last).setEndBefore(dummy); } else { parent.appendChild(frag); range.setStartBefore(dummy).setEndBefore(first); } var dummyParent = dummy.parentNode; if (dummyParent == range.endContainer) { var prev = K(dummy).prev(), next = K(dummy).next(); if (prev && next && prev.type == 3 && next.type == 3) { range.setEnd(prev[0], prev[0].nodeValue.length); } else if (!isStart) { range.setEnd(range.endContainer, range.endOffset - 1); } } dummyParent.removeChild(dummy); } return this; }, remove : function(map) { var self = this, doc = self.doc, range = self.range; range.enlarge(); if (range.startOffset === 0) { var ksc = K(range.startContainer), parent; while ((parent = ksc.parent()) && parent.isStyle() && parent.children().length == 1) { ksc = parent; } range.setStart(ksc[0], 0); ksc = K(range.startContainer); if (ksc.isBlock()) { _removeAttrOrCss(ksc, map); } var kscp = ksc.parent(); if (kscp && kscp.isBlock()) { _removeAttrOrCss(kscp, map); } } var sc, so; if (range.collapsed) { self.split(true, map); sc = range.startContainer; so = range.startOffset; if (so > 0) { var sb = K(sc.childNodes[so - 1]); if (sb && _isEmptyNode(sb)) { sb.remove(); range.setStart(sc, so - 1); } } var sa = K(sc.childNodes[so]); if (sa && _isEmptyNode(sa)) { sa.remove(); } if (_isEmptyNode(sc)) { range.startBefore(sc); sc.remove(); } range.collapse(true); return self; } self.split(true, map); self.split(false, map); var startDummy = doc.createElement('span'), endDummy = doc.createElement('span'); range.cloneRange().collapse(false).insertNode(endDummy); range.cloneRange().collapse(true).insertNode(startDummy); var nodeList = [], cmpStart = false; K(range.commonAncestor()).scan(function(node) { if (!cmpStart && node == startDummy) { cmpStart = true; return; } if (node == endDummy) { return false; } if (cmpStart) { nodeList.push(node); } }); K(startDummy).remove(); K(endDummy).remove(); sc = range.startContainer; so = range.startOffset; var ec = range.endContainer, eo = range.endOffset; if (so > 0) { var startBefore = K(sc.childNodes[so - 1]); if (startBefore && _isEmptyNode(startBefore)) { startBefore.remove(); range.setStart(sc, so - 1); if (sc == ec) { range.setEnd(ec, eo - 1); } } var startAfter = K(sc.childNodes[so]); if (startAfter && _isEmptyNode(startAfter)) { startAfter.remove(); if (sc == ec) { range.setEnd(ec, eo - 1); } } } var endAfter = K(ec.childNodes[range.endOffset]); if (endAfter && _isEmptyNode(endAfter)) { endAfter.remove(); } var bookmark = range.createBookmark(true); _each(nodeList, function(i, node) { _removeAttrOrCss(K(node), map); }); range.moveToBookmark(bookmark); return self; }, commonNode : function(map) { var range = this.range; var ec = range.endContainer, eo = range.endOffset, node = (ec.nodeType == 3 || eo === 0) ? ec : ec.childNodes[eo - 1]; function find(node) { var child = node, parent = node; while (parent) { if (_hasAttrOrCss(K(parent), map)) { return K(parent); } parent = parent.parentNode; } while (child && (child = child.lastChild)) { if (_hasAttrOrCss(K(child), map)) { return K(child); } } return null; } var cNode = find(node); if (cNode) { return cNode; } if (node.nodeType == 1 || (ec.nodeType == 3 && eo === 0)) { var prev = K(node).prev(); if (prev) { return find(prev); } } return null; }, commonAncestor : function(tagName) { var range = this.range, sc = range.startContainer, so = range.startOffset, ec = range.endContainer, eo = range.endOffset, startNode = (sc.nodeType == 3 || so === 0) ? sc : sc.childNodes[so - 1], endNode = (ec.nodeType == 3 || eo === 0) ? ec : ec.childNodes[eo - 1]; function find(node) { while (node) { if (node.nodeType == 1) { if (node.tagName.toLowerCase() === tagName) { return node; } } node = node.parentNode; } return null; } var start = find(startNode), end = find(endNode); if (start && end && start === end) { return K(start); } return null; }, state : function(key) { var self = this, doc = self.doc, bool = false; try { bool = doc.queryCommandState(key); } catch (e) {} return bool; }, val : function(key) { var self = this, doc = self.doc, range = self.range; function lc(val) { return val.toLowerCase(); } key = lc(key); var val = '', knode; if (key === 'fontfamily' || key === 'fontname') { val = _nativeCommandValue(doc, 'fontname'); val = val.replace(/['"]/g, ''); return lc(val); } if (key === 'formatblock') { val = _nativeCommandValue(doc, key); if (val === '') { knode = self.commonNode({'h1,h2,h3,h4,h5,h6,p,div,pre,address' : '*'}); if (knode) { val = knode.name; } } if (val === 'Normal') { val = 'p'; } return lc(val); } if (key === 'fontsize') { knode = self.commonNode({'*' : '.font-size'}); if (knode) { val = knode.css('font-size'); } return lc(val); } if (key === 'forecolor') { knode = self.commonNode({'*' : '.color'}); if (knode) { val = knode.css('color'); } val = _toHex(val); if (val === '') { val = 'default'; } return lc(val); } if (key === 'hilitecolor') { knode = self.commonNode({'*' : '.background-color'}); if (knode) { val = knode.css('background-color'); } val = _toHex(val); if (val === '') { val = 'default'; } return lc(val); } return val; }, toggle : function(wrapper, map) { var self = this; if (self.commonNode(map)) { self.remove(map); } else { self.wrap(wrapper); } return self.select(); }, bold : function() { return this.toggle('<strong></strong>', { span : '.font-weight=bold', strong : '*', b : '*' }); }, italic : function() { return this.toggle('<em></em>', { span : '.font-style=italic', em : '*', i : '*' }); }, underline : function() { return this.toggle('<u></u>', { span : '.text-decoration=underline', u : '*' }); }, strikethrough : function() { return this.toggle('<s></s>', { span : '.text-decoration=line-through', s : '*' }); }, forecolor : function(val) { return this.toggle('<span style="color:' + val + ';"></span>', { span : '.color=' + val, font : 'color' }); }, hilitecolor : function(val) { return this.toggle('<span style="background-color:' + val + ';"></span>', { span : '.background-color=' + val }); }, fontsize : function(val) { return this.toggle('<span style="font-size:' + val + ';"></span>', { span : '.font-size=' + val, font : 'size' }); }, fontname : function(val) { return this.fontfamily(val); }, fontfamily : function(val) { return this.toggle('<span style="font-family:' + val + ';"></span>', { span : '.font-family=' + val, font : 'face' }); }, removeformat : function() { var map = { '*' : '.font-weight,.font-style,.text-decoration,.color,.background-color,.font-size,.font-family,.text-indent' }, tags = _STYLE_TAG_MAP; _each(tags, function(key, val) { map[key] = '*'; }); this.remove(map); return this.select(); }, inserthtml : function(val) { var self = this, range = self.range; if (val === '') { return self; } if (_inPreElement(K(range.startContainer))) { return self; } function pasteHtml(range, val) { val = '<img id="__kindeditor_temp_tag__" width="0" height="0" style="display:none;" />' + val; var rng = range.get(); if (rng.item) { rng.item(0).outerHTML = val; } else { rng.pasteHTML(val); } var temp = range.doc.getElementById('__kindeditor_temp_tag__'); temp.parentNode.removeChild(temp); var newRange = _toRange(rng); range.setEnd(newRange.endContainer, newRange.endOffset); range.collapse(false); self.select(false); } function insertHtml(range, val) { var doc = range.doc, frag = doc.createDocumentFragment(); K('@' + val, doc).each(function() { frag.appendChild(this); }); range.deleteContents(); range.insertNode(frag); range.collapse(false); self.select(false); } if (_IE) { try { pasteHtml(range, val); } catch(e) { insertHtml(range, val); } return self; } insertHtml(range, val); return self; }, hr : function() { return this.inserthtml('<hr />'); }, print : function() { this.win.print(); return this; }, insertimage : function(url, title, width, height, border, align) { title = _undef(title, ''); border = _undef(border, 0); var html = '<img src="' + _escape(url) + '" data-ke-src="' + _escape(url) + '" '; if (width) { html += 'width="' + _escape(width) + '" '; } if (height) { html += 'height="' + _escape(height) + '" '; } if (title) { html += 'title="' + _escape(title) + '" '; } if (align) { html += 'align="' + _escape(align) + '" '; } html += 'alt="' + _escape(title) + '" '; html += '/>'; return this.inserthtml(html); }, createlink : function(url, type) { var self = this, doc = self.doc, range = self.range; self.select(); var a = self.commonNode({ a : '*' }); if (a && !range.isControl()) { range.selectNode(a.get()); self.select(); } var html = '<a href="' + _escape(url) + '" data-ke-src="' + _escape(url) + '" '; if (type) { html += ' target="' + _escape(type) + '"'; } if (range.collapsed) { html += '>' + _escape(url) + '</a>'; return self.inserthtml(html); } if (range.isControl()) { var node = K(range.startContainer.childNodes[range.startOffset]); html += '></a>'; node.after(K(html, doc)); node.next().append(node); range.selectNode(node[0]); return self.select(); } _nativeCommand(doc, 'createlink', '__kindeditor_temp_url__'); K('a[href="__kindeditor_temp_url__"]', doc).each(function() { K(this).attr('href', url).attr('data-ke-src', url); if (type) { K(this).attr('target', type); } else { K(this).removeAttr('target'); } }); return self; }, unlink : function() { var self = this, doc = self.doc, range = self.range; self.select(); if (range.collapsed) { var a = self.commonNode({ a : '*' }); if (a) { range.selectNode(a.get()); self.select(); } _nativeCommand(doc, 'unlink', null); if (_WEBKIT && K(range.startContainer).name === 'img') { var parent = K(range.startContainer).parent(); if (parent.name === 'a') { parent.remove(true); } } } else { _nativeCommand(doc, 'unlink', null); } return self; } }); _each(('formatblock,selectall,justifyleft,justifycenter,justifyright,justifyfull,insertorderedlist,' + 'insertunorderedlist,indent,outdent,subscript,superscript').split(','), function(i, name) { KCmd.prototype[name] = function(val) { var self = this; self.select(); _nativeCommand(self.doc, name, val); if (!_IE || _inArray(name, 'formatblock,selectall,insertorderedlist,insertunorderedlist'.split(',')) >= 0) { self.selection(); } return self; }; }); _each('cut,copy,paste'.split(','), function(i, name) { KCmd.prototype[name] = function() { var self = this; if (!self.doc.queryCommandSupported(name)) { throw 'not supported'; } self.select(); _nativeCommand(self.doc, name, null); return self; }; }); function _cmd(mixed) { if (mixed.nodeName) { var doc = _getDoc(mixed); mixed = _range(doc).selectNodeContents(doc.body).collapse(false); } return new KCmd(mixed); } K.cmd = _cmd; function _drag(options) { var moveEl = options.moveEl, moveFn = options.moveFn, clickEl = options.clickEl || moveEl, beforeDrag = options.beforeDrag, iframeFix = options.iframeFix === undefined ? true : options.iframeFix; var docs = [document], poss = [{ x : 0, y : 0}], listeners = []; if (iframeFix) { K('iframe').each(function() { var doc; try { doc = _iframeDoc(this); K(doc); } catch(e) { doc = null; } if (doc) { docs.push(doc); poss.push(K(this).pos()); } }); } clickEl.mousedown(function(e) { var self = clickEl.get(), x = _removeUnit(moveEl.css('left')), y = _removeUnit(moveEl.css('top')), width = moveEl.width(), height = moveEl.height(), pageX = e.pageX, pageY = e.pageY, dragging = true; if (beforeDrag) { beforeDrag(); } _each(docs, function(i, doc) { function moveListener(e) { if (dragging) { var diffX = _round(poss[i].x + e.pageX - pageX), diffY = _round(poss[i].y + e.pageY - pageY); moveFn.call(clickEl, x, y, width, height, diffX, diffY); } e.stop(); } function selectListener(e) { e.stop(); } function upListener(e) { dragging = false; if (self.releaseCapture) { self.releaseCapture(); } _each(listeners, function() { K(this.doc).unbind('mousemove', this.move) .unbind('mouseup', this.up) .unbind('selectstart', this.select); }); e.stop(); } K(doc).mousemove(moveListener) .mouseup(upListener) .bind('selectstart', selectListener); listeners.push({ doc : doc, move : moveListener, up : upListener, select : selectListener }); }); if (self.setCapture) { self.setCapture(); } e.stop(); }); } function KWidget(options) { this.init(options); } _extend(KWidget, { init : function(options) { var self = this; self.name = options.name || ''; self.doc = options.doc || document; self.win = _getWin(self.doc); self.x = _addUnit(options.x); self.y = _addUnit(options.y); self.z = options.z; self.width = _addUnit(options.width); self.height = _addUnit(options.height); self.div = K('<div style="display:block;"></div>'); self.options = options; self._alignEl = options.alignEl; if (self.width) { self.div.css('width', self.width); } if (self.height) { self.div.css('height', self.height); } if (self.z) { self.div.css({ position : 'absolute', left : self.x, top : self.y, 'z-index' : self.z }); } if (self.z && (self.x === undefined || self.y === undefined)) { self.autoPos(self.width, self.height); } if (options.cls) { self.div.addClass(options.cls); } if (options.shadowMode) { self.div.addClass('ke-shadow'); } if (options.css) { self.div.css(options.css); } if (options.src) { K(options.src).replaceWith(self.div); } else { K(self.doc.body).append(self.div); } if (options.html) { self.div.html(options.html); } if (options.autoScroll) { if (_IE && _V < 7 || _QUIRKS) { var scrollPos = _getScrollPos(); K(self.win).bind('scroll', function(e) { var pos = _getScrollPos(), diffX = pos.x - scrollPos.x, diffY = pos.y - scrollPos.y; self.pos(_removeUnit(self.x) + diffX, _removeUnit(self.y) + diffY, false); }); } else { self.div.css('position', 'fixed'); } } }, pos : function(x, y, updateProp) { var self = this; updateProp = _undef(updateProp, true); if (x !== null) { x = x < 0 ? 0 : _addUnit(x); self.div.css('left', x); if (updateProp) { self.x = x; } } if (y !== null) { y = y < 0 ? 0 : _addUnit(y); self.div.css('top', y); if (updateProp) { self.y = y; } } return self; }, autoPos : function(width, height) { var self = this, w = _removeUnit(width) || 0, h = _removeUnit(height) || 0, scrollPos = _getScrollPos(); if (self._alignEl) { var knode = K(self._alignEl), pos = knode.pos(), diffX = _round(knode[0].clientWidth / 2 - w / 2), diffY = _round(knode[0].clientHeight / 2 - h / 2); x = diffX < 0 ? pos.x : pos.x + diffX; y = diffY < 0 ? pos.y : pos.y + diffY; } else { var docEl = _docElement(self.doc); x = _round(scrollPos.x + (docEl.clientWidth - w) / 2); y = _round(scrollPos.y + (docEl.clientHeight - h) / 2); } if (!(_IE && _V < 7 || _QUIRKS)) { x -= scrollPos.x; y -= scrollPos.y; } return self.pos(x, y); }, remove : function() { var self = this; if (_IE && _V < 7) { K(self.win).unbind('scroll'); } self.div.remove(); _each(self, function(i) { self[i] = null; }); return this; }, show : function() { this.div.show(); return this; }, hide : function() { this.div.hide(); return this; }, draggable : function(options) { var self = this; options = options || {}; options.moveEl = self.div; options.moveFn = function(x, y, width, height, diffX, diffY) { if ((x = x + diffX) < 0) { x = 0; } if ((y = y + diffY) < 0) { y = 0; } self.pos(x, y); }; _drag(options); return self; } }); function _widget(options) { return new KWidget(options); } K.WidgetClass = KWidget; K.widget = _widget; function _iframeDoc(iframe) { iframe = _get(iframe); return iframe.contentDocument || iframe.contentWindow.document; } function _getInitHtml(themesPath, bodyClass, cssPath, cssData) { var arr = [ '<html><head><meta charset="utf-8" /><title>KindEditor</title>', '<style>', 'html {margin:0;padding:0;}', 'body {margin:0;padding:5px;}', 'body, td {font:12px/1.5 "sans serif",tahoma,verdana,helvetica;}', 'body, p, div {word-wrap: break-word;}', 'p {margin:5px 0;}', 'table {border-collapse:collapse;}', 'img {border:0;}', 'table.ke-zeroborder td {border:1px dotted #AAA;}', 'img.ke-flash {', ' border:1px solid #AAA;', ' background-image:url(' + themesPath + 'common/flash.gif);', ' background-position:center center;', ' background-repeat:no-repeat;', ' width:100px;', ' height:100px;', '}', 'img.ke-rm {', ' border:1px solid #AAA;', ' background-image:url(' + themesPath + 'common/rm.gif);', ' background-position:center center;', ' background-repeat:no-repeat;', ' width:100px;', ' height:100px;', '}', 'img.ke-media {', ' border:1px solid #AAA;', ' background-image:url(' + themesPath + 'common/media.gif);', ' background-position:center center;', ' background-repeat:no-repeat;', ' width:100px;', ' height:100px;', '}', 'img.ke-anchor {', ' border:1px dashed #666;', ' width:16px;', ' height:16px;', '}', '.ke-script {', ' display:none;', ' font-size:0;', ' width:0;', ' height:0;', '}', '.ke-pagebreak {', ' border:1px dotted #AAA;', ' font-size:0;', ' height:2px;', '}', '</style>' ]; if (!_isArray(cssPath)) { cssPath = [cssPath]; } _each(cssPath, function(i, path) { if (path) { arr.push('<link href="' + path + '" rel="stylesheet" />'); } }); if (cssData) { arr.push('<style>' + cssData + '</style>'); } arr.push('</head><body ' + (bodyClass ? 'class="' + bodyClass + '"' : '') + '></body></html>'); return arr.join('\n'); } function _elementVal(knode, val) { return knode.hasVal() ? knode.val(val) : knode.html(val); } function KEdit(options) { this.init(options); } _extend(KEdit, KWidget, { init : function(options) { var self = this; KEdit.parent.init.call(self, options); self.srcElement = K(options.srcElement); self.div.addClass('ke-edit'); self.designMode = _undef(options.designMode, true); self.beforeGetHtml = options.beforeGetHtml; self.beforeSetHtml = options.beforeSetHtml; self.afterSetHtml = options.afterSetHtml; var themesPath = _undef(options.themesPath, ''), bodyClass = options.bodyClass, cssPath = options.cssPath, cssData = options.cssData, isDocumentDomain = location.host.replace(/:\d+/, '') !== document.domain, srcScript = ('document.open();' + (isDocumentDomain ? 'document.domain="' + document.domain + '";' : '') + 'document.close();'), iframeSrc = _IE ? ' src="javascript:void(function(){' + encodeURIComponent(srcScript) + '}())"' : ''; self.iframe = K('<iframe class="ke-edit-iframe" hidefocus="true" frameborder="0"' + iframeSrc + '></iframe>').css('width', '100%'); self.textarea = K('<textarea class="ke-edit-textarea" hidefocus="true"></textarea>').css('width', '100%'); if (self.width) { self.setWidth(self.width); } if (self.height) { self.setHeight(self.height); } if (self.designMode) { self.textarea.hide(); } else { self.iframe.hide(); } function ready() { var doc = _iframeDoc(self.iframe); doc.open(); if (isDocumentDomain) { doc.domain = document.domain; } doc.write(_getInitHtml(themesPath, bodyClass, cssPath, cssData)); doc.close(); self.win = self.iframe[0].contentWindow; self.doc = doc; var cmd = _cmd(doc); self.afterChange(function(e) { cmd.selection(); }); if (_WEBKIT) { K(doc).click(function(e) { if (K(e.target).name === 'img') { cmd.selection(true); cmd.range.selectNode(e.target); cmd.select(); } }); } if (_IE) { K(doc).keydown(function(e) { if (e.which == 8) { cmd.selection(); var rng = cmd.range; if (rng.isControl()) { rng.collapse(true); K(rng.startContainer.childNodes[rng.startOffset]).remove(); e.preventDefault(); } } }); } self.cmd = cmd; self.html(_elementVal(self.srcElement)); if (_IE) { doc.body.disabled = true; doc.body.contentEditable = true; doc.body.removeAttribute('disabled'); } else { doc.designMode = 'on'; } if (options.afterCreate) { options.afterCreate.call(self); } } if (isDocumentDomain) { self.iframe.bind('load', function(e) { self.iframe.unbind('load'); if (_IE) { ready(); } else { setTimeout(ready, 0); } }); } self.div.append(self.iframe); self.div.append(self.textarea); self.srcElement.hide(); !isDocumentDomain && ready(); }, setWidth : function(val) { this.div.css('width', _addUnit(val)); return this; }, setHeight : function(val) { var self = this; val = _addUnit(val); self.div.css('height', val); self.iframe.css('height', val); if ((_IE && _V < 8) || _QUIRKS) { val = _addUnit(_removeUnit(val) - 2); } self.textarea.css('height', val); return self; }, remove : function() { var self = this, doc = self.doc; K(doc.body).unbind(); K(doc).unbind(); K(self.win).unbind(); _elementVal(self.srcElement, self.html()); self.srcElement.show(); doc.write(''); self.iframe.unbind(); self.textarea.unbind(); KEdit.parent.remove.call(self); }, html : function(val, isFull) { var self = this, doc = self.doc; if (self.designMode) { var body = doc.body; if (val === undefined) { if (isFull) { val = '<!doctype html><html>' + body.parentNode.innerHTML + '</html>'; } else { val = body.innerHTML; } if (self.beforeGetHtml) { val = self.beforeGetHtml(val); } if (_GECKO && val == '<br />') { val = ''; } return val; } if (self.beforeSetHtml) { val = self.beforeSetHtml(val); } K(body).html(val); if (self.afterSetHtml) { self.afterSetHtml(); } return self; } if (val === undefined) { return self.textarea.val(); } self.textarea.val(val); return self; }, design : function(bool) { var self = this, val; if (bool === undefined ? !self.designMode : bool) { if (!self.designMode) { val = self.html(); self.designMode = true; self.html(val); self.textarea.hide(); self.iframe.show(); } } else { if (self.designMode) { val = self.html(); self.designMode = false; self.html(val); self.iframe.hide(); self.textarea.show(); } } return self.focus(); }, focus : function() { var self = this; self.designMode ? self.win.focus() : self.textarea[0].focus(); return self; }, blur : function() { var self = this; if (_IE) { var input = K('<input type="text" style="float:left;width:0;height:0;padding:0;margin:0;border:0;" value="" />', self.div); self.div.append(input); input[0].focus(); input.remove(); } else { self.designMode ? self.win.blur() : self.textarea[0].blur(); } return self; }, afterChange : function(fn) { var self = this, doc = self.doc, body = doc.body; K(doc).keyup(function(e) { if (!e.ctrlKey && !e.altKey && _CHANGE_KEY_MAP[e.which]) { fn(e); } }); K(doc).mouseup(fn).contextmenu(fn); K(self.win).blur(fn); function timeoutHandler(e) { setTimeout(function() { fn(e); }, 1); } K(body).bind('paste', timeoutHandler); K(body).bind('cut', timeoutHandler); return self; } }); function _edit(options) { return new KEdit(options); } K.edit = _edit; K.iframeDoc = _iframeDoc; function _selectToolbar(name, fn) { var self = this, knode = self.get(name); if (knode) { if (knode.hasClass('ke-disabled')) { return; } fn(knode); } } function KToolbar(options) { this.init(options); } _extend(KToolbar, KWidget, { init : function(options) { var self = this; KToolbar.parent.init.call(self, options); self.disableMode = _undef(options.disableMode, false); self.noDisableItemMap = _toMap(_undef(options.noDisableItems, [])); self._itemMap = {}; self.div.addClass('ke-toolbar').bind('contextmenu,mousedown,mousemove', function(e) { e.preventDefault(); }).attr('unselectable', 'on'); function find(target) { var knode = K(target); if (knode.hasClass('ke-outline')) { return knode; } if (knode.hasClass('ke-toolbar-icon')) { return knode.parent(); } } function hover(e, method) { var knode = find(e.target); if (knode) { if (knode.hasClass('ke-disabled')) { return; } if (knode.hasClass('ke-selected')) { return; } knode[method]('ke-on'); } } self.div.mouseover(function(e) { hover(e, 'addClass'); }) .mouseout(function(e) { hover(e, 'removeClass'); }) .click(function(e) { var knode = find(e.target); if (knode) { if (knode.hasClass('ke-disabled')) { return; } self.options.click.call(this, e, knode.attr('data-name')); } }); }, get : function(name) { if (this._itemMap[name]) { return this._itemMap[name]; } return (this._itemMap[name] = K('span.ke-icon-' + name, this.div).parent()); }, select : function(name) { _selectToolbar.call(this, name, function(knode) { knode.addClass('ke-selected'); }); return self; }, unselect : function(name) { _selectToolbar.call(this, name, function(knode) { knode.removeClass('ke-selected').removeClass('ke-on'); }); return self; }, enable : function(name) { var self = this, knode = name.get ? name : self.get(name); if (knode) { knode.removeClass('ke-disabled'); knode.opacity(1); } return self; }, disable : function(name) { var self = this, knode = name.get ? name : self.get(name); if (knode) { knode.removeClass('ke-selected').addClass('ke-disabled'); knode.opacity(0.5); } return self; }, disableAll : function(bool, noDisableItems) { var self = this, map = self.noDisableItemMap, item; if (noDisableItems) { map = _toMap(noDisableItems); } if (bool === undefined ? !self.disableMode : bool) { K('span.ke-outline', self.div).each(function() { var knode = K(this), name = knode[0].getAttribute('data-name', 2); if (!map[name]) { self.disable(knode); } }); self.disableMode = true; } else { K('span.ke-outline', self.div).each(function() { var knode = K(this), name = knode[0].getAttribute('data-name', 2); if (!map[name]) { self.enable(knode); } }); self.disableMode = false; } return self; } }); function _toolbar(options) { return new KToolbar(options); } K.toolbar = _toolbar; function KMenu(options) { this.init(options); } _extend(KMenu, KWidget, { init : function(options) { var self = this; options.z = options.z || 811213; KMenu.parent.init.call(self, options); self.centerLineMode = _undef(options.centerLineMode, true); self.div.addClass('ke-menu').bind('click,mousedown', function(e){ e.stopPropagation(); }).attr('unselectable', 'on'); }, addItem : function(item) { var self = this; if (item.title === '-') { self.div.append(K('<div class="ke-menu-separator"></div>')); return; } var itemDiv = K('<div class="ke-menu-item" unselectable="on"></div>'), leftDiv = K('<div class="ke-inline-block ke-menu-item-left"></div>'), rightDiv = K('<div class="ke-inline-block ke-menu-item-right"></div>'), height = _addUnit(item.height), iconClass = _undef(item.iconClass, ''); self.div.append(itemDiv); if (height) { itemDiv.css('height', height); rightDiv.css('line-height', height); } var centerDiv; if (self.centerLineMode) { centerDiv = K('<div class="ke-inline-block ke-menu-item-center"></div>'); if (height) { centerDiv.css('height', height); } } itemDiv.mouseover(function(e) { K(this).addClass('ke-menu-item-on'); if (centerDiv) { centerDiv.addClass('ke-menu-item-center-on'); } }) .mouseout(function(e) { K(this).removeClass('ke-menu-item-on'); if (centerDiv) { centerDiv.removeClass('ke-menu-item-center-on'); } }) .click(function(e) { item.click.call(K(this)); e.stopPropagation(); }) .append(leftDiv); if (centerDiv) { itemDiv.append(centerDiv); } itemDiv.append(rightDiv); if (item.checked) { iconClass = 'ke-icon-checked'; } if (iconClass !== '') { leftDiv.html('<span class="ke-inline-block ke-toolbar-icon ke-toolbar-icon-url ' + iconClass + '"></span>'); } rightDiv.html(item.title); return self; }, remove : function() { var self = this; if (self.options.beforeRemove) { self.options.beforeRemove.call(self); } K('.ke-menu-item', self.div[0]).unbind(); KMenu.parent.remove.call(self); return self; } }); function _menu(options) { return new KMenu(options); } K.menu = _menu; function KColorPicker(options) { this.init(options); } _extend(KColorPicker, KWidget, { init : function(options) { var self = this; options.z = options.z || 811213; KColorPicker.parent.init.call(self, options); var colors = options.colors || [ ['#E53333', '#E56600', '#FF9900', '#64451D', '#DFC5A4', '#FFE500'], ['#009900', '#006600', '#99BB00', '#B8D100', '#60D978', '#00D5FF'], ['#337FE5', '#003399', '#4C33E5', '#9933E5', '#CC33E5', '#EE33EE'], ['#FFFFFF', '#CCCCCC', '#999999', '#666666', '#333333', '#000000'] ]; self.selectedColor = (options.selectedColor || '').toLowerCase(); self._cells = []; self.div.addClass('ke-colorpicker').bind('click,mousedown', function(e){ e.stopPropagation(); }).attr('unselectable', 'on'); var table = self.doc.createElement('table'); self.div.append(table); table.className = 'ke-colorpicker-table'; table.cellPadding = 0; table.cellSpacing = 0; table.border = 0; var row = table.insertRow(0), cell = row.insertCell(0); cell.colSpan = colors[0].length; self._addAttr(cell, '', 'ke-colorpicker-cell-top'); for (var i = 0; i < colors.length; i++) { row = table.insertRow(i + 1); for (var j = 0; j < colors[i].length; j++) { cell = row.insertCell(j); self._addAttr(cell, colors[i][j], 'ke-colorpicker-cell'); } } }, _addAttr : function(cell, color, cls) { var self = this; cell = K(cell).addClass(cls); if (self.selectedColor === color.toLowerCase()) { cell.addClass('ke-colorpicker-cell-selected'); } cell.attr('title', color || self.options.noColor); cell.mouseover(function(e) { K(this).addClass('ke-colorpicker-cell-on'); }); cell.mouseout(function(e) { K(this).removeClass('ke-colorpicker-cell-on'); }); cell.click(function(e) { e.stop(); self.options.click.call(K(this), color); }); if (color) { cell.append(K('<div class="ke-colorpicker-cell-color" unselectable="on"></div>').css('background-color', color)); } else { cell.html(self.options.noColor); } K(cell).attr('unselectable', 'on'); self._cells.push(cell); }, remove : function() { var self = this; _each(self._cells, function() { this.unbind(); }); KColorPicker.parent.remove.call(self); return self; } }); function _colorpicker(options) { return new KColorPicker(options); } K.colorpicker = _colorpicker; function KUploadButton(options) { this.init(options); } _extend(KUploadButton, { init : function(options) { var self = this, button = K(options.button), fieldName = options.fieldName || 'file', url = options.url || '', title = button.val(), cls = button[0].className || '', target = 'kindeditor_upload_iframe_' + new Date().getTime(); options.afterError = options.afterError || function(str) { alert(str); }; var html = [ '<div class="ke-inline-block ' + cls + '">', '<iframe name="' + target + '" style="display:none;"></iframe>', '<form class="ke-upload-area ke-form" method="post" enctype="multipart/form-data" target="' + target + '" action="' + url + '">', '<span class="ke-button-common">', '<input type="button" class="ke-button-common ke-button" value="' + title + '" />', '</span>', '<input type="file" class="ke-upload-file" name="' + fieldName + '" tabindex="-1" />', '</form></div>'].join(''); var div = K(html, button.doc); button.hide(); button.before(div); self.div = div; self.button = button; self.iframe = K('iframe', div); self.form = K('form', div); self.fileBox = K('.ke-upload-file', div).width(K('.ke-button-common').width()); self.options = options; }, submit : function() { var self = this, iframe = self.iframe; iframe.bind('load', function() { iframe.unbind(); var doc = K.iframeDoc(iframe), pre = doc.getElementsByTagName('pre')[0], str = '', data; if (pre) { str = pre.innerHTML; } else { str = doc.body.innerHTML; } try { data = K.json(str); } catch (e) { self.options.afterError.call(self, '<!doctype html><html>' + doc.body.parentNode.innerHTML + '</html>'); } if (data) { self.options.afterUpload.call(self, data); } }); self.form[0].submit(); var tempForm = document.createElement('form'); self.fileBox.before(tempForm); K(tempForm).append(self.fileBox); tempForm.reset(); K(tempForm).remove(true); return self; }, remove : function() { var self = this; if (self.fileBox) { self.fileBox.unbind(); } self.div.remove(); self.button.show(); return self; } }); function _uploadbutton(options) { return new KUploadButton(options); } K.uploadbutton = _uploadbutton; function _createButton(arg) { arg = arg || {}; var name = arg.name || '', span = K('<span class="ke-button-common ke-button-outer" title="' + name + '"></span>'), btn = K('<input class="ke-button-common ke-button" type="button" value="' + name + '" />'); if (arg.click) { btn.click(arg.click); } span.append(btn); return span; } function KDialog(options) { this.init(options); } _extend(KDialog, KWidget, { init : function(options) { var self = this; var shadowMode = _undef(options.shadowMode, true); options.z = options.z || 811213; options.shadowMode = false; KDialog.parent.init.call(self, options); var title = options.title, body = K(options.body, self.doc), previewBtn = options.previewBtn, yesBtn = options.yesBtn, noBtn = options.noBtn, closeBtn = options.closeBtn, showMask = _undef(options.showMask, true); self.div.addClass('ke-dialog').bind('click,mousedown', function(e){ e.stopPropagation(); }); var contentDiv = K('<div class="ke-dialog-content"></div>').appendTo(self.div); if (_IE && _V < 7) { self.iframeMask = K('<iframe src="about:blank" class="ke-dialog-shadow"></iframe>').appendTo(self.div); } else if (shadowMode) { K('<div class="ke-dialog-shadow"></div>').appendTo(self.div); } var headerDiv = K('<div class="ke-dialog-header"></div>'); contentDiv.append(headerDiv); headerDiv.html(title); self.closeIcon = K('<span class="ke-dialog-icon-close" title="' + closeBtn.name + '"></span>').click(closeBtn.click); headerDiv.append(self.closeIcon); self.draggable({ clickEl : headerDiv, beforeDrag : options.beforeDrag }); var bodyDiv = K('<div class="ke-dialog-body"></div>'); contentDiv.append(bodyDiv); bodyDiv.append(body); var footerDiv = K('<div class="ke-dialog-footer"></div>'); if (previewBtn || yesBtn || noBtn) { contentDiv.append(footerDiv); } _each([ { btn : previewBtn, name : 'preview' }, { btn : yesBtn, name : 'yes' }, { btn : noBtn, name : 'no' } ], function() { if (this.btn) { var button = _createButton(this.btn); button.addClass('ke-dialog-' + this.name); footerDiv.append(button); } }); if (self.height) { bodyDiv.height(_removeUnit(self.height) - headerDiv.height() - footerDiv.height()); } self.div.width(self.div.width()); self.div.height(self.div.height()); self.mask = null; if (showMask) { var docEl = _docElement(self.doc), docWidth = Math.max(docEl.scrollWidth, docEl.clientWidth), docHeight = Math.max(docEl.scrollHeight, docEl.clientHeight); self.mask = _widget({ x : 0, y : 0, z : self.z - 1, cls : 'ke-dialog-mask', width : docWidth, height : docHeight }); } self.autoPos(self.div.width(), self.div.height()); self.footerDiv = footerDiv; self.bodyDiv = bodyDiv; self.headerDiv = headerDiv; }, setMaskIndex : function(z) { var self = this; self.mask.div.css('z-index', z); }, showLoading : function(msg) { msg = _undef(msg, ''); var self = this, body = self.bodyDiv; self.loading = K('<div class="ke-dialog-loading"><div class="ke-inline-block ke-dialog-loading-content" style="margin-top:' + Math.round(body.height() / 3) + 'px;">' + msg + '</div></div>') .width(body.width()).height(body.height()) .css('top', self.headerDiv.height() + 'px'); body.css('visibility', 'hidden').after(self.loading); return self; }, hideLoading : function() { this.loading && this.loading.remove(); this.bodyDiv.css('visibility', 'visible'); return this; }, remove : function() { var self = this; if (self.options.beforeRemove) { self.options.beforeRemove.call(self); } self.mask && self.mask.remove(); self.iframeMask && self.iframeMask.remove(); self.closeIcon.unbind(); K('input', self.div).unbind(); self.footerDiv.unbind(); self.bodyDiv.unbind(); self.headerDiv.unbind(); KDialog.parent.remove.call(self); return self; } }); function _dialog(options) { return new KDialog(options); } K.dialog = _dialog; function _tabs(options) { var self = _widget(options), remove = self.remove, afterSelect = options.afterSelect, div = self.div, liList = []; div.addClass('ke-tabs') .bind('contextmenu,mousedown,mousemove', function(e) { e.preventDefault(); }); var ul = K('<ul class="ke-tabs-ul ke-clearfix"></ul>'); div.append(ul); self.add = function(tab) { var li = K('<li class="ke-tabs-li">' + tab.title + '</li>'); li.data('tab', tab); liList.push(li); ul.append(li); }; self.selectedIndex = 0; self.select = function(index) { self.selectedIndex = index; _each(liList, function(i, li) { li.unbind(); if (i === index) { li.addClass('ke-tabs-li-selected'); K(li.data('tab').panel).show(''); } else { li.removeClass('ke-tabs-li-selected').removeClass('ke-tabs-li-on') .mouseover(function() { K(this).addClass('ke-tabs-li-on'); }) .mouseout(function() { K(this).removeClass('ke-tabs-li-on'); }) .click(function() { self.select(i); }); K(li.data('tab').panel).hide(); } }); if (afterSelect) { afterSelect.call(self, index); } }; self.remove = function() { _each(liList, function() { this.remove(); }); ul.remove(); remove.call(self); }; return self; } K.tabs = _tabs; function _loadScript(url, fn) { var head = document.getElementsByTagName('head')[0] || (_QUIRKS ? document.body : document.documentElement), script = document.createElement('script'); head.appendChild(script); script.src = url; script.charset = 'utf-8'; script.onload = script.onreadystatechange = function() { if (!this.readyState || this.readyState === 'loaded') { if (fn) { fn(); } script.onload = script.onreadystatechange = null; head.removeChild(script); } }; } function _loadStyle(url) { var head = document.getElementsByTagName('head')[0] || (_QUIRKS ? document.body : document.documentElement), link = document.createElement('link'), absoluteUrl = _formatUrl(url, 'absolute'); var links = K('link[rel="stylesheet"]', head); for (var i = 0, len = links.length; i < len; i++) { if (_formatUrl(links[i].href, 'absolute') === absoluteUrl) { return; } } head.appendChild(link); link.href = url; link.rel = 'stylesheet'; } function _ajax(url, fn, method, param, dataType) { method = method || 'GET'; dataType = dataType || 'json'; var xhr = window.XMLHttpRequest ? new window.XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'); xhr.open(method, url, true); xhr.onreadystatechange = function () { if (xhr.readyState == 4 && xhr.status == 200) { if (fn) { var data = _trim(xhr.responseText); if (dataType == 'json') { data = _json(data); } fn(data); } } }; if (method == 'POST') { var params = []; _each(param, function(key, val) { params.push(encodeURIComponent(key) + '=' + encodeURIComponent(val)); }); try { xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); } catch (e) {} xhr.send(params.join('&')); } else { xhr.send(null); } } K.loadScript = _loadScript; K.loadStyle = _loadStyle; K.ajax = _ajax; var _plugins = {}; function _plugin(name, fn) { if (!fn) { return _plugins[name]; } _plugins[name] = fn; } var _language = {}; function _parseLangKey(key) { var match, ns = 'core'; if ((match = /^(\w+)\.(\w+)$/.exec(key))) { ns = match[1]; key = match[2]; } return { ns : ns, key : key }; } function _lang(mixed, langType) { langType = langType === undefined ? K.options.langType : langType; if (typeof mixed === 'string') { if (!_language[langType]) { return 'no language'; } var pos = mixed.length - 1; if (mixed.substr(pos) === '.') { return _language[langType][mixed.substr(0, pos)]; } var obj = _parseLangKey(mixed); return _language[langType][obj.ns][obj.key]; } _each(mixed, function(key, val) { var obj = _parseLangKey(key); if (!_language[langType]) { _language[langType] = {}; } if (!_language[langType][obj.ns]) { _language[langType][obj.ns] = {}; } _language[langType][obj.ns][obj.key] = val; }); } function _getImageFromRange(range, fn) { if (range.collapsed) { return; } range = range.cloneRange().up(); var sc = range.startContainer, so = range.startOffset; if (!_WEBKIT && !range.isControl()) { return; } var img = K(sc.childNodes[so]); if (!img || img.name != 'img') { return; } if (fn(img)) { return img; } } function _bindContextmenuEvent() { var self = this, doc = self.edit.doc; K(doc).contextmenu(function(e) { if (self.menu) { self.hideMenu(); } if (!self.useContextmenu) { e.preventDefault(); return; } if (self._contextmenus.length === 0) { return; } var maxWidth = 0, items = []; _each(self._contextmenus, function() { if (this.title == '-') { items.push(this); return; } if (this.cond && this.cond()) { items.push(this); if (this.width && this.width > maxWidth) { maxWidth = this.width; } } }); while (items.length > 0 && items[0].title == '-') { items.shift(); } while (items.length > 0 && items[items.length - 1].title == '-') { items.pop(); } var prevItem = null; _each(items, function(i) { if (this.title == '-' && prevItem.title == '-') { delete items[i]; } prevItem = this; }); if (items.length > 0) { e.preventDefault(); var pos = K(self.edit.iframe).pos(), menu = _menu({ x : pos.x + e.clientX, y : pos.y + e.clientY, width : maxWidth, css : { visibility: 'hidden' }, shadowMode : self.shadowMode }); _each(items, function() { if (this.title) { menu.addItem(this); } }); var docEl = _docElement(menu.doc), menuHeight = menu.div.height(); if (e.clientY + menuHeight >= docEl.clientHeight - 100) { menu.pos(menu.x, _removeUnit(menu.y) - menuHeight); } menu.div.css('visibility', 'visible'); self.menu = menu; } }); } function _bindNewlineEvent() { var self = this, doc = self.edit.doc, newlineTag = self.newlineTag; if (_IE && newlineTag !== 'br') { return; } if (_GECKO && _V < 3 && newlineTag !== 'p') { return; } if (_OPERA) { return; } var brSkipTagMap = _toMap('h1,h2,h3,h4,h5,h6,pre,li'), pSkipTagMap = _toMap('p,h1,h2,h3,h4,h5,h6,pre,li,blockquote'); function getAncestorTagName(range) { var ancestor = K(range.commonAncestor()); while (ancestor) { if (ancestor.type == 1 && !ancestor.isStyle()) { break; } ancestor = ancestor.parent(); } return ancestor.name; } K(doc).keydown(function(e) { if (e.which != 13 || e.shiftKey || e.ctrlKey || e.altKey) { return; } self.cmd.selection(); var tagName = getAncestorTagName(self.cmd.range); if (tagName == 'marquee' || tagName == 'select') { return; } if (newlineTag === 'br' && !brSkipTagMap[tagName]) { e.preventDefault(); self.insertHtml('<br />'); return; } if (!pSkipTagMap[tagName]) { _nativeCommand(doc, 'formatblock', '<p>'); } }); K(doc).keyup(function(e) { if (e.which != 13 || e.shiftKey || e.ctrlKey || e.altKey) { return; } if (newlineTag == 'br') { return; } self.cmd.selection(); var tagName = getAncestorTagName(self.cmd.range); if (tagName == 'marquee' || tagName == 'select') { return; } if (!pSkipTagMap[tagName]) { _nativeCommand(doc, 'formatblock', '<p>'); } var div = self.cmd.commonAncestor('div'); if (div) { var p = K('<p></p>'), child = div[0].firstChild; while (child) { var next = child.nextSibling; p.append(child); child = next; } div.before(p); div.remove(); self.cmd.range.selectNodeContents(p[0]); self.cmd.select(); } }); } function _bindTabEvent() { var self = this, doc = self.edit.doc; K(doc).keydown(function(e) { if (e.which == 9) { e.preventDefault(); if (self.afterTab) { self.afterTab.call(self, e); return; } var cmd = self.cmd, range = cmd.range; range.shrink(); if (range.collapsed && range.startContainer.nodeType == 1) { range.insertNode(K('@&nbsp;', doc)[0]); cmd.select(); } self.insertHtml('&nbsp;&nbsp;&nbsp;&nbsp;'); } }); } function _bindFocusEvent() { var self = this; K(self.edit.textarea[0], self.edit.win).focus(function(e) { if (self.afterFocus) { self.afterFocus.call(self, e); } }).blur(function(e) { if (self.afterBlur) { self.afterBlur.call(self, e); } }); } function _removeBookmarkTag(html) { return _trim(html.replace(/<span [^>]*id="?__kindeditor_bookmark_\w+_\d+__"?[^>]*><\/span>/ig, '')); } function _removeTempTag(html) { return html.replace(/<div[^>]+class="?__kindeditor_paste__"?[^>]*>[\s\S]*?<\/div>/ig, ''); } function _addBookmarkToStack(stack, bookmark) { if (stack.length === 0) { stack.push(bookmark); return; } var prev = stack[stack.length - 1]; if (_removeBookmarkTag(bookmark.html) !== _removeBookmarkTag(prev.html)) { stack.push(bookmark); } } function _undoToRedo(fromStack, toStack) { var self = this, edit = self.edit, body = edit.doc.body, range, bookmark; if (fromStack.length === 0) { return self; } if (edit.designMode) { range = self.cmd.range; bookmark = range.createBookmark(true); bookmark.html = body.innerHTML; } else { bookmark = { html : body.innerHTML }; } _addBookmarkToStack(toStack, bookmark); var prev = fromStack.pop(); if (_removeBookmarkTag(bookmark.html) === _removeBookmarkTag(prev.html) && fromStack.length > 0) { prev = fromStack.pop(); } if (edit.designMode) { edit.html(prev.html); if (prev.start) { range.moveToBookmark(prev); self.select(); } } else { K(body).html(_removeBookmarkTag(prev.html)); } return self; } function KEditor(options) { var self = this; self.options = {}; function setOption(key, val) { if (KEditor.prototype[key] === undefined) { self[key] = val; } self.options[key] = val; } _each(options, function(key, val) { setOption(key, options[key]); }); _each(K.options, function(key, val) { if (self[key] === undefined) { setOption(key, val); } }); setOption('width', _undef(self.width, self.minWidth)); setOption('height', _undef(self.height, self.minHeight)); setOption('width', _addUnit(self.width)); setOption('height', _addUnit(self.height)); if (_MOBILE && (!_IOS || _V < 534)) { self.designMode = false; } var se = K(self.srcElement || '<textarea/>'); self.srcElement = se; self.initContent = _elementVal(se); self.plugin = {}; self.isCreated = false; self.isLoading = false; self._handlers = {}; self._contextmenus = []; self._undoStack = []; self._redoStack = []; self._calledPlugins = {}; self._firstAddBookmark = true; self.menu = self.contextmenu = null; self.dialogs = []; } KEditor.prototype = { lang : function(mixed) { return _lang(mixed, this.langType); }, loadPlugin : function(name, fn) { var self = this; if (_plugins[name]) { if (self._calledPlugins[name]) { if (fn) { fn.call(self); } return self; } _plugins[name].call(self, KindEditor); if (fn) { fn.call(self); } self._calledPlugins[name] = true; return self; } if (self.isLoading) { return self; } self.isLoading = true; _loadScript(self.pluginsPath + name + '/' + name + '.js?ver=' + encodeURIComponent(K.DEBUG ? _TIME : _VERSION), function() { self.isLoading = false; if (_plugins[name]) { self.loadPlugin(name, fn); } }); return self; }, handler : function(key, fn) { var self = this; if (!self._handlers[key]) { self._handlers[key] = []; } if (_isFunction(fn)) { self._handlers[key].push(fn); return self; } _each(self._handlers[key], function() { fn = this.call(self, fn); }); return fn; }, clickToolbar : function(name, fn) { var self = this, key = 'clickToolbar' + name; if (fn === undefined) { if (self._handlers[key]) { return self.handler(key); } self.loadPlugin(name, function() { self.handler(key); }); return self; } return self.handler(key, fn); }, updateState : function() { var self = this; _each(('justifyleft,justifycenter,justifyright,justifyfull,insertorderedlist,insertunorderedlist,' + 'subscript,superscript,bold,italic,underline,strikethrough').split(','), function(i, name) { self.cmd.state(name) ? self.toolbar.select(name) : self.toolbar.unselect(name); }); return self; }, addContextmenu : function(item) { this._contextmenus.push(item); return this; }, afterCreate : function(fn) { return this.handler('afterCreate', fn); }, beforeRemove : function(fn) { return this.handler('beforeRemove', fn); }, beforeGetHtml : function(fn) { return this.handler('beforeGetHtml', fn); }, beforeSetHtml : function(fn) { return this.handler('beforeSetHtml', fn); }, afterSetHtml : function(fn) { return this.handler('afterSetHtml', fn); }, create : function() { var self = this, fullscreenMode = self.fullscreenMode; if (self.isCreated) { return self; } if (fullscreenMode) { _docElement().style.overflow = 'hidden'; } else { _docElement().style.overflow = ''; } var width = fullscreenMode ? _docElement().clientWidth + 'px' : self.width, height = fullscreenMode ? _docElement().clientHeight + 'px' : self.height; if ((_IE && _V < 8) || _QUIRKS) { height = _addUnit(_removeUnit(height) + 2); } var container = self.container = K(self.layout); if (fullscreenMode) { K(document.body).append(container); } else { self.srcElement.before(container); } var toolbarDiv = K('.toolbar', container), editDiv = K('.edit', container), statusbar = self.statusbar = K('.statusbar', container); container.removeClass('container') .addClass('ke-container ke-container-' + self.themeType).css('width', width); if (fullscreenMode) { container.css({ position : 'absolute', left : 0, top : 0, 'z-index' : 811211 }); if (!_GECKO) { self._scrollPos = _getScrollPos(); } window.scrollTo(0, 0); K(document.body).css({ 'height' : '1px', 'overflow' : 'hidden' }); K(document.body.parentNode).css('overflow', 'hidden'); } else { if (self._scrollPos) { K(document.body).css({ 'height' : '', 'overflow' : '' }); K(document.body.parentNode).css('overflow', ''); window.scrollTo(self._scrollPos.x, self._scrollPos.y); } } var htmlList = []; K.each(self.items, function(i, name) { if (name == '|') { htmlList.push('<span class="ke-inline-block ke-separator"></span>'); } else if (name == '/') { htmlList.push('<div class="ke-hr"></div>'); } else { htmlList.push('<span class="ke-outline" data-name="' + name + '" title="' + self.lang(name) + '" unselectable="on">'); htmlList.push('<span class="ke-toolbar-icon ke-toolbar-icon-url ke-icon-' + name + '" unselectable="on"></span></span>'); } }); var toolbar = self.toolbar = _toolbar({ src : toolbarDiv, html : htmlList.join(''), noDisableItems : self.noDisableItems, click : function(e, name) { e.stop(); if (self.menu) { var menuName = self.menu.name; self.hideMenu(); if (menuName === name) { return; } } self.clickToolbar(name); } }); var editHeight = _removeUnit(height) - toolbar.div.height(); var edit = self.edit = _edit({ height : editHeight > 0 && _removeUnit(height) > self.minHeight ? editHeight : self.minHeight, src : editDiv, srcElement : self.srcElement, designMode : self.designMode, themesPath : self.themesPath, bodyClass : self.bodyClass, cssPath : self.cssPath, cssData : self.cssData, beforeGetHtml : function(html) { html = self.beforeGetHtml(html); return _formatHtml(html, self.filterMode ? self.htmlTags : null, self.urlType, self.wellFormatMode, self.indentChar); }, beforeSetHtml : function(html) { html = _formatHtml(html, self.filterMode ? self.htmlTags : null, '', false); return self.beforeSetHtml(html); }, afterSetHtml : function() { self.edit = edit = this; self.afterSetHtml(); }, afterCreate : function() { self.edit = edit = this; self.cmd = edit.cmd; self._docMousedownFn = function(e) { if (self.menu) { self.hideMenu(); } }; K(edit.doc, document).mousedown(self._docMousedownFn); _bindContextmenuEvent.call(self); _bindNewlineEvent.call(self); _bindTabEvent.call(self); _bindFocusEvent.call(self); edit.afterChange(function(e) { if (!edit.designMode) { return; } self.updateState(); self.addBookmark(); if (self.options.afterChange) { self.options.afterChange.call(self); } }); edit.textarea.keyup(function(e) { if (!e.ctrlKey && !e.altKey && _INPUT_KEY_MAP[e.which]) { if (self.options.afterChange) { self.options.afterChange.call(self); } } }); if (self.readonlyMode) { self.readonly(); } self.isCreated = true; self.initContent = self.html(); self.afterCreate(); if (self.options.afterCreate) { self.options.afterCreate.call(self); } } }); statusbar.removeClass('statusbar').addClass('ke-statusbar') .append('<span class="ke-inline-block ke-statusbar-center-icon"></span>') .append('<span class="ke-inline-block ke-statusbar-right-icon"></span>'); K(window).unbind('resize'); function initResize() { if (statusbar.height() === 0) { setTimeout(initResize, 100); return; } self.resize(width, height); } initResize(); function newResize(width, height, updateProp) { updateProp = _undef(updateProp, true); if (width && width >= self.minWidth) { self.resize(width, null); if (updateProp) { self.width = _addUnit(width); } } if (height && height >= self.minHeight) { self.resize(null, height); if (updateProp) { self.height = _addUnit(height); } } } if (fullscreenMode) { K(window).bind('resize', function(e) { if (self.isCreated) { newResize(_docElement().clientWidth, _docElement().clientHeight, false); } }); toolbar.select('fullscreen'); statusbar.first().css('visibility', 'hidden'); statusbar.last().css('visibility', 'hidden'); } else { if (_GECKO) { K(window).bind('scroll', function(e) { self._scrollPos = _getScrollPos(); }); } if (self.resizeType > 0) { _drag({ moveEl : container, clickEl : statusbar, moveFn : function(x, y, width, height, diffX, diffY) { height += diffY; newResize(null, height); } }); } else { statusbar.first().css('visibility', 'hidden'); } if (self.resizeType === 2) { _drag({ moveEl : container, clickEl : statusbar.last(), moveFn : function(x, y, width, height, diffX, diffY) { width += diffX; height += diffY; newResize(width, height); } }); } else { statusbar.last().css('visibility', 'hidden'); } } return self; }, remove : function() { var self = this; if (!self.isCreated) { return self; } self.beforeRemove(); if (self.menu) { self.hideMenu(); } _each(self.dialogs, function() { self.hideDialog(); }); K(document).unbind('mousedown', self._docMousedownFn); self.toolbar.remove(); self.edit.remove(); self.statusbar.last().unbind(); self.statusbar.unbind(); self.container.remove(); self.container = self.toolbar = self.edit = self.menu = null; self.dialogs = []; self.isCreated = false; return self; }, resize : function(width, height) { var self = this; if (width !== null) { if (_removeUnit(width) > self.minWidth) { self.container.css('width', _addUnit(width)); } } if (height !== null) { height = _removeUnit(height) - self.toolbar.div.height() - self.statusbar.height(); if (height > 0 && _removeUnit(height) > self.minHeight) { self.edit.setHeight(height); } } return self; }, select : function() { this.isCreated && this.cmd.select(); return this; }, html : function(val) { var self = this; if (val === undefined) { return self.isCreated ? self.edit.html() : _elementVal(self.srcElement); } self.isCreated ? self.edit.html(val) : _elementVal(self.srcElement, val); return self; }, fullHtml : function() { return this.isCreated ? this.edit.html(undefined, true) : ''; }, text : function(val) { var self = this; if (val === undefined) { return _trim(self.html().replace(/<(?!img|embed).*?>/ig, '').replace(/&nbsp;/ig, ' ')); } else { return self.html(_escape(val)); } }, isEmpty : function() { return _trim(this.text().replace(/\r\n|\n|\r/, '')) === ''; }, isDirty : function() { return _trim(this.initContent.replace(/\r\n|\n|\r|t/g, '')) !== _trim(this.html().replace(/\r\n|\n|\r|t/g, '')); }, selectedHtml : function() { return this.isCreated ? this.cmd.range.html() : ''; }, count : function(mode) { var self = this; mode = (mode || 'html').toLowerCase(); if (mode === 'html') { return _removeBookmarkTag(_removeTempTag(self.html())).length; } if (mode === 'text') { return self.text().replace(/<(?:img|embed).*?>/ig, 'K').replace(/\r\n|\n|\r/g, '').length; } return 0; }, exec : function(key) { key = key.toLowerCase(); var self = this, cmd = self.cmd, changeFlag = _inArray(key, 'selectall,copy,paste,print'.split(',')) < 0; if (changeFlag) { self.addBookmark(false); } cmd[key].apply(cmd, _toArray(arguments, 1)); if (changeFlag) { self.updateState(); self.addBookmark(false); if (self.options.afterChange) { self.options.afterChange.call(self); } } return self; }, insertHtml : function(val) { if (!this.isCreated) { return this; } val = this.beforeSetHtml(val); this.exec('inserthtml', val); return this; }, appendHtml : function(val) { this.html(this.html() + val); if (this.isCreated) { var cmd = this.cmd; cmd.range.selectNodeContents(cmd.doc.body).collapse(false); cmd.select(); } return this; }, sync : function() { _elementVal(this.srcElement, this.html()); return this; }, focus : function() { this.isCreated ? this.edit.focus() : this.srcElement[0].focus(); return this; }, blur : function() { this.isCreated ? this.edit.blur() : this.srcElement[0].blur(); return this; }, addBookmark : function(checkSize) { checkSize = _undef(checkSize, true); var self = this, edit = self.edit, body = edit.doc.body, html = _removeTempTag(body.innerHTML), bookmark; if (checkSize && self._undoStack.length > 0) { var prev = self._undoStack[self._undoStack.length - 1]; if (Math.abs(html.length - _removeBookmarkTag(prev.html).length) < self.minChangeSize) { return self; } } if (edit.designMode && !self._firstAddBookmark) { var range = self.cmd.range; bookmark = range.createBookmark(true); bookmark.html = _removeTempTag(body.innerHTML); range.moveToBookmark(bookmark); } else { bookmark = { html : html }; } self._firstAddBookmark = false; _addBookmarkToStack(self._undoStack, bookmark); return self; }, undo : function() { return _undoToRedo.call(this, this._undoStack, this._redoStack); }, redo : function() { return _undoToRedo.call(this, this._redoStack, this._undoStack); }, fullscreen : function(bool) { this.fullscreenMode = (bool === undefined ? !this.fullscreenMode : bool); return this.remove().create(); }, readonly : function(isReadonly) { isReadonly = _undef(isReadonly, true); var self = this, edit = self.edit, doc = edit.doc; if (self.designMode) { self.toolbar.disableAll(isReadonly, []); } else { _each(self.noDisableItems, function() { self.toolbar[isReadonly ? 'disable' : 'enable'](this); }); } if (_IE) { doc.body.contentEditable = !isReadonly; } else { doc.designMode = isReadonly ? 'off' : 'on'; } edit.textarea[0].disabled = isReadonly; }, createMenu : function(options) { var self = this, name = options.name, knode = self.toolbar.get(name), pos = knode.pos(); options.x = pos.x; options.y = pos.y + knode.height(); options.shadowMode = _undef(options.shadowMode, self.shadowMode); if (options.selectedColor !== undefined) { options.cls = 'ke-colorpicker-' + self.themeType; options.noColor = self.lang('noColor'); self.menu = _colorpicker(options); } else { options.cls = 'ke-menu-' + self.themeType; options.centerLineMode = false; self.menu = _menu(options); } return self.menu; }, hideMenu : function() { this.menu.remove(); this.menu = null; return this; }, hideContextmenu : function() { this.contextmenu.remove(); this.contextmenu = null; return this; }, createDialog : function(options) { var self = this, name = options.name; options.autoScroll = _undef(options.autoScroll, true); options.shadowMode = _undef(options.shadowMode, self.shadowMode); options.closeBtn = _undef(options.closeBtn, { name : self.lang('close'), click : function(e) { self.hideDialog(); if (_IE && self.cmd) { self.cmd.select(); } } }); options.noBtn = _undef(options.noBtn, { name : self.lang(options.yesBtn ? 'no' : 'close'), click : function(e) { self.hideDialog(); if (_IE && self.cmd) { self.cmd.select(); } } }); if (self.dialogAlignType != 'page') { options.alignEl = self.container; } options.cls = 'ke-dialog-' + self.themeType; if (self.dialogs.length > 0) { var firstDialog = self.dialogs[0], parentDialog = self.dialogs[self.dialogs.length - 1]; firstDialog.setMaskIndex(parentDialog.z + 2); options.z = parentDialog.z + 3; options.showMask = false; } var dialog = _dialog(options); self.dialogs.push(dialog); return dialog; }, hideDialog : function() { var self = this; if (self.dialogs.length > 0) { self.dialogs.pop().remove(); } if (self.dialogs.length > 0) { var firstDialog = self.dialogs[0], parentDialog = self.dialogs[self.dialogs.length - 1]; firstDialog.setMaskIndex(parentDialog.z - 1); } return self; }, errorDialog : function(html) { var self = this; var dialog = self.createDialog({ width : 750, title : self.lang('uploadError'), body : '<div style="padding:10px 20px;"><iframe frameborder="0" style="width:708px;height:400px;"></iframe></div>' }); var iframe = K('iframe', dialog.div), doc = K.iframeDoc(iframe); doc.open(); doc.write(html); doc.close(); K(doc.body).css('background-color', '#FFF'); iframe[0].contentWindow.focus(); return self; } }; function _editor(options) { return new KEditor(options); } function _create(expr, options) { options = options || {}; options.basePath = _undef(options.basePath, K.basePath); options.themesPath = _undef(options.themesPath, options.basePath + 'themes/'); options.langPath = _undef(options.langPath, options.basePath + 'lang/'); options.pluginsPath = _undef(options.pluginsPath, options.basePath + 'plugins/'); if (_undef(options.loadStyleMode, K.options.loadStyleMode)) { var themeType = _undef(options.themeType, K.options.themeType); _loadStyle(options.themesPath + 'default/default.css'); _loadStyle(options.themesPath + themeType + '/' + themeType + '.css'); } function create(editor) { _each(_plugins, function(name, fn) { fn.call(editor, KindEditor); }); return editor.create(); } var knode = K(expr); if (!knode) { return; } options.srcElement = knode[0]; if (!options.width) { options.width = knode[0].style.width || knode.width(); } if (!options.height) { options.height = knode[0].style.height || knode.height(); } var editor = new KEditor(options); if (_language[editor.langType]) { return create(editor); } _loadScript(editor.langPath + editor.langType + '.js?ver=' + encodeURIComponent(K.DEBUG ? _TIME : _VERSION), function() { return create(editor); }); return editor; } if (_IE && _V < 7) { _nativeCommand(document, 'BackgroundImageCache', true); } K.editor = _editor; K.create = _create; K.plugin = _plugin; K.lang = _lang; _plugin('core', function(K) { var self = this, shortcutKeys = { undo : 'Z', redo : 'Y', bold : 'B', italic : 'I', underline : 'U', print : 'P', selectall : 'A' }; self.afterSetHtml(function() { if (self.options.afterChange) { self.options.afterChange.call(self); } }); if (self.syncType == 'form') { var el = K(self.srcElement), hasForm = false; while ((el = el.parent())) { if (el.name == 'form') { hasForm = true; break; } } if (hasForm) { el.bind('submit', function(e) { self.sync(); self.edit.textarea.remove(); }); var resetBtn = K('[type="reset"]', el); resetBtn.click(function() { self.html(self.initContent); self.cmd.selection(); }); self.beforeRemove(function() { el.unbind(); resetBtn.unbind(); }); } } self.clickToolbar('source', function() { if (self.edit.designMode) { self.toolbar.disableAll(true); self.edit.design(false); self.toolbar.select('source'); } else { self.toolbar.disableAll(false); self.edit.design(true); self.toolbar.unselect('source'); } self.designMode = self.edit.designMode; }); self.afterCreate(function() { if (!self.designMode) { self.toolbar.disableAll(true).select('source'); } }); self.clickToolbar('fullscreen', function() { self.fullscreen(); }); var loaded = false; self.afterCreate(function() { K(self.edit.doc, self.edit.textarea).keyup(function(e) { if (e.which == 27) { setTimeout(function() { self.fullscreen(); }, 0); } }); if (loaded) { if (_IE && !self.designMode) { return; } self.focus(); } if (!loaded) { loaded = true; } }); _each('undo,redo'.split(','), function(i, name) { if (shortcutKeys[name]) { self.afterCreate(function() { _ctrl(this.edit.doc, shortcutKeys[name], function() { self.clickToolbar(name); }); }); } self.clickToolbar(name, function() { self[name](); }); }); self.clickToolbar('formatblock', function() { var blocks = self.lang('formatblock.formatBlock'), heights = { h1 : 28, h2 : 24, h3 : 18, H4 : 14, p : 12 }, curVal = self.cmd.val('formatblock'), menu = self.createMenu({ name : 'formatblock', width : self.langType == 'en' ? 200 : 150 }); _each(blocks, function(key, val) { var style = 'font-size:' + heights[key] + 'px;'; if (key.charAt(0) === 'h') { style += 'font-weight:bold;'; } menu.addItem({ title : '<span style="' + style + '" unselectable="on">' + val + '</span>', height : heights[key] + 12, checked : (curVal === key || curVal === val), click : function() { self.select().exec('formatblock', '<' + key + '>').hideMenu(); } }); }); }); self.clickToolbar('fontname', function() { var curVal = self.cmd.val('fontname'), menu = self.createMenu({ name : 'fontname', width : 150 }); _each(self.lang('fontname.fontName'), function(key, val) { menu.addItem({ title : '<span style="font-family: ' + key + ';" unselectable="on">' + val + '</span>', checked : (curVal === key.toLowerCase() || curVal === val.toLowerCase()), click : function() { self.exec('fontname', key).hideMenu(); } }); }); }); self.clickToolbar('fontsize', function() { var curVal = self.cmd.val('fontsize'), menu = self.createMenu({ name : 'fontsize', width : 150 }); _each(self.fontSizeTable, function(i, val) { menu.addItem({ title : '<span style="font-size:' + val + ';" unselectable="on">' + val + '</span>', height : _removeUnit(val) + 12, checked : curVal === val, click : function() { self.exec('fontsize', val).hideMenu(); } }); }); }); _each('forecolor,hilitecolor'.split(','), function(i, name) { self.clickToolbar(name, function() { self.createMenu({ name : name, selectedColor : self.cmd.val(name) || 'default', colors : self.colorTable, click : function(color) { self.exec(name, color).hideMenu(); } }); }); }); _each(('cut,copy,paste').split(','), function(i, name) { self.clickToolbar(name, function() { self.focus(); try { self.exec(name, null); } catch(e) { alert(self.lang(name + 'Error')); } }); }); self.clickToolbar('about', function() { var html = '<div style="margin:20px;">' + '<div>KindEditor ' + _VERSION + '</div>' + '<div>Copyright &copy; <a href="http://www.kindsoft.net/" target="_blank">kindsoft.net</a> All rights reserved.</div>' + '</div>'; self.createDialog({ name : 'about', width : 300, title : self.lang('about'), body : html }); }); self.plugin.getSelectedLink = function() { return self.cmd.commonAncestor('a'); }; self.plugin.getSelectedImage = function() { return _getImageFromRange(self.edit.cmd.range, function(img) { return !/^ke-\w+$/i.test(img[0].className); }); }; self.plugin.getSelectedFlash = function() { return _getImageFromRange(self.edit.cmd.range, function(img) { return img[0].className == 'ke-flash'; }); }; self.plugin.getSelectedMedia = function() { return _getImageFromRange(self.edit.cmd.range, function(img) { return img[0].className == 'ke-media' || img[0].className == 'ke-rm'; }); }; self.plugin.getSelectedAnchor = function() { return _getImageFromRange(self.edit.cmd.range, function(img) { return img[0].className == 'ke-anchor'; }); }; _each('link,image,flash,media,anchor'.split(','), function(i, name) { var uName = name.charAt(0).toUpperCase() + name.substr(1); _each('edit,delete'.split(','), function(j, val) { self.addContextmenu({ title : self.lang(val + uName), click : function() { self.loadPlugin(name, function() { self.plugin[name][val](); self.hideMenu(); }); }, cond : self.plugin['getSelected' + uName], width : 150, iconClass : val == 'edit' ? 'ke-icon-' + name : undefined }); }); self.addContextmenu({ title : '-' }); }); self.plugin.getSelectedTable = function() { return self.cmd.commonAncestor('table'); }; self.plugin.getSelectedRow = function() { return self.cmd.commonAncestor('tr'); }; self.plugin.getSelectedCell = function() { return self.cmd.commonAncestor('td'); }; _each(('prop,cellprop,colinsertleft,colinsertright,rowinsertabove,rowinsertbelow,rowmerge,colmerge,' + 'rowsplit,colsplit,coldelete,rowdelete,insert,delete').split(','), function(i, val) { var cond = _inArray(val, ['prop', 'delete']) < 0 ? self.plugin.getSelectedCell : self.plugin.getSelectedTable; self.addContextmenu({ title : self.lang('table' + val), click : function() { self.loadPlugin('table', function() { self.plugin.table[val](); self.hideMenu(); }); }, cond : cond, width : 170, iconClass : 'ke-icon-table' + val }); }); self.addContextmenu({ title : '-' }); _each(('selectall,justifyleft,justifycenter,justifyright,justifyfull,insertorderedlist,' + 'insertunorderedlist,indent,outdent,subscript,superscript,hr,print,' + 'bold,italic,underline,strikethrough,removeformat,unlink').split(','), function(i, name) { if (shortcutKeys[name]) { self.afterCreate(function() { _ctrl(this.edit.doc, shortcutKeys[name], function() { self.cmd.selection(); self.clickToolbar(name); }); }); } self.clickToolbar(name, function() { self.focus().exec(name, null); }); }); self.afterCreate(function() { var doc = self.edit.doc, cmd, bookmark, div, cls = '__kindeditor_paste__', pasting = false; function movePastedData() { cmd.range.moveToBookmark(bookmark); cmd.select(); if (_WEBKIT) { K('div.' + cls, div).each(function() { K(this).after('<br />').remove(true); }); K('span.Apple-style-span', div).remove(true); K('meta', div).remove(); } var html = div[0].innerHTML; div.remove(); if (html === '') { return; } if (self.pasteType === 2) { if (/schemas-microsoft-com|worddocument|mso-\w+/i.test(html)) { html = _clearMsWord(html, self.filterMode ? self.htmlTags : K.options.htmlTags); } else { html = _formatHtml(html, self.filterMode ? self.htmlTags : null); html = self.beforeSetHtml(html); } } if (self.pasteType === 1) { html = html.replace(/<br[^>]*>/ig, '\n'); html = html.replace(/<\/p><p[^>]*>/ig, '\n'); html = html.replace(/<[^>]+>/g, ''); html = html.replace(/&nbsp;/ig, ' '); html = html.replace(/\n\s*\n/g, '\n'); html = html.replace(/ {2}/g, ' &nbsp;'); if (self.newlineTag == 'p') { if (/\n/.test(html)) { html = html.replace(/^/, '<p>').replace(/$/, '</p>').replace(/\n/g, '</p><p>'); } } else { html = html.replace(/\n/g, '<br />$&'); } } self.insertHtml(html); } K(doc.body).bind('paste', function(e){ if (self.pasteType === 0) { e.stop(); return; } if (pasting) { return; } pasting = true; K('div.' + cls, doc).remove(); cmd = self.cmd.selection(); bookmark = cmd.range.createBookmark(); div = K('<div class="' + cls + '"></div>', doc).css({ position : 'absolute', width : '1px', height : '1px', overflow : 'hidden', left : '-1981px', top : K(bookmark.start).pos().y + 'px', 'white-space' : 'nowrap' }); K(doc.body).append(div); if (_IE) { var rng = cmd.range.get(true); rng.moveToElementText(div[0]); rng.select(); rng.execCommand('paste'); e.preventDefault(); } else { cmd.range.selectNodeContents(div[0]); cmd.select(); } setTimeout(function() { movePastedData(); pasting = false; }, 0); }); }); self.beforeGetHtml(function(html) { return html.replace(/<img[^>]*class="?ke-(flash|rm|media)"?[^>]*>/ig, function(full) { var imgAttrs = _getAttrList(full), styles = _getCssList(imgAttrs.style || ''), attrs = _mediaAttrs(imgAttrs['data-ke-tag']); attrs.width = _undef(imgAttrs.width, _removeUnit(_undef(styles.width, ''))); attrs.height = _undef(imgAttrs.height, _removeUnit(_undef(styles.height, ''))); return _mediaEmbed(attrs); }) .replace(/<img[^>]*class="?ke-anchor"?[^>]*>/ig, function(full) { var imgAttrs = _getAttrList(full); return '<a name="' + unescape(imgAttrs['data-ke-name']) + '"></a>'; }) .replace(/<div\s+[^>]*data-ke-script-attr="([^"]*)"[^>]*>([\s\S]*?)<\/div>/ig, function(full, attr, code) { return '<script' + unescape(attr) + '>' + unescape(code) + '</script>'; }) .replace(/(<[^>]*)data-ke-src="([^"]*)"([^>]*>)/ig, function(full, start, src, end) { full = full.replace(/(\s+(?:href|src)=")[^"]*(")/i, '$1' + src + '$2'); full = full.replace(/\s+data-ke-src="[^"]*"/i, ''); return full; }) .replace(/(<[^>]+\s)data-ke-(on\w+="[^"]*"[^>]*>)/ig, function(full, start, end) { return start + end; }); }); self.beforeSetHtml(function(html) { return html.replace(/<embed[^>]*type="([^"]+)"[^>]*>(?:<\/embed>)?/ig, function(full) { var attrs = _getAttrList(full); attrs.src = _undef(attrs.src, ''); attrs.width = _undef(attrs.width, 0); attrs.height = _undef(attrs.height, 0); return _mediaImg(self.themesPath + 'common/blank.gif', attrs); }) .replace(/<a[^>]*name="([^"]+)"[^>]*>(?:<\/a>)?/ig, function(full) { var attrs = _getAttrList(full); if (attrs.href !== undefined) { return full; } return '<img class="ke-anchor" src="' + self.themesPath + 'common/anchor.gif" data-ke-name="' + escape(attrs.name) + '" />'; }) .replace(/<script([^>]*)>([\s\S]*?)<\/script>/ig, function(full, attr, code) { return '<div class="ke-script" data-ke-script-attr="' + escape(attr) + '">' + escape(code) + '</div>'; }) .replace(/(<[^>]*)(href|src)="([^"]*)"([^>]*>)/ig, function(full, start, key, src, end) { if (full.match(/\sdata-ke-src="[^"]*"/i)) { return full; } full = start + key + '="' + src + '"' + ' data-ke-src="' + src + '"' + end; return full; }) .replace(/(<[^>]+\s)(on\w+="[^"]*"[^>]*>)/ig, function(full, start, end) { return start + 'data-ke-' + end; }) .replace(/<table[^>]*\s+border="0"[^>]*>/ig, function(full) { if (full.indexOf('ke-zeroborder') >= 0) { return full; } return _addClassToTag(full, 'ke-zeroborder'); }); }); }); })(window);
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/kindeditor.js
JavaScript
oos
157,290
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php *******************************************************************************/ KindEditor.plugin('pagebreak', function(K) { var self = this, name = 'pagebreak'; self.clickToolbar(name, function() { var cmd = self.cmd, range = cmd.range; self.focus(); range.enlarge(true); cmd.split(true); var tail = self.newlineTag == 'br' || K.WEBKIT ? '' : '<p id="__kindeditor_tail_tag__"></p>'; self.insertHtml('<hr style="page-break-after: always;" class="ke-pagebreak" />' + tail); if (tail !== '') { var p = K('#__kindeditor_tail_tag__', self.edit.doc); range.selectNodeContents(p[0]); p.removeAttr('id'); cmd.select(); } }); });
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/pagebreak/pagebreak.js
JavaScript
oos
970
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php *******************************************************************************/ KindEditor.plugin('plainpaste', function(K) { var self = this, name = 'plainpaste'; self.clickToolbar(name, function() { var lang = self.lang(name + '.'), html = '<div style="padding:10px 20px;">' + '<div style="margin-bottom:10px;">' + lang.comment + '</div>' + '<textarea class="ke-textarea" style="width:408px;height:260px;"></textarea>' + '</div>', dialog = self.createDialog({ name : name, width : 450, title : self.lang(name), body : html, yesBtn : { name : self.lang('yes'), click : function(e) { var html = textarea.val(); html = K.escape(html); html = html.replace(/ {2}/g, ' &nbsp;'); if (self.newlineTag == 'p') { html = html.replace(/^/, '<p>').replace(/$/, '</p>').replace(/\n/g, '</p><p>'); } else { html = html.replace(/\n/g, '<br />$&'); } self.insertHtml(html).hideDialog().focus(); } } }), textarea = K('textarea', dialog.div); textarea[0].focus(); }); });
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/plainpaste/plainpaste.js
JavaScript
oos
1,413
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php *******************************************************************************/ // Google Maps: http://code.google.com/apis/maps/index.html KindEditor.plugin('map', function(K) { var self = this, name = 'map', lang = self.lang(name + '.'); self.clickToolbar(name, function() { var html = ['<div style="padding:10px 20px;">', '<div class="ke-dialog-row">', lang.address + ' <input id="kindeditor_plugin_map_address" name="address" class="ke-input-text" value="" style="width:200px;" /> ', '<span class="ke-button-common ke-button-outer">', '<input type="button" name="searchBtn" class="ke-button-common ke-button" value="' + lang.search + '" />', '</span>', '</div>', '<div class="ke-map" style="width:558px;height:360px;"></div>', '</div>'].join(''); var dialog = self.createDialog({ name : name, width : 600, title : self.lang(name), body : html, yesBtn : { name : self.lang('yes'), click : function(e) { var geocoder = win.geocoder, map = win.map, center = map.getCenter().lat() + ',' + map.getCenter().lng(), zoom = map.getZoom(), maptype = map.getMapTypeId(), url = 'http://maps.googleapis.com/maps/api/staticmap'; url += '?center=' + encodeURIComponent(center); url += '&zoom=' + encodeURIComponent(zoom); url += '&size=558x360'; url += '&maptype=' + encodeURIComponent(maptype); url += '&markers=' + encodeURIComponent(center); url += '&language=' + self.langType; url += '&sensor=false'; self.exec('insertimage', url).hideDialog().focus(); } }, beforeRemove : function() { searchBtn.remove(); if (doc) { doc.write(''); } iframe.remove(); } }); var div = dialog.div, addressBox = K('[name="address"]', div), searchBtn = K('[name="searchBtn"]', div), win, doc; var iframeHtml = ['<!doctype html><html><head>', '<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />', '<style>', ' html { height: 100% }', ' body { height: 100%; margin: 0; padding: 0; background-color: #FFF }', ' #map_canvas { height: 100% }', '</style>', '<script src="http://maps.googleapis.com/maps/api/js?sensor=false&language=' + self.langType + '"></script>', '<script>', 'var map, geocoder;', 'function initialize() {', ' var latlng = new google.maps.LatLng(31.230393, 121.473704);', ' var options = {', ' zoom: 11,', ' center: latlng,', ' disableDefaultUI: true,', ' panControl: true,', ' zoomControl: true,', ' mapTypeControl: true,', ' scaleControl: true,', ' streetViewControl: false,', ' overviewMapControl: true,', ' mapTypeId: google.maps.MapTypeId.ROADMAP', ' };', ' map = new google.maps.Map(document.getElementById("map_canvas"), options);', ' geocoder = new google.maps.Geocoder();', ' geocoder.geocode({latLng: latlng}, function(results, status) {', ' if (status == google.maps.GeocoderStatus.OK) {', ' if (results[3]) {', ' parent.document.getElementById("kindeditor_plugin_map_address").value = results[3].formatted_address;', ' }', ' }', ' });', '}', 'function search(address) {', ' if (!map) return;', ' geocoder.geocode({address : address}, function(results, status) {', ' if (status == google.maps.GeocoderStatus.OK) {', ' map.setZoom(11);', ' map.setCenter(results[0].geometry.location);', ' var marker = new google.maps.Marker({', ' map: map,', ' position: results[0].geometry.location', ' });', ' } else {', ' alert("Invalid address: " + address);', ' }', ' });', '}', '</script>', '</head>', '<body onload="initialize();">', '<div id="map_canvas" style="width:100%; height:100%"></div>', '</body></html>'].join('\n'); // TODO:用doc.write(iframeHtml)方式加载时,在IE6上第一次加载报错,暂时使用src方式 var iframe = K('<iframe class="ke-textarea" frameborder="0" src="' + self.pluginsPath + 'map/map.html" style="width:558px;height:360px;"></iframe>'); function ready() { win = iframe[0].contentWindow; doc = K.iframeDoc(iframe); //doc.open(); //doc.write(iframeHtml); //doc.close(); } iframe.bind('load', function() { iframe.unbind('load'); if (K.IE) { ready(); } else { setTimeout(ready, 0); } }); K('.ke-map', div).replaceWith(iframe); // search map searchBtn.click(function() { win.search(addressBox.val()); }); }); });
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/map/map.js
JavaScript
oos
4,932
<!doctype html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <style> html { height: 100% } body { height: 100%; margin: 0; padding: 0; background-color: #FFF } #map_canvas { height: 100% } </style> <script src="http://maps.googleapis.com/maps/api/js?sensor=false&language=zh_CN"></script> <script> var map, geocoder; function initialize() { var latlng = new google.maps.LatLng(31.230393, 121.473704); var options = { zoom: 11, center: latlng, disableDefaultUI: true, panControl: true, zoomControl: true, mapTypeControl: true, scaleControl: true, streetViewControl: false, overviewMapControl: true, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById("map_canvas"), options); geocoder = new google.maps.Geocoder(); geocoder.geocode({latLng: latlng}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { if (results[3]) { parent.document.getElementById("kindeditor_plugin_map_address").value = results[3].formatted_address; } } }); } function search(address) { if (!map) return; geocoder.geocode({address : address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setZoom(11); map.setCenter(results[0].geometry.location); var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location }); } else { alert("Invalid address: " + address); } }); } </script> </head> <body onload="initialize();"> <div id="map_canvas" style="width:100%; height:100%"></div> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/map/map.html
HTML
oos
1,752
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php *******************************************************************************/ KindEditor.plugin('flash', function(K) { var self = this, name = 'flash', lang = self.lang(name + '.'), allowFlashUpload = K.undef(self.allowFlashUpload, true), allowFileManager = K.undef(self.allowFileManager, false), uploadJson = K.undef(self.uploadJson, self.basePath + '/ashx/upload_json.ashx'); self.plugin.flash = { edit : function() { var html = [ '<div style="padding:10px 20px;">', //url '<div class="ke-dialog-row">', '<label for="keUrl" style="width:60px;">' + lang.url + '</label>', '<input class="ke-input-text" type="text" id="keUrl" name="url" value="" style="width:160px;" /> &nbsp;', '<input type="button" class="ke-upload-button" value="' + lang.upload + '" /> &nbsp;', '<span class="ke-button-common ke-button-outer">', '<input type="button" class="ke-button-common ke-button" name="viewServer" value="' + lang.viewServer + '" />', '</span>', '</div>', //width '<div class="ke-dialog-row">', '<label for="keWidth" style="width:60px;">' + lang.width + '</label>', '<input type="text" id="keWidth" class="ke-input-text ke-input-number" name="width" value="550" maxlength="4" /> ', '</div>', //height '<div class="ke-dialog-row">', '<label for="keHeight" style="width:60px;">' + lang.height + '</label>', '<input type="text" id="keHeight" class="ke-input-text ke-input-number" name="height" value="400" maxlength="4" /> ', '</div>', '</div>' ].join(''); var dialog = self.createDialog({ name : name, width : 450, height : 200, title : self.lang(name), body : html, yesBtn : { name : self.lang('yes'), click : function(e) { var url = K.trim(urlBox.val()), width = widthBox.val(), height = heightBox.val(); if (url == 'http://' || K.invalidUrl(url)) { alert(self.lang('invalidUrl')); urlBox[0].focus(); return; } if (!/^\d*$/.test(width)) { alert(self.lang('invalidWidth')); widthBox[0].focus(); return; } if (!/^\d*$/.test(height)) { alert(self.lang('invalidHeight')); heightBox[0].focus(); return; } var html = K.mediaImg(self.themesPath + 'common/blank.gif', { src : url, type : K.mediaType('.swf'), width : width, height : height, quality : 'high' }); self.insertHtml(html).hideDialog().focus(); } } }), div = dialog.div, urlBox = K('[name="url"]', div), viewServerBtn = K('[name="viewServer"]', div), widthBox = K('[name="width"]', div), heightBox = K('[name="height"]', div); urlBox.val('http://'); if (allowFlashUpload) { var uploadbutton = K.uploadbutton({ button : K('.ke-upload-button', div)[0], fieldName : 'imgFile', url : K.addParam(uploadJson, 'dir=flash'), afterUpload : function(data) { dialog.hideLoading(); if (data.error === 0) { var url = K.formatUrl(data.url, 'absolute'); urlBox.val(url); if (self.afterUpload) { self.afterUpload.call(self, url); } alert(self.lang('uploadSuccess')); } else { alert(data.message); } }, afterError : function(html) { dialog.hideLoading(); self.errorDialog(html); } }); uploadbutton.fileBox.change(function(e) { dialog.showLoading(self.lang('uploadLoading')); uploadbutton.submit(); }); } else { K('.ke-upload-button', div).hide(); urlBox.width(250); } if (allowFileManager) { viewServerBtn.click(function(e) { self.loadPlugin('filemanager', function() { self.plugin.filemanagerDialog({ viewType : 'LIST', dirName : 'flash', clickFn : function(url, title) { if (self.dialogs.length > 1) { K('[name="url"]', div).val(url); self.hideDialog(); } } }); }); }); } else { viewServerBtn.hide(); } var img = self.plugin.getSelectedFlash(); if (img) { var attrs = K.mediaAttrs(img.attr('data-ke-tag')); urlBox.val(attrs.src); widthBox.val(K.removeUnit(img.css('width')) || attrs.width || 0); heightBox.val(K.removeUnit(img.css('height')) || attrs.height || 0); } urlBox[0].focus(); urlBox[0].select(); }, 'delete' : function() { self.plugin.getSelectedFlash().remove(); } }; self.clickToolbar(name, self.plugin.flash.edit); });
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/flash/flash.js
JavaScript
oos
4,967
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php *******************************************************************************/ KindEditor.plugin('preview', function(K) { var self = this, name = 'preview', undefined; self.clickToolbar(name, function() { var lang = self.lang(name + '.'), html = '<div style="padding:10px 20px;">' + '<iframe class="ke-textarea" frameborder="0" style="width:708px;height:400px;"></iframe>' + '</div>', dialog = self.createDialog({ name : name, width : 750, title : self.lang(name), body : html }), iframe = K('iframe', dialog.div), doc = K.iframeDoc(iframe); doc.open(); doc.write(self.fullHtml()); doc.close(); K(doc.body).css('background-color', '#FFF'); iframe[0].contentWindow.focus(); }); });
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/preview/preview.js
JavaScript
oos
1,058
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php *******************************************************************************/ KindEditor.plugin('link', function(K) { var self = this, name = 'link'; self.plugin.link = { edit : function() { var lang = self.lang(name + '.'), html = '<div style="padding:10px 20px;">' + //url '<div class="ke-dialog-row">' + '<label for="keUrl">' + lang.url + '</label>' + '<input class="ke-input-text" type="text" id="keUrl" name="url" value="" style="width:90%;" /></div>' + //type '<div class="ke-dialog-row"">' + '<label for="keType">' + lang.linkType + '</label>' + '<select id="keType" name="type"></select>' + '</div>' + '</div>', dialog = self.createDialog({ name : name, width : 400, title : self.lang(name), body : html, yesBtn : { name : self.lang('yes'), click : function(e) { var url = K.trim(urlBox.val()); if (url == 'http://' || K.invalidUrl(url)) { alert(self.lang('invalidUrl')); urlBox[0].focus(); return; } self.exec('createlink', url, typeBox.val()).hideDialog().focus(); } } }), div = dialog.div, urlBox = K('input[name="url"]', div), typeBox = K('select[name="type"]', div); urlBox.val('http://'); typeBox[0].options[0] = new Option(lang.newWindow, '_blank'); typeBox[0].options[1] = new Option(lang.selfWindow, ''); self.cmd.selection(); var a = self.plugin.getSelectedLink(); if (a) { self.cmd.range.selectNode(a[0]); self.cmd.select(); urlBox.val(a.attr('data-ke-src')); typeBox.val(a.attr('target')); } urlBox[0].focus(); urlBox[0].select(); }, 'delete' : function() { self.exec('unlink', null); } }; self.clickToolbar(name, self.plugin.link.edit); });
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/link/link.js
JavaScript
oos
2,156
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php *******************************************************************************/ KindEditor.plugin('insertfile', function(K) { var self = this, name = 'insertfile', allowFileManager = K.undef(self.allowFileManager, false), uploadJson = K.undef(self.uploadJson, self.basePath + '/ashx/upload_json.ashx'), lang = self.lang(name + '.'); self.plugin.fileDialog = function(options) { var fileUrl = K.undef(options.fileUrl, 'http://'), fileTitle = K.undef(options.fileTitle, ''), clickFn = options.clickFn; var html = [ '<div style="padding:10px 20px;">', '<div class="ke-dialog-row">', '<label for="keUrl" style="width:60px;">' + lang.url + '</label>', '<input type="text" id="keUrl" name="url" class="ke-input-text" style="width:160px;" /> &nbsp;', '<input type="button" class="ke-upload-button" value="' + lang.upload + '" /> &nbsp;', '<span class="ke-button-common ke-button-outer">', '<input type="button" class="ke-button-common ke-button" name="viewServer" value="' + lang.viewServer + '" />', '</span>', '</div>', //title '<div class="ke-dialog-row">', '<label for="keTitle" style="width:60px;">' + lang.title + '</label>', '<input type="text" id="keTitle" class="ke-input-text" name="title" value="" style="width:160px;" /></div>', '</div>', //form end '</form>', '</div>' ].join(''); var dialog = self.createDialog({ name : name, width : 450, height : 180, title : self.lang(name), body : html, yesBtn : { name : self.lang('yes'), click : function(e) { var url = K.trim(urlBox.val()), title = titleBox.val(); if (url == 'http://' || K.invalidUrl(url)) { alert(self.lang('invalidUrl')); urlBox[0].focus(); return; } if (K.trim(title) === '') { title = url; } clickFn.call(self, url, title); } }, beforeRemove : function() { viewServerBtn.remove(); uploadbutton.remove(); } }), div = dialog.div; var urlBox = K('[name="url"]', div), viewServerBtn = K('[name="viewServer"]', div), titleBox = K('[name="title"]', div); var uploadbutton = K.uploadbutton({ button : K('.ke-upload-button', div)[0], fieldName : 'imgFile', url : K.addParam(uploadJson, 'dir=file'), afterUpload : function(data) { dialog.hideLoading(); if (data.error === 0) { var url = K.formatUrl(data.url, 'absolute'); urlBox.val(url); if (self.afterUpload) { self.afterUpload.call(self, url); } alert(self.lang('uploadSuccess')); } else { alert(data.message); } }, afterError : function(html) { dialog.hideLoading(); self.errorDialog(html); } }); uploadbutton.fileBox.change(function(e) { dialog.showLoading(self.lang('uploadLoading')); uploadbutton.submit(); }); if (allowFileManager) { viewServerBtn.click(function(e) { self.loadPlugin('filemanager', function() { self.plugin.filemanagerDialog({ viewType : 'LIST', dirName : 'file', clickFn : function(url, title) { if (self.dialogs.length > 1) { K('[name="url"]', div).val(url); self.hideDialog(); } } }); }); }); } else { viewServerBtn.hide(); } urlBox.val(fileUrl); titleBox.val(fileTitle); urlBox[0].focus(); urlBox[0].select(); }; self.clickToolbar(name, function() { self.plugin.fileDialog({ clickFn : function(url, title) { var html = '<a href="' + url + '" data-ke-src="' + url + '" target="_blank">' + title + '</a>'; self.insertHtml(html).hideDialog().focus(); } }); }); });
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/insertfile/insertfile.js
JavaScript
oos
4,029
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php *******************************************************************************/ KindEditor.plugin('media', function(K) { var self = this, name = 'media', lang = self.lang(name + '.'), allowMediaUpload = K.undef(self.allowMediaUpload, true), allowFileManager = K.undef(self.allowFileManager, false), uploadJson = K.undef(self.uploadJson, self.basePath + '/ashx/upload_json.php'); self.plugin.media = { edit : function() { var html = [ '<div style="padding:10px 20px;">', //url '<div class="ke-dialog-row">', '<label for="keUrl" style="width:60px;">' + lang.url + '</label>', '<input class="ke-input-text" type="text" id="keUrl" name="url" value="" style="width:160px;" /> &nbsp;', '<input type="button" class="ke-upload-button" value="' + lang.upload + '" /> &nbsp;', '<span class="ke-button-common ke-button-outer">', '<input type="button" class="ke-button-common ke-button" name="viewServer" value="' + lang.viewServer + '" />', '</span>', '</div>', //width '<div class="ke-dialog-row">', '<label for="keWidth" style="width:60px;">' + lang.width + '</label>', '<input type="text" id="keWidth" class="ke-input-text ke-input-number" name="width" value="550" maxlength="4" />', '</div>', //height '<div class="ke-dialog-row">', '<label for="keHeight" style="width:60px;">' + lang.height + '</label>', '<input type="text" id="keHeight" class="ke-input-text ke-input-number" name="height" value="400" maxlength="4" />', '</div>', //autostart '<div class="ke-dialog-row">', '<label for="keAutostart">' + lang.autostart + '</label>', '<input type="checkbox" id="keAutostart" name="autostart" value="" /> ', '</div>', '</div>' ].join(''); var dialog = self.createDialog({ name : name, width : 450, height : 230, title : self.lang(name), body : html, yesBtn : { name : self.lang('yes'), click : function(e) { var url = K.trim(urlBox.val()), width = widthBox.val(), height = heightBox.val(); if (url == 'http://' || K.invalidUrl(url)) { alert(self.lang('invalidUrl')); urlBox[0].focus(); return; } if (!/^\d*$/.test(width)) { alert(self.lang('invalidWidth')); widthBox[0].focus(); return; } if (!/^\d*$/.test(height)) { alert(self.lang('invalidHeight')); heightBox[0].focus(); return; } var html = K.mediaImg(self.themesPath + 'common/blank.gif', { src : url, type : K.mediaType(url), width : width, height : height, autostart : autostartBox[0].checked ? 'true' : 'false', loop : 'true' }); self.insertHtml(html).hideDialog().focus(); } } }), div = dialog.div, urlBox = K('[name="url"]', div), viewServerBtn = K('[name="viewServer"]', div), widthBox = K('[name="width"]', div), heightBox = K('[name="height"]', div), autostartBox = K('[name="autostart"]', div); urlBox.val('http://'); if (allowMediaUpload) { var uploadbutton = K.uploadbutton({ button : K('.ke-upload-button', div)[0], fieldName : 'imgFile', url : K.addParam(uploadJson, 'dir=media'), afterUpload : function(data) { dialog.hideLoading(); if (data.error === 0) { var url = K.formatUrl(data.url, 'absolute'); urlBox.val(url); if (self.afterUpload) { self.afterUpload.call(self, url); } alert(self.lang('uploadSuccess')); } else { alert(data.message); } }, afterError : function(html) { dialog.hideLoading(); self.errorDialog(html); } }); uploadbutton.fileBox.change(function(e) { dialog.showLoading(self.lang('uploadLoading')); uploadbutton.submit(); }); } else { K('.ke-upload-button', div).hide(); urlBox.width(250); } if (allowFileManager) { viewServerBtn.click(function(e) { self.loadPlugin('filemanager', function() { self.plugin.filemanagerDialog({ viewType : 'LIST', dirName : 'media', clickFn : function(url, title) { if (self.dialogs.length > 1) { K('[name="url"]', div).val(url); self.hideDialog(); } } }); }); }); } else { viewServerBtn.hide(); } var img = self.plugin.getSelectedMedia(); if (img) { var attrs = K.mediaAttrs(img.attr('data-ke-tag')); urlBox.val(attrs.src); widthBox.val(K.removeUnit(img.css('width')) || attrs.width || 0); heightBox.val(K.removeUnit(img.css('height')) || attrs.height || 0); autostartBox[0].checked = (attrs.autostart === 'true'); } urlBox[0].focus(); urlBox[0].select(); }, 'delete' : function() { self.plugin.getSelectedMedia().remove(); } }; self.clickToolbar(name, self.plugin.media.edit); });
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/media/media.js
JavaScript
oos
5,343
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php *******************************************************************************/ KindEditor.plugin('wordpaste', function(K) { var self = this, name = 'wordpaste'; self.clickToolbar(name, function() { var lang = self.lang(name + '.'), html = '<div style="padding:10px 20px;">' + '<div style="margin-bottom:10px;">' + lang.comment + '</div>' + '<iframe class="ke-textarea" frameborder="0" style="width:408px;height:260px;"></iframe>' + '</div>', dialog = self.createDialog({ name : name, width : 450, title : self.lang(name), body : html, yesBtn : { name : self.lang('yes'), click : function(e) { var str = doc.body.innerHTML; str = K.clearMsWord(str, self.filterMode ? self.htmlTags : K.options.htmlTags); self.insertHtml(str).hideDialog().focus(); } } }), div = dialog.div, iframe = K('iframe', div), doc = K.iframeDoc(iframe); if (!K.IE) { doc.designMode = 'on'; } doc.open(); doc.write('<!doctype html><html><head><title>WordPaste</title></head>'); doc.write('<body style="background-color:#FFF;font-size:12px;margin:2px;">'); if (!K.IE) { doc.write('<br />'); } doc.write('</body></html>'); doc.close(); if (K.IE) { doc.body.contentEditable = 'true'; } iframe[0].contentWindow.focus(); }); });
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/wordpaste/wordpaste.js
JavaScript
oos
1,663
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php *******************************************************************************/ KindEditor.plugin('quickformat', function(K) { var self = this, name = 'quickformat', blockMap = K.toMap('blockquote,center,div,h1,h2,h3,h4,h5,h6,p'); self.clickToolbar(name, function() { self.focus(); var doc = self.edit.doc, range = self.cmd.range, child = K(doc.body).first(), next, nodeList = [], subList = [], bookmark = range.createBookmark(true); while(child) { next = child.next(); if (blockMap[child.name]) { child.html(child.html().replace(/^(\s|&nbsp;| )+/ig, '')); child.css('text-indent', '2em'); } else { subList.push(child); } if (!next || (blockMap[next.name] || blockMap[child.name] && !blockMap[next.name])) { if (subList.length > 0) { nodeList.push(subList); } subList = []; } child = next; } K.each(nodeList, function(i, subList) { var wrapper = K('<p style="text-indent:2em;"></p>', doc); subList[0].before(wrapper); K.each(subList, function(i, knode) { wrapper.append(knode); }); }); range.moveToBookmark(bookmark); self.addBookmark(); }); }); /** -------------------------- abcd<br /> 1234<br /> to <p style="text-indent:2em;"> abcd<br /> 1234<br /> </p> -------------------------- &nbsp; abcd<img>1233 <p>1234</p> to <p style="text-indent:2em;">abcd<img>1233</p> <p style="text-indent:2em;">1234</p> -------------------------- */
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/quickformat/quickformat.js
JavaScript
oos
1,805
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php *******************************************************************************/ KindEditor.plugin('clearhtml', function(K) { var self = this, name = 'clearhtml'; self.clickToolbar(name, function() { self.focus(); var html = self.html(); html = html.replace(/(<script[^>]*>)([\s\S]*?)(<\/script>)/ig, ''); html = html.replace(/(<style[^>]*>)([\s\S]*?)(<\/style>)/ig, ''); html = K.formatHtml(html, { a : ['href', 'target'], embed : ['src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess'], img : ['src', 'width', 'height', 'border', 'alt', 'title', '.width', '.height'], table : ['border'], 'td,th' : ['rowspan', 'colspan'], 'div,hr,br,tbody,tr,p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : [] }); self.html(html); self.cmd.selection(true); self.addBookmark(); }); });
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/clearhtml/clearhtml.js
JavaScript
oos
1,185
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php *******************************************************************************/ KindEditor.plugin('lineheight', function(K) { var self = this, name = 'lineheight', lang = self.lang(name + '.'); self.clickToolbar(name, function() { var curVal = '', commonNode = self.cmd.commonNode({'*' : '.line-height'}); if (commonNode) { curVal = commonNode.css('line-height'); } var menu = self.createMenu({ name : name, width : 150 }); K.each(lang.lineHeight, function(i, row) { K.each(row, function(key, val) { menu.addItem({ title : val, checked : curVal === key, click : function() { self.cmd.toggle('<span style="line-height:' + key + ';"></span>', { span : '.line-height=' + key }); self.updateState(); self.addBookmark(); self.hideMenu(); } }); }); }); }); });
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/lineheight/lineheight.js
JavaScript
oos
1,181
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php *******************************************************************************/ KindEditor.plugin('image', function(K) { var self = this, name = 'image', allowImageUpload = K.undef(self.allowImageUpload, true), allowFileManager = K.undef(self.allowFileManager, false), uploadJson = K.undef(self.uploadJson, self.basePath + '/ashx/upload_json.ashx'), imgPath = self.basePath + 'plugins/image/images/', lang = self.lang(name + '.'); self.plugin.imageDialog = function(options) { var imageUrl = K.undef(options.imageUrl, 'http://'), imageWidth = K.undef(options.imageWidth, ''), imageHeight = K.undef(options.imageHeight, ''), imageTitle = K.undef(options.imageTitle, ''), imageAlign = K.undef(options.imageAlign, ''), clickFn = options.clickFn; var html = [ '<div style="padding:10px 20px;">', //tabs '<div class="tabs"></div>', //url or file '<div class="ke-dialog-row">', '<div class="tab1" style="display:none;">', '<label for="keUrl" style="width:60px;">' + lang.remoteUrl + '</label>', '<input type="text" id="keUrl" class="ke-input-text" name="url" value="" style="width:200px;" /> &nbsp;', '<span class="ke-button-common ke-button-outer">', '<input type="button" class="ke-button-common ke-button" name="viewServer" value="' + lang.viewServer + '" />', '</span>', '</div>', '<div class="tab2" style="display:none;">', '<label style="width:60px;">' + lang.localUrl + '</label>', '<input type="text" name="localUrl" class="ke-input-text" tabindex="-1" style="width:200px;" readonly="true" /> &nbsp;', '<input type="button" class="ke-upload-button" value="' + lang.viewServer + '" />', '</div>', '</div>', //size '<div class="ke-dialog-row">', '<label for="keWidth" style="width:60px;">' + lang.size + '</label>', lang.width + ' <input type="text" id="keWidth" class="ke-input-text ke-input-number" name="width" value="" maxlength="4" /> ', lang.height + ' <input type="text" class="ke-input-text ke-input-number" name="height" value="" maxlength="4" /> ', '<img class="ke-refresh-btn" src="' + imgPath + 'refresh.gif" width="16" height="16" alt="" style="cursor:pointer;" />', '</div>', //align '<div class="ke-dialog-row">', '<label style="width:60px;">' + lang.align + '</label>', '<input type="radio" name="align" class="ke-inline-block" value="" checked="checked" /> <img name="defaultImg" src="' + imgPath + 'align_top.gif" width="23" height="25" alt="" />', ' <input type="radio" name="align" class="ke-inline-block" value="left" /> <img name="leftImg" src="' + imgPath + 'align_left.gif" width="23" height="25" alt="" />', ' <input type="radio" name="align" class="ke-inline-block" value="right" /> <img name="rightImg" src="' + imgPath + 'align_right.gif" width="23" height="25" alt="" />', '</div>', //title '<div class="ke-dialog-row">', '<label for="keTitle" style="width:60px;">' + lang.imgTitle + '</label>', '<input type="text" id="keTitle" class="ke-input-text" name="title" value="" style="width:200px;" /></div>', '</div>', '</div>' ].join(''); var dialogWidth = allowImageUpload ? 450 : 400; dialogHeight = allowImageUpload ? 300 : 250; var dialog = self.createDialog({ name : name, width : dialogWidth, height : dialogHeight, title : self.lang(name), body : html, yesBtn : { name : self.lang('yes'), click : function(e) { // insert local image if (tabs && tabs.selectedIndex === 1) { dialog.showLoading(self.lang('uploadLoading')); uploadbutton.submit(); localUrlBox.val(''); return; } // insert remote image var url = K.trim(urlBox.val()), width = widthBox.val(), height = heightBox.val(), title = titleBox.val(), align = ''; alignBox.each(function() { if (this.checked) { align = this.value; return false; } }); if (url == 'http://' || K.invalidUrl(url)) { alert(self.lang('invalidUrl')); urlBox[0].focus(); return; } if (!/^\d*$/.test(width)) { alert(self.lang('invalidWidth')); widthBox[0].focus(); return; } if (!/^\d*$/.test(height)) { alert(self.lang('invalidHeight')); heightBox[0].focus(); return; } clickFn.call(self, url, title, width, height, 0, align); } }, beforeRemove : function() { viewServerBtn.remove(); widthBox.remove(); heightBox.remove(); refreshBtn.remove(); uploadbutton.remove(); } }), div = dialog.div; var tabs; if (allowImageUpload) { tabs = K.tabs({ src : K('.tabs', div), afterSelect : function(i) { } }); tabs.add({ title : lang.remoteImage, panel : K('.tab1', div) }); tabs.add({ title : lang.localImage, panel : K('.tab2', div) }); tabs.select(0); } else { K('.tab1', div).show(); } var urlBox = K('[name="url"]', div), localUrlBox = K('[name="localUrl"]', div), viewServerBtn = K('[name="viewServer"]', div), widthBox = K('[name="width"]', div), heightBox = K('[name="height"]', div), refreshBtn = K('.ke-refresh-btn', div), titleBox = K('[name="title"]', div), alignBox = K('[name="align"]'); var uploadbutton = K.uploadbutton({ button : K('.ke-upload-button', div)[0], fieldName : 'imgFile', url : K.addParam(uploadJson, 'dir=image'), afterUpload : function(data) { dialog.hideLoading(); if (data.error === 0) { var width = widthBox.val(), height = heightBox.val(), title = titleBox.val(), align = ''; alignBox.each(function() { if (this.checked) { align = this.value; return false; } }); var url = K.formatUrl(data.url, 'absolute'); clickFn.call(self, url, title, width, height, 0, align); if (self.afterUpload) { self.afterUpload.call(self, url); } } else { alert(data.message); } }, afterError : function(html) { dialog.hideLoading(); self.errorDialog(html); } }); uploadbutton.fileBox.change(function(e) { localUrlBox.val(uploadbutton.fileBox.val()); }); if (allowFileManager) { viewServerBtn.click(function(e) { self.loadPlugin('filemanager', function() { self.plugin.filemanagerDialog({ viewType : 'VIEW', dirName : 'image', clickFn : function(url, title) { if (self.dialogs.length > 1) { K('[name="url"]', div).val(url); self.hideDialog(); } } }); }); }); } else { viewServerBtn.hide(); } var originalWidth = 0, originalHeight = 0; function setSize(width, height) { widthBox.val(width); heightBox.val(height); originalWidth = width; originalHeight = height; } refreshBtn.click(function(e) { var tempImg = K('<img src="' + urlBox.val() + '" />', document).css({ position : 'absolute', visibility : 'hidden', top : 0, left : '-1000px' }); K(document.body).append(tempImg); setSize(tempImg.width(), tempImg.height()); tempImg.remove(); }); widthBox.change(function(e) { if (originalWidth > 0) { heightBox.val(Math.round(originalHeight / originalWidth * parseInt(this.value, 10))); } }); heightBox.change(function(e) { if (originalHeight > 0) { widthBox.val(Math.round(originalWidth / originalHeight * parseInt(this.value, 10))); } }); urlBox.val(options.imageUrl); setSize(options.imageWidth, options.imageHeight); titleBox.val(options.imageTitle); alignBox.each(function() { if (this.value === options.imageAlign) { this.checked = true; return false; } }); urlBox[0].focus(); urlBox[0].select(); return dialog; }; self.plugin.image = { edit : function() { var img = self.plugin.getSelectedImage(); self.plugin.imageDialog({ imageUrl : img ? img.attr('data-ke-src') : 'http://', imageWidth : img ? img.width() : '', imageHeight : img ? img.height() : '', imageTitle : img ? img.attr('title') : '', imageAlign : img ? img.attr('align') : '', clickFn : function(url, title, width, height, border, align) { self.exec('insertimage', url, title, width, height, border, align); // Bugfix: [Firefox] 上传图片后,总是出现正在加载的样式,需要延迟执行hideDialog setTimeout(function() { self.hideDialog().focus(); }, 0); } }); }, 'delete' : function() { self.plugin.getSelectedImage().remove(); } }; self.clickToolbar(name, self.plugin.image.edit); });
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/image/image.js
JavaScript
oos
9,122
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php *******************************************************************************/ KindEditor.plugin('anchor', function(K) { var self = this, name = 'anchor', lang = self.lang(name + '.'); self.plugin.anchor = { edit : function() { var html = ['<div style="padding:10px 20px;">', '<div class="ke-dialog-row">', '<label for="keName">' + lang.name + '</label>', '<input class="ke-input-text" type="text" id="keName" name="name" value="" style="width:100px;" />', '</div>', '</div>'].join(''); var dialog = self.createDialog({ name : name, width : 300, title : self.lang(name), body : html, yesBtn : { name : self.lang('yes'), click : function(e) { self.insertHtml('<a name="' + nameBox.val() + '">').hideDialog().focus(); } } }); var div = dialog.div, nameBox = K('input[name="name"]', div); var img = self.plugin.getSelectedAnchor(); if (img) { nameBox.val(unescape(img.attr('data-ke-name'))); } nameBox[0].focus(); nameBox[0].select(); }, 'delete' : function() { self.plugin.getSelectedAnchor().remove(); } }; self.clickToolbar(name, self.plugin.anchor.edit); });
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/anchor/anchor.js
JavaScript
oos
1,518
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php *******************************************************************************/ // google code prettify: http://google-code-prettify.googlecode.com/ // http://google-code-prettify.googlecode.com/ KindEditor.plugin('code', function(K) { var self = this, name = 'code'; self.clickToolbar(name, function() { var lang = self.lang(name + '.'), html = ['<div style="padding:10px 20px;">', '<div class="ke-dialog-row">', '<select class="ke-code-type">', '<option value="js">JavaScript</option>', '<option value="html">HTML</option>', '<option value="css">CSS</option>', '<option value="php">PHP</option>', '<option value="pl">Perl</option>', '<option value="py">Python</option>', '<option value="rb">Ruby</option>', '<option value="java">Java</option>', '<option value="vb">ASP/VB</option>', '<option value="cpp">C/C++</option>', '<option value="cs">C#</option>', '<option value="xml">XML</option>', '<option value="bsh">Shell</option>', '<option value="">Other</option>', '</select>', '</div>', '<textarea class="ke-textarea" style="width:408px;height:260px;"></textarea>', '</div>'].join(''), dialog = self.createDialog({ name : name, width : 450, title : self.lang(name), body : html, yesBtn : { name : self.lang('yes'), click : function(e) { var type = K('.ke-code-type', dialog.div).val(), code = textarea.val(), cls = type === '' ? '' : ' lang-' + type, html = '<pre class="prettyprint' + cls + '">\n' + K.escape(code) + '</pre> '; self.insertHtml(html).hideDialog().focus(); } } }), textarea = K('textarea', dialog.div); textarea[0].focus(); }); });
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/code/code.js
JavaScript
oos
2,071
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} pre.prettyprint { border: 0; border-left: 3px solid rgb(204, 204, 204); margin-left: 2em; padding: 0.5em; font-size: 110%; display: block; font-family: "Consolas", "Monaco", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; margin: 1em 0px; white-space: pre; }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/code/prettify.css
CSS
oos
960
<!doctype html> <html> <head> <meta charset="utf-8" /> </head> <body> <h3> 标题 </h3> <table style="width:100%;" cellpadding="2" cellspacing="0" border="1"> <tbody> <tr> <td> <h3>标题1</h3> </td> <td> <h3>标题1</h3> </td> </tr> <tr> <td> 内容1 </td> <td> 内容2 </td> </tr> <tr> <td> 内容3 </td> <td> 内容4 </td> </tr> </tbody> </table> <p> 表格说明 </p> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/template/html/2.html
HTML
oos
498
<!doctype html> <html> <head> <meta charset="utf-8" /> </head> <body> <p> 在此处输入内容 </p> <ol> <li> 描述1 </li> <li> 描述2 </li> <li> 描述3 </li> </ol> <p> 在此处输入内容 </p> <ul> <li> 描述1 </li> <li> 描述2 </li> <li> 描述3 </li> </ul> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/template/html/3.html
HTML
oos
338
<!doctype html> <html> <head> <meta charset="utf-8" /> </head> <body> <h3> <img align="left" height="100" style="margin-right: 10px" width="100" />在此处输入标题 </h3> <p> 在此处输入内容 </p> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/template/html/1.html
HTML
oos
230
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php *******************************************************************************/ KindEditor.plugin('template', function(K) { var self = this, name = 'template', lang = self.lang(name + '.'), htmlPath = self.pluginsPath + name + '/html/'; function getFilePath(fileName) { return htmlPath + fileName + '?ver=' + encodeURIComponent(K.DEBUG ? K.TIME : K.VERSION); } self.clickToolbar(name, function() { var lang = self.lang(name + '.'), arr = ['<div class="ke-plugin-template" style="padding:10px 20px;">', '<div class="ke-header">', // left start '<div class="ke-left">', lang. selectTemplate + ' <select>']; K.each(lang.fileList, function(key, val) { arr.push('<option value="' + key + '">' + val + '</option>'); }); html = [arr.join(''), '</select></div>', // right start '<div class="ke-right">', '<input type="checkbox" id="keReplaceFlag" name="replaceFlag" value="1" /> <label for="keReplaceFlag">' + lang.replaceContent + '</label>', '</div>', '<div class="ke-clearfix"></div>', '</div>', '<iframe class="ke-textarea" frameborder="0" style="width:458px;height:260px;background-color:#FFF;"></iframe>', '</div>'].join(''); var dialog = self.createDialog({ name : name, width : 500, title : self.lang(name), body : html, yesBtn : { name : self.lang('yes'), click : function(e) { var doc = K.iframeDoc(iframe); self[checkbox[0].checked ? 'html' : 'insertHtml'](doc.body.innerHTML).hideDialog().focus(); } } }); var selectBox = K('select', dialog.div), checkbox = K('[name="replaceFlag"]', dialog.div), iframe = K('iframe', dialog.div); checkbox[0].checked = true; iframe.attr('src', getFilePath(selectBox.val())); selectBox.change(function() { iframe.attr('src', getFilePath(this.value)); }); }); });
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/template/template.js
JavaScript
oos
2,191
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php *******************************************************************************/ KindEditor.plugin('filemanager', function(K) { var self = this, name = 'filemanager', fileManagerJson = K.undef(self.fileManagerJson, self.basePath + '/ashx/file_manager_json.ashx'), imgPath = self.pluginsPath + name + '/images/', lang = self.lang(name + '.'); function makeFileTitle(filename, filesize, datetime) { return filename + ' (' + Math.ceil(filesize / 1024) + 'KB, ' + datetime + ')'; } function bindTitle(el, data) { if (data.is_dir) { el.attr('title', data.filename); } else { el.attr('title', makeFileTitle(data.filename, data.filesize, data.datetime)); } } self.plugin.filemanagerDialog = function(options) { var width = K.undef(options.width, 520), height = K.undef(options.height, 510), dirName = K.undef(options.dirName, ''), viewType = K.undef(options.viewType, 'VIEW').toUpperCase(), // "LIST" or "VIEW" clickFn = options.clickFn; var html = [ '<div style="padding:10px 20px;">', // header start '<div class="ke-plugin-filemanager-header">', // left start '<div class="ke-left">', '<img class="ke-inline-block" name="moveupImg" src="' + imgPath + 'go-up.gif" width="16" height="16" border="0" alt="" /> ', '<a class="ke-inline-block" name="moveupLink" href="javascript:;">' + lang.moveup + '</a>', '</div>', // right start '<div class="ke-right">', lang.viewType + ' <select class="ke-inline-block" name="viewType">', '<option value="VIEW">' + lang.viewImage + '</option>', '<option value="LIST">' + lang.listImage + '</option>', '</select> ', lang.orderType + ' <select class="ke-inline-block" name="orderType">', '<option value="NAME">' + lang.fileName + '</option>', '<option value="SIZE">' + lang.fileSize + '</option>', '<option value="TYPE">' + lang.fileType + '</option>', '</select>', '</div>', '<div class="ke-clearfix"></div>', '</div>', // body start '<div class="ke-plugin-filemanager-body"></div>', '</div>' ].join(''); var dialog = self.createDialog({ name : name, width : width, height : height, title : self.lang(name), body : html }), div = dialog.div, bodyDiv = K('.ke-plugin-filemanager-body', div), moveupImg = K('[name="moveupImg"]', div), moveupLink = K('[name="moveupLink"]', div), viewServerBtn = K('[name="viewServer"]', div), viewTypeBox = K('[name="viewType"]', div), orderTypeBox = K('[name="orderType"]', div); function reloadPage(path, order, func) { var param = 'path=' + path + '&order=' + order + '&dir=' + dirName; dialog.showLoading(self.lang('ajaxLoading')); K.ajax(K.addParam(fileManagerJson, param + '&' + new Date().getTime()), function(data) { dialog.hideLoading(); func(data); }); } var elList = []; function bindEvent(el, result, data, createFunc) { var fileUrl = K.formatUrl(result.current_url + data.filename, 'absolute'), dirPath = encodeURIComponent(result.current_dir_path + data.filename + '/'); if (data.is_dir) { el.click(function(e) { reloadPage(dirPath, orderTypeBox.val(), createFunc); }); } else if (data.is_photo) { el.click(function(e) { clickFn.call(this, fileUrl, data.filename); }); } else { el.click(function(e) { clickFn.call(this, fileUrl, data.filename); }); } elList.push(el); } function createCommon(result, createFunc) { // remove events K.each(elList, function() { this.unbind(); }); moveupLink.unbind(); viewTypeBox.unbind(); orderTypeBox.unbind(); // add events if (result.current_dir_path) { moveupLink.click(function(e) { reloadPage(result.moveup_dir_path, orderTypeBox.val(), createFunc); }); } function changeFunc() { if (viewTypeBox.val() == 'VIEW') { reloadPage(result.current_dir_path, orderTypeBox.val(), createView); } else { reloadPage(result.current_dir_path, orderTypeBox.val(), createList); } } viewTypeBox.change(changeFunc); orderTypeBox.change(changeFunc); bodyDiv.html(''); } function createList(result) { createCommon(result, createList); var table = document.createElement('table'); table.className = 'ke-table'; table.cellPadding = 0; table.cellSpacing = 0; table.border = 0; bodyDiv.append(table); var fileList = result.file_list; for (var i = 0, len = fileList.length; i < len; i++) { var data = fileList[i], row = K(table.insertRow(i)); row.mouseover(function(e) { K(this).addClass('ke-on'); }) .mouseout(function(e) { K(this).removeClass('ke-on'); }); var iconUrl = imgPath + (data.is_dir ? 'folder-16.gif' : 'file-16.gif'), img = K('<img src="' + iconUrl + '" width="16" height="16" alt="' + data.filename + '" align="absmiddle" />'), cell0 = K(row[0].insertCell(0)).addClass('ke-cell ke-name').append(img).append(document.createTextNode(' ' + data.filename)); if (!data.is_dir || data.has_file) { row.css('cursor', 'pointer'); cell0.attr('title', data.filename); bindEvent(cell0, result, data, createList); } else { cell0.attr('title', lang.emptyFolder); } K(row[0].insertCell(1)).addClass('ke-cell ke-size').html(data.is_dir ? '-' : Math.ceil(data.filesize / 1024) + 'KB'); K(row[0].insertCell(2)).addClass('ke-cell ke-datetime').html(data.datetime); } } function createView(result) { createCommon(result, createView); var fileList = result.file_list; for (var i = 0, len = fileList.length; i < len; i++) { var data = fileList[i], div = K('<div class="ke-inline-block ke-item"></div>'); bodyDiv.append(div); var photoDiv = K('<div class="ke-inline-block ke-photo"></div>') .mouseover(function(e) { K(this).addClass('ke-on'); }) .mouseout(function(e) { K(this).removeClass('ke-on'); }); div.append(photoDiv); var fileUrl = result.current_url + data.filename, iconUrl = data.is_dir ? imgPath + 'folder-64.gif' : (data.is_photo ? fileUrl : imgPath + 'file-64.gif'); var img = K('<img src="' + iconUrl + '" width="80" height="80" alt="' + data.filename + '" />'); if (!data.is_dir || data.has_file) { photoDiv.css('cursor', 'pointer'); bindTitle(photoDiv, data); bindEvent(photoDiv, result, data, createView); } else { photoDiv.attr('title', lang.emptyFolder); } photoDiv.append(img); div.append('<div class="ke-name" title="' + data.filename + '">' + data.filename + '</div>'); } } viewTypeBox.val(viewType); reloadPage('', orderTypeBox.val(), viewType == 'VIEW' ? createView : createList); return dialog; } });
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/filemanager/filemanager.js
JavaScript
oos
7,160
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php *******************************************************************************/ KindEditor.plugin('table', function(K) { var self = this, name = 'table', lang = self.lang(name + '.'), zeroborder = 'ke-zeroborder'; // 取得下一行cell的index function _getCellIndex(table, row, cell) { var rowSpanCount = 0; for (var i = 0, len = row.cells.length; i < len; i++) { if (row.cells[i] == cell) { break; } rowSpanCount += row.cells[i].rowSpan - 1; } return cell.cellIndex - rowSpanCount; } self.plugin.table = { //insert or modify table prop : function(isInsert) { var html = [ '<div style="padding:10px 20px;">', //rows, cols '<div class="ke-dialog-row">', '<label for="keRows" style="width:90px;">' + lang.cells + '</label>', lang.rows + ' <input type="text" id="keRows" class="ke-input-text ke-input-number" name="rows" value="" maxlength="4" /> &nbsp; ', lang.cols + ' <input type="text" class="ke-input-text ke-input-number" name="cols" value="" maxlength="4" />', '</div>', //width, height '<div class="ke-dialog-row">', '<label for="keWidth" style="width:90px;">' + lang.size + '</label>', lang.width + ' <input type="text" id="keWidth" class="ke-input-text ke-input-number" name="width" value="" maxlength="4" /> &nbsp; ', '<select name="widthType">', '<option value="%">' + lang.percent + '</option>', '<option value="px">' + lang.px + '</option>', '</select> &nbsp; ', lang.height + ' <input type="text" class="ke-input-text ke-input-number" name="height" value="" maxlength="4" /> &nbsp; ', '<select name="heightType">', '<option value="%">' + lang.percent + '</option>', '<option value="px">' + lang.px + '</option>', '</select>', '</div>', //space, padding '<div class="ke-dialog-row">', '<label for="kePadding" style="width:90px;">' + lang.space + '</label>', lang.padding + ' <input type="text" id="kePadding" class="ke-input-text ke-input-number" name="padding" value="" maxlength="4" /> &nbsp; ', lang.spacing + ' <input type="text" class="ke-input-text ke-input-number" name="spacing" value="" maxlength="4" />', '</div>', //align '<div class="ke-dialog-row">', '<label for="keAlign" style="width:90px;">' + lang.align + '</label>', '<select id="keAlign" name="align">', '<option value="">' + lang.alignDefault + '</option>', '<option value="left">' + lang.alignLeft + '</option>', '<option value="center">' + lang.alignCenter + '</option>', '<option value="right">' + lang.alignRight + '</option>', '</select>', '</div>', //border '<div class="ke-dialog-row">', '<label for="keBorder" style="width:90px;">' + lang.border + '</label>', lang.borderWidth + ' <input type="text" id="keBorder" class="ke-input-text ke-input-number" name="border" value="" maxlength="4" /> &nbsp; ', lang.borderColor + ' <span class="ke-inline-block ke-input-color"></span>', '</div>', //background color '<div class="ke-dialog-row">', '<label for="keBgColor" style="width:90px;">' + lang.backgroundColor + '</label>', '<span class="ke-inline-block ke-input-color"></span>', '</div>', '</div>' ].join(''); var picker, currentElement; function removePicker() { if (picker) { picker.remove(); picker = null; currentElement = null; } } var dialog = self.createDialog({ name : name, width : 500, height : 300, title : self.lang(name), body : html, beforeDrag : removePicker, beforeRemove : function() { removePicker(); colorBox.unbind(); }, yesBtn : { name : self.lang('yes'), click : function(e) { var rows = rowsBox.val(), cols = colsBox.val(), width = widthBox.val(), height = heightBox.val(), widthType = widthTypeBox.val(), heightType = heightTypeBox.val(), padding = paddingBox.val(), spacing = spacingBox.val(), align = alignBox.val(), border = borderBox.val(), borderColor = K(colorBox[0]).html() || '', bgColor = K(colorBox[1]).html() || ''; if (rows == 0 || !/^\d+$/.test(rows)) { alert(self.lang('invalidRows')); rowsBox[0].focus(); return; } if (cols == 0 || !/^\d+$/.test(cols)) { alert(self.lang('invalidRows')); colsBox[0].focus(); return; } if (!/^\d*$/.test(width)) { alert(self.lang('invalidWidth')); widthBox[0].focus(); return; } if (!/^\d*$/.test(height)) { alert(self.lang('invalidHeight')); heightBox[0].focus(); return; } if (!/^\d*$/.test(padding)) { alert(self.lang('invalidPadding')); paddingBox[0].focus(); return; } if (!/^\d*$/.test(spacing)) { alert(self.lang('invalidSpacing')); spacingBox[0].focus(); return; } if (!/^\d*$/.test(border)) { alert(self.lang('invalidBorder')); borderBox[0].focus(); return; } //modify table if (table) { if (width !== '') { table.width(width + widthType); } else { table.css('width', ''); } if (table[0].width !== undefined) { table.removeAttr('width'); } if (height !== '') { table.height(height + heightType); } else { table.css('height', ''); } if (table[0].height !== undefined) { table.removeAttr('height'); } table.css('background-color', bgColor); if (table[0].bgColor !== undefined) { table.removeAttr('bgColor'); } if (padding !== '') { table[0].cellPadding = padding; } else { table.removeAttr('cellPadding'); } if (spacing !== '') { table[0].cellSpacing = spacing; } else { table.removeAttr('cellSpacing'); } if (align !== '') { table[0].align = align; } else { table.removeAttr('align'); } if (border !== '') { table.attr('border', border); } else { table.removeAttr('border'); } if (border === '' || border === '0') { table.addClass(zeroborder); } else { table.removeClass(zeroborder); } if (borderColor !== '') { table.attr('borderColor', borderColor); } else { table.removeAttr('borderColor'); } self.hideDialog().focus(); return; } //insert new table var style = ''; if (width !== '') { style += 'width:' + width + widthType + ';'; } if (height !== '') { style += 'height:' + height + heightType + ';'; } if (bgColor !== '') { style += 'background-color:' + bgColor + ';'; } var html = '<table'; if (style !== '') { html += ' style="' + style + '"'; } if (padding !== '') { html += ' cellpadding="' + padding + '"'; } if (spacing !== '') { html += ' cellspacing="' + spacing + '"'; } if (align !== '') { html += ' align="' + align + '"'; } if (border !== '') { html += ' border="' + border + '"'; } if (border === '' || border === '0') { html += ' class="' + zeroborder + '"'; } if (borderColor !== '') { html += ' bordercolor="' + borderColor + '"'; } html += '>'; for (var i = 0; i < rows; i++) { html += '<tr>'; for (var j = 0; j < cols; j++) { html += '<td>' + (K.IE ? '&nbsp;' : '<br />') + '</td>'; } html += '</tr>'; } html += '</table>'; if (!K.IE) { html += '<br />'; } self.insertHtml(html); self.select().hideDialog().focus(); self.addBookmark(); } } }), div = dialog.div, rowsBox = K('[name="rows"]', div).val(3), colsBox = K('[name="cols"]', div).val(2), widthBox = K('[name="width"]', div).val(100), heightBox = K('[name="height"]', div), widthTypeBox = K('[name="widthType"]', div), heightTypeBox = K('[name="heightType"]', div), paddingBox = K('[name="padding"]', div).val(2), spacingBox = K('[name="spacing"]', div).val(0), alignBox = K('[name="align"]', div), borderBox = K('[name="border"]', div).val(1), colorBox = K('.ke-input-color', div); function setColor(box, color) { color = color.toUpperCase(); box.css('background-color', color); box.css('color', color === '#000000' ? '#FFFFFF' : '#000000'); box.html(color); } setColor(K(colorBox[0]), '#000000'); setColor(K(colorBox[1]), ''); function clickHandler(e) { removePicker(); if (!picker || this !== currentElement) { var box = K(this), pos = box.pos(); picker = K.colorpicker({ x : pos.x, y : pos.y + box.height(), z : 811214, selectedColor : K(this).html(), colors : self.colorTable, noColor : self.lang('noColor'), shadowMode : self.shadowMode, click : function(color) { setColor(box, color); removePicker(); } }); currentElement = this; } } colorBox.click(clickHandler); // foucs and select rowsBox[0].focus(); rowsBox[0].select(); var table; if (isInsert) { return; } //get selected table node table = self.plugin.getSelectedTable(); if (table) { rowsBox.val(table[0].rows.length); colsBox.val(table[0].rows.length > 0 ? table[0].rows[0].cells.length : 0); rowsBox.attr('disabled', true); colsBox.attr('disabled', true); var match, tableWidth = table[0].style.width || table[0].width, tableHeight = table[0].style.height || table[0].height; if (tableWidth !== undefined && (match = /^(\d+)((?:px|%)*)$/.exec(tableWidth))) { widthBox.val(match[1]); widthTypeBox.val(match[2]); } else { widthBox.val(''); } if (tableHeight !== undefined && (match = /^(\d+)((?:px|%)*)$/.exec(tableHeight))) { heightBox.val(match[1]); heightTypeBox.val(match[2]); } paddingBox.val(table[0].cellPadding || ''); spacingBox.val(table[0].cellSpacing || ''); alignBox.val(table[0].align || ''); borderBox.val(table[0].border === undefined ? '' : table[0].border); setColor(K(colorBox[0]), K.toHex(table.attr('borderColor') || '')); setColor(K(colorBox[1]), K.toHex(table[0].style.backgroundColor || table[0].bgColor || '')); widthBox[0].focus(); widthBox[0].select(); } }, //modify cell cellprop : function() { var html = [ '<div style="padding:10px 20px;">', //width, height '<div class="ke-dialog-row">', '<label for="keWidth" style="width:90px;">' + lang.size + '</label>', lang.width + ' <input type="text" id="keWidth" class="ke-input-text ke-input-number" name="width" value="" maxlength="4" /> &nbsp; ', '<select name="widthType">', '<option value="%">' + lang.percent + '</option>', '<option value="px">' + lang.px + '</option>', '</select> &nbsp; ', lang.height + ' <input type="text" class="ke-input-text ke-input-number" name="height" value="" maxlength="4" /> &nbsp; ', '<select name="heightType">', '<option value="%">' + lang.percent + '</option>', '<option value="px">' + lang.px + '</option>', '</select>', '</div>', //align '<div class="ke-dialog-row">', '<label for="keAlign" style="width:90px;">' + lang.align + '</label>', lang.textAlign + ' <select id="keAlign" name="textAlign">', '<option value="">' + lang.alignDefault + '</option>', '<option value="left">' + lang.alignLeft + '</option>', '<option value="center">' + lang.alignCenter + '</option>', '<option value="right">' + lang.alignRight + '</option>', '</select> ', lang.verticalAlign + ' <select name="verticalAlign">', '<option value="">' + lang.alignDefault + '</option>', '<option value="top">' + lang.alignTop + '</option>', '<option value="middle">' + lang.alignMiddle + '</option>', '<option value="bottom">' + lang.alignBottom + '</option>', '<option value="baseline">' + lang.alignBaseline + '</option>', '</select>', '</div>', //border '<div class="ke-dialog-row">', '<label for="keBorder" style="width:90px;">' + lang.border + '</label>', lang.borderWidth + ' <input type="text" id="keBorder" class="ke-input-text ke-input-number" name="border" value="" maxlength="4" /> &nbsp; ', lang.borderColor + ' <span class="ke-inline-block ke-input-color"></span>', '</div>', //background color '<div class="ke-dialog-row">', '<label for="keBgColor" style="width:90px;">' + lang.backgroundColor + '</label>', '<span class="ke-inline-block ke-input-color"></span>', '</div>', '</div>' ].join(''); var picker, currentElement; function removePicker() { if (picker) { picker.remove(); picker = null; currentElement = null; } } var dialog = self.createDialog({ name : name, width : 500, height : 220, title : self.lang('tablecell'), body : html, beforeDrag : removePicker, beforeRemove : function() { removePicker(); colorBox.unbind(); }, yesBtn : { name : self.lang('yes'), click : function(e) { var width = widthBox.val(), height = heightBox.val(), widthType = widthTypeBox.val(), heightType = heightTypeBox.val(), padding = paddingBox.val(), spacing = spacingBox.val(), textAlign = textAlignBox.val(), verticalAlign = verticalAlignBox.val(), border = borderBox.val(), borderColor = K(colorBox[0]).html() || '', bgColor = K(colorBox[1]).html() || ''; if (!/^\d*$/.test(width)) { alert(self.lang('invalidWidth')); widthBox[0].focus(); return; } if (!/^\d*$/.test(height)) { alert(self.lang('invalidHeight')); heightBox[0].focus(); return; } if (!/^\d*$/.test(border)) { alert(self.lang('invalidBorder')); borderBox[0].focus(); return; } cell.css({ width : width !== '' ? (width + widthType) : '', height : height !== '' ? (height + heightType) : '', 'background-color' : bgColor, 'text-align' : textAlign, 'vertical-align' : verticalAlign, 'border-width' : border, 'border-style' : border !== '' ? 'solid' : '', 'border-color' : borderColor }); self.hideDialog().focus(); self.addBookmark(); } } }), div = dialog.div, widthBox = K('[name="width"]', div).val(100), heightBox = K('[name="height"]', div), widthTypeBox = K('[name="widthType"]', div), heightTypeBox = K('[name="heightType"]', div), paddingBox = K('[name="padding"]', div).val(2), spacingBox = K('[name="spacing"]', div).val(0), textAlignBox = K('[name="textAlign"]', div), verticalAlignBox = K('[name="verticalAlign"]', div), borderBox = K('[name="border"]', div).val(1), colorBox = K('.ke-input-color', div); function setColor(box, color) { color = color.toUpperCase(); box.css('background-color', color); box.css('color', color === '#000000' ? '#FFFFFF' : '#000000'); box.html(color); } setColor(K(colorBox[0]), '#000000'); setColor(K(colorBox[1]), ''); function clickHandler(e) { removePicker(); if (!picker || this !== currentElement) { var box = K(this), pos = box.pos(); picker = K.colorpicker({ x : pos.x, y : pos.y + box.height(), z : 811214, selectedColor : K(this).html(), colors : self.colorTable, noColor : self.lang('noColor'), shadowMode : self.shadowMode, click : function(color) { setColor(box, color); removePicker(); } }); currentElement = this; } } colorBox.click(clickHandler); // foucs and select widthBox[0].focus(); widthBox[0].select(); // get selected cell var cell = self.plugin.getSelectedCell(); var match, cellWidth = cell[0].style.width || cell[0].width || '', cellHeight = cell[0].style.height || cell[0].height || ''; if ((match = /^(\d+)((?:px|%)*)$/.exec(cellWidth))) { widthBox.val(match[1]); widthTypeBox.val(match[2]); } else { widthBox.val(''); } if ((match = /^(\d+)((?:px|%)*)$/.exec(cellHeight))) { heightBox.val(match[1]); heightTypeBox.val(match[2]); } textAlignBox.val(cell[0].style.textAlign || ''); verticalAlignBox.val(cell[0].style.verticalAlign || ''); var border = cell[0].style.borderWidth || ''; if (border) { border = parseInt(border); } borderBox.val(border); setColor(K(colorBox[0]), K.toHex(cell[0].style.borderColor || '')); setColor(K(colorBox[1]), K.toHex(cell[0].style.backgroundColor || '')); widthBox[0].focus(); widthBox[0].select(); }, insert : function() { this.prop(true); }, 'delete' : function() { var table = self.plugin.getSelectedTable(); self.cmd.range.setStartBefore(table[0]).collapse(true); self.cmd.select(); table.remove(); self.addBookmark(); }, colinsert : function(offset) { var table = self.plugin.getSelectedTable()[0], row = self.plugin.getSelectedRow()[0], cell = self.plugin.getSelectedCell()[0], index = cell.cellIndex + offset; for (var i = 0, len = table.rows.length; i < len; i++) { var newRow = table.rows[i], newCell = newRow.insertCell(index); newCell.innerHTML = K.IE ? '' : '<br />'; // 调整下一行的单元格index index = _getCellIndex(table, newRow, newCell); } self.cmd.range.selectNodeContents(cell).collapse(true); self.cmd.select(); self.addBookmark(); }, colinsertleft : function() { this.colinsert(0); }, colinsertright : function() { this.colinsert(1); }, rowinsert : function(offset) { var table = self.plugin.getSelectedTable()[0], row = self.plugin.getSelectedRow()[0], cell = self.plugin.getSelectedCell()[0], newRow; if (offset === 1) { newRow = table.insertRow(row.rowIndex + (cell.rowSpan - 1) + offset); } else { newRow = table.insertRow(row.rowIndex); } for (var i = 0, len = row.cells.length; i < len; i++) { var newCell = newRow.insertCell(i); // copy colspan if (offset === 1 && row.cells[i].colSpan > 1) { newCell.colSpan = row.cells[i].colSpan; } newCell.innerHTML = K.IE ? '' : '<br />'; } self.cmd.range.selectNodeContents(cell).collapse(true); self.cmd.select(); self.addBookmark(); }, rowinsertabove : function() { this.rowinsert(0); }, rowinsertbelow : function() { this.rowinsert(1); }, rowmerge : function() { var table = self.plugin.getSelectedTable()[0], row = self.plugin.getSelectedRow()[0], cell = self.plugin.getSelectedCell()[0], rowIndex = row.rowIndex, // 当前行的index nextRowIndex = rowIndex + cell.rowSpan, // 下一行的index nextRow = table.rows[nextRowIndex]; // 下一行 // 最后一行不能合并 if (table.rows.length <= nextRowIndex) { return; } var cellIndex = _getCellIndex(table, row, cell); // 下一行单元格的index if (nextRow.cells.length <= cellIndex) { return; } var nextCell = nextRow.cells[cellIndex]; // 下一行单元格 // 上下行的colspan不一致时不能合并 if (cell.colSpan !== nextCell.colSpan) { return; } cell.rowSpan += nextCell.rowSpan; nextRow.deleteCell(cellIndex); self.cmd.range.selectNodeContents(cell).collapse(true); self.cmd.select(); self.addBookmark(); }, colmerge : function() { var table = self.plugin.getSelectedTable()[0], row = self.plugin.getSelectedRow()[0], cell = self.plugin.getSelectedCell()[0], rowIndex = row.rowIndex, // 当前行的index cellIndex = cell.cellIndex, nextCellIndex = cellIndex + 1; // 最后一列不能合并 if (row.cells.length <= nextCellIndex) { return; } var nextCell = row.cells[nextCellIndex]; // 左右列的rowspan不一致时不能合并 if (cell.rowSpan !== nextCell.rowSpan) { return; } cell.colSpan += nextCell.colSpan; row.deleteCell(nextCellIndex); self.cmd.range.selectNodeContents(cell).collapse(true); self.cmd.select(); self.addBookmark(); }, rowsplit : function() { var table = self.plugin.getSelectedTable()[0], row = self.plugin.getSelectedRow()[0], cell = self.plugin.getSelectedCell()[0], rowIndex = row.rowIndex; // 不是可分割单元格 if (cell.rowSpan === 1) { return; } var cellIndex = _getCellIndex(table, row, cell); for (var i = 1, len = cell.rowSpan; i < len; i++) { var newRow = table.rows[rowIndex + i], newCell = newRow.insertCell(cellIndex); if (cell.colSpan > 1) { newCell.colSpan = cell.colSpan; } newCell.innerHTML = K.IE ? '' : '<br />'; // 调整下一行的单元格index cellIndex = _getCellIndex(table, newRow, newCell); } K(cell).removeAttr('rowSpan'); self.cmd.range.selectNodeContents(cell).collapse(true); self.cmd.select(); self.addBookmark(); }, colsplit : function() { var table = self.plugin.getSelectedTable()[0], row = self.plugin.getSelectedRow()[0], cell = self.plugin.getSelectedCell()[0], cellIndex = cell.cellIndex; // 不是可分割单元格 if (cell.colSpan === 1) { return; } for (var i = 1, len = cell.colSpan; i < len; i++) { var newCell = row.insertCell(cellIndex + i); if (cell.rowSpan > 1) { newCell.rowSpan = cell.rowSpan; } newCell.innerHTML = K.IE ? '' : '<br />'; } K(cell).removeAttr('colSpan'); self.cmd.range.selectNodeContents(cell).collapse(true); self.cmd.select(); self.addBookmark(); }, coldelete : function() { var table = self.plugin.getSelectedTable()[0], row = self.plugin.getSelectedRow()[0], cell = self.plugin.getSelectedCell()[0], index = cell.cellIndex; for (var i = 0, len = table.rows.length; i < len; i++) { var newRow = table.rows[i], newCell = newRow.cells[index]; if (newCell.colSpan > 1) { newCell.colSpan -= 1; if (newCell.colSpan === 1) { K(newCell).removeAttr('colSpan'); } } else { newRow.deleteCell(index); } // 跳过不需要删除的行 if (newCell.rowSpan > 1) { i += newCell.rowSpan - 1; } } if (row.cells.length === 0) { self.cmd.range.setStartBefore(table).collapse(true); self.cmd.select(); K(table).remove(); } else { self.cmd.selection(true); } self.addBookmark(); }, rowdelete : function() { var table = self.plugin.getSelectedTable()[0], row = self.plugin.getSelectedRow()[0], cell = self.plugin.getSelectedCell()[0], rowIndex = row.rowIndex; // 从下到上删除 for (var i = cell.rowSpan - 1; i >= 0; i--) { table.deleteRow(rowIndex + i); } if (table.rows.length === 0) { self.cmd.range.setStartBefore(table).collapse(true); self.cmd.select(); K(table).remove(); } else { self.cmd.selection(true); } self.addBookmark(); } }; self.clickToolbar(name, self.plugin.table.prop); });
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/table/table.js
JavaScript
oos
24,272
/******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2011 kindsoft.net * * @author Roddy <luolonghao@gmail.com> * @site http://www.kindsoft.net/ * @licence http://www.kindsoft.net/license.php *******************************************************************************/ KindEditor.plugin('emoticons', function(K) { var self = this, name = 'emoticons', path = (self.emoticonsPath || self.basePath + 'plugins/emoticons/images/'), allowPreview = self.allowPreviewEmoticons === undefined ? true : self.allowPreviewEmoticons, currentPageNum = 1; self.clickToolbar(name, function() { var rows = 5, cols = 9, total = 135, startNum = 0, cells = rows * cols, pages = Math.ceil(total / cells), colsHalf = Math.floor(cols / 2), wrapperDiv = K('<div class="ke-plugin-emoticons"></div>'), elements = [], menu = self.createMenu({ name : name, beforeRemove : function() { removeEvent(); } }); menu.div.append(wrapperDiv); var previewDiv, previewImg; if (allowPreview) { previewDiv = K('<div class="ke-preview"></div>').css('right', 0); previewImg = K('<img class="ke-preview-img" src="' + path + startNum + '.gif" />'); wrapperDiv.append(previewDiv); previewDiv.append(previewImg); } function bindCellEvent(cell, j, num) { if (previewDiv) { cell.mouseover(function() { if (j > colsHalf) { previewDiv.css('left', 0); previewDiv.css('right', ''); } else { previewDiv.css('left', ''); previewDiv.css('right', 0); } previewImg.attr('src', path + num + '.gif'); K(this).addClass('ke-on'); }); } else { cell.mouseover(function() { K(this).addClass('ke-on'); }); } cell.mouseout(function() { K(this).removeClass('ke-on'); }); cell.click(function(e) { self.insertHtml('<img src="' + path + num + '.gif" border="0" alt="" />').hideMenu().focus(); e.stop(); }); } function createEmoticonsTable(pageNum, parentDiv) { var table = document.createElement('table'); parentDiv.append(table); if (previewDiv) { K(table).mouseover(function() { previewDiv.show(); }); K(table).mouseout(function() { previewDiv.hide(); }); elements.push(K(table)); } table.className = 'ke-table'; table.cellPadding = 0; table.cellSpacing = 0; table.border = 0; var num = (pageNum - 1) * cells + startNum; for (var i = 0; i < rows; i++) { var row = table.insertRow(i); for (var j = 0; j < cols; j++) { var cell = K(row.insertCell(j)); cell.addClass('ke-cell'); bindCellEvent(cell, j, num); var span = K('<span class="ke-img"></span>') .css('background-position', '-' + (24 * num) + 'px 0px') .css('background-image', 'url(' + path + 'static.gif)'); cell.append(span); elements.push(cell); num++; } } return table; } var table = createEmoticonsTable(currentPageNum, wrapperDiv); function removeEvent() { K.each(elements, function() { this.unbind(); }); } var pageDiv; function bindPageEvent(el, pageNum) { el.click(function(e) { removeEvent(); table.parentNode.removeChild(table); pageDiv.remove(); table = createEmoticonsTable(pageNum, wrapperDiv); createPageTable(pageNum); currentPageNum = pageNum; e.stop(); }); } function createPageTable(currentPageNum) { pageDiv = K('<div class="ke-page"></div>'); wrapperDiv.append(pageDiv); for (var pageNum = 1; pageNum <= pages; pageNum++) { if (currentPageNum !== pageNum) { var a = K('<a href="javascript:;">[' + pageNum + ']</a>'); bindPageEvent(a, pageNum); pageDiv.append(a); elements.push(a); } else { pageDiv.append(K('@[' + pageNum + ']')); } pageDiv.append(K('@&nbsp;')); } } createPageTable(currentPageNum); }); });
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/plugins/emoticons/emoticons.js
JavaScript
oos
4,063
/* container */ .ke-container-simple { display: block; border: 1px solid #CCC; background-color: #FFF; overflow: hidden; } /* toolbar */ .ke-container-simple .ke-toolbar { border-bottom: 1px solid #CCC; background-color: #FFF; padding: 2px 5px; overflow: hidden; } .ke-container-simple .ke-toolbar .ke-outline { border: 1px solid #FFF; background-color: transparent; margin: 1px; padding: 1px 2px; font-size: 0; line-height: 0; overflow: hidden; cursor: pointer; } .ke-container-simple .ke-toolbar .ke-on { border: 1px solid #5690D2; } .ke-container-simple .ke-toolbar .ke-selected { border: 1px solid #5690D2; background-color: #E9EFF6; } .ke-container-simple .ke-toolbar .ke-disabled { cursor: default; } /* statusbar */ .ke-container-simple .ke-statusbar { position: relative; background-color: #FFF; border-top: 1px solid #CCCCCC; font-size: 0; line-height: 0; *height: 12px; overflow: hidden; text-align: center; cursor: s-resize; } /* menu */ .ke-menu-simple { border: 1px solid #A0A0A0; background-color: #FFF; color: #222222; padding: 2px; font-family: "sans serif",tahoma,verdana,helvetica; font-size: 12px; text-align: left; overflow: hidden; } .ke-menu-simple .ke-menu-item { border: 1px solid #FFF; background-color: #FFF; color: #222222; height: 24px; overflow: hidden; cursor: pointer; } .ke-menu-simple .ke-menu-item-on { border: 1px solid #5690D2; background-color: #FFF; } /* colorpicker */ .ke-colorpicker-simple { border: 1px solid #A0A0A0; background-color: #FEFEFE; color: #222222; padding: 2px; } .ke-colorpicker-simple .ke-colorpicker-cell { font-size: 0; line-height: 0; border: 1px solid #FEFEFE; cursor: pointer; margin:3px; padding:0; } .ke-colorpicker-simple .ke-colorpicker-cell-top { font-family: "sans serif",tahoma,verdana,helvetica; font-size: 12px; line-height: 24px; border: 1px solid #FEFEFE; cursor: pointer; margin:0; padding:0; text-align: center; } .ke-colorpicker-simple .ke-colorpicker-cell-on { border: 1px solid #5690D2; } .ke-colorpicker-simple .ke-colorpicker-cell-selected { border: 1px solid #2446AB; } /* dialog */ .ke-dialog-simple { position: absolute; margin: 0; padding: 0; } .ke-dialog-simple .ke-dialog-content { color: #333; background-color: #FFF; } .ke-dialog-simple .ke-dialog-shadow { background-color: #FFF; } .ke-dialog-simple .ke-dialog-header { border:0; margin:0; background-color: #FFF; padding: 10px; text-align: left; font: 14px/1 "sans serif",tahoma,verdana,helvetica; font-weight: bold; color: #222222; background-color: #FFF; cursor: move; } .ke-dialog-simple .ke-dialog-body { background-color: #FFF; } .ke-dialog-simple .ke-dialog-footer { background-color: #FFF; } /* tabs */ .ke-dialog-simple .ke-tabs { font: 12px/1 "sans serif",tahoma,verdana,helvetica; border-bottom:1px solid #A0A0A0; padding-left:5px; margin-bottom:10px; } .ke-dialog-simple .ke-tabs-li { position: relative; border: 1px solid #A0A0A0; background-color: #F0F0EE; margin: 0 2px -1px 0; padding: 0 20px; float: left; line-height: 25px; text-align: center; color: #555; cursor: pointer; } .ke-dialog-simple .ke-tabs-li-selected { background-color: #FFF; border-bottom: 1px solid #FFF; color: #000; cursor: default; } .ke-dialog-simple .ke-tabs-li-on { background-color: #FFF; color: #000; }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/themes/simple/simple.css
CSS
oos
3,338
/* common */ .ke-inline-block { display: -moz-inline-stack; display: inline-block; vertical-align: middle; zoom: 1; *display: inline; } .ke-clearfix { zoom: 1; } .ke-clearfix:after { content: "."; display: block; clear: both; font-size: 0; height: 0; line-height: 0; visibility: hidden; } .ke-shadow { box-shadow: 1px 1px 3px #A0A0A0; -moz-box-shadow: 1px 1px 3px #A0A0A0; -webkit-box-shadow: 1px 1px 3px #A0A0A0; filter: progid:DXImageTransform.Microsoft.Shadow(color='#A0A0A0', Direction=135, Strength=3); background-color: #F0F0EE; } .ke-menu a, .ke-menu a:hover, .ke-dialog a, .ke-dialog a:hover { color: #337FE5; text-decoration: none; } /* icons */ .ke-icon-source { background-position: 0px 0px; width: 16px; height: 16px; } .ke-icon-preview { background-position: 0px -16px; width: 16px; height: 16px; } .ke-icon-print { background-position: 0px -32px; width: 16px; height: 16px; } .ke-icon-undo { background-position: 0px -48px; width: 16px; height: 16px; } .ke-icon-redo { background-position: 0px -64px; width: 16px; height: 16px; } .ke-icon-cut { background-position: 0px -80px; width: 16px; height: 16px; } .ke-icon-copy { background-position: 0px -96px; width: 16px; height: 16px; } .ke-icon-paste { background-position: 0px -112px; width: 16px; height: 16px; } .ke-icon-selectall { background-position: 0px -128px; width: 16px; height: 16px; } .ke-icon-justifyleft { background-position: 0px -144px; width: 16px; height: 16px; } .ke-icon-justifycenter { background-position: 0px -160px; width: 16px; height: 16px; } .ke-icon-justifyright { background-position: 0px -176px; width: 16px; height: 16px; } .ke-icon-justifyfull { background-position: 0px -192px; width: 16px; height: 16px; } .ke-icon-insertorderedlist { background-position: 0px -208px; width: 16px; height: 16px; } .ke-icon-insertunorderedlist { background-position: 0px -224px; width: 16px; height: 16px; } .ke-icon-indent { background-position: 0px -240px; width: 16px; height: 16px; } .ke-icon-outdent { background-position: 0px -256px; width: 16px; height: 16px; } .ke-icon-subscript { background-position: 0px -272px; width: 16px; height: 16px; } .ke-icon-superscript { background-position: 0px -288px; width: 16px; height: 16px; } .ke-icon-date { background-position: 0px -304px; width: 25px; height: 16px; } .ke-icon-time { background-position: 0px -320px; width: 25px; height: 16px; } .ke-icon-formatblock { background-position: 0px -336px; width: 25px; height: 16px; } .ke-icon-fontname { background-position: 0px -352px; width: 21px; height: 16px; } .ke-icon-fontsize { background-position: 0px -368px; width: 23px; height: 16px; } .ke-icon-forecolor { background-position: 0px -384px; width: 20px; height: 16px; } .ke-icon-hilitecolor { background-position: 0px -400px; width: 23px; height: 16px; } .ke-icon-bold { background-position: 0px -416px; width: 16px; height: 16px; } .ke-icon-italic { background-position: 0px -432px; width: 16px; height: 16px; } .ke-icon-underline { background-position: 0px -448px; width: 16px; height: 16px; } .ke-icon-strikethrough { background-position: 0px -464px; width: 16px; height: 16px; } .ke-icon-removeformat { background-position: 0px -480px; width: 16px; height: 16px; } .ke-icon-image { background-position: 0px -496px; width: 16px; height: 16px; } .ke-icon-flash { background-position: 0px -512px; width: 16px; height: 16px; } .ke-icon-media { background-position: 0px -528px; width: 16px; height: 16px; } .ke-icon-div { background-position: 0px -544px; width: 16px; height: 16px; } .ke-icon-formula { background-position: 0px -576px; width: 16px; height: 16px; } .ke-icon-hr { background-position: 0px -592px; width: 16px; height: 16px; } .ke-icon-emoticons { background-position: 0px -608px; width: 16px; height: 16px; } .ke-icon-link { background-position: 0px -624px; width: 16px; height: 16px; } .ke-icon-unlink { background-position: 0px -640px; width: 16px; height: 16px; } .ke-icon-fullscreen { background-position: 0px -656px; width: 16px; height: 16px; } .ke-icon-about { background-position: 0px -672px; width: 16px; height: 16px; } .ke-icon-plainpaste { background-position: 0px -704px; width: 16px; height: 16px; } .ke-icon-wordpaste { background-position: 0px -720px; width: 16px; height: 16px; } .ke-icon-table { background-position: 0px -784px; width: 16px; height: 16px; } .ke-icon-tablemenu { background-position: 0px -768px; width: 16px; height: 16px; } .ke-icon-tableinsert { background-position: 0px -784px; width: 16px; height: 16px; } .ke-icon-tabledelete { background-position: 0px -800px; width: 16px; height: 16px; } .ke-icon-tablecolinsertleft { background-position: 0px -816px; width: 16px; height: 16px; } .ke-icon-tablecolinsertright { background-position: 0px -832px; width: 16px; height: 16px; } .ke-icon-tablerowinsertabove { background-position: 0px -848px; width: 16px; height: 16px; } .ke-icon-tablerowinsertbelow { background-position: 0px -864px; width: 16px; height: 16px; } .ke-icon-tablecoldelete { background-position: 0px -880px; width: 16px; height: 16px; } .ke-icon-tablerowdelete { background-position: 0px -896px; width: 16px; height: 16px; } .ke-icon-tablecellprop { background-position: 0px -912px; width: 16px; height: 16px; } .ke-icon-tableprop { background-position: 0px -928px; width: 16px; height: 16px; } .ke-icon-checked { background-position: 0px -944px; width: 16px; height: 16px; } .ke-icon-code { background-position: 0px -960px; width: 16px; height: 16px; } .ke-icon-map { background-position: 0px -976px; width: 16px; height: 16px; } .ke-icon-lineheight { background-position: 0px -992px; width: 16px; height: 16px; } .ke-icon-clearhtml { background-position: 0px -1008px; width: 16px; height: 16px; } .ke-icon-pagebreak { background-position: 0px -1024px; width: 16px; height: 16px; } .ke-icon-insertfile { background-position: 0px -1040px; width: 16px; height: 16px; } .ke-icon-quickformat { background-position: 0px -1056px; width: 16px; height: 16px; } .ke-icon-template { background-position: 0px -1072px; width: 16px; height: 16px; } .ke-icon-tablecellsplit { background-position: 0px -1088px; width: 16px; height: 16px; } .ke-icon-tablerowmerge { background-position: 0px -1104px; width: 16px; height: 16px; } .ke-icon-tablerowsplit { background-position: 0px -1120px; width: 16px; height: 16px; } .ke-icon-tablecolmerge { background-position: 0px -1136px; width: 16px; height: 16px; } .ke-icon-tablecolsplit { background-position: 0px -1152px; width: 16px; height: 16px; } .ke-icon-anchor { background-position: 0px -1168px; width: 16px; height: 16px; } .ke-icon-search { background-position: 0px -1184px; width: 16px; height: 16px; } .ke-icon-new { background-position: 0px -1200px; width: 16px; height: 16px; } .ke-icon-specialchar { background-position: 0px -1216px; width: 16px; height: 16px; } /* container */ .ke-container { display: block; border: 1px solid #CCCCCC; background-color: #FFF; overflow: hidden; margin: 0; padding: 0; } /* toolbar */ .ke-toolbar { border-bottom: 1px solid #CCC; background-color: #F0F0EE; padding: 2px 5px; text-align: left; overflow: hidden; zoom: 1; } .ke-toolbar-icon { background-repeat: no-repeat; font-size: 0; line-height: 0; overflow: hidden; display: block; } .ke-toolbar-icon-url { background-image: url(default.png); } .ke-toolbar .ke-outline { border: 1px solid #F0F0EE; margin: 1px; padding: 1px 2px; font-size: 0; line-height: 0; overflow: hidden; cursor: pointer; display: block; float: left; } .ke-toolbar .ke-on { border: 1px solid #5690D2; } .ke-toolbar .ke-selected { border: 1px solid #5690D2; background-color: #E9EFF6; } .ke-toolbar .ke-disabled { cursor: default; } .ke-toolbar .ke-separator { height: 16px; margin: 2px 3px; border-left: 1px solid #A0A0A0; border-right: 1px solid #FFFFFF; border-top:0; border-bottom:0; width: 0; font-size: 0; line-height: 0; overflow: hidden; display: block; float: left; } .ke-toolbar .ke-hr { overflow: hidden; height: 1px; clear: both; } /* edit */ .ke-edit { padding: 0; } .ke-edit-iframe, .ke-edit-textarea { border: 0; margin: 0; padding: 0; overflow: auto; } .ke-edit-textarea { font: 12px/1.5 "Consolas", "Monaco", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; color: #000; overflow: auto; resize: none; } .ke-edit-textarea:focus { outline: none; } /* statusbar */ .ke-statusbar { position: relative; background-color: #F0F0EE; border-top: 1px solid #CCCCCC; font-size: 0; line-height: 0; *height: 12px; overflow: hidden; text-align: center; cursor: s-resize; } .ke-statusbar-center-icon { background-position: -0px -754px; width: 15px; height: 11px; background-image: url(default.png); } .ke-statusbar-right-icon { position: absolute; right: 0; bottom: 0; cursor: se-resize; background-position: -5px -741px; width: 11px; height: 11px; background-image: url(default.png); } /* menu */ .ke-menu { border: 1px solid #A0A0A0; background-color: #F1F1F1; color: #222222; padding: 2px; font-family: "sans serif",tahoma,verdana,helvetica; font-size: 12px; text-align: left; overflow: hidden; } .ke-menu-item { border: 1px solid #F1F1F1; background-color: #F1F1F1; color: #222222; height: 24px; overflow: hidden; cursor: pointer; } .ke-menu-item-on { border: 1px solid #5690D2; background-color: #E9EFF6; } .ke-menu-item-left { width: 27px; text-align: center; overflow: hidden; } .ke-menu-item-center { width: 0; height: 24px; border-left: 1px solid #E3E3E3; border-right: 1px solid #FFFFFF; border-top: 0; border-bottom: 0; } .ke-menu-item-center-on { border-left: 1px solid #E9EFF6; border-right: 1px solid #E9EFF6; } .ke-menu-item-right { border: 0; padding: 0 0 0 5px; line-height: 24px; text-align: left; overflow: hidden; } .ke-menu-separator { margin: 2px 0; height: 0; overflow: hidden; border-top: 1px solid #CCCCCC; border-bottom: 1px solid #FFFFFF; border-left: 0; border-right: 0; } /* colorpicker */ .ke-colorpicker { border: 1px solid #A0A0A0; background-color: #F1F1F1; color: #222222; padding: 2px; } .ke-colorpicker-table { border:0; margin:0; padding:0; border-collapse: separate; } .ke-colorpicker-cell { font-size: 0; line-height: 0; border: 1px solid #F0F0EE; cursor: pointer; margin:3px; padding:0; } .ke-colorpicker-cell-top { font-family: "sans serif",tahoma,verdana,helvetica; font-size: 12px; line-height: 24px; border: 1px solid #F0F0EE; cursor: pointer; margin:0; padding:0; text-align: center; } .ke-colorpicker-cell-on { border: 1px solid #5690D2; } .ke-colorpicker-cell-selected { border: 1px solid #2446AB; } .ke-colorpicker-cell-color { width: 14px; height: 14px; margin: 3px; padding: 0; border: 0; } /* dialog */ .ke-dialog { position: absolute; margin: 0; padding: 0; } .ke-dialog-content { background-color: #F0F0EE; width: 100%; height: 100%; color: #333; border: 1px solid #A0A0A0; } .ke-dialog-shadow { position: absolute; z-index: -1; top: 0; left: 0; width: 100%; height: 100%; box-shadow: 3px 3px 7px #A0A0A0; -moz-box-shadow: 3px 3px 7px #A0A0A0; -webkit-box-shadow: 3px 3px 7px #A0A0A0; filter: progid:DXImageTransform.Microsoft.Blur(PixelRadius='3', MakeShadow='true', ShadowOpacity='0.3'); background-color: #F0F0EE; } .ke-dialog-header { border:0; margin:0; background-color: #F0F0EE; padding: 10px; text-align: left; font: 14px/1 "sans serif",tahoma,verdana,helvetica; font-weight: bold; color: #222222; cursor: move; } .ke-dialog-icon-close { display: block; background-position: 0px -688px; width: 16px; height: 16px; position: absolute; right: 15px; top: 15px; cursor: pointer; background-image: url(default.png); overflow: hidden; right: 10px; top: 10px; } .ke-dialog-body { font: 12px/1.5 "sans serif",tahoma,verdana,helvetica; text-align: left; overflow: hidden; background-color: #F0F0EE; } .ke-dialog-body textarea { display: block; overflow: auto; padding: 0; resize: none; } .ke-dialog-body textarea:focus, .ke-dialog-body input:focus, .ke-dialog-body select:focus { outline: none; } .ke-dialog-body label { margin-right: 10px; cursor: pointer; display: -moz-inline-stack; display: inline-block; vertical-align: middle; zoom: 1; *display: inline; } .ke-dialog-body img { display: -moz-inline-stack; display: inline-block; vertical-align: middle; zoom: 1; *display: inline; } .ke-dialog-body select { display: -moz-inline-stack; display: inline-block; vertical-align: middle; zoom: 1; *display: inline; width: auto; } .ke-dialog-body .ke-textarea { display: block; width: 408px; height: 260px; font-family: "sans serif",tahoma,verdana,helvetica; font-size: 12px; border-color: #848484 #E0E0E0 #E0E0E0 #848484; border-style: solid; border-width: 1px; } .ke-dialog-body .ke-form { margin: 0; padding: 0; } .ke-dialog-loading { position: absolute; top: 0; left: 0; z-index: 1; text-align: center; } .ke-dialog-loading-content { background: url("../common/loading.gif") no-repeat; color: #666; font-size: 14px; font-weight: bold; height: 31px; line-height: 31px; padding-left: 36px; } .ke-dialog-row { margin-bottom: 10px; } .ke-dialog-footer { font: 12px/1 "sans serif",tahoma,verdana,helvetica; text-align: right; padding:0 0 5px 0; background-color: #F0F0EE; } .ke-dialog-preview, .ke-dialog-yes { margin: 5px; } .ke-dialog-no { margin: 5px 10px 5px 5px; } .ke-dialog-mask { background-color:#FFF; filter:alpha(opacity=50); opacity:0.5; } .ke-button-common { background: url(bg.gif) no-repeat scroll 0 0 transparent; cursor: pointer; height: 25px; line-height: 25px; overflow: visible; display: inline-block; vertical-align: top; } .ke-button-outer { background-position: 0 0; padding: 0; position: relative; display: -moz-inline-stack; display: inline-block; vertical-align: middle; zoom: 1; *display: inline; } .ke-button { background-position: right 0; padding: 0 12px; margin: 0; font-family: "sans serif",tahoma,verdana,helvetica; border: 0 none; color: #333; font-size: 12px; font-weight: bold; left: 2px; text-decoration: none; } /* inputbox */ .ke-input-text { background-color:#FFFFFF; font-family: "sans serif",tahoma,verdana,helvetica; font-size: 12px; line-height: 17px; height: 17px; padding: 2px 4px; border-color: #848484 #E0E0E0 #E0E0E0 #848484; border-style: solid; border-width: 1px; display: -moz-inline-stack; display: inline-block; vertical-align: middle; zoom: 1; *display: inline; } .ke-input-number { width: 50px; } .ke-input-color { border: 1px solid #A0A0A0; background-color: #FFFFFF; font-size: 12px; width: 60px; height: 20px; line-height: 20px; padding-left: 5px; overflow: hidden; cursor: pointer; display: -moz-inline-stack; display: inline-block; vertical-align: middle; zoom: 1; *display: inline; } .ke-upload-area { position: relative; overflow: hidden; margin: 0; padding: 0; } .ke-upload-area .ke-upload-file { position: absolute; top: 0; right: 0; height: 25px; padding: 0; margin: 0; z-index: 811212; border: 0 none; opacity: 0; filter: alpha(opacity=0); } /* tabs */ .ke-tabs { font: 12px/1 "sans serif",tahoma,verdana,helvetica; border-bottom:1px solid #A0A0A0; padding-left:5px; margin-bottom:10px; } .ke-tabs-ul { list-style-image:none; list-style-position:outside; list-style-type:none; margin:0; padding:0; } .ke-tabs-li { position: relative; border: 1px solid #A0A0A0; background-color: #E0E0E0; margin: 0 2px -1px 0; padding: 0 20px; float: left; line-height: 25px; text-align: center; color: #555555; cursor: pointer; } .ke-tabs-li-selected { background-color: #F0F0EE; border-bottom: 1px solid #F0F0EE; color: #000; cursor: default; } .ke-tabs-li-on { background-color: #F0F0EE; color: #000; } /* emoticons */ .ke-plugin-emoticons { position: relative; } .ke-plugin-emoticons .ke-preview { position: absolute; text-align: center; margin: 2px; padding: 10px; top: 0; border: 1px solid #A0A0A0; background-color: #FFFFFF; display: none; } .ke-plugin-emoticons .ke-preview-img { border:0; margin:0; padding:0; } .ke-plugin-emoticons .ke-table { border:0; margin:0; padding:0; border-collapse:separate; } .ke-plugin-emoticons .ke-cell { margin:0; padding:1px; border:1px solid #F0F0EE; cursor:pointer; } .ke-plugin-emoticons .ke-on { border: 1px solid #5690D2; background-color: #E9EFF6; } .ke-plugin-emoticons .ke-img { display:block; background-repeat:no-repeat; overflow:hidden; margin:2px; width:24px; height:24px; margin: 0; padding: 0; border: 0; } .ke-plugin-emoticons .ke-page { text-align: right; margin: 5px; padding: 0; border: 0; font: 12px/1 "sans serif",tahoma,verdana,helvetica; color: #333; text-decoration: none; } .ke-plugin-plainpaste-textarea, .ke-plugin-wordpaste-iframe { display: block; width: 408px; height: 260px; font-family: "sans serif",tahoma,verdana,helvetica; font-size: 12px; border-color: #848484 #E0E0E0 #E0E0E0 #848484; border-style: solid; border-width: 1px; } /* filemanager */ .ke-plugin-filemanager-header { width: 100%; margin-bottom: 10px; } .ke-plugin-filemanager-header .ke-left { float: left; } .ke-plugin-filemanager-header .ke-right { float: right; } .ke-plugin-filemanager-body { overflow: scroll; background-color:#FFFFFF; border-color: #848484 #E0E0E0 #E0E0E0 #848484; border-style: solid; border-width: 1px; width: 470px; height: 370px; padding: 5px; } .ke-plugin-filemanager-body .ke-item { width: 100px; margin: 5px; } .ke-plugin-filemanager-body .ke-photo { border: 1px solid #DDDDDD; background-color:#FFFFFF; padding: 10px; } .ke-plugin-filemanager-body .ke-name { width: 100px; text-align: center; overflow: hidden; height:16px; } .ke-plugin-filemanager-body .ke-on { border: 1px solid #5690D2; background-color: #E9EFF6; } .ke-plugin-filemanager-body .ke-table { width: 95%; border: 0; margin: 0; padding: 0; border-collapse: separate; } .ke-plugin-filemanager-body .ke-table .ke-cell { margin: 0; padding: 0; border: 0; } .ke-plugin-filemanager-body .ke-table .ke-name { width: 55%; text-align: left; } .ke-plugin-filemanager-body .ke-table .ke-size { width: 15%; text-align: left; } .ke-plugin-filemanager-body .ke-table .ke-datetime { width: 30%; text-align: center; } /* template */ .ke-plugin-template .ke-header { width: 100%; margin-bottom: 10px; } .ke-plugin-template label { margin-right: 0; cursor: pointer; font-weight: normal; display: inline; vertical-align: top; } .ke-plugin-template .ke-left { float: left; } .ke-plugin-template .ke-right { float: right; }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/editor/kindeditor/themes/default/default.css
CSS
oos
19,872
*{padding:0px; margin:0px; font-size:12px; color:#282828} li{ list-style-type:none; float:left;} input.webSearch{border:1px solid #AAAAAA; padding:5px 20px 4px 5px; background:url("../images/ico/fatcow_542.png") no-repeat right 4px; width:250px; padding-right:18px;} input.webfocus{border:1px solid #5897FB;} input.submit{ background:url(../images/button_submit.gif) repeat-x #e3f1fa; border:1px solid #aed0ea; padding:0px 10px; height:24px; line-height:24px; margin:0px 4px; color:#3d80b3; cursor:pointer; } table.conSearch{width:796px;height:200px;} table.conSearch td.searchBox{height:60px;} table.conSearch a.btnCon{ background:url("../images/ico/ico-01.gif") no-repeat; width:91px; height:33px; float:right;} table.conSearch a.btnCon:hover{ background:url("../images/ico/ico-02.gif") no-repeat;} table.searchList{border-top:1px solid #ccc; width:100%;} table.searchList tr th.l,table.searchList tr td.l{border-right:1px solid #ccc; width:600px; text-align:left; } table.searchList tr th{color:#fff; font-weight:bold; font-size:14px; background:#f60; height:30px;} table.searchList tr td.c{height:300px;} table.searchList ul.infolist{ height:300px; position:relative;} table.searchList ul.infolist li{width:180px; float:left; height:60px; margin:8px;} table.searchList ul li a{ text-decoration:none; border:1px solid #fff; display:block; padding:5px; width:170px; height:60px; float:left; position:absolute; background:#faf9f9;} table.searchList ul li a img{border:1px solid #ccc; padding:1px; background:#ccc; float:left;} table.searchList ul li a p{display:block; width:100%; height:20px; line-height:20px; overflow:hidden; float:left;} table.searchList ul li a p.t{height:24px; line-height:24px; color:#f60; font-weight:bold;} table.searchList ul li a p.d{display:none;} table.searchList ul li a span{position:absolute; width:32px; height:16px; line-height:16px; right:0px; background:#f60; color:#fff; top:0px; text-align:center;} table.searchList ul li a:hover,table.searchList ul li a.cur{border:1px solid #f60; height:150px; z-index:1000000;} table.searchList ul li a:hover p.d{display:block;} table.searchList ul.sinfolist li{width:170px; height:60px; float:left; margin:8px;} table.searchList ul li.no a{ display:block; text-align:center; height:60px;} table.searchList ul li.no a:hover{height:60px}
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/css/webcommon.css
CSS
oos
2,621
/** * This <div> element is wrapped by jCarousel around the list * and has the classname "jcarousel-container". */ .jcarousel-container { position: relative; } .jcarousel-clip { z-index: 2; padding: 0; margin: 0; overflow: hidden; position: relative; } .jcarousel-list { z-index: 1; overflow: hidden; position: relative; top: 0; left: 0; margin: 0; padding: 0; } .jcarousel-list li, .jcarousel-item { float: left; list-style: none; /* We set the width/height explicitly. No width/height causes infinite loops. */ width: 75px; height: 75px; } /** * The buttons are added dynamically by jCarousel before * the <ul> list (inside the <div> described above) and * have the classnames "jcarousel-next" and "jcarousel-prev". */ .jcarousel-next { z-index: 3; display: none; } .jcarousel-prev { z-index: 3; display: none; }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/css/jquery.jcarousel.css
CSS
oos
915
/* * Lazy Load - jQuery plugin for lazy loading images * * Copyright (c) 2007-2012 Mika Tuupola * * Licensed under the MIT license: * http://www.opensource.org/licenses/mit-license.php * * Project home: * http://www.appelsiini.net/projects/lazyload * * Version: 1.7.2 * */ (function($, window) { $window = $(window); $.fn.lazyload = function(options) { var elements = this; var settings = { threshold : 0, failure_limit : 0, event : "scroll", effect : "show", container : window, data_attribute : "original", skip_invisible : true, appear : null, load : null }; function update() { var counter = 0; elements.each(function() { var $this = $(this); if (settings.skip_invisible && !$this.is(":visible")) { return; } if ($.abovethetop(this, settings) || $.leftofbegin(this, settings)) { /* Nothing. */ } else if (!$.belowthefold(this, settings) && !$.rightoffold(this, settings)) { $this.trigger("appear"); } else { if (++counter > settings.failure_limit) { return false; } } }); } if(options) { /* Maintain BC for a couple of versions. */ if (undefined !== options.failurelimit) { options.failure_limit = options.failurelimit; delete options.failurelimit; } if (undefined !== options.effectspeed) { options.effect_speed = options.effectspeed; delete options.effectspeed; } $.extend(settings, options); } /* Cache container as jQuery as object. */ $container = (settings.container === undefined || settings.container === window) ? $window : $(settings.container); /* Fire one scroll event per scroll. Not one scroll event per image. */ if (0 === settings.event.indexOf("scroll")) { $container.bind(settings.event, function(event) { return update(); }); } this.each(function() { var self = this; var $self = $(self); self.loaded = false; /* When appear is triggered load original image. */ $self.one("appear", function() { if (!this.loaded) { if (settings.appear) { var elements_left = elements.length; settings.appear.call(self, elements_left, settings); } $("<img />") .bind("load", function() { $self .hide() .attr("src", $self.data(settings.data_attribute)) [settings.effect](settings.effect_speed); self.loaded = true; /* Remove image from array so it is not looped next time. */ var temp = $.grep(elements, function(element) { return !element.loaded; }); elements = $(temp); if (settings.load) { var elements_left = elements.length; settings.load.call(self, elements_left, settings); } }) .attr("src", $self.data(settings.data_attribute)); } }); /* When wanted event is triggered load original image */ /* by triggering appear. */ if (0 !== settings.event.indexOf("scroll")) { $self.bind(settings.event, function(event) { if (!self.loaded) { $self.trigger("appear"); } }); } }); /* Check if something appears when window is resized. */ $window.bind("resize", function(event) { update(); }); /* Force initial check if images should appear. */ update(); return this; }; /* Convenience methods in jQuery namespace. */ /* Use as $.belowthefold(element, {threshold : 100, container : window}) */ $.belowthefold = function(element, settings) { var fold; if (settings.container === undefined || settings.container === window) { fold = $window.height() + $window.scrollTop(); } else { fold = $container.offset().top + $container.height(); } return fold <= $(element).offset().top - settings.threshold; }; $.rightoffold = function(element, settings) { var fold; if (settings.container === undefined || settings.container === window) { fold = $window.width() + $window.scrollLeft(); } else { fold = $container.offset().left + $container.width(); } return fold <= $(element).offset().left - settings.threshold; }; $.abovethetop = function(element, settings) { var fold; if (settings.container === undefined || settings.container === window) { fold = $window.scrollTop(); } else { fold = $container.offset().top; } return fold >= $(element).offset().top + settings.threshold + $(element).height(); }; $.leftofbegin = function(element, settings) { var fold; if (settings.container === undefined || settings.container === window) { fold = $window.scrollLeft(); } else { fold = $container.offset().left; } return fold >= $(element).offset().left + settings.threshold + $(element).width(); }; $.inviewport = function(element, settings) { return !$.rightofscreen(element, settings) && !$.leftofscreen(element, settings) && !$.belowthefold(element, settings) && !$.abovethetop(element, settings); }; /* Custom selectors for your convenience. */ /* Use as $("img:below-the-fold").something() */ $.extend($.expr[':'], { "below-the-fold" : function(a) { return $.belowthefold(a, {threshold : 0, container: window}); }, "above-the-top" : function(a) { return !$.belowthefold(a, {threshold : 0, container: window}); }, "right-of-screen": function(a) { return $.rightoffold(a, {threshold : 0, container: window}); }, "left-of-screen" : function(a) { return !$.rightoffold(a, {threshold : 0, container: window}); }, "in-viewport" : function(a) { return !$.inviewport(a, {threshold : 0, container: window}); }, /* Maintain BC for couple of versions. */ "above-the-fold" : function(a) { return !$.belowthefold(a, {threshold : 0, container: window}); }, "right-of-fold" : function(a) { return $.rightoffold(a, {threshold : 0, container: window}); }, "left-of-fold" : function(a) { return !$.rightoffold(a, {threshold : 0, container: window}); } }); })(jQuery, window);
10aaa-10aaa
trunk/TRECommerce/TREC.Web/resource/lazyload/jquery.lazyload.js
JavaScript
oos
7,632
<%@ WebHandler Language="C#" CodeBehind="ajaxuser.ashx.cs" Class="TREC.Web.ajax.ajaxuser" %>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/ajax/ajaxuser.ashx
ASP.NET
oos
97
<%@ WebHandler Language="C#" CodeBehind="ajaxconfig.ashx.cs" Class="TREC.Web.ajax.ajaxconfig" %>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/ajax/ajaxconfig.ashx
ASP.NET
oos
101
<%@ WebHandler Language="C#" CodeBehind="ajaxproduct.ashx.cs" Class="TREC.Web.ajax.ajaxproduct" %>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/ajax/ajaxproduct.ashx
ASP.NET
oos
103
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Text; using System.IO; using System.Data; using TREC.ECommerce; using TREC.Entity; using TRECommon; namespace TREC.Web.ajax { /// <summary> /// ajaxproduct 的摘要说明 /// </summary> public class ajaxproduct : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.ContentType = "text/plain"; string type = ""; string value = ""; string value2 = ""; string value3 = ""; string t = ""; string c = ""; if (context.Request.QueryString["type"] != null) { type = context.Request.QueryString["type"]; } else { type = context.Request.Params["type"]; } if (context.Request.QueryString["v"] != null) { value = context.Request.QueryString["v"]; } else { value = context.Request.Params["v"]; } if (context.Request.QueryString["v2"] != null) { value2 = context.Request.QueryString["v2"]; } else { value2 = context.Request.Params["v2"]; } if (context.Request.QueryString["v3"] != null) { value3 = context.Request.QueryString["v3"]; } else { value3 = context.Request.Params["v3"]; } if (context.Request.QueryString["t"] != null) { t = context.Request.QueryString["t"]; } else { t = context.Request.Params["t"]; } if (context.Request.QueryString["c"] != null) { c = context.Request.QueryString["c"]; } else { c = context.Request.Params["c"]; } switch (type) { case "getcategorytype": context.Response.Write(GetCategoryType(value)); break; case "deleteproductattribute": context.Response.Write(deleteproductattribute(value)); break; case "getcompanyproductsearchitem": context.Response.Write(GetProductSearchItem(value,value2,value3, c,"company")); break; case "getshopproductsearchitem": context.Response.Write(GetProductSearchItem(value,value2,value3, c,"shop")); break; case "getproductprice": context.Response.Write(GetPriceAttributePrice(value, value2, value3)); break; default: context.Response.Write("ajax数据读取错误"); break; } context.Response.End(); } public string GetPriceAttributePrice(string id, string m, string s) { EnProductAttribute p = ECProductAttribute.GetProductAttributeInfo(" where productid=" + id + " and replace(productmaterial,'+','')='" + m.Replace(" ", "") + "' and convert(varchar(10),productwidth)+'*'+convert(varchar(10),productlength)+'*'+convert(varchar(10),productheight)='" + s + "'"); if (p == null) return "0"; return p.markprice.ToString(); } public string deleteproductattribute(string id) { return !string.IsNullOrEmpty(id) ? ECProductAttribute.DeleteProductAttribute(TypeConverter.StrToInt(id)).ToString() : "0"; } public string GetCategoryType(string categoryid) { string producttypelist = ECPCategoryPTyp.GetProductCategoryTypeValueList(TypeConverter.StrToInt(categoryid)); List<EnConfig> list=new List<EnConfig>(); if (producttypelist.Length > 0) { list=ECConfig.GetConfigList(" type=" + (int)EnumConfigByProduct.产品类型 + " and value in(" + producttypelist + ")"); } StringBuilder sb = new StringBuilder(); foreach (EnConfig c in list) { sb.Append("{\"id\":\"" + c.value + "\",\"title\":\"" + c.title + "\"},"); } if(sb.Length>0) { return sb.ToString().Length > 0 && sb.ToString().EndsWith(",") ? "[" + sb.ToString().Substring(0, sb.ToString().Length - 1) + "]" : "[" + sb.ToString() + "]"; } return sb.ToString(); } public string GetProductSearchItem(string v1, string v2, string v3, string c,string type) { List<EnSearchProductItem> list = new List<EnSearchProductItem>(); if (type == "company") { list=ECProduct.GetProductSearchItemByCompanyId(TypeConverter.StrToInt(c)); } if (type == "shop") { list = ECProduct.GetProductSearchItemByShopId(TypeConverter.StrToInt(c)); } StringBuilder sb = new StringBuilder(); if (list.Count == 0) { return ""; } if (v1=="" && v2=="" && v3=="") { foreach (EnSearchProductItem item in list) { sb.Append("{\"type\":\"" + item.type + "\",\"v\":\"" + item.value + "\",\"n\":\"" + item.title + "\",\"count\":\"" + item.count + "\",\"b\":\"" + item.brandid + "\",\"bs\":\"" + item.brandsid + "\",\"pc\":\"" + item.pcategoryid + "\"},"); } } else { List<EnSearchProductItem> tempList = list.Where(x => x.type == "category").ToList(); if(v1!="") { tempList = list.Where(x => x.brandid == v1).ToList(); } if (v2 != "") { tempList = list.Where(x => x.brandsid == v2).ToList(); } if (v3 != "") { tempList = list.Where(x => x.pcategoryid == v3).ToList(); } foreach (EnSearchProductItem item in tempList) { sb.Append("{\"type\":\"" + item.type + "\",\"v\":\"" + item.value + "\",\"n\":\"" + item.title + "\",\"count\":\"" + item.count + "\",\"b\":\"" + item.brandid + "\",\"bs\":\"" + item.brandsid + "\",\"pc\":\"" + item.pcategoryid + "\"},"); } } if (sb.Length > 0) { return sb.ToString().Length > 0 && sb.ToString().EndsWith(",") ? "[" + sb.ToString().Substring(0, sb.ToString().Length - 1) + "]" : "[" + sb.ToString() + "]"; } return sb.ToString(); } public bool IsReusable { get { return false; } } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/ajax/ajaxproduct.ashx.cs
C#
oos
7,437
<%@ WebHandler Language="C#" CodeBehind="search.ashx.cs" Class="TREC.Web.ajax.search" %>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/ajax/search.ashx
ASP.NET
oos
93
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data.SqlClient; using System.Data; using System.Text; using TREC.Entity; namespace TREC.Web.ajax { /// <summary> /// search 的摘要说明 /// </summary> public class search : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; //context.Response.Write("["); //context.Response.Write("{value:'奥巴玛',label:' <font class=\"auto_E15A00\">[品牌]</font> 奥巴玛',redirecturl:'http://baidu.com/'}"); //context.Response.Write(",{value:'爱凡 书桌 田园风格 板式 家具',label:'爱凡 书桌 <font class=\"auto_BDBDBD\">田园风格</font> <font class=\"auto_BDBDBD\">板式</font> <font class=\"auto_BDBDBD\">家具</font><div class=\"auto_BDBDBD auto_item_right\">货号:QY81701A</div>',redirecturl:'http://qq.com/'}"); //context.Response.Write(",{value:'爱凡 书桌 田园风格 板式 家具',label:'爱凡 书桌 <font class=\"auto_BDBDBD\">田园风格</font> <font class=\"auto_BDBDBD\">板式</font> <font class=\"auto_BDBDBD\">家111具</font><div class=\"auto_BDBDBD auto_item_right\">货号:QY81701A</div>',redirecturl:'http://qq.com/'}"); //context.Response.Write(",{value:'爱凡 书桌 田园风格 板式 家具',label:'爱凡 书桌 <font class=\"auto_BDBDBD\">田园风格</font> <font class=\"auto_BDBDBD\">板式</font> <font class=\"auto_BDBDBD\">家222222具</font><div class=\"auto_BDBDBD auto_item_right\">货号:QY81701A</div>',redirecturl:'http://qq.com/'}"); //context.Response.Write(",{value:'爱凡 书桌 田园风格 板式 家具',label:'爱凡 书桌 <font class=\"auto_BDBDBD\">田园风格</font> <font class=\"auto_BDBDBD\">板式</font> <font class=\"auto_BDBDBD\">家具</font><div class=\"auto_BDBDBD auto_item_right\">货号:QY81701A</div>',redirecturl:'http://qq.com/'}"); //context.Response.Write("]"); //context.Response.End(); var key = context.Request.QueryString["key"]; var type = context.Request.QueryString["type"]; if (!string.IsNullOrEmpty(key)) { key = key.Trim(); } if (!string.IsNullOrEmpty(key)) { type = type.Trim(); } switch (type.ToLower()) { case "product": SearchProduct(key); break; case "brand": SearchBrand(key); break; case "distributor": SearchDistributor(key); break; case "market": SearchMarket(key); break; case "information": SearchInformation(key); break; case "hybrand": SearchhyBrand(key); break; case "hymarket": SearchhyMarket(key); break; case "hymaterial": SearchhyMaterial(key); break; case "hystyle": SearchhyStyle(key); break; } } void SearchProduct(string key) { List<string> slist = new List<string>(); DataTable dtBrand = ExcuteSelect("select top 1 id,companyid,title from t_brand where title='" + key + "' or letter='" + key + "'"); if (dtBrand.Rows.Count > 0) { slist.Add("{value:'" + (string)dtBrand.Rows[0]["title"] + "',label:' <font class=\"auto_E15A00\">[品牌]</font> " + ((string)dtBrand.Rows[0]["title"]).Replace(key, "<strong class=\"auto_BD182D\">" + key + "</strong>") + "',redirecturl:'" + string.Format(EnUrls.CompanyInfoBrandList, dtBrand.Rows[0]["companyid"], dtBrand.Rows[0]["id"]) + "'}"); } DataTable dtMateria = ExcuteSelect("select distinct materialvalue,materialname from t_product where materialname like '%" + key + "%' order by materialname"); if (dtMateria.Rows.Count > 0) { foreach (DataRow dr in dtMateria.Rows) { slist.Add("{value:'" + (string)dr["materialname"] + "',label:' <font class=\"auto_BDBDBD\">[选材]</font> " + ((string)dr["materialname"]).Replace(key, "<strong class=\"auto_BD182D\">" + key + "</strong>") + "',redirecturl:'" + string.Format(EnUrls.ProductListSearch, "", "", "_" + dr["materialvalue"], "", "", "", "", "", "1", "", "", "") + "'}"); } } DataTable dtStyle = ExcuteSelect("select distinct stylevalue,stylename from t_product where stylename like '%" + key + "%' order by stylename"); if (dtStyle.Rows.Count > 0) { foreach (DataRow dr in dtStyle.Rows) { slist.Add("{value:'" + (string)dr["stylename"] + "',label:' <font class=\"auto_BDBDBD\">[风格]</font> " + ((string)dr["stylename"]).Replace(key, "<strong class=\"auto_BD182D\">" + key + "</strong>") + "',redirecturl:'" + string.Format(EnUrls.ProductListSearch, "", "_" + dr["stylevalue"], "", "", "", "", "", "", "1", "", "", "") + "'}"); } } DataTable dtProduct = ExcuteSelect("select top 30 id,brandtitle,sku,materialname,categorytitle,stylename from t_product where brandtitle like '%" + key + "%' or categorytitle like '%" + key + "%' or stylename like '%" + key + "%' or materialname like '%" + key + "%' or sku like '%" + key + "%'"); if (dtProduct.Rows.Count > 0) { foreach (DataRow dr in dtProduct.Rows) { var redirecturl = string.Format(EnUrls.ProductInfo, dr["id"]); var brandtitle = (string)dr["brandtitle"]; var categorytitle = (string)dr["categorytitle"]; var stylename = (string)dr["stylename"]; var materialname = (string)dr["materialname"]; var sku = (string)dr["sku"]; slist.Add("{" + string.Format("value:'{0} {1} {2} {3} 家具',label:'{4} {5} <font class=\"auto_BDBDBD\">{6}</font> <font class=\"auto_BDBDBD\">{7}</font> <font class=\"auto_BDBDBD\">家具</font><div class=\"auto_BDBDBD auto_item_right\">货号:{8}</div>',redirecturl:'{9}'", brandtitle, categorytitle, stylename, materialname, brandtitle.Replace(key, "<strong class=\"auto_BD182D\">" + key + "</strong>"), categorytitle.Replace(key, "<strong class=\"auto_BD182D\">" + key + "</strong>"), stylename.Replace(key, "<strong class=\"auto_BD182D\">" + key + "</strong>"), materialname.Replace(key, "<strong class=\"auto_BD182D\">" + key + "</strong>"), sku.Replace(key.ToUpper(), "<strong class=\"auto_BD182D\">" + key.ToUpper() + "</strong>"), redirecturl) + "}"); } } StringBuilder sb = new StringBuilder(); foreach (var item in slist) { sb.Append(item + ","); } Response.Write("["); Response.Write(sb.ToString().Trim(',')); Response.Write("]"); Response.End(); } void SearchBrand(string key) { List<string> slist = new List<string>(); DataTable dtBrand = ExcuteSelect("select id,companyid,title from t_brand where title like '%" + key + "%' or letter like '%" + key + "%'"); List<int> fullmatchs = new List<int>(); if (dtBrand.Rows.Count > 0) { foreach (DataRow dr in dtBrand.Rows) { var title = (string)dr["title"]; slist.Add("{value:'" + title + "',label:' <font class=\"auto_E15A00\">[品牌]</font> " + title.Replace(key, "<strong class=\"auto_BD182D\">" + key + "</strong>") + "',redirecturl:'" + string.Format(EnUrls.CompanyInfoBrandList, dr["companyid"], dr["id"]) + "'}"); if (key == title) { fullmatchs.Add((int)dr["id"]); } } } if (fullmatchs.Any()) { var brandidjoin = ""; foreach (int i in fullmatchs) brandidjoin += i.ToString() + ","; DataTable dtShopbrand = ExcuteSelect("select t_shop.id,t_shop.template,t_shop.title,t_area.areaname from t_shop left join t_area on t_shop.areacode = t_area.areacode where t_shop.id in (select shopid from t_shopbrand where brandid in (" + brandidjoin.TrimEnd(',') + "))"); if (dtShopbrand.Rows.Count > 0) { foreach (DataRow dr in dtShopbrand.Rows) { var title = (string)dr["title"]; var redirecturl = ""; if (dr["template"] == null || dr["template"].ToString() == "0") { redirecturl = string.Format(EnUrls.ShopInfoIndex2, dr["id"]); } else { redirecturl = string.Format(EnUrls.ShopInfoIndex, dr["id"]); } slist.Add("{value:'" + title + "',label:' <font class=\"auto_FFC445\">[店铺]</font> " + title.Replace(key, "<strong class=\"auto_BD182D\">" + key + "</strong>") + "<div class=\"auto_BDBDBD auto_item_right\">" + dr["areaname"] + "</div>',redirecturl:'" + redirecturl + "'}"); } } } StringBuilder sb = new StringBuilder(); foreach (var item in slist) { sb.Append(item + ","); } Response.Write("["); Response.Write(sb.ToString().Trim(',')); Response.Write("]"); Response.End(); } void SearchDistributor(string key) { Response.Write("["); Response.Write("]"); Response.End(); } void SearchMarket(string key) { List<string> slist = new List<string>(); DataTable dtMarket = ExcuteSelect("select t_market.id,t_market.template,t_market.title,t_area.areaname from t_market left join t_area on t_market.areacode = t_area.areacode where title like '%" + key + "%' or letter like '%" + key + "%'"); List<int> fullmatchs = new List<int>(); if (dtMarket.Rows.Count > 0) { foreach (DataRow dr in dtMarket.Rows) { var title = (string)dr["title"]; var redirecturl = ""; if (dr["template"] == null || dr["template"].ToString() == "0") { redirecturl = string.Format(EnUrls.MarketInfoIndex2, dr["id"]); } else { redirecturl = string.Format(EnUrls.MarketInfoIndex, dr["id"]); } slist.Add("{value:'" + title + "',label:' <font class=\"auto_1B899D\">[卖场]</font> " + title.Replace(key, "<strong class=\"auto_BD182D\">" + key + "</strong>") + "<div class=\"auto_BDBDBD auto_item_right\">" + dr["areaname"] + "</div>',redirecturl:'" + redirecturl + "'}"); if (key == title) { fullmatchs.Add((int)dr["id"]); } } } if (fullmatchs.Any()) { var marketidjoin = ""; foreach (int i in fullmatchs) marketidjoin += i.ToString(); DataTable dtMarketstoreyshop = ExcuteSelect("select t_shop.id,t_shop.template,t_shop.title,t_area.areaname from t_shop left join t_area on t_shop.areacode = t_area.areacode where t_shop.id in (select shopid from t_marketstoreyshop where marketid in (" + marketidjoin.TrimEnd(',') + "))"); if (dtMarketstoreyshop.Rows.Count > 0) { foreach (DataRow dr in dtMarketstoreyshop.Rows) { var title = (string)dr["title"]; var redirecturl = ""; if (dr["template"] == null || dr["template"].ToString() == "0") { redirecturl = string.Format(EnUrls.ShopInfoIndex2, dr["id"]); } else { redirecturl = string.Format(EnUrls.ShopInfoIndex, dr["id"]); } slist.Add("{value:'" + title + "',label:' <font class=\"auto_FFC445\">[店铺]</font> " + title.Replace(key, "<strong class=\"auto_BD182D\">" + key + "</strong>") + "<div class=\"auto_BDBDBD auto_item_right\">" + dr["areaname"] + "</div>',redirecturl:'" + redirecturl + "'}"); } } } StringBuilder sb = new StringBuilder(); foreach (var item in slist) { sb.Append(item + ","); } Response.Write("["); Response.Write(sb.ToString().Trim(',')); Response.Write("]"); Response.End(); } void SearchInformation(string key) { Response.Write("["); Response.Write("]"); Response.End(); } void SearchhyBrand(string key) { Response.Write("["); Response.Write("{value:'爱凡',label:'A 爱凡'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write("]"); Response.End(); } void SearchhyMarket(string key) { Response.Write("["); Response.Write("{value:'爱凡',label:'A 爱1凡'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write("]"); Response.End(); } void SearchhyMaterial(string key) { Response.Write("["); Response.Write("{value:'爱凡',label:'A 爱2凡'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write("]"); Response.End(); } void SearchhyStyle(string key) { Response.Write("["); Response.Write("{value:'爱凡',label:'A 爱3凡'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write(",{value:'艾菲尔',label:'A 艾菲尔'}"); Response.Write(",{value:'艾迪卡',label:'A 艾迪卡'}"); Response.Write(",{value:'麦尔迪',label:'A 麦尔迪'}"); Response.Write("]"); Response.End(); } public HttpResponse Response { get { return HttpContext.Current.Response; } } public bool IsReusable { get { return false; } } public DataTable ExcuteSelect(string strSql) { return ExcuteSelect(strSql, null); } public DataTable ExcuteSelect(string strSql, SqlParameter[] parameter) { string strConn = System.Configuration.ConfigurationManager.ConnectionStrings["connectionstr"].ConnectionString; SqlConnection sqlConn = new SqlConnection(strConn); SqlCommand sqlComm = sqlConn.CreateCommand(); try { sqlConn.Open(); sqlComm.CommandText = strSql; if (parameter != null) { sqlComm.Parameters.AddRange(parameter); } DataTable dt = new DataTable(); using (SqlDataAdapter sqlAdp = new SqlDataAdapter(sqlComm)) { sqlAdp.Fill(dt); return dt; } } catch (Exception ex) { return null; } finally { if (sqlConn.State == ConnectionState.Open) { sqlComm.Parameters.Clear(); sqlComm.Dispose(); sqlConn.Close(); } } } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/ajax/search.ashx.cs
C#
oos
24,439
using System; using System.Reflection; using System.Configuration; using System.Collections.Generic; using System.Linq; using System.Web; using System.Text; using System.IO; using TRECommon; using TREC.Entity; using TREC.ECommerce; namespace TREC.Web.ajax { /// <summary> /// ajaxconfig 的摘要说明 /// </summary> public class ajaxconfig : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string module = WebRequest.GetQueryString("module"); string type = context.Request["type"] == null ? context.Request.Params["type"] == null ? "" : context.Request.Params["type"] : context.Request["type"]; switch (type.ToLower()) { case "getconfigmoduletype": context.Response.Write(GetConfigModuleType(module)); break; default: context.Response.Write("类型数据错误"); break; } context.Response.End(); } //根据模块获取模块类型 protected string GetConfigModuleType(string type) { if (string.IsNullOrEmpty(type)) { return ""; } StringBuilder sb = new StringBuilder(); foreach (EnConfigType t in ECConfig.GetConfigTypeList(" type='" + type + "'")) { sb.Append("{\"id\":\"" + t.id + "\",\"name\":\"" + t.title + "\"},"); } if (sb.Length > 0) { return "[" + sb.ToString().Substring(0, sb.ToString().Length - 1) + "]"; } return sb.ToString(); } public bool IsReusable { get { return false; } } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/ajax/ajaxconfig.ashx.cs
C#
oos
1,979
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.SessionState; using System.Text; using System.IO; using System.Data; using TREC.ECommerce; using TREC.Entity; using TRECommon; namespace TREC.Web.ajax { /// <summary> /// adminajax 的摘要说明 /// </summary> public class ajaxuser : IHttpHandler, IRequiresSessionState { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string type = ""; string value = ""; string value2 = ""; string t = ""; string m = ""; string mt = ""; if (context.Request.QueryString["type"] != null) { type = context.Request.QueryString["type"]; } else { type = context.Request.Params["type"]; } if (context.Request.QueryString["v"] != null) { value = context.Request.QueryString["v"]; } else { value = context.Request.Params["v"]; } if (context.Request.QueryString["v2"] != null) { value2 = context.Request.QueryString["v2"]; } else { value2 = context.Request.Params["v2"]; } if (context.Request.QueryString["t"] != null) { t = context.Request.QueryString["t"]; } else { t = context.Request.Params["t"]; } if (context.Request.QueryString["m"] != null) { m = context.Request.QueryString["m"]; } else { m = context.Request.Params["m"]; } if (context.Request.QueryString["mt"] != null) { mt = context.Request.QueryString["mt"]; } else { mt= context.Request.Params["mt"]; } switch (type) { case "getadcategoryadtype": context.Response.Write(GetAdCategoryAdType(value)); break; case "getnoaddmember": context.Response.Write(GetNoAddMember(value)); break; case "getnoaddmarket": context.Response.Write(GetNoAddMarket(value)); break; case "getcompanyordealertoshop": context.Response.Write(GetCompanyOrDealerToShop(value, t)); break; case "gettopcompany": context.Response.Write(GetTopCompany(value)); break; case "gettopbrand": context.Response.Write(GetTopBrand(value)); break; case "getwebtopbrand": context.Response.Write(GetTopWebBrand(value, m, mt)); break; case "getbrands": context.Response.Write(GetBrands(value)); break; case "upshopbrand": context.Response.Write(UpShopBrandId(value,value2)); break; case "login": context.Response.Write(Login(value,value2)); break; case "checkValidation": context.Response.Write(CheckValidation(value,t, context)); break; case "checkName": context.Response.Write(CheckName(value, value2, t)); break; default: context.Response.Write("ajax数据读取错误"); break; } context.Response.End(); } /// <summary> /// 检查名称是否存在 /// </summary> /// <param name="userName"></param> /// <param name="ctype">m:登陆账号,c企业名称,d经销商,s店铺,m2卖场,b,品牌名称</param> /// <returns></returns> public string CheckName(string name, string name2, string ctype) { return ECommon.CheckName(name, name2, ctype); } public string Login(string name, string pwd) { if (Validator.IsSafeSqlString(name) && Validator.IsSafeSqlString(pwd)) { int aid = ECMember.Login(name, pwd); if (aid > 0) { if (aid == 100) { return "2"; } else { return "1"; } } } return "0"; } /// <summary> /// 检查验证码 /// </summary> /// <param name="v">验证码</param> /// <param name="context"></param> /// <returns></returns> public string CheckValidation(string v, string vt, HttpContext context) { string vSession = ""; if (context.Session==null || context.Session["_session_" + vt] != null) { vSession = context.Session["_session_" + vt].ToString(); } if (vSession.ToLower() == v.ToLower()) { return "true"; } return "false"; } public string GetBrands(string value) { StringBuilder sb = new StringBuilder(); if (value != "") { List<EnBrands> list = ECBrand.GetBrandsList(" brandid=" + value); EnBrand b = ECBrand.GetBrandInfo(" where id=" + value); foreach (EnBrands m in list) { sb.Append("{\"id\":\"" + m.id + "\",\"title\":\"" + m.title + "\",\"s\":\"" + b.style + "\",\"m\":\"" + b.material + "\",\"c\":\"" + b.color + "\"},"); } if (list.Count == 0) { sb.Append("{\"id\":\"\",\"title\":\"\",\"s\":\"" + b.style + "\",\"m\":\"" + b.material + "\",\"c\":\"" + b.color + "\"},"); } return sb.Length > 0 && sb.ToString().EndsWith(",") ? "[" + sb.ToString().Substring(0, sb.ToString().Length - 1) + "]" : "[" + sb.ToString() + "]"; } return sb.ToString(); } //前台获取品牌-通过审核-从视图读取数据 protected string UpShopBrandId(string sid,string value) { value = value.StartsWith(",") ? value.Substring(1, value.Length - 1) : value; value = value.EndsWith(",") ? value.Substring(0, value.Length - 1) : value; string[] values = value.Split(','); if (values.Length > 0) { StringOperation.SortAndDdistinct(values, StringOperation.OrderByType.DESC); List<EnShopBrand> list = new List<EnShopBrand>(); foreach (string s in values) { if (sid != "0" && s != "0") { EnShopBrand m = new EnShopBrand(); m.shopid = TypeConverter.StrToInt(sid); m.brandid = TypeConverter.StrToInt(s); list.Add(m); } } if (list.Count > 0) { ECShop.EditShopBrand(list); } int tmpPageCount = 0; StringBuilder sb = new StringBuilder(); if (value != "") { foreach (EnWebBrand b in ECBrand.GetWebBrandList(1, 30, " id in(" + value + ") ", out tmpPageCount)) { sb.Append("{\"id\":\"" + b.id + "\",\"name\":\"" + b.title + "\",\"logo\":\"" + b.logo + "\",\"company\":\"" + b.companyname + "\",\"stylename\":\"" + b.stylename + "\",\"spreadname\":\"" + b.spreadname + "\",\"materialname\":\"" + b.materialname + "\"},"); } if (sb.Length > 0) { return "[" + sb.ToString().Substring(0, sb.ToString().Length - 1) + "]"; } } } return ""; } //前台获取品牌-通过审核-从视图读取数据 protected string GetTopWebBrand(string name,string m,string mt) { int tmpPageCount = 0; StringBuilder sb = new StringBuilder(); string strWhere = ""; if (m != "") { if (mt != "") { switch (TypeConverter.StrToInt(mt)) { case (int)EnumMemberType.工厂企业: strWhere += " and companyid=" + m; break; case (int)EnumMemberType.经销商: strWhere += " and id in( select brandid from " + TableName.TBAppBrand + " where dealerid=" + m + ") "; break; } } } foreach (EnWebBrand b in ECBrand.GetWebBrandList(1, 30, " (title like '%" + name + "%' or companyname like '" + name + "' or spreadname like '" + name + "' or stylename like '" + name + "' or materialname like '" + name + "') "+strWhere, out tmpPageCount)) { sb.Append("{\"id\":\"" + b.id + "\",\"name\":\"" + b.title + "\",\"logo\":\"" + b.logo + "\",\"company\":\"" + b.companyname + "\",\"stylename\":\"" + b.stylename + "\",\"spreadname\":\"" + b.spreadname + "\",\"materialname\":\"" + b.materialname + "\"},"); } if (sb.Length > 0) { return "[" + sb.ToString().Substring(0, sb.ToString().Length - 1) + "]"; } return ""; } //获取品牌 protected string GetTopBrand(string name) { int tmpPageCount = 0; StringBuilder sb = new StringBuilder(); foreach (EnBrand b in ECBrand.GetBrandList(1, 30, " title like '%" + name + "%' ", out tmpPageCount)) { sb.Append("{\"id\":\"" + b.id + "\",\"name\":\"" + b.title + "\"},"); } if (sb.Length > 0) { return "[" + sb.ToString().Substring(0, sb.ToString().Length - 1) + "]"; } return ""; } //获取工厂 protected string GetTopCompany(string name) { int tmpPageCount = 0; StringBuilder sb = new StringBuilder(); sb.Append("{\"id\":\"0\",\"name\":\"无关联工厂\"},"); foreach (EnCompany b in ECCompany.GetCompanyList(1, 30, " title like '%" + name + "%'", out tmpPageCount)) { sb.Append("{\"id\":\"" + b.id + "\",\"name\":\"" + b.title + "\"},"); } if (sb.Length > 0) { return "[" + sb.ToString().Substring(0, sb.ToString().Length - 1) + "]"; } return ""; } //根据类型查找厂家或经销商用于店铺所属对象 protected string GetCompanyOrDealerToShop(string name,string type) { StringBuilder sb = new StringBuilder(); if (type == ((int)EnumMemberType.工厂企业).ToString()) { foreach (EnCompany c in ECCompany.GetCompanyList(" title like '%" + name + "%'")) { sb.Append("{\"id\":\"" + c.id + "\",\"name\":\"" + c.title + "\"},"); } } if (type == ((int)EnumMemberType.经销商).ToString()) { foreach (EnDealer d in ECDealer.GetDealerList(" title like '%" + name + "%'")) { sb.Append("{\"id\":\"" + d.id + "\",\"name\":\"" + d.title + "\"},"); } } if (sb.Length > 0) { return "[" + sb.ToString().Substring(0, sb.ToString().Length - 1) + "]"; } return ""; } //获取没有绑定对象的账号[个人会员] protected string GetNoAddMember(string name) { StringBuilder sb = new StringBuilder(); sb.Append("{\"id\":\"0\",\"name\":\"无关联会员\"},"); foreach (EnMember m in ECMember.GetTop20MemberList(name)) { sb.Append("{\"id\":\"" + m.id + "\",\"name\":\"" + m.username + "\"},"); } if (sb.Length > 0) { return "[" + sb.ToString().Substring(0, sb.ToString().Length - 1) + "]"; } return ""; } protected string GetNoAddMarket(string name) { StringBuilder sb = new StringBuilder(); foreach (EnMarket m in ECMarket.GetTop20MarketList(name)) { sb.Append("{\"id\":\"" + m.id + "\",\"name\":\"" + m.title + "\"},"); } if (sb.Length > 0) { return "[" + sb.ToString().Substring(0, sb.ToString().Length - 1) + "]"; } return ""; } public string GetAdCategoryAdType(string id) { return ECAdvertisementCategory.GetAdCategropyAdType(id); } public bool IsReusable { get { return false; } } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/ajax/ajaxuser.ashx.cs
C#
oos
14,221
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TRECommon; using TREC.ECommerce; using TREC.Entity; namespace TREC.Web.Admin.dealer { public partial class menuinfo : AdminPageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ddlmodule.DataSource = ECModule.GetModuleList(""); ddlmodule.DataTextField = "title"; ddlmodule.DataValueField = "id"; ddlmodule.DataBind(); ddlmodule.Items.Insert(0, new ListItem("请选择", "")); ddlparent.Items.Add(new ListItem("请选择模块", "")); ddlparent.Items.Add(new ListItem("一级菜单", "0")); ShowData(); } } protected void ShowData() { if (ECommon.QueryId != "" && ECommon.QueryEdit != "") { EnMenu model = ECMenu.GetMenuInfo(" where id=" + ECommon.QueryId); if (model != null) { this.txttitle.Text = model.title; this.txtmark.Text = model.mark; this.txtlev.Text = model.lev.ToString(); this.txturl.Text = model.url; ddlmodule.SelectedValue = model.module.ToString(); this.txtdescript.Text = model.descript; this.txtsort.Text = model.sort.ToString(); if (model.module != 0) { ddlparent.DataSource = ECMenu.GetMenuList(" parent=0 and module=" + model.module); ddlparent.DataTextField = "title"; ddlparent.DataValueField = "id"; ddlparent.DataBind(); ddlparent.Items.Insert(0,new ListItem("请选择模块", "")); ddlparent.Items.Insert(1, new ListItem("一级菜单", "0")); ddlparent.SelectedValue = model.parent.ToString(); } } } } protected void btnSave_Click(object sender, EventArgs e) { EnMenu model = null; string strErr = ""; if (strErr != "") { //MessageBox.Show(this, strErr); return; } string title = this.txttitle.Text; string type = ""; string mark = this.txtmark.Text; int parent = TypeConverter.StrToInt(Request.Params["ddlparent"].ToString()); int lev = int.Parse(this.txtlev.Text); string path = ""; string url = this.txturl.Text; int module = TypeConverter.StrToInt(ddlmodule.SelectedValue); int action = 0; string descript = this.txtdescript.Text; int sort = int.Parse(this.txtsort.Text); if (ECommon.QueryId != "" && ECommon.QueryEdit != "") { model = ECMenu.GetMenuInfo(" where id=" + ECommon.QueryId); model.id = TypeConverter.StrToInt(ECommon.QueryId); } if (model == null) { model = new EnMenu(); } model.title = title; model.type = type; model.mark = mark; model.parent = parent; model.lev = lev; model.path = path; model.url = url; model.module = module; model.action = action; model.descript = descript; model.sort = sort; int aid = ECMenu.EditMenu(model); if (aid > 0) { UiCommon.JscriptPrint(this.Page, "编辑成功!", "Menulist.aspx?mid=" + model.module, "Success"); } } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/menu/menuinfo.aspx.cs
C#
oos
4,094
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="menuinfo.aspx.cs" Inherits="TREC.Web.Admin.dealer.menuinfo" %> <%@ Import Namespace="TREC.ECommerce" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery.validate.min.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery.form.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/additional-methods.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/messages_cn.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/My97DatePicker/WdatePicker.js"></script> <script type="text/javascript"> $(function () { //表单验证JS $("#form1").validate({ //出错时添加的标签 errorElement: "span", showErrors: function (errorMap, errorList) { if (errorList.length > 0) { if ($("#" + errorList[0].element.id).next() != null) { $("#" + errorList[0].element.id).next().remove(); } } this.defaultShowErrors(); }, success: function (label) { //正确时的样式 label.text(" ").addClass("success"); } }); $("#ddlmodule").live("change", function () { if ($(this).val() != "" && $(this).val() != "0") { $.ajax({ url: "../ajax/adminajax.ashx", data: "type=getmodulerootmenu&v=" + $(this).val(), success: function (data) { if (data != "") { $("#ddlparent").hide(); $("#ddlparent").show(); $("#ddlparent").html("<option value=\"\">请选择</option>"); $.each(data, function (i) { $("#ddlparent").append("<option value=\"" + data[i].id + "\">" + data[i].name + "</option>"); }); } }, dataType:"json", error: function (d, m) { alert(m); } }); } }) }); </script> <style type="text/css"> .formTable{border:1px solid #ccc;} .formTable tr th{background:#ededed; text-align:left;} .formTable tr td{border:none; padding-top:8px; padding-bottom:8px;} </style> </head> <body style="padding:10px;"> <form id="form1" runat="server"> <div class="navigation"> <span class="back"><a href="menulist.aspx">返回列表</a></span><b>您当前的位置:首页 &gt; 系统管理 &gt; 菜单管理</b> </div> <div class="spClear"></div> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable"> <tr> <th colspan="3" align="left">菜单信息</th> </tr> <tr> <td width="120" align="right"> 名称 : </td> <td align="left"> <asp:TextBox ID="txttitle" runat="server" CssClass="w160 input required"></asp:TextBox> </td> </tr> <tr> <td align="right"> 标识 : </td> <td > <asp:TextBox ID="txtmark" runat="server" CssClass="input"></asp:TextBox> </td> </tr> <tr> <td align="right"> 所属模块 : </td> <td > <asp:DropDownList ID="ddlmodule" runat="server" CssClass="select selectNone"></asp:DropDownList> </td> </tr> <tr> <td align="right"> 上级菜单 : </td> <td > <asp:DropDownList ID="ddlparent" runat="server" CssClass="select selectNone"></asp:DropDownList> </td> </tr> <tr> <td align="right"> 级别 : </td> <td > <asp:TextBox ID="txtlev" runat="server" CssClass="input digits required"></asp:TextBox> </td> </tr> <tr> <td align="right"> 连接地址 : </td> <td > <asp:TextBox ID="txturl" runat="server" CssClass="input w380 required"></asp:TextBox> </td> </tr> <tr> <td align="right"> 描述 : </td> <td > <asp:TextBox ID="txtdescript" runat="server" CssClass="textarea w380" TextMode="MultiLine" Rows="4"></asp:TextBox> </td> </tr> <tr> <td align="right"> 排序 : </td> <td align="left"> <asp:TextBox ID="txtsort" runat="server" CssClass="w160 input required digits">0</asp:TextBox> </td> </tr> </table> <div style="margin-top:10px; margin-left:140px"> <asp:Button ID="btnSave" runat="server" Text="确认保存" CssClass="submit" onclick="btnSave_Click" /><input name="重置" type="reset" class="submit" value="重置" /> </div> </form> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/menu/menuinfo.aspx
ASP.NET
oos
6,114
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TREC.ECommerce; using TREC.Entity; using TRECommon; namespace TREC.Web.Admin.dealer { public partial class menulist : AdminPageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ShowData(); } } protected void ShowData() { if (ECommon.QueryEdit == "2" && ECommon.QueryId != "") { ECMenu.DeleteMenu(TypeConverter.StrToInt(ECommon.QueryId)); } if (Request.QueryString["mid"] != null && Request.QueryString["mid"].ToString() != "") { rptList.DataSource = ECMenu.GetMenuList("", " where module=" + Request.QueryString["mid"], ""); rptList.DataBind(); AspNetPager1.RecordCount = tmpPageCount; } else { rptList.Visible = false; AspNetPager1.Visible = false; } } protected void lbtnDel_Click(object sender, EventArgs e) { string idlist=""; for (int i = 0; i < rptList.Items.Count; i++) { string id = ((Label)rptList.Items[i].FindControl("lb_id")).Text; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("cb_id"); if (cb.Checked) { idlist += id + ","; } } if (idlist.Length > 0) { ECMenu.DeleteMenuByIdList(idlist.EndsWith(",") ? idlist.Substring(0, idlist.Length - 1) : idlist); UiCommon.JscriptPrint(this.Page, "批量删除成功!", "menulist.aspx", "Success"); } } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/menu/menulist.aspx.cs
C#
oos
1,963
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="menulist.aspx.cs" Inherits="TREC.Web.Admin.dealer.menulist" %> <%@ Import Namespace="TREC.ECommerce" %> <%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="../script/admin.js"></script> <script type="text/javascript"> $(function () { $(".msgtable tr:nth-child(odd)").addClass("tr_bg"); //隔行变色 $(".msgtable tr").hover( function () { $(this).addClass("tr_hover_col"); }, function () { $(this).removeClass("tr_hover_col"); } ); }) </script> </head> <body style="padding:10px;"> <form id="form1" runat="server"> <div class="navigation"> <span class="add"><a href="menuinfo.aspx">添加菜单</a></span><b>您当前的位置:首页 &gt; 系统管理 &gt; 菜单管理</b> </div> <div class="spClear"> <ul class="nav"> <%foreach (TREC.Entity.EnModule m in TREC.ECommerce.ECModule.GetModuleList("")) { %> <li><a href="menulist.aspx?mid=<%=m.id %>" class="<%=UiCommon.QueryStringCur("mid", m.id.ToString(), "", "cur")%>" id="<%=m.id %>"><%=m.title %></a></li> <%} %> </ul> </div> <div class="spClear"></div> <% if (Request.QueryString["mid"] == null) {%> <div class="msgbox"> 请点击模块加载数据修改菜单! </div> <%} else { %> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable"> <tr> <th width="40px" align="center">选择</th> <th width="40px" align="center">编号</th> <th align="left" width="200">名称</th> <th width="60px" align="center">模块</th> <th align="center">连接地址</th> <th width="80px" align="right" style="padding-left:5px;">操作</th> </tr> <asp:Repeater ID="rptList" runat="server"> <ItemTemplate> <tr> <td align="center"><asp:CheckBox ID="cb_id" CssClass="checkall" runat="server" /></td> <td align="center"><asp:Label ID="lb_id" runat="server" Text='<%#Eval("Id")%>'></asp:Label></td> <td align="left"><%#TRECommon.HTMLUtils.GetSpacesString(int.Parse(Eval("lev").ToString())) %><a href="menuinfo.aspx?edit=1&id=<%#Eval("id") %>"><%#Eval("lev").ToString() == "1" || Eval("lev").ToString() == "" ? "<strong>" + Eval("title") + "</strong>" : Eval("title")%></a></td> <td align="center"><%#Eval("module")%></td> <td align="center"><%#Eval("url")%></td> <td align="right" style="padding-left:5px;"><a href="menuinfo.aspx?edit=1&id=<%#Eval("id") %>">修改</a>|<a href="menuinfo.aspx?edit=2&id=<%#Eval("id") %>">删除</a></td> </tr> </ItemTemplate> </asp:Repeater> </table> <div class="spClear"></div> <div style="line-height:30px;height:30px;"> <div id="Pagination" class="right flickr"> <webdiyer:AspNetPager ID="AspNetPager1" runat="server" AlwaysShow="true" UrlPaging="true" FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页"> </webdiyer:AspNetPager> </div> <div class="left"> <span class="btn_all" onclick="checkAll(this);">全选</span> <span class="btn_bg"> <asp:LinkButton ID="lbtnDel" runat="server" OnClientClick="return confirm( '确定要删除这些记录吗? ');" OnClick="lbtnDel_Click" >删 除</asp:LinkButton>&nbsp;&nbsp; </span> </div> </div> <%} %> </form> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/menu/menulist.aspx
ASP.NET
oos
4,058
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="configinfo.aspx.cs" Inherits="TREC.Web.Admin.config.configinfo" EnableEventValidation="false" %> <%@ Import Namespace="TREC.ECommerce" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery.validate.min.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery.form.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/additional-methods.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/messages_cn.js"></script> <script type="text/javascript"> $(function () { //表单验证JS $("#form1").validate({ //出错时添加的标签 errorElement: "span", showErrors: function (errorMap, errorList) { if (errorList.length > 0) { if ($("#" + errorList[0].element.id).next() != null) { $("#" + errorList[0].element.id).next().remove(); } } this.defaultShowErrors(); }, success: function (label) { //正确时的样式 label.text(" ").addClass("success"); } }); $("#ddlmodule").live("change", (function () { if ($(this).val() != "" && $(this).val() != "0") { $.ajax({ url: "<%=TREC.ECommerce.ECommon.WebUrl %>/ajax/ajaxconfig.ashx", data: "type=getConfigModuleType&module=" + $(this).val(), dataType:"json", success: function (data) { $("#ddltype").hide(); $("#ddltype").show(); if (data != "") { $("#ddltype").html(); $("#ddltype").html("<option value=\"0\">请选择</option>"); $.each(data, function (i) { $("#ddltype").append("<option value=\"" + data[i].id + "\">" + data[i].name + "</option>"); }); } } }); } })); }); </script> </head> <body style="padding:10px;"> <form id="form1" runat="server"> <div class="navigation"> <span class="back"><a href="configlist.aspx">返回列表</a></span><b>您当前的位置:首页 &gt; 系统管理 &gt; 配置管理</b> </div> <div class="spClear"></div> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable"> <tr> <th colspan="2" align="left">配置信息</th> </tr> <tr> <td width="160px" align="right">配置名称:</td> <td align="left"> <asp:TextBox id="txttitle" runat="server" CssClass="input"></asp:TextBox> </td> </tr> <tr> <td align="right"> 配置值 : </td> <td align="left"> <asp:TextBox ID="txtvalue" runat="server" CssClass="input"></asp:TextBox> </td> </tr> <tr> <td align="right"> 所属模块 : </td> <td align="left"> <asp:DropDownList ID="ddlmodule" runat="server" CssClass="select selectNone"></asp:DropDownList> </td> </tr> <tr> <td align="right"> 配置类型 : </td> <td align="left"> <asp:DropDownList ID="ddltype" runat="server" CssClass="select selectNone"></asp:DropDownList> </td> </tr> <tr> <td align="right">排序:</td> <td align="left"> <asp:TextBox id="txtsort" runat="server" Width="40px" CssClass="input">0</asp:TextBox> </td> </tr> </table> <div style="margin-top:10px; margin-left:180px"> <asp:Button ID="btnSave" runat="server" Text="确认保存" CssClass="submit" onclick="btnSave_Click" /><input name="重置" type="reset" class="submit" value="重置" /> </div> </form> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/config/configinfo.aspx
ASP.NET
oos
4,920
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="configtypeinfo.aspx.cs" Inherits="TREC.Web.Admin.config.configtypeinfo" EnableEventValidation="false" %> <%@ Import Namespace="TREC.ECommerce" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery.validate.min.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery.form.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/additional-methods.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/messages_cn.js"></script> <script type="text/javascript"> $(function () { //表单验证JS $("#form1").validate({ errorElement: "span", showErrors: function (errorMap, errorList) { if (errorList.length > 0) { if ($("#" + errorList[0].element.id).next() != null) { $("#" + errorList[0].element.id).next().remove(); } } this.defaultShowErrors(); }, success: function (label) { //正确时的样式 label.text(" ").addClass("success"); } }); $("#btnSave").click(function () { if ($("#txtmark").val() == "") { alert("请输入标识!")} $.ajax(function () { url:'../ajax/adminajax.ashx', data:'type=getconfigtypemarket&v='+$("#txtmark").val()+"&t=<%=ECommon.QueryId %>", success:function(data){ if(data=="1") { return true; } } }) }) }); </script> </head> <body style="padding:10px;"> <form id="form1" runat="server"> <div class="navigation"> <span class="back"><a href="configtypelist.aspx">返回列表</a></span><b>您当前的位置:首页 &gt; 系统管理 &gt; 配置管理</b> </div> <div class="spClear"></div> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable"> <tr> <th colspan="2" align="left">配置类型信息</th> </tr> <tr> <td width="160px" align="right">配置类型名称:</td> <td align="left"> <asp:TextBox id="txttitle" runat="server" CssClass="input required w250"></asp:TextBox> </td> </tr> <tr> <td align="right"> 标识 : </td> <td > <asp:TextBox ID="txtmark" runat="server" CssClass="input required w160"></asp:TextBox> </td> </tr> <tr> <td align="right"> 索引 : </td> <td > <asp:TextBox ID="txtletter" runat="server" CssClass="input required w160"></asp:TextBox> </td> </tr> <tr> <td align="right"> 配置模块 : </td> <td > <asp:DropDownList ID="ddltype" runat="server" CssClass="select selectNone"></asp:DropDownList> </td> </tr> <tr> <td align="right"> 对象数量 : </td> <td > <asp:TextBox ID="txtcount" runat="server" CssClass="input required digits" Width="40">0</asp:TextBox> </td> </tr> <tr> <td align="right">排序:</td> <td align="left"> <asp:TextBox id="txtsort" runat="server" Width="40px" CssClass="input required digits">0</asp:TextBox> </td> </tr> <tr> <td align="right"> 描述 : </td> <td > <asp:TextBox id="txtdescript" runat="server" CssClass="textarea w380" TextMode="MultiLine" Rows="5"></asp:TextBox> </td> </tr> </table> <div style="margin-top:10px; margin-left:180px"> <asp:Button ID="btnSave" runat="server" Text="确认保存" CssClass="submit" onclick="btnSave_Click" /><input name="重置" type="reset" class="submit" value="重置" /> </div> </form> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/config/configtypeinfo.aspx
ASP.NET
oos
4,931
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TRECommon; using TREC.ECommerce; using TREC.Entity; namespace TREC.Web.Admin.config { public partial class configtypeinfo : AdminPageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //模块绑定 ddltype.Items.Clear(); WebControlBind.DrpBind(typeof(EnumConfigModule), ddltype); ddltype.Items.Insert(0, new ListItem("请选择", "")); ShowData(); } } protected void ShowData() { if (ECommon.QueryId != "" && ECommon.QueryEdit != "") { EnConfigType model = ECConfig.GetConfigTypeInfo(" where id=" + ECommon.QueryId); if (model != null) { this.txttitle.Text = model.title; this.txtmark.Text = model.mark; this.txtletter.Text = model.letter; ddltype.SelectedValue = model.type.ToString(); this.txtsort.Text = model.sort.ToString(); this.txtcount.Text = model.count.ToString(); this.txtdescript.Text = model.descript; this.txtmark.Enabled = false; } } } protected void btnSave_Click(object sender, EventArgs e) { TREC.Entity.EnConfigType model = null; string strErr = ""; if (this.txttitle.Text.Trim().Length == 0) { strErr += "title不能为空!\\n"; } if (strErr != "") { //MessageBox.Show(this, strErr); return; } if (ECommon.QueryId != "" && ECommon.QueryEdit != "") { model = ECConfig.GetConfigTypeInfo(" where id=" + ECommon.QueryId); } if (model == null) { model = new EnConfigType(); } string title = this.txttitle.Text; string mark = this.txtmark.Text; string letter = this.txtletter.Text; string type = ddltype.SelectedValue; int sort = int.Parse(this.txtsort.Text); int count = int.Parse(this.txtcount.Text); string descript = this.txtdescript.Text; model.title = title; model.mark = mark; model.letter = letter; model.type = type; model.sort = sort; model.count = count; model.descript = descript; int aid = ECConfig.EditConfigType(model); if (aid > 0) { UiCommon.JscriptPrint(this.Page, "编辑成功!", "configtypelist.aspx?mid=" + ddltype.SelectedValue, "Success"); } } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/config/configtypeinfo.aspx.cs
C#
oos
3,147
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="configlist.aspx.cs" Inherits="TREC.Web.Admin.config.configlist" %> <%@ Import Namespace="TREC.ECommerce" %> <%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="../script/admin.js"></script> <script type="text/javascript"> $(function () { $(".msgtable tr:nth-child(odd)").addClass("tr_bg"); //隔行变色 $(".msgtable tr").hover( function () { $(this).addClass("tr_hover_col"); }, function () { $(this).removeClass("tr_hover_col"); } ); }) </script> </head> <body style="padding:10px;"> <form id="form1" runat="server"> <div class="navigation"> <span class="add"><a href="configinfo.aspx">添加系列</a></span><b>您当前的位置:首页 &gt; 系统管理 &gt; 配置管理</b> </div> <div class="spClear"></div> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable"> <tr> <th width="40px" align="center">选择</th> <th width="40px" align="center">编号</th> <th align="center" width="60px">所属模块</th> <th align="center" width="60px">配置类型</th> <th align="center" width="120px">配置值</th> <th align="left">配置名称</th> <th align="center" width="60px">排序</th> <th width="80px" align="right" style="padding-left:5px;">操作</th> </tr> <asp:Repeater ID="rptList" runat="server"> <ItemTemplate> <tr> <td align="center"><asp:CheckBox ID="cb_id" CssClass="checkall" runat="server" /></td> <td align="center"><asp:Label ID="lb_id" runat="server" Text='<%#Eval("Id")%>'></asp:Label></td> <td align="center"><%# Enum.GetName(typeof(TREC.Entity.EnumConfigModule),Eval("module"))%></td> <td align="center"><%# ECConfig.GetTypeName(Eval("module").ToString(), Eval("type").ToString())%></td> <td align="center"><%#Eval("value")%></td> <td align="left"><a href="configinfo.aspx?edit=1&id=<%#Eval("id") %>"><%#Eval("title") %></a></td> <td align="center"><asp:TextBox ID="txtSort" runat="server" Text='<%#Eval("sort") %>' Width="40" style="margin-left:10px;"></asp:TextBox></td> <td align="right" style="padding-left:5px;"><a href="configinfo.aspx?edit=1&id=<%#Eval("id") %>">修改</a>|<a href="configlist.aspx?edit=2&id=<%#Eval("id") %>">删除</a></td> </tr> </ItemTemplate> </asp:Repeater> </table> <div class="spClear"></div> <div style="line-height:30px;height:30px;"> <div id="Pagination" class="right flickr"> <webdiyer:AspNetPager ID="AspNetPager1" runat="server" AlwaysShow="true" UrlPaging="true" FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页"> </webdiyer:AspNetPager> </div> <div class="left"> <span class="btn_all" onclick="checkAll(this);">全选</span> <span class="btn_bg"> <asp:LinkButton ID="lbtnDel" runat="server" OnClientClick="return confirm( '确定要删除这些记录吗? ');" OnClick="lbtnDel_Click" >删 除</asp:LinkButton> <asp:LinkButton ID="lbUpSort" runat="server" OnClick="lbUpSort_Click" >排 序</asp:LinkButton>&nbsp;&nbsp; </span> </div> </div> </form> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/config/configlist.aspx
ASP.NET
oos
3,900
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TREC.ECommerce; using TREC.Entity; using TRECommon; namespace TREC.Web.Admin.config { public partial class configlist :AdminPageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ShowData(); } } protected void ShowData() { if (ECommon.QueryEdit == "2" && ECommon.QueryId != "") { ECConfig.DeleteConfig(TypeConverter.StrToInt(ECommon.QueryId)); } rptList.DataSource = ECConfig.GetConfigList(ECommon.QueryPageIndex, AspNetPager1.PageSize, "", out tmpPageCount); rptList.DataBind(); AspNetPager1.RecordCount = tmpPageCount; } protected void lbtnDel_Click(object sender, EventArgs e) { string idlist=""; for (int i = 0; i < rptList.Items.Count; i++) { string id = ((Label)rptList.Items[i].FindControl("lb_id")).Text; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("cb_id"); if (cb.Checked) { idlist += id + ","; } } if (idlist.Length > 0) { ECConfig.DeleteConfigByIdList(idlist.EndsWith(",") ? idlist.Substring(0, idlist.Length - 1) : idlist); UiCommon.JscriptPrint(this.Page, "批量删除成功!", "configlist.aspx", "Success"); } } protected void lbUpSort_Click(object sender, EventArgs e) { for (int i = 0; i < rptList.Items.Count; i++) { string id = ((Label)rptList.Items[i].FindControl("lb_id")).Text; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("cb_id"); TextBox txtSort = (TextBox)rptList.Items[i].FindControl("txtSort"); if (cb.Checked) { //ECConfig.UpConfigSort(TypeConverter.StrToInt(id), txtSort.Text == "" ? "0" : txtSort.Text); } } UiCommon.JscriptPrint(this.Page, "排序更新成功!", "configlist.aspx", "Success"); } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/config/configlist.aspx.cs
C#
oos
2,458
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TREC.ECommerce; using TREC.Entity; using TRECommon; namespace TREC.Web.Admin.config { public partial class configtypelist :AdminPageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ShowData(); } } protected void ShowData() { if (ECommon.QueryEdit == "2" && ECommon.QueryId != "") { ECConfig.DeleteConfigType(TypeConverter.StrToInt(ECommon.QueryId)); } string strWhere = ""; if (ECommon.QueryMid != "") { strWhere += " type=" + ECommon.QueryMid; } rptList.DataSource = ECConfig.GetConfigTypeList(ECommon.QueryPageIndex, AspNetPager1.PageSize, strWhere, out tmpPageCount); rptList.DataBind(); AspNetPager1.RecordCount = tmpPageCount; } protected void lbtnDel_Click(object sender, EventArgs e) { string idlist=""; for (int i = 0; i < rptList.Items.Count; i++) { string id = ((Label)rptList.Items[i].FindControl("lb_id")).Text; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("cb_id"); if (cb.Checked) { idlist += id + ","; } } if (idlist.Length > 0) { ECConfig.DeleteConfigTypeByIdList(idlist.EndsWith(",") ? idlist.Substring(0, idlist.Length - 1) : idlist); UiCommon.JscriptPrint(this.Page, "批量删除成功!", "configtypelist.aspx", "Success"); } } protected void lbUpSort_Click(object sender, EventArgs e) { for (int i = 0; i < rptList.Items.Count; i++) { string id = ((Label)rptList.Items[i].FindControl("lb_id")).Text; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("cb_id"); TextBox txtSort = (TextBox)rptList.Items[i].FindControl("txtSort"); if (cb.Checked) { ECConfig.UpConfigSort(txtSort.Text == "" ? "0" : txtSort.Text,TypeConverter.StrToInt(id)); } } UiCommon.JscriptPrint(this.Page, "排序更新成功!", "configtypelist.aspx", "Success"); } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/config/configtypelist.aspx.cs
C#
oos
2,649
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="configtypelist.aspx.cs" Inherits="TREC.Web.Admin.config.configtypelist" %> <%@ Import Namespace="TREC.ECommerce" %> <%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="../script/admin.js"></script> <script type="text/javascript"> $(function () { $(".msgtable tr:nth-child(odd)").addClass("tr_bg"); //隔行变色 $(".msgtable tr").hover( function () { $(this).addClass("tr_hover_col"); }, function () { $(this).removeClass("tr_hover_col"); } ); }) </script> </head> <body style="padding:10px;"> <form id="form1" runat="server"> <div class="navigation"> <span class="add"><a href="configtypeinfo.aspx">添加配置类型</a></span><b>您当前的位置:首页 &gt; 系统管理 &gt; 配置管理</b> </div> <div class="spClear"></div> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable"> <tr> <th width="40px" align="center">选择</th> <th width="40px" align="center">编号</th> <th align="center" width="60px">所属模块</th> <th align="left">配置名称</th> <th align="center" width="60px">排序</th> <th width="80px" align="right" style="padding-left:5px;">操作</th> </tr> <asp:Repeater ID="rptList" runat="server"> <ItemTemplate> <tr> <td align="center"><asp:CheckBox ID="cb_id" CssClass="checkall" runat="server" /></td> <td align="center"><asp:Label ID="lb_id" runat="server" Text='<%#Eval("Id")%>'></asp:Label></td> <td align="center"><%# Enum.GetName(typeof(TREC.Entity.EnumConfigModule),TRECommon.TypeConverter.StrToInt(Eval("type").ToString()))%></td> <td align="left"><a href="configtypeinfo.aspx?edit=1&id=<%#Eval("id") %>"><%#Eval("title") %></a></td> <td align="center"><asp:TextBox ID="txtSort" runat="server" Text='<%#Eval("sort") %>' Width="40" style="margin-left:10px;"></asp:TextBox></td> <td align="right" style="padding-left:5px;"><a href="configtypeinfo.aspx?edit=1&id=<%#Eval("id") %>">修改</a>|<a href="configtypelist.aspx?edit=2&id=<%#Eval("id") %>">删除</a></td> </tr> </ItemTemplate> </asp:Repeater> </table> <div class="spClear"></div> <div style="line-height:30px;height:30px;"> <div id="Pagination" class="right flickr"> <webdiyer:AspNetPager ID="AspNetPager1" runat="server" AlwaysShow="true" UrlPaging="true" FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页"> </webdiyer:AspNetPager> </div> <div class="left"> <span class="btn_all" onclick="checkAll(this);">全选</span> <span class="btn_bg"> <asp:LinkButton ID="lbtnDel" runat="server" OnClientClick="return confirm( '确定要删除这些记录吗? ');" OnClick="lbtnDel_Click" >删 除</asp:LinkButton> <asp:LinkButton ID="lbUpSort" runat="server" OnClick="lbUpSort_Click" >排 序</asp:LinkButton>&nbsp;&nbsp; </span> </div> </div> </form> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/config/configtypelist.aspx
ASP.NET
oos
3,693
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TRECommon; using TREC.ECommerce; using TREC.Entity; namespace TREC.Web.Admin.config { public partial class configinfo : AdminPageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //模块绑定 ddlmodule.Items.Clear(); WebControlBind.DrpBind(typeof(EnumConfigModule), ddlmodule); ddlmodule.Items.Insert(0, new ListItem("请选择", "")); ddltype.Items.Insert(0, new ListItem("请选择", "")); ShowData(); } } protected void ShowData() { if (ECommon.QueryId != "" && ECommon.QueryEdit != "") { EnConfig model = ECConfig.GetConfigInfo(" where id=" + ECommon.QueryId); if (model != null) { this.txttitle.Text = model.title; this.txtvalue.Text = model.value; ddlmodule.SelectedValue = model.module.ToString(); this.txtsort.Text = model.sort.ToString(); if (ddlmodule.SelectedValue != "" && ddlmodule.SelectedValue != "0") { ddltype.Items.Clear(); ddltype.DataSource = ECConfig.GetConfigTypeList(" type='" + model.module.ToString() + "'"); ddltype.DataTextField = "title"; ddltype.DataValueField = "id"; ddltype.DataBind(); } ddltype.SelectedValue = model.type.ToString(); } } } protected void btnSave_Click(object sender, EventArgs e) { TREC.Entity.EnConfig model = null; string strErr = ""; if (this.txttitle.Text.Trim().Length == 0) { strErr += "title不能为空!\\n"; } if (strErr != "") { //MessageBox.Show(this, strErr); return; } if (ECommon.QueryId != "" && ECommon.QueryEdit != "") { model.id = TypeConverter.StrToInt(ECommon.QueryId); } if (model == null) { model = new EnConfig(); } string title = this.txttitle.Text; string value = this.txtvalue.Text; int type = TypeConverter.StrToInt(HttpContext.Current.Request.Form["ddltype"] == null ? "0" : HttpContext.Current.Request.Form["ddltype"]); int module = TypeConverter.StrToInt(ddlmodule.SelectedValue); int sort = TypeConverter.StrToInt(this.txtsort.Text); model.title = title; model.value = value; model.type = type; model.module = module; model.sort = sort; int aid = ECConfig.EditConfig(model); if (aid > 0) { UiCommon.JscriptPrint(this.Page, "编辑成功!", "configlist.aspx", "Success"); } } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/config/configinfo.aspx.cs
C#
oos
3,417
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="aggregationtypelist.aspx.cs" Inherits="TREC.Web.Admin.aggregation.aggregationtypelist" %> <%@ Import Namespace="TREC.ECommerce" %> <%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="../script/admin.js"></script> <script type="text/javascript"> $(function () { $(".msgtable tr:nth-child(odd)").addClass("tr_bg"); //隔行变色 $(".msgtable tr").hover( function () { $(this).addClass("tr_hover_col"); }, function () { $(this).removeClass("tr_hover_col"); } ); }) </script> </head> <body style="padding:10px;"> <form id="form1" runat="server"> <div class="navigation"> <span class="add"><a href="aggregationinfo.aspx">添加信息</a></span><b>您当前的位置:首页 &gt; 信息管理 &gt; 聚合信息</b> </div> <div class="spClear"></div> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable"> <tr> <th width="40px" align="center">选择</th> <th width="40px" align="center">编号</th> <th align="left">模块名称</th> <th align="left">连接</th> <th align="center" width="160px">排序</th> <th width="80px" align="right" style="padding-left:5px;">操作</th> </tr> <asp:Repeater ID="rptList" runat="server"> <ItemTemplate> <tr> <td align="center"><asp:CheckBox ID="cb_id" CssClass="checkall" runat="server" /></td> <td align="center"><asp:Label ID="lb_id" runat="server" Text='<%#Eval("Id")%>'></asp:Label></td> <td align="left"><a href="aggregationtypeinfo.aspx?edit=1&id=<%#Eval("id") %>"><%#Eval("parentid").ToString() != "0" ? "&nbsp;&nbsp;&nbsp;&nbsp;<img align=\"absmiddle\" src=\"../images/folder_open.gif\"><img align=\"absmiddle\" src=\"../images/t.gif\">" : ""%> <%#Eval("title").ToString() %> </a></td> <td align="center"><%#Eval("url") %></td> <td align="center"><%#Eval("sort")%></td> <td align="right" style="padding-left:5px;"><a href="aggregationtypeinfo.aspx?edit=1&id=<%#Eval("id") %>">修改</a>|<a href="aggregationtypelist.aspx?edit=2&id=<%#Eval("id") %>">删除</a></td> </tr> </ItemTemplate> </asp:Repeater> </table> <div class="spClear"></div> <div style="line-height:30px;height:30px;"> <div id="Pagination" class="right flickr"> <webdiyer:AspNetPager ID="AspNetPager1" runat="server" AlwaysShow="true" UrlPaging="true" FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页" PageSize="2000"> </webdiyer:AspNetPager> </div> <div class="left"> <span class="btn_all" onclick="checkAll(this);">全选</span> <span class="btn_bg"> <asp:LinkButton ID="lbtnDel" runat="server" OnClientClick="return confirm( '确定要删除这些记录吗? ');" OnClick="lbtnDel_Click" >删 除</asp:LinkButton>&nbsp;&nbsp; </span> </div> </div> </form> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/aggregation/aggregationtypelist.aspx
ASP.NET
oos
3,622
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TRECommon; using TREC.ECommerce; using TREC.Entity; namespace TREC.Web.Admin.aggregation { public partial class aggregationinfo : AdminPageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ddltype.DataSource = ECAggregation.GetAggregationTypeListToDDL(); ddltype.DataTextField = "title"; ddltype.DataValueField = "id"; ddltype.DataBind(); ddltype.Items.Insert(0, new ListItem("请选择", "0")); ShowData(); } } protected void ShowData() { if (ECommon.QueryId != "" && ECommon.QueryEdit != "") { EnAggregation model = ECAggregation.GetAggregationInfo(" where id=" + ECommon.QueryId); if (model != null) { this.ddltype.SelectedValue = model.type.ToString(); this.txttitle.Text = model.title; this.txttitle1.Text = model.title1; this.txttitle2.Text = model.title2; this.txttitle3.Text = model.title3; this.hfthumb.Value = model.thumb; this.txtthumbw.Text = model.thumbw.ToString(); this.txtthumbh.Text = model.thumbh.ToString(); this.hfbannel.Value = model.bannel; this.txturl.Text = model.url; this.txturl1.Text = model.url1; this.txturl2.Text = model.url2; this.txtdescript.Text = model.descript; this.txtsort.Text = model.sort.ToString(); this.txthits.Text = model.hits.ToString(); } } } protected void btnSave_Click(object sender, EventArgs e) { EnAggregation model = null; if (ECommon.QueryId != "" && ECommon.QueryEdit != "") { model = ECAggregation.GetAggregationInfo(" where id=" + ECommon.QueryId); model.id = TypeConverter.StrToInt(ECommon.QueryId); } if (model == null) { model = new EnAggregation(); int createmid = adminId; model.createmid = createmid; } int type = TypeConverter.StrToInt(ddltype.SelectedValue); string title = this.txttitle.Text; string title1 = this.txttitle1.Text; string title2 = this.txttitle2.Text; string title3 = this.txttitle3.Text; string thumb = this.hfthumb.Value; int thumbw = int.Parse(this.txtthumbw.Text); int thumbh = int.Parse(this.txtthumbh.Text); string bannel = this.hfbannel.Value; string url = this.txturl.Text; string url1 = this.txturl1.Text; string url2 = this.txturl2.Text; string descript = this.txtdescript.Text; int sort = int.Parse(this.txtsort.Text); int hits = int.Parse(this.txthits.Text); DateTime lastedittime = DateTime.Now; model.type = type; model.title = title; model.title1 = title1; model.title2 = title2; model.title3 = title3; model.thumb = thumb; model.thumbw = thumbw; model.thumbh = thumbh; model.bannel = bannel; model.url = url; model.url1 = url1; model.url2 = url2; model.descript = descript; model.sort = sort; model.hits = hits; model.lastedittime = lastedittime; int aid = ECAggregation.EditAggregation(model); if (aid > 0) { ECUpLoad ecUpload = new ECUpLoad(); if (thumb.Length > 0) { ecUpload.MoveFiles(thumb.Split(','), string.Format(EnFilePath.Aggregation, aid, EnFilePath.Thumb)); } if (bannel.Length > 0) { ecUpload.MoveFiles(bannel.Split(','), string.Format(EnFilePath.Aggregation, aid, EnFilePath.Banner)); } UiCommon.JscriptPrint(this.Page, "编辑成功!", "aggregationlist.aspx", "Success"); } } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/aggregation/aggregationinfo.aspx.cs
C#
oos
4,700
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TREC.ECommerce; using TREC.Entity; using TRECommon; namespace TREC.Web.Admin.aggregation { public partial class aggregationtypelist : AdminPageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ShowData(); } } protected void ShowData() { if (ECommon.QueryEdit == "2" && ECommon.QueryId != "") { ECAggregation.DeleteAggregationType(TypeConverter.StrToInt(ECommon.QueryId)); } rptList.DataSource = ECAggregation.GetAggregationTypeList(ECommon.QueryPageIndex, AspNetPager1.PageSize, "", out tmpPageCount); rptList.DataBind(); AspNetPager1.RecordCount = tmpPageCount; } protected void lbtnDel_Click(object sender, EventArgs e) { string idlist=""; for (int i = 0; i < rptList.Items.Count; i++) { string id = ((Label)rptList.Items[i].FindControl("lb_id")).Text; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("cb_id"); if (cb.Checked) { idlist += id + ","; } } if (idlist.Length > 0) { ECAggregation.DeleteAggregationTypeByIdList(idlist.EndsWith(",") ? idlist.Substring(0, idlist.Length - 1) : idlist); UiCommon.JscriptPrint(this.Page, "批量删除成功!", "aggregationlist.aspx", "Success"); } } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/aggregation/aggregationtypelist.aspx.cs
C#
oos
1,797
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TRECommon; using TREC.ECommerce; using TREC.Entity; namespace TREC.Web.Admin.aggregation { public partial class aggregationtypeinfo : AdminPageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ddlparent.DataSource = ECAggregation.GetAggregationTypeList(" parentid=0"); ddlparent.DataTextField = "title"; ddlparent.DataValueField = "id"; ddlparent.DataBind(); ddlparent.Items.Insert(0, new ListItem("根模块", "0")); ShowData(); } } protected void ShowData() { if (ECommon.QueryId != "" && ECommon.QueryEdit != "") { EnAggregationType model = ECAggregation.GetAggregationTypeInfo(" where id=" + ECommon.QueryId); if (model != null) { this.ddlparent.SelectedValue = model.parentid.ToString(); this.txttitle.Text = model.title; this.txttitle1.Text = model.title1; this.txtthumb.Text = model.thumb; this.txturl.Text = model.url; this.txtsort.Text = model.sort.ToString(); } } } protected void btnSave_Click(object sender, EventArgs e) { EnAggregationType model = null; string strErr = ""; if (strErr != "") { //MessageBox.Show(this, strErr); return; } if (ECommon.QueryId != "" && ECommon.QueryEdit != "") { model = ECAggregation.GetAggregationTypeInfo(" where id=" + ECommon.QueryId); model.id = TypeConverter.StrToInt(ECommon.QueryId); } if (model == null) { model = new EnAggregationType(); } int parentid = int.Parse(this.ddlparent.SelectedValue); string title = this.txttitle.Text; string title1 = this.txttitle1.Text; string thumb = this.txtthumb.Text; string url = this.txturl.Text; int sort = int.Parse(this.txtsort.Text); model.parentid = parentid; model.title = title; model.title1 = title1; model.thumb = thumb; model.url = url; model.sort = sort; int aid = ECAggregation.EditAggregationType(model); if (aid > 0) { UiCommon.JscriptPrint(this.Page, "编辑成功!", "aggregationtypelist.aspx", "Success"); } } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/aggregation/aggregationtypeinfo.aspx.cs
C#
oos
3,006
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="aggregationinfo.aspx.cs" Inherits="TREC.Web.Admin.aggregation.aggregationinfo" %> <%@ Import Namespace="TREC.ECommerce" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery.validate.min.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery.form.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/additional-methods.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/messages_cn.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/My97DatePicker/WdatePicker.js"></script> <script type="text/javascript" src="<%=TREC.ECommerce.ECommon.WebResourceUrl %>/script/jquery.area.js"></script> <script type="text/javascript" src="<%=TREC.ECommerce.ECommon.WebResourceUrl %>/editor/kindeditor/kindeditor-min.js"></script> <script type="text/javascript" src="<%=TREC.ECommerce.ECommon.WebResourceUrl %>/script/fileupload.js"></script> <script type="text/javascript"> $(function () { //表单验证JS $("#form1").validate({ //出错时添加的标签 errorElement: "span", showErrors: function (errorMap, errorList) { if (errorList.length > 0) { if ($("#" + errorList[0].element.id).next() != null) { $("#" + errorList[0].element.id).next().remove(); } } this.defaultShowErrors(); }, success: function (label) { //正确时的样式 label.text(" ").addClass("success"); } }); }); </script> </head> <body style="padding:10px;"> <form id="form1" runat="server"> <div class="navigation"> <span class="back"><a href="aggregationlist.aspx">返回列表</a></span><b>您当前的位置:首页 &gt; 信息管理 &gt; 聚合信息</b> </div> <div class="spClear"></div> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable"> <tr> <th colspan="2" align="left">聚合信息</th> </tr> <tr> <td width="160" align="right"> 所属模块: </td> <td align="left"> <asp:DropDownList ID="ddltype" runat="server" CssClass="select"></asp:DropDownList> </td> </tr> <tr> <td width="160" align="right"> 信息标题 : </td> <td align="left"> <asp:TextBox ID="txttitle" runat="server" CssClass="input"></asp:TextBox> </td> </tr> <tr> <td align="right"> 信息副标题1 : </td> <td align="left"> <asp:TextBox ID="txttitle1" runat="server" CssClass="input"></asp:TextBox> </td> </tr> <tr> <td align="right"> 信息副标题2 : </td> <td align="left"> <asp:TextBox ID="txttitle2" runat="server" CssClass="input"></asp:TextBox> </td> </tr> <tr> <td align="right"> 信息副标题3 : </td> <td align="left"> <asp:TextBox ID="txttitle3" runat="server" CssClass="input"></asp:TextBox> </td> </tr> <tr> <td align="right"> 图片 : </td> <td align="left"> <div class="fileUpload" path="<%=string.Format(TREC.Entity.EnFilePath.Aggregation, ECommon.QueryId, TREC.Entity.EnFilePath.Thumb)%>"> <asp:HiddenField ID="hfthumb" runat="server" /> <div class="fileTools"> <input type="text" class="input w160 filedisplay" /> <a href="javascript:;" class="files"><input id="File3" type="file" class="upload" onchange="_upfile(this)" runat="server" /></a> <span class="uploading">正在上传,请稍后……</span> </div> </div> </td> </tr> <tr> <td align="right"> 图片宽 : </td> <td align="left"> <asp:TextBox ID="txtthumbw" runat="server" CssClass="input" Width="60">0</asp:TextBox> </td> </tr> <tr> <td align="right"> 图片高 : </td> <td align="left"> <asp:TextBox ID="txtthumbh" runat="server" CssClass="input" Width="60">0</asp:TextBox> </td> </tr> <tr> <td align="right"> 幻灯图 : </td> <td align="left"> <div class="fileUpload m" path="<%=string.Format(TREC.Entity.EnFilePath.Aggregation, ECommon.QueryId, TREC.Entity.EnFilePath.Banner)%>"> <asp:HiddenField ID="hfbannel" runat="server" /> <div class="fileTools"> <input type="text" class="input w160 filedisplay" /> <a href="javascript:;" class="files"><input id="File4" type="file" class="upload" onchange="_upfile(this)" runat="server" /></a> <span class="uploading">正在上传,请稍后……</span> </div> </div> </td> </tr> <tr> <td align="right"> 连接地址 : </td> <td align="left"> <asp:TextBox ID="txturl" runat="server" CssClass="input"></asp:TextBox> </td> </tr> <tr> <td align="right"> 连接地址1 : </td> <td align="left"> <asp:TextBox ID="txturl1" runat="server" CssClass="input"></asp:TextBox> </td> </tr><tr> <td align="right"> 连接地址2 : </td> <td align="left"> <asp:TextBox ID="txturl2" runat="server" CssClass="input"></asp:TextBox> </td> </tr> <tr> <td align="right"> 描述 : </td> <td align="left"> <asp:TextBox ID="txtdescript" runat="server" CssClass="input"></asp:TextBox> </td> </tr> <tr> <td align="right"> 排序 : </td> <td align="left"> <asp:TextBox ID="txtsort" runat="server" CssClass="input" Width="60">0</asp:TextBox> </td> </tr> <tr> <td align="right"> 点击量 : </td> <td align="left"> <asp:TextBox ID="txthits" runat="server" CssClass="input" Width="60">0</asp:TextBox> </td> </tr> </table> <div style="margin-top:10px; margin-left:180px"> <asp:Button ID="btnSave" runat="server" Text="确认保存" CssClass="submit" onclick="btnSave_Click" /><input name="重置" type="reset" class="submit" value="重置" /> </div> </form> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/aggregation/aggregationinfo.aspx
ASP.NET
oos
8,075
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="aggregationtypeinfo.aspx.cs" Inherits="TREC.Web.Admin.aggregation.aggregationtypeinfo" %> <%@ Import Namespace="TREC.ECommerce" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery.validate.min.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery.form.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/additional-methods.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/messages_cn.js"></script> <script type="text/javascript"> $(function () { //表单验证JS $("#form1").validate({ //出错时添加的标签 errorElement: "span", showErrors: function (errorMap, errorList) { if (errorList.length > 0) { if ($("#" + errorList[0].element.id).next() != null) { $("#" + errorList[0].element.id).next().remove(); } } this.defaultShowErrors(); }, success: function (label) { //正确时的样式 label.text(" ").addClass("success"); } }); }); </script> </head> <body style="padding:10px;"> <form id="form1" runat="server"> <div class="navigation"> <span class="back"><a href="aggregationlist.aspx">返回列表</a></span><b>您当前的位置:首页 &gt; 信息管理 &gt; 聚合信息</b> </div> <div class="spClear"></div> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable"> <tr> <th colspan="2" align="left">聚合信息模块</th> </tr> <tr> <td width="160px" align="right"> 上级模块 : </td> <td align="left"> <asp:DropDownList ID="ddlparent" runat="server" CssClass="select"></asp:DropDownList> </td> </tr> <tr> <td align="right"> 名称 : </td> <td align="left"> <asp:TextBox ID="txttitle" runat="server" CssClass="input"></asp:TextBox> </td> </tr> <tr> <td align="right"> 副名称 : </td> <td align="left"> <asp:TextBox ID="txttitle1" runat="server" CssClass="input"></asp:TextBox> </td> </tr> <tr> <td align="right"> 缩略图 : </td> <td align="left"> <asp:TextBox ID="txtthumb" runat="server" CssClass="input"></asp:TextBox> </td> </tr> <tr> <td align="right"> 连接地址 : </td> <td align="left"> <asp:TextBox ID="txturl" runat="server" CssClass="input"></asp:TextBox> </td> </tr> <tr> <td align="right"> 排序 : </td> <td align="left"> <asp:TextBox ID="txtsort" runat="server" CssClass="input" Width="40">0</asp:TextBox> </td> </tr> </table> <div style="margin-top:10px; margin-left:180px"> <asp:Button ID="btnSave" runat="server" Text="确认保存" CssClass="submit" onclick="btnSave_Click" /><input name="重置" type="reset" class="submit" value="重置" /> </div> </form> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/aggregation/aggregationtypeinfo.aspx
ASP.NET
oos
4,161
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="aggregationlist.aspx.cs" Inherits="TREC.Web.Admin.aggregation.aggregationlist" %> <%@ Import Namespace="TREC.ECommerce" %> <%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="../script/admin.js"></script> <script type="text/javascript"> $(function () { $(".msgtable tr:nth-child(odd)").addClass("tr_bg"); //隔行变色 $(".msgtable tr").hover( function () { $(this).addClass("tr_hover_col"); }, function () { $(this).removeClass("tr_hover_col"); } ); }) </script> </head> <body style="padding:10px;"> <form id="form1" runat="server"> <div class="navigation"> <span class="add"><a href="aggregationinfo.aspx">添加信息</a></span><b>您当前的位置:首页 &gt; 信息管理 &gt; 聚合信息</b> </div> <div class="spClear"></div> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable"> <tr> <th width="40px" align="center">选择</th> <th width="40px" align="center">编号</th> <th align="left">信息标题</th> <th align="center" width="160px">最后修改时间</th> <th width="80px" align="right" style="padding-left:5px;">操作</th> </tr> <asp:Repeater ID="rptList" runat="server"> <ItemTemplate> <tr> <td align="center"><asp:CheckBox ID="cb_id" CssClass="checkall" runat="server" /></td> <td align="center"><asp:Label ID="lb_id" runat="server" Text='<%#Eval("Id")%>'></asp:Label></td> <td align="left"><a href="aggregationinfo.aspx?edit=1&id=<%#Eval("id") %>"><%#Eval("title") %></a></td> <td align="center"><%#Eval("lastedittime")%></td> <td align="right" style="padding-left:5px;"><a href="aggregationinfo.aspx?edit=1&id=<%#Eval("id") %>">修改</a>|<a href="aggregationlist.aspx?edit=2&id=<%#Eval("id") %>">删除</a></td> </tr> </ItemTemplate> </asp:Repeater> </table> <div class="spClear"></div> <div style="line-height:30px;height:30px;"> <div id="Pagination" class="right flickr"> <webdiyer:AspNetPager ID="AspNetPager1" runat="server" AlwaysShow="true" UrlPaging="true" FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页"> </webdiyer:AspNetPager> </div> <div class="left"> <span class="btn_all" onclick="checkAll(this);">全选</span> <span class="btn_bg"> <asp:LinkButton ID="lbtnDel" runat="server" OnClientClick="return confirm( '确定要删除这些记录吗? ');" OnClick="lbtnDel_Click" >删 除</asp:LinkButton>&nbsp;&nbsp; </span> </div> </div> </form> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/aggregation/aggregationlist.aspx
ASP.NET
oos
3,293
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TREC.ECommerce; using TREC.Entity; using TRECommon; namespace TREC.Web.Admin.aggregation { public partial class aggregationlist : AdminPageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ShowData(); } } protected void ShowData() { if (ECommon.QueryEdit == "2" && ECommon.QueryId != "") { ECAggregation.DeleteAggregation(TypeConverter.StrToInt(ECommon.QueryId)); } rptList.DataSource = ECAggregation.GetAggregationList(ECommon.QueryPageIndex, AspNetPager1.PageSize, "", out tmpPageCount); rptList.DataBind(); AspNetPager1.RecordCount = tmpPageCount; } protected void lbtnDel_Click(object sender, EventArgs e) { string idlist=""; for (int i = 0; i < rptList.Items.Count; i++) { string id = ((Label)rptList.Items[i].FindControl("lb_id")).Text; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("cb_id"); if (cb.Checked) { idlist += id + ","; } } if (idlist.Length > 0) { ECAggregation.DeleteAggregationByIdList(idlist.EndsWith(",") ? idlist.Substring(0, idlist.Length - 1) : idlist); UiCommon.JscriptPrint(this.Page, "批量删除成功!", "aggregationlist.aspx", "Success"); } } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/aggregation/aggregationlist.aspx.cs
C#
oos
1,763
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TREC.ECommerce; using TREC.Entity; using TRECommon; namespace TREC.Web.Admin.administrator { public partial class administratorlist : AdminPageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ShowData(); } } protected void ShowData() { if (ECommon.QueryEdit == "2" && ECommon.QueryId != "") { ECAdmin.DeletEnAdmin(TypeConverter.StrToInt(ECommon.QueryId)); } rptList.DataSource = ECAdmin.GetAdminList(ECommon.QueryPageIndex, AspNetPager1.PageSize, "", out tmpPageCount); rptList.DataBind(); AspNetPager1.RecordCount = tmpPageCount; } protected void lbtnDel_Click(object sender, EventArgs e) { string idlist=""; for (int i = 0; i < rptList.Items.Count; i++) { string id = ((Label)rptList.Items[i].FindControl("lb_id")).Text; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("cb_id"); if (cb.Checked) { idlist += id + ","; } } if (idlist.Length > 0) { ECAdmin.DeletEnAdminByIdList(idlist.EndsWith(",") ? idlist.Substring(0, idlist.Length - 1) : idlist); UiCommon.JscriptPrint(this.Page, "批量删除成功!", "administratorlist.aspx", "Success"); } } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/administrator/administratorlist.aspx.cs
C#
oos
1,735
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TRECommon; using TREC.ECommerce; using TREC.Entity; namespace TREC.Web.Admin.administrator { public partial class administratorinfo : AdminPageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ShowData(); } } protected void ShowData() { if (ECommon.QueryId != "" && ECommon.QueryEdit != "") { EnAdmin model = ECAdmin.GetAdminInfo(" where id=" + ECommon.QueryId); if (model != null) { this.txtname.Text = model.name; this.txtpassword.Text = model.password; this.txtdisplayname.Text = model.displayname; this.txtquestion.Text = model.question; this.txtanswer.Text = model.answer; this.txtemail.Text = model.email; this.txtphone.Text = model.phone; this.txtareacode.Text = model.areacode; this.txtaddress.Text = model.address; raIsLock.SelectedValue = model.islock.ToString(); lbOther.Text = "创建时间:" + model.createdate + " " + "登陆次数:" + model.logincount + " " + "最后活动模块:" + model.lastmodule + " " + "最后活动时间:" + model.lastactivitydate; } } } protected void btnSave_Click(object sender, EventArgs e) { EnAdmin model = new EnAdmin(); string strErr = ""; if (this.txtname.Text.Trim().Length == 0) { strErr += "登陆账号不能为空!\\n"; } if (this.txtpassword.Text.Trim().Length == 0) { strErr += "密码不能为空!\\n"; } if (this.txtdisplayname.Text.Trim().Length == 0) { strErr += "姓名不能为空!\\n"; } if (strErr != "") { //MessageBox.Show(this, strErr); return; } if (ECommon.QueryId != "" && ECommon.QueryEdit != "") { model = ECAdmin.GetAdminInfo(" where id=" + ECommon.QueryId); model.id = TypeConverter.StrToInt(ECommon.QueryId); } else { model = new EnAdmin(); model.lastmodule = ""; model.createdate = DateTime.Now; model.lastactivitydate = DateTime.Now; model.logincount = 0; } string name = this.txtname.Text; string password = this.txtpassword.Text; string displayname = this.txtdisplayname.Text; string question = this.txtquestion.Text; string answer = this.txtanswer.Text; string email = this.txtemail.Text; string phone = this.txtphone.Text; string areacode = this.txtareacode.Text; string address = this.txtaddress.Text; int islock = TypeConverter.StrToInt(raIsLock.SelectedValue); model.name = name; model.password = password; model.displayname = displayname; model.question = question; model.answer = answer; model.email = email; model.phone = phone; model.areacode = areacode; model.address = address; model.islock = islock; int aid = ECAdmin.EditAdmin(model); if (aid > 0) { UiCommon.JscriptPrint(this.Page, "编辑成功!", "administratorlist.aspx", "Success"); } } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/administrator/administratorinfo.aspx.cs
C#
oos
4,113
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="administratorinfo.aspx.cs" Inherits="TREC.Web.Admin.administrator.administratorinfo" %> <%@ Import Namespace="TREC.ECommerce" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery.validate.min.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery.form.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/additional-methods.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/messages_cn.js"></script> <script type="text/javascript"> $(function () { //表单验证JS $("#form1").validate({ //出错时添加的标签 errorElement: "span", showErrors: function (errorMap, errorList) { if (errorList.length > 0) { if ($("#" + errorList[0].element.id).next() != null) { $("#" + errorList[0].element.id).next().remove(); } } this.defaultShowErrors(); }, success: function (label) { //正确时的样式 label.text(" ").addClass("success"); } }); }); </script> </head> <body style="padding:10px;"> <form id="form1" runat="server"> <div class="navigation"> <span class="back"><a href="administratorlist.aspx">返回列表</a></span><b>您当前的位置:首页 &gt; 系统管理 &gt; 管理员管理</b> </div> <div class="spClear"></div> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable"> <tr> <th colspan="2" align="left">管理员信息</th> </tr> <tr> <td width="160px" align="right"> 登陆账号 :</td> <td align="left"> <asp:TextBox id="txtname" runat="server" CssClass="input"></asp:TextBox> </td></tr> <tr> <td width="160px" align="right"> 登陆密码 :</td> <td align="left"> <asp:TextBox id="txtpassword" runat="server" CssClass="input" TextMode="Password"></asp:TextBox> </td></tr> <tr> <td width="160px" align="right"> 姓名 :</td> <td align="left"> <asp:TextBox id="txtdisplayname" runat="server" CssClass="input"></asp:TextBox> </td></tr> <tr> <td width="160px" align="right"> 安全问题 :</td> <td align="left"> <asp:TextBox id="txtquestion" runat="server" CssClass="input"></asp:TextBox> </td></tr> <tr> <td width="160px" align="right"> 问题回答 :</td> <td align="left"> <asp:TextBox id="txtanswer" runat="server" CssClass="input"></asp:TextBox> </td></tr> <tr> <td width="160px" align="right"> 邮件 :</td> <td align="left"> <asp:TextBox id="txtemail" runat="server" CssClass="input"></asp:TextBox> </td></tr> <tr> <td width="160px" align="right"> 电话 :</td> <td align="left"> <asp:TextBox id="txtphone" runat="server" CssClass="input"></asp:TextBox> </td></tr> <tr> <td width="160px" align="right"> 地区 :</td> <td align="left"> <asp:TextBox id="txtareacode" runat="server" CssClass="input"></asp:TextBox> </td></tr> <tr> <td width="160px" align="right"> 地址 :</td> <td align="left"> <asp:TextBox id="txtaddress" runat="server" CssClass="input"></asp:TextBox> </td></tr> <tr> <td width="160px" align="right"> 是否锁定 :</td> <td align="left"> <asp:RadioButtonList runat="server" ID="raIsLock" RepeatDirection="Horizontal" RepeatLayout="Flow"> <asp:ListItem Text="否" Value="0" Selected=True></asp:ListItem> <asp:ListItem Text="是" Value="1"></asp:ListItem> </asp:RadioButtonList> </td></tr> <%if (ECommon.QueryEdit != "") { %> <tr> <td width="160px" align="right"> 其它信息 :</td> <td align="left"> <asp:Label ID="lbOther" runat="server"></asp:Label> </td></tr> <%} %> </table> <div style="margin-top:10px; margin-left:180px"> <asp:Button ID="btnSave" runat="server" Text="确认保存" CssClass="submit" onclick="btnSave_Click" /><input name="重置" type="reset" class="submit" value="重置" /> </div> </form> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/administrator/administratorinfo.aspx
ASP.NET
oos
5,159
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="administratorlist.aspx.cs" Inherits="TREC.Web.Admin.administrator.administratorlist" %> <%@ Import Namespace="TREC.ECommerce" %> <%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="../script/admin.js"></script> <script type="text/javascript"> $(function () { $(".msgtable tr:nth-child(odd)").addClass("tr_bg"); //隔行变色 $(".msgtable tr").hover( function () { $(this).addClass("tr_hover_col"); }, function () { $(this).removeClass("tr_hover_col"); } ); }) </script> </head> <body style="padding:10px;"> <form id="form1" runat="server"> <div class="navigation"> <span class="add"><a href="administratorinfo.aspx">添加系列</a></span><b>您当前的位置:首页 &gt; 系统管理 &gt; 管理员管理</b> </div> <div class="spClear"></div> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable"> <tr> <th width="40px" align="center">选择</th> <th width="40px" align="center">编号</th> <th align="left">登陆名</th> <th align="center" width="160px">Email</th> <th align="center" width="160px">最后活动时间</th> <th width="80px" align="right" style="padding-left:5px;">操作</th> </tr> <asp:Repeater ID="rptList" runat="server"> <ItemTemplate> <tr> <td align="center"><asp:CheckBox ID="cb_id" CssClass="checkall" runat="server" /></td> <td align="center"><asp:Label ID="lb_id" runat="server" Text='<%#Eval("Id")%>'></asp:Label></td> <td align="left"><a href="administratorinfo.aspx?edit=1&id=<%#Eval("id") %>"><%#Eval("name") %></a></td> <td align="center"><%#Eval("email") %></td> <td align="center"><%#Eval("lastactivitydate")%></td> <td align="right" style="padding-left:5px;"><a href="administratorinfo.aspx?edit=1&id=<%#Eval("id") %>">修改</a>|<a href="administratorlist.aspx?edit=2&id=<%#Eval("id") %>">删除</a></td> </tr> </ItemTemplate> </asp:Repeater> </table> <div class="spClear"></div> <div style="line-height:30px;height:30px;"> <div id="Pagination" class="right flickr"> <webdiyer:AspNetPager ID="AspNetPager1" runat="server" AlwaysShow="true" UrlPaging="true" FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页"> </webdiyer:AspNetPager> </div> <div class="left"> <span class="btn_all" onclick="checkAll(this);">全选</span> <span class="btn_bg"> <asp:LinkButton ID="lbtnDel" runat="server" OnClientClick="return confirm( '确定要删除这些记录吗? ');" OnClick="lbtnDel_Click" >删 除</asp:LinkButton>&nbsp;&nbsp; </span> </div> </div> </form> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/administrator/administratorlist.aspx
ASP.NET
oos
3,416
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace TREC.Web.Admin { public partial class loginout : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/loginout.aspx.cs
C#
oos
336
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TRECommon; using TREC.ECommerce; using TREC.Entity; namespace TREC.Web.Admin.shop { public partial class shopgroupinfo : AdminPageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ShowData(); } } protected void ShowData() { if (ECommon.QueryId != "" && ECommon.QueryEdit != "") { EnShopGroup model = ECShop.GetShopGroupInfo(" where id=" + ECommon.QueryId); if (model != null) { this.txttitle.Text = model.title; this.txtcolor.Text = model.color; this.txtavatar.Text = model.avatar; this.txtintegral.Text = model.integral.ToString(); this.txtmoney.Text = model.money.ToString(); this.txtadcount.Text = model.adcount.ToString(); this.txtmarketcount.Text = model.marketpcount.ToString(); this.txtbrandcount.Text = model.brandcount.ToString(); this.txtpromotioncount.Text = model.promotioncount.ToString(); this.txtadrecommend.Text = model.adrecommend.ToString(); this.txtmarketrecommend.Text = model.marketrecommend.ToString(); this.txtbrandrecommend.Text = model.brandrecommend.ToString(); this.txtpromotionrecommend.Text = model.promotionrecommend.ToString(); this.txtpermissions.Text = model.permissions; this.txtlev.Text = model.lev.ToString(); this.txtdescript.Text = model.descript; this.txtsort.Text = model.sort.ToString(); } } } protected void btnSave_Click(object sender, EventArgs e) { EnShopGroup model = null; string strErr = ""; if (strErr != "") { //MessageBox.Show(this, strErr); return; } string title = this.txttitle.Text; string color = this.txtcolor.Text; string avatar = this.txtavatar.Text; decimal integral = TypeConverter.StrToDeimal(this.txtintegral.Text); decimal money = TypeConverter.StrToDeimal(this.txtmoney.Text); int adcount = TypeConverter.StrToInt(this.txtadcount.Text); int marketcount = TypeConverter.StrToInt(this.txtmarketcount.Text); int brandcount = TypeConverter.StrToInt(this.txtbrandcount.Text); int promotioncount = TypeConverter.StrToInt(this.txtpromotioncount.Text); int adrecommend = TypeConverter.StrToInt(this.txtadrecommend.Text); int marketrecommend = TypeConverter.StrToInt(this.txtmarketrecommend.Text); int brandrecommend = TypeConverter.StrToInt(this.txtbrandrecommend.Text); int promotionrecommend = TypeConverter.StrToInt(this.txtpromotionrecommend.Text); string permissions = this.txtpermissions.Text; int lev = TypeConverter.StrToInt(this.txtlev.Text); string descript = this.txtdescript.Text; int sort = TypeConverter.StrToInt(this.txtsort.Text); if (ECommon.QueryId != "" && ECommon.QueryEdit != "") { model = ECShop.GetShopGroupInfo(" where id=" + ECommon.QueryId); model.id = TypeConverter.StrToInt(ECommon.QueryId); } if (model == null) { model = new EnShopGroup(); } model.title = title; model.color = color; model.avatar = avatar; model.integral = integral; model.money = money; model.adcount = adcount; model.marketpcount = marketcount; model.brandcount = brandcount; model.promotioncount = promotioncount; model.adrecommend = adrecommend; model.marketrecommend = marketrecommend; model.brandrecommend = brandrecommend; model.promotionrecommend = promotionrecommend; model.permissions = permissions; model.lev = lev; model.descript = descript; model.sort = sort; int aid = ECShop.EditShopGroup(model); if (aid > 0) { UiCommon.JscriptPrint(this.Page, "编辑成功!", "ShopGrouplist.aspx", "Success"); } } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/shop/shopgroupinfo.aspx.cs
C#
oos
4,916
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="shopbrandlist.aspx.cs" Inherits="TREC.Web.Admin.shop.shopbrandlist" %> <%@ Import Namespace="TREC.ECommerce" %> <%@ Import Namespace="TREC.Entity" %> <%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <link rel="stylesheet" type="text/css" href=<%="\""+TREC.ECommerce.ECommon.WebResourceUrl%>/altdialog/skins/default.css" /> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/altdialog/artDialog.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/altdialog/plugins/iframeTools.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery.getcss.js"></script> <script type="text/javascript" src="../script/admin.js"></script> <script type="text/javascript"> $(function () { $(".msgtable tr:nth-child(odd)").addClass("tr_bg"); //隔行变色 $(".msgtable tr").hover( function () { $(this).addClass("tr_hover_col"); }, function () { $(this).removeClass("tr_hover_col"); } ); }); function getDialog(j) { art.dialog.open('<%=ECommon.WebUrl %>/common/getbrand.aspx?type=upshopbrandid&value='+j, { id: 'memdiv' + j, width: 800, height: 400, title: '选择-<%#Eval("title") %>-品牌', ok: function () { var iframe = this.iframe.contentWindow; if (!iframe.document.body) { alert('正在加载……') return false; }; $.ajax({ url: '<%=TREC.ECommerce.ECommon.WebUrl %>/ajax/ajaxuser.ashx', data: 'type=upshopbrand&v=' + j + '&v2=' + iframe.document.getElementById('hfvalue').value, dataType: "json", success: function (data) { if (data != null) { $.each(data, function (i) { var f = '<%=string.Format(EnFilePath.Brand,"_",EnFilePath.Logo) %>'; var mHtml = "<li id=\"" + data[i].id + "\"><a href=\"#\">"; mHtml += "<img src=\"" + f.replace("_", data[i].id) + "/" + data[i].logo + "\" width='105' height='38' alt='" + data[i].name + "' />" mHtml += data[i].name; mHtml += "</a></li>" $("#d_" + j).append(data[i].name); }); } } }) return true; }, init: function () { $('.aui_buttons').append('<img src=<%=ECommon.WebResourceUrl %>/images/ico/ico-03.gif class=tipimg>'); } }); } </script> </head> <body style="padding:10px;"> <form id="form1" runat="server"> <div class="navigation"> <b>您当前的位置:首页 &gt; 店铺管理 &gt; 店铺品牌</b> </div> <div class="spClear"></div> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable"> <tr> <th width="40px" align="center">选择</th> <th width="40px" align="center">编号</th> <th width="200px"align="center">店铺名称</th> <th align="left">品牌</th> </tr> <asp:Repeater ID="rptList" runat="server"> <ItemTemplate> <tr> <td align="center"><asp:CheckBox ID="cb_id" CssClass="checkall" runat="server" /></td> <td align="center"><asp:Label ID="lb_id" runat="server" Text='<%#Eval("Id")%>'></asp:Label></td> <td align="center"><a href="shopinfo.aspx?edit=1&id=<%#Eval("id") %>"><%#Eval("title") %></a></td> <td align="left"> <a href="#" onclick="javascript:getDialog(<%#Eval("id") %>);">【设置】</a> <div id="d_<%#Eval("id") %>"></div> </td> </tr> </ItemTemplate> </asp:Repeater> </table> <div class="spClear"></div> <div style="line-height:30px;height:30px;"> <div id="Pagination" class="right flickr"> <webdiyer:AspNetPager ID="AspNetPager1" runat="server" AlwaysShow="true" UrlPaging="true" FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页"> </webdiyer:AspNetPager> </div> </div> <style> .tipimg{width:255px; height:32px; position:absolute; right:66px; bottom:14px;} </style> </form> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/shop/shopbrandlist.aspx
ASP.NET
oos
5,397
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TRECommon; using TREC.ECommerce; using TREC.Entity; namespace TREC.Web.Admin.shop { public partial class shopinfo : AdminPageBase { public string areaCode = ""; public EnMember _memberInfo = null; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ddlmember.Items.Clear(); ddlmember.DataSource = ECMember.GetTop20MemberList(); ddlmember.DataTextField = "username"; ddlmember.DataValueField = "id"; ddlmember.DataBind(); ddlmember.Items.Insert(0, new ListItem("请选择", "")); ddlmember.Items.Insert(1, new ListItem("无联联账号", "0")); ddlmarket.Items.Clear(); ddlmarket.DataSource = ECMarket.GetTop20MarketList(); ddlmarket.DataTextField = "title"; ddlmarket.DataValueField = "id"; ddlmarket.DataBind(); ddlmarket.Items.Insert(0, new ListItem("请选择", "")); ddlmarket.Items.Insert(1, new ListItem("未加入卖场", "0")); ddlshopgroup.Items.Clear(); ddlshopgroup.DataSource = ECShop.GetShopGroupList(""); ddlshopgroup.DataTextField = "title"; ddlshopgroup.DataValueField = "id"; ddlshopgroup.DataBind(); ddlshopgroup.Items.Insert(0, new ListItem("请选择", "")); ddlstaffsize.Items.Clear(); ddlstaffsize.DataSource = ECConfig.GetConfigList(" module=" + (int)EnumConfigModule.企业配置 + " and type=" + (int)EnumConfigByEnterprise.人员规模); ddlstaffsize.DataTextField = "title"; ddlstaffsize.DataValueField = "value"; ddlstaffsize.DataBind(); ddlstaffsize.Items.Insert(0, new ListItem("请选择", "")); ddlPro.Items.Clear(); ddlPro.DataSource = ECArea.GetAreaList(" parentcode=0"); ddlPro.DataTextField = "areaname"; ddlPro.DataValueField = "areacode"; ddlPro.DataBind(); ddlPro.Items.Insert(0, new ListItem("请选择", "")); ddlregcity.Items.Clear(); ddlregcity.Items.Insert(0, new ListItem("请选择省份", "")); ddlauditstatus.Items.Clear(); WebControlBind.DrpBind(typeof(EnumAuditStatus), ddlauditstatus); ddlauditstatus.Items.Insert(0, new ListItem("请选择", "")); ddllinestatus.Items.Clear(); WebControlBind.DrpBind(typeof(EnumAuditStatus), ddllinestatus); ddllinestatus.Items.Insert(0, new ListItem("请选择", "")); chkattribute.Items.Clear(); WebControlBind.CheckBoxListBind(typeof(EnumAttribute), chkattribute); ddlctype.Items.Clear(); ddlctype.Items.Add(new ListItem(Enum.GetName(typeof(EnumMemberType), (int)EnumMemberType.工厂企业), ((int)EnumMemberType.工厂企业).ToString())); ddlctype.Items.Add(new ListItem(Enum.GetName(typeof(EnumMemberType), (int)EnumMemberType.经销商), ((int)EnumMemberType.经销商).ToString())); ddlctype.Items.Insert(0, new ListItem("请选择", "")); ddlc.Items.Clear(); ddlc.Items.Add(new ListItem("未加入企业", "0")); ddlc.Items.Insert(0, new ListItem("请选择", "")); WebControlBind.DrpBind(typeof(EnumTemplate), ddltemplate); ShowData(); } } protected void ShowData() { if (ECommon.QueryId != "" && ECommon.QueryEdit != "") { EnShop model = ECShop.GetShopInfo(" where id=" + ECommon.QueryId); if (model != null) { if (model != null && model.mid != 0) { _memberInfo = ECMember.GetMemberInfo(" where id=" + model.mid); if (_memberInfo != null && _memberInfo.id != 0) { this.ddlmember.Items.Clear(); this.ddlmember.Items.Insert(0, new ListItem(_memberInfo.username, model.mid.ToString())); this.ddlmember.Enabled = false; } } txttitle.Text = model.title; this.txtletter.Text = model.letter; this.ddlshopgroup.SelectedValue = model.groupid.ToString(); WebControlBind.CheckBoxListSetSelected(chkattribute, model.attribute); this.txtvip.Text = model.vip.ToString(); areaCode = model.areacode; this.txtaddress.Text = model.address; this.ddlstaffsize.SelectedValue = model.staffsize.ToString(); this.txtregyear.Text = model.regyear; if (!string.IsNullOrEmpty(model.regcity)) { this.ddlregcity.SelectedValue = model.regcity; this.ddlPro.SelectedValue = model.regcity.Substring(0, 2) + "0000"; if (model.regcity != model.regcity.Substring(0, 2) + "0000") { ddlregcity.Items.Clear(); ddlregcity.DataSource = ECArea.GetAreaList(" parentcode=" + ddlPro.SelectedValue); ddlregcity.DataTextField = "areaname"; ddlregcity.DataValueField = "areacode"; ddlregcity.DataBind(); ddlregcity.Items.Insert(0, new ListItem("请选择省份", "")); ddlregcity.SelectedValue = model.regcity; } } this.txtbuy.Text = model.buy; this.txtlinkman.Text = model.linkman; this.txtphone.Text = model.phone; this.txtmphone.Text = model.mphone; this.txtfax.Text = model.fax; this.txtemail.Text = model.email; this.txtpostcode.Text = model.postcode; this.txthomepage.Text = model.homepage; this.txtdomain.Text = model.domain; this.txtdomainip.Text = model.domainip; this.txticp.Text = model.icp; this.hfsurface.Value = model.surface; this.hflogo.Value = model.logo; this.hfthumb.Value = model.thumb; this.hfbannel.Value = model.bannel; this.hfdesimage.Value = model.desimage; this.txtdescript.Text = model.descript; this.txtkeywords.Text = model.keywords; this.ddltemplate.SelectedValue = model.template; this.txthits.Text = model.hits.ToString(); this.txtsort.Text = model.sort.ToString(); this.txtlastedittime.Text = model.lastedittime.ToString(); this.ddlauditstatus.SelectedValue = model.auditstatus.ToString(); this.ddllinestatus.SelectedValue = model.linestatus.ToString(); this.ddlctype.SelectedValue = model.ctype.ToString(); if (model.cid != 0) { ddlc.Items.Clear(); ddlc.Items.Add(new ListItem("未加入企业", "0")); ddlc.Items.Add(new ListItem("己加入企业", model.cid.ToString())); ddlc.Items.Insert(0, new ListItem("请选择", "")); } if (model != null && model.marketid != 0) { bool isHas = false; foreach (ListItem item in ddlmarket.Items) { if (item.Value == model.marketid.ToString()) { item.Selected = true; isHas = true; break; } } if (!isHas) { EnMarket m = ECMarket.GetMarketInfoVSNameAndIdInfo(" where id=" + model.marketid.ToString()); if (m != null) { ddlmarket.Items.Add(new ListItem(m.title, model.marketid.ToString())); ddlmarket.SelectedValue = model.marketid.ToString(); } } } } } } protected void btnSave_Click(object sender, EventArgs e) { EnShop model = null; string strErr = ""; if (strErr != "") { //MessageBox.Show(this, strErr); return; } if (ECommon.QueryId != "" && ECommon.QueryEdit != "") { model = ECShop.GetShopInfo(" where id=" + ECommon.QueryId); model.id = TypeConverter.StrToInt(ECommon.QueryId); } if (model == null) { model = new EnShop(); model.mapapi = ""; model.marketid = 0; model.createmid = 0; } int mid = TypeConverter.StrToInt(ddlmember.SelectedValue); string title = txttitle.Text; string letter = this.txtletter.Text; int groupid = TypeConverter.StrToInt(ddlshopgroup.SelectedValue); string attribute = WebControlBind.CheckBoxListSelected(chkattribute); string industry = ""; string productcategory = ""; int vip = TypeConverter.StrToInt(this.txtvip.Text); string areacode = Request.Form["ddlareacode_value"] == null ? Request.Params["ddlareacode_value"] == null ? "" : Request.Params["ddlareacode_value"].ToString() : Request.Form["ddlareacode_value"]; string address = this.txtaddress.Text; int staffsize = TypeConverter.StrToInt(ddlstaffsize.SelectedValue); string regyear = this.txtregyear.Text; string regcity = Request.Form["ddlregcity"] == null ? Request.Form["ddlregcity"] == null ? "" : Request.Form["ddlregcity"].ToString() : Request.Form["ddlregcity"].ToString(); string buy = this.txtbuy.Text; string sell = ""; string linkman = this.txtlinkman.Text; string phone = this.txtphone.Text; string mphone = this.txtmphone.Text; string fax = this.txtfax.Text; string email = this.txtemail.Text; string postcode = this.txtpostcode.Text; string homepage = this.txthomepage.Text; string domain = this.txtdomain.Text; string domainip = this.txtdomainip.Text; string icp = this.txticp.Text; string surface = this.hfsurface.Value; string logo = this.hflogo.Value; string thumb = this.hfthumb.Value; string bannel = this.hfbannel.Value; string desimage = this.hfdesimage.Value; string descript = this.txtdescript.Text; string keywords = this.txtkeywords.Text; string template = ddltemplate.SelectedValue; int hits = TypeConverter.StrToInt(this.txthits.Text); int sort = TypeConverter.StrToInt(this.txtsort.Text); string cid = ddlc.SelectedValue; string ctype = ddlctype.SelectedValue; DateTime lastedittime = DateTime.Now; int auditstatus = TypeConverter.StrToInt(ddlauditstatus.SelectedValue); int linestatus = TypeConverter.StrToInt(ddllinestatus.SelectedValue); model.mid = mid; model.title = title; model.letter = letter; model.groupid = groupid; model.attribute = attribute; model.industry = industry; model.productcategory = productcategory; model.vip = vip; model.areacode = areacode; model.address = address; model.staffsize = staffsize; model.regyear = regyear; model.regcity = regcity; model.buy = buy; model.sell = sell; model.linkman = linkman; model.phone = phone; model.mphone = mphone; model.fax = fax; model.email = email; model.postcode = postcode; model.homepage = homepage; model.domain = domain; model.domainip = domainip; model.icp = icp; model.surface = surface; model.logo = logo; model.thumb = thumb; model.bannel = bannel; model.desimage = desimage; model.descript = descript; model.keywords = keywords; model.template = template; model.hits = hits; model.sort = sort; model.marketid = TypeConverter.StrToInt(ddlmarket.SelectedValue); model.cid = TypeConverter.StrToInt(cid); model.ctype = TypeConverter.StrToInt(ctype); model.lastedittime = lastedittime; model.auditstatus = auditstatus; model.linestatus = linestatus; model.lastedid = adminId; int aid = ECShop.EditShop(model); if (aid > 0) { ECUpLoad ecUpload = new ECUpLoad(); if (surface.Length > 0) { surface = surface.StartsWith(",") ? surface.Substring(1, surface.Length - 1) : surface; surface = surface.EndsWith(",") ? surface.Substring(0, surface.Length - 1) : surface; ecUpload.MoveFiles(surface.Split(','), string.Format(EnFilePath.Shop, aid, EnFilePath.Surface)); } if (thumb.Length > 0) { ecUpload.MoveFiles(thumb.Split(','), string.Format(EnFilePath.Shop, aid, EnFilePath.Thumb)); } if (logo.Length > 0) { ecUpload.MoveFiles(logo.Split(','), string.Format(EnFilePath.Shop, aid, EnFilePath.Logo)); } if (bannel.Length > 0) { ecUpload.MoveFiles(bannel.Split(','), string.Format(EnFilePath.Shop, aid, EnFilePath.Banner)); } if (desimage.Length > 0) { ecUpload.MoveFiles(desimage.Split(','), string.Format(EnFilePath.Shop, aid, EnFilePath.DesImage)); } StringBuilder imglist = Utils.GetImgUrl(model.descript); if (Utils.GetImgUrl(model.descript).Length > 0) { string strConFilePath = ""; foreach (string s in imglist.ToString().Split(',')) { if (s.Contains(TREC.Entity.EnFilePath.tmpRootPath)) { strConFilePath += s + ","; } } if (strConFilePath.Length > 0) { ECShop.UpConFilePath(ECommon.RepFilePathContent(model.descript, TREC.Entity.EnFilePath.tmpRootPath, string.Format(EnFilePath.Shop, aid, EnFilePath.ConImage)), aid); ecUpload.MoveContentFiles(strConFilePath.Replace(TREC.Entity.EnFilePath.tmpRootPath, "").Split(','), string.Format(EnFilePath.Shop, aid, EnFilePath.ConImage)); } } UiCommon.JscriptPrint(this.Page, "编辑成功!", "shoplist.aspx", "Success"); } } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/shop/shopinfo.aspx.cs
C#
oos
16,912
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="shopinfo.aspx.cs" Inherits="TREC.Web.Admin.shop.shopinfo" EnableEventValidation="false" %> <%@ Import Namespace="TREC.ECommerce" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery.validate.min.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery.form.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/additional-methods.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/messages_cn.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/My97DatePicker/WdatePicker.js"></script> <script type="text/javascript" src="<%=TREC.ECommerce.ECommon.WebResourceUrl %>/script/jquery.area.js"></script> <script type="text/javascript" src="<%=TREC.ECommerce.ECommon.WebResourceUrl %>/editor/kindeditor/kindeditor-min.js"></script> <script type="text/javascript" src="<%=TREC.ECommerce.ECommon.WebResourceUrl %>/script/fileupload.js"></script> <script type="text/javascript"> $(function () { //表单验证JS $("#form1").validate({ //出错时添加的标签 errorElement: "span", showErrors: function (errorMap, errorList) { if (errorList.length > 0) { if ($("#" + errorList[0].element.id).next() != null) { $("#" + errorList[0].element.id).next().remove(); } } this.defaultShowErrors(); }, success: function (label) { //正确时的样式 label.text(" ").addClass("success"); } }); var editor; KindEditor.ready(function (K) { editor = K.create('#txtdescript', { allowPreviewEmoticons: true, allowImageUpload: true, allowFileManager: true, <%if (TREC.ECommerce.ECommon.QueryId != "" && TREC.ECommerce.ECommon.QueryEdit != "") { %> fileManagerJson:"<%=TREC.ECommerce.ECommon.WebResourceUrl %>/editor/kindeditor/ashx/file_manager_json.ashx?m=shop&id=<%=TREC.ECommerce.ECommon.QueryId %>", <%} %> allowMediaUpload: true, items: [ 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', 'insertunorderedlist', '|', 'image', 'flash', 'media', 'link', 'fullscreen'] }); }); $("#btnSearch").click(function () { $.ajax({ url: "<%=ECommon.WebUrl %>/ajax/ajaxuser.ashx", data: "type=getnoaddmember&v=" + $("#txtSearch").val(), dataType: "json", success: function (data) { if (data != "") { $("#ddlmember").html(); $("#ddlmember").html("<option value=\"\">请选择</option>"); $.each(data, function (i) { $("#ddlmember").append("<option value=\"" + data[i].id + "\">" + data[i].name + "</option>"); }); } } }) }); $("#btnmarketsearch").click(function () { $.ajax({ url: "<%=ECommon.WebUrl %>/ajax/ajaxuser.ashx", data: "type=getnoaddmarket&v=" + $("#txtmarketsearch").val(), dataType: "json", success: function (data) { if (data != "") { $("#ddlmarket").html(); $("#ddlmarket").html("<option value=\"\">请选择</option>"); $("#ddlmarket").append("<option value=\"0\">未加入卖场</option>"); $.each(data, function (i) { $("#ddlmarket").append("<option value=\"" + data[i].id + "\">" + data[i].name + "</option>"); }); } } }) }); $("#btnctypsearch").click(function () { if($("#ddlctype").val()!="") { $.ajax({ url: "<%=ECommon.WebUrl %>/ajax/ajaxuser.ashx", data: "type=getcompanyordealertoshop&v=" + $("#txtctype").val()+"&t="+$("#ddlctype").val(), dataType: "json", success: function (data) { if (data != "") { $("#ddlc").hide(); $("#ddlc").show(); $("#ddlc").html("<option value=\"\">请选择</option>"); $("#ddlc").append("<option value=\"0\">未加企业</option>"); $.each(data, function (i) { $("#ddlc").append("<option value=\"" + data[i].id + "\">" + data[i].name + "</option>"); }); } } }); } else { alert("请选择要加入的企业类型"); } }); $("#ddlPro").live("change", function () { if ($(this).val() != "" && $(this).val() != "0") { $.ajax({ url: "<%=ECommon.WebUrl %>/ajaxtools/ajaxarea.ashx", data: "type=c&p=" + $(this).val(), success: function (data) { $("#ddlregcity").html(data) }, error: function (d, m) { alert(m); } }); } }) }); </script> <style type="text/css"> .formTable{border:1px solid #ccc;} .formTable tr th{background:#ededed; text-align:left;} .formTable tr td{border:none; padding-top:8px; padding-bottom:8px;} </style> </head> <body style="padding:10px;"> <form id="form1" runat="server"> <div class="navigation"> <span class="back"><a href="shoplist.aspx">返回列表</a></span><b>您当前的位置:首页 &gt; 成员管理 &gt; 登陆账号管理</b> </div> <div class="spClear"></div> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable"> <tr> <th colspan="3" align="left">登陆账号信息</th> </tr> <tr> <td width="390px" valign="top"> <table class="formTable" width="380px"> <tr> <th colspan="2">账号信息:</th> </tr> <%if (ECommon.QueryId != "" && ECommon.QueryEdit != "" && _memberInfo!=null) { %> <tr> <td align="right" width="70">通&nbsp;行&nbsp;&nbsp;证:</td> <td><%=_memberInfo.passport %></td> </tr> <%} else { %> <tr> <td align="right" width="70">会员查找:</td> <td><asp:TextBox ID="txtSearch" runat="server" CssClass="w160 input"></asp:TextBox>&nbsp;<input type="button" class="submit" value="查找" id="btnSearch" /></td> </tr> <%} %> <tr> <td align="right">登陆账号:</td> <td><asp:DropDownList ID="ddlmember" runat="server" CssClass="select selectNone" Width="160"></asp:DropDownList></td> </tr> </table> <div class="spClear"></div> <table class="formTable" width="380px"> <tr> <th colspan="2">企业信息:</th> </tr> <tr> <td width="70px" align="right"> 推荐属性: </td> <td > <asp:CheckBoxList runat="server" ID="chkattribute" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow"></asp:CheckBoxList> </td> </tr> <tr> <td align="right"> 企业名称: </td> <td > <asp:TextBox id="txttitle" runat="server" CssClass="input required w160"></asp:TextBox> </td></tr> <tr> <td align="right"> 企业组 : </td> <td> <asp:DropDownList ID="ddlshopgroup" runat="server" CssClass="select selectNone" Width="160px"></asp:DropDownList> </td> </tr> <tr> <td align="right"> 名称索引: </td> <td> <asp:TextBox ID="txtletter" runat="server" CssClass="input required w160"></asp:TextBox> </td> </tr> <tr> <td width="76px" align="right"> 是否vip : </td> <td> <asp:TextBox ID="txtvip" runat="server" Width="45" CssClass="input required">0</asp:TextBox><label>(1-10值越大级别越高,0为不是vip)</label> </td> </tr> <tr> <td align="right"> 人员规格 : </td> <td> <asp:DropDownList ID="ddlstaffsize" runat="server" CssClass="select selectNone" Width="160"></asp:DropDownList> </td> </tr> <tr> <td align="right"> 注册年份: </td> <td> <asp:TextBox ID="txtregyear" runat="server" CssClass="input w160 required digits"></asp:TextBox> </td> </tr> <tr> <td align="right"> 注册城市: </td> <td> <asp:DropDownList ID="ddlPro" runat="server" CssClass="select"></asp:DropDownList> <asp:DropDownList ID="ddlregcity" runat="server" CssClass="select selectNone"></asp:DropDownList> </td> </tr> <tr> <td align="right"> 业务描述: </td> <td> <asp:TextBox ID="txtbuy" runat="server" CssClass="w250 textarea" TextMode="MultiLine" Rows="4"></asp:TextBox><label>长度不超过250字符,生产/销售/租凭业务描述</label> </td> </tr> </table> <div class="spClear"></div> <table class="formTable" width="380"> <tr> <th colspan="2">所在卖场:</th> </tr> <tr> <td align="right" width="70">卖场查找:</td> <td><asp:TextBox ID="txtmarketsearch" runat="server" CssClass="w160 input"></asp:TextBox>&nbsp;<input type="button" class="submit" value="查找" id="btnmarketsearch" /></td> </tr> <tr> <td align="right">选择卖场:</td> <td><asp:DropDownList ID="ddlmarket" runat="server" CssClass="select selectNone" Width="160"></asp:DropDownList></td> </tr> <tr> <td align="right" width="70">所属企业:</td> <td><asp:DropDownList ID="ddlctype" runat="server" CssClass="select" Width="160"></asp:DropDownList></td> </tr> <tr> <td align="right" width="70">查找企业:</td> <td><asp:TextBox ID="txtctype" runat="server" CssClass="w160 input"></asp:TextBox>&nbsp;<input type="button" class="submit" value="查找" id="btnctypsearch" /></td> </tr> <tr> <td align="right" width="70">选择企业:</td> <td><asp:DropDownList ID="ddlc" runat="server" CssClass="select selectNone" Width="160"></asp:DropDownList></td> </tr> </table> </td> <td width="380px" valign="top"> <table class="formTable" width="380px"> <tr> <th colspan="2">联系信息:</th> </tr> <tr> <td align="right" width="70px" >地区:</td> <td> <div class="_droparea" id="ddlareacode" title="<%=areaCode %>"></div> </td> </tr> <tr> <td align="right">地址:</td> <td ><asp:TextBox id="txtaddress" runat="server" CssClass="input w250 required"></asp:TextBox></td> </tr> <tr> <td align="right">联系人:</td> <td ><asp:TextBox id="txtlinkman" runat="server" CssClass="input w160"></asp:TextBox></td> </tr> <tr> <td align="right"> 手机 : </td> <td> <asp:TextBox ID="txtmphone" runat="server" CssClass="input w160"></asp:TextBox> </td> </tr> <tr> <td align="right"> 电话 : </td> <td> <asp:TextBox ID="txtphone" runat="server" CssClass="input w160"></asp:TextBox> </td> </tr> <tr> <td align="right"> 传真 : </td> <td> <asp:TextBox ID="txtfax" runat="server" CssClass="input w160"></asp:TextBox> </td> </tr> <tr> <td align="right"> 邮箱 : </td> <td> <asp:TextBox ID="txtemail" runat="server" CssClass="input w160"></asp:TextBox> </td> </tr> <tr> <td align="right"> 邮编 : </td> <td> <asp:TextBox ID="txtpostcode" runat="server" CssClass="input w160"></asp:TextBox> </td> </tr> <tr> <td align="right"> 主页 : </td> <td> <asp:TextBox ID="txthomepage" runat="server" CssClass="input w160"></asp:TextBox> </td> </tr> </table> <div class="spClear"></div> <table class="formTable" width="380"> <tr> <th colspan="2">图片信息:</th> </tr> <tr> <td align="right" valign="top">形&nbsp;象&nbsp;&nbsp;图:</td> <td> <div class="fileUpload" path="<%=string.Format(TREC.Entity.EnFilePath.Shop, ECommon.QueryId, TREC.Entity.EnFilePath.Surface)%>"> <asp:HiddenField ID="hfsurface" runat="server" /> <div class="fileTools"> <input type="text" class="input w160 filedisplay" /> <a href="javascript:;" class="files"><input id="File1" type="file" class="upload" onchange="_upfile(this)" runat="server" /></a> <span class="uploading">正在上传,请稍后……</span> </div> </div> </td> </tr> <tr> <td width="70px" align="right">企业标志:</td> <td> <div class="fileUpload" path="<%=string.Format(TREC.Entity.EnFilePath.Shop, ECommon.QueryId, TREC.Entity.EnFilePath.Logo)%>"> <asp:HiddenField ID="hflogo" runat="server" /> <div class="fileTools"> <input type="text" class="input w160 filedisplay" /> <a href="javascript:;" class="files"><input id="File2" type="file" class="upload" onchange="_upfile(this)" runat="server" /></a> <span class="uploading">正在上传,请稍后……</span> </div> </div> </td> </tr> <tr> <td align="right">缩&nbsp;略&nbsp;&nbsp;图:</td> <td> <div class="fileUpload" path="<%=string.Format(TREC.Entity.EnFilePath.Shop, ECommon.QueryId, TREC.Entity.EnFilePath.Thumb)%>"> <asp:HiddenField ID="hfthumb" runat="server" /> <div class="fileTools"> <input type="text" class="input w160 filedisplay" /> <a href="javascript:;" class="files"><input id="File3" type="file" class="upload" onchange="_upfile(this)" runat="server" /></a> <span class="uploading">正在上传,请稍后……</span> </div> </div> </td> </tr> <tr> <td align="right">广告幻灯:</td> <td> <div class="fileUpload m" path="<%=string.Format(TREC.Entity.EnFilePath.Shop, ECommon.QueryId, TREC.Entity.EnFilePath.Banner)%>"> <asp:HiddenField ID="hfbannel" runat="server" /> <div class="fileTools"> <input type="text" class="input w160 filedisplay" /> <a href="javascript:;" class="files"><input id="File4" type="file" class="upload" onchange="_upfile(this)" runat="server" /></a> <span class="uploading">正在上传,请稍后……</span> </div> </div> </td> </tr> <tr> <td align="right">企业展示:</td> <td> <div class="fileUpload m" path="<%=string.Format(TREC.Entity.EnFilePath.Shop, ECommon.QueryId, TREC.Entity.EnFilePath.DesImage)%>"> <asp:HiddenField ID="hfdesimage" runat="server" /> <div class="fileTools"> <input type="text" class="input w160 filedisplay" /> <a href="javascript:;" class="files"><input id="File5" type="file" class="upload" onchange="_upfile(this)" runat="server" /></a> <span class="uploading">正在上传,请稍后……</span> </div> </div> </td> </tr> </table> </td> <td valign="top"> <table class="formTable" width="380"> <tr> <th colspan="2">优化及配置:</th> </tr> <tr> <td width="70px" align="right">关&nbsp;键&nbsp;&nbsp;字:</td> <td><asp:TextBox id="txtkeywords" runat="server" CssClass="input w160"></asp:TextBox></td> </tr> <tr> <td align="right">配置域名:</td> <td><asp:TextBox id="txtdomain" runat="server" CssClass="input w160"></asp:TextBox></td> </tr> <tr> <td align="right">配置IP:</td> <td><asp:TextBox id="txtdomainip" runat="server" CssClass="input w160"></asp:TextBox></td> </tr> <tr> <td align="right">ICP备案:</td> <td><asp:TextBox id="txticp" runat="server" CssClass="input w160"></asp:TextBox></td> </tr> <tr> <td align="right">企业风格:</td> <td><asp:DropDownList ID="ddltemplate" runat="server"></asp:DropDownList></td> </tr> </table> <div class="spClear"></div> <table class="formTable" width="380"> <tr> <th colspan="2">企业描述:</th> </tr> <tr> <td colspan="2"><asp:TextBox id="txtdescript" runat="server" CssClass="textarea required" TextMode="MultiLine" Rows="5" Width="360"></asp:TextBox></td> </tr> </table> <div class="spClear"></div> <table class="formTable" width="380"> <tr> <th colspan="2">企业状态:</th> </tr> <tr> <td width="90px" align="right">审核:</td> <td><asp:DropDownList ID="ddlauditstatus" runat="server" CssClass="select selectNone" Width="160"></asp:DropDownList></td> </tr> <tr> <td align="right">上/下线:</td> <td><asp:DropDownList ID="ddllinestatus" runat="server" CssClass="select selectNone" Width="160"></asp:DropDownList></td> </tr> <tr> <td align="right"> 排序 : </td> <td> <asp:TextBox ID="txtsort" runat="server" CssClass="input w160 required digits">0</asp:TextBox> </td> </tr> <%if (ECommon.QueryId != "" && ECommon.QueryEdit != "") { %> <tr> <td align="right"> 点击量 : </td> <td> <asp:TextBox ID="txthits" runat="server" CssClass="input w160 required digits">0</asp:TextBox> </td> </tr> <tr> <td align="right"> 最后修改 : </td> <td> <asp:TextBox ID="txtlastedittime" runat="server" CssClass="input Wdate w160 required" onfocus="WdatePicker()"></asp:TextBox> </td> </tr> <%} %> </table> </td> </tr> </table> <div style="margin-top:10px; margin-left:180px"> <asp:Button ID="btnSave" runat="server" Text="确认保存" CssClass="submit" onclick="btnSave_Click" /><input name="重置" type="reset" class="submit" value="重置" /> </div> </form> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/shop/shopinfo.aspx
ASP.NET
oos
26,483
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="shoplist.aspx.cs" Inherits="TREC.Web.Admin.shop.shoplist" %> <%@ Import Namespace="TREC.ECommerce" %> <%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="../script/admin.js"></script> <script type="text/javascript"> $(function () { $(".msgtable tr:nth-child(odd)").addClass("tr_bg"); //隔行变色 $(".msgtable tr").hover( function () { $(this).addClass("tr_hover_col"); }, function () { $(this).removeClass("tr_hover_col"); } ); }) </script> </head> <body style="padding:10px;"> <form id="form1" runat="server"> <div class="navigation"> <span class="add"><a href="shopinfo.aspx">添加系列</a></span><b>您当前的位置:首页 &gt; 成员管理 &gt; 登陆账号管理</b> </div> <div class="spClear"></div> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable"> <tr> <th width="40px" align="center">选择</th> <th width="40px" align="center">编号</th> <th align="left">登陆名</th> <th align="center" width="160px">Email</th> <th align="center" width="160px">最后活动时间</th> <th width="80px" align="right" style="padding-left:5px;">操作</th> </tr> <asp:Repeater ID="rptList" runat="server"> <ItemTemplate> <tr> <td align="center"><asp:CheckBox ID="cb_id" CssClass="checkall" runat="server" /></td> <td align="center"><asp:Label ID="lb_id" runat="server" Text='<%#Eval("Id")%>'></asp:Label></td> <td align="left"><a href="shopinfo.aspx?edit=1&id=<%#Eval("id") %>"><%#Eval("title") %></a></td> <td align="center"><%#Eval("email") %></td> <td align="center"><%#Eval("lastedittime")%></td> <td align="right" style="padding-left:5px;"><a href="shopinfo.aspx?edit=1&id=<%#Eval("id") %>">修改</a>|<a href="shoplist.aspx?edit=2&id=<%#Eval("id") %>">删除</a></td> </tr> </ItemTemplate> </asp:Repeater> </table> <div class="spClear"></div> <div style="line-height:30px;height:30px;"> <div id="Pagination" class="right flickr"> <webdiyer:AspNetPager ID="AspNetPager1" runat="server" AlwaysShow="true" UrlPaging="true" FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页"> </webdiyer:AspNetPager> </div> <div class="left"> <span class="btn_all" onclick="checkAll(this);">全选</span> <span class="btn_bg"> <asp:LinkButton ID="lbtnDel" runat="server" OnClientClick="return confirm( '确定要删除这些记录吗? ');" OnClick="lbtnDel_Click" >删 除</asp:LinkButton>&nbsp;&nbsp; </span> </div> </div> </form> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/shop/shoplist.aspx
ASP.NET
oos
3,353
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TREC.ECommerce; using TREC.Entity; using TRECommon; namespace TREC.Web.Admin.shop { public partial class shopgrouplist : AdminPageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ShowData(); } } protected void ShowData() { if (ECommon.QueryEdit == "2" && ECommon.QueryId != "") { ECShop.DeletEnShopGroup(TypeConverter.StrToInt(ECommon.QueryId)); } rptList.DataSource = ECShop.GetShopGroupList(ECommon.QueryPageIndex, AspNetPager1.PageSize, "", out tmpPageCount); rptList.DataBind(); AspNetPager1.RecordCount = tmpPageCount; } protected void lbtnDel_Click(object sender, EventArgs e) { string idlist=""; for (int i = 0; i < rptList.Items.Count; i++) { string id = ((Label)rptList.Items[i].FindControl("lb_id")).Text; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("cb_id"); if (cb.Checked) { idlist += id + ","; } } if (idlist.Length > 0) { ECShop.DeletEnShopGroupByIdList(idlist.EndsWith(",") ? idlist.Substring(0, idlist.Length - 1) : idlist); UiCommon.JscriptPrint(this.Page, "批量删除成功!", "shopgrouplist.aspx", "Success"); } } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/shop/shopgrouplist.aspx.cs
C#
oos
1,727
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="shopgroupinfo.aspx.cs" Inherits="TREC.Web.Admin.shop.shopgroupinfo" %> <%@ Import Namespace="TREC.ECommerce" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery.validate.min.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery.form.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/additional-methods.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/messages_cn.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/My97DatePicker/WdatePicker.js"></script> <script type="text/javascript"> $(function () { //表单验证JS $("#form1").validate({ //出错时添加的标签 errorElement: "span", showErrors: function (errorMap, errorList) { if (errorList.length > 0) { if ($("#" + errorList[0].element.id).next() != null) { $("#" + errorList[0].element.id).next().remove(); } } this.defaultShowErrors(); }, success: function (label) { //正确时的样式 label.text(" ").addClass("success"); } }); }); </script> <style type="text/css"> .formTable{border:1px solid #ccc;} .formTable tr th{background:#ededed; text-align:left;} .formTable tr td{border:none; padding-top:8px; padding-bottom:8px;} </style> </head> <body style="padding:10px;"> <form id="form1" runat="server"> <div class="navigation"> <span class="back"><a href="shopgrouplist.aspx">返回列表</a></span><b>您当前的位置:首页 &gt; 店铺管理 &gt; 店铺组管理</b> </div> <div class="spClear"></div> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable"> <tr> <th colspan="3" align="left">卖场组信息</th> </tr> <tr> <td width="120" align="right"> 名称 : </td> <td align="left"> <asp:TextBox ID="txttitle" runat="server" CssClass="w160 input required"></asp:TextBox> </td> </tr> <tr> <td align="right"> 颜色 : </td> <td align="left"> <asp:TextBox ID="txtcolor" runat="server" CssClass="w160 input"></asp:TextBox> </td> </tr> <tr> <td align="right"> 组图标 : </td> <td align="left"> <asp:TextBox ID="txtavatar" runat="server" CssClass="w160 input"></asp:TextBox> </td> </tr> <tr> <td align="right"> 积分 : </td> <td align="left"> <asp:TextBox ID="txtintegral" runat="server" CssClass="w160 input required number">0</asp:TextBox> </td> </tr> <tr> <td align="right"> 金钱 : </td> <td align="left"> <asp:TextBox ID="txtmoney" runat="server" CssClass="w160 input required number">0</asp:TextBox> </td> </tr> <tr> <td align="right"> 广告数量 : </td> <td align="left"> <asp:TextBox ID="txtadcount" runat="server" CssClass="w160 input required digits">0</asp:TextBox> </td> </tr> <tr> <td align="right"> 卖场数量 : </td> <td align="left"> <asp:TextBox ID="txtmarketcount" runat="server" CssClass="w160 input required digits">0</asp:TextBox> </td> </tr> <tr> <td align="right"> 品牌数量 : </td> <td align="left"> <asp:TextBox ID="txtbrandcount" runat="server" CssClass="w160 input required digits">0</asp:TextBox> </td> </tr> <tr> <td align="right"> 促销数量 : </td> <td align="left"> <asp:TextBox ID="txtpromotioncount" runat="server" CssClass="w160 input required digits">0</asp:TextBox> </td> </tr> <tr> <td align="right"> 广告推荐数量 : </td> <td align="left"> <asp:TextBox ID="txtadrecommend" runat="server" CssClass="w160 input required digits">0</asp:TextBox> </td> </tr> <tr> <td align="right"> 卖场推荐数量 : </td> <td align="left"> <asp:TextBox ID="txtmarketrecommend" runat="server" CssClass="w160 input required digits">0</asp:TextBox> </td> </tr> <tr> <td align="right"> 品牌推荐数量 : </td> <td align="left"> <asp:TextBox ID="txtbrandrecommend" runat="server" CssClass="w160 input required digits">0</asp:TextBox> </td> </tr> <tr> <td align="right"> 促销推荐数量 : </td> <td align="left"> <asp:TextBox ID="txtpromotionrecommend" runat="server" CssClass="w160 input required digits">0</asp:TextBox> </td> </tr> <tr> <td align="right"> 楼层数量 : </td> <td align="left"> <asp:TextBox ID="txtstoreycount" runat="server" CssClass="w160 input required digits">0</asp:TextBox> </td> </tr> <tr> <td align="right"> 楼层店铺数量 : </td> <td align="left"> <asp:TextBox ID="txtstoreyshopcount" runat="server" CssClass="w160 input required digits">0</asp:TextBox> </td> </tr> <tr> <td align="right"> 权限 : </td> <td align="left"> <asp:TextBox ID="txtpermissions" runat="server" CssClass="w160 input"></asp:TextBox> </td> </tr> <tr> <td align="right"> 级别 : </td> <td align="left"> <asp:TextBox ID="txtlev" runat="server" CssClass="w160 input required digits">1</asp:TextBox> </td> </tr> <tr> <td align="right"> 描述 : </td> <td align="left"> <asp:TextBox ID="txtdescript" runat="server" CssClass=" w380 textarea" TextMode="MultiLine" Rows="3"></asp:TextBox> </td> </tr> <tr> <td align="right"> 排序 : </td> <td align="left"> <asp:TextBox ID="txtsort" runat="server" CssClass="w160 input required digits">0</asp:TextBox> </td> </tr> </table> <div style="margin-top:10px; margin-left:140px"> <asp:Button ID="btnSave" runat="server" Text="确认保存" CssClass="submit" onclick="btnSave_Click" /><input name="重置" type="reset" class="submit" value="重置" /> </div> </form> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/shop/shopgroupinfo.aspx
ASP.NET
oos
8,242
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TREC.ECommerce; using TREC.Entity; using TRECommon; namespace TREC.Web.Admin.shop { public partial class shopbrandlist : AdminPageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ShowData(); } } protected void ShowData() { if (ECommon.QueryEdit == "2" && ECommon.QueryId != "") { ECShop.DeletEnShop(TypeConverter.StrToInt(ECommon.QueryId)); } rptList.DataSource = ECShop.GetShopList(ECommon.QueryPageIndex, AspNetPager1.PageSize, "", out tmpPageCount); rptList.DataBind(); AspNetPager1.RecordCount = tmpPageCount; } protected void lbtnDel_Click(object sender, EventArgs e) { string idlist=""; for (int i = 0; i < rptList.Items.Count; i++) { string id = ((Label)rptList.Items[i].FindControl("lb_id")).Text; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("cb_id"); if (cb.Checked) { idlist += id + ","; } } if (idlist.Length > 0) { ECShop.DeletEnShopByIdList(idlist.EndsWith(",") ? idlist.Substring(0, idlist.Length - 1) : idlist); UiCommon.JscriptPrint(this.Page, "批量删除成功!", "shoplist.aspx", "Success"); } } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/shop/shopbrandlist.aspx.cs
C#
oos
1,707
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="shopgrouplist.aspx.cs" Inherits="TREC.Web.Admin.shop.shopgrouplist" %> <%@ Import Namespace="TREC.ECommerce" %> <%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="../script/admin.js"></script> <script type="text/javascript"> $(function () { $(".msgtable tr:nth-child(odd)").addClass("tr_bg"); //隔行变色 $(".msgtable tr").hover( function () { $(this).addClass("tr_hover_col"); }, function () { $(this).removeClass("tr_hover_col"); } ); }) </script> </head> <body style="padding:10px;"> <form id="form1" runat="server"> <div class="navigation"> <span class="add"><a href="shopgroupinfo.aspx">添加店铺</a></span><b>您当前的位置:首页 &gt; 店铺管理 &gt; 店铺组管理</b> </div> <div class="spClear"></div> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable"> <tr> <th width="40px" align="center">选择</th> <th width="40px" align="center">编号</th> <th align="left">名称</th> <th width="60px" align="center">积分</th> <th width="60px" align="center">金钱</th> <th width="60px" align="center">级别</th> <th width="80px" align="right" style="padding-left:5px;">操作</th> </tr> <asp:Repeater ID="rptList" runat="server"> <ItemTemplate> <tr> <td align="center"><asp:CheckBox ID="cb_id" CssClass="checkall" runat="server" /></td> <td align="center"><asp:Label ID="lb_id" runat="server" Text='<%#Eval("Id")%>'></asp:Label></td> <td align="left"><a href="membergroupinfo.aspx?edit=1&id=<%#Eval("id") %>"><%#Eval("title") %></a></td> <td align="center"><%#Eval("integral")%></td> <td align="center"><%#Eval("money")%></td> <td align="center"><%#Eval("lev")%></td> <td align="right" style="padding-left:5px;"><a href="membergroupinfo.aspx?edit=1&id=<%#Eval("id") %>">修改</a>|<a href="membergroupinfo.aspx?edit=2&id=<%#Eval("id") %>">删除</a></td> </tr> </ItemTemplate> </asp:Repeater> </table> <div class="spClear"></div> <div style="line-height:30px;height:30px;"> <div id="Pagination" class="right flickr"> <webdiyer:AspNetPager ID="AspNetPager1" runat="server" AlwaysShow="true" UrlPaging="true" FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页"> </webdiyer:AspNetPager> </div> <div class="left"> <span class="btn_all" onclick="checkAll(this);">全选</span> <span class="btn_bg"> <asp:LinkButton ID="lbtnDel" runat="server" OnClientClick="return confirm( '确定要删除这些记录吗? ');" OnClick="lbtnDel_Click" >删 除</asp:LinkButton>&nbsp;&nbsp; </span> </div> </div> </form> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/shop/shopgrouplist.aspx
ASP.NET
oos
3,468
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TREC.ECommerce; using TREC.Entity; using TRECommon; namespace TREC.Web.Admin.shop { public partial class shoplist : AdminPageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ShowData(); } } protected void ShowData() { if (ECommon.QueryEdit == "2" && ECommon.QueryId != "") { ECShop.DeletEnShop(TypeConverter.StrToInt(ECommon.QueryId)); } rptList.DataSource = ECShop.GetShopList(ECommon.QueryPageIndex, AspNetPager1.PageSize, "", out tmpPageCount); rptList.DataBind(); AspNetPager1.RecordCount = tmpPageCount; } protected void lbtnDel_Click(object sender, EventArgs e) { string idlist=""; for (int i = 0; i < rptList.Items.Count; i++) { string id = ((Label)rptList.Items[i].FindControl("lb_id")).Text; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("cb_id"); if (cb.Checked) { idlist += id + ","; } } if (idlist.Length > 0) { ECShop.DeletEnShopByIdList(idlist.EndsWith(",") ? idlist.Substring(0, idlist.Length - 1) : idlist); UiCommon.JscriptPrint(this.Page, "批量删除成功!", "shoplist.aspx", "Success"); } } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/shop/shoplist.aspx.cs
C#
oos
1,702
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="memberinfo.aspx.cs" Inherits="TREC.Web.Admin.member.memberinfo" %> <%@ Import Namespace="TREC.ECommerce" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery.validate.min.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery.form.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/additional-methods.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/messages_cn.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/My97DatePicker/WdatePicker.js"></script> <script type="text/javascript"> $(function () { //表单验证JS $("#form1").validate({ //出错时添加的标签 errorElement: "span", showErrors: function (errorMap, errorList) { if (errorList.length > 0) { if ($("#" + errorList[0].element.id).next() != null) { $("#" + errorList[0].element.id).next().remove(); } } this.defaultShowErrors(); }, success: function (label) { //正确时的样式 label.text(" ").addClass("success"); } }); }); </script> <style type="text/css"> .formTable{border:1px solid #ccc;} .formTable tr th{background:#ededed; text-align:left;} .formTable tr td{border:none; padding-top:8px; padding-bottom:8px;} </style> </head> <body style="padding:10px;"> <form id="form1" runat="server"> <div class="navigation"> <span class="back"><a href="memberlist.aspx">返回列表</a></span><b>您当前的位置:首页 &gt; 成员管理 &gt; 登陆账号管理</b> </div> <div class="spClear"></div> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable"> <tr> <th colspan="3" align="left">登陆账号信息</th> </tr> <tr> <td width="390px" valign="top"> <table class="formTable" width="380px"> <tr> <th colspan="2">账号信息:</th> </tr> <%if (ECommon.QueryId != "" && ECommon.QueryEdit != "") { %> <tr> <td width="70px" align="right">通&nbsp;行&nbsp;&nbsp;证:</td><td align="left"><asp:Label id="lbpassport" runat="server" CssClass="w160"></asp:Label></td> </tr> <%} %> <tr> <td width="70px" align="right">登陆账号:</td><td align="left"><asp:TextBox id="txtusername" runat="server" CssClass="input required w160"></asp:TextBox></td> </tr> <tr> <td align="right">登陆密码:</td><td align="left"><asp:TextBox id="txtpassword" runat="server" CssClass="input w160"></asp:TextBox> <asp:HiddenField ID="hfpassword" runat="server" /></td> </tr> <tr> <td align="right">支付密码:</td> <td align="left"> <asp:TextBox id="txtpaypassword" runat="server" CssClass="input w160"></asp:TextBox> <asp:HiddenField ID="hfpaypassword" runat="server" /> </td> </tr> <tr> <td align="right">会&nbsp;员&nbsp;&nbsp;组:</td> <td> <asp:DropDownList ID="ddlmembergroup" runat="server" Width="160" CssClass="select selectNone"></asp:DropDownList> </td> </tr> </table> <div class="spClear"></div> <table class="formTable" width="380px"> <tr> <th colspan="2">余额信息:</th> </tr> <tr> <td width="70px" align="right"> 短信余额 :</td> <td > <asp:TextBox id="txtsms" runat="server" CssClass="input required w160"></asp:TextBox> </td></tr> <tr> <td align="right"> 积分 : </td> <td> <asp:TextBox ID="txtintegral" runat="server" CssClass="input required w160"></asp:TextBox> </td> </tr> <tr> <td align="right"> 资金金额 : </td> <td> <asp:TextBox ID="txtmoney" runat="server" CssClass="input required w160"></asp:TextBox> </td> </tr> </table> <div class="spClear"></div> <table class="formTable" width="380px"> <tr> <th colspan="2">银行信息:</th> </tr> <tr> <td width="76px" align="right"> 收款银行 : </td> <td> <asp:TextBox ID="txtbank" runat="server" CssClass="input w160"></asp:TextBox> </td> </tr> <tr> <td align="right"> 收款账号 : </td> <td> <asp:TextBox ID="txtaccount" runat="server" CssClass="input w250"></asp:TextBox> </td> </tr> <tr> <td align="right"> 支付宝账号 : </td> <td> <asp:TextBox ID="txtalipay" runat="server" CssClass="input w160"></asp:TextBox> </td> </tr> </table> <div class="spClear"></div> <table class="formTable" width="380px"> <tr> <th colspan="2">认证信息:</th> </tr> <tr> <td> <label>邮箱认证 :</label><asp:RadioButtonList ID="ravemail" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow"><asp:ListItem Text="否" Selected="True" Value="0"></asp:ListItem><asp:ListItem Text="是" Value="1"></asp:ListItem></asp:RadioButtonList> <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label> <label>手机认证 :</label><asp:RadioButtonList ID="ravmobile" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow"><asp:ListItem Text="否" Selected="True" Value="0"></asp:ListItem><asp:ListItem Text="是" Value="1"></asp:ListItem></asp:RadioButtonList> </td> </tr> <tr> <td> <label>实名认证 :</label><asp:RadioButtonList ID="ravname" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow"><asp:ListItem Text="否" Selected="True" Value="0"></asp:ListItem><asp:ListItem Text="是" Value="1"></asp:ListItem></asp:RadioButtonList> <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label> <label>验证银行 :</label><asp:RadioButtonList ID="ravbank" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow"><asp:ListItem Text="否" Selected="True" Value="0"></asp:ListItem><asp:ListItem Text="是" Value="1"></asp:ListItem></asp:RadioButtonList> </td> </tr> <tr> <td> <label>验证公司 :</label><asp:RadioButtonList ID="ravcompany" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow"><asp:ListItem Text="否" Selected="True" Value="0"></asp:ListItem><asp:ListItem Text="是" Value="1"></asp:ListItem></asp:RadioButtonList> <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label> <label>验证支付 :</label><asp:RadioButtonList ID="ravalipay" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow"><asp:ListItem Text="否" Selected="True" Value="0"></asp:ListItem><asp:ListItem Text="是" Value="1"></asp:ListItem></asp:RadioButtonList> </td> </tr> </table> <div class="spClear"></div> </td> <td width="380px" valign="top"> <table class="formTable" width="380px"> <tr> <th colspan="2">基本信息:</th> </tr> <tr> <td width="70px" align="right">账号类型:</td> <td><asp:DropDownList ID="ddlmembertype" runat="server" CssClass="w160 selectNone" Width="160"></asp:DropDownList></td> </tr> <tr> <td align="right">真实姓名:</td> <td><asp:TextBox id="txttname" runat="server" CssClass="input w160"></asp:TextBox></td> </tr> <tr> <td align="right">email:</td> <td ><asp:TextBox id="txtemail" runat="server" CssClass="input w160"></asp:TextBox></td> </tr> <tr> <td align="right">性别:</td> <td ><asp:TextBox id="txtgender" runat="server" CssClass="input w160"></asp:TextBox></td> </tr> <tr> <td align="right"> 手机 : </td> <td> <asp:TextBox ID="txtmobile" runat="server" CssClass="input w160"></asp:TextBox> </td> </tr> <tr> <td align="right"> 电话 : </td> <td> <asp:TextBox ID="txtphone" runat="server" CssClass="input w160"></asp:TextBox> </td> </tr> <tr> <td align="right"> msn : </td> <td> <asp:TextBox ID="txtmsn" runat="server" CssClass="input w160"></asp:TextBox> </td> </tr> <tr> <td align="right"> qq : </td> <td> <asp:TextBox ID="txtqq" runat="server" CssClass="input w160"></asp:TextBox> </td> </tr> <tr> <td align="right"> skype : </td> <td> <asp:TextBox ID="txtskype" runat="server" CssClass="input w160"></asp:TextBox> </td> </tr> <tr> <td align="right"> ali : </td> <td> <asp:TextBox ID="txtali" runat="server" CssClass="input w160"></asp:TextBox> </td> </tr> <tr> <td align="right"> 出生日期 : </td> <td> <asp:TextBox ID="txtbirthdate" runat="server" CssClass="input Wdate w160 required" onfocus="WdatePicker()"></asp:TextBox> </td> </tr> <tr> <td align="right"> 地区 : </td> <td> <asp:TextBox ID="txtareacode" runat="server" CssClass="input w160"></asp:TextBox> </td> </tr> <tr> <td align="right"> 详细地址 : </td> <td> <asp:TextBox ID="txtaddress" runat="server" CssClass="input w160"></asp:TextBox> </td> </tr> <tr> <td align="right"> 部门 : </td> <td> <asp:TextBox ID="txtdepartment" runat="server" CssClass="input w160"></asp:TextBox> </td> </tr> <tr> <td align="right"> 职位 : </td> <td> <asp:TextBox ID="txtcareer" runat="server" CssClass="input w160"></asp:TextBox> </td> </tr> <tr> <td align="right"> 提示音 : </td> <td> <asp:TextBox ID="txtsound" runat="server" CssClass="input w160"></asp:TextBox> </td> </tr> </table> <div class="spClear"></div> </td> <td valign="top"> <%if (ECommon.QueryId != "" && ECommon.QueryEdit != "" && ddlmembertype.SelectedValue!= ((int)TREC.Entity.EnumMemberType.个人成员).ToString()) { %> <table class="formTable" width="380"> <tr> <th colspan="2">商务信息:</th> </tr> <tr> <td>名称:<strong> 状态:</strong></td> </tr> <tr> <td>电话:</td> </tr> <tr> <td>手机:</td> </tr> <tr> <td>邮箱:</td> </tr> <tr> <td>地区:</td> </tr> <tr> <td>地址:</td> </tr> </table> <div class="spClear"></div> <%} %> <table class="formTable" width="380"> <tr> <th colspan="2">注册信息:</th> </tr> <tr> <td width="90px" align="right">注册IP:</td><td><asp:TextBox id="txtregip" runat="server" CssClass="input required w160"></asp:TextBox></td> </tr> <tr> <td align="right">注册时间:</td><td><asp:TextBox ID="txtregtime" runat="server" CssClass="input Wdate w160 required" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})"></asp:TextBox></td> </tr> </table> <%if (ECommon.QueryId != "" && ECommon.QueryEdit != "") { %> <div class="spClear"></div> <table class="formTable" width="380"> <tr> <th colspan="2">登陆信息:</th> </tr> <tr> <td width="90px" align="right">最后登陆IP:</td><td><asp:TextBox id="txtloginip" runat="server" CssClass="input required w160"></asp:TextBox></td> </tr> <tr> <td align="right">最后登陆时间:</td><td><asp:TextBox ID="txtlogintime" runat="server" CssClass="input Wdate w160 required" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})"></asp:TextBox></td> </tr> <tr> <td align="right"> 登陆次数 : </td> <td> <asp:TextBox ID="txtlogincount" runat="server" CssClass="input w160"></asp:TextBox> </td> </tr> </table> <div class="spClear"></div> <table class="formTable" width="380"> <tr> <th colspan="2">其它信息:</th> </tr> <tr> <td width="70" align="right"> 客服专员 : </td> <td> <asp:TextBox ID="txtsupport" runat="server" CssClass="input w160"></asp:TextBox> </td> </tr> <tr> <td align="right"> 推&nbsp;&nbsp;荐&nbsp;&nbsp;人: </td> <td> <asp:TextBox ID="txtinviter" runat="server" CssClass="input w160"></asp:TextBox>(限定为用户名) </td> </tr> <tr> <td align="right">站内信息:</td><td>消息:<asp:Label ID="lbchat" runat="server"></asp:Label>(条)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;短信:<asp:Label ID="lbmsg" runat="server"></asp:Label>(条)</td> </tr> <tr> <td align="right">更新时间:</td><td><asp:Label ID="lblastedittime" runat="server"></asp:Label></td> </tr> </table> <%} %> </td> </tr> </table> <div style="margin-top:10px; margin-left:180px"> <asp:Button ID="btnSave" runat="server" Text="确认保存" CssClass="submit" onclick="btnSave_Click" /><input name="重置" type="reset" class="submit" value="重置" /> </div> </form> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/member/memberinfo.aspx
ASP.NET
oos
20,090
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TREC.ECommerce; using TREC.Entity; using TRECommon; namespace TREC.Web.Admin.member { public partial class membergrouplist : AdminPageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ShowData(); } } protected void ShowData() { if (ECommon.QueryEdit == "2" && ECommon.QueryId != "") { ECMember.DeletEnMemberGroup(TypeConverter.StrToInt(ECommon.QueryId)); } rptList.DataSource = ECMember.GetMemberGroupList(ECommon.QueryPageIndex, AspNetPager1.PageSize, "", out tmpPageCount); rptList.DataBind(); AspNetPager1.RecordCount = tmpPageCount; } protected void lbtnDel_Click(object sender, EventArgs e) { string idlist=""; for (int i = 0; i < rptList.Items.Count; i++) { string id = ((Label)rptList.Items[i].FindControl("lb_id")).Text; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("cb_id"); if (cb.Checked) { idlist += id + ","; } } if (idlist.Length > 0) { ECMember.DeletEnMemberGroupByIdList(idlist.EndsWith(",") ? idlist.Substring(0, idlist.Length - 1) : idlist); UiCommon.JscriptPrint(this.Page, "批量删除成功!", "MemberGrouplist.aspx?page="+ECommon.QueryPageIndex, "Success"); } } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/member/membergrouplist.aspx.cs
C#
oos
1,776
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="membergroupinfo.aspx.cs" Inherits="TREC.Web.Admin.member.membergroupinfo" %> <%@ Import Namespace="TREC.ECommerce" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery.validate.min.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery.form.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/additional-methods.js"></script> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/messages_cn.js"></script> <script type="text/javascript"> $(function () { //表单验证JS $("#form1").validate({ //出错时添加的标签 errorElement: "span", showErrors: function (errorMap, errorList) { if (errorList.length > 0) { if ($("#" + errorList[0].element.id).next() != null) { $("#" + errorList[0].element.id).next().remove(); } } this.defaultShowErrors(); }, success: function (label) { //正确时的样式 label.text(" ").addClass("success"); } }); }); </script> </head> <body style="padding:10px;"> <form id="form1" runat="server"> <div class="navigation"> <span class="back"><a href="actionlist.aspx">返回列表</a></span><b>您当前的位置:首页 &gt; 会员管理 &gt; 会员组</b> </div> <div class="spClear"></div> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable"> <tr> <th colspan="2" align="left">会员组</th> </tr> <tr> <td width="100px" align="right">会员组名称:</td> <td > <asp:TextBox id="txttitle" runat="server" CssClass="input w160 required"></asp:TextBox> </td> </tr> <tr> <td align="right"> 颜色 : </td> <td height="25" width="*"> <asp:TextBox ID="txtcolor" runat="server" CssClass="w160 input"></asp:TextBox> </td> </tr> <tr> <td align="right"> 组图片 : </td> <td height="25" width="*"> <asp:TextBox ID="txtavatar" runat="server" CssClass="w160 input"></asp:TextBox> </td> </tr> <tr> <td align="right"> 积分 : </td> <td height="25" width="*"> <asp:TextBox ID="txtintegral" runat="server" CssClass="w160 input required number">0</asp:TextBox> </td> </tr> <tr> <td align="right"> 金额 : </td> <td height="25" width="*"> <asp:TextBox ID="txtmoney" runat="server" CssClass="w160 input required number">0</asp:TextBox> </td> </tr> <tr> <td align="right"> 权限 : </td> <td height="25" width="*"> <asp:TextBox ID="txtpermissions" runat="server" CssClass="w160 input"></asp:TextBox> </td> </tr> <tr> <td align="right"> 级别 : </td> <td height="25" width="*"> <asp:TextBox ID="txtlev" runat="server" CssClass="w160 input required digits">1</asp:TextBox> </td> </tr> <tr> <td align="right"> 描述 : </td> <td height="25" width="*"> <asp:TextBox ID="txtdescript" runat="server" CssClass=" w380 textarea" Rows="3" TextMode="MultiLine"></asp:TextBox> </td> </tr> <tr> <td align="right"> 排序: </td> <td> <asp:TextBox ID="txtsort" runat="server" Width="40px" CssClass="input required digits">0</asp:TextBox> </td> </tr> </table> <div style="margin-top:10px; margin-left:110px"> <asp:Button ID="btnSave" runat="server" Text="确认保存" CssClass="submit" onclick="btnSave_Click" /><input name="重置" type="reset" class="submit" value="重置" /> </div> </form> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/member/membergroupinfo.aspx
ASP.NET
oos
5,001
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TRECommon; using TREC.ECommerce; using TREC.Entity; namespace TREC.Web.Admin.member { public partial class memberinfo : AdminPageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //账号类型 ddlmembertype.Items.Clear(); WebControlBind.DrpBind(typeof(EnumMemberType), ddlmembertype); ddlmembertype.Items.Insert(0, new ListItem("请选择", "")); ddlmembergroup.DataSource=ECMember.GetMemberGroupList(""); ddlmembergroup.DataTextField = "title"; ddlmembergroup.DataValueField = "id"; ddlmembergroup.DataBind(); ddlmembergroup.Items.Insert(0, new ListItem("请选择", "")); ShowData(); } } protected void ShowData() { if (ECommon.QueryId != "" && ECommon.QueryEdit != "") { EnMember model = ECMember.GetMemberInfo(" where id=" + ECommon.QueryId); if (model != null) { ddlmembertype.Enabled = false; this.txtusername.Text = model.username; this.lbpassport.Text = model.passport; this.ddlmembertype.SelectedValue = model.type.ToString(); this.ddlmembertype.Enabled = false; this.ddlmembergroup.SelectedValue = model.groupid.ToString(); this.txtsound.Text = model.sound; this.txttname.Text = model.tname; this.txtemail.Text = model.email; this.txtgender.Text = model.gender.ToString(); this.txtmobile.Text = model.mobile; this.txtphone.Text = model.phone; this.txtmsn.Text = model.msn; this.txtqq.Text = model.qq; this.txtskype.Text = model.skype; this.txtali.Text = model.ali; this.txtbirthdate.Text = model.birthdate.ToString(); this.txtareacode.Text = model.areacode; this.txtaddress.Text = model.address; this.txtdepartment.Text = model.department; this.txtcareer.Text = model.career; this.txtsms.Text = model.sms.ToString(); this.txtintegral.Text = model.integral.ToString(); this.txtmoney.Text = model.money.ToString(); this.txtbank.Text = model.bank; this.txtaccount.Text = model.account; this.txtalipay.Text = model.alipay; this.txtregip.Text = model.regip; this.txtregtime.Text = model.regtime.ToString(); this.txtloginip.Text = model.loginip; this.txtlogintime.Text = model.logintime.ToString(); this.txtlogincount.Text = model.logincount.ToString(); this.ravemail.SelectedValue = model.vemail.ToString(); this.ravmobile.SelectedValue = model.vmobile.ToString(); this.ravname.SelectedValue = model.vname.ToString(); this.ravbank.SelectedValue = model.vbank.ToString(); this.ravcompany.SelectedValue = model.vcompany.ToString(); this.ravalipay.SelectedValue = model.valipay.ToString(); this.txtsupport.Text = model.support; this.txtinviter.Text = model.inviter; this.lblastedittime.Text = model.lastedittime.ToString(); this.lbchat.Text = model.chat.ToString(); this.lbmsg.Text = model.message.ToString(); } } else { txtregip.Text = WebRequest.GetIP(); txtregtime.Text = DateTime.Now.ToString("yyyy-MM-dd hh:mm"); txtbirthdate.Text = "1900-01-01 00:00:00"; txtsms.Text = "0"; txtintegral.Text = "0"; txtmoney.Text = "0"; txtloginip.Text = WebRequest.GetIP(); txtlogintime.Text = "1900-01-01 00:00:00"; txtlogincount.Text = "0"; ddlmembertype.SelectedValue = ((int)EnumMemberType.个人成员).ToString(); ddlmembertype.Enabled = false; } } protected void btnSave_Click(object sender, EventArgs e) { EnMember model = null; string strErr = ""; if (strErr != "") { //MessageBox.Show(this, strErr); return; } string username = this.txtusername.Text; string password = this.txtpassword.Text; string paypassword = this.txtpaypassword.Text; int type = TypeConverter.StrToInt(this.ddlmembertype.SelectedValue); int groupid = TypeConverter.StrToInt(ddlmembergroup.SelectedValue); string sound = this.txtsound.Text; string tname = this.txttname.Text; string email = this.txtemail.Text; int gender = TypeConverter.StrToInt(this.txtgender.Text); string mobile = this.txtmobile.Text; string phone = this.txtphone.Text; string msn = this.txtmsn.Text; string qq = this.txtqq.Text; string skype = this.txtskype.Text; string ali = this.txtali.Text; DateTime birthdate = DateTime.Parse(this.txtbirthdate.Text); string areacode = this.txtareacode.Text; string address = this.txtaddress.Text; string department = this.txtdepartment.Text; string career = this.txtcareer.Text; string bank = this.txtbank.Text; string account = this.txtaccount.Text; string alipay = this.txtalipay.Text; int vemail = TypeConverter.StrToInt(this.ravemail.SelectedValue); int vmobile = TypeConverter.StrToInt(this.ravmobile.SelectedValue); int vname = TypeConverter.StrToInt(this.ravname.SelectedValue); int vbank = TypeConverter.StrToInt(this.ravbank.SelectedValue); int vcompany = TypeConverter.StrToInt(this.ravcompany.SelectedValue); int valipay = TypeConverter.StrToInt(this.ravalipay.SelectedValue); string support = this.txtsupport.Text; string inviter = this.txtinviter.Text; DateTime lastedittime = DateTime.Now; if (ECommon.QueryId != "" && ECommon.QueryEdit != "") { model = ECMember.GetMemberInfo(" where id=" + ECommon.QueryId); model.id = TypeConverter.StrToInt(ECommon.QueryId); if (txtpassword.Text == "") { model.password = model.password; } else { model.password = MyMD5.GetMD5(txtpassword.Text); } if (txtpaypassword.Text == "") { model.paypassword = model.paypassword; } else { model.paypassword = MyMD5.GetMD5(txtpaypassword.Text); } } if(model==null) { model = new EnMember(); model.chat = 0; model.message = 0; model.logincount = 0; model.regip = WebRequest.GetIP(); model.regtime = DateTime.Now ; model.passport = ""; model.auth = ""; model.authvalue = ""; model.authtime = TypeConverter.StrToDateTime("1900-1-1 00:00:00"); model.support = ""; model.inviter = ""; model.loginip = WebRequest.GetIP(); model.logintime = TypeConverter.StrToDateTime("1900-1-1 00:00:00"); model.password = MyMD5.GetMD5(password); model.paypassword = MyMD5.GetMD5(paypassword); } model.username = username; model.type = type; model.groupid = groupid; model.sound = sound; model.tname = tname; model.email = email; model.gender = gender; model.mobile = mobile; model.phone = phone; model.msn = msn; model.qq = qq; model.skype = skype; model.ali = ali; model.birthdate = birthdate; model.areacode = areacode; model.address = address; model.department = department; model.career = career; model.bank = bank; model.account = account; model.alipay = alipay; model.vemail = vemail; model.vmobile = vmobile; model.vname = vname; model.vbank = vbank; model.vcompany = vcompany; model.valipay = valipay; model.support = support; model.inviter = inviter; model.lastedittime = lastedittime; int aid = ECMember.EditMember(model); if (aid > 0) { UiCommon.JscriptPrint(this.Page, "编辑成功!", "memberlist.aspx", "Success"); } } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/member/memberinfo.aspx.cs
C#
oos
10,055
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TREC.ECommerce; using TREC.Entity; using TRECommon; namespace TREC.Web.Admin.member { public partial class memberlist : AdminPageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //账号类型 ddlmembertype.Items.Clear(); WebControlBind.DrpBind(typeof(EnumMemberType), ddlmembertype); ddlmembertype.Items.Insert(0, new ListItem("请选择", "")); ddlmembergroup.DataSource = ECMember.GetMemberGroupList(""); ddlmembergroup.DataTextField = "title"; ddlmembergroup.DataValueField = "id"; ddlmembergroup.DataBind(); ddlmembergroup.Items.Insert(0, new ListItem("请选择", "")); ShowData(); } } protected void ShowData() { if (ECommon.QueryEdit == "2" && ECommon.QueryId != "") { ECMember.DeletEnMember(TypeConverter.StrToInt(ECommon.QueryId)); } string strWhere = " 1=1 "; if (txtUserName.Text != "") { strWhere += " and username like '%" + txtUserName.Text + "%'"; } if (ddlmembergroup.SelectedValue != "") { strWhere += " and groupid=" + ddlmembergroup.SelectedValue; } if (ddlmembertype.SelectedValue != "") { strWhere += " and type=" + ddlmembertype.SelectedValue; } rptList.DataSource = ECMember.GetMemberList(ECommon.QueryPageIndex, AspNetPager1.PageSize, strWhere, out tmpPageCount); rptList.DataBind(); AspNetPager1.RecordCount = tmpPageCount; } //protected void ddlmembertype_SelectedIndexChanged(object sender, EventArgs e) //{ //} //protected void ddlmembergroup_SelectedIndexChanged(object sender, EventArgs e) //{ //} protected void btnSearch_Click(object sender, EventArgs e) { ShowData(); } protected void lbtnDel_Click(object sender, EventArgs e) { string idlist = ""; for (int i = 0; i < rptList.Items.Count; i++) { string id = ((Label)rptList.Items[i].FindControl("lb_id")).Text; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("cb_id"); if (cb.Checked) { idlist += id + ","; } } if (idlist.Length > 0) { ECMember.DeletEnMemberByIdList(idlist.EndsWith(",") ? idlist.Substring(0, idlist.Length - 1) : idlist); UiCommon.JscriptPrint(this.Page, "批量删除成功!", "memberlist.aspx", "Success"); } } } }
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/member/memberlist.aspx.cs
C#
oos
3,151
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="membergrouplist.aspx.cs" Inherits="TREC.Web.Admin.member.membergrouplist" %> <%@ Import Namespace="TREC.ECommerce" %> <%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <script type="text/javascript" src="<%=ECommon.WebResourceUrl %>/script/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="../script/admin.js"></script> <script type="text/javascript"> $(function () { $(".msgtable tr:nth-child(odd)").addClass("tr_bg"); //隔行变色 $(".msgtable tr").hover( function () { $(this).addClass("tr_hover_col"); }, function () { $(this).removeClass("tr_hover_col"); } ); }) </script> </head> <body style="padding:10px;"> <form id="form1" runat="server"> <div class="navigation"> <span class="add"><a href="membergroupinfo.aspx">添加会员组</a></span><b>您当前的位置:首页 &gt; 会员管理 &gt; 会员组</b> </div> <div class="spClear"></div> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable"> <tr> <th width="40px" align="center">选择</th> <th width="40px" align="center">编号</th> <th align="left">名称</th> <th width="60px" align="center">积分</th> <th width="60px" align="center">金钱</th> <th width="60px" align="center">级别</th> <th width="80px" align="right" style="padding-left:5px;">操作</th> </tr> <asp:Repeater ID="rptList" runat="server"> <ItemTemplate> <tr> <td align="center"><asp:CheckBox ID="cb_id" CssClass="checkall" runat="server" /></td> <td align="center"><asp:Label ID="lb_id" runat="server" Text='<%#Eval("Id")%>'></asp:Label></td> <td align="left"><a href="membergroupinfo.aspx?edit=1&id=<%#Eval("id") %>"><%#Eval("title") %></a></td> <td align="center"><%#Eval("integral")%></td> <td align="center"><%#Eval("money")%></td> <td align="center"><%#Eval("lev")%></td> <td align="right" style="padding-left:5px;"><a href="membergroupinfo.aspx?edit=1&id=<%#Eval("id") %>">修改</a>|<a href="membergroupinfo.aspx?edit=2&id=<%#Eval("id") %>">删除</a></td> </tr> </ItemTemplate> </asp:Repeater> </table> <div class="spClear"></div> <div style="line-height:30px;height:30px;"> <div id="Pagination" class="right flickr"> <webdiyer:AspNetPager ID="AspNetPager1" runat="server" AlwaysShow="true" UrlPaging="true" FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页"> </webdiyer:AspNetPager> </div> <div class="left"> <span class="btn_all" onclick="checkAll(this);">全选</span> <span class="btn_bg"> <asp:LinkButton ID="lbtnDel" runat="server" OnClientClick="return confirm( '确定要删除这些记录吗? ');" OnClick="lbtnDel_Click" >删 除</asp:LinkButton>&nbsp;&nbsp; </span> </div> </div> </form> </body> </html>
10aaa-10aaa
trunk/TRECommerce/TREC.Web/Admin/member/membergrouplist.aspx
ASP.NET
oos
3,478