| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | use "base.view.vd" |
| | | unit trade |
| | | [ |
| | | class DocSelectDlg: public xframe |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | #include <xcontrol/xdatetimepick.hpp> |
| | | |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) DocSelectDlg: public xframe |
| | | { |
| | | public: |
| | | //xdwgrid dw_list; |
| | | xlistview lv_view; |
| | | xnode m_agentNode; //Agent Condition |
| | | int columnCount ; |
| | | |
| | | public: |
| | | DocSelectDlg(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static DocSelectDlg* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | DocSelectDlg* pWin = new DocSelectDlg(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if(m_agentNode) |
| | | { |
| | | SetAgentNodeContent (anode,m_agentNode); |
| | | SetAgentNode (anode,m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/"+xfNodeAgentArea+L"[1]/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent (anode,s); |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode (anode,s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //重置工具条 |
| | | //SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnListViewDoubleClicked(ref TEvent evt,int param) |
| | | int OnListViewDoubleClicked(TEvent* evt, LPARAM param) |
| | | { |
| | | //重置工具条 |
| | | //SetAgent(); |
| | |
| | | int LVNI_CUT = 0x0004; |
| | | int LVNI_DROPHILITED = 0x0008; |
| | | |
| | | int nItem =xlistview::GetNextItem(lv_view.GetId(), -1, LVNI_FOCUSED); |
| | | int nItem =lv_view.GetNextItem( -1, LVNI_FOCUSED); |
| | | if(nItem < 0) return 1; |
| | | |
| | | int LVIF_PARAM = 0x0004; |
| | |
| | | lvItem.iSubItem = 0; |
| | | lvItem.mask = LVIF_PARAM ; |
| | | |
| | | xlistview::GetItem(lv_view.GetId(), lvItem); |
| | | msxml::IXMLDOMElement ele = trust(lvItem.lParam as msxml::IXMLDOMElement); |
| | | lv_view.GetItem( lvItem); |
| | | KXMLDOMElement ele = trust(lvItem.lParam as KXMLDOMElement); |
| | | |
| | | string src = ele.getAttribute("url"); |
| | | string name=ele.getAttribute("caption"); |
| | | string file =""; |
| | | if(src.find("/file/")>0) file = src.mid(src.find("/file/") + 6,9999); |
| | | if(file =="") return 1; |
| | | string str = file.left(2); |
| | | string ext = ""; |
| | | if(name.find(".")>=0) ext = name.mid(name.find("."),name.length()); |
| | | string sfile = file; |
| | | xstring src = ele.getAttribute(L"url"); |
| | | xstring name=ele.getAttribute(L"caption"); |
| | | xstring file =L""; |
| | | if(src.find(L"/file/")>0) file = src.mid(src.find(L"/file/") + 6,9999); |
| | | if(file ==L"") return 1; |
| | | xstring str = file.left(2); |
| | | xstring ext = L""; |
| | | if(name.find(L".")>=0) ext = name.mid(name.find(L"."),name.length()); |
| | | xstring sfile = file; |
| | | |
| | | xaserverarg arg = GetParam(); |
| | | xaserverarg arg = GetArg(); |
| | | if(arg) |
| | | { |
| | | arg.AddArg("result","ok"); |
| | | if((arg.GetArgString("process")=="path" ||arg.GetArgString("process")=="data")) |
| | | arg.AddArg(L"result",L"ok"); |
| | | if((arg.GetArgString(L"process")==L"path" ||arg.GetArgString(L"process")==L"data")) |
| | | { |
| | | string id = ele.getAttribute("ID"); |
| | | arg.AddArg("ID", id); |
| | | arg.AddArg("path", src); |
| | | arg.AddArg("filename", name); |
| | | arg.AddArg("src","/business/attachment/"+str+"/"+ file+".jpg"); |
| | | if(arg.GetArgString("process")=="path" ) return 1; |
| | | xstring id = ele.getAttribute(L"ID"); |
| | | arg.AddArg(L"ID", id); |
| | | arg.AddArg(L"path", src); |
| | | arg.AddArg(L"filename", name); |
| | | arg.AddArg(L"src",L"/business/attachment/"+str+L"/"+ file+L".jpg"); |
| | | if(arg.GetArgString(L"process")==L"path" ) return 1; |
| | | } |
| | | } |
| | | |
| | | |
| | | /* |
| | | const string d = m_Html.GetData(p.object); |
| | | if(d == "") return -1; |
| | | string file = d.mid(0, d.find("|##@@|",0)); |
| | | string name = d.mid(d.find("|##@@|",0)+6, d.length()); |
| | | const xstring d = m_Html.GetData(p.object); |
| | | if(d == L"") return -1; |
| | | xstring file = d.mid(0, d.find(L"|##@@|",0)); |
| | | xstring name = d.mid(d.find(L"|##@@|",0)+6, d.length()); |
| | | */ |
| | | |
| | | xaserver::CreateDirectory("C:/Temp"); |
| | | xaserver::CreateDirectory(L"C:/Temp"); |
| | | if(arg) |
| | | { |
| | | if(arg.GetArgString("process")=="data") |
| | | if(arg.GetArgString(L"process")==L"data") |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml ::CreateInstance()); |
| | | xaserver::LoadUrl(GetServerUrl(),"/business/attachment/"+str+"/"+ file+".jpg","",x); |
| | | arg.AddArg("data",x.GetXml()); |
| | | xml x ; |
| | | |
| | | xaserver::LoadUrl(GetServerUrl(),L"/business/attachment/"+str+L"/"+ file+L".jpg",L"",x); |
| | | arg.AddArg(L"data",x.xml()); |
| | | return 1; |
| | | } |
| | | } |
| | | |
| | | int openRet = xaserver::DownLoadFile(GetServerUrl(),"/business/attachment/"+str+"/"+ file+".jpg","","C:/Temp/"+sfile+ext); |
| | | int openRet = xaserver::DownLoadFile(GetServerUrl(),L"/business/attachment/"+str+L"/"+ file+L".jpg",L"",L"C:/Temp/"+sfile+ext); |
| | | |
| | | |
| | | |
| | | //alert("/business/attachment/"+str+"/"+ file+".jpg"); |
| | | //alert(L"/business/attachment/"+str+L"/"+ file+L".jpg"); |
| | | if(openRet < 0) |
| | | { |
| | | alert("文件打开失败1!"); |
| | | alert(L"文件打开失败1!"); |
| | | return -1; |
| | | } |
| | | //openRet = win32::ShellExecute(0,"open","C:/Temp/"+name,"","",5); |
| | | openRet = win32::ShellExecute(0,"open","C:/Temp/"+sfile+ext,"","",5); |
| | | //openRet = ShellExecute(0,L"open",L"C:/Temp/"+name,L"",L"",5); |
| | | openRet = ShellExecute(0,L"open",L"C:/Temp/"+sfile+ext,L"",L"",5); |
| | | if(openRet < 32) |
| | | { |
| | | alert("文件打开失败2!"); |
| | | alert(L"文件打开失败2!"); |
| | | return -1; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&DocSelectDlg::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&DocSelectDlg::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | /* |
| | | int OnRetrieve() |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("xxx","xxx"); |
| | | if (getUrl("",arg.GetString(),x)!=1) |
| | | xml x ; |
| | | |
| | | xaserverarg arg ; |
| | | |
| | | arg.AddArg(L"xxx",L"xxx"); |
| | | if (getUrl(L"",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | trace(x.text()); |
| | | return -1; |
| | | }else |
| | | { |
| | |
| | | } |
| | | */ |
| | | |
| | | int SetListViewHeaderColumn(string Url) |
| | | int SetListViewHeaderColumn(xstring Url) |
| | | { |
| | | const int LVCFMT_LEFT = 0; |
| | | for(int i=0;i<3;i++) lv_view.DeleteColumn(lv_view.GetId(),1); |
| | | //if(Url=="") |
| | | for(int i=0;i<3;i++) lv_view.DeleteColumn(1); |
| | | //if(Url==L"") |
| | | //{ |
| | | lv_view.InsertColumn(lv_view.GetId(),0,"创建人员",LVCFMT_LEFT,80,0); |
| | | lv_view.InsertColumn(lv_view.GetId(),0,"创建日期",LVCFMT_LEFT,80,0); |
| | | lv_view.InsertColumn(lv_view.GetId(),0,"名称",0,120,0); |
| | | lv_view.InsertColumn(0,L"创建人员",LVCFMT_LEFT,80,0); |
| | | lv_view.InsertColumn(0,L"创建日期",LVCFMT_LEFT,80,0); |
| | | lv_view.InsertColumn(0,L"名称",0,120,0); |
| | | columnCount = 3; |
| | | //} |
| | | return 1; |
| | | } |
| | | |
| | | int Retrieve(string src) |
| | | int Retrieve(xstring src) |
| | | { |
| | | xml x = ViewObject::RetrieveData("/sale/data/TDocument3/folder/list", "src",src); |
| | | xml x = ViewObject::RetrieveData(L"/sale/data/TDocument3/folder/list", L"src",src); |
| | | if(x) |
| | | { |
| | | msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement; |
| | | msxml::IXMLDOMNodeList nlist=ele.SelectNodes("*"); |
| | | int s=nlist.length; |
| | | KXMLDOMElement ele = x.documentElement(); |
| | | KXMLDOMNodeList nlist=ele.selectNodes(L"*"); |
| | | int s=nlist.length(); |
| | | if (s>0) |
| | | { |
| | | for (int i=0; i<s; i++) |
| | | { |
| | | msxml::IXMLDOMElement e=nlist.item(i); |
| | | string name=e.getAttribute("caption"); |
| | | int nItem = xlistview::InsertItemEx(lv_view.GetId(),0,name,23,cast(e as int)); |
| | | KXMLDOMElement e=nlist.item(i); |
| | | xstring name=e.getAttribute(L"caption"); |
| | | int nItem = lv_view.InsertItemEx(0,name,23,e); |
| | | |
| | | xlistview::SetItemText(lv_view.GetId(),nItem,1,e.getAttribute("Creator")); |
| | | xlistview::SetItemText(lv_view.GetId(),nItem,2,e.getAttribute("CreateDate")); |
| | | lv_view.SetItemText(nItem,1,e.getAttribute(L"Creator")); |
| | | lv_view.SetItemText(nItem,2,e.getAttribute(L"CreateDate")); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | int onload() |
| | | { |
| | | lv_view = GetControl("lv_view"); |
| | | //xlistview::SetdwStyle(lv_view.GetId(),0); |
| | | SetArg(); |
| | | lv_view = GetControl(L"lv_view"); |
| | | //lv_view.SetdwStyle(0); |
| | | |
| | | columnCount = 0; |
| | | SetListViewHeaderColumn(""); |
| | | AttachEvent("lv_view", "NM_DBLCLK",OnListViewDoubleClicked); |
| | | SetListViewHeaderColumn(L""); |
| | | AttachEvent(L"lv_view", L"NM_DBLCLK", (FEvent)&DocSelectDlg::OnListViewDoubleClicked); |
| | | |
| | | if(GetParam()) |
| | | if(GetWinParam()) |
| | | { |
| | | xaserverarg arg = GetParam(); |
| | | string src = arg.GetArgString("src"); |
| | | xaserverarg arg = GetArg(); |
| | | xstring src = arg.GetArgString(L"src"); |
| | | Retrieve(src); |
| | | } |
| | | |
| | |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
| | | }; |