root/trunk/ttypefunc.h

Revision 1516, 5.8 KB (checked in by Gary, 2 years ago)

unxsVZ tJob recurring jobs and related work done. Ready for alpha testing.

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