/[informatika.old]/html/inc/org_jed.inc
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /html/inc/org_jed.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Tue Apr 24 13:57:23 2001 UTC (23 years ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +2 -2 lines
promjene

1 dpavlin 1.1
2     <script language="JavaScript1.1">
3    
4     var pod_arr = [ <?
5    
6     $pod_option=""; // HTML pod <option>
7     $nad_option=""; // HTML nad <option>
8    
9 dpavlin 1.2 $result = pg_Exec ($conn, "select id,naziv from org_jed where aktivna=true order by id");
10 dpavlin 1.1 for ($k = 0; $k < pg_numrows($result); $k++) {
11     $row=pg_fetch_array($result,$k);
12     $nad_option.="<option value=\"$row[id]\"";
13     if ($row[id]==$nad_select) { $nad_option.=" selected"; }
14     $nad_option.=">$row[naziv]</option>\n";
15     }
16    
17 dpavlin 1.2 $result = pg_Exec ($conn, "select pod_id,nad_id,pod_naziv from org_pod_jed where pod_aktivna=true order by nad_id,pod_id"); $delim = "";
18 dpavlin 1.1 for ($k = 0; $k < pg_numrows($result); $k++) {
19     $row=pg_fetch_array($result,$k);
20     echo "$delim \"$row[nad_id],$row[pod_id],$row[pod_naziv]\" ";
21     $val="$row[nad_id] $row[pod_id]";
22     $pod_option.="<option value=\"$val\"";
23     if ($val == $pod_select) { $pod_option.=" selected"; }
24     $pod_option.=">$row[pod_naziv]</option>\n";
25     $delim = ",";
26     }
27    
28     $tmp=explode(" ",$pod_select);
29     if ($tmp[1] == "0") {
30     $pod_option.='<option value="'.$pod_select.'" selected>-</option>';
31     }
32     ?> ];
33    
34     function pod_change() {
35     ns=document.forma.nad_select;
36     ps=document.forma.pod_select;
37    
38     tmp=ps.options[ps.options.selectedIndex].value.split(" ");
39     ns.options.selectedIndex=tmp[0]-1;
40     /* alert("selected: "+ps.options.selectedIndex+" value: "+ps.options[ps.options.selectedIndex].value); */
41     }
42    
43     function nad_change() {
44     ns=document.forma.nad_select;
45     ps=document.forma.pod_select;
46    
47     nr=0;
48     nad=ns.options[ns.options.selectedIndex].value;
49    
50     for (var i=0; i < pod_arr.length; i++) {
51     tmp=pod_arr[i].split(",",3);
52     if (tmp[0]==nad) {
53     ps.options.length=nr+1;
54     ps.options[nr].value=tmp[0]+" "+tmp[1];
55     ps.options[nr].text=tmp[2];
56     nr++;
57     }
58     }
59     if (nr == 0) {
60     ps.options[0].value=nad+" 0";
61     ps.options[0].text="-";
62     ps.options.length=1;
63     }
64     /* alert("nr:"+nr+"\nlast value:"+ps.options[nr].value); */
65     ps.options.selectedIndex=0;
66     }
67    
68     </script>
69    
70     <select name="nad_select" onChange="nad_change()">
71     <? echo $nad_option ?>
72     </select>
73    
74     <select name="pod_select" onChange="pod_change()">
75     <? echo $pod_option ?>
76     </select>

  ViewVC Help
Powered by ViewVC 1.1.26