#pragma once
|
|
#include <wobject/xwin.hpp>
|
#include <wobject/xurl.hpp>
|
#include <xcontrol/xdwgrid.hpp>
|
#include <xcontrol/xdwpages.hpp>
|
#include "listex.vframe.vbusiness.hpp"
|
#include "frame.vframe.vbusiness.hpp"
|
|
class listwin : public xframe
|
{
|
public:
|
xdwgrid dw_list;
|
xdwpages dw_pages;
|
string m_QueryTxt;
|
KXMLDOMDocument m_configDoc;
|
int m_pageIndex;
|
int m_pageNumber;
|
listEx* m_listEx;
|
|
listwin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd){}
|
|
xstring GetEntityWorkNode(/*param*/LPARAM pr, xstring what)
|
{
|
if (m_configDoc)
|
{
|
KXMLDOMNode n = m_configDoc.selectSingleNode(L"//worknodes/worknode[@for='" + what + L"']/@url");
|
if (n)
|
{
|
xstring surl = n.text();
|
if (surl.find(L"/", 0) != 0)
|
{
|
xstring vface = m_configDoc.selectSingleNode(L"//vface[1]").text();
|
surl = vface + L"/" + surl;
|
}
|
return surl;
|
}
|
}
|
return L"";
|
}
|
|
string GetEntityIDName(/*param*/int pr)
|
{
|
if (m_configDoc)
|
{
|
if (m_configDoc.selectSingleNode(L"//entity/EntityID[1]"))
|
return m_configDoc.selectSingleNode(L"//entity/EntityID[1]").text();
|
else
|
return L"";
|
}
|
else
|
return L"";
|
}
|
|
xstring GetEntityID(LPARAM pr)
|
{
|
int row = dw_list.GetRow();
|
if (row<0 || row>dw_list.GetRowCount()) return L"";
|
KXMLDOMElement ele = dw_list.GetRowElement(row);
|
xstring id = GetEntityIDName(pr);
|
if (id == L"") return L"";
|
if (ele.selectSingleNode(id))
|
{
|
xstring d = ele.selectSingleNode(id).text();
|
return L"" + d;
|
}
|
return L"";
|
}
|
|
virtual xstring GetEntityRowData(LPARAM pr)
|
{
|
int row = dw_list.GetRow();
|
if (row<0 || row>dw_list.GetRowCount()) return L"";
|
KXMLDOMElement ele = dw_list.GetRowElement(row);
|
ele.setAttribute(L"update.delete", L"1");
|
ele.setAttribute(L"guid", GetEntityID(1).c_str());
|
//trace(ele.xml);
|
return ele.xml();
|
}
|
|
virtual xstring GetEntityData(LPARAM pr)
|
{
|
dw_list.AcceptText();
|
KXMLDOMDocument x;
|
dw_list.DwUpdateAllToEx(x);
|
return x.xml();
|
}
|
|
xstring GetEntityName(LPARAM pr)
|
{
|
if (m_configDoc)
|
{
|
if (m_configDoc.selectSingleNode(L"//entity/name[1]"))
|
{
|
return m_configDoc.selectSingleNode(L"//entity/name[1]").text();
|
}
|
else
|
return L"";
|
}
|
else
|
return L"";
|
}
|
|
xstring GetEntityTitle(LPARAM pr)
|
{
|
if (m_configDoc)
|
{
|
if (m_configDoc.selectSingleNode(L"//entity/EntityName[1]"))
|
{
|
int row = dw_list.GetRow();
|
if (row<0 || row>dw_list.GetRowCount()) return L"";
|
KXMLDOMElement ele = dw_list.GetRowElement(row);
|
string id = m_configDoc.selectSingleNode(L"//entity/EntityName[1]").text();
|
if (ele.selectSingleNode(id))
|
return ele.selectSingleNode(id).text();
|
else
|
return L"";
|
}
|
else
|
return L"";
|
}
|
else
|
return L"";
|
}
|
|
xstring GetEntityNo(LPARAM pr)
|
{
|
if (m_configDoc)
|
{
|
if (m_configDoc.selectSingleNode(L"//entity/EntityNo[1]"))
|
{
|
int row = dw_list.GetRow();
|
if (row<0 || row>dw_list.GetRowCount()) return L"";
|
KXMLDOMElement ele = dw_list.GetRowElement(row);
|
string id = m_configDoc.selectSingleNode(L"//entity/EntityNo[1]").text();
|
if (ele.selectSingleNode(id))
|
return ele.selectSingleNode(id).text();
|
else
|
return L"";
|
}
|
else
|
return L"";
|
}
|
else
|
return L"";
|
}
|
|
int getURLParam()
|
{
|
if (GetWinParam())
|
{
|
xaserverarg arg = GetArg();
|
xstring config = arg.GetArgString(L"config");
|
KXMLDOMDocument x;
|
if (config == L"")
|
{
|
string configXml = arg.GetArgString(L"configxml");
|
if (configXml == L"") return 1;
|
x.loadXML(configXml);
|
}
|
else
|
{
|
getUrl(GetServerUrl(),config, L"", x);
|
}
|
m_configDoc = x;
|
}
|
return 1;
|
}
|
|
virtual int SetEntityData(xaserverarg arg)
|
{
|
return 0;
|
}
|
|
virtual int OnPreRetrieve()
|
{
|
return 0;
|
}
|
|
virtual int OnPostRetrieve()
|
{
|
return 0;
|
}
|
|
virtual int setSearchInit()
|
{
|
return 0;
|
}
|
|
int OnRetrieve()
|
{
|
|
if (OnPreRetrieve() == 1)
|
return 0;
|
|
xaserverarg arg;
|
arg.AddArg(L"pageindex", xstring(m_pageIndex), L""); //µÚ¼¸Ò³
|
arg.AddArg(L"pagenumber", xstring(m_pageNumber), L""); //ÿҳÊýÁ¿
|
arg.AddArg(L"QueryTxt", m_QueryTxt, L""); //²éѯÌõ¼þ
|
//trace("OnRetrieve.arg="+arg.GetString());
|
|
KXMLDOMDocument x;
|
|
KXMLDOMNode n = m_configDoc.selectSingleNode(L"//list/dwview[@type='dwgrid'][1]");
|
if (n)
|
{
|
//trace("OnRetrieve.n != null");
|
KXMLDOMElement e = n;
|
//trace("OnRetrieve.e="+e.xml);
|
if (e.selectSingleNode(L"@dataurl"))
|
{
|
xstring dataUrl = e.selectSingleNode(L"@dataurl").text();
|
//trace("OnRetrieve.dataUrl="+dataUrl);
|
if (getUrl(GetServerUrl(),GetEntityName(1) + L"/" + dataUrl, arg.GetString(), x) != 1)
|
return 1;
|
|
//trace("OnRetrieve.GetEntityName(1)/dataUrl="+GetEntityName(1)+"/"+dataUrl);
|
//trace("OnRetrieve.x="+x.GetXml());
|
|
KXMLDOMElement ele = x.documentElement();
|
|
if (dw_pages)
|
{
|
if (ele.selectSingleNode(L"@TotalPage"))
|
{
|
xstring s = ele.selectSingleNode(L"@TotalPage").text(); //×ÜÊýÁ¿
|
dw_pages.SetMaxPage(s.toInt());
|
}
|
}
|
//trace("OnRetrieve.Retrieve(x)");
|
dw_list.Retrieve(x);
|
dw_list.Redraw();
|
if (e.selectSingleNode(L"@readonly"))
|
{
|
if (e.selectSingleNode(L"@readonly").text() == L"Y")
|
dw_list.SetReadOnly(true);
|
}
|
else
|
dw_list.SetReadOnly(true);
|
}
|
else
|
{
|
//trace("OnRetrieve.SetEntityData");
|
SetEntityData(arg);
|
}
|
}
|
else
|
{
|
// trace("OnRetrieve.n == null");
|
SetEntityData(arg);
|
}
|
//trace("OnRetrieve.OnPostRetrieve begin");
|
OnPostRetrieve();
|
//trace("OnRetrieve.OnPostRetrieve end");
|
return 1;
|
}
|
|
int OnChangePages(TNotifyEvent* evt, LPARAM p)
|
{
|
PAGENMHDR* h = (PAGENMHDR*)evt->notify.pnmh;
|
int c = h->cur;
|
HCURSOR hCursor = xutil::SetCursorWait();
|
m_pageIndex = c;
|
OnRetrieve();
|
xutil::RestoreCursor(hCursor);
|
return 1;
|
}
|
|
int OnSetFocus(TNotifyEvent* evt, LPARAM p)
|
{
|
//if(!m_configDoc) return -1; //---
|
KXMLDOMNode n = m_configDoc.selectSingleNode(L"//list/dwview[@type='dwgrid'][1]");
|
if (n)
|
{
|
KXMLDOMElement e = n;
|
if (e.selectSingleNode(L"@rowagent"))
|
{
|
xstring rowagent = e.selectSingleNode(L"@rowagent").text();
|
if (rowagent == L"Y")
|
{
|
int row = dw_list.GetRow();
|
if (row < 1 || row > dw_list.GetRowCount())
|
SetAgent(L"list");
|
else
|
{
|
KXMLDOMElement ele = dw_list.GetRowElement(row);
|
string id = GetEntityIDName(1);
|
string entity = ele.selectSingleNode(id).text();
|
//alert(ele.xml);
|
SetAgent(L"list", entity);
|
}
|
}
|
}
|
else
|
SetAgent(L"list");
|
}
|
else
|
SetAgent(L"list");
|
return 1;
|
}
|
|
int OnPrint()
|
{
|
xaserverarg& arg = *(new xaserverarg);
|
arg.AddArg(L"EntityName", GetEntityName(1), L"");
|
arg.AddArg(L"EntityID", GetEntityID(1), L"");
|
arg.AddArg(L"EntityNo", GetEntityNo(1), L"");
|
//openUrl("/sale/view/view.base/xpage/Template/PrintView", p);
|
openUrl(L"/sale/view/view.base/xpage/Template/PrintViewEx", &arg);
|
|
return 1;
|
}
|
|
virtual int Onhistroydata()
|
{
|
return 1;
|
}
|
|
int GridSearch()
|
{
|
xaserverarg arg;
|
if (m_configDoc.selectSingleNode(L"Config/search"))
|
{
|
KXMLDOMNode nn = m_configDoc.selectSingleNode(L"Config/search");
|
arg.AddArg(L"sheet", nn.xml(), L"");
|
}
|
else
|
{
|
xstring tpl = L"";
|
xstring vface = m_configDoc.selectSingleNode(L"//vface[1]").text();
|
KXMLDOMNode n = m_configDoc.selectSingleNode(L"//list/dwview[@type='dwgrid'][1]");
|
if (n)
|
{
|
KXMLDOMElement e = n;
|
if (e.selectSingleNode(L"@url")) tpl = e.selectSingleNode(L"@url").text();
|
}
|
if (tpl == L"") return -1;
|
KXMLDOMDocument x;
|
xurl::get(GetServerUrl(),vface + L"/" + tpl, L"", x);
|
arg.AddArg(L"sheet", x.xml(), L"");
|
//alert(m_QueryTxt);
|
}
|
arg.AddArg(L"search", m_QueryTxt, L"");
|
//trace(arg.GetString());
|
|
OpenWindow(L"dev:xpage[search.column.grid.ex.vx]", (LPARAM) & 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);
|
m_pageIndex = 1;
|
if (dw_pages) dw_pages.SetCurPage(1);
|
OnRetrieve();
|
}
|
}
|
return 0;
|
}
|
|
virtual int GridSearchExAdd()
|
{
|
return 1;
|
}
|
|
int GridSearchEx()
|
{
|
//trace("372Line :GridSearchEx %d %d",dw_pages.ptr_native_,dw_pages.get_native_ptr());
|
m_pageIndex = 1;
|
if (dw_pages)dw_pages.SetCurPage(1);
|
m_QueryTxt = m_listEx->GridSearchEx();
|
GridSearchExAdd();
|
OnRetrieve();
|
return 1;
|
}
|
|
int OnSearchDropDown(TNotifyEvent* evt, LPARAM p) {
|
m_listEx->OnSelectDialog();
|
return 0;
|
}
|
int OnSearchCombboChange(TEvent* evt, LPARAM lParam)
|
{
|
HWND k= (HWND)evt->lParam;
|
int h = xcombobox::GetCurSel(k);
|
if (h < 0) return 0;
|
int ret = m_listEx->ComboChange(h);
|
if (ret == 3)
|
AttachEvent(L"_cb_grid_value1", L"CBN_DROPDOWN", (FEvent)&listwin::OnSearchDropDown);
|
return 1;
|
}
|
int rowSearch(string tpl)
|
{
|
m_listEx = new listEx();
|
m_listEx->Init(this, m_configDoc);
|
//alert(tpl);
|
int ret = m_listEx->rowSearch(tpl);
|
if (ret == 1)
|
AttachEvent(L"_cb_grid_col", L"CBN_SELCHANGE", (FEvent)&listwin::OnSearchCombboChange);
|
return ret;
|
}
|
virtual int PostOnAttachEvent()
|
{
|
return 1;
|
}
|
|
virtual int PreOnCmdDispatch(string comdid)
|
{
|
//·µ»Ø0¡ª¡ª²»ÔÚÖ´ÐÐÒÔÏ´úÂ룻·µ»ØÆäËû¡ª¡ªÖ´ÐÐÒÔÏ´úÂë¡£
|
return 1;
|
}
|
|
virtual int PostOnCmdDispatch(string comdid)
|
{
|
// trace("test");
|
return 1;
|
}
|
|
xstring GetSheetContent()
|
{
|
if (m_configDoc) {}
|
else return L"";
|
|
if (m_configDoc.selectSingleNode(L"Config/columns"))
|
{
|
KXMLDOMElement e = m_configDoc.selectSingleNode(L"Config/columns");
|
return e.xml();
|
}
|
if (m_configDoc.selectSingleNode(L"//list/dwview[@type='dwgrid'][1]"))
|
{
|
KXMLDOMElement e2 = m_configDoc.selectSingleNode(L"//list/dwview[@type='dwgrid'][1]");
|
xstring tpl = L"";
|
if (e2.selectSingleNode(L"@url")) tpl = e2.selectSingleNode(L"@url").text();
|
if (tpl != L"")
|
{
|
xstring vface = m_configDoc.selectSingleNode(L"//vface[1]").text();
|
KXMLDOMDocument x;
|
if (getUrl(GetServerUrl(),vface + L"/" + tpl, L"", x) == 1)
|
{
|
KXMLDOMElement e3 = x.documentElement();
|
//trace("e3--->%s\r\n",e3.xml);
|
xstring src = e3.xml();//
|
if (src.left(6) == L"<sheet")
|
return src;
|
src = e3.getAttribute(L"src");
|
return src;
|
}
|
}
|
}
|
return L"";
|
}
|
|
virtual int OnCanModifyRow(int row)
|
{
|
return 1;
|
}
|
|
virtual int OnPostModifyRows()
|
{
|
return 1;
|
}
|
|
int OnModifyRows()
|
{
|
xstring SheetStr = GetSheetContent();
|
//trace("sheet----> %s\r\n", SheetStr);
|
if (SheetStr == L"") return -1;
|
xaserverarg arg;
|
arg.AddArg(L"sheet", SheetStr);
|
openUrl(L"/sale/view/view.dlg/xpage/grid/column/editex", &arg);
|
//trace("%s", arg.GetString());
|
string ret = arg.GetArgString(L"return");
|
if (ret != L"ok") return 1;
|
string column = arg.GetArgString(L"column");
|
if (column == L"") return 1;
|
string tpy = arg.GetArgString(L"tpy");
|
string value = arg.GetArgString(L"value");// id //value
|
string value2 = arg.GetArgString(L"value2"); //value
|
int row = 1;
|
if (tpy != L"È«²¿ÐÐ")
|
row = dw_list.GetNextSelectRow(0);
|
while (row > 0)
|
{
|
int rowret = OnCanModifyRow(row);
|
if (rowret < 0) continue;
|
//dw_list.ItemChangeTo(row, column, value);
|
dw_list.SetItemString(row, column, value);
|
if (value2 != L"")
|
dw_list.SetItemDisplayString(row, column, value2);
|
if (tpy == L"È«²¿ÐÐ")
|
row++;
|
else
|
row = dw_list.GetNextSelectRow(row + 1);
|
if (row > dw_list.GetRowCount()) break;
|
}
|
OnPostModifyRows();
|
dw_list.Redraw();
|
return 1;
|
}
|
|
int AppendItem(KXMLDOMDocument x, KXMLDOMElement r, string name, string value)
|
{
|
KXMLDOMElement e = x.createElement(name);
|
e.settext(value);
|
e.setAttribute(L"update.modify", L"1");
|
r.appendChild(e);
|
return 1;
|
}
|
|
virtual xstring GetTemplateUrl()
|
{
|
KXMLDOMNode n = m_configDoc.selectSingleNode(L"//list/dwview[@type='dwgrid'][1]");
|
if (n)
|
{
|
KXMLDOMElement e0 = n;
|
xstring vface = m_configDoc.selectSingleNode(L"//vface[1]").text();
|
xstring tpl = L"";//e.selectsingleNode("@url").text;
|
if (e0.selectSingleNode(L"@url"))
|
tpl = e0.selectSingleNode(L"@url").text();
|
else
|
return L"";
|
if (tpl.left(1) == L"/") return tpl;
|
return vface + L"/" + tpl;
|
}
|
return L"";
|
}
|
|
int OnSaveTemplate(xdwgrid dw_list, string aurl)
|
{
|
//alert("먦·Å...");
|
if (aurl == L"") return -1;
|
int i;
|
int s = dw_list.GetColumnCount();
|
xaserverarg arg;
|
for (i = 1; i <= s; i++)
|
{
|
xstring name = dw_list.GetColumnName(i);
|
if (name == L"guid") continue;
|
string titlename = dw_list.GetTitleName(i - 1);
|
int width = dw_list.GetColumnWidth(name.c_str());
|
//trace("%s %s %d\r\n", titlename, name, width);
|
arg.AddArg(name, xstring(width), titlename);
|
}
|
//trace("%s \r\n", arg.GetString());
|
|
KXMLDOMDocument x;
|
x.loadXML(L"<root><SysGridCols update.new='1' update.modify='1'/></root>");
|
KXMLDOMElement doc = x.documentElement();
|
KXMLDOMElement e = doc.selectSingleNode(L"*");
|
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::GetUID());
|
doc.appendChild(e);
|
//trace(doc.xml);
|
xaserverarg arg0;
|
arg0.AddArg(L"content", doc.xml());
|
if (xurl::get(GetServerUrl(),L"/workflow/action/SysGridCols/bill.update", arg0.GetString(), x) != 1)
|
{
|
//trace("error:"+x.GetXml());
|
alert(L"³ö´í!");
|
}
|
return 1;
|
}
|
|
int SetUserTemplate(xstring aurl)
|
{
|
if (aurl == L"") return -1;
|
KXMLDOMDocument x;
|
xaserverarg arg;
|
arg.AddArg(L"user", xaserver::GetUID());
|
arg.AddArg(L"type", aurl);
|
if (getUrl(GetServerUrl(), L"/sale/data/product/category/col", arg.GetString(), x) != 1) return 0;
|
KXMLDOMElement e0 = x.documentElement();
|
if (e0.selectSingleNode(L"Cols")) {}
|
else return 0;
|
xstring content =e0.selectSingleNode(L"Cols").text();
|
x.loadXML(content);
|
//trace("content: %s \r\n x: %s", content, x.GetXml());
|
KXMLDOMElement e = x.documentElement();
|
KXMLDOMNodeList li = e.selectNodes(L"arg");
|
int i;
|
int s = li.length();
|
int h = 1;
|
for (i = 0; i < s; i++)
|
{
|
//if(i > 3) break;
|
KXMLDOMElement ele = li.item(i);
|
string name = ele.getAttribute(L"name");
|
int k = dw_list.GetColumnIndex(name) - 1;
|
if (k < 1) continue;
|
h++;
|
xstring value = ele.getAttribute(L"value");
|
int width = value.toInt();
|
dw_list.SetColumnWidth(name, width);
|
if (width < 0) dw_list.SetColumnState(name, false);
|
xstring tpy = ele.getAttribute(L"type");
|
if (tpy == L"xs:string" || tpy == L"") continue;
|
if (h >= dw_list.GetColumnCount()) break;
|
if (k != h) dw_list.MoveColumnTo(k, h);
|
}
|
|
return 1;
|
}
|
|
int OnCmdDispatch(xstring comdid)
|
{
|
int result = 0;
|
if (PreOnCmdDispatch(comdid) == 0)
|
return 1;
|
|
if (comdid.find(L"__ModifyRows", 0) >= 0)
|
{
|
OnModifyRows();
|
return 1;
|
}
|
|
if (comdid.find(L"__SaveTpl", 0) >= 0)
|
{
|
OnSaveTemplate(dw_list, GetTemplateUrl());
|
return 1;
|
}
|
|
if (comdid == L"action:bill.print") return OnPrint();
|
if (comdid == L"action:bill.histroydata") return Onhistroydata();
|
if (comdid == L"action:refresh")
|
{
|
xaserverarg arg;
|
OnRetrieve();
|
ViewUpdate(1, L"setstate", arg);
|
}
|
else if (comdid == L"action:search" || comdid == L"search" || comdid == L"action:bill.search")
|
{
|
GridSearch();
|
return 1;
|
}
|
else if (comdid.find(L"action:", 0) >= 0)
|
{
|
result = ProcessFlowAction(comdid, 1);
|
}
|
|
if (PostOnCmdDispatch(comdid) != 1)
|
{
|
//alert("error");
|
return -1;
|
}
|
if (comdid == L"showall") return ShowAll();
|
if (comdid == L"action:search1") return GridSearchnew();
|
if (comdid == L"action:customermodify") return CustomerModify();
|
if (comdid == L"_cb_grid_search") return GridSearchEx();
|
if (comdid == L"_cb_grid_search_ad") return GridSearch();
|
|
return result;
|
}
|
|
int OnDoubleClicked(TNotifyEvent* evt, LPARAM p)
|
{
|
HCURSOR hCursor = xutil::SetCursorWait();
|
OnCmdDispatch(L"action:bill.open");
|
xutil::RestoreCursor(hCursor);
|
return 1;
|
}
|
|
int OnRowChanged(TEvent* evt, LPARAM p)
|
{
|
DWNMHDR* hdr = (DWNMHDR*)evt->notify.pnmh;
|
int row = hdr->row;
|
KXMLDOMElement ele = dw_list.GetRowElement(row);
|
xstring id = GetEntityIDName(1);
|
xstring entity = ele.selectSingleNode(id).text();
|
SetAgent(L"list", entity);
|
|
return 1;
|
}
|
|
virtual int getGridRClickItem(xaserverarg arg)
|
{
|
return 1;
|
}
|
|
int OnGridRClicked(TEvent* evt, LPARAM p)
|
{
|
DWNMHDR* hdr = (DWNMHDR*)evt->notify.pnmh;
|
HWND idfrom = (HWND)hdr->idFrom;
|
xaserverarg arg;
|
arg.AddArg(L"__SaveTpl_" + xstring((__int64)idfrom), L"±£´æ²¼¾Ö");
|
arg.AddArg(L"__", L"");
|
arg.AddArg(L"__ModifyRows_" + xstring((__int64)idfrom), L"ÅúÁ¿ÐÞ¸Ä");
|
getGridRClickItem(arg);
|
//if(getRClickItem(arg) > 0)
|
// arg.AddArg("__ModifyRows", "ÅúÁ¿ÐÞ¸Ä");
|
hdr->data = arg.GetString();
|
return 1;
|
}
|
|
int OnXCommand(TEvent* evt, LPARAM p)
|
{
|
return OnCmdDispatch(evt->xcommand.pStrID);
|
}
|
|
int OnAttachEvent()
|
{
|
AttachEvent(L"WM_XCOMMAND", (FEvent)&listwin::OnXCommand);
|
AttachEvent(L"WM_SETFOCUS", (FEvent)&listwin::OnSetFocus);
|
//AttachEvent(L"dw_list",L"DWV_DOUBLECLICKED", (FEvent)&listwin::OnDoubleClicked);
|
PostOnAttachEvent();
|
OnCloseWindow();
|
return 0;
|
}
|
|
int onloaded()
|
{
|
KXMLDOMNode n = m_configDoc.selectSingleNode(L"//list/dwview[@type='dwgrid'][1]");
|
if (n)
|
{
|
KXMLDOMElement e = n;
|
xstring vface = m_configDoc.selectSingleNode(L"//vface[1]").text();
|
xstring tpl = L"";//e.selectsingleNode("@url").text;
|
if (e.selectSingleNode(L"@url")) tpl = e.selectSingleNode(L"@url").text();
|
if (e.selectSingleNode(L"@search"))
|
{
|
xstring colsearch = e.selectSingleNode(L"@search").text();
|
if (colsearch == L"Y")
|
{
|
int ret = rowSearch(vface + L"/" + tpl);
|
if (ret == -1)
|
{
|
OnRetrieve();
|
}
|
else
|
{
|
setSearchInit();
|
ret = GridSearchEx();
|
if (ret == -1)
|
{
|
//trace("onload.OnRetrieve1()");
|
OnRetrieve();
|
}
|
}
|
}
|
else
|
{
|
//trace("onload.OnRetrieve2()");
|
OnRetrieve();
|
}
|
}
|
else
|
{
|
//trace("onload.OnRetrieve66()");
|
OnRetrieve();
|
}
|
}
|
SetAgent(L"list");
|
return -1;
|
}
|
|
int onload()
|
{
|
OnAttachEvent();
|
getURLParam();
|
|
KXMLDOMNode n = m_configDoc.selectSingleNode(L"//list/dwview[@type='dwgrid'][1]");
|
if (n)
|
{
|
//trace("m_configDoc.xml1111111111="+m_configDoc.xml);
|
KXMLDOMElement e = n;
|
//trace("m_configDoc//list/dwview[@type='dwgrid'][1]="+e.xml);
|
xstring vface = m_configDoc.selectSingleNode(L"//vface[1]").text();
|
xstring dwname = L"";//e.selectsingleNode("@name").text;
|
xstring tpl = GetTemplateUrl();//e.selectsingleNode("@url").text;
|
xstring selectmode = L"4";
|
if (e.selectSingleNode(L"@name")) dwname = e.selectSingleNode(L"@name").text();
|
//if(e.selectSingleNode("@url")) tpl = e.selectSingleNode("@url").text;
|
if (e.selectSingleNode(L"@selectmode")) selectmode = e.selectSingleNode(L"@selectmode").text();
|
dw_list = GetControl(dwname);
|
dw_list.openUrl(GetServerUrl(), tpl);
|
SetUserTemplate(tpl);
|
|
|
dw_list.SetReadOnly(true);
|
dw_list.SetSelectionMode(selectmode.toInt());
|
//trace("onload.2");
|
if (e.selectSingleNode(L"@DBClick"))
|
{
|
AttachEvent(dwname, L"DWV_DOUBLECLICKED", (FEvent)&listwin::OnDoubleClicked);//ÐÐË«»÷
|
}
|
|
m_pageIndex = 1;
|
m_pageNumber = 40;
|
if (e.selectSingleNode(L"@page.rows"))
|
{
|
xstring rows = e.selectSingleNode(L"@page.rows").text();
|
m_pageNumber = rows.toInt();
|
}
|
|
if (e.selectSingleNode(L"@pages"))
|
{
|
string pages = e.selectSingleNode(L"@pages").text();
|
dw_pages = GetControl(pages);
|
AttachEvent(pages, L"PAGE_CLICK", (FEvent)&listwin::OnChangePages);
|
}
|
|
if (e.selectSingleNode(L"@rowagent"))
|
{
|
xstring rowagent = e.selectSingleNode(L"@rowagent").text();
|
if (rowagent == L"Y")
|
AttachEvent(dwname, L"DWV_ROWFOCUSCHANGED", (FEvent)&listwin::OnRowChanged);
|
}
|
AttachEvent(dwname, L"DWV_RCLICKED", (FEvent)&listwin::OnGridRClicked);
|
return 1;
|
}
|
return -1;
|
}
|
|
virtual int BeforeCloseWindow()
|
{
|
return 1;
|
}
|
};
|