root/trunk/tmonthfunc.h

Revision 1380, 6.6 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
8        (C) 2001-2007 Gary Wallis.
9 
10*/
11
12//ModuleFunctionProtos()
13
14
15void tMonthNavList(void);
16
17void ExtProcesstMonthVars(pentry entries[], int x)
18{
19        /*
20        register int i;
21        for(i=0;i<x;i++)
22        {
23        }
24        */
25}//void ExtProcesstMonthVars(pentry entries[], int x)
26
27
28void ExttMonthCommands(pentry entries[], int x)
29{
30
31        if(!strcmp(gcFunction,"tMonthTools"))
32        {
33                //ModuleFunctionProcess()
34
35                if(!strcmp(gcCommand,LANG_NB_NEW))
36                {
37                        if(guPermLevel>=12)
38                        {
39                                ProcesstMonthVars(entries,x);
40                                guMode=2000;
41                                tMonth(LANG_NB_CONFIRMNEW);
42                        }
43                }
44                else if(!strcmp(gcCommand,LANG_NB_CONFIRMNEW))
45                {
46                        if(guPermLevel>=12)
47                        {
48                                ProcesstMonthVars(entries,x);
49
50                                guMode=2000;
51                                //Check entries here
52                                guMode=0;
53
54                                uMonth=0;
55                                uCreatedBy=guLoginClient;
56                                uOwner=guCompany;
57                                uModBy=0;//Never modified
58                                uModDate=0;//Never modified
59                                NewtMonth(0);
60                        }
61                }
62                else if(!strcmp(gcCommand,LANG_NB_DELETE))
63                {
64                        ProcesstMonthVars(entries,x);
65                        if(uOwner) GetClientOwner(uOwner,&guReseller);
66                        if( (guPermLevel>=12 && uOwner==guLoginClient)
67                                || (guPermLevel>9 && uOwner!=1 && uOwner!=0)
68                                || (guPermLevel>7 && guReseller==guLoginClient) )
69                        {
70                                guMode=2001;
71                                tMonth(LANG_NB_CONFIRMDEL);
72                        }
73                }
74                else if(!strcmp(gcCommand,LANG_NB_CONFIRMDEL))
75                {
76                        ProcesstMonthVars(entries,x);
77                        if(uOwner) GetClientOwner(uOwner,&guReseller);
78                        if( (guPermLevel>=12 && uOwner==guLoginClient)
79                                || (guPermLevel>9 && uOwner!=1 && uOwner!=0)
80                                || (guPermLevel>7 && guReseller==guLoginClient) )
81                        {
82                                guMode=5;
83                                DeletetMonth();
84                        }
85                }
86                else if(!strcmp(gcCommand,LANG_NB_MODIFY))
87                {
88                        ProcesstMonthVars(entries,x);
89                        if(uOwner) GetClientOwner(uOwner,&guReseller);
90                        if( (guPermLevel>=12 && uOwner==guLoginClient)
91                                || (guPermLevel>9 && uOwner!=1 && uOwner!=0)
92                                || (guPermLevel>7 && guReseller==guLoginClient) )
93                        {
94                                guMode=2002;
95                                tMonth(LANG_NB_CONFIRMMOD);
96                        }
97                }
98                else if(!strcmp(gcCommand,LANG_NB_CONFIRMMOD))
99                {
100                        ProcesstMonthVars(entries,x);
101                        if(uOwner) GetClientOwner(uOwner,&guReseller);
102                        if( (guPermLevel>=12 && uOwner==guLoginClient)
103                                || (guPermLevel>9 && uOwner!=1 && uOwner!=0)
104                                || (guPermLevel>7 && guReseller==guLoginClient) )
105                        {
106                                guMode=2002;
107                                //Check entries here
108                                guMode=0;
109
110                                uModBy=guLoginClient;
111                                ModtMonth();
112                        }
113                }
114        }
115
116}//void ExttMonthCommands(pentry entries[], int x)
117
118
119void ExttMonthButtons(void)
120{
121        OpenFieldSet("tMonth Aux Panel",100);
122        switch(guMode)
123        {
124                case 2000:
125                        printf("<p><u>Enter/mod data</u><br>");
126                        printf(LANG_NBB_CONFIRMNEW);
127                break;
128
129                case 2001:
130                        printf("<p><u>Think twice</u><br>");
131                        printf(LANG_NBB_CONFIRMDEL);
132                break;
133
134                case 2002:
135                        printf("<p><u>Review changes</u><br>");
136                        printf(LANG_NBB_CONFIRMMOD);
137                break;
138
139                default:
140
141                        tMonthNavList();
142        }
143        CloseFieldSet();
144
145}//void ExttMonthButtons(void)
146
147
148void ExttMonthAuxTable(void)
149{
150
151}//void ExttMonthAuxTable(void)
152
153
154void ExttMonthGetHook(entry gentries[], int x)
155{
156        register int i;
157
158        for(i=0;i<x;i++)
159        {
160                if(!strcmp(gentries[i].name,"uMonth"))
161                {
162                        sscanf(gentries[i].val,"%u",&uMonth);
163                        guMode=6;
164                }
165        }
166        tMonth("");
167
168}//void ExttMonthGetHook(entry gentries[], int x)
169
170
171void ExttMonthSelect(void)
172{
173        //Set non search gcQuery here for tTableName()
174        ExtSelect("tMonth",VAR_LIST_tMonth);
175
176}//void ExttMonthSelect(void)
177
178
179void ExttMonthSelectRow(void)
180{
181        ExtSelectRow("tMonth",VAR_LIST_tMonth,uMonth);
182
183}//void ExttMonthSelectRow(void)
184
185
186void ExttMonthListSelect(void)
187{
188        char cCat[512];
189
190        ExtListSelect("tMonth",VAR_LIST_tMonth);
191
192        //Changes here must be reflected below in ExttMonthListFilter()
193        if(!strcmp(gcFilter,"uMonth"))
194        {
195                sscanf(gcCommand,"%u",&uMonth);
196                if(guLoginClient==1 && guPermLevel>11)
197                        strcat(gcQuery," WHERE ");
198                else
199                        strcat(gcQuery," AND ");
200                sprintf(cCat,"tMonth.uMonth=%u ORDER BY uMonth",uMonth);
201                strcat(gcQuery,cCat);
202        }
203        else if(1)
204        {
205                //None NO FILTER
206                strcpy(gcFilter,"None");
207                strcat(gcQuery," ORDER BY uMonth");
208        }
209
210}//void ExttMonthListSelect(void)
211
212
213void ExttMonthListFilter(void)
214{
215        //Filter
216        printf("&nbsp;&nbsp;&nbsp;Filter on ");
217        printf("<select name=gcFilter>");
218        if(strcmp(gcFilter,"uMonth"))
219                printf("<option>uMonth</option>");
220        else
221                printf("<option selected>uMonth</option>");
222        if(strcmp(gcFilter,"None"))
223                printf("<option>None</option>");
224        else
225                printf("<option selected>None</option>");
226        printf("</select>");
227
228}//void ExttMonthListFilter(void)
229
230
231void ExttMonthNavBar(void)
232{
233        if(uOwner) GetClientOwner(uOwner,&guReseller);
234
235        printf(LANG_NBB_SKIPFIRST);
236        printf(LANG_NBB_SKIPBACK);
237        printf(LANG_NBB_SEARCH);
238
239        if(guPermLevel>=12 && !guListMode)
240                printf(LANG_NBB_NEW);
241
242                        if( (guPermLevel>=12 && uOwner==guLoginClient)
243                                || (guPermLevel>9 && uOwner!=1 && uOwner!=0)
244                                || (guPermLevel>7 && guReseller==guLoginClient) )
245                printf(LANG_NBB_MODIFY);
246
247                        if( (guPermLevel>=12 && uOwner==guLoginClient)
248                                || (guPermLevel>9 && uOwner!=1 && uOwner!=0)
249                                || (guPermLevel>7 && guReseller==guLoginClient) )
250                printf(LANG_NBB_DELETE);
251
252        if(uOwner)
253                printf(LANG_NBB_LIST);
254
255        printf(LANG_NBB_SKIPNEXT);
256        printf(LANG_NBB_SKIPLAST);
257        printf("&nbsp;&nbsp;&nbsp;\n");
258
259}//void ExttMonthNavBar(void)
260
261
262void tMonthNavList(void)
263{
264        MYSQL_RES *res;
265        MYSQL_ROW field;
266
267        ExtSelect("tMonth","tMonth.uMonth,tMonth.cLabel");
268       
269        mysql_query(&gMysql,gcQuery);
270        if(mysql_errno(&gMysql))
271        {
272                printf("<p><u>tMonthNavList</u><br>\n");
273                printf("%s",mysql_error(&gMysql));
274                return;
275        }
276
277        res=mysql_store_result(&gMysql);
278        if(mysql_num_rows(res))
279        {       
280                printf("<p><u>tMonthNavList</u><br>\n");
281
282                while((field=mysql_fetch_row(res)))
283                {
284printf("<a class=darkLink href=unxsVZ.cgi?gcFunction=tMonth\
285&uMonth=%s>%s</a><br>\n",field[0],field[1]);
286                }
287        }
288        mysql_free_result(res);
289
290}//void tMonthNavList(void)
291
292
Note: See TracBrowser for help on using the browser.