| 1 | /* |
|---|
| 2 | FILE |
|---|
| 3 | tJobStatus 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 tjobstatusfunc.h while |
|---|
| 9 | RAD is still to be used. |
|---|
| 10 | */ |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | #include "mysqlrad.h" |
|---|
| 14 | |
|---|
| 15 | //Table Variables |
|---|
| 16 | //Table Variables |
|---|
| 17 | //uJobStatus: Primary Key |
|---|
| 18 | static unsigned uJobStatus=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_tJobStatus "tJobStatus.uJobStatus,tJobStatus.cLabel,tJobStatus.uOwner,tJobStatus.uCreatedBy,tJobStatus.uCreatedDate,tJobStatus.uModBy,tJobStatus.uModDate" |
|---|
| 35 | |
|---|
| 36 | //Local only |
|---|
| 37 | void Insert_tJobStatus(void); |
|---|
| 38 | void Update_tJobStatus(char *cRowid); |
|---|
| 39 | void ProcesstJobStatusListVars(pentry entries[], int x); |
|---|
| 40 | |
|---|
| 41 | //In tJobStatusfunc.h file included below |
|---|
| 42 | void ExtProcesstJobStatusVars(pentry entries[], int x); |
|---|
| 43 | void ExttJobStatusCommands(pentry entries[], int x); |
|---|
| 44 | void ExttJobStatusButtons(void); |
|---|
| 45 | void ExttJobStatusNavBar(void); |
|---|
| 46 | void ExttJobStatusGetHook(entry gentries[], int x); |
|---|
| 47 | void ExttJobStatusSelect(void); |
|---|
| 48 | void ExttJobStatusSelectRow(void); |
|---|
| 49 | void ExttJobStatusListSelect(void); |
|---|
| 50 | void ExttJobStatusListFilter(void); |
|---|
| 51 | void ExttJobStatusAuxTable(void); |
|---|
| 52 | |
|---|
| 53 | #include "tjobstatusfunc.h" |
|---|
| 54 | |
|---|
| 55 | //Table Variables Assignment Function |
|---|
| 56 | void ProcesstJobStatusVars(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,"uJobStatus")) |
|---|
| 64 | sscanf(entries[i].val,"%u",&uJobStatus); |
|---|
| 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 | ExtProcesstJobStatusVars(entries,x); |
|---|
| 82 | |
|---|
| 83 | }//ProcesstJobStatusVars() |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | void ProcesstJobStatusListVars(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",&uJobStatus); |
|---|
| 95 | guMode=2002; |
|---|
| 96 | tJobStatus(""); |
|---|
| 97 | } |
|---|
| 98 | } |
|---|
| 99 | }//void ProcesstJobStatusListVars(pentry entries[], int x) |
|---|
| 100 | |
|---|
| 101 | |
|---|
| 102 | int tJobStatusCommands(pentry entries[], int x) |
|---|
| 103 | { |
|---|
| 104 | ProcessControlVars(entries,x); |
|---|
| 105 | |
|---|
| 106 | ExttJobStatusCommands(entries,x); |
|---|
| 107 | |
|---|
| 108 | if(!strcmp(gcFunction,"tJobStatusTools")) |
|---|
| 109 | { |
|---|
| 110 | if(!strcmp(gcFind,LANG_NB_LIST)) |
|---|
| 111 | { |
|---|
| 112 | tJobStatusList(); |
|---|
| 113 | } |
|---|
| 114 | |
|---|
| 115 | //Default |
|---|
| 116 | ProcesstJobStatusVars(entries,x); |
|---|
| 117 | tJobStatus(""); |
|---|
| 118 | } |
|---|
| 119 | else if(!strcmp(gcFunction,"tJobStatusList")) |
|---|
| 120 | { |
|---|
| 121 | ProcessControlVars(entries,x); |
|---|
| 122 | ProcesstJobStatusListVars(entries,x); |
|---|
| 123 | tJobStatusList(); |
|---|
| 124 | } |
|---|
| 125 | |
|---|
| 126 | return(0); |
|---|
| 127 | |
|---|
| 128 | }//tJobStatusCommands() |
|---|
| 129 | |
|---|
| 130 | |
|---|
| 131 | void tJobStatus(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 | ExttJobStatusSelectRow(); |
|---|
| 142 | else |
|---|
| 143 | ExttJobStatusSelect(); |
|---|
| 144 | |
|---|
| 145 | mysql_query(&gMysql,gcQuery); |
|---|
| 146 | if(mysql_errno(&gMysql)) |
|---|
| 147 | { |
|---|
| 148 | if(strstr(mysql_error(&gMysql)," doesn't exist")) |
|---|
| 149 | { |
|---|
| 150 | CreatetJobStatus(); |
|---|
| 151 | unxsVZ("New tJobStatus 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 tJobStatus WHERE uJobStatus=%u" |
|---|
| 165 | ,uJobStatus); |
|---|
| 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",&uJobStatus); |
|---|
| 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 | }//Internal Skip |
|---|
| 184 | |
|---|
| 185 | Header_ism3(":: tJobStatus",0); |
|---|
| 186 | printf("<table width=100%% cellspacing=0 cellpadding=0>\n"); |
|---|
| 187 | printf("<tr><td colspan=2 align=right valign=center>"); |
|---|
| 188 | |
|---|
| 189 | |
|---|
| 190 | printf("<input type=hidden name=gcFunction value=tJobStatusTools>"); |
|---|
| 191 | printf("<input type=hidden name=gluRowid value=%lu>",gluRowid); |
|---|
| 192 | if(guI) |
|---|
| 193 | { |
|---|
| 194 | if(guMode==6) |
|---|
| 195 | //printf(" Found"); |
|---|
| 196 | printf(LANG_NBR_FOUND); |
|---|
| 197 | else if(guMode==5) |
|---|
| 198 | //printf(" Modified"); |
|---|
| 199 | printf(LANG_NBR_MODIFIED); |
|---|
| 200 | else if(guMode==4) |
|---|
| 201 | //printf(" New"); |
|---|
| 202 | printf(LANG_NBR_NEW); |
|---|
| 203 | printf(LANG_NBRF_SHOWING,gluRowid,guI); |
|---|
| 204 | } |
|---|
| 205 | else |
|---|
| 206 | { |
|---|
| 207 | if(!cResult[0]) |
|---|
| 208 | //printf(" No records found"); |
|---|
| 209 | printf(LANG_NBR_NORECS); |
|---|
| 210 | } |
|---|
| 211 | if(cResult[0]) printf("%s",cResult); |
|---|
| 212 | printf("</td></tr>"); |
|---|
| 213 | printf("<tr><td valign=top width=25%%>"); |
|---|
| 214 | |
|---|
| 215 | ExttJobStatusButtons(); |
|---|
| 216 | |
|---|
| 217 | printf("</td><td valign=top>"); |
|---|
| 218 | // |
|---|
| 219 | OpenFieldSet("tJobStatus Record Data",100); |
|---|
| 220 | |
|---|
| 221 | if(guMode==2000 || guMode==2002) |
|---|
| 222 | tJobStatusInput(1); |
|---|
| 223 | else |
|---|
| 224 | tJobStatusInput(0); |
|---|
| 225 | |
|---|
| 226 | // |
|---|
| 227 | CloseFieldSet(); |
|---|
| 228 | |
|---|
| 229 | //Bottom table |
|---|
| 230 | printf("<tr><td colspan=2>"); |
|---|
| 231 | ExttJobStatusAuxTable(); |
|---|
| 232 | |
|---|
| 233 | Footer_ism3(); |
|---|
| 234 | |
|---|
| 235 | }//end of tJobStatus(); |
|---|
| 236 | |
|---|
| 237 | |
|---|
| 238 | void tJobStatusInput(unsigned uMode) |
|---|
| 239 | { |
|---|
| 240 | |
|---|
| 241 | //uJobStatus |
|---|
| 242 | OpenRow(LANG_FL_tJobStatus_uJobStatus,"black"); |
|---|
| 243 | printf("<input title='%s' type=text name=uJobStatus value=%u size=16 maxlength=10 " |
|---|
| 244 | ,LANG_FT_tJobStatus_uJobStatus,uJobStatus); |
|---|
| 245 | if(guPermLevel>=20 && uMode) |
|---|
| 246 | { |
|---|
| 247 | printf("></td></tr>\n"); |
|---|
| 248 | } |
|---|
| 249 | else |
|---|
| 250 | { |
|---|
| 251 | printf("disabled></td></tr>\n"); |
|---|
| 252 | printf("<input type=hidden name=uJobStatus value=%u >\n",uJobStatus); |
|---|
| 253 | } |
|---|
| 254 | //cLabel |
|---|
| 255 | OpenRow(LANG_FL_tJobStatus_cLabel,"black"); |
|---|
| 256 | printf("<input title='%s' type=text name=cLabel value=\"%s\" size=40 maxlength=32 " |
|---|
| 257 | ,LANG_FT_tJobStatus_cLabel,EncodeDoubleQuotes(cLabel)); |
|---|
| 258 | if(guPermLevel>=0 && uMode) |
|---|
| 259 | { |
|---|
| 260 | printf("></td></tr>\n"); |
|---|
| 261 | } |
|---|
| 262 | else |
|---|
| 263 | { |
|---|
| 264 | printf("disabled></td></tr>\n"); |
|---|
| 265 | printf("<input type=hidden name=cLabel value=\"%s\">\n",EncodeDoubleQuotes(cLabel)); |
|---|
| 266 | } |
|---|
| 267 | //uOwner |
|---|
| 268 | OpenRow(LANG_FL_tJobStatus_uOwner,"black"); |
|---|
| 269 | if(guPermLevel>=1 && uMode) |
|---|
| 270 | { |
|---|
| 271 | printf("%s<input type=hidden name=uOwner value=%u >\n",ForeignKey("tClient","cLabel",uOwner),uOwner); |
|---|
| 272 | } |
|---|
| 273 | else |
|---|
| 274 | { |
|---|
| 275 | printf("%s<input type=hidden name=uOwner value=%u >\n",ForeignKey("tClient","cLabel",uOwner),uOwner); |
|---|
| 276 | } |
|---|
| 277 | //uCreatedBy |
|---|
| 278 | OpenRow(LANG_FL_tJobStatus_uCreatedBy,"black"); |
|---|
| 279 | if(guPermLevel>=1 && uMode) |
|---|
| 280 | { |
|---|
| 281 | printf("%s<input type=hidden name=uCreatedBy value=%u >\n",ForeignKey("tClient","cLabel",uCreatedBy),uCreatedBy); |
|---|
| 282 | } |
|---|
| 283 | else |
|---|
| 284 | { |
|---|
| 285 | printf("%s<input type=hidden name=uCreatedBy value=%u >\n",ForeignKey("tClient","cLabel",uCreatedBy),uCreatedBy); |
|---|
| 286 | } |
|---|
| 287 | //uCreatedDate |
|---|
| 288 | OpenRow(LANG_FL_tJobStatus_uCreatedDate,"black"); |
|---|
| 289 | if(uCreatedDate) |
|---|
| 290 | printf("%s\n\n",ctime(&uCreatedDate)); |
|---|
| 291 | else |
|---|
| 292 | printf("---\n\n"); |
|---|
| 293 | printf("<input type=hidden name=uCreatedDate value=%lu >\n",uCreatedDate); |
|---|
| 294 | //uModBy |
|---|
| 295 | OpenRow(LANG_FL_tJobStatus_uModBy,"black"); |
|---|
| 296 | if(guPermLevel>=1 && uMode) |
|---|
| 297 | { |
|---|
| 298 | printf("%s<input type=hidden name=uModBy value=%u >\n",ForeignKey("tClient","cLabel",uModBy),uModBy); |
|---|
| 299 | } |
|---|
| 300 | else |
|---|
| 301 | { |
|---|
| 302 | printf("%s<input type=hidden name=uModBy value=%u >\n",ForeignKey("tClient","cLabel",uModBy),uModBy); |
|---|
| 303 | } |
|---|
| 304 | //uModDate |
|---|
| 305 | OpenRow(LANG_FL_tJobStatus_uModDate,"black"); |
|---|
| 306 | if(uModDate) |
|---|
| 307 | printf("%s\n\n",ctime(&uModDate)); |
|---|
| 308 | else |
|---|
| 309 | printf("---\n\n"); |
|---|
| 310 | printf("<input type=hidden name=uModDate value=%lu >\n",uModDate); |
|---|
| 311 | printf("</tr>\n"); |
|---|
| 312 | |
|---|
| 313 | |
|---|
| 314 | |
|---|
| 315 | }//void tJobStatusInput(unsigned uMode) |
|---|
| 316 | |
|---|
| 317 | |
|---|
| 318 | void NewtJobStatus(unsigned uMode) |
|---|
| 319 | { |
|---|
| 320 | register int i=0; |
|---|
| 321 | MYSQL_RES *res; |
|---|
| 322 | |
|---|
| 323 | sprintf(gcQuery,"SELECT uJobStatus FROM tJobStatus\ |
|---|
| 324 | WHERE uJobStatus=%u" |
|---|
| 325 | ,uJobStatus); |
|---|
| 326 | MYSQL_RUN_STORE(res); |
|---|
| 327 | i=mysql_num_rows(res); |
|---|
| 328 | |
|---|
| 329 | if(i) |
|---|
| 330 | //tJobStatus("<blink>Record already exists"); |
|---|
| 331 | tJobStatus(LANG_NBR_RECEXISTS); |
|---|
| 332 | |
|---|
| 333 | //insert query |
|---|
| 334 | Insert_tJobStatus(); |
|---|
| 335 | if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql)); |
|---|
| 336 | //sprintf(gcQuery,"New record %u added"); |
|---|
| 337 | uJobStatus=mysql_insert_id(&gMysql); |
|---|
| 338 | uCreatedDate=luGetCreatedDate("tJobStatus",uJobStatus); |
|---|
| 339 | unxsVZLog(uJobStatus,"tJobStatus","New"); |
|---|
| 340 | |
|---|
| 341 | if(!uMode) |
|---|
| 342 | { |
|---|
| 343 | sprintf(gcQuery,LANG_NBR_NEWRECADDED,uJobStatus); |
|---|
| 344 | tJobStatus(gcQuery); |
|---|
| 345 | } |
|---|
| 346 | |
|---|
| 347 | }//NewtJobStatus(unsigned uMode) |
|---|
| 348 | |
|---|
| 349 | |
|---|
| 350 | void DeletetJobStatus(void) |
|---|
| 351 | { |
|---|
| 352 | sprintf(gcQuery,"DELETE FROM tJobStatus WHERE uJobStatus=%u AND ( uOwner=%u OR %u>9 )" |
|---|
| 353 | ,uJobStatus,guLoginClient,guPermLevel); |
|---|
| 354 | MYSQL_RUN; |
|---|
| 355 | //tJobStatus("Record Deleted"); |
|---|
| 356 | if(mysql_affected_rows(&gMysql)>0) |
|---|
| 357 | { |
|---|
| 358 | unxsVZLog(uJobStatus,"tJobStatus","Del"); |
|---|
| 359 | tJobStatus(LANG_NBR_RECDELETED); |
|---|
| 360 | } |
|---|
| 361 | else |
|---|
| 362 | { |
|---|
| 363 | unxsVZLog(uJobStatus,"tJobStatus","DelError"); |
|---|
| 364 | tJobStatus(LANG_NBR_RECNOTDELETED); |
|---|
| 365 | } |
|---|
| 366 | |
|---|
| 367 | }//void DeletetJobStatus(void) |
|---|
| 368 | |
|---|
| 369 | |
|---|
| 370 | void Insert_tJobStatus(void) |
|---|
| 371 | { |
|---|
| 372 | sprintf(gcQuery,"INSERT INTO tJobStatus SET uJobStatus=%u,cLabel='%s',uOwner=%u,uCreatedBy=%u," |
|---|
| 373 | "uCreatedDate=UNIX_TIMESTAMP(NOW())", |
|---|
| 374 | uJobStatus |
|---|
| 375 | ,TextAreaSave(cLabel) |
|---|
| 376 | ,uOwner |
|---|
| 377 | ,uCreatedBy |
|---|
| 378 | ); |
|---|
| 379 | |
|---|
| 380 | MYSQL_RUN; |
|---|
| 381 | |
|---|
| 382 | }//void Insert_tJobStatus(void) |
|---|
| 383 | |
|---|
| 384 | |
|---|
| 385 | void Update_tJobStatus(char *cRowid) |
|---|
| 386 | { |
|---|
| 387 | sprintf(gcQuery,"UPDATE tJobStatus SET uJobStatus=%u,cLabel='%s',uModBy=%u," |
|---|
| 388 | "uModDate=UNIX_TIMESTAMP(NOW()) WHERE _rowid=%s", |
|---|
| 389 | uJobStatus |
|---|
| 390 | ,TextAreaSave(cLabel) |
|---|
| 391 | ,uModBy |
|---|
| 392 | ,cRowid); |
|---|
| 393 | |
|---|
| 394 | MYSQL_RUN; |
|---|
| 395 | |
|---|
| 396 | }//void Update_tJobStatus(void) |
|---|
| 397 | |
|---|
| 398 | |
|---|
| 399 | void ModtJobStatus(void) |
|---|
| 400 | { |
|---|
| 401 | register int i=0; |
|---|
| 402 | MYSQL_RES *res; |
|---|
| 403 | MYSQL_ROW field; |
|---|
| 404 | unsigned uPreModDate=0; |
|---|
| 405 | |
|---|
| 406 | //Mod select gcQuery |
|---|
| 407 | if(guPermLevel<10) |
|---|
| 408 | sprintf(gcQuery,"SELECT tJobStatus.uJobStatus,\ |
|---|
| 409 | tJobStatus.uModDate\ |
|---|
| 410 | FROM tJobStatus,tClient\ |
|---|
| 411 | WHERE tJobStatus.uJobStatus=%u\ |
|---|
| 412 | AND tJobStatus.uOwner=tClient.uClient\ |
|---|
| 413 | AND (tClient.uOwner=%u OR tClient.uClient=%u)" |
|---|
| 414 | ,uJobStatus,guLoginClient,guLoginClient); |
|---|
| 415 | else |
|---|
| 416 | sprintf(gcQuery,"SELECT uJobStatus,uModDate FROM tJobStatus\ |
|---|
| 417 | WHERE uJobStatus=%u" |
|---|
| 418 | ,uJobStatus); |
|---|
| 419 | |
|---|
| 420 | MYSQL_RUN_STORE(res); |
|---|
| 421 | i=mysql_num_rows(res); |
|---|
| 422 | |
|---|
| 423 | //if(i<1) tJobStatus("<blink>Record does not exist"); |
|---|
| 424 | if(i<1) tJobStatus(LANG_NBR_RECNOTEXIST); |
|---|
| 425 | //if(i>1) tJobStatus("<blink>Multiple rows!"); |
|---|
| 426 | if(i>1) tJobStatus(LANG_NBR_MULTRECS); |
|---|
| 427 | |
|---|
| 428 | field=mysql_fetch_row(res); |
|---|
| 429 | sscanf(field[1],"%u",&uPreModDate); |
|---|
| 430 | if(uPreModDate!=uModDate) tJobStatus(LANG_NBR_EXTMOD); |
|---|
| 431 | Update_tJobStatus(field[0]); |
|---|
| 432 | if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql)); |
|---|
| 433 | //sprintf(query,"record %s modified",field[0]); |
|---|
| 434 | sprintf(gcQuery,LANG_NBRF_REC_MODIFIED,field[0]); |
|---|
| 435 | uModDate=luGetModDate("tJobStatus",uJobStatus); |
|---|
| 436 | unxsVZLog(uJobStatus,"tJobStatus","Mod"); |
|---|
| 437 | tJobStatus(gcQuery); |
|---|
| 438 | |
|---|
| 439 | }//ModtJobStatus(void) |
|---|
| 440 | |
|---|
| 441 | |
|---|
| 442 | void tJobStatusList(void) |
|---|
| 443 | { |
|---|
| 444 | MYSQL_RES *res; |
|---|
| 445 | MYSQL_ROW field; |
|---|
| 446 | |
|---|
| 447 | ExttJobStatusListSelect(); |
|---|
| 448 | |
|---|
| 449 | MYSQL_RUN_STORE(res); |
|---|
| 450 | guI=mysql_num_rows(res); |
|---|
| 451 | |
|---|
| 452 | PageMachine("tJobStatusList",1,"");//1 is auto header list guMode. Opens table! |
|---|
| 453 | |
|---|
| 454 | //Filter select drop down |
|---|
| 455 | ExttJobStatusListFilter(); |
|---|
| 456 | |
|---|
| 457 | printf("<input type=text size=16 name=gcCommand maxlength=98 value=\"%s\" >",gcCommand); |
|---|
| 458 | |
|---|
| 459 | printf("</table>\n"); |
|---|
| 460 | |
|---|
| 461 | printf("<table bgcolor=#9BC1B3 border=0 width=100%%>\n"); |
|---|
| 462 | printf("<tr bgcolor=black><td><font face=arial,helvetica color=white>uJobStatus<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>"); |
|---|
| 463 | |
|---|
| 464 | |
|---|
| 465 | |
|---|
| 466 | mysql_data_seek(res,guStart-1); |
|---|
| 467 | |
|---|
| 468 | for(guN=0;guN<(guEnd-guStart+1);guN++) |
|---|
| 469 | { |
|---|
| 470 | field=mysql_fetch_row(res); |
|---|
| 471 | if(!field) |
|---|
| 472 | { |
|---|
| 473 | printf("<tr><td><font face=arial,helvetica>End of data</table>"); |
|---|
| 474 | Footer_ism3(); |
|---|
| 475 | } |
|---|
| 476 | if(guN % 2) |
|---|
| 477 | printf("<tr bgcolor=#BBE1D3>"); |
|---|
| 478 | else |
|---|
| 479 | printf("<tr>"); |
|---|
| 480 | time_t luTime4=strtoul(field[4],NULL,10); |
|---|
| 481 | char cBuf4[32]; |
|---|
| 482 | if(luTime4) |
|---|
| 483 | ctime_r(&luTime4,cBuf4); |
|---|
| 484 | else |
|---|
| 485 | sprintf(cBuf4,"---"); |
|---|
| 486 | time_t luTime6=strtoul(field[6],NULL,10); |
|---|
| 487 | char cBuf6[32]; |
|---|
| 488 | if(luTime6) |
|---|
| 489 | ctime_r(&luTime6,cBuf6); |
|---|
| 490 | else |
|---|
| 491 | sprintf(cBuf6,"---"); |
|---|
| 492 | printf("<td><input type=submit name=ED%s value=Edit> %s<td>%s<td>%s<td>%s<td>%s<td>%s<td>%s</tr>" |
|---|
| 493 | ,field[0] |
|---|
| 494 | ,field[0] |
|---|
| 495 | ,field[1] |
|---|
| 496 | ,ForeignKey("tClient","cLabel",strtoul(field[2],NULL,10)) |
|---|
| 497 | ,ForeignKey("tClient","cLabel",strtoul(field[3],NULL,10)) |
|---|
| 498 | ,cBuf4 |
|---|
| 499 | ,ForeignKey("tClient","cLabel",strtoul(field[5],NULL,10)) |
|---|
| 500 | ,cBuf6 |
|---|
| 501 | ); |
|---|
| 502 | |
|---|
| 503 | } |
|---|
| 504 | |
|---|
| 505 | printf("</table></form>\n"); |
|---|
| 506 | Footer_ism3(); |
|---|
| 507 | |
|---|
| 508 | }//tJobStatusList() |
|---|
| 509 | |
|---|
| 510 | |
|---|
| 511 | void CreatetJobStatus(void) |
|---|
| 512 | { |
|---|
| 513 | sprintf(gcQuery,"CREATE TABLE IF NOT EXISTS tJobStatus ( uJobStatus 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 )"); |
|---|
| 514 | MYSQL_RUN; |
|---|
| 515 | |
|---|
| 516 | }//CreatetJobStatus() |
|---|
| 517 | |
|---|
| 518 | //perlSAR patch1 |
|---|