| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <xcontrol/xcell.hpp> |
| | | |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) MessageBusinessWin : public xframe |
| | | { |
| | | public: |
| | | //xdwgrid dw_list; |
| | | xdwtable dw_base; |
| | | xnode m_agentNode; //Agent Condition |
| | | xwin sheet; |
| | | bool readonly; |
| | | xstring MessageID; |
| | | xstring bill; |
| | | |
| | | public: |
| | | MessageBusinessWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static MessageBusinessWin* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | MessageBusinessWin* pWin = new MessageBusinessWin(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int SetAgent() |
| | | { |
| | | return 1; |
| | | |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if(m_agentNode) |
| | | { |
| | | SetAgentNode (anode,m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/"+xfNodeAgentArea+L"[1]/*"); |
| | | if(agent) |
| | | { |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode (anode,s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnItemChanged(TEvent* evt, int p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring colname=hdr.colname; |
| | | xstring value = hdr.data; |
| | | int row = hdr.row; |
| | | |
| | | if(colname==L"Category") |
| | | { |
| | | if(value==L"ä¾åºåç³è¯·") |
| | | { |
| | | dw_base.SetItemString(1,L"Receiver",L"fdp-011"); |
| | | dw_base.SetItemString(1,L"Subject",L"请添å "); |
| | | } |
| | | return 1; |
| | | |
| | | bool changed = false; |
| | | xml x = ViewObject::RetrieveData(L"/sale/data/business/message/maint",L"typ",value); |
| | | if(x) |
| | | { |
| | | xstring xpage_ = x.documentElement().getAttribute(L"xpage"); |
| | | xstring templaterpt = x.documentElement().getAttribute(L"template"); |
| | | if(xpage_ !=L"") |
| | | { |
| | | xstring s = L"<hbox name='agent'>"; |
| | | s += L"<xpage url='" + xpage_ + L"' name='contentex'/>"; |
| | | s += L"</hbox>"; |
| | | SetAgentNode (GetAgentNode(L"agent"),s); |
| | | SwitchLayer(L"sheet2",L"frame"); |
| | | sheet = GetChildWin(L"contentex"); |
| | | changed = true; |
| | | } |
| | | } |
| | | if(!changed) |
| | | { |
| | | sheet = 0; |
| | | SwitchLayer(L"sheet1",L"frame"); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if(comdid==L"xmSend") |
| | | { |
| | | if(!readonly) OnSend(); |
| | | return 1; |
| | | } |
| | | else if(comdid==L"xmSave") |
| | | { |
| | | if(!readonly) OnSave(); |
| | | return 1; |
| | | } |
| | | else if(comdid==L"xmCancel") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | if(sheet && comdid !=L"") |
| | | { |
| | | int ret =SendMessage(GetHWND(),0x401,(LPARAM)comdid,0); |
| | | if(ret) return ret; |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | |
| | | int OnDWClick(TEvent* evt, int p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring value = hdr.data; |
| | | xstring colname = hdr.colname; |
| | | if (value == L"æ¶ä»¶äºº:") |
| | | { |
| | | |
| | | xaserverarg arg2 ; |
| | | xaserverarg parg2 = GetArg(); |
| | | OpenWindow(L"dev:xpage[UserGroupPersonSelect.vx]",arg2); |
| | | |
| | | if(arg2.GetArgString(L"comdid")==L"xmOk") |
| | | { |
| | | xstring data = arg2.GetArgString(L"data"); |
| | | xml x2; |
| | | |
| | | x2.loadXML(data); |
| | | KXMLDOMNodeList nodes = x2.selectNodes(L"/root/item"); |
| | | trace(x2.xml()); |
| | | |
| | | int len = nodes.length(); |
| | | |
| | | xstring Names = L""; |
| | | for(int i=0;i<len; i++) |
| | | { |
| | | KXMLDOMElement t= nodes.item(i); |
| | | |
| | | if(t.getAttribute(L"Name")) |
| | | { |
| | | xstring Name = t.getAttribute(L"Name"); |
| | | if(Names==L"") |
| | | Names = Name; |
| | | else if(Names.find(Name) < 0) Names+=L";"+Name; |
| | | } |
| | | } |
| | | dw_base.SetItemString(1,L"Receiver",Names); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&MessageBusinessWin::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&MessageBusinessWin::OnSetFocus); |
| | | |
| | | AttachEvent(L"dw_base",L"DWV_ITEMCHANGED", (FEvent)&MessageBusinessWin::OnItemChanged); |
| | | AttachEvent(L"dw_base",L"DWV_CLICKED", (FEvent)&MessageBusinessWin::OnDWClick); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | xml x ; |
| | | |
| | | xaserverarg arg1 = MakeArg(L"scriptbox"); |
| | | xstring murl = L"/sale/data/Business/message/update"; |
| | | if(MessageID==L"") murl = L"/sale/data/Business/message/add2"; |
| | | if(xurl::get(murl, arg1.GetString(),x)!=1) |
| | | { |
| | | alert((xstring)L"error1:\r\n"+x.text()); |
| | | return 1; |
| | | } |
| | | if(MessageID==L"") MessageID= dw_base.GetGuid(1); |
| | | alert(L"å·²ä¿åå°è稿箱"); |
| | | return 1; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | if(sheet) |
| | | { |
| | | |
| | | SendMessage(sheet.GetHWND(),0x401,L"GetEntityData:"+arg,0); |
| | | xstring data = arg.GetArgString(L"EntityData"); |
| | | murl = L"/sale/data/Business/message/attach/update"; |
| | | arg1.AddArg(L"url",L"message/attach"); |
| | | arg1.AddArg(L"content",data); |
| | | arg1.AddArg(L"param",MessageID); |
| | | if(xurl::get(murl, arg1.GetString(),x)!=1) |
| | | { |
| | | alert((xstring)L"error2:\r\n"+x.text()); |
| | | return 1; |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnSend() |
| | | { |
| | | xml x ; |
| | | //xaserverarg arg1 = MakeArg(L"outbox"); |
| | | xaserverarg arg1 = MakeArg(L"inbox"); |
| | | xstring murl = L"/sale/data/Business/message/update"; |
| | | if(MessageID==L"") murl = L"/sale/data/Business/message/add2"; |
| | | |
| | | trace(arg1.GetString()); |
| | | |
| | | if(xurl::get(murl, arg1.GetString(),x)!=1) |
| | | { |
| | | alert((xstring)L"error1:\r\n"+x.text()); |
| | | return 1; |
| | | } |
| | | if(MessageID==L"") MessageID= dw_base.GetGuid(1); |
| | | alert(L"åé宿"); |
| | | CloseWindow(); |
| | | |
| | | return 1; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | if(sheet) |
| | | { |
| | | |
| | | SendMessage(sheet.GetHWND(),0x401,L"GetEntityData:"+arg,0); |
| | | xstring data = arg.GetArgString(L"EntityData"); |
| | | murl = L"/sale/data/Business/message/attach/update"; |
| | | arg1.AddArg(L"url",L"message/attach"); |
| | | arg1.AddArg(L"content",data); |
| | | arg1.AddArg(L"param",MessageID); |
| | | if(xurl::get(murl, arg1.GetString(),x)!=1) |
| | | { |
| | | alert((xstring)L"error2:\r\n"+x.text()); |
| | | return 1; |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | xaserverarg MakeArg(xstring folder) |
| | | { |
| | | //ThingImpl:AddMessage($MessageID,$Folder,$EntityNo, $EntityID, $Subject, $Category, $Reciever, $Content) |
| | | //ThingImpl:UpdateMessage($MessageID,$Folder,$EntityNo, $EntityID, $Subject, $Category, $Reciever, $Content) |
| | | |
| | | xaserverarg arg; |
| | | |
| | | |
| | | if(MessageID==L"") |
| | | { |
| | | dw_base.SetGuid(1,ViewObject::GetGuid()); |
| | | arg.AddArg(L"MessageID", dw_base.GetGuid(1)); |
| | | arg.AddArg(L"EntityID", dw_base.GetGuid(1)); |
| | | } |
| | | else |
| | | { |
| | | arg.AddArg(L"MessageID", MessageID); |
| | | arg.AddArg(L"EntityID", MessageID); |
| | | } |
| | | |
| | | arg.AddArg(L"Folder", folder); |
| | | arg.AddArg(L"EntityNo", dw_base.GetItemString(1,L"EntityNo")); |
| | | arg.AddArg(L"Subject", dw_base.GetItemString(1,L"Subject")); |
| | | arg.AddArg(L"Category", dw_base.GetItemString(1,L"Category")); |
| | | arg.AddArg(L"Reciever", dw_base.GetItemString(1,L"Receiver")); |
| | | arg.AddArg(L"Note", dw_base.GetItemString(1,L"Note")); |
| | | //arg.AddArg(L"Content", dw_base.GetItemString(1,L"Content")); |
| | | arg.AddArg(L"Content",xcontrol(GetControl(L"sle_search")).GetText()); |
| | | arg.AddArg(L"Content2",bill); |
| | | return arg; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"id",MessageID); |
| | | if (getUrl(L"/sale/data/business/list/fetch",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | }else |
| | | { |
| | | dw_base.Retrieve(x); |
| | | dw_base.Redraw(); |
| | | if(readonly) dw_base.SetReadOnly(true); |
| | | |
| | | if(x.selectSingleNode(L"root/Content")) |
| | | { |
| | | xstring str = x.selectSingleNode(L"root/Content").text(); |
| | | str = str.replace(L"\n",L"\r\n"); |
| | | GetControl(L"content").SetText(str); |
| | | } |
| | | //alert(x.xml()); |
| | | if(x.selectSingleNode(L"root/Content2")) |
| | | { |
| | | |
| | | xstring str2 = x.selectSingleNode(L"root/Content2").text(); |
| | | xstring tm=L""; |
| | | xstring EntityID=L""; |
| | | xstring Category=L""; |
| | | int pos = str2.find(L"EntityID=L"); |
| | | if(pos >= 0) |
| | | { |
| | | tm = str2.mid(pos + L"EntityID=L".length(),64); |
| | | if(tm.find(L" ")>0) tm = tm.left(tm.find(L" ")); |
| | | EntityID=tm; |
| | | } |
| | | pos = str2.find(L"Category=L"); |
| | | if(pos >= 0) |
| | | { |
| | | tm = str2.mid(pos+L"Category=L".length(),64); |
| | | if(tm.find(L" ")>0) tm = tm.left(tm.find(L" ")); |
| | | Category=tm; |
| | | } |
| | | trace(L"EntityID:"+EntityID); |
| | | trace(L"Category:"+Category); |
| | | if(EntityID != L"" && Category != L"") |
| | | { |
| | | xstring eleStr = L"<row EntityID='"+EntityID+L"'"; |
| | | eleStr += L" category='" + Category + L"'/>"; |
| | | bill = L"EntityID=L"+EntityID+L" Category=L" + Category; |
| | | ShowDetail(eleStr); |
| | | } |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int ShowDetail(xstring eleStr) |
| | | { |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"content",eleStr); |
| | | xml doc; |
| | | |
| | | if(getUrl(L"/sale/data/vpage/vstart/task",arg.GetString(),doc)!=1) |
| | | { |
| | | trace((xstring)L"error->:"+doc.xml()); |
| | | return 0; |
| | | } |
| | | if(doc.xml() == L"") |
| | | return -1; |
| | | |
| | | htmlctrl ht = GetControl(L"taskinfo"); |
| | | ht.SetContent(doc.xml()); |
| | | ht.Redraw(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | SetArg(); |
| | | dw_base = GetControl(L"dw_base"); |
| | | dw_base.openUrl(L"/sale/view/business3/template/message/maint"); |
| | | dw_base.SetColHeaderHeight(0); |
| | | dw_base.SetRowSelectorWidth(0); |
| | | dw_base.SetHScrollState(false); |
| | | dw_base.SetVScrollState(false); |
| | | |
| | | dw_base.SetItemString(1,L"Category",L"æ®é"); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | readonly = false; |
| | | MessageID = L""; |
| | | bill = L""; |
| | | |
| | | SetAgent(); |
| | | if(GetWinParam()) |
| | | { |
| | | xaserverarg arg = GetArg(); |
| | | MessageID = arg.GetArgString(L"id"); |
| | | if(arg.GetArgString(L"readonly")==L"1") readonly=true; |
| | | OnRetrieve(); |
| | | |
| | | if(arg.GetArgString(L"EntityID")!=L"") |
| | | { |
| | | xstring str = L"<row EntityID='"+arg.GetArgString(L"EntityID")+L"'"; |
| | | str += L" category='" + arg.GetArgString(L"EntityName")+L"'/>"; |
| | | bill = L"EntityID=L"+arg.GetArgString(L"EntityID")+L" Category=L" + arg.GetArgString(L"EntityName"); |
| | | ShowDetail(str); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | |
| | | return 1; |
| | | } |
| | | }; |