<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<activity id="__B47NqIsMJxMjkJogyc4">
  <name>删除</name>
  <parentId>__fnfbXm8hQ7vlF6HxJRM</parentId>
  <type>3</type>
  <onActionForm></onActionForm>
  <onActionView></onActionView>
  <onActionFlow></onActionFlow>
  <onActionPrint></onActionPrint>
  <colorType>default</colorType>
  <beforeActionScript><![CDATA[(function(){      
       	var selectId = getParameterAsText("_selects");        
      	var it = 0;      
      	var arrto = splitText(selectId,";");      
      	var errorStr = "";      
      	var domainId = getDomainid();      
        var deleteResSize = 0;    
      	it =arrto.length;      
      	if(!isNotNull(selectId)){      
            return createAlert("请先勾选需要删除的数据");      
          }      
      	for(var i=0;i<arrto.length;i++){      
            var resourceId =  arrto[i];      
            var resourceInfo=findDocument(resourceId);     
            deleteResSize += parseDouble(resourceInfo.getItemValueAsString("resourceSize"));    
            println("deleteResSize-->" + deleteResSize);    
            var sql="select '"+ domainId +"' as domainid,count(ID) count, ITEM_SECTIONNAME, ITEM_LESSONRESOURCENAME from tlk_lesson_section where ITEM_SECTIONRESOURCEID = '"+resourceId+"' GROUP BY ID";                               
            var datas = queryByDSName("tms",sql);  
          println("datas----->"+datas);
            if(datas!=null){      
         for(var iterator = datas.iterator();iterator.hasNext();){      
           	var data = iterator.next();//取值      
           	if(data.get("count") != "0"){      
              	errorStr += data.get("ITEM_LESSONRESOURCENAME") + "已被" + data.get("ITEM_SECTIONNAME") +"小节使用无法删除</br>";      
              }   
         }      
           }      
          }       
      	if(errorStr != ""){      
            return createAlert(errorStr);       
          }else{   
            var sql="select ITEM_ALLSPACESIZE, ITEM_USESPACESIZE, ITEM_FREESPACESIZE from tlk_com_resource_space where DOMAINID = '"+domainId+"' limit 1";        
                 var datas = queryByDSName("tms",sql);    
                 var data = datas.iterator().next();//取值            
                 	var useSpaceSize = parseDouble(data.get("ITEM_USESPACESIZE")) - deleteResSize;            
                 	var freeSpaceSize = parseDouble(data.get("ITEM_FREESPACESIZE")) + deleteResSize;          
                   var updateSql = "update tlk_com_resource_space set ITEM_USESPACESIZE = '"+useSpaceSize+"',"+        
                       												" ITEM_FREESPACESIZE = '"+freeSpaceSize+"' where DOMAINID = '"+domainId+"'";        
                   updateByDSName("tms", updateSql);         
          }   
      })()]]></beforeActionScript>
  <afterActionScript><![CDATA[]]></afterActionScript>
  <retractBeforeActionScript><![CDATA[]]></retractBeforeActionScript>
  <retractAfterActionScript><![CDATA[]]></retractAfterActionScript>
  <hiddenScript><![CDATA[]]></hiddenScript>
  <readonlyScript><![CDATA[]]></readonlyScript>
  <startFlowScript><![CDATA[							]]></startFlowScript>
  <editMode>0</editMode>
  <flowShowType>表单中显示流程操作</flowShowType>
  <fileNameScript><![CDATA[]]></fileNameScript>
  <orderno>1</orderno>
  <stateToShow></stateToShow>
  <parentView>__fnfbXm8hQ7vlF6HxJRM</parentView>
  <parentForm></parentForm>
  <impmappingconfigid>__7tkXQ8UWGSqrTJkHtCB</impmappingconfigid>
  <jumpType>0</jumpType>
  <expSub>false</expSub>
  <icon></icon>
  <disableFlowNode>true</disableFlowNode>
  <changeFlowOperator>true</changeFlowOperator>
  <changeFlowCc>true</changeFlowCc>
  <multiLanguageLabel></multiLanguageLabel>
  <dispatcherMode>0</dispatcherMode>
  <dispatcherUrl><![CDATA[]]></dispatcherUrl>
  <dispatcherParams><![CDATA[]]></dispatcherParams>
  <jumpMode>1</jumpMode>
  <jumpActOpenType>0</jumpActOpenType>
  <withOld>false</withOld>
  <actionType>0</actionType>
  <actionDispatcherUrlScript><![CDATA[]]></actionDispatcherUrlScript>
  <actionSelection>0</actionSelection>
  <relatedFormId></relatedFormId>
  <actionScript><![CDATA[]]></actionScript>
  <workFlowType>0</workFlowType>
  <isneedcomment>0</isneedcomment>
  <contextMenu>true</contextMenu>
  <showInToolbar>true</showInToolbar>
  <transpond>选择</transpond>
  <targetList>ism1EiHqAkpLpSd2Zr7|</targetList>
  <label><![CDATA[]]></label>
</activity>