¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) QuickCode_Tree : public xwin |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xtreeview tv_1; |
| | | xstring m_config; |
| | | xstring m_agent; |
| | | xstring m_id; |
| | | xstring m_dbmap; |
| | | xstring treexquery; |
| | | xstring c_type; |
| | | KXMLDOMDocument m_configDoc; |
| | | xstring kpstr; |
| | | xstring strtpl; |
| | | xstring m_QueryTxt; |
| | | xnode m_agentNode; |
| | | public: |
| | | QuickCode_Tree(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static QuickCode_Tree* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | QuickCode_Tree* pWin = new QuickCode_Tree(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int alert(xstring str) |
| | | { |
| | | TApp::alert(this, str); |
| | | //win::MessageBox(GetHWND(),str,L"æç¤º:",0); |
| | | return 0; |
| | | } |
| | | int SetAgent() |
| | | { |
| | | 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 OnRetrieve() |
| | | { |
| | | dw_list.AcceptText(); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"id", m_id); |
| | | arg.AddArg(L"sType", c_type); |
| | | arg.AddArg(L"QueryTxt", m_QueryTxt); |
| | | //trace(arg.GetString()); |
| | | /*if (TDataSet::exec(m_config, L"query1", arg.GetString(),x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | }*/ |
| | | if (xurl::get(L"QuickCode/entity/listaddtree", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | //trace(x.xml()); |
| | | if (x.xml() == L"") |
| | | { |
| | | xml xx; |
| | | xx.loadXML(L"<root/>"); |
| | | dw_list.Retrieve(xx); |
| | | dw_list.Redraw(); |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int OnTreeSelChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | HTREEITEM hItem = nmtv.itemNew.hItem; |
| | | |
| | | |
| | | HTREEITEM hitem = tv_1.GetSelectedItem(); |
| | | //c_type=dw_type.GetItemLabel(hitem); |
| | | //妿æ¯è·èç¹ |
| | | HTREEITEM roothitem = tv_1.GetRootItem(); |
| | | if (hitem == roothitem) { |
| | | c_type = L""; |
| | | } |
| | | else |
| | | { |
| | | c_type = tv_1.GetItemLabel(hitem); |
| | | |
| | | } |
| | | OnRetrieve(); |
| | | return 1; |
| | | } |
| | | int adduomfolder() |
| | | { |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"note", L"æ°å¢"); |
| | | arg.AddArg(L"m_id", m_id); |
| | | //win::OpenWindow(L"dev:xpage[AddUomGroup.vx]",arg); |
| | | openUrl(L"å
Œ
±è®¾ç½®.vface/xpage/quickcode/AddGroup", arg); |
| | | xstring ok = arg.GetArgString(L"return"); |
| | | if (ok == L"ok") { |
| | | xstring GroupName = arg.GetArgString(L"GroupName"); |
| | | xml xx; |
| | | |
| | | xaserverarg args; |
| | | |
| | | args.AddArg(L"GroupName", GroupName); |
| | | args.AddArg(L"OldGroupName", L""); |
| | | args.AddArg(L"m_id", m_id); |
| | | /*if(TFile::exec(m_config,L"updateuomtype",args,xx)!=1) |
| | | { |
| | | trace(L"error:"+xx.xml()); |
| | | alert(L"ä¿ååºé!"); |
| | | return 0; |
| | | }*/ |
| | | if (xurl::get(L"QuickCode/pref/quickcode_tree.updateGroup", args.GetString(), xx) != 1) |
| | | { |
| | | trace(L"error:" + (xstring)xx.xml()); |
| | | alert(L"ä¿ååºé!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | xstring vv = xx.documentElement().text(); |
| | | xml x; |
| | | |
| | | x.loadXML(L"<row GroupName='" + GroupName + L"'/>"); |
| | | HTREEITEM root = tv_1.GetRootItem(); |
| | | if (vv == L"OK") |
| | | { |
| | | tv_1.InsertChildItem(root, GroupName, x.documentElement(), 15); |
| | | } |
| | | |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int modifyuomfolder() |
| | | { |
| | | |
| | | HTREEITEM h = tv_1.GetSelectedItem(); |
| | | if (!h) |
| | | { |
| | | alert(L"è¯·éæ©éè¦ä¿®æ¹çç»å"); |
| | | return 0; |
| | | } |
| | | HTREEITEM roothitem = tv_1.GetRootItem(); |
| | | if (h == roothitem) |
| | | { |
| | | alert(L"ä¸è½ä¿®æ¹æ ¹èç¹åç§°ï¼"); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = tv_1.GetItemData(h); |
| | | trace(e.xml()); |
| | | //xstring OldGroupName= e.SelectSingleNode(L"@GroupName").text(); |
| | | xstring OldGroupName = tv_1.GetItemLabel(h); |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"note", L"ä¿®æ¹"); |
| | | arg.AddArg(L"m_id", m_id); |
| | | arg.AddArg(L"GroupName", OldGroupName); |
| | | OpenWindow(L"dev:xpage[AddUomGroup.vx]", arg); |
| | | xstring ok = arg.GetArgString(L"return"); |
| | | if (ok == L"ok") { |
| | | xstring NewGroupName = arg.GetArgString(L"GroupName"); |
| | | xml xx; |
| | | |
| | | xaserverarg args; |
| | | |
| | | args.AddArg(L"GroupName", NewGroupName); |
| | | args.AddArg(L"OldGroupName", OldGroupName); |
| | | args.AddArg(L"m_id", m_id); |
| | | /*if(TFile::exec(m_config,L"updateuomtype",args,xx)!=1) |
| | | { |
| | | trace(L"error:"+xx.xml()); |
| | | alert(L"ä¿ååºé!"); |
| | | return 0; |
| | | }*/ |
| | | if (xurl::get(L"QuickCode/pref/quickcode_tree.updateGroup", args.GetString(), xx) != 1) |
| | | { |
| | | trace(L"error:" + (xstring)xx.xml()); |
| | | alert(L"ä¿ååºé!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | trace(xx.xml()); |
| | | xstring vv = xx.documentElement().text(); |
| | | if (vv == L"OK") |
| | | { |
| | | tv_1.SetItemLabel(h, NewGroupName); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int deluomfolder() |
| | | { |
| | | |
| | | HTREEITEM hitem = tv_1.GetSelectedItem(); |
| | | if (!hitem) |
| | | { |
| | | alert(L"è¯·éæ©éè¦å é¤çç»å"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | |
| | | int s = dw_list.GetRowCount(); |
| | | if (s > 0) |
| | | { |
| | | alert(L"该åç»ä¸é¢å卿°æ®ï¼ä¸è½å é¤ï¼"); |
| | | return 0; |
| | | } |
| | | HTREEITEM roothitem = tv_1.GetRootItem(); |
| | | if (hitem == roothitem) |
| | | { |
| | | alert(L"ä¸è½å 餿 ¹èç¹ï¼"); |
| | | } |
| | | else |
| | | { |
| | | //缺å°å¤æå é¤çæ¡ä»¶ |
| | | xstring GroupName = tv_1.GetItemLabel(hitem); |
| | | if (MessageBox(GetHWND(), L"ç¡®å®å é¤ç»åï¼" + GroupName + L" åï¼", L"æç¤º", 1) == 1) |
| | | { |
| | | xml xx; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"GroupName", GroupName); |
| | | arg.AddArg(L"m_id", m_id); |
| | | trace(GroupName); |
| | | trace(m_id); |
| | | /*if (xaserver::ExecXAction(GetServerUrl(),L"[delete.type.FND_UOM.xa]",arg.GetString()) == 1) |
| | | { |
| | | tv_1.DeleteItem(wid,hitem); |
| | | //OnTreeSelChanged(); |
| | | }*/ |
| | | if (xurl::get(L"QuickCode/pref/quickcode_tree.deleteGroup", arg.GetString(), xx) == 1) |
| | | { |
| | | tv_1.DeleteItem(hitem); |
| | | } |
| | | else |
| | | alert(L"å é¤å¤±è´¥ï¼"); |
| | | } |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | xdwgrid getDW() |
| | | { |
| | | return dw_list; |
| | | } |
| | | int GridSearch() |
| | | { |
| | | xml x; |
| | | |
| | | xaserver::LoadUrl(L"", L"dev:vface[å
Œ
±è®¾ç½®.vface]", L"", x); |
| | | //trace(x.xml()); |
| | | //trace(strtpl); |
| | | xstring aa = strtpl; |
| | | var doc = x; |
| | | var n = doc.selectSingleNode(L"//resource[@url='" + aa + L"']/@src"); |
| | | //trace(n.text()); |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sheet", n.text()); |
| | | arg.AddArg(L"search", list::m_QueryTxt); |
| | | openUrl(L"view.dlg.vface/xpage/grid/column/search", arg); |
| | | xstring ok = arg.GetArgString(L"return"); |
| | | if (ok == L"ok") { |
| | | xstring txt = arg.GetArgString(L"search"); |
| | | if (txt != L"") { |
| | | m_QueryTxt = txt; |
| | | //trace(txt); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | xdwgrid dw = getDW(); |
| | | if (comdid == L"save") { |
| | | dw_list.AcceptText(); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | dw_list.DwUpdateAllToEx(x); |
| | | KXMLDOMElement e = x.documentElement(); |
| | | e.setAttribute(L"id", m_id); |
| | | //arg.AddArg(L"id",m_id); |
| | | //trace(m_id); |
| | | //trace(m_dbmap); |
| | | if (m_id == L"å¼ç¥¨é¶è¡") |
| | | { |
| | | xml kp; |
| | | |
| | | kp.loadXML(L"<root></root>"); |
| | | KXMLDOMElement ele = kp.documentElement(); |
| | | var list = e.selectNodes(L"item[@update.modify='1' or @update.delete='1' ]"); |
| | | int j; |
| | | int k = list.length; |
| | | for (j = 0; j < k; j++) |
| | | { |
| | | KXMLDOMElement ele1 = list.item(j); |
| | | ele.appendChild(ele1); |
| | | } |
| | | kpstr = ele.xml(); |
| | | trace(ele.xml()); |
| | | } |
| | | if (m_id == L"å¼ç¥¨é¶è¡") |
| | | { |
| | | arg.AddArg(L"content", kpstr); |
| | | } |
| | | else |
| | | { |
| | | arg.AddArg(L"content", e.xml()); |
| | | } |
| | | arg.AddArg(L"dbmap", m_dbmap); |
| | | /*if(TFile::exec(m_config,L"save",arg,x)!=1) |
| | | { |
| | | trace(L"error:"+x.xml()); |
| | | alert(L"ä¿ååºé!"); |
| | | return 0; |
| | | }*/ |
| | | trace(m_dbmap + L"\r\n" + e.xml()); |
| | | if (xurl::get(L"QuickCode/pref/quickcode.save", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | trace(error); |
| | | } |
| | | //trace(arg.GetString()); |
| | | if (x.selectSingleNode(L"error")) |
| | | { |
| | | alert(L"ä¿ååºé2!"); |
| | | return 0; |
| | | } |
| | | dw_list.ResetUpdateStatus(); |
| | | alert(L"ä¿åæå!"); |
| | | } |
| | | else if (comdid == L"add") { |
| | | dw.InsertRow(0); |
| | | int rows = dw.GetRowCount(); |
| | | dw.SetItemString(rows, L"GroupName", c_type); |
| | | dw.SetItemString(rows, L"BankName", c_type); |
| | | } |
| | | else if (comdid == L"insert") { |
| | | int row = dw.GetRow(); |
| | | if (row<1 || row>dw.GetRowCount()) return 0; |
| | | dw.InsertRow(row); |
| | | |
| | | dw.SetItemString(row, L"GroupName", c_type); |
| | | } |
| | | else if (comdid == L"delet") { |
| | | dw_list.AcceptText(); |
| | | int row2 = dw.GetRow(); |
| | | if (row2<1 || row2>dw.GetRowCount()) return 0; |
| | | dw.DeleteRow(row2); |
| | | } |
| | | else if (comdid == L"adduomfolder") |
| | | adduomfolder(); |
| | | else if (comdid == L"modifyuomfolder") |
| | | modifyuomfolder(); |
| | | else if (comdid == L"deluomfolder") |
| | | deluomfolder(); |
| | | else if (comdid == L"search") |
| | | GridSearch(); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 0; |
| | | } |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | int OnSetFocus(TEvent* evt, LPARAM p) |
| | | { |
| | | SetAgent(); |
| | | tv_1 = new treeview; |
| | | tv_1.setNativePointer(GetControl(L"tv_1")); |
| | | |
| | | HTREEITEM root = tv_1.GetRootItem(); |
| | | tv_1.ExpandItem(root); |
| | | return 1; |
| | | } |
| | | int OnDoubleClicked(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | if (row<1 || row > dw_list.GetRowCount()) return 0; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | //xstring str = hdr.data; |
| | | xstring colname = hdr.colname; |
| | | xstring str = dw_list.GetItemString(row, colname); |
| | | arg.AddArg(L"value", str); |
| | | openUrl(L"/sale/view/view.dlg/xpage/memo/edit", arg); |
| | | xstring comdid = arg.GetArgString(L"comdid"); |
| | | if (comdid == L"xmOK") |
| | | { |
| | | xstring value = arg.GetArgString(L"value"); |
| | | dw_list.SetItemString(row, colname, value); |
| | | dw_list.Redraw(); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int ItemOutput() |
| | | { |
| | | xstring d = xaserver::GetCurrentDate(); |
| | | d = d.left(10) + L""; |
| | | dw_list.SaveAs(d); |
| | | return 1; |
| | | } |
| | | int OnSelectAllRow() |
| | | { |
| | | int rows = dw_list.GetRowCount(); |
| | | if (rows < 1) return -1; |
| | | dw_list.SelectRow(1, rows, true); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | int OnRowCopy() |
| | | { |
| | | int rows = dw_list.GetRowCount(); |
| | | if (rows < 1) return -1; |
| | | int cols = dw_list.GetColumnCount(); |
| | | xstring str = L""; |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | int i; |
| | | while (row > 0) |
| | | { |
| | | xstring tmp1 = L""; |
| | | for (i = 1; i < cols; i++) |
| | | { |
| | | int w = dw_list.GetColumnWidth(i); |
| | | if (w < 5) continue; |
| | | xstring tmp; |
| | | if (dw_list.GetItemDisplayString(row, i + 1)) |
| | | tmp = dw_list.GetItemDisplayString(row, i + 1); |
| | | else |
| | | tmp = dw_list.GetItemString(row, i + 1); |
| | | tmp1 += tmp + L"\t"; |
| | | } |
| | | str += tmp1 + L"\r\n"; |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | dw_list.SetDataToClip(str); |
| | | return 1; |
| | | } |
| | | int OnColCopy(xstring col) |
| | | { |
| | | int rows = dw_list.GetRowCount(); |
| | | if (rows < 1) return -1; |
| | | xstring str = L""; |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | while (row > 0) |
| | | { |
| | | xstring tmp; |
| | | if (dw_list.GetItemDisplayString(row, col)) |
| | | tmp = dw_list.GetItemDisplayString(row, col); |
| | | else |
| | | tmp = dw_list.GetItemString(row, col); |
| | | str += tmp + L"\r\n"; |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | dw_list.SetDataToClip(str); |
| | | |
| | | return 1; |
| | | } |
| | | int OnRClick(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | |
| | | int m = win::CreatePopupMenu(); |
| | | int MF_STRING = 0x00000000; |
| | | int MF_DISABLED = 0x00000002; |
| | | int TPM_RIGHTBUTTON = 0x0002; |
| | | int TPM_RETURNCMD = 0x0100; |
| | | int MF_CHECKED = 0x8; |
| | | int MF_SEPARATOR = 0x0800; |
| | | win::AppendMenu(m, MF_STRING, 1, L"å¤å¶è¡"); |
| | | win::AppendMenu(m, MF_STRING, 101, L"å¤å¶å"); |
| | | win::AppendMenu(m, MF_SEPARATOR, -1, L""); |
| | | win::AppendMenu(m, MF_STRING, 2, L"ȫѡ"); |
| | | win::AppendMenu(m, MF_SEPARATOR, -1, L""); |
| | | win::AppendMenu(m, MF_STRING, 4, L"导åºå°Excel"); |
| | | win::AppendMenu(m, MF_SEPARATOR, -1, L""); |
| | | win::AppendMenu(m, MF_STRING, 6, L"æ¾ç¤ºå设置"); |
| | | xrect xr; |
| | | xpoint pt; |
| | | win::GetCursorPos(pt); |
| | | int ret = win::TrackPopupMenu(m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, GetHWND(), xr); |
| | | |
| | | //trace(ret); |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | if (ret == 1) { OnRowCopy(); } |
| | | else if (ret == 101) { |
| | | xstring colname = hdr.colname; |
| | | if (colname != L"") |
| | | OnColCopy(colname); |
| | | } |
| | | else if (ret == 2) { OnSelectAllRow(); } |
| | | else if (ret == 4) { ItemOutput(); } |
| | | else if (ret == 6) {} |
| | | xutil::RestoreCursor(hCursor); |
| | | |
| | | return 1; |
| | | } |
| | | int OnAttachEvent() |
| | | { |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&QuickCode_Tree::OnSetFocus); |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&QuickCode_Tree::OnXCommand); |
| | | //è·å¾æ çéæ©äºä»¶ |
| | | AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&QuickCode_Tree::OnTreeSelChanged); |
| | | AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&QuickCode_Tree::OnDoubleClicked);//è¡åå» |
| | | AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&QuickCode_Tree::OnRClick);//é¼ æ å³é® |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | xstring jxParam(xstring p, xstring n) |
| | | { |
| | | if (p != L"") |
| | | { |
| | | p += L"&"; |
| | | int i = 1; |
| | | while (p.find(L"=L", 0) > 0) |
| | | { |
| | | xstring name = p.mid(0, p.find(L"=L", 0)); |
| | | xstring value = p.mid(p.find(L"=L", 0) + 1, p.find(L"&", 0) - p.find(L"=L", 0) - 1); |
| | | if (name == n) return L"" + value; |
| | | i += 1; |
| | | p = p.mid(p.find(L"&", 0) + 1, p.length()); |
| | | } |
| | | } |
| | | return L""; |
| | | } |
| | | int getURLParam() |
| | | { |
| | | if (GetWinParam()) |
| | | { |
| | | xpage xp = new xpage; |
| | | xp.setNativePointer(GetXPage()); |
| | | xstring aurl = xp.GetWkUrl(); |
| | | xaserverarg arg; |
| | | if (aurl && aurl.find(L"native=true", 0) > 0) |
| | | { |
| | | int p = GetParam(); |
| | | arg; |
| | | arg.setNativePointer(p); |
| | | } |
| | | else |
| | | { |
| | | arg = GetParam(); |
| | | } |
| | | xstring config = arg.GetArgString(L"config"); |
| | | xml x; |
| | | |
| | | if (config == L"") |
| | | { |
| | | xstring configXml = arg.GetArgString(L"configxml"); |
| | | x.loadXML(configXml); |
| | | } |
| | | else |
| | | { |
| | | getUrl(config, L"", x); |
| | | } |
| | | m_configDoc = x; |
| | | |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int loaded() |
| | | { |
| | | getURLParam(); |
| | | KXMLDOMDocument ee = m_configDoc; |
| | | xstring id = m_id; |
| | | var n = ee.selectSingleNode(L"//list/dwview[@type='dwgrid'][@id='" + id + L"']"); |
| | | if (n) |
| | | { |
| | | KXMLDOMElement e = n; |
| | | //trace(e.xml); |
| | | xstring vface = m_configDoc.selectSingleNode(L"//vface[1]").text(); |
| | | xstring dwname = L"";//e.selectsingleNode(L"@name").text(); |
| | | xstring tpl = L"";//e.selectsingleNode(L"@url").text(); |
| | | xstring dbmap = L""; |
| | | xstring strtreexquery = L""; |
| | | if (e.selectSingleNode(L"@name")) dwname = e.selectSingleNode(L"@name").text(); |
| | | if (e.selectSingleNode(L"@url")) tpl = e.selectSingleNode(L"@url").text(); |
| | | if (e.selectSingleNode(L"@dbmap")) dbmap = e.selectSingleNode(L"@dbmap").text(); |
| | | if (e.selectSingleNode(L"@treexquery")) strtreexquery = e.selectSingleNode(L"@treexquery").text(); |
| | | m_dbmap = dbmap; |
| | | treexquery = strtreexquery; |
| | | //trace(vface +L"/"+ tpl); |
| | | //trace(selectmode); |
| | | dw_list = new xdwgrid; |
| | | dw_list.setNativePointer(GetControl(dwname)); |
| | | dw_list.openUrl(vface + L"/" + tpl); |
| | | strtpl = tpl; |
| | | trace(tpl); |
| | | |
| | | } |
| | | } |
| | | int onload() |
| | | { |
| | | |
| | | SetArg(); |
| | | m_config = L"QuickCode.config"; |
| | | m_agent = L""; |
| | | dw_list = new xdwtable; |
| | | dw_list.setNativePointer(GetControl(L"dw_list")); |
| | | if (GetWinParam()) |
| | | { |
| | | xaserverarg arg = GetArg(); |
| | | //trace(arg.GetString()); |
| | | xstring id = arg.GetArgString(L"id"); |
| | | if (id == L"") return 0; |
| | | m_id = id; |
| | | loaded(); |
| | | |
| | | /*xstring tpl = arg.GetArgString(L"tpl"); |
| | | if(tpl == L"") |
| | | tpl = L"QuickCode.tpl/QuickCode"; |
| | | dw_list.SetDataObject(GetServerUrl(),L"dev:sheet["+tpl+L"]"); |
| | | //dw_list.SetColHeaderHeight(0); |
| | | //dw_list.SetRowSelectorWidth(0); |
| | | xstring dbmap = arg.GetArgString(L"dbmap"); |
| | | if(dbmap == L"") |
| | | dbmap = L"QuickCode.dbmap"; |
| | | m_dbmap = dbmap; |
| | | xstring txquery=arg.GetArgString(L"treexquery"); |
| | | treexquery=txquery; |
| | | xstring title = arg.GetArgString(L"title"); |
| | | if(title != L"") |
| | | win::SetWindowText(GetHWND(),title);*/ |
| | | OnRetrieve(); |
| | | } |
| | | SetAgent(); |
| | | xstring aa = treexquery; |
| | | xstring xfNodeAgentArea2 = L"treeagent"; |
| | | xnode tnode = new xnode; |
| | | tnode.setNativePointer(GetAgentNode(xfNodeAgentArea2)); |
| | | xstring stree = L"<vbox><xtree name='tv_1' imagelist='0'>"; |
| | | stree += L"<treeitem src='xquery:[" + aa + L"]' xcaption='@GroupName' xroot='/root' xpath='row' xchildpath='row' image='15' loop='yes' xdata='.'/>"; |
| | | stree += L"</xtree></vbox>"; |
| | | SetAgentNode(tnode, stree); |
| | | |
| | | tv_1 = new treeview; |
| | | tv_1.setNativePointer(GetControl(L"tv_1")); |
| | | |
| | | HTREEITEM root = tv_1.GetRootItem(); |
| | | tv_1.ExpandItem( root); |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |