toolbarMoreSettingList.jsp 15.9 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%>

<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<html>
  <head>
    <LINK href="/css/Weaver_wev8.css" type="text/css" rel=STYLESHEET>
	<SCRIPT language="javascript" src="/js/weaver_wev8.js"></script>
	<SCRIPT language="javascript" src="/page/layoutdesign/js/jquery-ui_wev8.js"></script>
	
	<link rel="stylesheet" href="/css/ecology8/request/requestTopMenu_wev8.css" type="text/css" />
	<style type="text/css" >
		.itemicon{ 
			float:left;
			width:25px;
			height:100%;
		}
		.itemicon img{ 
			max-width:100%;
			max-height:100%;
		}
		.iconsetting {
		    color: #fff;
		    background-color: #30b5ff;
		    padding-left: 10px !important;
		    padding-right: 10px !important;
		   	margin-left: 5px;
		    height: 23px;
		    line-height: 22px;
		    vertical-align: middle;
		    border: 1px solid #30b5ff;
		    float:left;
		    cursor: pointer;
		}
	</style>
  </head>  
  <%
	if(user.getUID() !=1 && !HrmUserVarify.checkUserRight("Portal:toolBarMenu", user)){
		response.sendRedirect("/notice/noright.jsp");
		return;
	}
	String titlename=SystemEnv.getHtmlLabelName(128541,user.getLanguage());
	String sqlWhere=" "; 
	String resourceId = "1";	//toolbar默认使用1、0
	String resourceType = "0";
	String subCompanyId = ""+user.getUserSubCompany1();
%>

<body>
<jsp:include page="/systeminfo/commonTabHead.jsp">
   <jsp:param name="mouldID" value="portal"/>
   <jsp:param name="navName" value="<%=titlename%>"/>  
</jsp:include>
<%@ include file="/systeminfo/TopTitle_wev8.jsp" %>
<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp" %>
<%
	RCMenu += "{"+SystemEnv.getHtmlLabelName(611,user.getLanguage())+",javascript:onAdd(),_self} " ;
	RCMenuHeight += RCMenuHeightStep ;
	RCMenu += "{"+SystemEnv.getHtmlLabelName(91,user.getLanguage())+",javascript:onDel(),_self} " ;
	RCMenuHeight += RCMenuHeightStep ;
	RCMenu += "{"+SystemEnv.getHtmlLabelName(86,user.getLanguage())+",javascript:onSave(),_self} " ;
	RCMenuHeight += RCMenuHeightStep ;
%>
<%@ include file="/systeminfo/RightClickMenu_wev8.jsp" %>
	<table id="topTitle" cellpadding="0" cellspacing="0" width="100%">
		<tr>
			<td width="75px">					
			</td>
			<td class="rightSearchSpan" style="text-align:right; width:500px!important">
				<input type="button" value="<%=SystemEnv.getHtmlLabelName(611,user.getLanguage())%>" class="e8_btn_top" onclick="onAdd();" />
				<input type="button" value="<%=SystemEnv.getHtmlLabelName(91,user.getLanguage())%>" class="e8_btn_top" onclick="onDel();" />
				<input type="button" value="<%=SystemEnv.getHtmlLabelName(86,user.getLanguage())%>" class="e8_btn_top" onclick="onSave();"/>				
				<span title='<%=SystemEnv.getHtmlLabelName(83721,user.getLanguage())%>' class="cornerMenu"></span>
			</td>
		</tr>
	</table>
	<%
		//得到pageNum 与 perpage
		int perpage =10;
		String tableString="<table  pagesize=\""+perpage+"\" tabletype=\"checkbox\" valign=\"top\"  needPage=\"true\">"
		  + "<checkboxpopedom popedompara=\"column:type\"  showmethod=\"weaver.splitepage.transform.SptmForToolbar.isSys\"/>" 
		  + "<sql backfields=\"id,labelid,icon,isshow,url,linkmode,customname,type,shoposition\" sqlform=\" from toolbarmoremenuinfo \" sqlorderby=\" sortnum,id\" sqlsortway=\"ASC\"  sqlprimarykey=\"id\" sqlisdistinct=\"false\" />"+
			"<head >"+
				"<col width=\"5%\"   text=\""+SystemEnv.getHtmlLabelName(556,user.getLanguage())+"\"   column=\"id\"  transmethod=\"weaver.splitepage.transform.SptmForToolbar.getDragBtn\"/>"+
				"<col width=\"20%\"   text=\""+SystemEnv.getHtmlLabelName(18390,user.getLanguage())+"\"  column=\"id\"  otherpara=\"column:labelid+"+user.getLanguage()+"+column:customname\" transmethod=\"weaver.splitepage.transform.SptmForToolbar.getMenuNameInput\"/>"+
				"<col width=\"13%\"   text=\""+SystemEnv.getHtmlLabelName(22969,user.getLanguage())+"(18*18px)\"   column=\"id\"   otherpara=\"column:icon+"+user.getLanguage()+"\"  transmethod=\"weaver.splitepage.transform.SptmForToolbar.getIconSetting\"/>"+
				"<col width=\"8%\"   text=\""+SystemEnv.getHtmlLabelName(89,user.getLanguage())+"\"   column=\"id\"   otherpara=\"column:isshow\"  transmethod=\"weaver.splitepage.transform.SptmForToolbar.getIsShow\"/>"+
				"<col width=\"18%\"   text=\"URL\"   column=\"url\" otherpara=\"column:type\"   transmethod=\"weaver.splitepage.transform.SptmForToolbar.getUrl\"/>"+
				"<col width=\"14%\"   text=\""+SystemEnv.getHtmlLabelName(30173,user.getLanguage())+"\"   column=\"id\"   otherpara=\"column:linkmode+"+user.getLanguage()+"\"  transmethod=\"weaver.splitepage.transform.SptmForToolbar.getLinkType\"/>"+
				"<col width=\"14%\"   text=\""+SystemEnv.getHtmlLabelName(19989,user.getLanguage())+"\"   column=\"shoposition\"   otherpara=\""+user.getLanguage()+"\"  transmethod=\"weaver.splitepage.transform.SptmForToolbar.getShowPostion\"/>"+
				"<col width=\"8%\"   text=\""+SystemEnv.getHtmlLabelName(33466,user.getLanguage())+"\"   column=\"id\"   otherpara=\"column:labelid+"+user.getLanguage()+"+column:customname\"  transmethod=\"weaver.splitepage.transform.SptmForToolbar.getSettingJs\"/>"+
			"</head>"
			 + "</table>";						
		%>
<form id="settingform" name="settingform" method="post" action="/page/maint/toolbarmoresetting/toolbarMoreOperation.jsp">		
</form>	
	<TABLE width="100%">
		<TR>
			<TD valign="top">
				<wea:SplitPageTag  tableString="<%=tableString%>"  mode="run"   />
			</TD>
		</TR>
	</TABLE>
<jsp:include page="/systeminfo/commonTabFoot.jsp"></jsp:include>  
</body>
</html>
<!--For zDialog-->
<link rel="stylesheet" href="/wui/theme/ecology8/jquery/js/zDialog_e8_wev8.css"type="text/css"/>
<script language="javascript" src="/wui/theme/ecology8/jquery/js/zDialog_wev8.js"></script>
<script language="javascript" src="/wui/theme/ecology8/jquery/js/zDrag_wev8.js"></script>
<SCRIPT LANGUAGE="JavaScript">

	jQuery.fn.deleteSelectedRow = function (callback) {
		var table=jQuery(this);
		var selectedTrs=table.find("tr:has([name='chkInTableTag']:checked)");
		if(selectedTrs.size()==0){
			window.top.Dialog.alert(SystemEnv.getHtmlNoteName(3529,readCookie("languageidweaver")));
			return;
		}
		window.top.Dialog.confirm(SystemEnv.getHtmlNoteName(3580,readCookie("languageidweaver")),function(){

			try{
				callback();
			}catch(e){
			}
			selectedTrs.each(function(){
				jQuery(this).next("tr.Spacing").remove();
				jQuery(this).remove();
				table.children("tbody tr.Spacing:last").children("td").attr("class","paddingLeft0Table");
			});
		});
	}
	function onSetting(id,text){
		var url = "/page/maint/common/commonShare.jsp?type=toolbarm&id="+id+"&resourceId=<%=resourceId%>&resourceType=<%=resourceType%>&subCompanyId=<%=subCompanyId%>";
	 	var title = "<%=SystemEnv.getHtmlLabelName(33466, user.getLanguage())%>:"+text; 
	 	showDialogWin(title,url,650,480);
	}
	function onAdd(){
		var newRow = '<tr class="newRow" >';
		newRow += '<td _notitle="true" style="vertical-align: middle;"><input type="checkbox" value="" name="chkInTableTag"></td>'
			+ '<td ></td>'
			+'<td align="left"style="vertical-align: middle;"><input class="inputStyle itemname" maxlength="50" required=true name="itemname" id="itemname_" onchange="checkinputNoSpan(this)" /><IMG src="/images/BacoError_wev8.gif" align=absMiddle/></td>'
			+'<td><div class="itemicon"><img src="" id="icon_"/></div><div class="iconsetting" onclick="setIcon(this)"><%=SystemEnv.getHtmlLabelName(126779,user.getLanguage())%></div></td>'
			+'<td><input type=checkbox name="isshow" id="isshow_" onclick="isShow(this)"/></td>'
			+'<td><input class="inputStyle urldata" maxlength="100" name="urldata" id="urldata_"  _noMultiLang="true" ></td>'
			+ '<td ><select><option value="0"><%=SystemEnv.getHtmlLabelName(83868,user.getLanguage())%></option><option value="1"><%=SystemEnv.getHtmlLabelName(19498,user.getLanguage())%></option><option value="2"><%=SystemEnv.getHtmlLabelName(19497,user.getLanguage())%></option></select></td>'
			+'<td><select><option value="0"><%=SystemEnv.getHtmlLabelName(332, user.getLanguage()) %></option><option value="1"><%= SystemEnv.getHtmlLabelName(33675, user.getLanguage()) %></option><option value="2"><%=SystemEnv.getHtmlLabelName(33676, user.getLanguage()) %></option></select></td>'
			+'<td><img src="/images/homepage/menu/setting_1_wev8.png" onclick="alert(\'<%=SystemEnv.getHtmlLabelName(30776, user.getLanguage()) %>\')"/></td>'
		newRow += '</tr>';
		$(".ListStyle").append(newRow)
		$(".newRow").jNice(); 
		__jNiceNamespace__.beautySelect()
	}
	function onDel(){
		
		$(".ListStyle").deleteSelectedRow(function(){
			var seletRow  = _xtable_CheckedCheckboxId();
			if(seletRow.match(/,$/g) != null){
				seletRow = seletRow.substring(0,seletRow.length-1)
			}
			$.post("/page/maint/toolbarmoresetting/toolbarMoreOperation.jsp",
					{method:"del",delids:seletRow},
					function(result){
						if(result.trim() == 'ok'){
							_table.reLoad()
						}
					})
		});
	}
	function onSave(){
		if($("input[name=itemname]").next().length >0){
			Dialog.alert('<%=SystemEnv.getHtmlLabelName(30933, user.getLanguage()) %>!');
			return;
		}
		var sendData = "";
		var sorNum = (_table.nowPage-1)*_table.pagesize +1 ;
		
		var rows= $(".ListStyle tr[class!=HeaderForXtalbe][class!=Spacing]");
		//$(".ListStyle tr[class=],.ListStyle tr[class=newRow]");
		for(var i =0;i< rows.length;i++){
			var row = rows[i]
			var tds = $(row).find('td')
			var id = $(row).find('td:first input').attr('id');//$(row).find('td:first input').attr('checkboxid') ||  
			if( id==undefined ||  id==null){
				id ="";
			}else{
				id =id.replace("_xTable_","")
			}
			var keySplit = ":mh:";
			var itemSplit=",dh,";
			var lineSplit=";fh;"
			var lineStr = "id"+keySplit+id+itemSplit+ "sortnum"+keySplit+sorNum;
			sorNum++;
			for(var j =0;j< tds.length;j++){
				if(j<2 || j ==8){
					continue;
				}
				var td = tds[j];
				
				switch(j){
					case 2:
						var mlang = $(td).find("[name=__multilangpre_itemname]").val()
						var rtitle = $(td).find(".itemname").val()
						lineStr +=itemSplit+ "name"+keySplit+(mlang || rtitle);
						break;
					case 3:
						lineStr += itemSplit+ "icon"+keySplit+$(td).find("img").attr('src');
						break;
					case 4:
						lineStr += itemSplit+ "isshow"+keySplit+($(td).find("input").attr('checked') ? "1" :"0");
						break;
					case 5:
						lineStr += itemSplit+ "url"+keySplit+($(td).find(".urldata").length>0 ? $(td).find(".urldata").val() :$(td).text());
						break;
					case 6:
						lineStr += itemSplit+ "linkmode"+keySplit+$(td).find("select").val();
						break;
					case 7:
						lineStr += itemSplit+ "shoposition"+keySplit+$(td).find("select").val();
						break;
				}
			}
			if(i ==0){
				sendData = lineStr
			}else{
				sendData+=lineSplit+lineStr
			}
		}
		if(sendData != ""){
			$.post("/page/maint/toolbarmoresetting/toolbarMoreOperation.jsp",
					{method:"save",senddata:sendData},
					function(result){
						if(result.trim() == 'ok'){
							_table.reLoad()
						}
					}
				)
		}
	}
	function setIcon(obj){
		var img = $(obj).prev().find("img");
		var isSingle = "";
		var tempFile=img.attr("src");
		
		var width = top.document.body.clientWidth-100;
		var height = top.document.body.clientHeight-100;
		
		var pos=tempFile.indexOf("/page/resource/userfile/");
		if(pos!=-1) tempFile=tempFile.substring(pos+24);
		
		var url="/page/maint/common/CustomResourceMaint.jsp?isDialog=1&?file="+tempFile+"&isSingle="+isSingle;
		
		showDialogWin("",url,width,height,function(ret,datas){
			if (datas!=null&&datas.id!="false"){
				img.attr("src",datas.id)
			}
		});
	}
	function showDialogWin(title,url,width,height,callback){
		var Show_dialog = new window.top.Dialog();
		Show_dialog.currentWindow = window;   //传入当前window
	 	Show_dialog.Width = width;
	 	Show_dialog.Height = height;
	 	Show_dialog.Modal = true;
	 	Show_dialog.Title = title;
	 	Show_dialog.URL = url;
	 	if(callback){
	 		Show_dialog.callbackfun=function(ret,datas){
	 			callback(ret,datas)
			}
	 	}
	 	Show_dialog.show();
	}
		
	$(document).ready(function(){
		$('.drag').live("mouseover",function(){
			this.src='/proj/img/move-hot_wev8.png'
	    }).live("mouseout",function(){
	    	this.src='/proj/img/move_wev8.png'
	    });
		
		$("#changetoplang").bind("change",function(){
			$(".topmenuname").hide();
			if($(this).val()!="customMenuName"){
				$("#topMenuNamespan").hide();
			}else{
				$("#topMenuNamespan").show();
			}
			$("#"+$(this).val()).show();
		})
	});
	function afterDoWhenLoaded(){
		$('th[_itemid=4]').html('<input type="checkbox" id="showCheckAll" onclick="checkAll(this)"/>'+$('th[_itemid=4]').text())
		$("th").jNice(); 
		
		registerDragEvent();
		$("input[name=itemname]").change(function(){
			checkinputNoSpan(this)
		})
	}
	function checkAll(obj){
		if($(obj).attr('checked')){
			$(".ListStyle input[name=isshow]").trigger("checked",true)
		}else{
			$(".ListStyle input[name=isshow]").trigger("checked",false)
		}
	}
	
	function registerDragEvent() {
		var fixHelper = function(e, ui) {
			ui.children().each(function() {
			    $(this).width($(this).width()); // 在拖动时,拖动行的cell(单元格)宽度会发生改变。在这里做了处理就没问题了

			    $(this).height($(this).height());
			});
			return ui;
		};

		var copyTR = null;
		var startIdx = 0;

		var idStr = ".ListStyle";
		
		jQuery(idStr + " tbody tr").bind("mousedown", function(e) {
			copyTR = jQuery(this).next("tr.Spacing");
		});
	        
	    jQuery(idStr + " tbody").sortable({ // 这里是talbe tbody,绑定 了sortable
	        helper: fixHelper, // 调用fixHelper
	        axis: "y",
	        start: function(e, ui) {
	            ui.helper.addClass("e8_hover_tr") // 拖动时的行,要用ui.helper
	            if(ui.item.hasClass("notMove")) {
	            	e.stopPropagation && e.stopPropagation();
	            	e.cancelBubble = true;
	            }
	            if(copyTR) {
	       			copyTR.hide();
	       		}
	       		startIdx = ui.item.get(0).rowIndex;
	            return ui;
	        },
	        stop: function(e, ui) {
	            ui.item.removeClass("e8_hover_tr"); // 释放鼠标时,要用ui.item才是释放的行
	        	if(ui.item.get(0).rowIndex < 1) { // 不能拖动到表头上方

	                if(copyTR) {
	           			copyTR.show();
	           		}
	        		return false;
	        	}
	           	if(copyTR) {
		       	  	/* if(ui.item.get(0).rowIndex > startIdx) {
		        	  	ui.item.before(copyTR.clone().show());
					}else {
		        	  	ui.item.after(copyTR.clone().show());
					} */
					if(ui.item.prev("tr").attr("class") == "Spacing") {
						ui.item.after(copyTR.clone().show());
					}else {
						ui.item.before(copyTR.clone().show());
					}
		       	  	copyTR.remove();
		       	  	copyTR = null;
	       		}
	           	return ui;
	        }
	    });
	}
	// 取消输入框后面跟随的红色惊叹号
	function checkinpute8(obj,spanid){
	    var tmpvalue = obj.value;
	    //alert(tmpvalue)
	    while(tmpvalue.indexOf(" ") >= 0){
	        tmpvalue = tmpvalue.replace(" ", "");
	    }
	    if(tmpvalue != ""){
	        while(tmpvalue.indexOf("\r\n") >= 0){
	            tmpvalue = tmpvalue.replace("\r\n", "");
	        }
	        if(tmpvalue != ""){
	            $(obj).siblings("#"+spanid).html("");
	        }else{
	            $(obj).siblings("#"+spanid).html("<IMG src='/images/BacoError_wev8.gif' align=absMiddle>");
	        }
	    }else{
	        $(obj).siblings("#"+spanid).html("<IMG src='/images/BacoError_wev8.gif' align=absMiddle>");
	    }
	}
	// 取消输入框后面跟随的红色惊叹号
	function checkinputNoSpan(obj){
	    var tmpvalue = $(obj).val();
	    if(tmpvalue.trim() != ""){
	        while(tmpvalue.indexOf("\r\n") >= 0){
	            tmpvalue = tmpvalue.replace("\r\n", "");
	        }
	        if(tmpvalue != ""){
	        	try{
	        		$(obj).next().remove();
	        	}catch(e){
	        	}
	        }else{
	        	$(obj).parent().append('<IMG src="/images/BacoError_wev8.gif" align=absMiddle>') 
	        }
	    }else{
	    	 $(obj).parent().append('<IMG src="/images/BacoError_wev8.gif" align=absMiddle>') 
	    }
	}
</SCRIPT>