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