Subversion Repositories wimsdev

Rev

Rev 9042 | Rev 9048 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9042 Rev 9044
Line 29... Line 29...
29
 * or name, list slist [prompt plist]
29
 * or name, list slist [prompt plist]
30
 * Using script to do this is too slow.
30
 * Using script to do this is too slow.
31
 */
31
 */
32
void _form_menus(char *p,int kind)
32
void _form_menus(char *p,int kind)
33
{
33
{
34
    char *n, *li, *pp, *val, *p0, *p1, *p2, *pc, *s, *hmode;
34
    char *n, *li, *pp, *val, *p0, *p1, *p2, *pc, *s, *hmode, *name;
35
    char *vlist[MAX_MENU_ITEMS], *plist[MAX_MENU_ITEMS];
35
    char *vlist[MAX_MENU_ITEMS], *plist[MAX_MENU_ITEMS];
36
    char nbuf[MAX_LINELEN+1],vbuf[MAX_LINELEN+1],pbuf[MAX_LINELEN+1];
36
    char nbuf[MAX_LINELEN+1],vbuf[MAX_LINELEN+1],pbuf[MAX_LINELEN+1];
37
    char buf[256], pfrb[256], pfre[256];
37
    char buf[256], pfrb[256], pfre[256], input_id[128];
38
    char input_id[128];
-
 
39
    int i,i1=0,i2,itemcnt,type;
38
    int i,i1=0,i2,itemcnt,type;
40
    if(!outputing) return;
39
    if(!outputing) return;
41
    n=find_word_start(p); if(*n==0) return;
40
    n=find_word_start(p); if(*n==0) return;
42
    pp=find_word_end(n);
41
    pp=find_word_end(n);
43
    if(*pp!=0) *(pp++)=0;
42
    if(*pp!=0) *(pp++)=0;
Line 125... Line 124...
125
        if(hmode!=NULL && *hmode!=0) {
124
        if(hmode!=NULL && *hmode!=0) {
126
          snprintf(pfrb, sizeof(pfrb), "<%s>", hmode);
125
          snprintf(pfrb, sizeof(pfrb), "<%s>", hmode);
127
          snprintf(pfre, sizeof(pfre), "</%s>", hmode);
126
          snprintf(pfre, sizeof(pfre), "</%s>", hmode);
128
        }
127
        }
129
      }
128
      }
-
 
129
      switch(kind) {
-
 
130
        case FORM_RADIO: name="radio"; break;
-
 
131
        case FORM_CHECKBOX: name="checkbox"; break;
130
 
132
      }
131
      switch(kind) {
133
      switch(kind) {
132
        case FORM_SELECT:
134
        case FORM_SELECT:
133
         output("<option value=\"%s\"%s>%s</option>\n", p0, pc, plist[i]);
135
         output("<option value=\"%s\"%s>%s</option>\n", p0, pc, plist[i]);
134
         break;
136
         break;
135
 
137
 
136
        case FORM_RADIO:
138
        case FORM_RADIO:
137
         output("%s<input type=\"radio\" name=\"%s\" id=\"%s%d\" value=\"%s\"%s/><label for=\"%s%d\">%s</label>%s",
-
 
138
             pfrb,nbuf,input_id,i,p0,pc,input_id,i,plist[i],pfre);
-
 
139
         if(i<itemcnt-1 && itemcnt>2 && (hmode==NULL || *hmode==0)) _output_(",");
-
 
140
         _output_("\n");
-
 
141
         break;
-
 
142
 
-
 
143
        case FORM_CHECKBOX:
139
        case FORM_CHECKBOX:
-
 
140
         if (itemcnt > 2) {
144
         output("%s<input type=\"checkbox\" name=\"%s\" id=\"%s%d\" value=\"%s\"%s/><label for=\"%s%d\">%s</label>%s",
141
         output("%s<input type=\"%s\" name=\"%s\" id=\"%s%d\" value=\"%s\"%s/><label for=\"%s%d\">%s</label>%s",
145
             pfrb,nbuf,input_id,i,p0,pc,input_id,i,plist[i],pfre);
142
             pfrb,name,nbuf,input_id,i+1,p0,pc,input_id,i+1,plist[i],pfre);
-
 
143
         } else {
-
 
144
         output("%s<input type=\"%s\" name=\"%s\" id=\"%s\" value=\"%s\"%s/><label for=\"%s\">%s</label>%s",
-
 
145
             pfrb,name,nbuf,input_id,p0,pc,input_id,plist[i],pfre);
-
 
146
         }
146
         if(i<itemcnt-1 && itemcnt>2 && (hmode==NULL || *hmode==0)) _output_(",");
147
         if(i<itemcnt-1 && itemcnt>2 && (hmode==NULL || *hmode==0)) _output_(",");
147
         _output_("\n");
148
         _output_("\n");
148
         break;
149
         break;
149
 
-
 
150
        case FORM_BAR:
150
        case FORM_BAR:
151
         output("<input type=\"radio\" name=\"%s\" id=\"%s%d\" value=\"%s\"%s/>",
151
         output("<input type=\"radio\" name=\"%s\" id=\"%s%d\" value=\"%s\"%s/>",
152
             nbuf,input_id,i,p0,pc);
152
             nbuf,input_id,i+1,p0,pc);
153
         break;
153
         break;
154
      }
154
      }
155
    }
155
    }
156
    setvar("wims_ref_class","");
156
    setvar("wims_ref_class","");
157
    setvar("wims_html_mode","");
157
    setvar("wims_html_mode","");