|  |  | 
 |  |  |       int showAtt() | 
 |  |  |       { | 
 |  |  |          xnode anode = GetAgentNode(L"att"); | 
 |  |  |          int s = xcombobox::GetCount(m_cb.GetId()); | 
 |  |  |          int s = m_cb.GetCount(); | 
 |  |  |          xml x ; | 
 |  |  |          x.loadXML(L"<vbox/>"); | 
 |  |  |        | 
 |  |  | 
 |  |  |          int i = 0; | 
 |  |  |          for (i = 0; i < s; i++) | 
 |  |  |          { | 
 |  |  |             xstring tmp = xcombobox::GetLBText(m_cb.GetId(), i); | 
 |  |  |             xstring tmp = m_cb.GetLBText(i); | 
 |  |  |             KXMLDOMElement e = x.createElement(L"hbox"); | 
 |  |  |             e.setAttribute(L"height", L"20"); | 
 |  |  |             KXMLDOMElement l = x.createElement(L"xlabel"); | 
 |  |  | 
 |  |  |             g.setAttribute(L"style", L"background-color:#000000"); | 
 |  |  |             ele.appendChild(g); | 
 |  |  |          } | 
 |  |  |          SetAgentNodeContent(anode, ele); | 
 |  |  |          SetAgentNode(anode, ele.xml()); | 
 |  |  |          anode.SetWidthHeight(-1, i * 20 + 1); | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  | 
 |  |  |          xstring guid = publiccode::GetGuid(); | 
 |  |  |          xstring str = guid.left(2); | 
 |  |  |          xstring ret = xaserver::UploadFile(L"attachment" + str, guid + L".jpg", GetHWND(), L"", false); | 
 |  |  |          int nIndex = m_cb.AddItem(ret.c_str(true), (guid + L".jpg").c_str(true)); | 
 |  |  |          showAtt(); | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  | 
 |  |  |       int delAtt(xstring no) | 
 |  |  |       { | 
 |  |  |          int nIndex = no.toInt(); | 
 |  |  |          xcombobox::DeleteItem(m_cb.GetId(), nIndex); | 
 |  |  |          m_cb.DeleteItem(nIndex); | 
 |  |  |          showAtt(); | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       KXMLDOMElement getAtt() | 
 |  |  |       { | 
 |  |  |          int s = xcombobox::GetCount(m_cb.GetId()); | 
 |  |  |          int s = m_cb.GetCount(); | 
 |  |  |          xml x; | 
 |  |  |          x.loadXML(L"<Attachment/>"); | 
 |  |  |          KXMLDOMElement ele = x.documentElement; | 
 |  |  |          KXMLDOMElement ele = x.documentElement(); | 
 |  |  |          int i = 0; | 
 |  |  |          for (i = 0; i < s; i++) | 
 |  |  |          { | 
 |  |  |             xstring tmp = xcombobox::GetLBText(m_cb.GetId(), i); | 
 |  |  |             xstring tmp2 = xcombobox::GetItemData(m_cb.GetId(), i); | 
 |  |  |             xstring tmp = m_cb.GetLBText(i); | 
 |  |  |             xstring tmp2 = m_cb.GetItemData( i); | 
 |  |  |             KXMLDOMElement e = x.createElement(L"item"); | 
 |  |  |             e.setAttribute(L"name", L"" + tmp); | 
 |  |  |             e.setAttribute(L"file", L"" + tmp2); | 
 |  |  | 
 |  |  |             xstring value = m_Edit.GetText(); | 
 |  |  |             if (value == L"") | 
 |  |  |             { | 
 |  |  |                alert(L"请填写批注!"); | 
 |  |  |                return 1; | 
 |  |  |                int s = m_cb.GetCount(); | 
 |  |  |                if (s < 1) | 
 |  |  |                { | 
 |  |  |                   alert(L"请填写批注!"); | 
 |  |  |                   return 1; | 
 |  |  |                } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             x.loadXML(L"<Commentary update.new='1' update.modify='1'/>"); | 
 |  |  | 
 |  |  |             AppendItem(x, ele, L"CreatorID", xaserver::GetUserId()); | 
 |  |  |             ele.appendChild(getAtt()); | 
 |  |  |  | 
 |  |  |             arg.AddArg(L"content", L"<root>" + ele.xml + L"</root>"); | 
 |  |  |             arg.AddArg(L"content", (xstring)L"<root>" + ele.xml() + L"</root>"); | 
 |  |  |  | 
 |  |  |             if (getUrl(L"/workflow/action/Commentary/bill.update", arg.GetString(), x) == 1) | 
 |  |  |             { | 
 |  |  |                m_Edit.SetText(L""); | 
 |  |  |                xcombobox::ResetContent(m_cb.GetId()); | 
 |  |  |                m_cb.ResetContent(); | 
 |  |  |                Init(); | 
 |  |  |                showAtt(); | 
 |  |  |                return 1; | 
 |  |  | 
 |  |  |  | 
 |  |  |       int OnHtmlClick(TEvent* evt, LPARAM pr) | 
 |  |  |       { | 
 |  |  |          ref  HTMLNMHDR p = evt.pnmh; | 
 |  |  |          /* | 
 |  |  |          HTMLNMHDR& p = evt->pnmh; | 
 |  |  |          const xstring d = m_Html.GetData(p.object); | 
 |  |  |          if (d == L"") return -1; | 
 |  |  |          xstring file = d.mid(0, d.find(L"|##@@|", 0)); | 
 |  |  | 
 |  |  |             alert(L"文件打开失败2!"); | 
 |  |  |             return -1; | 
 |  |  |          } | 
 |  |  |  | 
 |  |  |          */ | 
 |  |  |          return -1; | 
 |  |  |       } | 
 |  |  |  | 
 |  |  | 
 |  |  |          //绑定工具条点击事件 | 
 |  |  |          AttachEvent(L"WM_XCOMMAND", (FEvent)&CommentaryEx::OnXCommand); | 
 |  |  |          AttachEvent(L"note", L"HTC_OBJECTCLICKED", (FEvent)&CommentaryEx::OnHtmlClick); | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       int onload() |