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