| 1 | /* |
|---|
| 2 | FILE |
|---|
| 3 | tTemplateSet source code of unxsVZ.cgi |
|---|
| 4 | Built by mysqlRAD2.cgi (C) Gary Wallis 2001-2007 |
|---|
| 5 | $Id$ |
|---|
| 6 | PURPOSE |
|---|
| 7 | Schema dependent RAD generated file. |
|---|
| 8 | Program app functionality in ttemplatesetfunc.h while |
|---|
| 9 | RAD is still to be used. |
|---|
| 10 | */ |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | #include "mysqlrad.h" |
|---|
| 14 | |
|---|
| 15 | //Table Variables |
|---|
| 16 | //Table Variables |
|---|
| 17 | //uTemplateSet: Primary Key |
|---|
| 18 | static unsigned uTemplateSet=0; |
|---|
| 19 | //cLabel: Short label |
|---|
| 20 | static char cLabel[33]={""}; |
|---|
| 21 | //uOwner: Record owner |
|---|
| 22 | static unsigned uOwner=0; |
|---|
| 23 | //uCreatedBy: uClient for last insert |
|---|
| 24 | static unsigned uCreatedBy=0; |
|---|
| 25 | //uCreatedDate: Unix seconds date last insert |
|---|
| 26 | static time_t uCreatedDate=0; |
|---|
| 27 | //uModBy: uClient for last update |
|---|
| 28 | static unsigned uModBy=0; |
|---|
| 29 | //uModDate: Unix seconds date last update |
|---|
| 30 | static time_t uModDate=0; |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | #define VAR_LIST_tTemplateSet "tTemplateSet.uTemplateSet,tTemplateSet.cLabel,tTemplateSet.uOwner,tTemplateSet.uCreatedBy,tTemplateSet.uCreatedDate,tTemplateSet.uModBy,tTemplateSet.uModDate" |
|---|
| 35 | |
|---|
| 36 | //Local only |
|---|
| 37 | void Insert_tTemplateSet(void); |
|---|
| 38 | void Update_tTemplateSet(char *cRowid); |
|---|
| 39 | void ProcesstTemplateSetListVars(pentry entries[], int x); |
|---|
| 40 | |
|---|
| 41 | //In tTemplateSetfunc.h file included below |
|---|
| 42 | void ExtProcesstTemplateSetVars(pentry entries[], int x); |
|---|
| 43 | void ExttTemplateSetCommands(pentry entries[], int x); |
|---|
| 44 | void ExttTemplateSetButtons(void); |
|---|
| 45 | void ExttTemplateSetNavBar(void); |
|---|
| 46 | void ExttTemplateSetGetHook(entry gentries[], int x); |
|---|
| 47 | void ExttTemplateSetSelect(void); |
|---|
| 48 | void ExttTemplateSetSelectRow(void); |
|---|
| 49 | void ExttTemplateSetListSelect(void); |
|---|
| 50 | void ExttTemplateSetListFilter(void); |
|---|
| 51 | void ExttTemplateSetAuxTable(void); |
|---|
| 52 | |
|---|
| 53 | #include "ttemplatesetfunc.h" |
|---|
| 54 | |
|---|
| 55 | //Table Variables Assignment Function |
|---|
| 56 | void ProcesstTemplateSetVars(pentry entries[], int x) |
|---|
| 57 | { |
|---|
| 58 | register int i; |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | for(i=0;i<x;i++) |
|---|
| 62 | { |
|---|
| 63 | if(!strcmp(entries[i].name,"uTemplateSet")) |
|---|
| 64 | sscanf(entries[i].val,"%u",&uTemplateSet); |
|---|
| 65 | else if(!strcmp(entries[i].name,"cLabel")) |
|---|
| 66 | sprintf(cLabel,"%.32s",entries[i].val); |
|---|
| 67 | else if(!strcmp(entries[i].name,"uOwner")) |
|---|
| 68 | sscanf(entries[i].val,"%u",&uOwner); |
|---|
| 69 | else if(!strcmp(entries[i].name,"uCreatedBy")) |
|---|
| 70 | sscanf(entries[i].val,"%u",&uCreatedBy); |
|---|
| 71 | else if(!strcmp(entries[i].name,"uCreatedDate")) |
|---|
| 72 | sscanf(entries[i].val,"%lu",&uCreatedDate); |
|---|
| 73 | else if(!strcmp(entries[i].name,"uModBy")) |
|---|
| 74 | sscanf(entries[i].val,"%u",&uModBy); |
|---|
| 75 | else if(!strcmp(entries[i].name,"uModDate")) |
|---|
| 76 | sscanf(entries[i].val,"%lu",&uModDate); |
|---|
| 77 | |
|---|
| 78 | } |
|---|
| 79 | |
|---|
| 80 | //After so we can overwrite form data if needed. |
|---|
| 81 | ExtProcesstTemplateSetVars(entries,x); |
|---|
| 82 | |
|---|
| 83 | }//ProcesstTemplateSetVars() |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | void ProcesstTemplateSetListVars(pentry entries[], int x) |
|---|
| 87 | { |
|---|
| 88 | register int i; |
|---|
| 89 | |
|---|
| 90 | for(i=0;i<x;i++) |
|---|
| 91 | { |
|---|
| 92 | if(!strncmp(entries[i].name,"ED",2)) |
|---|
| 93 | { |
|---|
| 94 | sscanf(entries[i].name+2,"%u",&uTemplateSet); |
|---|
| 95 | guMode=2002; |
|---|
| 96 | tTemplateSet(""); |
|---|
| 97 | } |
|---|
| 98 | } |
|---|
| 99 | }//void ProcesstTemplateSetListVars(pentry entries[], int x) |
|---|
| 100 | |
|---|
| 101 | |
|---|
| 102 | int tTemplateSetCommands(pentry entries[], int x) |
|---|
| 103 | { |
|---|
| 104 | ProcessControlVars(entries,x); |
|---|
| 105 | |
|---|
| 106 | ExttTemplateSetCommands(entries,x); |
|---|
| 107 | |
|---|
| 108 | if(!strcmp(gcFunction,"tTemplateSetTools")) |
|---|
| 109 | { |
|---|
| 110 | if(!strcmp(gcFind,LANG_NB_LIST)) |
|---|
| 111 | { |
|---|
| 112 | tTemplateSetList(); |
|---|
| 113 | } |
|---|
| 114 | |
|---|
| 115 | //Default |
|---|
| 116 | ProcesstTemplateSetVars(entries,x); |
|---|
| 117 | tTemplateSet(""); |
|---|
| 118 | } |
|---|
| 119 | else if(!strcmp(gcFunction,"tTemplateSetList")) |
|---|
| 120 | { |
|---|
| 121 | ProcessControlVars(entries,x); |
|---|
| 122 | ProcesstTemplateSetListVars(entries,x); |
|---|
| 123 | tTemplateSetList(); |
|---|
| 124 | } |
|---|
| 125 | |
|---|
| 126 | return(0); |
|---|
| 127 | |
|---|
| 128 | }//tTemplateSetCommands() |
|---|
| 129 | |
|---|
| 130 | |
|---|
| 131 | void tTemplateSet(const char *cResult) |
|---|
| 132 | { |
|---|
| 133 | MYSQL_RES *res; |
|---|
| 134 | MYSQL_RES *res2; |
|---|
| 135 | MYSQL_ROW field; |
|---|
| 136 | |
|---|
| 137 | //Internal skip reloading |
|---|
| 138 | if(!cResult[0]) |
|---|
| 139 | { |
|---|
| 140 | if(guMode) |
|---|
| 141 | ExttTemplateSetSelectRow(); |
|---|
| 142 | else |
|---|
| 143 | ExttTemplateSetSelect(); |
|---|
| 144 | |
|---|
| 145 | mysql_query(&gMysql,gcQuery); |
|---|
| 146 | if(mysql_errno(&gMysql)) |
|---|
| 147 | { |
|---|
| 148 | if(strstr(mysql_error(&gMysql)," doesn't exist")) |
|---|
| 149 | { |
|---|
| 150 | CreatetTemplateSet(); |
|---|
| 151 | unxsVZ("New tTemplateSet table created"); |
|---|
| 152 | } |
|---|
| 153 | else |
|---|
| 154 | { |
|---|
| 155 | htmlPlainTextError(mysql_error(&gMysql)); |
|---|
| 156 | } |
|---|
| 157 | } |
|---|
| 158 | |
|---|
| 159 | res=mysql_store_result(&gMysql); |
|---|
| 160 | if((guI=mysql_num_rows(res))) |
|---|
| 161 | { |
|---|
| 162 | if(guMode==6) |
|---|
| 163 | { |
|---|
| 164 | sprintf(gcQuery,"SELECT _rowid FROM tTemplateSet WHERE uTemplateSet=%u" |
|---|
| 165 | ,uTemplateSet); |
|---|
| 166 | MYSQL_RUN_STORE(res2); |
|---|
| 167 | field=mysql_fetch_row(res2); |
|---|
| 168 | sscanf(field[0],"%lu",&gluRowid); |
|---|
| 169 | gluRowid++; |
|---|
| 170 | } |
|---|
| 171 | PageMachine("",0,""); |
|---|
| 172 | if(!guMode) mysql_data_seek(res,gluRowid-1); |
|---|
| 173 | field=mysql_fetch_row(res); |
|---|
| 174 | sscanf(field[0],"%u",&uTemplateSet); |
|---|
| 175 | sprintf(cLabel,"%.32s",field[1]); |
|---|
| 176 | sscanf(field[2],"%u",&uOwner); |
|---|
| 177 | sscanf(field[3],"%u",&uCreatedBy); |
|---|
| 178 | sscanf(field[4],"%lu",&uCreatedDate); |
|---|
| 179 | sscanf(field[5],"%u",&uModBy); |
|---|
| 180 | sscanf(field[6],"%lu",&uModDate); |
|---|
| 181 | |
|---|
| 182 | } |
|---|
| 183 | |
|---|
| 184 | }//Internal Skip |
|---|
| 185 | |
|---|
| 186 | Header_ism3(":: tTemplateSet",0); |
|---|
| 187 | printf("<table width=100%% cellspacing=0 cellpadding=0>\n"); |
|---|
| 188 | printf("<tr><td colspan=2 align=right valign=center>"); |
|---|
| 189 | |
|---|
| 190 | |
|---|
| 191 | printf("<input type=hidden name=gcFunction value=tTemplateSetTools>"); |
|---|
| 192 | printf("<input type=hidden name=gluRowid value=%lu>",gluRowid); |
|---|
| 193 | if(guI) |
|---|
| 194 | { |
|---|
| 195 | if(guMode==6) |
|---|
| 196 | //printf(" Found"); |
|---|
| 197 | printf(LANG_NBR_FOUND); |
|---|
| 198 | else if(guMode==5) |
|---|
| 199 | //printf(" Modified"); |
|---|
| 200 | printf(LANG_NBR_MODIFIED); |
|---|
| 201 | else if(guMode==4) |
|---|
| 202 | //printf(" New"); |
|---|
| 203 | printf(LANG_NBR_NEW); |
|---|
| 204 | printf(LANG_NBRF_SHOWING,gluRowid,guI); |
|---|
| 205 | } |
|---|
| 206 | else |
|---|
| 207 | { |
|---|
| 208 | if(!cResult[0]) |
|---|
| 209 | //printf(" No records found"); |
|---|
| 210 | printf(LANG_NBR_NORECS); |
|---|
| 211 | } |
|---|
| 212 | if(cResult[0]) printf("%s",cResult); |
|---|
| 213 | printf("</td></tr>"); |
|---|
| 214 | printf("<tr><td valign=top width=25%%>"); |
|---|
| 215 | |
|---|
| 216 | ExttTemplateSetButtons(); |
|---|
| 217 | |
|---|
| 218 | printf("</td><td valign=top>"); |
|---|
| 219 | // |
|---|
| 220 | OpenFieldSet("tTemplateSet Record Data",100); |
|---|
| 221 | |
|---|
| 222 | if(guMode==2000 || guMode==2002) |
|---|
| 223 | tTemplateSetInput(1); |
|---|
| 224 | else |
|---|
| 225 | tTemplateSetInput(0); |
|---|
| 226 | |
|---|
| 227 | // |
|---|
| 228 | CloseFieldSet(); |
|---|
| 229 | |
|---|
| 230 | //Bottom table |
|---|
| 231 | printf("<tr><td colspan=2>"); |
|---|
| 232 | ExttTemplateSetAuxTable(); |
|---|
| 233 | |
|---|
| 234 | Footer_ism3(); |
|---|
| 235 | |
|---|
| 236 | }//end of tTemplateSet(); |
|---|
| 237 | |
|---|
| 238 | |
|---|
| 239 | void tTemplateSetInput(unsigned uMode) |
|---|
| 240 | { |
|---|
| 241 | |
|---|
| 242 | //uTemplateSet |
|---|
| 243 | OpenRow(LANG_FL_tTemplateSet_uTemplateSet,"black"); |
|---|
| 244 | printf("<input title='%s' type=text name=uTemplateSet value=%u size=16 maxlength=10 " |
|---|
| 245 | ,LANG_FT_tTemplateSet_uTemplateSet,uTemplateSet); |
|---|
| 246 | if(guPermLevel>=20 && uMode) |
|---|
| 247 | { |
|---|
| 248 | printf("></td></tr>\n"); |
|---|
| 249 | } |
|---|
| 250 | else |
|---|
| 251 | { |
|---|
| 252 | printf("disabled></td></tr>\n"); |
|---|
| 253 | printf("<input type=hidden name=uTemplateSet value=%u >\n",uTemplateSet); |
|---|
| 254 | } |
|---|
| 255 | //cLabel |
|---|
| 256 | OpenRow(LANG_FL_tTemplateSet_cLabel,"black"); |
|---|
| 257 | printf("<input title='%s' type=text name=cLabel value=\"%s\" size=40 maxlength=32 " |
|---|
| 258 | ,LANG_FT_tTemplateSet_cLabel,EncodeDoubleQuotes(cLabel)); |
|---|
| 259 | if(guPermLevel>=7 && uMode) |
|---|
| 260 | { |
|---|
| 261 | printf("></td></tr>\n"); |
|---|
| 262 | } |
|---|
| 263 | else |
|---|
| 264 | { |
|---|
| 265 | printf("disabled></td></tr>\n"); |
|---|
| 266 | printf("<input type=hidden name=cLabel value=\"%s\">\n",EncodeDoubleQuotes(cLabel)); |
|---|
| 267 | } |
|---|
| 268 | //uOwner |
|---|
| 269 | OpenRow(LANG_FL_tTemplateSet_uOwner,"black"); |
|---|
| 270 | if(guPermLevel>=20 && uMode) |
|---|
| 271 | { |
|---|
| 272 | printf("%s<input type=hidden name=uOwner value=%u >\n",ForeignKey(TCLIENT,"cLabel",uOwner),uOwner); |
|---|
| 273 | } |
|---|
| 274 | else |
|---|
| 275 | { |
|---|
| 276 | printf("%s<input type=hidden name=uOwner value=%u >\n",ForeignKey(TCLIENT,"cLabel",uOwner),uOwner); |
|---|
| 277 | } |
|---|
| 278 | //uCreatedBy |
|---|
| 279 | OpenRow(LANG_FL_tTemplateSet_uCreatedBy,"black"); |
|---|
| 280 | if(guPermLevel>=20 && uMode) |
|---|
| 281 | { |
|---|
| 282 | printf("%s<input type=hidden name=uCreatedBy value=%u >\n",ForeignKey(TCLIENT,"cLabel",uCreatedBy),uCreatedBy); |
|---|
| 283 | } |
|---|
| 284 | else |
|---|
| 285 | { |
|---|
| 286 | printf("%s<input type=hidden name=uCreatedBy value=%u >\n",ForeignKey(TCLIENT,"cLabel",uCreatedBy),uCreatedBy); |
|---|
| 287 | } |
|---|
| 288 | //uCreatedDate |
|---|
| 289 | OpenRow(LANG_FL_tTemplateSet_uCreatedDate,"black"); |
|---|
| 290 | if(uCreatedDate) |
|---|
| 291 | printf("%s\n\n",ctime(&uCreatedDate)); |
|---|
| 292 | else |
|---|
| 293 | printf("---\n\n"); |
|---|
| 294 | printf("<input type=hidden name=uCreatedDate value=%lu >\n",uCreatedDate); |
|---|
| 295 | //uModBy |
|---|
| 296 | OpenRow(LANG_FL_tTemplateSet_uModBy,"black"); |
|---|
| 297 | if(guPermLevel>=20 && uMode) |
|---|
| 298 | { |
|---|
| 299 | printf("%s<input type=hidden name=uModBy value=%u >\n",ForeignKey(TCLIENT,"cLabel",uModBy),uModBy); |
|---|
| 300 | } |
|---|
| 301 | else |
|---|
| 302 | { |
|---|
| 303 | printf("%s<input type=hidden name=uModBy value=%u >\n",ForeignKey(TCLIENT,"cLabel",uModBy),uModBy); |
|---|
| 304 | } |
|---|
| 305 | //uModDate |
|---|
| 306 | OpenRow(LANG_FL_tTemplateSet_uModDate,"black"); |
|---|
| 307 | if(uModDate) |
|---|
| 308 | printf("%s\n\n",ctime(&uModDate)); |
|---|
| 309 | else |
|---|
| 310 | printf("---\n\n"); |
|---|
| 311 | printf("<input type=hidden name=uModDate value=%lu >\n",uModDate); |
|---|
| 312 | printf("</tr>\n"); |
|---|
| 313 | |
|---|
| 314 | |
|---|
| 315 | |
|---|
| 316 | }//void tTemplateSetInput(unsigned uMode) |
|---|
| 317 | |
|---|
| 318 | |
|---|
| 319 | void NewtTemplateSet(unsigned uMode) |
|---|
| 320 | { |
|---|
| 321 | register int i=0; |
|---|
| 322 | MYSQL_RES *res; |
|---|
| 323 | |
|---|
| 324 | sprintf(gcQuery,"SELECT uTemplateSet FROM tTemplateSet\ |
|---|
| 325 | WHERE uTemplateSet=%u" |
|---|
| 326 | ,uTemplateSet); |
|---|
| 327 | MYSQL_RUN_STORE(res); |
|---|
| 328 | i=mysql_num_rows(res); |
|---|
| 329 | |
|---|
| 330 | if(i) |
|---|
| 331 | //tTemplateSet("<blink>Record already exists"); |
|---|
| 332 | tTemplateSet(LANG_NBR_RECEXISTS); |
|---|
| 333 | |
|---|
| 334 | //insert query |
|---|
| 335 | Insert_tTemplateSet(); |
|---|
| 336 | if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql)); |
|---|
| 337 | //sprintf(gcQuery,"New record %u added"); |
|---|
| 338 | uTemplateSet=mysql_insert_id(&gMysql); |
|---|
| 339 | uCreatedDate=luGetCreatedDate("tTemplateSet",uTemplateSet); |
|---|
| 340 | unxsVZLog(uTemplateSet,"tTemplateSet","New"); |
|---|
| 341 | |
|---|
| 342 | if(!uMode) |
|---|
| 343 | { |
|---|
| 344 | sprintf(gcQuery,LANG_NBR_NEWRECADDED,uTemplateSet); |
|---|
| 345 | tTemplateSet(gcQuery); |
|---|
| 346 | } |
|---|
| 347 | |
|---|
| 348 | }//NewtTemplateSet(unsigned uMode) |
|---|
| 349 | |
|---|
| 350 | |
|---|
| 351 | void DeletetTemplateSet(void) |
|---|
| 352 | { |
|---|
| 353 | sprintf(gcQuery,"DELETE FROM tTemplateSet WHERE uTemplateSet=%u AND ( uOwner=%u OR %u>9 )" |
|---|
| 354 | ,uTemplateSet,guLoginClient,guPermLevel); |
|---|
| 355 | MYSQL_RUN; |
|---|
| 356 | //tTemplateSet("Record Deleted"); |
|---|
| 357 | if(mysql_affected_rows(&gMysql)>0) |
|---|
| 358 | { |
|---|
| 359 | unxsVZLog(uTemplateSet,"tTemplateSet","Del"); |
|---|
| 360 | tTemplateSet(LANG_NBR_RECDELETED); |
|---|
| 361 | } |
|---|
| 362 | else |
|---|
| 363 | { |
|---|
| 364 | unxsVZLog(uTemplateSet,"tTemplateSet","DelError"); |
|---|
| 365 | tTemplateSet(LANG_NBR_RECNOTDELETED); |
|---|
| 366 | } |
|---|
| 367 | |
|---|
| 368 | }//void DeletetTemplateSet(void) |
|---|
| 369 | |
|---|
| 370 | |
|---|
| 371 | void Insert_tTemplateSet(void) |
|---|
| 372 | { |
|---|
| 373 | |
|---|
| 374 | //insert query |
|---|
| 375 | sprintf(gcQuery,"INSERT INTO tTemplateSet SET uTemplateSet=%u,cLabel='%s',uOwner=%u,uCreatedBy=%u,uCreatedDate=UNIX_TIMESTAMP(NOW())", |
|---|
| 376 | uTemplateSet |
|---|
| 377 | ,TextAreaSave(cLabel) |
|---|
| 378 | ,uOwner |
|---|
| 379 | ,uCreatedBy |
|---|
| 380 | ); |
|---|
| 381 | |
|---|
| 382 | MYSQL_RUN; |
|---|
| 383 | |
|---|
| 384 | }//void Insert_tTemplateSet(void) |
|---|
| 385 | |
|---|
| 386 | |
|---|
| 387 | void Update_tTemplateSet(char *cRowid) |
|---|
| 388 | { |
|---|
| 389 | |
|---|
| 390 | //update query |
|---|
| 391 | sprintf(gcQuery,"UPDATE tTemplateSet SET uTemplateSet=%u,cLabel='%s',uModBy=%u,uModDate=UNIX_TIMESTAMP(NOW()) WHERE _rowid=%s", |
|---|
| 392 | uTemplateSet |
|---|
| 393 | ,TextAreaSave(cLabel) |
|---|
| 394 | ,uModBy |
|---|
| 395 | ,cRowid); |
|---|
| 396 | |
|---|
| 397 | MYSQL_RUN; |
|---|
| 398 | |
|---|
| 399 | }//void Update_tTemplateSet(void) |
|---|
| 400 | |
|---|
| 401 | |
|---|
| 402 | void ModtTemplateSet(void) |
|---|
| 403 | { |
|---|
| 404 | register int i=0; |
|---|
| 405 | MYSQL_RES *res; |
|---|
| 406 | MYSQL_ROW field; |
|---|
| 407 | |
|---|
| 408 | unsigned uPreModDate=0; |
|---|
| 409 | sprintf(gcQuery,"SELECT uTemplateSet,uModDate FROM tTemplateSet WHERE uTemplateSet=%u" |
|---|
| 410 | ,uTemplateSet); |
|---|
| 411 | MYSQL_RUN_STORE(res); |
|---|
| 412 | i=mysql_num_rows(res); |
|---|
| 413 | |
|---|
| 414 | //if(i<1) tTemplateSet("<blink>Record does not exist"); |
|---|
| 415 | if(i<1) tTemplateSet(LANG_NBR_RECNOTEXIST); |
|---|
| 416 | //if(i>1) tTemplateSet("<blink>Multiple rows!"); |
|---|
| 417 | if(i>1) tTemplateSet(LANG_NBR_MULTRECS); |
|---|
| 418 | |
|---|
| 419 | field=mysql_fetch_row(res); |
|---|
| 420 | sscanf(field[1],"%u",&uPreModDate); |
|---|
| 421 | if(uPreModDate!=uModDate) tTemplateSet(LANG_NBR_EXTMOD); |
|---|
| 422 | |
|---|
| 423 | Update_tTemplateSet(field[0]); |
|---|
| 424 | if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql)); |
|---|
| 425 | //sprintf(query,"record %s modified",field[0]); |
|---|
| 426 | sprintf(gcQuery,LANG_NBRF_REC_MODIFIED,field[0]); |
|---|
| 427 | uModDate=luGetModDate("tTemplateSet",uTemplateSet); |
|---|
| 428 | unxsVZLog(uTemplateSet,"tTemplateSet","Mod"); |
|---|
| 429 | tTemplateSet(gcQuery); |
|---|
| 430 | |
|---|
| 431 | }//ModtTemplateSet(void) |
|---|
| 432 | |
|---|
| 433 | |
|---|
| 434 | void tTemplateSetList(void) |
|---|
| 435 | { |
|---|
| 436 | MYSQL_RES *res; |
|---|
| 437 | MYSQL_ROW field; |
|---|
| 438 | |
|---|
| 439 | ExttTemplateSetListSelect(); |
|---|
| 440 | |
|---|
| 441 | MYSQL_RUN_STORE(res); |
|---|
| 442 | guI=mysql_num_rows(res); |
|---|
| 443 | |
|---|
| 444 | PageMachine("tTemplateSetList",1,"");//1 is auto header list guMode. Opens table! |
|---|
| 445 | |
|---|
| 446 | //Filter select drop down |
|---|
| 447 | ExttTemplateSetListFilter(); |
|---|
| 448 | |
|---|
| 449 | printf("<input type=text size=16 name=gcCommand maxlength=98 value=\"%s\" >",gcCommand); |
|---|
| 450 | |
|---|
| 451 | printf("</table>\n"); |
|---|
| 452 | |
|---|
| 453 | printf("<table bgcolor=#9BC1B3 border=0 width=100%%>\n"); |
|---|
| 454 | printf("<tr bgcolor=black><td><font face=arial,helvetica color=white>uTemplateSet<td><font face=arial,helvetica color=white>cLabel<td><font face=arial,helvetica color=white>uOwner<td><font face=arial,helvetica color=white>uCreatedBy<td><font face=arial,helvetica color=white>uCreatedDate<td><font face=arial,helvetica color=white>uModBy<td><font face=arial,helvetica color=white>uModDate</tr>"); |
|---|
| 455 | |
|---|
| 456 | |
|---|
| 457 | |
|---|
| 458 | mysql_data_seek(res,guStart-1); |
|---|
| 459 | |
|---|
| 460 | for(guN=0;guN<(guEnd-guStart+1);guN++) |
|---|
| 461 | { |
|---|
| 462 | field=mysql_fetch_row(res); |
|---|
| 463 | if(!field) |
|---|
| 464 | { |
|---|
| 465 | printf("<tr><td><font face=arial,helvetica>End of data</table>"); |
|---|
| 466 | Footer_ism3(); |
|---|
| 467 | } |
|---|
| 468 | if(guN % 2) |
|---|
| 469 | printf("<tr bgcolor=#BBE1D3>"); |
|---|
| 470 | else |
|---|
| 471 | printf("<tr>"); |
|---|
| 472 | time_t luTime4=strtoul(field[4],NULL,10); |
|---|
| 473 | char cBuf4[32]; |
|---|
| 474 | if(luTime4) |
|---|
| 475 | ctime_r(&luTime4,cBuf4); |
|---|
| 476 | else |
|---|
| 477 | sprintf(cBuf4,"---"); |
|---|
| 478 | time_t luTime6=strtoul(field[6],NULL,10); |
|---|
| 479 | char cBuf6[32]; |
|---|
| 480 | if(luTime6) |
|---|
| 481 | ctime_r(&luTime6,cBuf6); |
|---|
| 482 | else |
|---|
| 483 | sprintf(cBuf6,"---"); |
|---|
| 484 | printf("<td><input type=submit name=ED%s value=Edit> %s<td>%s<td>%s<td>%s<td>%s<td>%s<td>%s</tr>" |
|---|
| 485 | ,field[0] |
|---|
| 486 | ,field[0] |
|---|
| 487 | ,field[1] |
|---|
| 488 | ,ForeignKey(TCLIENT,"cLabel",strtoul(field[2],NULL,10)) |
|---|
| 489 | ,ForeignKey(TCLIENT,"cLabel",strtoul(field[3],NULL,10)) |
|---|
| 490 | ,cBuf4 |
|---|
| 491 | ,ForeignKey(TCLIENT,"cLabel",strtoul(field[5],NULL,10)) |
|---|
| 492 | ,cBuf6 |
|---|
| 493 | ); |
|---|
| 494 | |
|---|
| 495 | } |
|---|
| 496 | |
|---|
| 497 | printf("</table></form>\n"); |
|---|
| 498 | Footer_ism3(); |
|---|
| 499 | |
|---|
| 500 | }//tTemplateSetList() |
|---|
| 501 | |
|---|
| 502 | |
|---|
| 503 | void CreatetTemplateSet(void) |
|---|
| 504 | { |
|---|
| 505 | sprintf(gcQuery,"CREATE TABLE IF NOT EXISTS tTemplateSet ( uTemplateSet INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, cLabel VARCHAR(32) NOT NULL DEFAULT '', uOwner INT UNSIGNED NOT NULL DEFAULT 0,index (uOwner), uCreatedBy INT UNSIGNED NOT NULL DEFAULT 0, uCreatedDate INT UNSIGNED NOT NULL DEFAULT 0, uModBy INT UNSIGNED NOT NULL DEFAULT 0, uModDate INT UNSIGNED NOT NULL DEFAULT 0 )"); |
|---|
| 506 | MYSQL_RUN; |
|---|
| 507 | |
|---|
| 508 | }//CreatetTemplateSet() |
|---|
| 509 | |
|---|