Browse Source

Fixed File manger css overflow bug

Toby Chui 1 year ago
parent
commit
9a04e5ce2f

+ 2 - 2
agi-doc.md

@@ -340,8 +340,8 @@ deleteDBItem("tablename", "key");
 
 ```
 registerModule(JSON.stringify(moduleLaunchInfo)); //See moduleLaunchInfo in the sections above
-requirepkg("ffmpeg");
-execpkg("ffmpeg",'-i "files/users/TC/Desktop/群青.mp3" "files/users/TC/Desktop/群青.flac'); //ffmpeg must be required() before use
+[deprecated] requirepkg("ffmpeg");
+[deprecated] execpkg("ffmpeg",'-i "files/users/TC/Desktop/群青.mp3" "files/users/TC/Desktop/群青.flac'); //ffmpeg must be required() before use
 ```
 
 #### Structure & OOP

+ 2 - 6
mod/agi/agi.appdata.go

@@ -20,7 +20,7 @@ import (
 	This library allow agi script to access files located in the web root
 	*This library provide READ ONLY function*
 	You cannot write to web folder due to security reasons. If you need to read write
-	web root (which is not recommended), ask the user to mount it top web:/ manually
+	web root (which is not recommended), ask the user to mount it to web:/ manually
 */
 
 var webRoot string = "./web" //The web folder root
@@ -34,11 +34,7 @@ func (g *Gateway) AppdataLibRegister() {
 
 func (g *Gateway) injectAppdataLibFunctions(payload *static.AgiLibInjectionPayload) {
 	vm := payload.VM
-	//u := payload.User
-	//scriptFsh := payload.ScriptFsh
-	//scriptPath := payload.ScriptPath
-	//w := payload.Writer
-	//r := payload.Request
+
 	vm.Set("_appdata_readfile", func(call otto.FunctionCall) otto.Value {
 		relpath, err := call.Argument(0).ToString()
 		if err != nil {

+ 3 - 1
mod/agi/agi.go

@@ -132,7 +132,9 @@ func (g *Gateway) InitiateAllWebAppModules() {
 
 		//Only allow non user based operations
 		g.injectStandardLibs(vm, script, "./web/")
-
+		g.injectAppdataLibFunctions(&static.AgiLibInjectionPayload{
+			VM: vm,
+		})
 		_, err := vm.Run(scriptContent)
 		if err != nil {
 			log.Println("[AGI] Load Failed: " + script + ". Skipping.")

+ 6 - 0
web/Dummy/backend/helloworld.js

@@ -0,0 +1,6 @@
+//Send Hello World as response
+if (typeof(NAME) != "undefined"){
+    sendResp("Hello World! Welcome " + NAME);
+}else{
+    sendResp("Hello there!");
+}

+ 95 - 84
web/Dummy/index.html

@@ -1,85 +1,96 @@
-<!DOCTYPE html>
-<html>
-    <head>
-        <meta name="apple-mobile-web-app-capable" content="yes" />
-        <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"/>
-        <meta charset="UTF-8">
-        <meta name="theme-color" content="#4b75ff">
-        <link rel="stylesheet" href="../script/semantic/semantic.min.css">
-        <script src="../script/jquery.min.js"></script>
-        <script src="../script/ao_module.js"></script>
-        <script src="../script/semantic/semantic.min.js"></script>
-        <title>Dummy</title>
-        <style>
-            body{
-                background-color:white;
-            }
-        </style>
-    </head>
-    <body>
-        <br><br>
-        <div class="ui container">
-            <h3>This is a Dummy Testing Module</h3>
-            <p>Received drag-in filelist (if any)</p>
-            <span id="flist"></span>
-            <div class="ui divider"></div>
-            <p>Try open an IME and type something</p>
-            <input class="ui fluid input" val="Test"></input>
-            <br>
-            <textarea></textarea>
-            <br>
-            <button class="ui blue button" onClick="pinWindow();">Pin Window</button>
-            <button class="ui blue button" onClick="unpinWindow();">Unpin Window</button>
-            <button class="ui primary button" onclick="openfileselector();">Open File Selector New Mode</button>
-            <button class="ui negative button" onClick="ao_module_close();">Close Window</button>
-        </div>
-        <script>
-            var flist = ao_module_loadInputFiles();
-            if (flist == null){
-                $("#flist").text("No input file");
-            }else{
-                for (var i =0; i < flist.length; i++){
-                    $("#flist").append(flist[i].filename + " / " + flist[i].filepath + "<br>");
-                }
-            }
-
-            function openfileselector(){
-                ao_module_openFileSelector(fileLoader, "user:/Desktop/",type="new",true, {
-                    defaultName: "New File.txt"
-                })
-            }
-
-            //Test to pin this window to topmost
-            function pinWindow(){
-                ao_module_setTopMost();
-            }
-
-            function unpinWindow(){
-                ao_module_unsetTopMost();
-            }
-
-            function fileLoader(filedata){
-                if (filedata.length == 0){
-                    $("#flist").text("No file selected");
-                    return;
-                }
-                $("#flist").html("");
-                for (var i =0; i < filedata.length; i++){
-                    $("#flist").append(filedata[i].filename + " / " + filedata[i].filepath + "<br>");
-                }
-            }
-
-            function testRunScript(){
-                var script = "Dummy/backend/getParamters.js";
-                $.ajax({
-                    url: "../system/ajgi/interface?script=" + script,
-                    data: {foo: "Hello", bar: "World"},
-                    method: "POST",
-                    success: function(data){
-                        console.log(data);
-                    }
-                })
-            }
-        </script>
-    </body>
+<!DOCTYPE html>
+<html>
+    <head>
+        <meta name="apple-mobile-web-app-capable" content="yes" />
+        <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"/>
+        <meta charset="UTF-8">
+        <meta name="theme-color" content="#4b75ff">
+        <link rel="stylesheet" href="../script/semantic/semantic.min.css">
+        <script src="../script/jquery.min.js"></script>
+        <script src="../script/ao_module.js"></script>
+        <script src="../script/semantic/semantic.min.js"></script>
+        <title>Dummy</title>
+        <style>
+            body{
+                background-color:white;
+            }
+        </style>
+    </head>
+    <body>
+        <br><br>
+        <div class="ui container">
+            <h3>This is a Dummy Testing Module</h3>
+            <p>Received drag-in filelist (if any)</p>
+            <span id="flist"></span>
+            <div class="ui divider"></div>
+            <p>Try open an IME and type something</p>
+            <input class="ui fluid input" val="Test"></input>
+            <br>
+            <textarea></textarea>
+            <br>
+            <button class="ui blue button" onclick="test()">Click Me</button>
+            <button class="ui blue button" onClick="pinWindow();">Pin Window</button>
+            <button class="ui blue button" onClick="unpinWindow();">Unpin Window</button>
+            <button class="ui primary button" onclick="openfileselector();">Open File Selector New Mode</button>
+            <button class="ui negative button" onClick="ao_module_close();">Close Window</button>
+        </div>
+        <script>
+            function test(){
+                ao_module_agirun("Dummy/backend/helloworld.js", {
+                    NAME: "Toby"
+                }, function(resp){
+                    alert(resp);
+                },function(){
+                    alert("Oops. Something went wrong!")
+                },
+                300);
+            }
+            var flist = ao_module_loadInputFiles();
+            if (flist == null){
+                $("#flist").text("No input file");
+            }else{
+                for (var i =0; i < flist.length; i++){
+                    $("#flist").append(flist[i].filename + " / " + flist[i].filepath + "<br>");
+                }
+            }
+
+            function openfileselector(){
+                ao_module_openFileSelector(fileLoader, "user:/Desktop/",type="new",true, {
+                    defaultName: "New File.txt"
+                })
+            }
+
+            //Test to pin this window to topmost
+            function pinWindow(){
+                ao_module_setTopMost();
+            }
+
+            function unpinWindow(){
+                ao_module_unsetTopMost();
+            }
+
+            function fileLoader(filedata){
+                if (filedata.length == 0){
+                    $("#flist").text("No file selected");
+                    return;
+                }
+                $("#flist").html("");
+                for (var i =0; i < filedata.length; i++){
+                    $("#flist").append(filedata[i].filename + " / " + filedata[i].filepath + "<br>");
+                }
+            }
+
+            function testRunScript(){
+                var script = "Dummy/backend/getParamters.js";
+                $.ajax({
+                    url: "../system/ajgi/interface?script=" + script,
+                    data: {foo: "Hello", bar: "World"},
+                    method: "POST",
+                    success: function(data){
+                        console.log(data);
+                    }
+                })
+            }
+        </script>
+    </body>
 </html>

+ 2 - 1
web/SystemAO/file_system/file_explorer.css

@@ -312,9 +312,10 @@ body.darkTheme .ui.icon.button{
 .ui.selection.dropdown{
     background-color: var(--dropdown_bg) !important;
     color: var(--dropdown_txt) !important;
-    min-width: 13em !important;
+    min-width: 11.5em !important;
 }
 
+
 /* special case when using in mobile sidebar */
 #mobileSortDropdown .ui.selection.dropdown{
     width: 100%;

+ 2 - 2
web/SystemAO/file_system/file_explorer.html

@@ -32,7 +32,7 @@
             <button class="fileOprBtn tabletAndDesktopOnly" title="Copy" onclick="copy();"><img class="opricon" src="img/opr/copy.svg"><p class="oprtxt" locale="fileopr/Copy">Copy</p></button>
             <button class="fileOprBtn tabletAndDesktopOnly" title="Paste" onclick="paste();"><img class="opricon" src="img/opr/paste.svg"><p class="oprtxt" locale="fileopr/Paste">Paste</p></button>
             <div class="fileoprGroupDivider tabletAndDesktopOnly" style="display: inline-block; vertical-align: top;">
-                <button class="fileoprSmallBtn" title="Open with" onclick="openWith();"><i class="external icon"></i> <span locale="fileopr/Open with">Open With</span></button><br>
+                <button class="fileoprSmallBtn" title="Open with" onclick="openWith();"><i class="external icon"></i> <span locale="fileopr/Open with" style="font-size: 0.9em !important;">Open With</span></button><br>
                 <button class="fileoprSmallBtn" title="Cut" onclick="cut();"><i class="blue cut icon"></i> <span locale="fileopr/Cut">Cut</span></button><br>
                 <button class="fileoprSmallBtn" title="Rename" onclick="rename();"><i class="teal i cursor icon"></i> <span locale="fileopr/Rename">Rename</span></button>
             </div>
@@ -57,7 +57,7 @@
                 <i class="ui large bars icon"></i>
             </button>
             <div style="display: inline-block; vertical-align: top;">
-                <select id="sortingMethodSelector" title="Sorting Method" class="ui basic borderless mini dropdown" onchange="updateSortingMethods();" autocomplete="off" style="min-width: 10em;">
+                <select id="sortingMethodSelector" title="Sorting Method" class="ui basic borderless mini dropdown" onchange="updateSortingMethods();" autocomplete="off" style="min-width: 10em !important;">
                     <option value="default" locale="menu/sort/asc">Ascending</option>
                     <option value="reverse" locale="menu/sort/desc">Descending</option>
                     <option value="smallToLarge" locale="menu/sort/small">Smallest</option>