Changeset 6738
- Timestamp:
- 10/01/06 16:30:54 (5 years ago)
- Location:
- trunk/Xul_Cms/content/scenaricms
- Files:
-
- 2 edited
-
ut.js (modified) (2 diffs)
-
wspview/wspview.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Xul_Cms/content/scenaricms/ut.js
r6148 r6738 150 150 151 151 /** 152 * 152 * Lance l'application par défaut de l'OS pour l'URL passée en paramètre. 153 153 */ 154 154 ut.loadExternalURL = function(pUrl){ … … 159 159 vExtProtocolSvc.loadUrl(vUri); 160 160 } 161 } 162 163 /** 164 * Ouvre ou révèle un fichier local. 165 * @param pReveal : true = révèle dans le système de fichier de l'OS, false lance l'appli associée par l'OS 166 */ 167 ut.openExternalLocalFile = function wspOpenExternal(pFilePath, pReveal) { 168 var vFile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); 169 vFile.initWithPath(pFilePath); 170 try { 171 if(pReveal) vFile.reveal(); else vFile.launch(); 172 } catch(e) { 173 // This is only called on unix systems due to the fact that nsILocalFile::Launch and nsILocalFile::Reveal have a bug under that OS. 174 // This code is copied from the firefox 1.5 chrome, original file: mozapps/downloads/downloads.js 175 if(pReveal && ! vFile.isDirectory()) vFile = vFile.parent; 176 var vUri = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService).newFileURI(vFile); 177 var vProtocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"].getService(Components.interfaces.nsIExternalProtocolService); 178 vProtocolSvc.loadUrl(vUri); 179 } 161 180 } 162 181 // ####################### XML UTIL ####################### -
trunk/Xul_Cms/content/scenaricms/wspview/wspview.js
r6675 r6738 1314 1314 var vFilePath = vCtx.fServer.getTextFromService("/u/vueObjet?cdaction=GetFilePath¶m="+encodeURIComponent(vCtx.fUri)); 1315 1315 } 1316 if(vFilePath) wspOpenExternal(vFilePath, true);1316 if(vFilePath) ut.openExternalLocalFile(vFilePath, true); 1317 1317 } 1318 1318 … … 1320 1320 var vCtx = ut.getContextActions(pEvent.target); 1321 1321 var vFilePath = vCtx.fServer.getTextFromService("/u/vueObjet?cdaction=GetFilePath¶m="+window.encodeURIComponent(vCtx.fUri)); 1322 if(vFilePath) wspOpenExternal(vFilePath, false); 1323 } 1324 1325 function wspOpenExternal(pFilePath, pReveal) { 1326 var vFile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); 1327 vFile.initWithPath(pFilePath); 1328 try { 1329 if(pReveal) vFile.reveal(); else vFile.launch(); 1330 } catch(e) { 1331 // This is only called on unix systems due to the fact that nsILocalFile::Launch and nsILocalFile::Reveal have a bug under that OS. 1332 // This code is copied from the firefox 1.5 chrome, original file: mozapps/downloads/downloads.js 1333 if(pReveal && ! vFile.isDirectory()) vFile = vFile.parent; 1334 var vUri = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService).newFileURI(vFile); 1335 var vProtocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"].getService(Components.interfaces.nsIExternalProtocolService); 1336 vProtocolSvc.loadUrl(vUri); 1337 } 1322 if(vFilePath) ut.openExternalLocalFile(vFilePath, false); 1338 1323 } 1339 1324
Note: See TracChangeset
for help on using the changeset viewer.