[SVN-NetXMS] revision 3357

From: NetXMS.org SVN Server <svn_at_DOMAIN_REMOVED>
Date: Tue, 1 Jul 2008 01:22:20 +0300

* { font-family: Consolas, Lucida Console, Courier New; font-size: 100%; }
h1 { font-size: 150%; }
td.linenos { background-color: #f0f0f0; padding-right: 10px; }
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
pre { line-height: 100%; width: 100%; }
.highlight span { width: 100%; display:-moz-inline-stack; display:inline-block; zoom:1; *display:inline; }
body { background: #ffffff; }
body .c { color: #999988; font-style: italic } /* Comment */
body .err { color: #a61717; background-color: #e3d2d2 } /* Error */
body .k { font-weight: bold } /* Keyword */
body .o { font-weight: bold } /* Operator */
body .cm { color: #999988; font-style: italic } /* Comment.Multiline */
body .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
body .c1 { color: #999988; font-style: italic } /* Comment.Single */
body .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
body .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
body .ge { font-style: italic } /* Generic.Emph */
body .gr { color: #aa0000 } /* Generic.Error */
body .gh { color: #999999 } /* Generic.Heading */
body .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
body .go { color: #888888 } /* Generic.Output */
body .gp { color: #555555 } /* Generic.Prompt */
body .gs { font-weight: bold } /* Generic.Strong */
body .gu { color: #aaaaaa } /* Generic.Subheading */
body .gt { color: #aa0000 } /* Generic.Traceback */
body .kc { font-weight: bold } /* Keyword.Constant */
body .kd { font-weight: bold } /* Keyword.Declaration */
body .kp { font-weight: bold } /* Keyword.Pseudo */
body .kr { font-weight: bold } /* Keyword.Reserved */
body .kt { color: #445588; font-weight: bold } /* Keyword.Type */
body .m { color: #009999 } /* Literal.Number */
body .s { color: #bb8844 } /* Literal.String */
body .na { color: #008080 } /* Name.Attribute */
body .nb { color: #999999 } /* Name.Builtin */
body .nc { color: #445588; font-weight: bold } /* Name.Class */
body .no { color: #008080 } /* Name.Constant */
body .ni { color: #800080 } /* Name.Entity */
body .ne { color: #990000; font-weight: bold } /* Name.Exception */
body .nf { color: #990000; font-weight: bold } /* Name.Function */
body .nn { color: #555555 } /* Name.Namespace */
body .nt { color: #000080 } /* Name.Tag */
body .nv { color: #008080 } /* Name.Variable */
body .ow { font-weight: bold } /* Operator.Word */
body .w { color: #bbbbbb } /* Text.Whitespace */
body .mf { color: #009999 } /* Literal.Number.Float */
body .mh { color: #009999 } /* Literal.Number.Hex */
body .mi { color: #009999 } /* Literal.Number.Integer */
body .mo { color: #009999 } /* Literal.Number.Oct */
body .sb { color: #bb8844 } /* Literal.String.Backtick */
body .sc { color: #bb8844 } /* Literal.String.Char */
body .sd { color: #bb8844 } /* Literal.String.Doc */
body .s2 { color: #bb8844 } /* Literal.String.Double */
body .se { color: #bb8844 } /* Literal.String.Escape */
body .sh { color: #bb8844 } /* Literal.String.Heredoc */
body .si { color: #bb8844 } /* Literal.String.Interpol */
body .sx { color: #bb8844 } /* Literal.String.Other */
body .sr { color: #808000 } /* Literal.String.Regex */
body .s1 { color: #bb8844 } /* Literal.String.Single */
body .ss { color: #bb8844 } /* Literal.String.Symbol */
body .bp { color: #999999 } /* Name.Builtin.Pseudo */
body .vc { color: #008080 } /* Name.Variable.Class */
body .vg { color: #008080 } /* Name.Variable.Global */
body .vi { color: #008080 } /* Name.Variable.Instance */
body .il { color: #009999 } /* Literal.Number.Integer.Long */

Info

Revision:3357
Author:alk

Date:2008-07-01 01:22:20 +0300 (Tue, 01 Jul 2008)

Comment:- User selection dialog complete

Changes
U trunk/src/client/console/libnxmc/userSelectionDialog.cpp
U trunk/src/client/console/libnxmc/userSelectionDialog.h
A trunk/src/client/console/nxmc/rc/icons/normal/everyone.png
A trunk/src/client/console/nxmc/rc/icons/normal/user.png
A trunk/src/client/console/nxmc/rc/icons/normal/userGroup.png
A trunk/src/client/console/nxmc/rc/icons/small/everyone.png
A trunk/src/client/console/nxmc/rc/icons/small/user.png
A trunk/src/client/console/nxmc/rc/icons/small/userGroup.png
U trunk/src/client/console/nxmc/rc/manual.xrc
U trunk/src/client/console/nxmc/rc/nxmc.fbp

Diff
Modified: trunk/src/client/console/libnxmc/userSelectionDialog.cpp
===================================================================
--- trunk/src/client/console/libnxmc/userSelectionDialog.cpp 2008-06-30 17:42:08 UTC (rev 3356)
+++ trunk/src/client/console/libnxmc/userSelectionDialog.cpp 2008-06-30 22:22:20 UTC (rev 3357)
@@ -46,6 +46,13 @@
 
         wxXmlResource::Get()-&gt;LoadDialog(this, parent, _T(&quot;nxUserSelDlg&quot;));
         GetSizer()-&gt;Fit(this);
+
+ m_showPublic = false;
+ m_showGroups = true;
+ m_singleSelection = true;
+
+ m_selectedUsersCount = 0;
+ m_selectedUsers = NULL;
 }
 
 
@@ -57,37 +64,205 @@
 {
         wxConfig::Get()-&gt;Write(_T(&quot;/UserSelDlg/SortMode&quot;), m_sortMode);
         wxConfig::Get()-&gt;Write(_T(&quot;/UserSelDlg/SortDir&quot;), m_sortDir);
+
+ wxListCtrl *wndListCtrl = XRCCTRL(*this, &quot;wndListCtrl&quot;, wxListCtrl);
+ NXMCSaveListCtrlColumns(wxConfig::Get(), *wndListCtrl, _T(&quot;/UserSelDlg/UserList&quot;));
+
+ wxSize size = this-&gt;GetSize();
+ wxConfig::Get()-&gt;Write(_T(&quot;/UserSelDlg/SizeX&quot;), size.GetX());
+ wxConfig::Get()-&gt;Write(_T(&quot;/UserSelDlg/SizeY&quot;), size.GetY());
+
+ if (m_selectedUsers != NULL)
+ {
+ delete m_selectedUsers;
+ m_selectedUsers = NULL;
+ }
 }
 
 
 //
+// Setters
+//
+
+void nxUserSelectionDialog::SetShowGroups(bool flag)
+{
+ m_showGroups = flag;
+}
+
+void nxUserSelectionDialog::SetShowPublic(bool flag)
+{
+ m_showPublic = flag;
+}
+
+void nxUserSelectionDialog::SetSingleSelection(bool flag)
+{
+ m_singleSelection = flag;
+}
+
+// Getters
+
+DWORD nxUserSelectionDialog::GetSelectedUsersCount()
+{
+ return m_selectedUsersCount;
+}
+
+DWORD *nxUserSelectionDialog::GetSelectedUsers()
+{
+ return m_selectedUsers;
+}
+
+//
 // Data exchange
 //
 
 bool nxUserSelectionDialog::TransferDataFromWindow(void)
 {
+ wxListCtrl *list = XRCCTRL(*this, &quot;wndListCtrl&quot;, wxListCtrl);
+
+ m_selectedUsersCount = list-&gt;GetSelectedItemCount();
+ m_selectedUsers = new DWORD[m_selectedUsersCount];
+
+ long item = -1;
+ int i = 0;
+ do
+ {
+ item = list-&gt;GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ if (item != -1)
+ {
+ m_selectedUsers[i++] = (DWORD)list-&gt;GetItemData(item);
+ }
+ } while (item != -1);
+
         return true;
 }
 
 bool nxUserSelectionDialog::TransferDataToWindow(void)
 {
- wxListCtrl *wndListCtrl = XRCCTRL(*this, &quot;wndListCtrl&quot;, wxListCtrl);
+ return true;
+}
 
- int width = wndListCtrl-&gt;GetClientSize().x;
 
- wndListCtrl-&gt;InsertColumn(0, _T(&quot;Name&quot;), wxLIST_FORMAT_LEFT, 150);
- wndListCtrl-&gt;InsertColumn(1, _T(&quot;Full Name&quot;), wxLIST_FORMAT_LEFT, width - 150 - wxSystemSettings::GetMetric(wxSYS_VSCROLL_X));
+//
+// Object comparison callback
+//
 
- return true;
+static int wxCALLBACK CompareObjects(long item1, long item2, long sortData)
+{
+ int rc = 0;
+
+ if (((item1 &amp; GROUP_FLAG) &amp;&amp; (item2 &amp; GROUP_FLAG)) || (!(item1 &amp; GROUP_FLAG) &amp;&amp; !(item2 &amp; GROUP_FLAG)))
+ {
+ rc = ((unsigned long)item1) - ((unsigned long)item2);
+ }
+ else if (item1 &amp; GROUP_FLAG)
+ {
+ rc = -1;
+ }
+ else if (item2 &amp; GROUP_FLAG)
+ {
+ rc = 1;
+ }
+
+
+ return rc;
 }
 
-
 //
 // Dialog initialization handler
 //
 
 void nxUserSelectionDialog::OnInitDialog(wxInitDialogEvent &amp;event)
 {
+ wxListCtrl *list = XRCCTRL(*this, &quot;wndListCtrl&quot;, wxListCtrl);
+
+ // cleanup it not first invocation
+ m_selectedUsersCount = 0;
+ if (m_selectedUsers != NULL)
+ {
+ delete m_selectedUsers;
+ m_selectedUsers = NULL;
+ }
+ list-&gt;ClearAll();
+
+ // set selection type
+ list-&gt;SetSingleStyle(wxLC_SINGLE_SEL, m_singleSelection);
+
+ // load and assign icons
+ wxImageList *imageList = new wxImageList(16, 16);
+
+ imageList-&gt;Add(wxXmlResource::Get()-&gt;LoadIcon(_T(&quot;icoSmallUser&quot;)));
+ imageList-&gt;Add(wxXmlResource::Get()-&gt;LoadIcon(_T(&quot;icoSmallUserGroup&quot;)));
+ imageList-&gt;Add(wxXmlResource::Get()-&gt;LoadIcon(_T(&quot;icoSmallEveryone&quot;)));
+ list-&gt;AssignImageList(imageList, wxIMAGE_LIST_SMALL);
+
+ // load and set dialog size
+ int sizeX, sizeY;
+ wxConfig::Get()-&gt;Read(_T(&quot;/UserSelDlg/SizeX&quot;), &amp;sizeX, 400);
+ wxConfig::Get()-&gt;Read(_T(&quot;/UserSelDlg/SizeY&quot;), &amp;sizeY, 300);
+
+ this-&gt;SetMinSize(wxSize(300, 200));
+ this-&gt;SetSize(wxSize(sizeX, sizeY));
+ this-&gt;Layout();
+
+ // add columns
+ int width = list-&gt;GetClientSize().GetX();
+ list-&gt;InsertColumn(0, _T(&quot;Name&quot;), wxLIST_FORMAT_LEFT, 200);
+ list-&gt;InsertColumn(1, _T(&quot;Full Name&quot;), wxLIST_FORMAT_LEFT, width - 200 - wxSystemSettings::GetMetric(wxSYS_VSCROLL_X));
+
+ NXMCLoadListCtrlColumns(wxConfig::Get(), *list, _T(&quot;/UserSelDlg/UserList&quot;));
+
+ // Populate list
+ NXC_USER *userList;
+ DWORD i, userCount;
+ //NXCLockUserDB(NXMCGetSession());
+
+ if (m_showPublic)
+ {
+ int item = list-&gt;InsertItem(0x7FFFFFFF, _T(&quot;[public]&quot;), 2);
+ list-&gt;SetItemData(item, GROUP_EVERYONE);
+ }
+ if (NXCGetUserDB(NXMCGetSession(), &amp;userList, &amp;userCount))
+ {
+ for(i = 0; i &lt; userCount; i++)
+ {
+ if (userList[i].wFlags &amp; UF_DELETED)
+ {
+ continue;
+ }
+
+ if (!m_showGroups &amp;&amp; (userList[i].dwId &amp; GROUP_FLAG))
+ {
+ continue;
+ }
+
+ //if (!(userList[i].dwId &amp; GROUP_FLAG) &amp;&amp; !(userList[i].wFlags &amp; UF_DELETED))
+ int imageIndex;
+ if (userList[i].dwId == GROUP_EVERYONE)
+ {
+ imageIndex = 2;
+ }
+ else
+ {
+ if (userList[i].dwId &amp; GROUP_FLAG)
+ {
+ imageIndex = 1;
+ }
+ else
+ {
+ imageIndex = 0;
+ }
+ }
+
+ long item = list-&gt;InsertItem(0x7FFFFFFF, userList[i].szName, imageIndex);
+ list-&gt;SetItem(item, 1, userList[i].szFullName);
+ list-&gt;SetItemData(item, userList[i].dwId);
+ }
+ }
+ //NXCUnlockUserDB(NXMCGetSession());
+
+ list-&gt;SortItems(CompareObjects, 0);
+
+ // Set focus to &quot;OK&quot;
         wxWindow *wnd;
 
         wnd = FindWindowById(wxID_OK, this);
@@ -120,5 +295,8 @@
 
 void nxUserSelectionDialog::OnListItemActivate(wxListEvent &amp;event)
 {
-
+ if (Validate() &amp;&amp; TransferDataFromWindow())
+ {
+ EndDialog(wxID_OK);
+ }
 }

Modified: trunk/src/client/console/libnxmc/userSelectionDialog.h
===================================================================
--- trunk/src/client/console/libnxmc/userSelectionDialog.h 2008-06-30 17:42:08 UTC (rev 3356)
+++ trunk/src/client/console/libnxmc/userSelectionDialog.h 2008-06-30 22:22:20 UTC (rev 3357)
@@ -29,6 +29,13 @@
         nxUserSelectionDialog(wxWindow *parent);
         virtual ~nxUserSelectionDialog();
 
+ void SetShowGroups(bool flag);
+ void SetShowPublic(bool flag);
+ void SetSingleSelection(bool flag);
+
+ DWORD GetSelectedUsersCount();
+ DWORD *GetSelectedUsers();
+
 protected:
         virtual bool TransferDataFromWindow(void);
         virtual bool TransferDataToWindow(void);
@@ -36,7 +43,13 @@
 private:
         int m_sortMode;
         int m_sortDir;
+ bool m_showGroups;
+ bool m_showPublic;
+ bool m_singleSelection;
 
+ DWORD m_selectedUsersCount;
+ DWORD *m_selectedUsers;
+
         void OnInitDialog(wxInitDialogEvent &amp;event);
         void OnListColumnClick(wxListEvent &amp;event);
         void OnListItemActivate(wxListEvent &amp;event);

Property changes on: trunk/src/client/console/nxmc/rc/icons/normal/everyone.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Property changes on: trunk/src/client/console/nxmc/rc/icons/normal/user.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Property changes on: trunk/src/client/console/nxmc/rc/icons/normal/userGroup.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Property changes on: trunk/src/client/console/nxmc/rc/icons/small/everyone.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Property changes on: trunk/src/client/console/nxmc/rc/icons/small/user.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Property changes on: trunk/src/client/console/nxmc/rc/icons/small/userGroup.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: trunk/src/client/console/nxmc/rc/manual.xrc
===================================================================
--- trunk/src/client/console/nxmc/rc/manual.xrc 2008-06-30 17:42:08 UTC (rev 3356)
+++ trunk/src/client/console/nxmc/rc/manual.xrc 2008-06-30 22:22:20 UTC (rev 3357)
@@ -48,6 +48,14 @@
         &lt;!-- Miscellanious normal size icons --&gt;
         &lt;object class=&quot;wxIcon&quot; name=&quot;icoConfig&quot;&gt;icons/normal/config.png&lt;/object&gt;
         &lt;object class=&quot;wxIcon&quot; name=&quot;icoUnknown&quot;&gt;icons/normal/unknown.png&lt;/object&gt;
+
+ &lt;!-- User icons --&gt;
+ &lt;object class=&quot;wxIcon&quot; name=&quot;icoSmallUser&quot;&gt;icons/small/user.png&lt;/object&gt;
+ &lt;object class=&quot;wxIcon&quot; name=&quot;icoSmallUserGroup&quot;&gt;icons/small/userGroup.png&lt;/object&gt;
+ &lt;object class=&quot;wxIcon&quot; name=&quot;icoSmallEveryone&quot;&gt;icons/small/everyone.png&lt;/object&gt;
+ &lt;object class=&quot;wxIcon&quot; name=&quot;icoUser&quot;&gt;icons/normal/user.png&lt;/object&gt;
+ &lt;object class=&quot;wxIcon&quot; name=&quot;icoUserGroup&quot;&gt;icons/normal/userGroup.png&lt;/object&gt;
+ &lt;object class=&quot;wxIcon&quot; name=&quot;icoEveryone&quot;&gt;icons/normal/everyone.png&lt;/object&gt;
 
         &lt;!-- Busy dialog --&gt;
         &lt;object class=&quot;wxDialog&quot; name=&quot;nxBusyDialog&quot;&gt;

Modified: trunk/src/client/console/nxmc/rc/nxmc.fbp
===================================================================
--- trunk/src/client/console/nxmc/rc/nxmc.fbp 2008-06-30 17:42:08 UTC (rev 3356)
+++ trunk/src/client/console/nxmc/rc/nxmc.fbp 2008-06-30 22:22:20 UTC (rev 3357)
@@ -1341,7 +1341,7 @@
                 &lt;/object&gt;
             &lt;/object&gt;
         &lt;/object&gt;
- &lt;object class=&quot;Dialog&quot; expanded=&quot;1&quot;&gt;
+ &lt;object class=&quot;Dialog&quot; expanded=&quot;0&quot;&gt;
             &lt;property name=&quot;bg&quot;&gt;&lt;/property&gt;
             &lt;property name=&quot;center&quot;&gt;wxBOTH&lt;/property&gt;
             &lt;property name=&quot;context_help&quot;&gt;&lt;/property&gt;
@@ -1866,10 +1866,10 @@
             &lt;property name=&quot;hidden&quot;&gt;0&lt;/property&gt;
             &lt;property name=&quot;id&quot;&gt;wxID_ANY&lt;/property&gt;
             &lt;property name=&quot;maximum_size&quot;&gt;&lt;/property&gt;
- &lt;property name=&quot;minimum_size&quot;&gt;&lt;/property&gt;
+ &lt;property name=&quot;minimum_size&quot;&gt;300,200&lt;/property&gt;
             &lt;property name=&quot;name&quot;&gt;nxUserSelDlg&lt;/property&gt;
             &lt;property name=&quot;pos&quot;&gt;&lt;/property&gt;
- &lt;property name=&quot;size&quot;&gt;438,292&lt;/property&gt;
+ &lt;property name=&quot;size&quot;&gt;426,367&lt;/property&gt;
             &lt;property name=&quot;style&quot;&gt;wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER&lt;/property&gt;
             &lt;property name=&quot;subclass&quot;&gt;&lt;/property&gt;
             &lt;property name=&quot;title&quot;&gt;Select User&lt;/property&gt;
Received on Tue Jul 01 2008 - 01:22:20 EEST

This archive was generated by hypermail 2.2.0 : Tue Jul 01 2008 - 01:17:17 EEST