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