#pragma once 
 | 
  
 | 
#include <wobject/xwin.hpp> 
 | 
#include <wobject/xurl.hpp> 
 | 
#include <wobject/xapp.hpp> 
 | 
#include "viewobject/view.base.hpp" 
 | 
#include "xcontrol/xshtml.hpp" 
 | 
  
 | 
class xframe : public xwin 
 | 
{ 
 | 
public: 
 | 
    xframe(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) { 
 | 
         
 | 
    } 
 | 
  
 | 
    static int getUrl(string url1, string para, KXMLDOMDocument x) 
 | 
    { 
 | 
        return xurl::get(xapp::GetServerUrl(), url1, para, x); 
 | 
    } 
 | 
  
 | 
    static int getUrl(string serverUrl,string url1, string para, KXMLDOMDocument x) 
 | 
    { 
 | 
        return xurl::get(serverUrl,url1, para, x); 
 | 
    } 
 | 
    int getSql( string para, KXMLDOMDocument x) 
 | 
    { 
 | 
        return xurl::getSql(GetServerUrl(), para, x); 
 | 
    } 
 | 
  
 | 
    int getSql( xaserverarg para, KXMLDOMDocument x) 
 | 
    { 
 | 
        return xurl::getSql(GetServerUrl(), para.GetString(), x); 
 | 
    } 
 | 
  
 | 
    virtual string GetBillStatusName(xstring billstatus) 
 | 
    { 
 | 
        if (billstatus == L"1") return L"н¨"; 
 | 
        else if (billstatus == L"2") return L"´ýÅú"; 
 | 
        else if (billstatus ==L"3") return L"ÒÑÅú×¼"; 
 | 
        else if (billstatus ==L"4") return L"ÉêÇëÈ¡Ïû"; 
 | 
        else if (billstatus ==L"5") return L"ÐÞ¸Ä"; 
 | 
        else if (billstatus ==L"6") return L"ÒÑÉóºË"; 
 | 
        else if (billstatus ==L"9") return L"ºÏ²¢"; 
 | 
        else if (billstatus ==L"10") return L"¹éµµ"; 
 | 
        else if (billstatus ==L"11") return L"×÷·Ï"; 
 | 
  
 | 
        return L"#Error"; 
 | 
    } 
 | 
  
 | 
    virtual int ProcessUsedArg(xaserverarg& arg) 
 | 
    { 
 | 
        return 1; 
 | 
    } 
 | 
  
 | 
    virtual xstring GetEntityName(LPARAM pr) 
 | 
    { 
 | 
        //alert("frame£ºget entity name!"); 
 | 
        return L""; 
 | 
    } 
 | 
  
 | 
    virtual xstring GetEntityIDName(LPARAM pr) 
 | 
    { 
 | 
        return L""; 
 | 
    } 
 | 
  
 | 
    virtual xstring GetEntityID(LPARAM pr) 
 | 
    { 
 | 
        return L""; 
 | 
    } 
 | 
  
 | 
    virtual xstring GetEntityData(LPARAM pr) 
 | 
    { 
 | 
        return L""; 
 | 
    } 
 | 
  
 | 
    virtual xstring GetEntityRowData(LPARAM pr) 
 | 
    { 
 | 
        return L""; 
 | 
    } 
 | 
  
 | 
    virtual xstring GetEntityTitle(LPARAM pr) 
 | 
    { 
 | 
        return L""; 
 | 
    } 
 | 
  
 | 
    virtual xstring GetEntityNo(LPARAM pr) 
 | 
    { 
 | 
        return L""; 
 | 
    } 
 | 
  
 | 
    virtual xstring GetEntityItemValue(LPARAM pr, xstring obj, xstring item) 
 | 
    { 
 | 
        return L""; 
 | 
    } 
 | 
  
 | 
    virtual int ViewUpdate(LPARAM pr, xstring updateItem, xaserverarg  arg) 
 | 
    { 
 | 
        return 1; 
 | 
    } 
 | 
  
 | 
    virtual xstring GetEntityWorkNode(LPARAM pr, xstring what) 
 | 
    { 
 | 
        return L""; 
 | 
    } 
 | 
  
 | 
    virtual int CheckEntityValidity(LPARAM pr) 
 | 
    { 
 | 
        return 1; 
 | 
    } 
 | 
    virtual int ShowAll() 
 | 
    { 
 | 
        return 1; 
 | 
    } 
 | 
    virtual int GridSearchnew() 
 | 
    { 
 | 
        return 1; 
 | 
    } 
 | 
    virtual int CustomerModify() 
 | 
    { 
 | 
        return 1; 
 | 
    } 
 | 
         
 | 
    virtual xstring GetReason(LPARAM pr) 
 | 
    { 
 | 
        xaserverarg arg; 
 | 
        //openUrl("/sale/view/view.dlg/xpage/memo/edit", arg); 
 | 
        arg.AddArg(L"EntityID", GetEntityID(2)); 
 | 
        openUrl(L"/sale/view/workflow.view/xpage/chkdlg_vd", &arg);         
 | 
        xstring comdid = arg.GetArgString(L"comdid"); 
 | 
        if (comdid ==L"xmOK") 
 | 
        { 
 | 
            xstring value = arg.GetArgString(L"content"); 
 | 
            return value; 
 | 
        } 
 | 
        return L""; 
 | 
    } 
 | 
  
 | 
    virtual xstring GetParamValue(xstring name) 
 | 
    { 
 | 
        return L""; 
 | 
    } 
 | 
  
 | 
    virtual xstring GetSheetContent() 
 | 
    { 
 | 
        return L""; 
 | 
    } 
 | 
  
 | 
    int OnModifyRows() 
 | 
    { 
 | 
        xstring SheetStr = GetSheetContent(); 
 | 
        if (SheetStr ==L"") return -1; 
 | 
        xaserverarg arg; 
 | 
        arg.AddArg(L"sheet", SheetStr); 
 | 
        openUrl(L"/sale/view/view.dlg/xpage/grid/column/editex", &arg); 
 | 
        return 1; 
 | 
    } 
 | 
  
 | 
    int ProcessFlowAction(xstring comdid, LPARAM pr1) 
 | 
    { 
 | 
        if (comdid ==L"__ModifyRows") 
 | 
        { 
 | 
            OnModifyRows(); 
 | 
            return 1; 
 | 
        } 
 | 
  
 | 
        LPARAM pr = pr1; 
 | 
        xstring action = comdid.mid(comdid.find(L"action:", 0) + 7, 9999); 
 | 
        if (action ==L"bill.delete" || action ==L"bill.deleteEx") 
 | 
        { 
 | 
            if (MessageBoxW(GetHWND(),L"ÊÇ·ñÈ·¶¨É¾³ý¼Ç¼!",L"Ìáʾ", 1) == 2) 
 | 
                return 1; 
 | 
        } 
 | 
         
 | 
        xaserverarg& arg = *(new xaserverarg); 
 | 
        arg.AddArg(L"Action", action); 
 | 
        KXMLDOMDocument x; 
 | 
  
 | 
        xstring aurl =L"/workflow/query/actioninfo/" + action; 
 | 
         
 | 
        if (xurl::get(GetServerUrl(),aurl,L"", x) != 1) 
 | 
            return -1; 
 | 
  
 | 
        int nlen; 
 | 
        int i = 0; 
 | 
        xstring name; 
 | 
        xstring worknode; 
 | 
        xstring how; 
 | 
        xstring state =L""; 
 | 
        xstring billstatus =L""; 
 | 
        KXMLDOMElement e; 
 | 
  
 | 
        arg.AddArg(L"EntityName", GetEntityName(pr)); 
 | 
        //²ÎÊýÒªÇó 
 | 
        KXMLDOMNodeList nlist = x.selectNodes(L"//params/param"); 
 | 
        nlen = nlist.length(); 
 | 
  
 | 
        for (i = 0; i < nlen; i++) 
 | 
        { 
 | 
            e = nlist.item(i); 
 | 
            name = e.selectSingleNode(L"@name").text(); 
 | 
            how = e.selectSingleNode(L"@how").text(); 
 | 
  
 | 
            xstring content =L""; 
 | 
            if (how ==L"Entity" || how ==L"EntityData") 
 | 
            { 
 | 
                content = GetEntityData(pr); 
 | 
            } 
 | 
            if (e.selectSingleNode(L"@valid")) 
 | 
            { 
 | 
                if (content.find(L"update.modify", 0) > 0 || content.find(L"update.delete", 0) > 0) {} 
 | 
                else return 0; 
 | 
                if (CheckEntityValidity(pr) < 0) return -1; 
 | 
            } 
 | 
            if (how ==L"EntityID") 
 | 
                arg.AddArg(name, GetEntityID(pr),L"xs:string"); 
 | 
            else if (how ==L"Entity" || how ==L"EntityData") 
 | 
                arg.AddArg(name, content,L"xs:string"); 
 | 
            else if (how ==L"EntityRowData") 
 | 
                arg.AddArg(name, GetEntityRowData(pr),L"xs:string"); 
 | 
            else if (how ==L"Reason") 
 | 
            { 
 | 
                arg.AddArg(name, GetReason(1),L"xs:string"); 
 | 
            } 
 | 
            else if (how ==L"EntityNo") 
 | 
                arg.AddArg(name, GetEntityNo(pr),L"xs:string"); 
 | 
            else if (how ==L"EntityTitle") 
 | 
                arg.AddArg(name, GetEntityTitle(pr),L"xs:string"); 
 | 
            else if (how ==L"GetParam") 
 | 
                arg.AddArg(name, GetParamValue(name),L"xs:string"); 
 | 
            else if (how ==L"UserID") 
 | 
                arg.AddArg(name, xaserver::GetUID(),L"xs:string"); 
 | 
            if (how ==L"Reason" && arg.GetArgString(name) ==L"") return -1; 
 | 
            //if(how=="EntityData" && arg.GetArgString(name)=="") return -1; 
 | 
            if (e.selectSingleNode(L"@check")) 
 | 
            { 
 | 
  
 | 
                xstring doCheck = e.selectSingleNode(L"@check").text(); 
 | 
                if (doCheck ==L"Y") 
 | 
                { 
 | 
                    xstring value = arg.GetArgString(name); 
 | 
                    if (value ==L"") 
 | 
                    { 
 | 
                        alert(xstring(name) +L" ²ÎÊýÖµ²»ÄÜΪ¿Õ£¬Ê¼þÖÕÖ¹!"); 
 | 
                        return -1; 
 | 
                    } 
 | 
                } 
 | 
            } 
 | 
        } 
 | 
  
 | 
        arg.AddArg(L"action.entity", GetEntityName(pr),L"xs:string"); 
 | 
        ProcessUsedArg(arg); 
 | 
        //¶¯×÷ 
 | 
        KXMLDOMNode n = x.selectSingleNode(L"//view.action[1]"); 
 | 
  
 | 
        bool execResult = true; //´¦Àí½á¹û 
 | 
        if (n) 
 | 
        { 
 | 
            name = n.selectSingleNode(L"@name").text(); 
 | 
            if (n.selectSingleNode(L"@worknode")) 
 | 
                worknode = n.selectSingleNode(L"@worknode").text(); 
 | 
            else 
 | 
                worknode = GetEntityWorkNode(pr, name); 
 | 
            arg.AddArg(L"do", name,L"xs:string"); 
 | 
            if (worknode !=L"") 
 | 
            { 
 | 
                if (worknode.find(L"dev:xpage") == 0) 
 | 
                    OpenWindow(worknode, (LPARAM) & arg); 
 | 
                else 
 | 
                    openUrl(worknode, &arg);  
 | 
            } 
 | 
            else 
 | 
            { 
 | 
                alert(L"Warn: Please configure worknode for actionL" + xstring(name) +L"."); 
 | 
                return -1; 
 | 
            } 
 | 
        } 
 | 
        else 
 | 
        { 
 | 
            //url::post(GetEntityName(pr)+"/workflow/action",arg.GetString(),x); 
 | 
            KXMLDOMDocument x1; 
 | 
            xstring EntityNo = GetEntityName(pr); 
 | 
            int retxx = xurl::post(GetServerUrl(), (xstring)(L"/workflow/action/") + EntityNo + L"/" + action, arg.GetString(), x1); 
 | 
  
 | 
            //alert("/workflow/action/"+GetEntityName(pr)+"/"+action+"\r\n"+arg.GetString()+"\r\n"+x1.GetXml()); 
 | 
  
 | 
            if (retxx != 1) execResult = false; 
 | 
            if (x1.selectSingleNode(L"//process")) 
 | 
            { 
 | 
                KXMLDOMElement e1 = x1.selectSingleNode(L"//process"); 
 | 
                xstring valid = e1.getAttribute(L"valid"); 
 | 
                xstring finished = e1.getAttribute(L"finished"); 
 | 
                xstring errInfo =L""; 
 | 
                if (valid ==L"0") 
 | 
                { 
 | 
                    errInfo = e1.getAttribute(L"errInfo"); 
 | 
                    alert(errInfo); 
 | 
                    execResult = false; 
 | 
                } 
 | 
                else if (finished ==L"0") 
 | 
                { 
 | 
                    errInfo = e1.getAttribute(L"errInfo"); 
 | 
                    errInfo =L"´¦Àíʧ°Ü!\r\n" + errInfo; 
 | 
                    alert(errInfo); 
 | 
                    execResult = false; 
 | 
                } 
 | 
            } 
 | 
            else if (x1.selectSingleNode(L"//process-check-list")) 
 | 
            { 
 | 
                KXMLDOMElement e2 = x1.selectSingleNode(L"//process-check-list"); 
 | 
                string val = e2.getAttribute(L"process"); 
 | 
                if (val ==L"ok") 
 | 
                { 
 | 
                    alert("´¦Àí³É¹¦"); 
 | 
                    PostMessageW(GetHWND(), 0x401,(WPARAM)L"action:bill.refresh", 0); 
 | 
                } 
 | 
                else if (val ==L"part") 
 | 
                { 
 | 
                    alert("Óв¿·ÖÊý¾Ý´¦Àíδ³É¹¦£¬Ìá½»³É¹¦µÄÒÑ´¦Àí¡£"); 
 | 
                    PostMessage(GetHWND(), 0x401, (WPARAM)L"action:bill.refresh", 0); 
 | 
                } 
 | 
                else 
 | 
                    alert((xstring)L"Êý¾Ý´¦Àí²»³É¹¦\r\n" + x1.xml()); 
 | 
                return 1; 
 | 
            } 
 | 
            else if (x1.selectSingleNode(L"//msg")) 
 | 
            { 
 | 
                xstring aStr =x1.selectSingleNode(L"//msg[1]").text(); 
 | 
                //if(aStr.find("Àí³É¹¦",0) < 0) 
 | 
                //    alert(aStr); 
 | 
                if (aStr.find(L"ʧ°Ü", 0) >= 0) 
 | 
                    execResult = false; 
 | 
                alert(aStr); 
 | 
            } 
 | 
            if (x1.selectSingleNode(L"//msg/@state")) 
 | 
            { 
 | 
                state = x1.selectSingleNode(L"//msg[1]/@state").text(); 
 | 
                arg.AddArg(L"state", state,L"xs:string"); 
 | 
                billstatus = x1.selectSingleNode(L"//msg[1]/@billstatus").text(); 
 | 
                arg.AddArg(L"billstatus", billstatus,L"xs:string"); 
 | 
            } 
 | 
        } 
 | 
        //¸üÐÂÒªÇó 
 | 
        if (execResult) 
 | 
        { 
 | 
            nlist = x.selectNodes(L"//view/update"); 
 | 
            nlen = nlist.length(); 
 | 
            for (i = 0; i < nlen; i++) 
 | 
            { 
 | 
                e = nlist.item(i); 
 | 
                how = e.selectSingleNode(L"@do").text(); 
 | 
                if (how ==L"setstate") 
 | 
                { 
 | 
                    if (state !=L"") 
 | 
                    { 
 | 
                        arg.AddArg(L"state", state,L"xs:string"); 
 | 
                        arg.AddArg(L"billstatus", billstatus,L"xs:string"); 
 | 
                        ViewUpdate(pr, how, arg); 
 | 
  
 | 
                    } 
 | 
                } 
 | 
                else 
 | 
                    ViewUpdate(pr, how, arg); 
 | 
            } 
 | 
        } 
 | 
  
 | 
  
 | 
        return 1; 
 | 
    } 
 | 
  
 | 
    int OnItemError(TNotifyEvent* evt, int p) 
 | 
    { 
 | 
        DWNMHDR&  hdr = *(DWNMHDR *)evt->notify.pnmh; 
 | 
        xstring value = hdr.data; 
 | 
        int e = hdr.idFrom; 
 | 
        if (e == -1000) 
 | 
            MessageBoxW(0,L"¡¾" + value +L"¡¿²»ÊÇÓÐЧµÄÊý×Ö!",L"OnItemError", 0); 
 | 
        if (e == -1001) 
 | 
            MessageBoxW(0,L"¡¾" + value +L"¡¿²»ÊÇÓÐЧµÄÊý×Ö!", L"OnItemError", 0); 
 | 
        if (e == -1002) 
 | 
            MessageBoxW(0,L"¡¾" + value +L"¡¿²»ÊÇÓÐЧµÄÈÕÆÚ!", L"OnItemError", 0); 
 | 
        hdr.idFrom = 0; 
 | 
        return 1; 
 | 
    } 
 | 
  
 | 
    virtual int SetObjectInfo(KXMLDOMElement e) 
 | 
    { 
 | 
        return 1; 
 | 
    } 
 | 
  
 | 
    virtual xstring GetTaskID() 
 | 
    { 
 | 
        return L""; 
 | 
    } 
 | 
  
 | 
    virtual int ShowAgentInfo(xstring scene, xstring EntityID) 
 | 
    { 
 | 
        if (EntityID != L"") 
 | 
        { 
 | 
            KXMLDOMDocument x = ViewObject::RetrieveData(L"/sale/data/Agent/entity", L"scene",scene,L"EntityID", EntityID); 
 | 
            if (x) 
 | 
            { 
 | 
                xshtml xs =GetControl(L"frame:agentinfo");  
 | 
                string content = x.xml(); 
 | 
                xs.SetContent(content); 
 | 
                xs.Redraw(); 
 | 
            } 
 | 
        } 
 | 
        return 1; 
 | 
    } 
 | 
  
 | 
    virtual int SetAgent(xstring scene, xstring EntityID) 
 | 
    { 
 | 
        xstring xfNodeAgentArea =L"agentarea"; 
 | 
        xnode anode = GetAgentNode(xfNodeAgentArea); 
 | 
        KXMLDOMElement xframeElement = GetElement(); 
 | 
        KXMLDOMNode agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea +L"[1]/*"); 
 | 
  
 | 
        KXMLDOMDocument x; 
 | 
        xaserverarg arg; 
 | 
        arg.AddArg(L"scene", scene,L"xs:string"); 
 | 
        arg.AddArg(L"EntityID", EntityID,L"xs:string"); 
 | 
        arg.AddArg(L"TaskID", GetTaskID(),L"xs:string"); 
 | 
        arg.AddArg(L"EntityName", GetEntityName(1),L"xs:string"); 
 | 
        xurl::get(GetServerUrl(),(xstring)L"/workflow/query/datarole/" + GetEntityName(1), arg.GetString(), x); 
 | 
        //if(x.GetXmlDoc().selectSingleNode("datarole/rightes/right")) 
 | 
        SetObjectInfo(x.documentElement()); 
 | 
        xstring sNodes; 
 | 
        sNodes =(xstring)L"datarole/actions/action[contains(@scene,'" + scene +L"')]"; 
 | 
        KXMLDOMNodeList nlist = x.selectNodes(sNodes); 
 | 
        int  index; 
 | 
        int  nlen = nlist.length(); 
 | 
        KXMLDOMElement ele; 
 | 
  
 | 
        auto elenode = anode.GetElement(); 
 | 
        xstring nodeName = elenode.tagName(); 
 | 
  
 | 
        xstring tools =L"<vbox class=''>"; 
 | 
        if (scene ==L"list") tools +=L"<xspace height='12'/>"; 
 | 
        if (nodeName == L"hbox")tools = L"<hbox class=''>"; 
 | 
  
 | 
        for (index = 0; index < nlen; index++) 
 | 
        { 
 | 
            ele = nlist.item(index); 
 | 
            xstring name = ele.selectSingleNode(L"@id").text();//.getAttribute("id"); 
 | 
            xstring label = ele.selectSingleNode(L"@caption").text();//ele.getAttribute("caption"); 
 | 
            xstring image; 
 | 
            xstring src =L""; 
 | 
            if (ele.selectSingleNode(L"@image")) 
 | 
                image = ele.selectSingleNode(L"@image").text(); 
 | 
            else 
 | 
                image =L"0 22"; 
 | 
  
 | 
            if (ele.selectSingleNode(L"@src")) 
 | 
                src = ele.selectSingleNode(L"@src").text(); 
 | 
  
 | 
            xstring tool; 
 | 
  
 | 
            if (nodeName == L"hbox") 
 | 
            { 
 | 
                if (src != L"") 
 | 
                    tool = (xstring)L"<xtoolbutton src='" + src + L"'  caption='" + label + L"' name='action:" + name + L"' width='70'  style='font-family:˼ԴºÚÌå CN Bold;font-size:8pt'/>"; 
 | 
                else 
 | 
                    tool = (xstring)L"<xtoolbutton image='" + image + L"'  caption='" + label + L"' name='action:" + name + L"' width='70'  style='font-family:˼ԴºÚÌå CN Bold;font-size:8pt'/>"; 
 | 
            } 
 | 
            else 
 | 
            { 
 | 
                if (src != L"") 
 | 
                    tool = (xstring)L"<xtoolbutton src='" + src + L"'  caption='" + label + L"' name='action:" + name + L"' height='23' style='background-color:none #ceecce  none #ffffff'/>"; 
 | 
                else 
 | 
                    tool = (xstring)L"<xtoolbutton image='" + image + L"'  caption='" + label + L"' name='action:" + name + L"' height='23'  style='background-color:none #ceecce none #ffffff'/>"; 
 | 
            } 
 | 
            tools += tool; 
 | 
        } 
 | 
        if (agent) 
 | 
        { 
 | 
            nlist = agent.selectNodes(L".//xtoolbutton"); 
 | 
            nlen = nlist.length(); 
 | 
            for (index = 0; index < nlen; index++) 
 | 
            { 
 | 
                ele = nlist.item(index); 
 | 
                xstring tmp = ele.xml(); 
 | 
                tools += tmp; 
 | 
            } 
 | 
        } 
 | 
        if (nodeName == L"hbox") 
 | 
            tools += L"</hbox>"; 
 | 
        else 
 | 
            tools +=L"</vbox>"; 
 | 
        SetAgentNode(anode, tools); 
 | 
  
 | 
        if (GetControl(L"frame:agentinfo"))ShowAgentInfo(scene,EntityID); 
 | 
  
 | 
        return 1; 
 | 
    } 
 | 
  
 | 
    virtual int SetAgent1(xstring scene, xstring EntityID) 
 | 
    { 
 | 
        xstring xfNodeAgentArea = L"agentarea"; 
 | 
        xnode anode = GetAgentNode(xfNodeAgentArea); 
 | 
        KXMLDOMElement xframeElement = GetElement(); 
 | 
        KXMLDOMNode agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); 
 | 
  
 | 
        KXMLDOMDocument x; 
 | 
        xaserverarg arg; 
 | 
        arg.AddArg(L"scene", scene, L"xs:string"); 
 | 
        arg.AddArg(L"EntityID", EntityID, L"xs:string"); 
 | 
        arg.AddArg(L"TaskID", GetTaskID(), L"xs:string"); 
 | 
        arg.AddArg(L"EntityName", GetEntityName(1), L"xs:string"); 
 | 
        xurl::get(GetServerUrl(), (xstring)L"/workflow/query/datarole/" + GetEntityName(1), arg.GetString(), x); 
 | 
        //if(x.GetXmlDoc().selectSingleNode("datarole/rightes/right")) 
 | 
        SetObjectInfo(x.documentElement()); 
 | 
        xstring sNodes; 
 | 
        sNodes = (xstring)L"datarole/actions/action[contains(@scene,'" + scene + L"')]"; 
 | 
        KXMLDOMNodeList nlist = x.selectNodes(sNodes); 
 | 
        int  index; 
 | 
        int  nlen = nlist.length(); 
 | 
        KXMLDOMElement ele; 
 | 
  
 | 
        xstring tools = L"<vbox class=''>"; 
 | 
        if (scene == L"list") tools += L"<xspace height='12'/>"; 
 | 
  
 | 
        for (index = 0; index < nlen; index++) 
 | 
        { 
 | 
            ele = nlist.item(index); 
 | 
            xstring name = ele.selectSingleNode(L"@id").text();//.getAttribute("id"); 
 | 
            xstring label = ele.selectSingleNode(L"@caption").text();//ele.getAttribute("caption"); 
 | 
            xstring image; 
 | 
            xstring src = L""; 
 | 
            if (ele.selectSingleNode(L"@image")) 
 | 
                image = ele.selectSingleNode(L"@image").text(); 
 | 
            else 
 | 
                image = L"0 22"; 
 | 
  
 | 
            if (ele.selectSingleNode(L"@src")) 
 | 
                src = ele.selectSingleNode(L"@src").text(); 
 | 
  
 | 
            xstring tool; 
 | 
  
 | 
            if (src != L"") 
 | 
                tool = (xstring)L"<xtoolbutton src='" + src + L"'  caption='" + label + L"' name='action:" + name + L"' height='23' style='background-color:none #ceecce  none #ffffff'/>"; 
 | 
            else 
 | 
                tool = (xstring)L"<xtoolbutton image='" + image + L"'  caption='" + label + L"' name='action:" + name + L"' height='23'  style='background-color:none #ceecce none #ffffff'/>"; 
 | 
            tools += tool; 
 | 
        } 
 | 
        if (agent) 
 | 
        { 
 | 
            nlist = agent.selectNodes(L".//xtoolbutton"); 
 | 
            nlen = nlist.length(); 
 | 
            for (index = 0; index < nlen; index++) 
 | 
            { 
 | 
                ele = nlist.item(index); 
 | 
                xstring tmp = ele.xml(); 
 | 
                tools += tmp; 
 | 
            } 
 | 
        } 
 | 
        tools += L"</vbox>"; 
 | 
        SetAgentNode(anode, tools); 
 | 
  
 | 
        return 1; 
 | 
    } 
 | 
  
 | 
    virtual int SetAgent(xstring scene) 
 | 
    { 
 | 
        return SetAgent(scene,L"*"); 
 | 
    } 
 | 
  
 | 
    virtual int SetAgent() 
 | 
    { 
 | 
        return SetAgent(L"list"); 
 | 
    } 
 | 
  
 | 
    virtual int DoUpdate(bool showSuccess) 
 | 
    { 
 | 
        return 0; 
 | 
    } 
 | 
  
 | 
    virtual bool NeedNotifyUpdate() 
 | 
    { 
 | 
        return false; 
 | 
        return true; 
 | 
    } 
 | 
  
 | 
    virtual int BeforeCloseWindow() 
 | 
    { 
 | 
        if (!NeedNotifyUpdate()) return 1; 
 | 
        xstring content = GetEntityData(1); 
 | 
        if (content ==L"") return 1; 
 | 
        if (content.find(L"update.modify", 0) > 0 || content.find(L"update.delete", 0) > 0) 
 | 
        { 
 | 
            int MB_YESNOCANCEL_ = 3; 
 | 
            int IDYES_ = 6; 
 | 
            int IDNO_ = 7; 
 | 
            int IDCANCEL_ = 2; 
 | 
            int re = MessageBoxW(GetHWND(),L"Êý¾ÝÒѾÐ޸ģ¬ÊÇ·ñ±£´æ?",L"Ìáʾ:", MB_YESNOCANCEL_); 
 | 
            if (re == IDCANCEL_) return -1; 
 | 
            if (re == IDNO_) return 1; 
 | 
            if (DoUpdate(false) == 1) return 1; 
 | 
            return -1; 
 | 
        } 
 | 
        return 1; 
 | 
    } 
 | 
  
 | 
    int OnCloseOwnerWindow(TEvent* evt, LPARAM p) 
 | 
    { 
 | 
        if (BeforeCloseWindow() < 0)     return 1; 
 | 
        return 0; 
 | 
    } 
 | 
  
 | 
    int OnCloseFrameSheet(TEvent* evt, LPARAM p) 
 | 
    { 
 | 
        LYSNMHDR* nmtv = (LYSNMHDR*)evt->notify.pnmh; 
 | 
        HWND h = (HWND)nmtv->idFrom; 
 | 
        int canCLose = 1; 
 | 
        if (h == GetHWND()) 
 | 
            canCLose = BeforeCloseWindow(); 
 | 
  
 | 
        if (canCLose < 0) 
 | 
            nmtv->nSheet = canCLose; 
 | 
        return 1; 
 | 
    } 
 | 
  
 | 
    int AttachCloseWindow() 
 | 
    { 
 | 
        xstring typ = GetElement().getAttribute(L"type"); 
 | 
        if (typ ==L"sheet") 
 | 
        { 
 | 
            AttachEvent(L"frame:mdilayer",L"LYSN_CLOSESHEET", (FEvent)&xframe::OnCloseFrameSheet); 
 | 
        } 
 | 
        else 
 | 
        { 
 | 
            AttachEvent(L"WM_CLOSE", (FEvent)&xframe::OnCloseOwnerWindow); 
 | 
        } 
 | 
        return 1; 
 | 
    } 
 | 
  
 | 
    int OnCloseWindow() 
 | 
    { 
 | 
        //AttachEvent("frame:mdilayer",L"LYSN_CLOSESHEET",BeforeCloseWindow);     
 | 
        return 1; 
 | 
    } 
 | 
  
 | 
    /* 
 | 
    int AppendItem(xml x,msxml::IXMLDOMElement r,string name,string value) 
 | 
    { 
 | 
        msxml::IXMLDOMElement e = x.GetXmlDoc().createElement(name); 
 | 
        e.text =L""+value; 
 | 
        e.setAttribute("update.modify","1"); 
 | 
        r.appendChild(e); 
 | 
        return 1; 
 | 
    } 
 | 
  
 | 
    int OnSaveTemplate(xdwgrid dw_list, string aurl) 
 | 
    { 
 | 
        //alert("먦·Å..."); 
 | 
        if(aurl ==L"") return -1; 
 | 
        int i; 
 | 
        int s = dw_list.GetColumnCount(); 
 | 
        xaserverarg arg = new xaserverarg; 
 | 
        arg.setNativePointer(arg.CreateInstance()); 
 | 
        for(i=1; i<=s; i++) 
 | 
        { 
 | 
            string name = dw_list.GetColumnName(i); 
 | 
            if(name ==L"guid") continue; 
 | 
            string titlename = dw_list.GetTitleName(i - 1); 
 | 
            int width = dw_list.GetColumnWidth(name); 
 | 
            arg.AddArg(name, width.toString(), titlename); 
 | 
        } 
 | 
  
 | 
        xml x=new xml; 
 | 
        x.setNativePointer(xml::CreateInstance()); 
 | 
        x.LoadXml("<root><SysGridCols update.new='1' update.modify='1'/></root>"); 
 | 
        msxml::IXMLDOMElement doc = x.GetXmlDoc().documentElement; 
 | 
        msxml::IXMLDOMElement e = doc.selectSingleNode("*"); 
 | 
  
 | 
        //string guid1 = publiccode::GetGuid(); 
 | 
        //string gid = publiccode::GetCurrentDate(); 
 | 
  
 | 
        //AppendItem(x, e,L"ID", publiccode::GetGuid()); 
 | 
        AppendItem(x, e,L"TplType", aurl); 
 | 
        AppendItem(x, e,L"Cols", arg.GetString()); 
 | 
        AppendItem(x, e,L"Recorder", xaserver::GetUserId()); 
 | 
        doc.appendChild(e); 
 | 
        xaserverarg arg0 = new xaserverarg; 
 | 
        arg0.setNativePointer(arg0.CreateInstance()); 
 | 
        arg0.AddArg("content", doc.xml); 
 | 
        if(url::get("/workflow/action/SysGridCols/bill.update",arg0.GetString(),x)!=1) 
 | 
        { 
 | 
            trace("error:"+x.GetXml()); 
 | 
            alert("³ö´í!"); 
 | 
        } 
 | 
        return 1; 
 | 
    }        */ 
 | 
}; 
 |