| | |
| | | #include "wobject/xnode.hpp" |
| | | #include "platform/nstring.hpp" |
| | | |
| | | #include <vector> |
| | | //#include <stdio.h> |
| | | |
| | | class __declspec(dllexport)IndexMenuWin: public xwin |
| | | { |
| | | public: |
| | |
| | | HWND m_nHwnd; |
| | | int tabNo; |
| | | |
| | | //int m_panelNo; // 当前菜单组 |
| | | //int m_panelNo; // 当前菜单组 |
| | | xstring m_Assignment; |
| | | public: |
| | | IndexMenuWin(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | |
| | | if(hItem == 0) return 1; |
| | | int hasChild = tv_menu.GetItemChild1(hItem); |
| | | if(hasChild > 0) return 1; |
| | | int ret = rClick(L"收藏菜单"); |
| | | int ret = rClick(L"收藏菜单"); |
| | | if(ret == 1) |
| | | { |
| | | xstring id = (xstring)tv_menu.GetItemData(hItem); |
| | |
| | | if(xaserver::ExecXQuery(GetServerUrl(),L"[menu.user.edit.xq]",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.xml()); |
| | | //alert("收藏失败!"); |
| | | //alert("收藏失败!"); |
| | | return -1; |
| | | } |
| | | createTree1(); |
| | |
| | | return 1; |
| | | } |
| | | |
| | | int SetMenuAgent() |
| | | { |
| | | xaserverarg arg; |
| | | KXMLDOMDocument x; |
| | | arg.SetArg(L"pid", L"null"); |
| | | arg.SetArg(L"Assignment", this->m_Assignment); |
| | | if (xaserver::ExecXQuery(GetServerUrl(), L"[Items.menu.xq]", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.xml()); |
| | | alert("取消失败!"); |
| | | return -1; |
| | | } |
| | | KXMLDOMNodeList items = x.selectNodes(L"*/item"); |
| | | long len = items.length(); |
| | | xstring tools; |
| | | wchar_t tool[1204]; |
| | | const wchar_t * templ = L"<xtoolbutton width ='80' imageflow ='top' height ='80' caption ='%s' name ='Menu-%d' src ='icons32/%s白.png' style ='font-family:思源黑体 CN Bold;font-size:9pt;margin:8;text-align:center;background-color:%s;background-radius:8pt;'><help>%s</help></xtoolbutton>"; |
| | | std::vector<const wchar_t*> colors{L"#DE9832",L"#32B2E6",L"#FFEF34",L"#2EA14A",L"#D54C84"}; |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | if (i >= 20)break; |
| | | xstring name = items.item(i).selectSingleNode(L"name").text(); |
| | | xstring id = items.item(i).selectSingleNode(L"id").text(); |
| | | xstring src = name.replace(L"管理", L"").replace(L"模块", L""); |
| | | swprintf_s(tool, 1024, templ, name.c_str(), i, src.c_str(), colors[i % 5],name.c_str()); |
| | | if (i == 0) tools = tool; else tools += tool; |
| | | } |
| | | tools = L"<box layerflow ='htmlflow'>" + tools + L"</box>"; |
| | | xnode node = this->GetAgentNode(L"menu-item"); |
| | | if(node)this->SetAgentNode(node, tools); |
| | | } |
| | | int SetInitAgent() |
| | | { |
| | | int no = GetCurPanel(); |
| | |
| | | xstring str = xc.GetText(); |
| | | if(str.isEmpty()) |
| | | { |
| | | alert(L"请输入查询条件!"); |
| | | alert(L"请输入查询条件!"); |
| | | return -1; |
| | | } |
| | | HTREEITEM rItem = tv_menu2.GetRootItem(); |
| | |
| | | TVNNMHDR& nmtv = *(TVNNMHDR*)evt->notify.pnmh; |
| | | HTREEITEM hItem = nmtv.FromItem; |
| | | if(!hItem) return 1; |
| | | int ret = rClick(L"取消收藏"); |
| | | int ret = rClick(L"取消收藏"); |
| | | if(ret == 1) |
| | | { |
| | | xstring id = (xstring)tv_menu1.GetItemData(hItem); |
| | |
| | | if(xaserver::ExecXQuery(GetServerUrl(),L"[menu.user.edit.xq]",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.xml()); |
| | | alert("取消失败!"); |
| | | alert("取消失败!"); |
| | | return -1; |
| | | } |
| | | tv_menu1.DeleteItem(hItem); |
| | |
| | | SetInitAgent(); |
| | | createTree1(); |
| | | |
| | | SetMenuAgent(); |
| | | xutil::RestoreCursor(hCursor); |
| | | //this->Redraw(); |
| | | |