Răsfoiți Sursa

Merge branch 'Dev' of http://10.1.1.202:3030/steve07s/BIM-Monitor into Dev

steve07s 3 ani în urmă
părinte
comite
7c6c1070f3
3 a modificat fișierele cu 83 adăugiri și 1 ștergeri
  1. 46 0
      script/js/jstreeAJAX.js
  2. 3 1
      script/php/captcha.php
  3. 34 0
      script/php/treeJs_getPath.php

+ 46 - 0
script/js/jstreeAJAX.js

@@ -0,0 +1,46 @@
+$('#treeAjaxHTML').jstree({
+    'core': {
+        'themes': {
+            'responsive': false
+        },
+        'check_callback': true,
+        'data': {
+            'url': './script/php/treeJs_getPath.php',
+        }
+    },
+    'types': {
+        'default': {
+            'icon': 'fa fa-folder'
+        },
+        'file': {
+            'icon': 'fa fa-file'
+        }
+    },
+    'plugins': ['types']
+}).on(
+    'select_node.jstree',
+    function (event, data) {
+
+        if (data.node.text.includes(".")) {
+
+            window.location.href = data.node.a_attr.href;
+            //console.log(data);
+        }
+
+
+    }).bind('loaded.jstree', function (e, data) {
+    // invoked after jstree has loaded
+    $('.jstree-anchor').each(function (index) {
+        if ($(this).attr('href').includes(".dll") || $(this).attr('href').includes(".dyn")) {
+            api = $(this).attr('href');
+        }
+    });
+    if (api != null) {
+        var fileNames = api.split("/");
+        fileName = fileNames[fileNames.length - 1];
+        $("#api").attr("href", api)
+        $("#api").append(fileName);
+    }
+
+
+});

+ 3 - 1
script/php/captcha.php

@@ -21,8 +21,10 @@ function imgcode($nums, $width, $high)
 {
 
     //去除了數字0和1 字母小寫O和L,為了避免辨識不清楚
+
+    $str = "1234567890";
     //$str = "23456789abcdefghijkmnpqrstuvwxyzABCDEFGHIJKLMOPQRSTUBWXYZ";
-	$str = "1234567890";
+
     $code = '';
     for ($i = 0; $i < $nums; $i++) {
         $code .= $str[mt_rand(0, strlen($str) - 1)];

+ 34 - 0
script/php/treeJs_getPath.php

@@ -0,0 +1,34 @@
+<?php
+
+$root = '../../assets';
+//$folder = $_GET["folder"];
+
+FindPath($root,'建置資料');
+function FindPath($root,$folder){
+    $rootPath = $root."/".$folder;
+    $paths = array_diff(scandir($rootPath), array('.', '..','Thumbs.db')); 
+    echo("<ul>");
+    foreach($paths as $path){
+        
+        if(str_contains($path,'.')){
+            
+                echo("<li data-jstree='{ ".'"type" : "file"'." }' >");
+                $path = "<a href='".substr($rootPath,0)."/".$path."'>".$path."</a>";            
+                echo($path);
+                echo("</li>");
+            
+           
+        }else{
+            echo("<li>");
+            echo($path);
+            FindPath($rootPath,$path);
+            echo("</li>");
+        }
+        
+        
+        
+
+    }
+    echo("</ul>");
+}
+?>