|
|
@@ -0,0 +1,130 @@
|
|
|
+["WebApp 開啟方式"]
|
|
|
+# WebApp 開啟方式
|
|
|
+ArOZ Online WebApps 有時可能需要從檔案總管開啟檔案,而系統有3個方式來開啟檔案。
|
|
|
+
|
|
|
+1. 直接開啟模式 - 如普通網站一樣打開。
|
|
|
+2. 浮動視窗開啟模式 - 使用FloatWinow.php和特定參數來打開網頁。
|
|
|
+3. 嵌入式開啟模式 - 使特定參數開啟檔案。
|
|
|
+
|
|
|
+## 開啟方式
|
|
|
+### 直接開啟
|
|
|
+這種模式是直接使用index.php或index.html來顯示。就像普通網站一樣,不過可能會因程式沒有檢查VDI模式而錯誤地把使用者帶回主頁。
|
|
|
+
|
|
|
+### 浮動視窗開啟模式
|
|
|
+當然使用桌面圖示啟動WebApp時。 FloatWindow.php將會接收參數,而php 將加載至iframe中,你應該使用ao_module的功能來處理要求。
|
|
|
+以下是FloatWindow.php的範例。
|
|
|
+
|
|
|
+```
|
|
|
+<?php
|
|
|
+include_once '../auth.php';
|
|
|
+?>
|
|
|
+<html>
|
|
|
+<body>
|
|
|
+Now Loading...
|
|
|
+<script src="FloatWindow.js"></script>
|
|
|
+<script>
|
|
|
+var uid = (new Date()).getTime();
|
|
|
+var fw = new FloatWindow("index.php?mode=fw","Audio","music", uid,545,765,undefined,undefined,undefined,true);
|
|
|
+fw.launch();
|
|
|
+</script>
|
|
|
+</body>
|
|
|
+</html>
|
|
|
+```
|
|
|
+
|
|
|
+以下是FloatWindow.js的範例。
|
|
|
+
|
|
|
+```
|
|
|
+class FloatWindow {
|
|
|
+ constructor(src, title, iconTag="folder", uid ,ww=undefined, wh=undefined, posx=undefined, posy=undefined, resizable=true, glassEffect=false) {
|
|
|
+ this.src = location.href.replace(/[^/]*$/, '') + src;
|
|
|
+ this.title = title;
|
|
|
+ this.iconTag = iconTag;
|
|
|
+ this.uid = uid;
|
|
|
+ this.ww = ww;
|
|
|
+ this.wh = wh;
|
|
|
+ this.posx = posx;
|
|
|
+ this.posy = posy;
|
|
|
+ this.resizable = resizable;
|
|
|
+ this.glassEffect = glassEffect;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Method
|
|
|
+ launch() {
|
|
|
+ parent.newEmbededWindow(this.src,this.title,this.iconTag,this.uid,this.ww,this.wh,this.posx,this.posy,this.resizable,this.glassEffect);
|
|
|
+ //console.log(this.src,this.title,this.iconTag,this.uid,this.ww,this.wh,this.posx,this.posy,this.resizable,this.glassEffect);
|
|
|
+ }
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+有關浮動視窗的更多詳細信息,請參見"Float Winodow"頁面。
|
|
|
+
|
|
|
+### 嵌入式開啟模式
|
|
|
+嵌入式開啟模式(或另一個眾所周知的術語:使用{...}打開{...}是允許模組打開文件的其中一個功能。
|
|
|
+這個功能需要```index.php```和```embedded.php```。 開發人員可以使用其中一個程式來執行文件打開要求。 在大部份情況下有兩種開啟方法。
|
|
|
+
|
|
|
+#### 在虛擬桌面模式下打開嵌入式神窗
|
|
|
+
|
|
|
+在VDI模式下,桌面上的文件需要```embedded.php```來啟動。
|
|
|
+文件名和文件路徑可以從兩個get參數```filename```和```filepath```取得。
|
|
|
+
|
|
|
+ - filename:人類可讀格式的文件名。 這可能是空的,僅供程式參考。
|
|
|
+ - filepath:來自/ AOR的文件的相對路徑。
|
|
|
+
|
|
|
+這是一個範例php,用於從參數接收文件名和文件路徑。
|
|
|
+
|
|
|
+```
|
|
|
+<?php
|
|
|
+$filepath = "";
|
|
|
+$filename = "";
|
|
|
+if (isset($_GET['filepath'])){
|
|
|
+ $filepath = str_replace("./","",str_replace("../","",str_replace("\\","/",$_GET['filepath'])));
|
|
|
+}
|
|
|
+if (isset($_GET['filename'])){
|
|
|
+ $filename = $_GET['filename'];
|
|
|
+}
|
|
|
+?>
|
|
|
+```
|
|
|
+
|
|
|
+如果你想使用單獨的php來處理外部文件參數,您可以在embedded.php中建立處理接口,並在index.php中添加以下代碼,以令到文件可以正確打開 - 並重定向到embedded.php。
|
|
|
+
|
|
|
+```
|
|
|
+if (isset($_GET['filepath'])){
|
|
|
+ header("Location: embedded.php?filepath=" . $_GET['filepath']);
|
|
|
+}
|
|
|
+
|
|
|
+```
|
|
|
+
|
|
|
+#### 在檔案總管上打開
|
|
|
+如果用戶在檔案總管上要求嵌入式模式,要求將被傳送到index.php而非embedded.php。 在這種情況下,用戶可以選擇將要求重定向到embedded.php或在index.php中處理。 在大多數情況下,我們建議將要求從index.php重定向到embedded.php或從embedded.php重定向到index.php,因為這能有效降低WebApp的開發成本。
|
|
|
+
|
|
|
+值得注意的是,在大部份情況下,用戶將以VDI模式或普通模式啟動WebApp,在這兩種情況下,開發人員都應檢查VDI模式以安排WebApp介面。
|
|
|
+
|
|
|
+#### Background Worker (Deprecated)
|
|
|
+Provide background worker function with ```backgroundworker.php```. This access method is no longer used since BETA phrase.
|
|
|
+
|
|
|
+###傳入路徑
|
|
|
+filepath參數將提供**相對於/ AOR的文件位置或來自/ media / **的絕對路徑。 您的WebApp模組可能會接收三種之中任何類型的路徑。
|
|
|
+
|
|
|
+1.內部文件路徑,以```./```(aka / AOR)開頭,例如```./Video/Uploads/ test.mp3```
|
|
|
+2.extDiskAccess處理的外置儲存裝備文件路徑,以``./SystemAOB/functions/extDiskAccess.php?file = ...```開頭。
|
|
|
+3.沒有extDiskAccess處理的外置儲存裝備文件路徑,例如```/media/Storage1/ test.mp3```
|
|
|
+
|
|
|
+對於類型1和類型2,您可以通過將文件路徑放在```src```元素中直接將它們加載。
|
|
|
+但是,對於類型3文件路徑,您將需要使用``.SystemAOB/functions/extDiskAccess.php?file =```調用外部儲存空間處理功能,然後輸人文件的絕對路徑。
|
|
|
+
|
|
|
+以下是影片模組引用的文件路徑示例
|
|
|
+
|
|
|
+```
|
|
|
+if (file_exists($_GET['filepath'])|| strpos($_GET['filepath'],"extDiskAccess.php")){
|
|
|
+ echo '<video id="player" style="position:fixed; height:100%; max-width:100% ;top:0; left:0;" src="'.$_GET['filepath'].'" autoplay controls></video>';
|
|
|
+ $filename = basename($_GET['filepath'], ".mp4");
|
|
|
+ if (ctype_xdigit(str_replace("inith","",$filename)) && strlen(str_replace("inith","",$filename)) % 2 == 0) {
|
|
|
+ $decodedName = hex2bin(str_replace("inith","",$filename));
|
|
|
+ }else{
|
|
|
+ $decodedName = $filename;
|
|
|
+ }
|
|
|
+}else{
|
|
|
+ die('<i class="remove icon"></i>API call error: 404 File not found.');
|
|
|
+}
|
|
|
+```
|
|
|
+
|