| 1 | /* |
|---|
| 2 | FILE |
|---|
| 3 | $Id$ |
|---|
| 4 | (Built initially by unixservice.com mysqlRAD2) |
|---|
| 5 | PURPOSE |
|---|
| 6 | Non schema-dependent table and application table related functions. |
|---|
| 7 | AUTHOR |
|---|
| 8 | (C) 2001-2007 Gary Wallis. |
|---|
| 9 | |
|---|
| 10 | */ |
|---|
| 11 | |
|---|
| 12 | //ModuleFunctionProtos() |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | void tGlossaryNavList(void); |
|---|
| 16 | |
|---|
| 17 | void ExtProcesstGlossaryVars(pentry entries[], int x) |
|---|
| 18 | { |
|---|
| 19 | /* |
|---|
| 20 | register int i; |
|---|
| 21 | for(i=0;i<x;i++) |
|---|
| 22 | { |
|---|
| 23 | } |
|---|
| 24 | */ |
|---|
| 25 | }//void ExtProcesstGlossaryVars(pentry entries[], int x) |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | void ExttGlossaryCommands(pentry entries[], int x) |
|---|
| 29 | { |
|---|
| 30 | |
|---|
| 31 | if(!strcmp(gcFunction,"tGlossaryTools")) |
|---|
| 32 | { |
|---|
| 33 | //ModuleFunctionProcess() |
|---|
| 34 | |
|---|
| 35 | if(!strcmp(gcCommand,LANG_NB_NEW)) |
|---|
| 36 | { |
|---|
| 37 | if(guPermLevel>=10) |
|---|
| 38 | { |
|---|
| 39 | ProcesstGlossaryVars(entries,x); |
|---|
| 40 | guMode=2000; |
|---|
| 41 | tGlossary(LANG_NB_CONFIRMNEW); |
|---|
| 42 | } |
|---|
| 43 | } |
|---|
| 44 | else if(!strcmp(gcCommand,LANG_NB_CONFIRMNEW)) |
|---|
| 45 | { |
|---|
| 46 | if(guPermLevel>=10) |
|---|
| 47 | { |
|---|
| 48 | ProcesstGlossaryVars(entries,x); |
|---|
| 49 | |
|---|
| 50 | guMode=2000; |
|---|
| 51 | //Check entries here |
|---|
| 52 | guMode=0; |
|---|
| 53 | |
|---|
| 54 | uGlossary=0; |
|---|
| 55 | uCreatedBy=guLoginClient; |
|---|
| 56 | uOwner=guCompany; |
|---|
| 57 | uModBy=0;//Never modified |
|---|
| 58 | uModDate=0;//Never modified |
|---|
| 59 | NewtGlossary(0); |
|---|
| 60 | } |
|---|
| 61 | } |
|---|
| 62 | else if(!strcmp(gcCommand,LANG_NB_DELETE)) |
|---|
| 63 | { |
|---|
| 64 | ProcesstGlossaryVars(entries,x); |
|---|
| 65 | if(uAllowDel(uOwner,uCreatedBy)) |
|---|
| 66 | { |
|---|
| 67 | guMode=2001; |
|---|
| 68 | tGlossary(LANG_NB_CONFIRMDEL); |
|---|
| 69 | } |
|---|
| 70 | } |
|---|
| 71 | else if(!strcmp(gcCommand,LANG_NB_CONFIRMDEL)) |
|---|
| 72 | { |
|---|
| 73 | ProcesstGlossaryVars(entries,x); |
|---|
| 74 | if(uAllowDel(uOwner,uCreatedBy)) |
|---|
| 75 | { |
|---|
| 76 | guMode=5; |
|---|
| 77 | DeletetGlossary(); |
|---|
| 78 | } |
|---|
| 79 | } |
|---|
| 80 | else if(!strcmp(gcCommand,LANG_NB_MODIFY)) |
|---|
| 81 | { |
|---|
| 82 | ProcesstGlossaryVars(entries,x); |
|---|
| 83 | if(uAllowMod(uOwner,uCreatedBy)) |
|---|
| 84 | { |
|---|
| 85 | guMode=2002; |
|---|
| 86 | tGlossary(LANG_NB_CONFIRMMOD); |
|---|
| 87 | } |
|---|
| 88 | } |
|---|
| 89 | else if(!strcmp(gcCommand,LANG_NB_CONFIRMMOD)) |
|---|
| 90 | { |
|---|
| 91 | ProcesstGlossaryVars(entries,x); |
|---|
| 92 | if(uAllowMod(uOwner,uCreatedBy)) |
|---|
| 93 | { |
|---|
| 94 | guMode=2002; |
|---|
| 95 | //Check entries here |
|---|
| 96 | guMode=0; |
|---|
| 97 | |
|---|
| 98 | uModBy=guLoginClient; |
|---|
| 99 | ModtGlossary(); |
|---|
| 100 | } |
|---|
| 101 | } |
|---|
| 102 | } |
|---|
| 103 | |
|---|
| 104 | }//void ExttGlossaryCommands(pentry entries[], int x) |
|---|
| 105 | |
|---|
| 106 | |
|---|
| 107 | void ExttGlossaryButtons(void) |
|---|
| 108 | { |
|---|
| 109 | OpenFieldSet("tGlossary Aux Panel",100); |
|---|
| 110 | switch(guMode) |
|---|
| 111 | { |
|---|
| 112 | case 2000: |
|---|
| 113 | printf("<p><u>Enter/mod data</u><br>"); |
|---|
| 114 | printf(LANG_NBB_CONFIRMNEW); |
|---|
| 115 | break; |
|---|
| 116 | |
|---|
| 117 | case 2001: |
|---|
| 118 | printf("<p><u>Think twice</u><br>"); |
|---|
| 119 | printf(LANG_NBB_CONFIRMDEL); |
|---|
| 120 | break; |
|---|
| 121 | |
|---|
| 122 | case 2002: |
|---|
| 123 | printf("<p><u>Review changes</u><br>"); |
|---|
| 124 | printf(LANG_NBB_CONFIRMMOD); |
|---|
| 125 | break; |
|---|
| 126 | |
|---|
| 127 | default: |
|---|
| 128 | |
|---|
| 129 | tGlossaryNavList(); |
|---|
| 130 | } |
|---|
| 131 | CloseFieldSet(); |
|---|
| 132 | |
|---|
| 133 | }//void ExttGlossaryButtons(void) |
|---|
| 134 | |
|---|
| 135 | |
|---|
| 136 | void ExttGlossaryAuxTable(void) |
|---|
| 137 | { |
|---|
| 138 | |
|---|
| 139 | }//void ExttGlossaryAuxTable(void) |
|---|
| 140 | |
|---|
| 141 | |
|---|
| 142 | void ExttGlossaryGetHook(entry gentries[], int x) |
|---|
| 143 | { |
|---|
| 144 | register int i; |
|---|
| 145 | |
|---|
| 146 | for(i=0;i<x;i++) |
|---|
| 147 | { |
|---|
| 148 | if(!strcmp(gentries[i].name,"uGlossary")) |
|---|
| 149 | { |
|---|
| 150 | sscanf(gentries[i].val,"%u",&uGlossary); |
|---|
| 151 | guMode=6; |
|---|
| 152 | } |
|---|
| 153 | } |
|---|
| 154 | tGlossary(""); |
|---|
| 155 | |
|---|
| 156 | }//void ExttGlossaryGetHook(entry gentries[], int x) |
|---|
| 157 | |
|---|
| 158 | |
|---|
| 159 | void ExttGlossarySelect(void) |
|---|
| 160 | { |
|---|
| 161 | ExtSelect("tGlossary",VAR_LIST_tGlossary); |
|---|
| 162 | |
|---|
| 163 | }//void ExttGlossarySelect(void) |
|---|
| 164 | |
|---|
| 165 | |
|---|
| 166 | void ExttGlossarySelectRow(void) |
|---|
| 167 | { |
|---|
| 168 | ExtSelectRow("tGlossary",VAR_LIST_tGlossary,uGlossary); |
|---|
| 169 | |
|---|
| 170 | }//void ExttGlossarySelectRow(void) |
|---|
| 171 | |
|---|
| 172 | |
|---|
| 173 | void ExttGlossaryListSelect(void) |
|---|
| 174 | { |
|---|
| 175 | char cCat[512]; |
|---|
| 176 | |
|---|
| 177 | ExtListSelect("tGlossary",VAR_LIST_tGlossary); |
|---|
| 178 | |
|---|
| 179 | //Changes here must be reflected below in ExttGlossaryListFilter() |
|---|
| 180 | if(!strcmp(gcFilter,"uGlossary")) |
|---|
| 181 | { |
|---|
| 182 | sscanf(gcCommand,"%u",&uGlossary); |
|---|
| 183 | if(guPermLevel<10) |
|---|
| 184 | strcat(gcQuery," AND "); |
|---|
| 185 | else |
|---|
| 186 | strcat(gcQuery," WHERE "); |
|---|
| 187 | sprintf(cCat,"tGlossary.uGlossary=%u \ |
|---|
| 188 | ORDER BY uGlossary", |
|---|
| 189 | uGlossary); |
|---|
| 190 | strcat(gcQuery,cCat); |
|---|
| 191 | } |
|---|
| 192 | else if(1) |
|---|
| 193 | { |
|---|
| 194 | //None NO FILTER |
|---|
| 195 | strcpy(gcFilter,"None"); |
|---|
| 196 | strcat(gcQuery," ORDER BY uGlossary"); |
|---|
| 197 | } |
|---|
| 198 | |
|---|
| 199 | }//void ExttGlossaryListSelect(void) |
|---|
| 200 | |
|---|
| 201 | |
|---|
| 202 | void ExttGlossaryListFilter(void) |
|---|
| 203 | { |
|---|
| 204 | //Filter |
|---|
| 205 | printf(" Filter on "); |
|---|
| 206 | printf("<select name=gcFilter>"); |
|---|
| 207 | if(strcmp(gcFilter,"uGlossary")) |
|---|
| 208 | printf("<option>uGlossary</option>"); |
|---|
| 209 | else |
|---|
| 210 | printf("<option selected>uGlossary</option>"); |
|---|
| 211 | if(strcmp(gcFilter,"None")) |
|---|
| 212 | printf("<option>None</option>"); |
|---|
| 213 | else |
|---|
| 214 | printf("<option selected>None</option>"); |
|---|
| 215 | printf("</select>"); |
|---|
| 216 | |
|---|
| 217 | }//void ExttGlossaryListFilter(void) |
|---|
| 218 | |
|---|
| 219 | |
|---|
| 220 | void ExttGlossaryNavBar(void) |
|---|
| 221 | { |
|---|
| 222 | if(uOwner) GetClientOwner(uOwner,&guReseller); |
|---|
| 223 | |
|---|
| 224 | printf(LANG_NBB_SKIPFIRST); |
|---|
| 225 | printf(LANG_NBB_SKIPBACK); |
|---|
| 226 | printf(LANG_NBB_SEARCH); |
|---|
| 227 | |
|---|
| 228 | if(guPermLevel>=10 && !guListMode) |
|---|
| 229 | printf(LANG_NBB_NEW); |
|---|
| 230 | |
|---|
| 231 | if(uAllowMod(uOwner,uCreatedBy)) |
|---|
| 232 | printf(LANG_NBB_MODIFY); |
|---|
| 233 | |
|---|
| 234 | if(uAllowDel(uOwner,uCreatedBy)) |
|---|
| 235 | printf(LANG_NBB_DELETE); |
|---|
| 236 | |
|---|
| 237 | if(uOwner) |
|---|
| 238 | printf(LANG_NBB_LIST); |
|---|
| 239 | |
|---|
| 240 | printf(LANG_NBB_SKIPNEXT); |
|---|
| 241 | printf(LANG_NBB_SKIPLAST); |
|---|
| 242 | printf(" \n"); |
|---|
| 243 | |
|---|
| 244 | }//void ExttGlossaryNavBar(void) |
|---|
| 245 | |
|---|
| 246 | |
|---|
| 247 | void tGlossaryNavList(void) |
|---|
| 248 | { |
|---|
| 249 | MYSQL_RES *res; |
|---|
| 250 | MYSQL_ROW field; |
|---|
| 251 | |
|---|
| 252 | ExtSelect("tGlossary","tGlossary.uGlossary,tGlossary.cLabel"); |
|---|
| 253 | |
|---|
| 254 | mysql_query(&gMysql,gcQuery); |
|---|
| 255 | if(mysql_errno(&gMysql)) |
|---|
| 256 | { |
|---|
| 257 | printf("<p><u>tGlossaryNavList</u><br>\n"); |
|---|
| 258 | printf("%s",mysql_error(&gMysql)); |
|---|
| 259 | return; |
|---|
| 260 | } |
|---|
| 261 | |
|---|
| 262 | res=mysql_store_result(&gMysql); |
|---|
| 263 | if(mysql_num_rows(res)) |
|---|
| 264 | { |
|---|
| 265 | printf("<p><u>tGlossaryNavList</u><br>\n"); |
|---|
| 266 | |
|---|
| 267 | while((field=mysql_fetch_row(res))) |
|---|
| 268 | { |
|---|
| 269 | printf("<a class=darkLink href=unxsVZ.cgi?gcFunction=tGlossary&uGlossary=%s>%s</a>", |
|---|
| 270 | field[0],field[1]); |
|---|
| 271 | printf(" (<a class=darkLink href=# onClick=\"open_popup('?gcFunction=Glossary&cLabel=%s')\">" |
|---|
| 272 | "preview</a>)<br>",field[1]); |
|---|
| 273 | } |
|---|
| 274 | } |
|---|
| 275 | mysql_free_result(res); |
|---|
| 276 | |
|---|
| 277 | }//void tGlossaryNavList(void) |
|---|
| 278 | |
|---|
| 279 | |
|---|