a5c109c01bf28f881d489233e72448f8e2fa006b
[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 <xsl:output media-type="application/vnd.mozilla.xul+xml"/>
6 <xsl:template match="/">
7   <xsl:choose>
8     <xsl:when test="system-property('xsl:vendor')='Transformiix'">
9
10       <xsl:apply-templates/>
11     </xsl:when>
12     <xsl:otherwise>
13       <xsl:apply-templates mode="html"/>
14     </xsl:otherwise>
15   </xsl:choose>
16 </xsl:template>
17
18 <xsl:template match="doc" mode="html">
19   <html xmlns="http://www.w3.org/1999/xhtml">
20     <head>
21       <meta http-equiv="refresh" content="5;url=menu.pl?action=display"/>
22     </head>
23     <body style="background-color: #eee; color: #333;">
24      <div style="margin-top: 2em; margin-left: auto; margin-right: auto; border: solid 0.1em #f88; width: 30em; background-color:#fff; font-size: 0.8em;font-family: Verdana, Arial, Helvetica; padding: 2em;">
25       <h2>XUL-Men&#252; ist aktiviert</h2>
26       <h3>Nur der Firefox-Browser mag das XUL-Men&#252;.</h3>
27       Wir schalten auf die kompatiblere <a href="menu.pl?action=display">HTML-Variante</a> um.
28       <h3>Only the Firefox-Browser likes the XUL-Menu.</h3>
29       We switch to the <a href="menu.pl?action=display">HTML-Version</a> now.      
30      </div>
31     </body>
32   </html>
33 </xsl:template>
34
35 <!-- main document structure -->
36 <!-- ******************************************************************* -->
37 <xsl:template match="doc">
38 <xsl:processing-instruction name="xml-stylesheet">href="xslt/style1.css" type="text/css"</xsl:processing-instruction>
39   <xsl:variable name="callback"><xsl:value-of select='/doc/callback'/></xsl:variable>
40   <xsl:variable name="title">
41       LX-Office Version <xsl:value-of select='/doc/version'/>
42       - <xsl:value-of select='/doc/name'/>
43       - <xsl:value-of select='/doc/db'/>
44     </xsl:variable>
45    <!-- <xsl:call-template name="style"/>-->
46   <window title="{$title}">
47   <html:title/>
48     <xsl:call-template name="script"/>
49     <toolbox>
50       <xsl:apply-templates select="menu"/>
51       <xsl:apply-templates select="favorites"/>
52     </toolbox>
53     <hbox flex="1">
54       <vbox id="sidebar" style="overflow:hidden">
55
56         <xsl:apply-templates mode="tree" select="menu"/>
57
58         <xsl:call-template name="ArtikelSuche"/>
59         <!--<iframe src="xslt/trans.xml" flex="1" id="uhr"/>-->
60       </vbox>
61       <splitter state="open" collapse="before" resizeafter="farthest"><grippy/></splitter>
62       <browser id="main_window" type="content" src="{$callback}" flex="1" style="border:0px"/>
63     </hbox>
64   </window>
65 </xsl:template>
66 <!-- ******************************************************************* -->
67
68
69 <!-- the top menu -->
70 <!-- ******************************************************************* -->
71 <xsl:template match="menu"><menubar id="sample-menubar" flex="1"><xsl:apply-templates/></menubar></xsl:template>
72 <!-- ******************************************************************* -->
73
74
75 <!-- favorites toolbar -->
76 <!-- ******************************************************************* -->
77 <xsl:template match="favorites">
78   <toolbar id="favoriten" >
79     <xsl:call-template name="specialbuttons"/>
80     <toolbarseparator/>
81     <xsl:for-each select="link">
82       <xsl:variable name="name" select="@name"/>
83       <xsl:choose>
84         <xsl:when test="/*//item[@id=$name]/item">
85           <toolbarbutton type="menu" label="{$name}" tooltiptext="A simple popup" link="{/*//item[@id=$name]/@link}" oncommand="openLink(event)">
86             <image src="image/icons/24x24/{/*//item[@id=$name]/@id}.png" width="24" height="24" />
87             <menupopup id="file-popup">
88               <xsl:apply-templates select="/*//item[@id=$name]/*"/>
89             </menupopup>
90           </toolbarbutton>
91         </xsl:when>
92         <xsl:otherwise>
93           <toolbarbutton label="{$name}" tooltiptext="A simple popup" link="{/*//item[@id=$name]/@link}" oncommand="openLink(event)" lxid="{/*//item[@id=$name]/@id}">
94             <image src="image/icons/24x24/{/*//item[@id=$name]/@id}.png" width="24" height="24" />
95           </toolbarbutton>
96         </xsl:otherwise>
97       </xsl:choose>
98     </xsl:for-each>
99     <toolbarspring flex="1"/>
100     <xsl:call-template name="searchbox"/>
101
102   </toolbar>
103 </xsl:template>
104 <!-- ******************************************************************* -->
105
106
107 <!-- template for the top menu items
108 *********************************************************************************  -->
109 <xsl:template match="item">
110  <xsl:choose>
111   <xsl:when test="item">
112    <menu id="{@name}_menu" label="{@name}" class="menu-iconic" image="image/icons/16x16/{@id}.png">
113     <menupopup id="file-popup">
114      <xsl:apply-templates/>
115     </menupopup>
116    </menu>
117   </xsl:when>
118   <xsl:otherwise>
119    <menuitem target="{@target}" link="{@link}" label="{@name}" oncommand="openLink(event)" class="menuitem-iconic" image="image/icons/16x16/{@id}.png" lxid="{@id}" onclick="openLinkNewTab(event)"/>
120   </xsl:otherwise>
121  </xsl:choose>
122 </xsl:template>
123 <!-- ***************************************************************************  -->
124
125
126 <!-- templates for the treeview
127 **********************************************************************************   -->
128 <xsl:template match="menu" mode="tree">
129 <toolbar>
130 <label value="Hauptmen&#252;"/>
131 </toolbar>
132   <tree flex="1" onselect="openTreeLink(event)" style="margin:0px;" hidecolumnpicker="true">
133     <treecols>
134         <treecol hideheader="true" id="menuepunkt"  primary="true" flex="1" />
135     </treecols>
136     <treechildren>
137       <xsl:apply-templates mode="tree"/>
138     </treechildren>
139   </tree>
140 </xsl:template>
141
142 <xsl:template match="item" mode="tree">
143   <xsl:choose>
144     <xsl:when test="item">
145         <treeitem container="true" open="false">
146           <treerow>
147             <treecell label="{@name}" src="image/icons/16x16/{@id}.png"/>
148           </treerow>
149           <treechildren>
150             <xsl:apply-templates mode="tree"/>
151           </treechildren>
152         </treeitem>
153     </xsl:when>
154     <xsl:otherwise>
155     <treeitem link="{@link}">
156       <treerow>
157         <treecell label="{@name}" src="image/icons/16x16/{@id}.png"/>
158       </treerow>
159     </treeitem>
160     </xsl:otherwise>
161   </xsl:choose>
162 </xsl:template>
163 <!-- ***************************************************************************  -->
164
165
166 <!-- template fuer die uhr
167 ********************************************************************************  -->
168 <xsl:template name="uhr">
169
170 </xsl:template>
171 <!-- ***************************************************************************  -->
172
173
174 <!-- scripts
175 ********************************************************************************  -->
176 <xsl:template name="script">
177   <html:script type="text/ecmascript">
178
179   function openLink(event)
180     {
181     var path=event.target.getAttribute("link")
182     if(event.target.getAttribute("target")=="_top")
183       {
184         window.location=path
185       }
186       else
187       {
188         var bf=document.getElementById("main_window")
189         bf.setAttribute("src",path)
190       }
191     }
192
193   function openLinkNewTab(event)
194     {
195     if(event.button!=1) return
196     var path=event.target.getAttribute("link")
197     if(event.target.getAttribute("target")=="_top")
198       {
199         window.location=path
200       }
201       else
202       {
203 window.open(path,"_new","")
204
205       }
206     }
207
208
209   function openLinkNewWindow(event)
210     {
211       var path=event.target.getAttribute("link")
212       window.open(path,"_blank","")
213     }
214
215   function openTreeLink(event)
216     {
217       var tree=event.target
218       var selIndex=tree.currentIndex
219       var item=tree.view.getItemAtIndex(selIndex)
220       var link=item.getAttribute("link")
221       if(link) document.getElementById("main_window").setAttribute("src",link)
222     }
223
224   function updateClock()
225     {
226       var d= new Date()
227       var sec=d.getSeconds()
228       var min=d.getMinutes()
229       var std=(d.getHours() % 12 ) + min/60
230       document.getElementById("std").setAttribute("transform","rotate("+std*30+",20,20)")
231       document.getElementById("min").setAttribute("transform","rotate("+min*6+",20,20)")
232       document.getElementById("sec").setAttribute("transform","rotate("+sec*6+",20,20)")
233     }
234
235   function PrintW()
236     {
237       document.getElementById("main_window").contentWindow.print()
238     }
239
240   function doSearch(){
241   var t=document.getElementById("searchboxtext").value
242   document.getElementById("desc").value=t
243   document.getElementById("sb").click()
244
245   }
246   function checkEnter(event){
247   if(event.keyCode==13) doSearch()
248   }
249   //setInterval("updateClock()",1000)
250   function MyGoBack(){
251 document.getElementById("main_window").contentWindow.history.back()
252 }
253   function MyGoForward(){
254 document.getElementById("main_window").contentWindow.history.forward()
255 }
256   </html:script>
257 </xsl:template>
258 <!-- ***************************************************************************  -->
259
260 <!-- special buttons ( logout , print, open new window )
261 The tooltips, like tooltiptext="Neues Fenster", do not appear in my Firefox/Prism browsers. Why?
262 https://developer.mozilla.org/en/XUL_Tutorial/Popup_Menus
263 https://developer.mozilla.org/en/XUL/Attribute/tooltiptext
264 ****************************************************************************  -->
265 <xsl:template name="specialbuttons">
266     <toolbarbutton image="image/icons/24x24/Batch Printing.png" oncommand="PrintW(event)" tooltiptext="Drucken"/>
267     <toolbarbutton image="image/icons/24x24/Neues Fenster.png" tooltiptext="Neues Fenster" link="menuXML.pl?action=display" target="_top" oncommand="openLinkNewWindow(event)"/>
268     <toolbarbutton image="image/icons/24x24/Program--Logout.png" link="{/*//item[@id='Program--Logout']/@link}" target="_top" oncommand="openLink(event)" tooltiptext="Abmelden"/>
269   <toolbarseparator/>
270     <toolbarbutton image="image/icons/24x24/leftarrow_24.png" tooltiptext="Schritt zurück" oncommand="MyGoBack()"/>
271     <toolbarbutton image="image/icons/24x24/rightarrow_24.png" tooltiptext="Schritt vor" oncommand="MyGoForward()"/>
272 </xsl:template>
273 <!-- ***************************************************************************  -->
274
275
276 <!-- searchbox
277 ****************************************************************************  -->
278 <xsl:template name="searchbox">
279 <vbox style="padding-top:2px">
280   <hbox>
281     <textbox style="font-size:11px;margin-right:0px" width="200px" id="searchboxtext" onkeypress="checkEnter(event)"/> 
282     <toolbarbutton type="toolbar" width="20" height="20" style="padding:5px !important" 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="revers" value="0"/>
346     <input type="hidden" name="lastsort" value=""/>
347     <input type="hidden" name="sort" value="description"/>
348     <input type="hidden" name="ndxs_counter" value="0"/>
349   </div>
350   </form>
351 </xsl:template>
352 <!-- ***************************************************************************  -->
353 </xsl:stylesheet>