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