root/trunk/tgrouptypefunc.h

Revision 1380, 7.1 KB (checked in by Gary, 2 years ago)

unxsVZ corrected permissions code for type and status public tables.

  • Property svn:keywords set to id
Line 
1/*
2FILE
3        $Id$
4        (Built initially by unixservice.com mysqlRAD2)
5PURPOSE
6        Non schema-dependent table and application table related functions.
7AUTHOR/LEGAL
8        (C) 2001-2010 Gary Wallis for Unixservice, LLC.
9        GPLv2 license applies. See LICENSE file.
10*/
11
12//ModuleFunctionProtos()
13
14
15void tGroupTypeNavList(void);
16
17void ExtProcesstGroupTypeVars(pentry entries[], int x)
18{
19        /*
20        register int i;
21        for(i=0;i<x;i++)
22        {
23        }
24        */
25}//void ExtProcesstGroupTypeVars(pentry entries[], int x)
26
27
28void ExttGroupTypeCommands(pentry entries[], int x)
29{
30
31        if(!strcmp(gcFunction,"tGroupTypeTools"))
32        {
33                //ModuleFunctionProcess()
34
35                if(!strcmp(gcCommand,LANG_NB_NEW))
36                {
37                        if(guPermLevel>=12)
38                        {
39                                ProcesstGroupTypeVars(entries,x);
40                                guMode=2000;
41                                tGroupType(LANG_NB_CONFIRMNEW);
42                        }
43                }
44                else if(!strcmp(gcCommand,LANG_NB_CONFIRMNEW))
45                {
46                        if(guPermLevel>=12)
47                        {
48                                ProcesstGroupTypeVars(entries,x);
49
50                                guMode=2000;
51                                //Check entries
52                                guMode=0;
53
54                                uGroupType=0;
55                                uCreatedBy=guLoginClient;
56                                uOwner=guCompany;
57                                uModBy=0;//Never modified
58                                uModDate=0;//Never modified
59                                NewtGroupType(0);
60                        }
61                }
62                else if(!strcmp(gcCommand,LANG_NB_DELETE))
63                {
64                        ProcesstGroupTypeVars(entries,x);
65                        if(guPermLevel>=12 && guLoginClient==1)
66                        {
67                                guMode=2001;
68                                tGroupType(LANG_NB_CONFIRMDEL);
69                        }
70                }
71                else if(!strcmp(gcCommand,LANG_NB_CONFIRMDEL))
72                {
73                        ProcesstGroupTypeVars(entries,x);
74                        if(guPermLevel>=12 && guLoginClient==1)
75                        {
76                                guMode=5;
77                                DeletetGroupType();
78                        }
79                }
80                else if(!strcmp(gcCommand,LANG_NB_MODIFY))
81                {
82                        ProcesstGroupTypeVars(entries,x);
83                        if(guPermLevel>=12)
84                        {
85                                guMode=2002;
86                                tGroupType(LANG_NB_CONFIRMMOD);
87                        }
88                }
89                else if(!strcmp(gcCommand,LANG_NB_CONFIRMMOD))
90                {
91                        ProcesstGroupTypeVars(entries,x);
92                        if(guPermLevel>=12)
93                        {
94                                guMode=2002;
95                                //Check entries here
96                                guMode=0;
97
98                                uModBy=guLoginClient;
99                                ModtGroupType();
100                        }
101                }
102        }
103
104}//void ExttGroupTypeCommands(pentry entries[], int x)
105
106
107void ExttGroupTypeButtons(void)
108{
109        OpenFieldSet("tGroupType Aux Panel",100);
110        switch(guMode)
111        {
112                case 2000:
113                        printf("<p><u>Enter/mod data</u><br>");
114                        printf(LANG_NBB_CONFIRMNEW);
115                break;
116
117                case 2001:
118                        printf("<p><u>Think twice</u><br>");
119                        printf(LANG_NBB_CONFIRMDEL);
120                break;
121
122                case 2002:
123                        printf("<p><u>Review changes</u><br>");
124                        printf(LANG_NBB_CONFIRMMOD);
125                break;
126
127                default:
128                        printf("<u>Table Tips</u><br>");
129                        printf("tGroupType (and it's related tables <a href=?gcFunction=tGroupGlue>"
130                                "tGroupGlue</a> and <a href=?gcFunction=tGroup>tGroup</a>)"
131                                " provide a way to create"
132                                " container and node groups of different types."
133                                " These groups can then be used for organizational and/or autonomic purposes.");
134                        tGroupTypeNavList();
135        }
136        CloseFieldSet();
137
138}//void ExttGroupTypeButtons(void)
139
140
141void ExttGroupTypeAuxTable(void)
142{
143        if(!uGroupType) return;
144
145        MYSQL_RES *res;
146        MYSQL_ROW field;
147
148        sprintf(gcQuery,"%s Property Panel",cLabel);
149        OpenFieldSet(gcQuery,100);
150        sprintf(gcQuery,"SELECT uProperty,cName,cValue FROM tProperty WHERE uKey=%u AND uType="
151                        PROP_GROUPTYPE
152                        " ORDER BY cName",
153                                uGroupType);
154
155        mysql_query(&gMysql,gcQuery);
156        if(mysql_errno(&gMysql))
157                htmlPlainTextError(mysql_error(&gMysql));
158
159        res=mysql_store_result(&gMysql);
160        if(mysql_num_rows(res))
161        {
162                printf("<table cols=2>");
163                while((field=mysql_fetch_row(res)))
164                {
165                        printf("<tr>\n");
166                        printf("<td width=200 valign=top><a class=darkLink href=unxsVZ.cgi?"
167                                        "gcFunction=tProperty&uProperty=%s&cReturn=tGroupType_%u>"
168                                        "%s</a></td><td>%s</td>\n",
169                                                field[0],uGroupType,field[1],field[2]);
170                        printf("</tr>\n");
171                }
172                printf("</table>");
173        }
174
175        CloseFieldSet();
176
177}//void ExttGroupTypeAuxTable(void)
178
179
180void ExttGroupTypeGetHook(entry gentries[], int x)
181{
182        register int i;
183
184        for(i=0;i<x;i++)
185        {
186                if(!strcmp(gentries[i].name,"uGroupType"))
187                {
188                        sscanf(gentries[i].val,"%u",&uGroupType);
189                        guMode=6;
190                }
191        }
192        tGroupType("");
193
194}//void ExttGroupTypeGetHook(entry gentries[], int x)
195
196
197void ExttGroupTypeSelect(void)
198{
199        ExtSelectPublic("tGroupType",VAR_LIST_tGroupType);
200
201}//void ExttGroupTypeSelect(void)
202
203
204void ExttGroupTypeSelectRow(void)
205{
206        ExtSelectRowPublic("tGroupType",VAR_LIST_tGroupType,uGroupType);
207
208}//void ExttGroupTypeSelectRow(void)
209
210
211void ExttGroupTypeListSelect(void)
212{
213        char cCat[512];
214
215        ExtListSelectPublic("tGroupType",VAR_LIST_tGroupType);
216       
217        //Changes here must be reflected below in ExttGroupTypeListFilter()
218        if(!strcmp(gcFilter,"uGroupType"))
219        {
220                sscanf(gcCommand,"%u",&uGroupType);
221                sprintf(cCat," WHERE tGroupType.uGroupType=%u ORDER BY uGroupType",
222                                                uGroupType);
223                strcat(gcQuery,cCat);
224        }
225        else if(1)
226        {
227                //None NO FILTER
228                strcpy(gcFilter,"None");
229                strcat(gcQuery," ORDER BY uGroupType");
230        }
231
232}//void ExttGroupTypeListSelect(void)
233
234
235void ExttGroupTypeListFilter(void)
236{
237        //Filter
238        printf("&nbsp;&nbsp;&nbsp;Filter on ");
239        printf("<select name=gcFilter>");
240        if(strcmp(gcFilter,"uGroupType"))
241                printf("<option>uGroupType</option>");
242        else
243                printf("<option selected>uGroupType</option>");
244        if(strcmp(gcFilter,"None"))
245                printf("<option>None</option>");
246        else
247                printf("<option selected>None</option>");
248        printf("</select>");
249
250}//void ExttGroupTypeListFilter(void)
251
252
253void ExttGroupTypeNavBar(void)
254{
255        if(uOwner) GetClientOwner(uOwner,&guReseller);
256
257        printf(LANG_NBB_SKIPFIRST);
258        printf(LANG_NBB_SKIPBACK);
259        printf(LANG_NBB_SEARCH);
260
261        if(guPermLevel>=12 && !guListMode)
262                printf(LANG_NBB_NEW);
263
264        if(guPermLevel>=12)
265                printf(LANG_NBB_MODIFY);
266
267        if(guPermLevel>=12 && guLoginClient==1)
268                printf(LANG_NBB_DELETE);
269
270        if(uOwner)
271                printf(LANG_NBB_LIST);
272
273        printf(LANG_NBB_SKIPNEXT);
274        printf(LANG_NBB_SKIPLAST);
275        printf("&nbsp;&nbsp;&nbsp;\n");
276
277}//void ExttGroupTypeNavBar(void)
278
279
280void tGroupTypeNavList(void)
281{
282        MYSQL_RES *res;
283        MYSQL_ROW field;
284
285        ExtSelectPublic("tGroupType","tGroupType.uGroupType,tGroupType.cLabel");
286
287        mysql_query(&gMysql,gcQuery);
288        if(mysql_errno(&gMysql))
289        {
290                printf("<p><u>tGroupTypeNavList</u><br>\n");
291                printf("%s",mysql_error(&gMysql));
292                return;
293        }
294
295        res=mysql_store_result(&gMysql);
296        if(mysql_num_rows(res))
297        {       
298                printf("<p><u>tGroupTypeNavList</u><br>\n");
299
300                while((field=mysql_fetch_row(res)))
301                        printf("<a class=darkLink href=unxsVZ.cgi?gcFunction=tGroupType&uGroupType=%s>%s</a><br>\n",
302                                        field[0],field[1]);
303        }
304        mysql_free_result(res);
305
306}//void tGroupTypeNavList(void)
307
308
Note: See TracBrowser for help on using the browser.