| 1 | /* |
|---|
| 2 | FILE |
|---|
| 3 | tSearchdomain 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 tsearchdomainfunc.h while |
|---|
| 9 | RAD is still to be used. |
|---|
| 10 | AUTHOR/LEGAL |
|---|
| 11 | (C) 2001-2010 Gary Wallis for Unixservice, LLC. |
|---|
| 12 | GPLv2 license applies. See LICENSE file included. |
|---|
| 13 | */ |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | #include "mysqlrad.h" |
|---|
| 17 | |
|---|
| 18 | //Table Variables |
|---|
| 19 | //Table Variables |
|---|
| 20 | //uSearchdomain: Primary Key |
|---|
| 21 | static unsigned uSearchdomain=0; |
|---|
| 22 | //cLabel: Short label |
|---|
| 23 | static char cLabel[33]={""}; |
|---|
| 24 | //uOwner: Record owner |
|---|
| 25 | static unsigned uOwner=0; |
|---|
| 26 | //uCreatedBy: uClient for last insert |
|---|
| 27 | static unsigned uCreatedBy=0; |
|---|
| 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 | #define VAR_LIST_tSearchdomain "tSearchdomain.uSearchdomain,tSearchdomain.cLabel,tSearchdomain.uOwner,tSearchdomain.uCreatedBy,tSearchdomain.uCreatedDate,tSearchdomain.uModBy,tSearchdomain.uModDate" |
|---|
| 36 | |
|---|
| 37 | //Local only |
|---|
| 38 | void Insert_tSearchdomain(void); |
|---|
| 39 | void Update_tSearchdomain(char *cRowid); |
|---|
| 40 | void ProcesstSearchdomainListVars(pentry entries[], int x); |
|---|
| 41 | |
|---|
| 42 | //In tSearchdomainfunc.h file included below |
|---|
| 43 | void ExtProcesstSearchdomainVars(pentry entries[], int x); |
|---|
| 44 | void ExttSearchdomainCommands(pentry entries[], int x); |
|---|
| 45 | void ExttSearchdomainButtons(void); |
|---|
| 46 | void ExttSearchdomainNavBar(void); |
|---|
| 47 | void ExttSearchdomainGetHook(entry gentries[], int x); |
|---|
| 48 | void ExttSearchdomainSelect(void); |
|---|
| 49 | void ExttSearchdomainSelectRow(void); |
|---|
| 50 | void ExttSearchdomainListSelect(void); |
|---|
| 51 | void ExttSearchdomainListFilter(void); |
|---|
| 52 | void ExttSearchdomainAuxTable(void); |
|---|
| 53 | |
|---|
| 54 | #include "tsearchdomainfunc.h" |
|---|
| 55 | |
|---|
| 56 | //Table Variables Assignment Function |
|---|
| 57 | void ProcesstSearchdomainVars(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,"uSearchdomain")) |
|---|
| 65 | sscanf(entries[i].val,"%u",&uSearchdomain); |
|---|
| 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 | //After so we can overwrite form data if needed. |
|---|
| 81 | ExtProcesstSearchdomainVars(entries,x); |
|---|
| 82 | |
|---|
| 83 | }//ProcesstSearchdomainVars() |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | void ProcesstSearchdomainListVars(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",&uSearchdomain); |
|---|
| 95 | guMode=2002; |
|---|
| 96 | tSearchdomain(""); |
|---|
| 97 | } |
|---|
| 98 | } |
|---|
| 99 | }//void ProcesstSearchdomainListVars(pentry entries[], int x) |
|---|
| 100 | |
|---|
| 101 | |
|---|
| 102 | int tSearchdomainCommands(pentry entries[], int x) |
|---|
| 103 | { |
|---|
| 104 | ProcessControlVars(entries,x); |
|---|
| 105 | |
|---|
| 106 | ExttSearchdomainCommands(entries,x); |
|---|
| 107 | |
|---|
| 108 | if(!strcmp(gcFunction,"tSearchdomainTools")) |
|---|
| 109 | { |
|---|
| 110 | if(!strcmp(gcFind,LANG_NB_LIST)) |
|---|
| 111 | { |
|---|
| 112 | tSearchdomainList(); |
|---|
| 113 | } |
|---|
| 114 | |
|---|
| 115 | //Default |
|---|
| 116 | ProcesstSearchdomainVars(entries,x); |
|---|
| 117 | tSearchdomain(""); |
|---|
| 118 | } |
|---|
| 119 | else if(!strcmp(gcFunction,"tSearchdomainList")) |
|---|
| 120 | { |
|---|
| 121 | ProcessControlVars(entries,x); |
|---|
| 122 | ProcesstSearchdomainListVars(entries,x); |
|---|
| 123 | tSearchdomainList(); |
|---|
| 124 | } |
|---|
| 125 | |
|---|
| 126 | return(0); |
|---|
| 127 | |
|---|
| 128 | }//tSearchdomainCommands() |
|---|
| 129 | |
|---|
| 130 | |
|---|
| 131 | void tSearchdomain(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 | ExttSearchdomainSelectRow(); |
|---|
| 142 | else |
|---|
| 143 | ExttSearchdomainSelect(); |
|---|
| 144 | |
|---|
| 145 | mysql_query(&gMysql,gcQuery); |
|---|
| 146 | if(mysql_errno(&gMysql)) |
|---|
| 147 | { |
|---|
| 148 | if(strstr(mysql_error(&gMysql)," doesn't exist")) |
|---|
| 149 | { |
|---|
| 150 | CreatetSearchdomain(); |
|---|
| 151 | unxsVZ("New tSearchdomain 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 tSearchdomain WHERE uSearchdomain=%u" |
|---|
| 165 | ,uSearchdomain); |
|---|
| 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",&uSearchdomain); |
|---|
| 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(":: Container Resolver Searchdomain",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=tSearchdomainTools>"); |
|---|
| 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 | ExttSearchdomainButtons(); |
|---|
| 216 | |
|---|
| 217 | printf("</td><td valign=top>"); |
|---|
| 218 | // |
|---|
| 219 | OpenFieldSet("tSearchdomain Record Data",100); |
|---|
| 220 | |
|---|
| 221 | if(guMode==2000 || guMode==2002) |
|---|
| 222 | tSearchdomainInput(1); |
|---|
| 223 | else |
|---|
| 224 | tSearchdomainInput(0); |
|---|
| 225 | |
|---|
| 226 | // |
|---|
| 227 | CloseFieldSet(); |
|---|
| 228 | |
|---|
| 229 | //Bottom table |
|---|
| 230 | printf("<tr><td colspan=2>"); |
|---|
| 231 | ExttSearchdomainAuxTable(); |
|---|
| 232 | |
|---|
| 233 | Footer_ism3(); |
|---|
| 234 | |
|---|
| 235 | }//end of tSearchdomain(); |
|---|
| 236 | |
|---|
| 237 | |
|---|
| 238 | void tSearchdomainInput(unsigned uMode) |
|---|
| 239 | { |
|---|
| 240 | |
|---|
| 241 | //uSearchdomain |
|---|
| 242 | OpenRow(LANG_FL_tSearchdomain_uSearchdomain,"black"); |
|---|
| 243 | printf("<input title='%s' type=text name=uSearchdomain value=%u size=16 maxlength=10 " |
|---|
| 244 | ,LANG_FT_tSearchdomain_uSearchdomain,uSearchdomain); |
|---|
| 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=uSearchdomain value=%u >\n",uSearchdomain); |
|---|
| 253 | } |
|---|
| 254 | //cLabel |
|---|
| 255 | OpenRow(LANG_FL_tSearchdomain_cLabel,"black"); |
|---|
| 256 | printf("<input title='%s' type=text name=cLabel value=\"%s\" size=40 maxlength=32 " |
|---|
| 257 | ,LANG_FT_tSearchdomain_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_tSearchdomain_uOwner,"black"); |
|---|
| 269 | if(guPermLevel>=20 && 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_tSearchdomain_uCreatedBy,"black"); |
|---|
| 279 | if(guPermLevel>=20 && 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_tSearchdomain_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_tSearchdomain_uModBy,"black"); |
|---|
| 296 | if(guPermLevel>=20 && 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_tSearchdomain_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 tSearchdomainInput(unsigned uMode) |
|---|
| 316 | |
|---|
| 317 | |
|---|
| 318 | void NewtSearchdomain(unsigned uMode) |
|---|
| 319 | { |
|---|
| 320 | register int i=0; |
|---|
| 321 | MYSQL_RES *res; |
|---|
| 322 | |
|---|
| 323 | sprintf(gcQuery,"SELECT uSearchdomain FROM tSearchdomain\ |
|---|
| 324 | WHERE uSearchdomain=%u" |
|---|
| 325 | ,uSearchdomain); |
|---|
| 326 | MYSQL_RUN_STORE(res); |
|---|
| 327 | i=mysql_num_rows(res); |
|---|
| 328 | |
|---|
| 329 | if(i) |
|---|
| 330 | //tSearchdomain("<blink>Record already exists"); |
|---|
| 331 | tSearchdomain(LANG_NBR_RECEXISTS); |
|---|
| 332 | |
|---|
| 333 | //insert query |
|---|
| 334 | Insert_tSearchdomain(); |
|---|
| 335 | if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql)); |
|---|
| 336 | //sprintf(gcQuery,"New record %u added"); |
|---|
| 337 | uSearchdomain=mysql_insert_id(&gMysql); |
|---|
| 338 | uCreatedDate=luGetCreatedDate("tSearchdomain",uSearchdomain); |
|---|
| 339 | unxsVZLog(uSearchdomain,"tSearchdomain","New"); |
|---|
| 340 | |
|---|
| 341 | if(!uMode) |
|---|
| 342 | { |
|---|
| 343 | sprintf(gcQuery,LANG_NBR_NEWRECADDED,uSearchdomain); |
|---|
| 344 | tSearchdomain(gcQuery); |
|---|
| 345 | } |
|---|
| 346 | |
|---|
| 347 | }//NewtSearchdomain(unsigned uMode) |
|---|
| 348 | |
|---|
| 349 | |
|---|
| 350 | void DeletetSearchdomain(void) |
|---|
| 351 | { |
|---|
| 352 | sprintf(gcQuery,"DELETE FROM tSearchdomain WHERE uSearchdomain=%u AND ( uOwner=%u OR %u>9 )" |
|---|
| 353 | ,uSearchdomain,guLoginClient,guPermLevel); |
|---|
| 354 | MYSQL_RUN; |
|---|
| 355 | //tSearchdomain("Record Deleted"); |
|---|
| 356 | if(mysql_affected_rows(&gMysql)>0) |
|---|
| 357 | { |
|---|
| 358 | unxsVZLog(uSearchdomain,"tSearchdomain","Del"); |
|---|
| 359 | tSearchdomain(LANG_NBR_RECDELETED); |
|---|
| 360 | } |
|---|
| 361 | else |
|---|
| 362 | { |
|---|
| 363 | unxsVZLog(uSearchdomain,"tSearchdomain","DelError"); |
|---|
| 364 | tSearchdomain(LANG_NBR_RECNOTDELETED); |
|---|
| 365 | } |
|---|
| 366 | |
|---|
| 367 | }//void DeletetSearchdomain(void) |
|---|
| 368 | |
|---|
| 369 | |
|---|
| 370 | void Insert_tSearchdomain(void) |
|---|
| 371 | { |
|---|
| 372 | sprintf(gcQuery,"INSERT INTO tSearchdomain SET uSearchdomain=%u,cLabel='%s',uOwner=%u,uCreatedBy=%u," |
|---|
| 373 | "uCreatedDate=UNIX_TIMESTAMP(NOW())", |
|---|
| 374 | uSearchdomain |
|---|
| 375 | ,TextAreaSave(cLabel) |
|---|
| 376 | ,uOwner |
|---|
| 377 | ,uCreatedBy); |
|---|
| 378 | MYSQL_RUN; |
|---|
| 379 | |
|---|
| 380 | }//void Insert_tSearchdomain(void) |
|---|
| 381 | |
|---|
| 382 | |
|---|
| 383 | void Update_tSearchdomain(char *cRowid) |
|---|
| 384 | { |
|---|
| 385 | sprintf(gcQuery,"UPDATE tSearchdomain SET uSearchdomain=%u,cLabel='%s',uModBy=%u," |
|---|
| 386 | "uModDate=UNIX_TIMESTAMP(NOW()) WHERE _rowid=%s", |
|---|
| 387 | uSearchdomain |
|---|
| 388 | ,TextAreaSave(cLabel) |
|---|
| 389 | ,uModBy |
|---|
| 390 | ,cRowid); |
|---|
| 391 | MYSQL_RUN; |
|---|
| 392 | |
|---|
| 393 | }//void Update_tSearchdomain(void) |
|---|
| 394 | |
|---|
| 395 | |
|---|
| 396 | void ModtSearchdomain(void) |
|---|
| 397 | { |
|---|
| 398 | register int i=0; |
|---|
| 399 | MYSQL_RES *res; |
|---|
| 400 | MYSQL_ROW field; |
|---|
| 401 | unsigned uPreModDate=0; |
|---|
| 402 | |
|---|
| 403 | //Mod select gcQuery |
|---|
| 404 | if(guPermLevel<10) |
|---|
| 405 | sprintf(gcQuery,"SELECT tSearchdomain.uSearchdomain," |
|---|
| 406 | "tSearchdomain.uModDate" |
|---|
| 407 | "FROM tSearchdomain,tClient" |
|---|
| 408 | "WHERE tSearchdomain.uSearchdomain=%u" |
|---|
| 409 | "AND tSearchdomain.uOwner=tClient.uClient" |
|---|
| 410 | "AND (tClient.uOwner=%u OR tClient.uClient=%u)" |
|---|
| 411 | ,uSearchdomain,guLoginClient,guLoginClient); |
|---|
| 412 | else |
|---|
| 413 | sprintf(gcQuery,"SELECT uSearchdomain,uModDate FROM tSearchdomain WHERE uSearchdomain=%u" |
|---|
| 414 | ,uSearchdomain); |
|---|
| 415 | |
|---|
| 416 | MYSQL_RUN_STORE(res); |
|---|
| 417 | i=mysql_num_rows(res); |
|---|
| 418 | |
|---|
| 419 | //if(i<1) tSearchdomain("<blink>Record does not exist"); |
|---|
| 420 | if(i<1) tSearchdomain(LANG_NBR_RECNOTEXIST); |
|---|
| 421 | //if(i>1) tSearchdomain("<blink>Multiple rows!"); |
|---|
| 422 | if(i>1) tSearchdomain(LANG_NBR_MULTRECS); |
|---|
| 423 | |
|---|
| 424 | field=mysql_fetch_row(res); |
|---|
| 425 | sscanf(field[1],"%u",&uPreModDate); |
|---|
| 426 | if(uPreModDate!=uModDate) tSearchdomain(LANG_NBR_EXTMOD); |
|---|
| 427 | |
|---|
| 428 | Update_tSearchdomain(field[0]); |
|---|
| 429 | if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql)); |
|---|
| 430 | //sprintf(query,"record %s modified",field[0]); |
|---|
| 431 | sprintf(gcQuery,LANG_NBRF_REC_MODIFIED,field[0]); |
|---|
| 432 | uModDate=luGetModDate("tSearchdomain",uSearchdomain); |
|---|
| 433 | unxsVZLog(uSearchdomain,"tSearchdomain","Mod"); |
|---|
| 434 | tSearchdomain(gcQuery); |
|---|
| 435 | |
|---|
| 436 | }//ModtSearchdomain(void) |
|---|
| 437 | |
|---|
| 438 | |
|---|
| 439 | void tSearchdomainList(void) |
|---|
| 440 | { |
|---|
| 441 | MYSQL_RES *res; |
|---|
| 442 | MYSQL_ROW field; |
|---|
| 443 | |
|---|
| 444 | ExttSearchdomainListSelect(); |
|---|
| 445 | |
|---|
| 446 | MYSQL_RUN_STORE(res); |
|---|
| 447 | guI=mysql_num_rows(res); |
|---|
| 448 | |
|---|
| 449 | PageMachine("tSearchdomainList",1,"");//1 is auto header list guMode. Opens table! |
|---|
| 450 | |
|---|
| 451 | //Filter select drop down |
|---|
| 452 | ExttSearchdomainListFilter(); |
|---|
| 453 | |
|---|
| 454 | printf("<input type=text size=16 name=gcCommand maxlength=98 value=\"%s\" >",gcCommand); |
|---|
| 455 | |
|---|
| 456 | printf("</table>\n"); |
|---|
| 457 | |
|---|
| 458 | printf("<table bgcolor=#9BC1B3 border=0 width=100%%>\n"); |
|---|
| 459 | printf("<tr bgcolor=black>" |
|---|
| 460 | "<td><font face=arial,helvetica color=white>uSearchdomain" |
|---|
| 461 | "<td><font face=arial,helvetica color=white>cLabel" |
|---|
| 462 | "<td><font face=arial,helvetica color=white>uOwner" |
|---|
| 463 | "<td><font face=arial,helvetica color=white>uCreatedBy" |
|---|
| 464 | "<td><font face=arial,helvetica color=white>uCreatedDate" |
|---|
| 465 | "<td><font face=arial,helvetica color=white>uModBy" |
|---|
| 466 | "<td><font face=arial,helvetica color=white>uModDate</tr>"); |
|---|
| 467 | |
|---|
| 468 | mysql_data_seek(res,guStart-1); |
|---|
| 469 | |
|---|
| 470 | for(guN=0;guN<(guEnd-guStart+1);guN++) |
|---|
| 471 | { |
|---|
| 472 | field=mysql_fetch_row(res); |
|---|
| 473 | if(!field) |
|---|
| 474 | { |
|---|
| 475 | printf("<tr><td><font face=arial,helvetica>End of data</table>"); |
|---|
| 476 | Footer_ism3(); |
|---|
| 477 | } |
|---|
| 478 | if(guN % 2) |
|---|
| 479 | printf("<tr bgcolor=#BBE1D3>"); |
|---|
| 480 | else |
|---|
| 481 | printf("<tr>"); |
|---|
| 482 | time_t luTime4=strtoul(field[4],NULL,10); |
|---|
| 483 | char cBuf4[32]; |
|---|
| 484 | if(luTime4) |
|---|
| 485 | ctime_r(&luTime4,cBuf4); |
|---|
| 486 | else |
|---|
| 487 | sprintf(cBuf4,"---"); |
|---|
| 488 | time_t luTime6=strtoul(field[6],NULL,10); |
|---|
| 489 | char cBuf6[32]; |
|---|
| 490 | if(luTime6) |
|---|
| 491 | ctime_r(&luTime6,cBuf6); |
|---|
| 492 | else |
|---|
| 493 | sprintf(cBuf6,"---"); |
|---|
| 494 | printf("<td><input type=submit name=ED%s value=Edit> %s<td>%s<td>%s<td>%s<td>%s<td>%s<td>%s</tr>" |
|---|
| 495 | ,field[0] |
|---|
| 496 | ,field[0] |
|---|
| 497 | ,field[1] |
|---|
| 498 | ,ForeignKey("tClient","cLabel",strtoul(field[2],NULL,10)) |
|---|
| 499 | ,ForeignKey("tClient","cLabel",strtoul(field[3],NULL,10)) |
|---|
| 500 | ,cBuf4 |
|---|
| 501 | ,ForeignKey("tClient","cLabel",strtoul(field[5],NULL,10)) |
|---|
| 502 | ,cBuf6); |
|---|
| 503 | |
|---|
| 504 | } |
|---|
| 505 | |
|---|
| 506 | printf("</table></form>\n"); |
|---|
| 507 | Footer_ism3(); |
|---|
| 508 | |
|---|
| 509 | }//tSearchdomainList() |
|---|
| 510 | |
|---|
| 511 | |
|---|
| 512 | void CreatetSearchdomain(void) |
|---|
| 513 | { |
|---|
| 514 | sprintf(gcQuery,"CREATE TABLE IF NOT EXISTS tSearchdomain ( " |
|---|
| 515 | "uSearchdomain INT UNSIGNED PRIMARY KEY AUTO_INCREMENT," |
|---|
| 516 | "cLabel VARCHAR(32) NOT NULL DEFAULT ''," |
|---|
| 517 | "uOwner INT UNSIGNED NOT NULL DEFAULT 0, INDEX (uOwner)," |
|---|
| 518 | "uCreatedBy INT UNSIGNED NOT NULL DEFAULT 0," |
|---|
| 519 | "uCreatedDate INT UNSIGNED NOT NULL DEFAULT 0," |
|---|
| 520 | "uModBy INT UNSIGNED NOT NULL DEFAULT 0," |
|---|
| 521 | "uModDate INT UNSIGNED NOT NULL DEFAULT 0," |
|---|
| 522 | "uDatacenter INT UNSIGNED NOT NULL DEFAULT 0 )"); |
|---|
| 523 | mysql_query(&gMysql,gcQuery); |
|---|
| 524 | if(mysql_errno(&gMysql)) |
|---|
| 525 | htmlPlainTextError(mysql_error(&gMysql)); |
|---|
| 526 | }//CreatetSearchdomain() |
|---|
| 527 | |
|---|