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