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