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