| 1 | /* |
|---|
| 2 | FILE |
|---|
| 3 | tLogType 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 tlogtypefunc.h while |
|---|
| 9 | RAD is still to be used. |
|---|
| 10 | */ |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | #include "mysqlrad.h" |
|---|
| 14 | |
|---|
| 15 | //Table Variables |
|---|
| 16 | //Table Variables |
|---|
| 17 | //uLogType: Primary Key |
|---|
| 18 | static unsigned uLogType=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_tLogType "tLogType.uLogType,tLogType.cLabel,tLogType.uOwner,tLogType.uCreatedBy,tLogType.uCreatedDate,tLogType.uModBy,tLogType.uModDate" |
|---|
| 36 | |
|---|
| 37 | //Local only |
|---|
| 38 | void Insert_tLogType(void); |
|---|
| 39 | void Update_tLogType(char *cRowid); |
|---|
| 40 | void ProcesstLogTypeListVars(pentry entries[], int x); |
|---|
| 41 | |
|---|
| 42 | //In tLogTypefunc.h file included below |
|---|
| 43 | void ExtProcesstLogTypeVars(pentry entries[], int x); |
|---|
| 44 | void ExttLogTypeCommands(pentry entries[], int x); |
|---|
| 45 | void ExttLogTypeButtons(void); |
|---|
| 46 | void ExttLogTypeNavBar(void); |
|---|
| 47 | void ExttLogTypeGetHook(entry gentries[], int x); |
|---|
| 48 | void ExttLogTypeSelect(void); |
|---|
| 49 | void ExttLogTypeSelectRow(void); |
|---|
| 50 | void ExttLogTypeListSelect(void); |
|---|
| 51 | void ExttLogTypeListFilter(void); |
|---|
| 52 | void ExttLogTypeAuxTable(void); |
|---|
| 53 | |
|---|
| 54 | #include "tlogtypefunc.h" |
|---|
| 55 | |
|---|
| 56 | //Table Variables Assignment Function |
|---|
| 57 | void ProcesstLogTypeVars(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,"uLogType")) |
|---|
| 65 | sscanf(entries[i].val,"%u",&uLogType); |
|---|
| 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 | ExtProcesstLogTypeVars(entries,x); |
|---|
| 83 | |
|---|
| 84 | }//ProcesstLogTypeVars() |
|---|
| 85 | |
|---|
| 86 | |
|---|
| 87 | void ProcesstLogTypeListVars(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",&uLogType); |
|---|
| 96 | guMode=2002; |
|---|
| 97 | tLogType(""); |
|---|
| 98 | } |
|---|
| 99 | } |
|---|
| 100 | }//void ProcesstLogTypeListVars(pentry entries[], int x) |
|---|
| 101 | |
|---|
| 102 | |
|---|
| 103 | int tLogTypeCommands(pentry entries[], int x) |
|---|
| 104 | { |
|---|
| 105 | ProcessControlVars(entries,x); |
|---|
| 106 | |
|---|
| 107 | ExttLogTypeCommands(entries,x); |
|---|
| 108 | |
|---|
| 109 | if(!strcmp(gcFunction,"tLogTypeTools")) |
|---|
| 110 | { |
|---|
| 111 | if(!strcmp(gcFind,LANG_NB_LIST)) |
|---|
| 112 | { |
|---|
| 113 | tLogTypeList(); |
|---|
| 114 | } |
|---|
| 115 | |
|---|
| 116 | //Default |
|---|
| 117 | ProcesstLogTypeVars(entries,x); |
|---|
| 118 | tLogType(""); |
|---|
| 119 | } |
|---|
| 120 | else if(!strcmp(gcFunction,"tLogTypeList")) |
|---|
| 121 | { |
|---|
| 122 | ProcessControlVars(entries,x); |
|---|
| 123 | ProcesstLogTypeListVars(entries,x); |
|---|
| 124 | tLogTypeList(); |
|---|
| 125 | } |
|---|
| 126 | |
|---|
| 127 | return(0); |
|---|
| 128 | |
|---|
| 129 | }//tLogTypeCommands() |
|---|
| 130 | |
|---|
| 131 | |
|---|
| 132 | void tLogType(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 | ExttLogTypeSelectRow(); |
|---|
| 143 | else |
|---|
| 144 | ExttLogTypeSelect(); |
|---|
| 145 | |
|---|
| 146 | mysql_query(&gMysql,gcQuery); |
|---|
| 147 | if(mysql_errno(&gMysql)) |
|---|
| 148 | { |
|---|
| 149 | if(strstr(mysql_error(&gMysql)," doesn't exist")) |
|---|
| 150 | { |
|---|
| 151 | CreatetLogType(); |
|---|
| 152 | unxsVZ("New tLogType 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 tLogType WHERE uLogType=%u" |
|---|
| 166 | ,uLogType); |
|---|
| 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",&uLogType); |
|---|
| 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(":: tLogType",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=tLogTypeTools>"); |
|---|
| 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 | ExttLogTypeButtons(); |
|---|
| 218 | |
|---|
| 219 | printf("</td><td valign=top>"); |
|---|
| 220 | // |
|---|
| 221 | OpenFieldSet("tLogType Record Data",100); |
|---|
| 222 | |
|---|
| 223 | if(guMode==2000 || guMode==2002) |
|---|
| 224 | tLogTypeInput(1); |
|---|
| 225 | else |
|---|
| 226 | tLogTypeInput(0); |
|---|
| 227 | |
|---|
| 228 | // |
|---|
| 229 | CloseFieldSet(); |
|---|
| 230 | |
|---|
| 231 | //Bottom table |
|---|
| 232 | printf("<tr><td colspan=2>"); |
|---|
| 233 | ExttLogTypeAuxTable(); |
|---|
| 234 | |
|---|
| 235 | Footer_ism3(); |
|---|
| 236 | |
|---|
| 237 | }//end of tLogType(); |
|---|
| 238 | |
|---|
| 239 | |
|---|
| 240 | void tLogTypeInput(unsigned uMode) |
|---|
| 241 | { |
|---|
| 242 | |
|---|
| 243 | //uLogType |
|---|
| 244 | OpenRow(LANG_FL_tLogType_uLogType,"black"); |
|---|
| 245 | printf("<input title='%s' type=text name=uLogType value=%u size=16 maxlength=10 " |
|---|
| 246 | ,LANG_FT_tLogType_uLogType,uLogType); |
|---|
| 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=uLogType value=%u >\n",uLogType); |
|---|
| 255 | } |
|---|
| 256 | //cLabel |
|---|
| 257 | OpenRow(LANG_FL_tLogType_cLabel,"black"); |
|---|
| 258 | printf("<input title='%s' type=text name=cLabel value=\"%s\" size=40 maxlength=32 " |
|---|
| 259 | ,LANG_FT_tLogType_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_tLogType_uOwner,"black"); |
|---|
| 271 | if(guPermLevel>=20 && 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_tLogType_uCreatedBy,"black"); |
|---|
| 281 | if(guPermLevel>=20 && 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_tLogType_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_tLogType_uModBy,"black"); |
|---|
| 298 | if(guPermLevel>=20 && 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_tLogType_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 tLogTypeInput(unsigned uMode) |
|---|
| 318 | |
|---|
| 319 | |
|---|
| 320 | void NewtLogType(unsigned uMode) |
|---|
| 321 | { |
|---|
| 322 | register int i=0; |
|---|
| 323 | MYSQL_RES *res; |
|---|
| 324 | |
|---|
| 325 | sprintf(gcQuery,"SELECT uLogType FROM tLogType\ |
|---|
| 326 | WHERE uLogType=%u" |
|---|
| 327 | ,uLogType); |
|---|
| 328 | MYSQL_RUN_STORE(res); |
|---|
| 329 | i=mysql_num_rows(res); |
|---|
| 330 | |
|---|
| 331 | if(i) |
|---|
| 332 | //tLogType("<blink>Record already exists"); |
|---|
| 333 | tLogType(LANG_NBR_RECEXISTS); |
|---|
| 334 | |
|---|
| 335 | //insert query |
|---|
| 336 | Insert_tLogType(); |
|---|
| 337 | if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql)); |
|---|
| 338 | //sprintf(gcQuery,"New record %u added"); |
|---|
| 339 | uLogType=mysql_insert_id(&gMysql); |
|---|
| 340 | #ifdef ISM3FIELDS |
|---|
| 341 | uCreatedDate=luGetCreatedDate("tLogType",uLogType); |
|---|
| 342 | unxsVZLog(uLogType,"tLogType","New"); |
|---|
| 343 | #endif |
|---|
| 344 | |
|---|
| 345 | if(!uMode) |
|---|
| 346 | { |
|---|
| 347 | sprintf(gcQuery,LANG_NBR_NEWRECADDED,uLogType); |
|---|
| 348 | tLogType(gcQuery); |
|---|
| 349 | } |
|---|
| 350 | |
|---|
| 351 | }//NewtLogType(unsigned uMode) |
|---|
| 352 | |
|---|
| 353 | |
|---|
| 354 | void DeletetLogType(void) |
|---|
| 355 | { |
|---|
| 356 | #ifdef ISM3FIELDS |
|---|
| 357 | sprintf(gcQuery,"DELETE FROM tLogType WHERE uLogType=%u AND ( uOwner=%u OR %u>9 )" |
|---|
| 358 | ,uLogType,guLoginClient,guPermLevel); |
|---|
| 359 | #else |
|---|
| 360 | sprintf(gcQuery,"DELETE FROM tLogType WHERE uLogType=%u" |
|---|
| 361 | ,uLogType); |
|---|
| 362 | #endif |
|---|
| 363 | MYSQL_RUN; |
|---|
| 364 | //tLogType("Record Deleted"); |
|---|
| 365 | if(mysql_affected_rows(&gMysql)>0) |
|---|
| 366 | { |
|---|
| 367 | #ifdef ISM3FIELDS |
|---|
| 368 | unxsVZLog(uLogType,"tLogType","Del"); |
|---|
| 369 | #endif |
|---|
| 370 | tLogType(LANG_NBR_RECDELETED); |
|---|
| 371 | } |
|---|
| 372 | else |
|---|
| 373 | { |
|---|
| 374 | #ifdef ISM3FIELDS |
|---|
| 375 | unxsVZLog(uLogType,"tLogType","DelError"); |
|---|
| 376 | #endif |
|---|
| 377 | tLogType(LANG_NBR_RECNOTDELETED); |
|---|
| 378 | } |
|---|
| 379 | |
|---|
| 380 | }//void DeletetLogType(void) |
|---|
| 381 | |
|---|
| 382 | |
|---|
| 383 | void Insert_tLogType(void) |
|---|
| 384 | { |
|---|
| 385 | |
|---|
| 386 | //insert query |
|---|
| 387 | sprintf(gcQuery,"INSERT INTO tLogType SET uLogType=%u,cLabel='%s',uOwner=%u,uCreatedBy=%u,uCreatedDate=UNIX_TIMESTAMP(NOW())", |
|---|
| 388 | uLogType |
|---|
| 389 | ,TextAreaSave(cLabel) |
|---|
| 390 | ,uOwner |
|---|
| 391 | ,uCreatedBy |
|---|
| 392 | ); |
|---|
| 393 | |
|---|
| 394 | MYSQL_RUN; |
|---|
| 395 | |
|---|
| 396 | }//void Insert_tLogType(void) |
|---|
| 397 | |
|---|
| 398 | |
|---|
| 399 | void Update_tLogType(char *cRowid) |
|---|
| 400 | { |
|---|
| 401 | |
|---|
| 402 | //update query |
|---|
| 403 | sprintf(gcQuery,"UPDATE tLogType SET uLogType=%u,cLabel='%s',uModBy=%u,uModDate=UNIX_TIMESTAMP(NOW()) WHERE _rowid=%s", |
|---|
| 404 | uLogType |
|---|
| 405 | ,TextAreaSave(cLabel) |
|---|
| 406 | ,uModBy |
|---|
| 407 | ,cRowid); |
|---|
| 408 | |
|---|
| 409 | MYSQL_RUN; |
|---|
| 410 | |
|---|
| 411 | }//void Update_tLogType(void) |
|---|
| 412 | |
|---|
| 413 | |
|---|
| 414 | void ModtLogType(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 tLogType.uLogType,\ |
|---|
| 425 | tLogType.uModDate\ |
|---|
| 426 | FROM tLogType,tClient\ |
|---|
| 427 | WHERE tLogType.uLogType=%u\ |
|---|
| 428 | AND tLogType.uOwner=tClient.uClient\ |
|---|
| 429 | AND (tClient.uOwner=%u OR tClient.uClient=%u)" |
|---|
| 430 | ,uLogType,guLoginClient,guLoginClient); |
|---|
| 431 | else |
|---|
| 432 | sprintf(gcQuery,"SELECT uLogType,uModDate FROM tLogType\ |
|---|
| 433 | WHERE uLogType=%u" |
|---|
| 434 | ,uLogType); |
|---|
| 435 | #else |
|---|
| 436 | sprintf(gcQuery,"SELECT uLogType FROM tLogType\ |
|---|
| 437 | WHERE uLogType=%u" |
|---|
| 438 | ,uLogType); |
|---|
| 439 | #endif |
|---|
| 440 | |
|---|
| 441 | MYSQL_RUN_STORE(res); |
|---|
| 442 | i=mysql_num_rows(res); |
|---|
| 443 | |
|---|
| 444 | //if(i<1) tLogType("<blink>Record does not exist"); |
|---|
| 445 | if(i<1) tLogType(LANG_NBR_RECNOTEXIST); |
|---|
| 446 | //if(i>1) tLogType("<blink>Multiple rows!"); |
|---|
| 447 | if(i>1) tLogType(LANG_NBR_MULTRECS); |
|---|
| 448 | |
|---|
| 449 | field=mysql_fetch_row(res); |
|---|
| 450 | #ifdef ISM3FIELDS |
|---|
| 451 | sscanf(field[1],"%u",&uPreModDate); |
|---|
| 452 | if(uPreModDate!=uModDate) tLogType(LANG_NBR_EXTMOD); |
|---|
| 453 | #endif |
|---|
| 454 | |
|---|
| 455 | Update_tLogType(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("tLogType",uLogType); |
|---|
| 461 | unxsVZLog(uLogType,"tLogType","Mod"); |
|---|
| 462 | #endif |
|---|
| 463 | tLogType(gcQuery); |
|---|
| 464 | |
|---|
| 465 | }//ModtLogType(void) |
|---|
| 466 | |
|---|
| 467 | |
|---|
| 468 | void tLogTypeList(void) |
|---|
| 469 | { |
|---|
| 470 | MYSQL_RES *res; |
|---|
| 471 | MYSQL_ROW field; |
|---|
| 472 | |
|---|
| 473 | ExttLogTypeListSelect(); |
|---|
| 474 | |
|---|
| 475 | MYSQL_RUN_STORE(res); |
|---|
| 476 | guI=mysql_num_rows(res); |
|---|
| 477 | |
|---|
| 478 | PageMachine("tLogTypeList",1,"");//1 is auto header list guMode. Opens table! |
|---|
| 479 | |
|---|
| 480 | //Filter select drop down |
|---|
| 481 | ExttLogTypeListFilter(); |
|---|
| 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>uLogType<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 | }//tLogTypeList() |
|---|
| 535 | |
|---|
| 536 | |
|---|
| 537 | void CreatetLogType(void) |
|---|
| 538 | { |
|---|
| 539 | sprintf(gcQuery,"CREATE TABLE IF NOT EXISTS tLogType ( uModDate INT UNSIGNED NOT NULL DEFAULT 0, uModBy INT UNSIGNED NOT NULL DEFAULT 0, uOwner INT UNSIGNED NOT NULL DEFAULT 0,index (uOwner), uCreatedBy INT UNSIGNED NOT NULL DEFAULT 0, uCreatedDate INT UNSIGNED NOT NULL DEFAULT 0, uLogType INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, cLabel VARCHAR(32) NOT NULL DEFAULT '' )"); |
|---|
| 540 | MYSQL_RUN; |
|---|
| 541 | |
|---|
| 542 | }//CreatetLogType() |
|---|
| 543 | |
|---|