XML basiertes Menue, siehe Bug #771
[kivitendo-erp.git] / xslt / xulmenu.xsl
1 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
2     xmlns:html="http://www.w3.org/1999/xhtml" 
3     xmlns:svg="http://www.w3.org/2000/svg"
4     xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
5
6 <xsl:template match="/">
7   <xsl:apply-templates/>
8 </xsl:template>
9
10 <!-- main document structure -->
11 <!-- ******************************************************************* -->
12 <xsl:template match="doc">
13 <xsl:processing-instruction
14 name="xml-stylesheet">href="xslt/style1.css" type="text/css"</xsl:processing-instruction>
15   <window>
16     <html:title>
17       LX-Office Version <xsl:value-of select='/doc/version'/> 
18       - <xsl:value-of select='/doc/name'/> 
19       - <xsl:value-of select='/doc/db'/>
20     </html:title>
21    <!-- <xsl:call-template name="style"/>-->
22     <xsl:call-template name="script"/>
23     <toolbox>
24       <xsl:apply-templates select="menu"/>
25       <xsl:apply-templates select="favorites"/>
26     </toolbox>
27     <hbox flex="1">
28       <vbox id="sidebar" style="overflow:hidden">
29
30         <xsl:apply-templates mode="tree"/>
31
32         <xsl:call-template name="ArtikelSuche"/>
33         <!--<iframe src="xslt/trans.xml" flex="1" id="uhr"/>-->
34       </vbox>
35       <splitter/>
36           <html:iframe id="main_window" src="{/*//item[@id='Programm--Version']/@link}" flex="1" style="border:0px"/>
37     </hbox>
38   </window>
39 </xsl:template>
40 <!-- ******************************************************************* -->
41
42
43 <!-- the top menu -->
44 <!-- ******************************************************************* -->
45 <xsl:template match="menu">
46 <!--<div style="background:grey">-->
47   <menubar id="sample-menubar">
48     <xsl:apply-templates/>
49   </menubar>
50 <!--</div>-->
51 </xsl:template>
52 <!-- ******************************************************************* -->
53
54
55 <!-- favorites toolbar -->
56 <!-- ******************************************************************* -->
57 <xsl:template match="favorites">
58   <toolbar id="favoriten" >
59     <xsl:call-template name="specialbuttons"/>
60     <toolbarseparator/>
61     <xsl:for-each select="link">
62       <xsl:variable name="name" select="@name"/>
63       <xsl:choose>
64         <xsl:when test="/*//item[@id=$name]/item">
65           <toolbarbutton type="menu" label="{$name}" tooltiptext="A simple popup" link="{/*//item[@id=$name]/@link}" oncommand="openLink(event)">
66             <image src="image/icons/24x24/{/*//item[@id=$name]/@id}.png" width="24" height="24" />
67             <menupopup id="file-popup">
68               <xsl:apply-templates select="/*//item[@id=$name]/*"/>
69             </menupopup>
70           </toolbarbutton>
71         </xsl:when>
72         <xsl:otherwise>
73           <toolbarbutton label="{$name}" tooltiptext="A simple popup" link="{/*//item[@id=$name]/@link}" oncommand="openLink(event)" lxid="{/*//item[@id=$name]/@id}">
74             <image src="image/icons/24x24/{/*//item[@id=$name]/@id}.png" width="24" height="24" />
75           </toolbarbutton>
76         </xsl:otherwise>
77       </xsl:choose>
78     </xsl:for-each>
79     <toolbarspring flex="1"/>
80     <xsl:call-template name="searchbox"/>
81
82   </toolbar>
83 </xsl:template>
84 <!-- ******************************************************************* -->
85
86
87 <!-- template for the top menu items
88 *********************************************************************************  -->
89 <xsl:template match="item">
90   <xsl:choose>
91     <xsl:when test="item">
92         <menu id="{@name}_menu" label="{@name}" class="menu-iconic" image="image/icons/16x16/{@id}.png">
93           <menupopup id="file-popup">
94     <xsl:apply-templates/>
95           </menupopup>
96         </menu>
97     </xsl:when>
98     <xsl:otherwise>
99     <menuitem target="{@target}" link="{@link}" label="{@name}" oncommand="openLink(event)" class="menuitem-iconic" image="image/icons/16x16/{@id}.png" lxid="{@id}" onclick="openLinkNewTab(event)"/>
100     </xsl:otherwise>
101   </xsl:choose>
102 </xsl:template>
103 <!-- ***************************************************************************  -->
104
105
106 <!-- templates for the treeview 
107 **********************************************************************************   -->
108 <xsl:template match="menu" mode="tree">
109 <toolbar>
110 <label value="Hauptmenue"/>
111 </toolbar>
112   <tree flex="1" onselect="openTreeLink(event)" style="margin:0px;" hidecolumnpicker="true">
113     <treecols>
114         <treecol hideheader="true" id="menuepunkt"  primary="true" flex="1" />
115     </treecols>
116     <treechildren>
117       <xsl:apply-templates mode="tree"/>
118     </treechildren>
119   </tree>
120 </xsl:template>
121
122 <xsl:template match="item" mode="tree">
123   <xsl:choose>
124     <xsl:when test="item">
125         <treeitem container="true" open="false">
126           <treerow>
127             <treecell label="{@name}" src="image/icons/16x16/{@id}.png"/>
128           </treerow>
129           <treechildren>
130             <xsl:apply-templates mode="tree"/>
131           </treechildren>
132         </treeitem>
133     </xsl:when>
134     <xsl:otherwise>
135     <treeitem link="{@link}">
136       <treerow>
137         <treecell label="{@name}" src="image/icons/16x16/{@id}.png"/>
138       </treerow>
139     </treeitem>
140     </xsl:otherwise>
141   </xsl:choose>
142 </xsl:template>
143 <!-- ***************************************************************************  -->
144
145
146 <!-- template für die uhr
147 ********************************************************************************  -->
148 <xsl:template name="uhr">
149
150 </xsl:template>
151 <!-- ***************************************************************************  -->
152
153
154 <!-- scripts 
155 ********************************************************************************  -->
156 <xsl:template name="script">
157   <html:script type="text/ecmascript">
158   
159   function openLink(event)
160     {
161     var path=event.target.getAttribute("link")
162     if(event.target.getAttribute("target")=="_top")
163       {
164         window.location=path
165       }
166       else
167       {
168         var bf=document.getElementsByTagName("iframe").item(0)
169         bf.setAttribute("src",path)
170       }
171     }
172     
173   function openLinkNewTab(event)
174     {
175     if(event.button!=1) return
176     var path=event.target.getAttribute("link")
177     if(event.target.getAttribute("target")=="_top")
178       {
179         window.location=path
180       }
181       else
182       {
183 window.open(path,"_new","")
184  
185       }
186     }
187     
188     
189   function openLinkNewWindow(event)
190     {
191       var path=event.target.getAttribute("link")
192       window.open(path,"_new","")
193     }
194   
195   function openTreeLink(event)
196     {
197       var tree=event.target
198       var selIndex=tree.currentIndex
199       var item=tree.view.getItemAtIndex(selIndex)
200       var link=item.getAttribute("link")
201       if(link) document.getElementById("main_window").setAttribute("src",link)
202     }  
203   
204   function updateClock()
205     {
206       var d= new Date()
207       var sec=d.getSeconds() 
208       var min=d.getMinutes() 
209       var std=(d.getHours() % 12 ) + min/60
210       document.getElementById("std").setAttribute("transform","rotate("+std*30+",20,20)")
211       document.getElementById("min").setAttribute("transform","rotate("+min*6+",20,20)")
212       document.getElementById("sec").setAttribute("transform","rotate("+sec*6+",20,20)")
213     }
214   
215   function PrintW()
216     {
217       document.getElementById("main_window").contentWindow.print()
218     }
219   
220   function doSearch(){
221   var t=document.getElementById("searchboxtext").value
222   document.getElementById("desc").value=t
223   document.getElementById("sb").click()
224   
225   }
226   function checkEnter(event){
227   if(event.keyCode==13) doSearch()
228   }
229   //setInterval("updateClock()",1000)
230   
231   </html:script>
232 </xsl:template>
233 <!-- ***************************************************************************  -->
234
235 <!-- special buttons ( logout , print, open new window )
236 ****************************************************************************  -->
237 <xsl:template name="specialbuttons">
238   <toolbarbutton image="image/icons/24x24/Batch Printing.png" tooltiptext="hallo" oncommand="PrintW(event)"/>
239   <toolbarbutton image="image/icons/24x24/Neues Fenster.png" tooltip="Neues Fenster" link="menuXML.pl?action=display&amp;login={/doc/login}&amp;password={/doc/password}" target="_top" oncommand="openLinkNewWindow(event)"/>
240   <toolbarbutton label="Logout" link="{/*//item[@id='Programm--Logout']/@link}" target="_top" oncommand="openLink(event)">
241     <image src="image/icons/24x24/Programm--Logout.png" width="24" height="24" />
242   </toolbarbutton>
243 </xsl:template>
244 <!-- ***************************************************************************  -->
245
246
247 <!-- searchbox
248 ****************************************************************************  -->
249 <xsl:template name="searchbox">
250 <vbox style="padding-top:5px">
251   <hbox>
252
253     <textbox height="22px" style="font-size:12px;margin-right:0px" width="200px" id="searchboxtext" onkeypress="checkEnter(event)"/>
254 <toolbarbutton type="toolbar" width="20" height="20" style="padding:5px !important"
255 image="xslt/images/16x16/CRM--Schnellsuche.png" flex="0" oncommand="doSearch()"/>
256 </hbox>
257
258 </vbox>
259 </xsl:template>
260 <!-- ***************************************************************************  -->
261
262
263 <!-- hidden form for article search
264 ****************************************************************************  -->
265 <xsl:template name="ArtikelSuche">
266   <form id="aform" method="post" action="ic.pl" xmlns="http://www.w3.org/1999/xhtml" target="main_window" style="font-family:arial;font-size:12px;display:none">
267   <input name="partnumber" size="20"/>
268   <input name="description" flex="1" id="desc"/>
269   <input name="partsgroup" size="20"/>
270   <input name="make" size="20"/>
271   <input class="submit" type="submit" name="action" value="Weiter" id="sb"/>
272   <div style="display:none" >    
273   <input class="submit" type="submit" name="action" value="Top 100"/> 
274     <input type="hidden" name="serialnumber" size="20"/>  
275     <input type="hidden" name="ean" size="20"/>     
276     <input type="hidden" name="searchitems" value="part"/>
277     <input type="hidden" name="title" value="Waren"/>
278     <input type="hidden" name="revers" value="0"/>
279     <input type="hidden" name="lastsort" value=""/>
280     <input type="hidden" name="model" size="20"/>
281     <input type="hidden" name="drawing" size="20"/>
282     <input type="hidden" name="microfiche" size="20"/>
283     <input  name="itemstatus" class="radio" type="radio" value="active" checked="true"/>
284     <input name="itemstatus" class="radio" type="radio" value="onhand"/>
285     <input  name="itemstatus" class="radio" type="radio" value="short"/>
286     <input  name="itemstatus" class="radio" type="radio" value="obsolete"/>
287     <input  name="itemstatus" class="radio" type="radio" value="orphaned"/>
288     <input  name="bought" class="checkbox" type="checkbox" value="1"/>
289     <input  name="sold" class="checkbox" type="checkbox" value="1"/>
290     <input  name="onorder" class="checkbox" type="checkbox" value="1"/>
291     <input  name="ordered" class="checkbox" type="checkbox" value="1"/>
292     <input  name="rfq" class="checkbox" type="checkbox" value="1"/>Anfrage
293     <input  name="quoted" class="checkbox" type="checkbox" value="1"/>Angeboten  
294     <input type="hidden" name="transdatefrom" id="transdatefrom" size="11" title="dd.mm.yy"/>
295     <input  type="button" name="transdatefrom" id="trigger1" value="?"/> 
296     <input name="transdateto" id="transdateto" size="11" title="dd.mm.yy"/>
297     <input type="button" name="transdateto" id="trigger2" value="?"/>
298     <input name="l_partnumber" class="checkbox" type="checkbox" value="Y" checked="true"/>Artikelnummer
299     <input name="l_description" class="checkbox" type="checkbox" value="Y" checked="true"/>Artikelbeschreibung
300     <input name="l_serialnumber" class="checkbox" type="checkbox" value="Y"/>Seriennummer
301     <input name="l_unit" class="checkbox" type="checkbox" value="Y" checked="true"/>Maßeinheit
302     <input name="l_listprice" class="checkbox" type="checkbox" value="Y"/>Listenpreis
303     <input name="l_sellprice" class="checkbox" type="checkbox" value="Y" checked="true"/>Verkaufspreis
304     <input name="l_lastcost" class="checkbox" type="checkbox" value="Y" checked="true"/>Einkaufspreis
305     <input name="l_linetotal" class="checkbox" type="checkbox" value="Y" checked="true"/>Zeilensumme
306     <input name="l_priceupdate" class="checkbox" type="checkbox" value="Y"/>Erneuert am
307     <input name="l_bin" class="checkbox" type="checkbox" value="Y"/>Lagerplatz
308     <input name="l_rop" class="checkbox" type="checkbox" value="Y"/>Mindestlagerbestand
309     <input name="l_weight" class="checkbox" type="checkbox" value="Y"/>Gewicht
310     <input name="l_image" class="checkbox" type="checkbox" value="Y"/>Grafik
311     <input name="l_drawing" class="checkbox" type="checkbox" value="Y"/>Zeichnung
312     <input name="l_microfiche" class="checkbox" type="checkbox" value="Y"/>Mikrofilm
313     <input name="l_partsgroup" class="checkbox" type="checkbox" value="Y"/>Warengruppe
314     <input name="l_subtotal" class="checkbox" type="checkbox" value="Y"/>Zwischensumme
315     <input name="l_soldtotal" class="checkbox" type="checkbox" value="Y"/>Verkaufte Anzahl
316     <input name="l_deliverydate" class="checkbox" type="checkbox" value="Y"/>Lieferdatum
317     <input type="hidden" name="nextsub" value="generate_report"/>
318     <input type="hidden" name="login" value="{/doc/login}"/>
319     <input type="hidden" name="password" value="{/doc/password}"/>
320     <input type="hidden" name="revers" value="0"/>
321     <input type="hidden" name="lastsort" value=""/>
322     <input type="hidden" name="sort" value="description"/>
323     <input type="hidden" name="ndxs_counter" value="0"/>
324   </div>
325   </form>
326 </xsl:template>
327 <!-- ***************************************************************************  -->
328 </xsl:stylesheet>