`

Infoshare后台管理系统-->栏目参数配置

阅读更多
<%@ page pageEncoding="UTF-8"%>
<%@ page language="java" import="java.util.*" errorPage=""%>
<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="newstag" uri="http://www.sobey.com/news/taglib/news"%>
<script type="text/javascript"
src="<%=request.getContextPath()%>/scripts/tree/jquery.js" /></script>
<script type="text/javascript"
src="<%=request.getContextPath()%>/widgets/ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript"
src="<%=request.getContextPath()%>/widgets/ext/ext-all.js"></script>
<script type="text/javascript"
src="<%=request.getContextPath()%>/widgets/ext/resources/dateTimeFieldAddSecond.js" /></script>
<script type="text/javascript"
src="<%=request.getContextPath()%>/scripts/tree/tree.js" /></script>
<script type="text/javascript"
src="<%=request.getContextPath()%>/scripts/tree/hpmIconBinding.js" /></script>
<script type="text/javascript"
src="<%=request.getContextPath()%>/scripts/tree/hpmsBusinessBehaviorStore.js" /></script>
<link rel="stylesheet" type="text/css"
href="<%=request.getContextPath()%>/css/tree2.css" />
<link rel="stylesheet" type="text/css"
href="<%=request.getContextPath()%>/styles/css.css" />
<link rel="stylesheet" type="text/css"
href="<%=request.getContextPath()%>/widgets/ext/resources/css/ext-all.css" />
<link rel="STYLESHEET" type="text/css"
href="<%=request.getContextPath()%>/styles/page.css" />
<script type="text/javascript">
Ext.BLANK_IMAGE_URL = '<c:url value="/widgets/ext/resources/images/default/s.gif"/>';
var folderSelector = null;
</script>

<html>
<script language="javascript" type="text/javascript">
</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
</head>
<body onload="">
<%@ include file="/widgets/peopleTree/treeV3.jsp"%>
<table height="40" border="0" style="margin-left: 10px; margin-top: 5px"
cellpadding="0" cellspacing="0">

<tr>
<%--左侧树形框--%>
<td valign="top" height="660">
<table width="320" height="660" cellpadding="0" cellspacing="0"
bordercolorlight="#FFFFFF" bordercolordark="#003366" border="1"
bgcolor="#535552" style="margin-left: 10px; margin-top: 3px">
<tr>
<td align="left" valign="top" height="100%">
<div id="exttree-div" style="width: 250px;"></div>
</td>
</tr>
</table>
</td>
<%--右侧列表框--%>
<td>
<table width="640" height="660" cellpadding="0" cellspacing="0"
bordercolorlight="#FFFFFF" bordercolordark="#003366" border="1"
bgcolor="#535552" style="margin-left: 10px; margin-top: 3px">
<tr>
<td align="left" valign="top" height="100%">
<div id="scoreGrade_center" oncontextmenu="return false;">
<div id="list_grid_panel" style="width: 100%; height: 100%;"></div>
<div id="listColumnPolicy"></div>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- 栏目策略设置  -->
<div id="editColumnPolicy_Panel"
style="visibility: hidden; position: absolute; top: 0px">
<div class="x-dlg-hd"><bean:message
key="columnpolicy.label.titleSet" /></div>
<div class="x-dlg-bd">
<div class="x-dlg-tab"
title="<bean:message key="columnpolicy.label.titleSet"/>">
<div class="inner-tab">
<form id="editColumnPolicyForm" method="POST"
action="<c:url value='/channel/saveColumnPolicy.do'/>">
<table border="0" width="100%" cellpadding="0" cellspacing="0"
align="left" style="margin: 10px 0px 0px 15px" id="policyTab">
<tr class="utype">
<td height="25" align="left" width="120"><bean:message
key="columnpolicy.label.useType" />:</td>
<td align="left"><newstag:basicdatalist showtype="select"
uniquename="useType" key="${columnPolicy.usetype}"
id="columnPolicy.usetype" name="columnPolicy.usetype">
<option></option>
</newstag:basicdatalist></td>
</tr>

<tr>
<td height="25" align="left" width="120"><bean:message
key="columnpolicy.label.sendType" />:</td>
<td align="left"><newstag:basicdatalist showtype="select"
uniquename="sendtype" key="${columnPolicy.sendtype}"
id="columnPolicy.sendtype" name="columnPolicy.sendtype">
<option></option>
</newstag:basicdatalist></td>
</tr>

<tr>
<td height="25" align="left" width="120"><bean:message
key="columnpolicy.label.serverIp" />:</td>
<td align="left"><input name="columnPolicy.serverip"
id="columnPolicy.serverip" type="text" size="10"></td>
</tr>
<tr>
<td height="25" align="left" width="120"><bean:message
key="columnpolicy.label.mosId" />:</td>
<td align="left"><input name="columnPolicy.mosid"
id="columnPolicy.mosid" type="text" size="10"></td>
</tr>

<tr>
<td height="25" align="left" width="120"><bean:message
key="columnpolicy.label.isChannel" />:</td>
<td align="left"><newstag:basicdatalist showtype="select"
uniquename="ischannel" key="" id="columnPolicy.ischannel"
name="columnPolicy.ischannel">
<option></option>
</newstag:basicdatalist> <input type="hidden" id="columnPolicy.policyid"
name="columnPolicy.policyid" value="${columnPolicy.policyid}">
<input type="hidden" id="columnPolicy.columnid"
name="columnPolicy.columnid" value="${columnPolicy.columnid}">
</td>
</tr>

<tr>
<td height="25" align="left" width="120">备注:</td>
<td align="left"><textarea rows="3" cols="15"
name="columnPolicy.notes" id="columnPolicy.notes"><c:out
value="${columnPolicy.notes}" /></textarea></td>
</tr>

</table>
</form>
</div>
</div>
</div>
</div>


<!-- 栏目参数配置 -->
<div id="columnPathConfig_Panel"
style="visibility: hidden; position: absolute; top: 0px">
<div class="x-dlg-hd"><bean:message
key="columnpolicy.label.columnPathConfig" /></div>
<div class="x-dlg-bd">
<div class="x-dlg-tab"
title="<bean:message key="columnpolicy.label.columnPathConfig"/>">
<div class="inner-tab">
<form id="editColumnPathConfigForm" method="POST"
action="<c:url value='/channel/saveColumnPathConfig.do'/>">
    <div id="treeSelector" style="display: none;"></div>
<table id="cmsdata" border="0" width="100%" cellpadding="0" cellspacing="0"
align="left" style="margin: 10px 0px 0px 15px">
<tr><td height="25"></td></tr>
<c:forEach var="t" items="${basicDataType}">
<tr class="program" typeid="${t.id}">
<td height="25" align="left" width="180">${t.data}节目目录:</td>
<td align="left">
    <input name="basicDataType_programid" class='folderId' type="text" size="10" readonly="readonly" />
<input type="button" value="选择" siteType="${t.id}" class="folderSelector" />
<input type="hidden" class="siteId" name="siteidContainer"/>
</td>
</tr>
<tr class="material" typeid="${t.id}">
<td height="25" align="left" width="180">${t.data}素材目录:</td>
<td align="left">
    <input name="basicDataType_materialid" type="text" size="10" class='folderId' readonly="readonly" />
<input type="button" value="选择" siteType="${t.id}" class="folderSelector" />
<input type="hidden" class="siteId" name="siteidContainer"/>
</td>
</tr>
</c:forEach>
<tr>
<td><bean:message key="columnpolicy.label.columnTaskType" />:</td>
<td align="left"><newstag:basicdatalist showtype="select"
uniquename="column_task_type" key="" id="columnTaskType"
name="columnTaskType">
<option></option>
</newstag:basicdatalist>
<input type="hidden" id="policyid" name="policyid" value="${columnPolicy.policyid}">
<input type="hidden" id="MLcolumnid" name="columnPolicy.columnid" value="${columnPolicy.columnid}">
<input type="hidden" id="basicDataTypeArray" name="basicDataTypeArray" >
<input type="hidden" id="useType" name="useType" >
</td>
</tr>
<tr><td><div id="configContent" style="display: block; color: red"></div></td></tr>
</table>

</form>
</div>
</div>
</div>
</div>
<!--栏目设置 -->
<div id="edit_Panel"
style="visibility: hidden; position: absolute; top: 0px">
<div class="x-dlg-hd"><bean:message key="label.page.title" /></div>
<div class="x-dlg-bd">
<div class="x-dlg-tab" title="<bean:message key="label.page.title"/>">
<div class="inner-tab">
<form id="editForm" method="POST"
action="<c:url value='/channel/saveObject.do'/>">
<table id='cmsTable' border="0" width="100%" cellpadding="0" cellspacing="0"
align="left" style="margin: 10px 0px 0px 15px">
<tr>
<td height="25" align="left"><bean:message
key="label.page.nodetype" />:</td>
<td align="left"><input name="nodeType" id="nodeType" type="text"
size="20" readonly="readonly"></td>
</tr>
<tr>
<td height="25" align="left"><bean:message
key="label.page.nodename" />:</td>
<td align="left"><input name="vo.CName" id="vo.CName" type="text"
size="20"> <input type="hidden" name="vo.PID" id="vo.PID" />
<input type="hidden" name="vo.CID" id="vo.CID" /> <input
type="hidden" name="vo.leaf" id="vo.leaf" /> <input type="hidden"
name="vo.depth" id="vo.depth" /> <input type="hidden"
name="vo.CCode" id="vo.CCode" /> <input type="hidden"
name="vo.ownCanModify" id="vo.ownCanModify" /></td>
</tr>
<tr id="isShowdate">
<td height="25" align="left">播出时间:</td>
<td align="left"><input readonly="readonly" name="vo.showdate"
id="vo.showdate" style="width: 125px"
value='<fmt:formatDate value="${vo.showdate}"  pattern="yyyy-MM-dd HH:mm:ss"/>' />
</td>
</tr>
<tr id="temp1">
<td height="40" align="left"><input type="checkbox"
name="checkbox" id="checkbox"></td>
<td align="left">
<div style="width: 150px">允许用户在没有权限情况下修改和删除自己建的资源
<div>
</td>
</tr>
<tr id="Note">
<td height="25" align="left"><bean:message
key="label.page.nodenote" />:</td>
<td align="left"><input name="vo.CNote" id="vo.CNote" type="text">
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
</div>



<script type="text/javascript">
//Ext TREE
var _tempTree;
var selectedNode;
var parentNode;
var columnpolicyDialog;
var columnPathConfigDialog;
var explorerPanelDialog;
var RepSelM;
var dataSource;
var dateField;
//初始化ext date
var extDateArray=new Array();
initExtDate=function(){
var shotDateTimeExt=new Ext.form.DateTimeFieldAddSecond({
  allowBlank:true,
  format:'Y-m-d H:i:s'
});
shotDateTimeExt.applyTo('vo.showdate');
extDateArray.push(shotDateTimeExt);
}
function DataItem(){
this.programFolder=new Object();
this.programSite=new Object();
this.materialFolder=new Object();
this.materialSite=new Object();
}
function obj2str(o){
    var r = [];
    if(typeof o =="string") return "\""+o.replace(/([\'\"\\])/g,"\\$1").replace(/(\n)/g,"\\n").replace(/(\r)/g,"\\r").replace(/(\t)/g,"\\t")+"\"";
    if(typeof o == "object"){
        if(!o.sort){
            for(var i in o)
                r.push(i+":"+obj2str(o[i]));
            if(!!document.all && !/^\n?function\s*toString\(\)\s*\{\n?\s*\[native code\]\n?\s*\}\n?\s*$/.test(o.toString)){
                r.push("toString:"+o.toString.toString());
            }
            r="{"+r.join()+"}";
        }else{
            for(var i =0;i<o.length;i++){
                r.push(obj2str(o[i]));
            }
            r="["+r.join()+"]";
        }
        return r;
    }
    return o.toString();
}
Ext.onReady(function(){
initExtDate();

    var Tree = Ext.tree;
    var mytreeLoader = new Tree.TreeLoader({
            dataUrl:'<c:url value="/channel/getAllChannelByPID.do"/>'
        });
    mytreeLoader.on("beforeload", function(treeLoader, node) {
        this.baseParams.id = node.attributes.id;
        this.baseParams.depth = node.getDepth();
    }, mytreeLoader);
    _tempTree = new Tree.TreePanel('exttree-div', {
        animate:true,
        loader: mytreeLoader,
        enableDD:false,
        containerScroll: true
    });
    // set the root node
    var root = new Tree.AsyncTreeNode({
        text: "<bean:message key="label.root.title"/>",
        draggable:false,
        id:'0'
    });
    _tempTree.on("click", function(node, eventObject) {
        selectedNode = node;
        clearContent();
        refreshGrid();
    }, _tempTree);
    _tempTree.on("dblclick", function(node, eventObject) {
        selectedNode = node;
        editChildren();
    }, _tempTree);
    _tempTree.on("contextmenu", function(node, eventObject) {
        selectedNode = node;
        var menu = new Ext.menu.Menu();
var item;
if(selectedNode.getDepth() < 3){
item = menu.add({text:"<bean:message key="label.menu.add"/>",handler:function(){addChildren();}});
}
if(selectedNode.getDepth() > 0){
item = menu.add({text:"<bean:message key="label.menu.update"/>",handler:function(){editChildren();}});
item = menu.add({text:"<bean:message key="label.menu.delete"/>",handler:function(){removeChildren();}});
}
item = menu.add({text:"<bean:message key="label.menu.refresh"/>",handler:function(){refreshTree();}});
        var coords = eventObject.getXY();
    menu.showAt([coords[0], coords[1]]);
    }, _tempTree);
    _tempTree.setRootNode(root);
    _tempTree.render();
    root.expand();
initMainGrid();
changeStatus();

<%--选择按钮点击事件   start --%>
$('.folderSelector').live('click',function(){
    var trigger = $(this);
var siteType = trigger.attr('siteType');
$('#treeSelector').empty();
$('#treeSelector').css('left', trigger.position().left+50).css('top',trigger.position().top);
$('#treeSelector').show();

constructFolderSelector('', '','',siteType,function() {
trigger.parent().find('.folderId').val(this.getData().id);
trigger.parent().find('.siteId').val(this.getData().siteId);
$('#treeSelector').hide();
});

});

<%--method   start --%>

  function constructFolderSelector(url,username,password, type, callback) {

   var rootData = {
id : '0',
siteId:'0',
label : '选择根目录',
businessType : 'folder',
nodeType : 'ajax',
folderType:type,
expand : true
};
var businessBehaviorStore = {
'folder' : {
'click' : callback,
'loadChildrenData' : function(){
             var node = this;
             return this.loadJSON('/news-manage/configuration/getFolderChildren.do',{
          siteId:this.getData().siteId,
          rootId:this.getData().id,
          folderType:this.getData().folderType
  });
}
}
};


var optionsData = {
target : '#folderSelector',
businessBehaviorStore : businessBehaviorStore,
businessIconStore : hpmIconBinding,
menu : null
}

if (folderSelector) {
folderSelector.options.functions.destory(folderSelector);
}
$('#treeSelector').show();
folderSelector = $('#treeSelector').tree(optionsData, rootData);
      }

  <%--method   end --%>

  <%-- onChange start  --%>
    $("[id='columnPolicy.usetype']").change(function(){
       var a=$("[id='columnPolicy.usetype']").val();
               var notes = document.getElementById("columnPolicy.notes").value;    

               document.getElementsByName("basicDataType_programid").value="";
               document.getElementsByName("basicDataType_materialid").value="";
          
               if(a==30){
               columnpolicyDialog.hide();
                   columnPathConfigPolicy();
                   return;
               }else{
               showColumnpolicyDialog();
               }
    });  
  <%--  onChange end  --%>
});


//编辑节点
var editChildren = function(){
showExplorerPanelDialog();
var depth = selectedNode.getDepth();
var id = selectedNode.id;
document.getElementById("vo.showdate").value = "";
Ext.Ajax.request({
url: '<c:url value="/channel/getObjectByID.do"/>?id=' + id + "&depth=" +  depth,
success: function (response,options) {
if(response && response.responseText && response.responseText != ''){
var json = Ext.util.JSON.decode(response.responseText);
var obj = json.vo;
document.getElementById("checkbox").checked = false;
document.getElementById("vo.CName").value = obj.CName;
document.getElementById("vo.CCode").value = obj.CCode;
document.getElementById("vo.PID").value = obj.PID;
document.getElementById("vo.CID").value = obj.CID;
document.getElementById("vo.depth").value = depth;
document.getElementById("vo.ownCanModify").value = obj.ownCanModify;
if(obj.showdate != null){
document.getElementById("vo.showdate").value = obj.showdate;
}
if(depth == 1){
document.getElementById("vo.CNote").value = obj.CNote;
document.getElementById("nodeType").value = "<bean:message key="label.nodeType.channel"/>";
document.getElementById("note").style.display = '';
document.getElementById("isShowdate").style.display = 'none';
document.getElementById("temp1").style.display = 'none';

}else if(depth == 2){
document.getElementById("vo.CNote").value = obj.CNote;
var a2 = "<bean:message key="label.nodeType.timesect"/>";
$('#nodeType').val(a2);
$('#note').show();
$('#isShowdate').hide();
  document.getElementById("temp1").style.display = 'none';
}else if(depth == 3){
document.getElementById("vo.CNote").value = "";
var aaa = "<bean:message key="label.nodeType.column"/>";
$('#nodeType').val(aaa);
$('#note').hide();
document.getElementById("isShowdate").style.display = '';
document.getElementById("temp1").style.display = '';
if(document.getElementById("vo.ownCanModify").value == 1){
document.getElementById("checkbox").checked = true;
}
 
}
explorerPanelDialog.show();
}
},
failure: function () {
Ext.MessageBox.alert("581","<bean:message key="label.action.operationfailed"/>");
}
});
}
var showExplorerPanelDialog = function(){
if(!explorerPanelDialog){
explorerPanelDialog = new Ext.BasicDialog('edit_Panel', {
          autoTabs:true,
            width:550,
            height:350,
            shadow:false,
            minWidth:300,
            minHeight:300,
            proxyDrag: true,
        modal:true,
            resizable: true
        });
        explorerPanelDialog.setContentSize(300, 300);
        explorerPanelDialog.center();
        explorerPanelDialog.addKeyListener(27, explorerPanelDialog.hide, explorerPanelDialog);
    explorerPanelDialog.addButton("<bean:message key="label.page.ok"/>", saveChildren, explorerPanelDialog);
    explorerPanelDialog.addButton("<bean:message key="label.page.cancel"/>", explorerPanelDialog.hide, explorerPanelDialog);
}

}
//增加节点
var addChildren = function(){
showExplorerPanelDialog();
var depth = selectedNode.getDepth() + 1;
if(depth == 4){
Ext.MessageBox.alert("","<bean:message key="label.action.nocreate"/>");
return;
}
document.getElementById("checkbox").checked = false;
var pid = selectedNode.id;
document.getElementById("vo.PID").value = pid;
document.getElementById("vo.CName").value = "";
document.getElementById("vo.CCode").value = "";
document.getElementById("vo.CNote").value = "";
document.getElementById("vo.CID").value = "";
document.getElementById("vo.depth").value = depth;
if(depth == 1){
document.getElementById("nodeType").value = "<bean:message key="label.nodeType.channel"/>";
  document.getElementById("note").style.display = '';
  document.getElementById("temp1").style.display = 'none';
}else if(depth == 2){
document.getElementById("nodeType").value = "<bean:message key="label.nodeType.timesect"/>";
  document.getElementById("note").style.display = '';
  document.getElementById("temp1").style.display = 'none';
}else if(depth == 3){
document.getElementById("nodeType").value = "<bean:message key="label.nodeType.column"/>";
document.getElementById("note").style.display = 'none';
document.getElementById("temp1").style.display = '';
}
explorerPanelDialog.show();
}

//删除节点
var removeChildren = function(){
showExplorerPanelDialog();
selectedNode.expand(1,true,function(){
if(selectedNode.childNodes.length > 0){
Ext.MessageBox.alert("","<bean:message key="label.action.nodelete"/>");
return false;
}
if(selectedNode.childNodes.length <= 0 && window.confirm("<bean:message key="msg.channel.dodelete"/>")){
var depth = selectedNode.getDepth();
//从后台得到数据

Ext.Ajax.request({
url: '<c:url value="/channel/removeObject.do"/>?id=' +selectedNode.id + "&depth=" +  depth,
success: function (response,options) {
if(response && response.responseText && response.responseText != ''){
var pNode = selectedNode.parentNode;
pNode.removeChild(selectedNode);
Ext.MessageBox.alert("","<bean:message key="columnpolicy.operating.success"/>");
}
},
failure: function () {
Ext.MessageBox.alert("660","<bean:message key="label.action.operationfailed"/>");
}
});
}
});
}

//保存节点
var saveChildren = function(){
if(document.getElementById("vo.CName").value == ""){
alert("<bean:message key="label.action.nameisnull"/>");return false;
}
var depth = selectedNode.getDepth();
    if  (depth=="3") {
  if(document.getElementById("vo.showdate").value == ""){
alert("播出时间不能为空");return false;
  }
    }
    if(document.getElementById("checkbox").checked == true){
   document.getElementById("vo.ownCanModify").value = 1;
    }else{
   document.getElementById("vo.ownCanModify").value = 0;
    }
explorerPanelDialog.hide();
Ext.Ajax.request({
form: document.forms["editForm"],
success: function (response,options) {
if(response && response.responseText && response.responseText != ''){
var json = Ext.util.JSON.decode(response.responseText);
if(document.getElementById("vo.CID").value != ""){
//修改后的设置
selectedNode.setText(document.getElementById("vo.CName").value);
}else{
var ID = json.ID;
//新增后的设置
var node = new Ext.tree.TreeNode({id:ID, text:document.getElementById("vo.CName").value});
selectedNode.appendChild(node);
selectedNode.expand();

}
Ext.MessageBox.alert("","<bean:message key="columnpolicy.operating.success"/>");
}
},
failure: function () {
Ext.MessageBox.alert("704","<bean:message key="label.action.operationfailed"/>");
}
});
}

//刷新菜单
var refreshTree = function(){
_tempTree.root.reload();
}
//初始化右侧栏目策略grid
function initMainGrid(){
  var rowclick=function(grid,rowindex,e){
  var Ite=Ext.menu.Item;

  var addItem=new Ite({
text: "<bean:message key="columnpolicy.label.add"/>",
icon:"../images/add.png",
                handler: function(ite, e){
addColumnPolicy();
                }
      });

var editItem=new Ite({
text: "<bean:message key="columnpolicy.label.update"/>",
icon:"../images/edit.png",
                handler: function(ite, e){
                     editColumnPolicy();
                }
      });
  
  var deleteItem=new Ite({
text: "<bean:message key="columnpolicy.label.delete"/>",
icon:"../images/del.png",
                handler: function(ite, e){
                     delColumnPolicy();
                }
       });
 
  var cMenu = new Ext.menu.Menu({
        id: 'cmtmenu', // the menu's id we use later to assign as submenu
        items: [addItem,editItem,deleteItem]
     });
cMenu.show(e.getTarget());
    };
   
    var rowdbclick=function(grid,rowindex,e){
        editColumnPolicy();
    };
 
       
var fm = Ext.form,
Ed = Ext.grid.GridEditor,
Sm=Ext.grid.RowSelectionModel;

var selModel=new Sm({singleSelect:true});

var cm = new Ext.grid.ColumnModel([{
           header: "<bean:message key="columnpolicy.label.useType"/>",
           dataIndex: 'usetypeString',
           width: 150
        },{
           header: "<bean:message key="columnpolicy.label.sendType"/>",
           dataIndex: 'sendtypeString',
           width: 150
        },{
           header: "<bean:message key="columnpolicy.label.serverIp"/>",
           dataIndex: 'serverip',
           width: 150
        },{
           header: "<bean:message key="columnpolicy.label.mosId"/>",
           dataIndex: 'mosid',
           width: 150
        }]);
  
    cm.defaultSortable = true;

    var Plant = Ext.data.Record.create([
           {name: 'usetypeString', type: 'string'},
           {name: 'sendtypeString', type: 'string'},
           {name: 'serverip', type: 'string'},
           {name: 'mosid', type: 'string'}
      ]);


    var ds = new Ext.data.Store({
        proxy: new Ext.data.HttpProxy({url:"<%=request.getContextPath()%>/channel/queryNewsColumnpolicy.do"}),
        reader:  new Ext.data.JsonReader({root:'data',id:'gradeid',
            totalProperty: 'total'}, Plant)
    });
dataSource = ds;
    var grid = new Ext.grid.EditorGrid('listColumnPolicy', {
        ds: ds,
        cm: cm,
selModel:selModel,
        enableColLock:false,
        loadMask: true
    });

RepSelM=selModel;

    var layout = Ext.BorderLayout.create({
        center: {
            margins:{left:0,top:0,right:0,bottom:0},
            panels: [new Ext.GridPanel(grid)]
        }
    }, 'list_grid_panel');

grid.addListener("rowcontextmenu",rowclick);
grid.addListener("rowdblclick",rowdbclick);
    grid.render();

var gridHead = grid.getView().getHeaderPanel(true);
    var tb = new Ext.Toolbar(gridHead, [{
        text: '<bean:message key="columnpolicy.label.toolMenu"/>',
menu:{
id:"first_menu",
items:[{
                        text: "<bean:message key="columnpolicy.label.add"/>",
                        icon:"../images/add.png",
                        handler: addColumnPolicy
                },{
                        text: "<bean:message key="columnpolicy.label.update"/>",
                        icon:"../images/edit.png",
                        handler: editColumnPolicy
                }, {
                        text: "<bean:message key="columnpolicy.label.delete"/>",
                        icon:"../images/del.png",
                        handler: delColumnPolicy
                }]
}
     }]);
    
     var gridFoot = grid.getView().getFooterPanel(true);

    // add a paging toolbar to the grid's footer
    var paging = new Ext.PagingToolbar(gridFoot, ds, {
        pageSize: 20,
        displayInfo: true,
        displayMsg: '{0}-{1}/{2}',
        emptyMsg: 'No records'
    });
   
    ds.load({params:{start:0, limit:20}});
    }
//添加栏目策略
function addColumnPolicy(){
if(!selectedNode){
Ext.MessageBox.alert("","<bean:message key="columnpolicy.operating.selectColumnOrChannel"/>");
    return;
}
//当此对话框出现时,触发change事件,确保select的初始值不变
document.getElementById("columnPolicy.usetype").value = 10;
$("[id='columnPolicy.usetype']").trigger('change');

var depth = selectedNode.getDepth();
var id = selectedNode.id;
if(depth==0||depth==2){
Ext.MessageBox.alert("","<bean:message key="columnpolicy.operating.selectColumnOrChannel"/>");
    return;
}

    document.getElementById("policyid").value = "";
   
    if(depth==1){//频道策略
    document.getElementById("columnPolicy.ischannel").value = 1;
    document.getElementById("columnPolicy.columnid").value = id;
    }else if(depth==3){//栏目策略
    document.getElementById("columnPolicy.ischannel").value = 0;
    document.getElementById("columnPolicy.columnid").value = id;
    }
showColumnpolicyDialog();
columnpolicyDialog.show();
}

//栏目参数配置
function columnPathConfigPolicy(){
if(!selectedNode){
Ext.MessageBox.alert("","<bean:message key="columnpolicy.operating.selectColumnOrChannel"/>");
    return;
}
var depth = selectedNode.getDepth();
var id = selectedNode.id;
if(depth==0||depth==2){
Ext.MessageBox.alert("","<bean:message key="columnpolicy.operating.selectColumnOrChannel"/>");
    return;
}

document.getElementById("MLcolumnid").value = id;
showColumnPathConfigDialog();
columnPathConfigDialog.show();
}

function showColumnpolicyDialog(){

if (!columnpolicyDialog){
columnpolicyDialog = new Ext.BasicDialog("editColumnPolicy_Panel",{
autoTabs:true,
            width:550,
            height:350,
            shadow:false,
            minWidth:300,
            minHeight:300,
            proxyDrag: true,
            modal:true,
            resizable: false
});
columnpolicyDialog.addKeyListener(27, columnpolicyDialog.hide, columnpolicyDialog);
        columnpolicyDialog.addButton("<bean:message key="label.page.ok"/>", saveColumnPolicy, columnpolicyDialog);
        columnpolicyDialog.addButton("<bean:message key="label.page.cancel"/>", columnpolicyDialog.hide, columnpolicyDialog);
}
}

//栏目参数配置对话框
function showColumnPathConfigDialog(){

if (!columnPathConfigDialog){
columnPathConfigDialog = new Ext.BasicDialog("columnPathConfig_Panel",{
autoTabs:true,
            width:550,
            height:350,
            shadow:false,
            minWidth:300,
            minHeight:300,
            proxyDrag: true,
            modal:true,
            resizable: false
});
columnPathConfigDialog.addKeyListener(27, columnPathConfigDialog.hide, columnPathConfigDialog);
columnPathConfigDialog.addButton("<bean:message key="label.page.ok"/>", saveColumnPathConfig, columnPathConfigDialog);
columnPathConfigDialog.addButton("<bean:message key="label.page.cancel"/>", columnPathConfigDialog.hide, columnPathConfigDialog);
}
}

//编辑栏目策略
function editColumnPolicy(){
    if(!RepSelM.getSelected()){
    Ext.MessageBox.alert("","<bean:message key="columnpolicy.operating.selectOne"/>");
    return;
    }
showColumnpolicyDialog();
    
    document.getElementById("columnPolicy.usetype").value = RepSelM.getSelected().json.usetype;
    document.getElementById("columnPolicy.policyid").value = RepSelM.getSelected().json.policyid;
    document.getElementById("columnPolicy.sendtype").value = RepSelM.getSelected().json.sendtype;
    document.getElementById("columnPolicy.serverip").value = RepSelM.getSelected().json.serverip;
    document.getElementById("columnPolicy.mosid").value = RepSelM.getSelected().json.mosid;
    document.getElementById("columnPolicy.ischannel").value = RepSelM.getSelected().json.ischannel;
    document.getElementById("columnPolicy.columnid").value = RepSelM.getSelected().json.columnid;
   // document.getElementById("columnPolicy.notes").value = RepSelM.getSelected().json.notes == "" ? "" : Ext.util.JSON.encode(RepSelM.getSelected().json.notes);

    //内容管理参数的id约定为30,如果是操作的对象是内容管理参数,则进行以下操作
     var a=$("[id='columnPolicy.usetype']").val();
if(a==30){
// alert(RepSelM.getSelected().json.policyid);
//将数据库返回的json值赋值给data , 这个值是string格式的
var data = RepSelM.getSelected().json.notes == "" ? "" : Ext.util.JSON.encode(RepSelM.getSelected().json.notes);

         //将string转换成json
  var c = eval('('+data+')');

var programSite = new Array();
var materialFolder = new Array();
var materialSite = new Array();
var programFolder = new Array();
var columnTaskType = null;

//遍历这个json数据,将相同名字的值传到相应的数组里面
var num=0;
for(var i in c){
      if(typeof(c[i]) == "string"){
     columnTaskType=c[i];
}else{
       programSite[num] = c[i].programSite;
       materialFolder[num] = c[i].materialFolder;
   materialSite[num] = c[i].materialSite;
   programFolder[num] = c[i].programFolder;
    num++;
}
   }
   //将值赋值给相应的控件
$('#cmsdata .program').each(function(i){
    var $tr = $(this);
var typeid=$tr.attr('typeid');

$tr.find('.folderId').attr("value",programFolder[typeid]);
$tr.find('.siteId').attr("value",programSite[typeid]);
});
$('#cmsdata .material').each(function(i){
    var $tr = $(this);
var typeid=$tr.attr('typeid');

$tr.find('.folderId').attr("value",materialFolder[typeid]);
$tr.find('.siteId').attr("value",materialSite[typeid]);
});

document.getElementById("columnTaskType").value = columnTaskType;
document.getElementById("policyid").value = RepSelM.getSelected().json.policyid;

columnpolicyDialog.hide();
columnPathConfigPolicy();
return;
}
columnpolicyDialog.show();
}

//删除栏目策略
function delColumnPolicy(){
if(!RepSelM.getSelected()){
    Ext.MessageBox.alert("","<bean:message key="columnpolicy.operating.selectOne"/>");
    return;
    }
Ext.Ajax.request({
url: '<c:url value="/channel/removeColumnPolicy.do"/>?columnPolicy.policyid=' +RepSelM.getSelected().json.policyid,
success: function (response,options) {
if(response && response.responseText && response.responseText != ''){
var json = Ext.util.JSON.decode(response.responseText);
if(json&&json.message){
if(json.message="success"){
Ext.MessageBox.alert("","<bean:message key="columnpolicy.operating.success"/>");
}
refreshGrid();
}
}
},
failure: function () {
Ext.MessageBox.alert("926","<bean:message key="label.action.operationfailed"/>");
}
});
}
//保存栏目策略
function saveColumnPolicy(){
columnpolicyDialog.hide();
document.getElementById("columnPolicy.ischannel").disabled=false;
Ext.Ajax.request({
form: document.forms["editColumnPolicyForm"],
success: function (response,options) {
if(response && response.responseText && response.responseText != ''){
var json = Ext.util.JSON.decode(response.responseText);
//alert(json.columnPolicy.policyid);
if(json.isok == "true" && json.columnPolicy.policyid){
document.getElementById("columnPolicy.policyid").value = json.columnPolicy.policyid;
refreshGrid();
Ext.MessageBox.alert("","<bean:message key="columnpolicy.operating.success"/>");
}else{
Ext.MessageBox.alert("","保存失败!已有相同类型的策略!");
}
}
},
failure: function () {
Ext.MessageBox.alert("erorr","<bean:message key="label.action.operationfailed"/>");
}
});
changeStatus();
}

//保存栏目参数配置
function saveColumnPathConfig(){
getBasicDataType();
columnPathConfigDialog.hide();
Ext.Ajax.request({
form: document.forms["editColumnPathConfigForm"],
success: function (response,options) {
if(response && response.responseText && response.responseText != ''){
var json = Ext.util.JSON.decode(response.responseText);
//alert(json.columnPolicy.policyid);
if(json.isok == "true" && json.columnPolicy.policyid){
document.getElementById("policyid").value = json.columnPolicy.policyid;
refreshGrid();
Ext.MessageBox.alert("","<bean:message key="columnpolicy.operating.success"/>");
}else{
Ext.MessageBox.alert("","保存失败!已有相同类型的配置!");
}
}
},
failure: function () {
Ext.MessageBox.alert("949","<bean:message key="label.action.operationfailed"/>");
}
});
changeStatus();
}

//得到基础数据,传给ChannelManageCommand.java 的saveColumnPathConfig()的basicDataTypeArray
function getBasicDataType(){
var data = {};
$('#cmsdata .program').each(function(i){
var $tr = $(this);
var typeid=$tr.attr('typeid');
data[typeid]=new DataItem();
data[typeid].programFolder = $tr.find('.folderId').val();
data[typeid].programSite = $tr.find('.siteId').val();
});
$('#cmsdata .material').each(function(i){
var $tr = $(this);
var typeid=$tr.attr('typeid');
data[typeid].materialFolder = $tr.find('.folderId').val();
data[typeid].materialSite = $tr.find('.siteId').val();
});

document.getElementById("basicDataTypeArray").value = obj2str(data);
document.getElementById("useType").value = $("[id='columnPolicy.usetype']").val();;
}
//刷新grid
function refreshGrid(){
var depth = selectedNode.getDepth();
var id = selectedNode.id;
if(depth==0||depth==2){
return;
}
var args={};
    if(id!=null)
        args.columnid=id;
    if(depth!=null){
    args.depth=depth;
    }
    args.start = 0;
    args.limit = 20;
    dataSource.load({params:args});
}
//改变各状态

function changeStatus(){
document.getElementById("columnPolicy.ischannel").disabled=true;
}

//清空内容管理目录,在每次节点点击事件的时候调用
function clearContent(){
$('#cmsdata .program').each(function(i){
var $tr = $(this);
$tr.find('.folderId').attr("value","");
$tr.find('.siteId').attr("value","");
    });
    $('#cmsdata .material').each(function(i){
var $tr = $(this);
$tr.find('.folderId').attr("value","");
$tr.find('.siteId').attr("value","");
    });
    document.getElementById("policyid").value="";
}
</script>
</html>

============================================================
今天终于把最后一个bug解决了,感觉后台的东西都好搞定,jquery前台的赋值取值技术要是不熟就只有傻眼了,看来要加强这方面的练习.
  • 大小: 167.6 KB
  • 大小: 160 KB
  • 大小: 153.1 KB
分享到:
评论

相关推荐

    分享JS代码下载分享JS代码下载

    -- ShareTo Button BEGIN --&gt; &lt;div class="shareto_toolbox"&gt; &lt;a href="http://shareto.com.cn/share.html" class="shareto_button_compact"&gt;分享到&lt;/a&gt; &lt;span class="shareto_separator"&gt;|&lt;/span&gt; &lt;a class="share...

    响应式登陆注册模板

    &lt;a href="index3.html"&gt;Info Overlay&lt;/a&gt; &lt;a href="index4.html"&gt;Subscribe&lt;/a&gt; &lt;a href="index5.html"&gt;Share&lt;/a&gt; &lt;a href="index6.html"&gt;Video Player&lt;/a&gt; &lt;a href="index7.html"&gt;Sidebar Settings...

    SU-FTP-Server-Windows-v15.1.2

    &lt;Serv-U-InstallDir&gt;\Client\Web Client\Share\ShareDetails.htm Linux: &lt;Serv-U-InstallDir&gt;\Serv-U &lt;Serv-U-InstallDir&gt;\Client\Web Client\Share\GuestDownload.htm &lt;Serv-U-InstallDir&gt;\Client\Web ...

    JBoss7.1.1配置MySql数据源

    &lt;share-prepared-statements&gt;true&lt;/share-prepared-statements&gt; &lt;/statement&gt; &lt;/datasource&gt; ... &lt;/datasources&gt; ``` 2. **添加MySQL驱动**: JBoss 7.1.1可能不包含MySQL的JDBC驱动,因此需要手动添加。将`...

    SSM(spring+spring MVC+mybatis)开发学生信息后台管理系统

    SSM(spring+spring MVC+mybatis)开发学生信息后台管理系统,实现学生增删改查功能设计一个简单的学生信息管理系统,要求使用SSM框架技术整合实现,用户登录后能够通过Web页面添加、删除、修改和查询学生信息 ...

    UTF-8 中文字符集表

    UTF-8 中文 字符集表 免费share UTF-8 ---&gt; Chinese Charset Table

    3鸟设社T恤坛论

    &lt;br&gt; 改名后,用文本编辑器打开online.asp,&lt;br&gt; share.asp以及admin/share.asp这三个&lt;br&gt; 文件,在顶部第2~3行处找到旧的数据库&lt;br&gt; 文件名,将其改为新的数据库文件名。&lt;br&gt; -------------------------------------...

    Stardict词库(朗道英->汉 朗道汉->英 计算机英->汉 牛津词典)

    朗道英-&gt;汉 2.朗道汉-&gt;英 3.计算机英语-&gt;汉语 4.牛津词典) 使用说明 1.安装Stardict $sudo apt-get install stardict (ubuntu debin linux) 2.将当前文件夹下的所有文件夹解压到"/usr/share/stardict/dic" 或 "~/....

    AA System -- AA制费用管理系统

    4) AA System DB Script Tool.zip --&gt; 里面带了一个数据库脚本自动执行工具,不过需要安装PowerShell。详细说明请在百度或谷歌搜 “数据库版本控制 小鼬”即可。 5) AASystem Source Code.zip --&gt; 源代码,得用...

    最新图片在线加水印小程序源码亲测可用

    color u-p-l-44"&gt;&lt;button class="u-reset-button" open-type="share"&gt;&lt;image class="share-icon" src="../../static/share.png"&gt;&lt;/image&gt;&lt;/button&gt;&lt;/view&gt;&lt;/top-nav&gt;&lt;view class="u-flex-col"&gt;&lt;add-tips vue-id="8dd...

    allegro基础知识汇

    同时,会话文件的管理也很重要,`specctra`支持通过`file-&gt;write-&gt;session-&gt;demo.ses-&gt;ok`保存当前设计状态。此外,Allegro还允许用户删除特定设计元素,比如通过`delete(ctrl+D)`命令清除错误或不需要的部分,以及...

    [www.infoshare.cc]selenium-java-3.0.0-beta4.jar

    [www.infoshare.cc]selenium-java-3.0.0-beta4.jar

    SpringShiro分布式缓存版

    -- jsessionId的path为 / 用于多个系统共享jsessionId --&gt; &lt;property name="path" value="/" /&gt; &lt;property name="httpOnly" value="true"/&gt; &lt;/bean&gt; &lt;!-- 缓存相关配置 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!...

    Qtopia configure 參數深入了解

    10. `-sysconfdir &lt;dir&gt;`:系统配置文件将被安装到 `&lt;dir&gt;`,例如 `/etc`。 11. `-examplesdir &lt;dir&gt;` 和 `-demosdir &lt;dir&gt;`:示例和演示程序的安装目录。 12. `-release`、`-debug` 和 `-debug-and-release`:...

    [www.infoshare.cc]poi-3.15.jar

    [www.infoshare.cc]poi-3.15.jar

    [www.infoshare.cc]grinder-3.11.tar.gz

    [www.infoshare.cc]grinder-3.11.tar.gz

    openocd-esp32-win32-0.10.0-esp32-20190313.zip

    2、unzip /c/Users/&lt;user&gt;/Downloads/openocd-esp32-win32-&lt;version&gt;.zip 打开终端,进入安装目录并启动 OpenOCD: 1、cd ~/esp/openocd-esp32 2、bin/openocd -s share/openocd/scripts -f interface/ftdi/esp32_...

    Samba共享文件服务器搭建

    &lt;Context path="/fileserver" docBase="/data/share/file"&gt; &lt;/Context&gt; ``` - 其中`path`属性定义了Web应用的访问路径,`docBase`属性定义了Web应用对应的磁盘文件目录。 2. **web.xml配置**:同样位于Tomcat的`...

    kail虚拟机的共享文件夹安装失败,所以通过git仓库来share_share-the-file-

    kail虚拟机的共享文件夹安装失败,所以通过git仓库来share_share-the-file-to-the-linux

    GithubDemo:git 操作实例

    创建远程代码仓库VCS-&gt;Import into Version Control-&gt;Share Project on Github3.添加项目成员setting-&gt;Contributors-&gt;Add contributor-&gt;等待对方邮件同意4.成员建立本地仓库VCS-&gt;Checkout from Version Control-&gt;...

Global site tag (gtag.js) - Google Analytics