base.js

 
var IFrameTreeName  = "cont";       //The IFrame tree name 
var doAction   =new Array(new Array(),new Array());
var obj     ="";
//New Window Height
var winH     = 600;
var winW     = 600;

//param
var Params     = new Array();

function onAddRequestClick(){
 document.forms[0].searchValue.value = searchValue;
 document.forms[0].searchCriteria.value = searchCriteria;
 document.forms[0].subSystemName.value = subSystemName; 
 document.forms[0].action = addRequestAction;
 document.forms[0].submit();
}
function onAddRequestClick2(){
 //document.forms[0].searchValue.value = searchValue;
 //document.forms[0].searchCriteria.value = searchCriteria;
 //document.forms[0].subSystemName.value = subSystemName; 
 document.forms[0].action = addRequestAction2;
 document.forms[0].submit();
}
function onAddRequestClick3(){
 //document.forms[0].searchValue.value = searchValue;
 //document.forms[0].searchCriteria.value = searchCriteria;
 //document.forms[0].subSystemName.value = subSystemName; 
 document.forms[0].action = addRequestAction3;
 document.forms[0].submit();
}
function OverObj(obj)
{
 SetObj(obj);

}
function SameLineSubmit(){
 var IsChange=false;
 var IFrameObj=eval(IFrameTreeName);
 var name=document.getElementById('name').value;
 var description=document.getElementById('description').value;
 bf.name=name;
 bf.description=description;

 if(bf.name!=opener.BFList[obj].name) IsChange=true;
 if(bf.description!=opener.BFList[obj].description) IsChange=true;
 
 if(IFrameObj.menuAddArray.length>0 || IFrameObj.menuDelArray.length>0 || IFrameObj.screenAddArray.length>0 || IFrameObj.screenDelArray.length>0 || IFrameObj.actionAddArray.length>0 || IFrameObj.actionDelArray.length>0 || IFrameObj.tabAddArray.length>0 || IFrameObj.tabDelArray.length>0){
  opener.menuAddArray = IFrameObj.menuAddArray;
  opener.menuDelArray = IFrameObj.menuDelArray;
  
  opener.screenAddArray = IFrameObj.screenAddArray;
  opener.screenDelArray = IFrameObj.screenDelArray;
  
  opener.actionAddArray = IFrameObj.actionAddArray;
  opener.actionDelArray = IFrameObj.actionDelArray;
  
  opener.tabAddArray = IFrameObj.tabAddArray;
  opener.tabDelArray = IFrameObj.tabDelArray;
  
  IsChange=true;
 }
  
 if(IsChange)
 {
  opener.document.forms[0].doAction.value = '8';//change doAction
  opener.ResetFlush(bf,opener.curBF,opener.BFList[obj],true);
  opener.curBF=bf;
  opener.PageFlush(obj,true);
  opener.ButtonFlush(true);
 }
 else
 {
  
  opener.ResetFlush(bf,opener.curBF,opener.BFList[obj],false);
  opener.curBF=bf;
  opener.PageFlush(obj,false);
  opener.ButtonFlush(false);
 }
 saveToken();
 self.close();
}
function onOKActionClick() //for delete and update
{
 var opener=window.dialogArguments['WIN'];
 var obj=window.dialogArguments['INDEX'];
 doAction=opener.doAction;
 var IFrameObj=eval(IFrameTreeName);
 if(doAction[obj] == "<a href='#' onClick='EffectiveObj();onUpdateClick()'>Update</a>")
 {  
      var counter = 0; 
    var  fieldList = new Array();
    fieldList[counter++] = new Array("name", [labelName], "MS", true);  
     var errMsg = validateForm(document.forms[0], fieldList);
       // if content is not empty, this indicates there is message to be alerted and processing shall be discontinued
      if (errMsg != '')
      {
          alert(errMsg);
          return;
      }      
       //if the tree not exist
       if(IFrameObj.menuFlagArray == null){
        return;
       }       
   if(IFrameObj.menuFlagArray.length<1)
   {
    alert(ResourceIsMandatory);
    return false;
   }
   if(bf.description.length>500)
   {
    alert(DesLengthError);
    return false;
   }  
   if(SameLine) {SameLineSubmit();return;}
   var IsChange=false;   
   var bfName=document.forms[0].name.value;   
   var bfDesp=document.forms[0].description.value;    
   if(bf.name!=bfName)
   {
    bf.name=bfName;  
    IsChange=true;
   }  
   if(bf.description!=bfDesp)
   {
    bf.description=bfDesp;
    IsChange=true;
   }  
   //bf.currentRecordVersion=document.forms[0].currentRecordVersion.value; 
   opener.menuFlagArray = IFrameObj.menuFlagArray;//empty flag 
   if(IFrameObj.menuAddArray.length>0 || IFrameObj.menuDelArray.length>0 || IFrameObj.screenAddArray.length>0 || IFrameObj.screenDelArray.length>0 || IFrameObj.actionAddArray.length>0 || IFrameObj.actionDelArray.length>0 || IFrameObj.tabAddArray.length>0 || IFrameObj.tabDelArray.length>0){
    opener.menuAddArray = IFrameObj.menuAddArray;
    opener.menuDelArray = IFrameObj.menuDelArray;  
     
    opener.screenAddArray = IFrameObj.screenAddArray;
    opener.screenDelArray = IFrameObj.screenDelArray;
    
    opener.actionAddArray = IFrameObj.actionAddArray;
    opener.actionDelArray = IFrameObj.actionDelArray;
    
    opener.tabAddArray = IFrameObj.tabAddArray;
    opener.tabDelArray = IFrameObj.tabDelArray;
    
    IsChange=true;
   }

   if(IsChange)
   {  
 
    opener.document.forms[0].doAction.value = '8';  
    opener.ResetFlush(bf,opener.curBF,opener.BFList[obj],true);   
    opener.curBF=bf;    
    opener.PageFlush(obj,true);   
    opener.ButtonFlush(true);   
   }
   else{
   }
    
 }
 else if(doAction[obj] == "<a href='#' onClick='EffectiveObj();onDeleteClick()'>Delete</a>")
 { 
  opener.document.forms[0].doAction.value = '9';  
  opener.ResetFlush(opener.BFList[obj],opener.curBF,opener.BFList[obj],true);
 // bf.currentRecordVersion=document.forms[0].currentRecordVersion.value;
  opener.curBF=bf;
  opener.PageFlush(obj,true);
  opener.ButtonFlush(true);
 }
  saveToken();
  self.close();
}

 

 

function onCancelActionClick()
{
 saveToken();
 self.close();
}

function onSubmitClick() {

 var fm=document.forms[0];
 var doAction = fm.doAction.value;  
 if(doAction == '9')//delete page
 {
  fm.id.value=curBF.id; 
  fm.applicationCode.value=curBF.applicationCode;  
  fm.userType.value=curBF.userType;
  fm.code.value=curBF.code;
  fm.name.value=curBF.name;
  fm.description.value=curBF.description;

  fm.currentRecordVersion.value=curBF.currentRecordVersion;
  document.forms[0].action=deleteAction;
  document.forms[0].submit();
  ButtonFlush(false);
 }
 else if(doAction == '0'){ //add page

  var counter = 0;
   var  fieldList = new Array();
   fieldList[counter++] = new Array("code", [labelCode], "M", true);
   fieldList[counter++] = new Array("name", [labelName], "MS", true);   
    var errMsg = validateForm(document.forms[0], fieldList);
      // if content is not empty, this indicates there is message to be alerted and processing shall be discontinued
     if (errMsg != '')
     {
         alert(errMsg);
         return;
     }
     if(fm.description.value.length>500)
  {
   alert(DesLengthError);
   return false;
  }
     //get the application name
     fm.applicationName.value = fm.applicationCode.options[fm.applicationCode.options.selectedIndex].text;
     fm.subSystemCode.value = fm.subSystemCodeOption.options[fm.subSystemCodeOption.options.selectedIndex].value;
     fm.subSystemName.value = fm.subSystemCodeOption.options[fm.subSystemCodeOption.options.selectedIndex].text;
  if(fm.subSystemCode.value == "" || fm.subSystemCode.value == null)
  {
   alert(appAndSubIsMandatory);
   return;
  }
  var menuList = new Array();
  var screenList = new Array();
  var actionList = new Array();
  var tabList = new Array();

  menuList = frames[0].menuArray;
  if(menuList == null || menuList.length <1)
  {
   alert(ResourceIsMandatory);
   return;
  }
  screenList = frames[0].screenArray;
  actionList = frames[0].actionArray;
  tabList = frames[0].tabArray; 
     
  for(var i=0;i<menuList.length;i++)
  {
   var inputObj=document.createElement("input");
         inputObj.name="menuArray";
         inputObj.value=menuList[i];
         inputObj.type="hidden";
         fm.appendChild(inputObj);
  }
  for(var i=0;i<screenList.length;i++)
  {
   var inputObj=document.createElement("input");
         inputObj.name="screenArray";
         inputObj.value=screenList[i];
         inputObj.type="hidden";
         fm.appendChild(inputObj);
  }
  for(var i=0;i<actionList.length;i++)
  {
   var inputObj=document.createElement("input");
         inputObj.name="actionArray";
         inputObj.value=actionList[i];
         inputObj.type="hidden";
         fm.appendChild(inputObj);
  }
  for(var i=0;i<tabList.length;i++)
  {
   var inputObj=document.createElement("input");
         inputObj.name="tabArray";
         inputObj.value=tabList[i];
         inputObj.type="hidden";
         fm.appendChild(inputObj);
  }
  document.forms[0].action=addAction; 
  document.forms[0].submit();
  ButtonFlush(false);
 }

 else if(doAction == '8')//update page
 {
  fm.id.value=curBF.id; 
  fm.applicationCode.value=curBF.applicationCode;
  fm.subSystemCode.value = curBF.subSystemCode; 
  fm.userType.value=curBF.userType;
  fm.code.value=curBF.code;
  fm.name.value=curBF.name;
  fm.description.value=curBF.description; 
  fm.currentRecordVersion.value=curBF.currentRecordVersion; 

  for(var i=0;i<menuFlagArray.length;i++)
  {
   var inputObj=document.createElement("input");
         inputObj.name="menuFlagArray";
         inputObj.value=menuFlagArray[i];
         inputObj.type="hidden";
         fm.appendChild(inputObj);
  }
   // menu 
  for(var i=0;i<menuAddArray.length;i++)
  {
   var inputObj=document.createElement("input");
         inputObj.name="menuArray";
         inputObj.value=menuAddArray[i];
         inputObj.type="hidden";
         fm.appendChild(inputObj);
  }
  for(var i=0;i<menuDelArray.length;i++)
  {
   var inputObj=document.createElement("input");
         inputObj.name="menuDelArray";
         inputObj.value=menuDelArray[i];
         inputObj.type="hidden";
         fm.appendChild(inputObj);
  }
   // screen 
  for(var i=0;i<screenAddArray.length;i++)
  {
   var inputObj=document.createElement("input");
         inputObj.name="screenArray";
         inputObj.value=screenAddArray[i];
         inputObj.type="hidden";
         fm.appendChild(inputObj);
  }
  for(var i=0;i<screenDelArray.length;i++)
  {
   var inputObj=document.createElement("input");
         inputObj.name="screenDelArray";
         inputObj.value=screenDelArray[i];
         inputObj.type="hidden";
         fm.appendChild(inputObj);
  }
   // action
  for(var i=0;i<actionAddArray.length;i++)
  {
   var inputObj=document.createElement("input");
         inputObj.name="actionArray";
         inputObj.value=actionAddArray[i];
         inputObj.type="hidden";
         fm.appendChild(inputObj);
  }
  for(var i=0;i<actionDelArray.length;i++)
  {
   var inputObj=document.createElement("input");
         inputObj.name="actionDelArray";
         inputObj.value=actionDelArray[i];
         inputObj.type="hidden";
         fm.appendChild(inputObj);
  }
    // tab
  for(var i=0;i<tabAddArray.length;i++)
  {
   var inputObj=document.createElement("input");
         inputObj.name="tabArray";
         inputObj.value=tabAddArray[i];
         inputObj.type="hidden";
         fm.appendChild(inputObj);
  }
  for(var i=0;i<tabDelArray.length;i++)
  {
   var inputObj=document.createElement("input");
         inputObj.name="tabDelArray";
         inputObj.value=tabDelArray[i];
         inputObj.type="hidden";
         fm.appendChild(inputObj);
  }
  document.forms[0].action=updateAction;
  ButtonFlush(false);
  document.forms[0].submit();
 }
  
 
}

function onPaginationClick(number)
{
    document.forms[0].currentPage.value = number;
    document.forms[0].numberOfPage.value = number;
    document.forms[0].action = pagingGoAction;
    document.forms[0].submit();
}
function saveToken()
{
 var token=document.getElementsByName('org.apache.struts.taglib.html.TOKEN')[0].value;
 if(opener.document.getElementsByName('org.apache.struts.taglib.html.TOKEN')[0]!=null&&opener.document.getElementsByName('org.apache.struts.taglib.html.TOKEN')[0]!=undefined)
 {
  var parent=opener.document.getElementsByName('org.apache.struts.taglib.html.TOKEN')[0];
  parent.value=token; 
 }
 else
 {
  var fm=opener.document.forms[0];
  var input=opener.document.createElement("input");
  input.name='org.apache.struts.taglib.html.TOKEN';
  input.type='hidden';
  input.value=token;
  fm.appendChild(input);  
 }
}
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值