~ubuntu-branches/ubuntu/warty/openafs/warty

« back to all changes in this revision

Viewing changes to src/WINNT/afsusrmgr/grp_col.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Sam Hartman
  • Date: 2004-01-10 16:37:33 UTC
  • Revision ID: james.westby@ubuntu.com-20040110163733-jvr0n1uahshlb1uu
Tags: upstream-1.2.11
ImportĀ upstreamĀ versionĀ 1.2.11

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2000, International Business Machines Corporation and others.
 
3
 * All Rights Reserved.
 
4
 * 
 
5
 * This software has been released under the terms of the IBM Public
 
6
 * License.  For details, see the LICENSE file in the top-level source
 
7
 * directory or online at http://www.openafs.org/dl/license10.html
 
8
 */
 
9
 
 
10
extern "C" {
 
11
#include <afs/param.h>
 
12
#include <afs/stds.h>
 
13
}
 
14
 
 
15
#include "TaAfsUsrMgr.h"
 
16
#include "grp_col.h"
 
17
 
 
18
 
 
19
/*
 
20
 * GROUP-VIEW COLUMNS _________________________________________________________
 
21
 *
 
22
 */
 
23
 
 
24
void Group_SetDefaultView (LPVIEWINFO lpvi, ICONVIEW *piv)
 
25
{
 
26
   lpvi->lvsView = FLS_VIEW_SMALL;
 
27
   lpvi->nColsAvail = nGROUPCOLUMNS;
 
28
 
 
29
   for (size_t iCol = 0; iCol < nGROUPCOLUMNS; ++iCol)
 
30
      {
 
31
      lpvi->cxColumns[ iCol ]  = GROUPCOLUMNS[ iCol ].cxWidth;
 
32
      lpvi->idsColumns[ iCol ] = GROUPCOLUMNS[ iCol ].idsColumn;
 
33
      }
 
34
 
 
35
   lpvi->iSort = grpcolNAME;
 
36
 
 
37
   lpvi->nColsShown = 3;
 
38
   lpvi->aColumns[0] = (int)grpcolNAME;
 
39
   lpvi->aColumns[1] = (int)grpcolUID;
 
40
   lpvi->aColumns[2] = (int)grpcolCMEMBERS;
 
41
 
 
42
   *piv = ivSTATUS;
 
43
}
 
44
 
 
45
 
 
46
void Group_GetColumn (ASID idObject, GROUPCOLUMN iCol, LPTSTR pszText, LPSYSTEMTIME pstDate, LONG *pcsec, COLUMNTYPE *pcType)
 
47
{
 
48
   if (pszText)
 
49
      *pszText = TEXT('\0');
 
50
   if (pstDate)
 
51
      memset (pstDate, 0x00, sizeof(SYSTEMTIME));
 
52
   if (pcsec)
 
53
      *pcsec = 0;
 
54
   if (pcType)
 
55
      *pcType = ctALPHABETIC;
 
56
 
 
57
   ASOBJPROP Properties;
 
58
   if (asc_ObjectPropertiesGet_Fast (g.idClient, g.idCell, idObject, &Properties))
 
59
      {
 
60
      switch (iCol)
 
61
         {
 
62
         case grpcolNAME:
 
63
            if (pcType)
 
64
               *pcType = ctALPHABETIC;
 
65
            if (pszText)
 
66
               lstrcpy (pszText, Properties.szName);
 
67
            break;
 
68
 
 
69
         case grpcolCMEMBERS:
 
70
            if (pcType)
 
71
               *pcType = ctNUMERIC;
 
72
            if (pszText)
 
73
               wsprintf (pszText, TEXT("%lu"), Properties.u.GroupProperties.nMembers);
 
74
            break;
 
75
 
 
76
         case grpcolUID:
 
77
            if (pcType)
 
78
               *pcType = ctNUMERIC;
 
79
            if (pszText)
 
80
               wsprintf (pszText, TEXT("%ld"), Properties.u.GroupProperties.uidName);
 
81
            break;
 
82
 
 
83
         case grpcolOWNER:
 
84
            if (pcType)
 
85
               *pcType = ctALPHABETIC;
 
86
            if (pszText)
 
87
               {
 
88
               if (Properties.u.GroupProperties.szOwner[0])
 
89
                  wsprintf (pszText, TEXT("%s (%ld)"), Properties.u.GroupProperties.szOwner, Properties.u.GroupProperties.uidOwner);
 
90
               else
 
91
                  wsprintf (pszText, TEXT("%ld"), Properties.u.GroupProperties.uidOwner);
 
92
               }
 
93
            break;
 
94
 
 
95
         case grpcolCREATOR:
 
96
            if (pcType)
 
97
               *pcType = ctALPHABETIC;
 
98
            if (pszText)
 
99
               {
 
100
               if (Properties.u.GroupProperties.szCreator[0])
 
101
                  wsprintf (pszText, TEXT("%s (%ld)"), Properties.u.GroupProperties.szCreator, Properties.u.GroupProperties.uidCreator);
 
102
               else
 
103
                  wsprintf (pszText, TEXT("%ld"), Properties.u.GroupProperties.uidCreator);
 
104
               }
 
105
            break;
 
106
         }
 
107
      }
 
108
}
 
109