Changeset 9879 for trunk/Wsp_Modeling/spaces/gen/modelBuilder/bs.doss/sm_binaryPrim/mainview.xul.xsl
- Timestamp:
- 10/26/07 19:52:07 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Wsp_Modeling/spaces/gen/modelBuilder/bs.doss/sm_binaryPrim/mainview.xul.xsl
r9842 r9879 55 55 <xsl:template match="*"> 56 56 <xsl:processing-instruction name="xml-stylesheet">href="chrome://scenaricms/content/view/baseview.css" type="text/css"</xsl:processing-instruction> 57 <window head="{name()}" >57 <window head="{name()}" onload="init()"> 58 58 <script src="chrome://scenaricms/content/view/baseview.js"/> 59 59 <script src="chrome://scenaricms/content/util/upload.js"/> 60 <script><![CDATA[ 60 <script> 61 var vMimeType = "<xsl:value-of select='sm:structure/@type'/>"; 62 var vIsServerLocal = document.fUriObject.fServer.isServerLocal(); 63 <![CDATA[ 64 var vHasWebDavMode = vMimeType.indexOf('application/vnd.oasis.opendocument.')==0 ? true : false; 65 function init(){ 66 try{ 67 if(!vIsServerLocal && !vHasWebDavMode){ 68 var vEditTab = document.getElementById("idEdit"); 69 if(vEditTab) vEditTab.collapsed = true; 70 //refresh de sctabs 71 document.getElementById("sctabs").redrawNoTabs(); 72 } 73 }catch(e){ 74 ut.debug("mainview.xul > init : " + e ); 75 } 76 } 77 61 78 //On force l'uriObject sur l'Item, pas sur une de ses subUriRes. 62 79 //Doit etre executé avant les constructeurs des XBL … … 74 91 } 75 92 function edit(){ 76 var vFilePath = vUriObjectMainStream.getServer().getTextFromService("/u/vueObjet?cdaction=GetFilePath¶m="+window.encodeURIComponent(vUriObjectMainStream.fUri)); 77 if(vFilePath) ut.openExternalLocalFile(vFilePath, false); 93 try{ 94 if(vIsServerLocal){/// TODO 95 var vFilePath = vUriObjectMainStream.getServer().getTextFromService("/u/vueObjet?cdaction=GetFilePath¶m="+window.encodeURIComponent(vUriObjectMainStream.fUri)); 96 if(vFilePath) ut.openExternalLocalFile(vFilePath, false); 97 }else{ 98 // ressource OO : lecture webDav possible 99 if(vMimeType.indexOf('application/vnd.oasis.opendocument.')==0){ 100 var vItemDavUrl = vUriObjectMainStream.getServer().getSourceUrl("trav") + '/' + vUriObjectMainStream.fUri; 101 vOOFile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); 102 if(ut.isWin){// win 103 var vWrk = Components.classes["@mozilla.org/windows-registry-key;1"].createInstance(Components.interfaces.nsIWindowsRegKey); 104 var vOOKey = "Software\\OpenOffice.org\\UNO\\InstallPath"; 105 var vOOLocalPath = ""; 106 try{ 107 vWrk.open(vWrk.ROOT_KEY_CURRENT_USER, vOOKey, vWrk.ACCESS_READ); 108 vOOLocalPath = vWrk.readStringValue(""); 109 }catch(e){ 110 try{ 111 vWrk.open(vWrk.ROOT_KEY_LOCAL_MACHINE, vOOKey, vWrk.ACCESS_READ); 112 vOOLocalPath = vWrk.readStringValue(""); 113 }catch(e){ 114 ut.debug("mainview.xul : OO n'a pas été trouvé dans la base de registre"); 115 } 116 } 117 if(vOOLocalPath!=""){ 118 vOOFile.initWithPath(vOOLocalPath); 119 vOOFile.append("soffice.exe"); 120 } 121 vWrk.close(); 122 }else if(ut.isUnix){// lin 123 vOOFile.initWithPath('soffice'); 124 }else{// mac 125 var vTmpAppFile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); 126 vTmpAppFile.initWithPath('/Applications'); 127 var vTmpAppFile2_0 = vTmpAppFile.clone(); vTmpAppFile2_0.append("OpenOffice.org 2.0.app"); 128 if(!vTmpAppFile2_0.exists()){ 129 var vTmpAppFile2_1 = vTmpAppFile.clone(); vTmpAppFile2_1.append("OpenOffice.org 2.1.app"); 130 if(!vTmpAppFile2_1.exists()){ 131 var vTmpAppFile2_2 = vTmpAppFile.clone(); vTmpAppFile2_2.append("OpenOffice.org 2.2.app"); 132 if(!vTmpAppFile2_2.exists()){ 133 var vTmpAppFile2_3 = vTmpAppFile.clone(); vTmpAppFile2_3.append("OpenOffice.org 2.3.app"); 134 if(!vTmpAppFile2_3.exists()){ 135 vTmpAppFile.append("OpenOffice.org 2.4.app"); 136 vOOFile = vTmpAppFile; 137 }else{ 138 vOOFile = vTmpAppFile2_3; 139 } 140 }else{ 141 vOOFile = vTmpAppFile2_2; 142 } 143 }else{ 144 vOOFile = vTmpAppFile2_1; 145 } 146 }else{ 147 vOOFile = vTmpAppFile2_0; 148 } 149 } 150 151 // ut.debug("vOOFile :: " + vOOFile.path); 152 // ut.debug("vItemDavUrl :: " + vItemDavUrl); 153 154 if(vOOFile && vOOFile.exists()){ 155 var vProcess = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess); 156 vProcess.init(vOOFile); 157 var vArgs = []; 158 vArgs.push(vItemDavUrl); 159 vProcess.run(false, vArgs, vArgs.length); 160 }else{ 161 ut.alert("L'application openOffice n'a pu être trouvée. L'édition directe est donc impossible."); 162 } 163 } 164 } 165 }catch(e){ 166 ut.debug("mainview.xul > edit : " + e); 167 } 78 168 } 79 169 function upload(){ … … 90 180 ]]></script> 91 181 <headitem model="{resultatAgent('//nameModel')}" categ="{resultatAgent('//groupNameModel')}"/> 92 <sctabs >182 <sctabs id="sctabs"> 93 183 <xsl:apply-templates select="computeNodeAgent('@@/mainView', codeAgent('//'))/*" mode="mainview"/> 94 184 </sctabs> … … 140 230 141 231 <xsl:template match="sm:buttonTab[@buttonKey='externalEdition']" mode="mainview"> 142 <scaction icon="chrome://scenaricms/content/widgets/sctab/icon/edit.png" label="{@name}" command="edit();" />232 <scaction icon="chrome://scenaricms/content/widgets/sctab/icon/edit.png" label="{@name}" command="edit();" id="idEdit"/> 143 233 </xsl:template> 144 234
Note: See TracChangeset
for help on using the changeset viewer.