use "xcontrol.vframe.vbusiness.vd" use "xbase.vframe.vbusiness.vd" use "base.view.vd" use "xflowchart.wobject.wface.vd" unit trade [ class flow : public xframe { xtreeview tv_1; xlayersheet tab_1; xdwgrid dw_flow; xdwgrid dw_state; xdwgrid dw_button; xdwgrid dw_role; xdwgrid dw_bill; xdwgrid dw_scene; xdwgrid dw_buttonright; xdwgrid dw_datafieldright; string flowid; xtreeview tv_folder; xnode m_agentNode; //Agent Condition string GetSheetType(int index) { if (index == 0) return "flowitem"; else if (index == 1) return "state"; else if (index == 2) return "actionrole"; else if (index == 3) return "button"; else if (index == 4) return "role"; else if (index == 5) return "bill"; else if (index == 6) return "scene"; else if (index ==7) return "fieldrole"; else return "unkown"; } xdwgrid GetSheetDwgrid(int index) { string typ = GetSheetType(index); if(typ=="flowitem") return dw_flow; if(typ=="actionrole") return dw_buttonright; if(typ=="state") return dw_state; if(typ=="button") return dw_button; if(typ=="role") return dw_role; if(typ=="bill") return dw_bill; if(typ=="scene") return dw_scene; if(typ=="fieldrole") return dw_datafieldright; return 0; } xdwgrid GetSheetDbmap(int index) { string typ = GetSheetType(index); if(typ=="flowitem") return "flow.dbmap"; if(typ=="actionrole") return "workflow.actionrole.dbmap"; if(typ=="state") return "state.dbmap"; if(typ=="button") return "button.dbmap"; if(typ=="role") return "role.dbmap"; if(typ=="bill") return "bill.dbmap"; if(typ=="scene") return "scene.dbmap"; if(typ=="fieldrole") return "workflow.datarole.dbmap"; return 0; } string GetDwname(string typ) { if(typ=="flowitem") return "/sale/view/Flow3/template/flow"; if(typ=="actionrole") return "/sale/view/Flow3/template/buttonright"; if(typ=="state") return "/sale/view/Flow3/template/state"; if(typ=="button") return "/sale/view/Flow3/template/button"; if(typ=="role") return "/sale/view/Flow3/template/role"; if(typ=="bill") return "/sale/view/Flow3/template/bill"; if(typ=="scene") return "/sale/view/Flow3/template/scene"; if(typ=="fieldrole") return "/sale/view/Flow3/template/datafieldright"; return ""; } int SetAgent() { string xfNodeAgentArea = "agentarea"; xnode anode = GetAgentNode(xfNodeAgentArea); if(m_agentNode) { SetAgentNodeContent (anode,m_agentNode); } else { msxml::IXMLDOMElement xframeElement = GetElement(); msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); if(agent) { string s = agent.xml; m_agentNode = SetAgentNodeContent (anode,s); } } return 1; } int OnSave() { if(flowid=="") return 1; string sdbmap; xml x = new xml; x.setNativePointer(xml::CreateInstance()); int index = tab_1.GetSheetIndex(); sdbmap = GetSheetDbmap(index); xdwgrid dw_list = GetSheetDwgrid(index); dw_list.DwUpdateAllToEx(x.GetXmlDoc()); //trace(x.GetXml()); msxml::IXMLDOMNodeList ls = x.GetXmlDoc().documentElement.SelectNodes("*[@update.modify='1' and @update.new='1']"); int len = ls.length; for(int k=0;k"); flowchart.LoadEx(f.GetXmlDoc().documentElement); } return 1; } //ÃüÁî·¢²¼º¯Êý int OnCmdDispatch(string comdid) { if (comdid == "xmSave") return OnSave(); if (comdid == "xmAddrow") return OnAddrow(); if (comdid == "xmInsertrow") return OnInsertrow(); if (comdid == "xmDeleterow") return OnDeleterow(); if (comdid == "xmImport") return OnImport(); return 0; } //ÃüÁî´¦Àíʼþ int OnXCommand(ref TXCommandEvent evt,int param) { return OnCmdDispatch(evt.pStrID); } int OnAttachEvent() { //°ó¶¨¹¤¾ßÌõµã»÷ʼþ AttachEvent("WM_XCOMMAND",OnXCommand); //»ñÈ¡½¹µãʼþ£¬ÓÃÓÚÖØÖù¤¾ßÌõ AttachEvent("WM_SETFOCUS",OnSetFocus); AttachEvent("tv_folder", "TVN_SELCHANGED",OnTreeSelChanged); AttachEvent("tab_1","LYSN_SELECTEDSHEET",OnTabSelectSheet); AttachEvent("dw_flow","DWV_CLICKED",OnClicked); AttachEvent("dw_buttonright","DWV_CLICKED",OnClicked); AttachEvent("dw_button","DWV_CLICKED",OnClicked); AttachEvent("dw_state","DWV_CLICKED",OnClicked); return 1; } int CreateFlowFloder() { xml x = ViewObject::RetrieveData("/sale/data/flow3/flowfolder"); if(x) { msxml::IXMLDOMNodeList nlist = x.GetXmlDoc().SelectNodes("//item"); int len = nlist.length; int hItem = 0; for (int i = 0; i < len; i++) { msxml::IXMLDOMElement e = nlist.item(i); string name = e.getAttribute("flowName"); string no = e.getAttribute("flowNo"); string label = name;//no.trim() + " " + name; int h= tv_folder.InsertChildItem(hItem,label, trust(e as int),22); //tv_folder.SetItemChild(h,1); } } return 1; } int onload() { flowid = ""; tv_folder = GetControl("tv_folder"); CreateFlowFloder(); tv_1 = GetControl("tv_1"); tab_1 = GetControl("tab_1"); dw_flow = GetControl("dw_flow"); dw_flow.openUrl("/sale/view/Flow3/template/flow"); dw_state = GetControl("dw_state"); dw_state.openUrl("/sale/view/Flow3/template/state"); dw_button = GetControl("dw_button"); dw_button.openUrl("/sale/view/Flow3/template/button"); dw_role = GetControl("dw_role"); dw_role.openUrl("/sale/view/Flow3/template/role"); dw_bill = GetControl("dw_bill"); dw_bill.openUrl("/sale/view/Flow3/template/bill"); dw_scene = GetControl("dw_scene"); dw_scene.openUrl("/sale/view/Flow3/template/scene"); dw_buttonright = GetControl("dw_buttonright"); dw_buttonright.openUrl("/sale/view/Flow3/template/buttonright"); dw_datafieldright = GetControl("dw_datafieldright"); dw_datafieldright.openUrl("/sale/view/Flow3/template/datafieldright"); OnAttachEvent(); return 1; } int onloaded() { SetAgent(); OnRetrieve(); return 1; } }; ]