Index: branches/testa/php/content.php
===================================================================
--- branches/testa/php/content.php	(revision 25)
+++ branches/testa/php/content.php	(revision 27)
@@ -12,6 +12,6 @@
 function get_url_data_array()
 {
-        $yaml= spyc_load_file( dirname(__FILE__) . "/../settings.yml");// ☆の部分にはyamlファイルがあるパスを入れます
-        return $yaml;
+    $yaml= spyc_load_file( dirname(__FILE__) . "/../settings.yml");// ☆の部分にはyamlファイルがあるパスを入れます
+    return $yaml;
 }
 
@@ -33,12 +33,38 @@
 }
 
-function get_path_from_url_data( $num ){
-    return get_url_data( $num )['path'];
-}
-
-function get_path_list_by_url( $num ){
-    $pattern = "*.md";
-    $top_path = get_path_from_url_data($num);
-    $cmd_line_items = array("find" , $top_path , "-name", $pattern);
+function get_path_from_url_data( $num , $part){
+    switch($part){
+    case 'data':
+        $ret = get_url_data( $num )['path'];
+        break;
+    case 'setting':
+        $ret = get_url_data( $num )['setting_path'];
+        break;
+    case 'output':
+        $ret = get_url_data( $num )['output_path'];
+        break;
+    default:
+        //exit(200);
+        echo "get_path_from_url_data " . $part . "<br>";
+    }
+
+    return $ret;
+}
+
+function get_path_list_by_url( $num , $part){
+    $top_path = get_path_from_url_data($num, $part);
+
+    switch($part){
+    case 'data':
+        $pattern = "*.md";
+        $cmd_line_items = array("find" , $top_path , "-name", $pattern);
+        break;
+    case 'setting':
+        $cmd_line_items = array("find" , $top_path , "-type", "f");
+        break;
+    default:
+        echo "get_path_list_by_url=" . $part . "<br>";
+        exit(100);
+    }
     $cmd_line = implode(" " , $cmd_line_items);
 
@@ -67,5 +93,5 @@
         }
         echo $v . "||(" . strlen($v) . ")\n";
-   }
+    }
 }
 
@@ -81,19 +107,28 @@
 }
 
-function get_path_info( $num ){
-    $path_info = get_path_list_by_url( $num );
+function get_path_info( $num , $part){
+    $path_info = get_path_list_by_url( $num , $part);
     $pathinfo = new ns\PathInfo($path_info["top_path"]);
-#    $pathinfo = new PathInfo($path_info["top_path"]);
     foreach($path_info["file_list"] as $path){
         $pathinfo->register($path);
     }
     return $pathinfo->pathinfo_list_in_json();
-#    $pathinfo->dump();
-#    $pathinfo->dump_root();
-#    dump_hier_list($pathinfo);
-}
-
-function print_get_path_info( $num ){
-    echo get_path_info( $num );
+}
+
+function get_setting_path_info( $num ){
+    $path_info = get_setting_path_list_by_url( $num );
+    $pathinfo = new ns\PathInfo($path_info["top_path"]);
+    foreach($path_info["file_list"] as $path){
+        $pathinfo->register($path);
+    }
+    return $pathinfo->pathinfo_list_in_json();
+}
+
+function print_get_path_info( $num ,$part){
+    echo get_path_info( $num , $part);
+}
+
+function print_get_setting_path_info( $num ){
+    echo get_setting_path_info( $num );
 }
 
@@ -113,6 +148,6 @@
 }
 
-function get_content( $num , $path ) {
-    $top_dir = get_path_from_url_data( $num );
+function get_content( $num , $path , $part) {
+    $top_dir = get_path_from_url_data( $num , $part);
     $full_path = implode( '/', [$top_dir, $path]);
     $result = input_file( $full_path );
@@ -121,6 +156,5 @@
 
 function cmdx(){
-    $filelist_filename = "filelist.json";
-    $setting_filelist_filename = "setting-filelist.json";
+    $filelist_filename = array("data"=> "filelist.json", "setting"=> "setting-filelist.json");
     $storage_dir = dirname(__FILE__) . '/../storage';
 
@@ -130,69 +164,88 @@
         if (isset($_GET['num'])) {
             $num = $_GET['num'];
-
-            switch ($cmd) {
-            case 'get_setting_filelist':
-                $path = ensure_storage_dir( $storage_dir , $num, $setting_filelist_filename );
-                if( file_exists($path) ){
-                    $content = input_file( $path );
+            if (isset($_GET['part'])) {
+                $part = $_GET['part'];
+
+                switch ($cmd) {
+                case 'update_setting_filelist':
+                    $path = ensure_storage_dir( $storage_dir , $num, $setting_filelist_filename );
+                    $content = get_setting_path_info( $num );
+                    output_file( $path , $content );
+                    break;
+                case 'get_setting_filelist':
+                    $path = ensure_storage_dir( $storage_dir , $num, $setting_filelist_filename );
+                    if( file_exists($path) ){
+                        $content = input_file( $path );
+                    }
+                    else {
+                        $content = get_setting_path_info( $num );
+                        output_file( $path , $content );
+                    }
+                    break;
+                case 'get_setting_content':
+                    if (isset($_GET['path'])) {
+                        $path = $_GET['path'];
+                        $content = get_setting_content( $num , $path );
+                    }
+                    break;
+                case 'build':
+                    break;
+                case 'get_content':
+                    if (isset($_GET['path'])) {
+                        $path = $_GET['path'];
+                        $content = get_content( $num , $path , $part );
+                    }
+                    break;
+                case 'update_filelistx':
+                    $path = ensure_storage_dir( $storage_dir , $num, $filelist_filename[$part] );
+                    $content = get_path_info( $num , $part);
+                    output_file( $path , $content );
+                    break;
+                case 'get_filelistx':
+                    $path = ensure_storage_dir( $storage_dir , $num, $filelist_filename[$part] );
+                    if( file_exists($path) ){
+                        $content = input_file( $path );
+                    }
+                    else {
+                        $content = get_path_info( $num , $part);
+                        output_file( $path , $content );
+                    }
+                    break;
+                default:
+                    break;
                 }
-                else {
-                    $content = get_path_info( $num );
-                    output_file( $path , $content );
-                }
-                break;
-            case 'build':
-                break;
-            case 'get_content':
-                if (isset($_GET['path'])) {
-                    $path = $_GET['path'];
-                    $content = get_content( $num , $path );
-                }
-                break;
-            case 'update_filelist':
-                $path = ensure_storage_dir( $storage_dir , $num, $filelist_filename );
-                $content = get_path_info( $num );
-                output_file( $path , $content );
-                break;
-            case 'get_filelist':
-                $path = ensure_storage_dir( $storage_dir , $num, $filelist_filename );
-                if( file_exists($path) ){
-                    $content = input_file( $path );
-                }
-                else {
-                    $content = get_path_info( $num );
-                    output_file( $path , $content );
-                }
-                break;
-            default:
-                break;
             }
         }
     }
+
     elseif (isset($_POST['cmd'])) {
         $cmd = $_POST['cmd'];
         if (isset($_POST['num'])) {
             $num = $_POST['num'];
-
-            switch ($cmd) {
-            case 'upload_content':
-                $array = get_lines_from_formdata( "mytext" );
-                $upload_content = implode( "\n" , $array );
-                if (isset($_POST['path'])) {
-                    $path = $_POST['path'];
-                    $top_path = get_path_from_url_data( $num );
-                    $filename_abs_path = $top_path . DIRECTORY_SEPARATOR . $path;
-
-                    output_file( $filename_abs_path , $upload_content );
-                    $content = "P-UPLOAD_CONTENT-OK=" . $filename_abs_path;
+            if (isset($_POST['part'])) {
+                $part = $_POST['part'];
+
+
+                switch ($cmd) {
+                case 'upload_content':
+                    $array = get_lines_from_formdata( "mytext" );
+                    $upload_content = implode( "\n" , $array );
+                    if (isset($_POST['path'])) {
+                        $path = $_POST['path'];
+                        $top_path = get_path_from_url_data( $num , $part);
+                        $filename_abs_path = $top_path . DIRECTORY_SEPARATOR . $path;
+                        
+                        output_file( $filename_abs_path , $upload_content );
+                        $content = "P-UPLOAD_CONTENT-OK=" . $filename_abs_path;
+                    }
+                    else{
+                        $content = "P-UPLOAD_CONTENT-NO-PATH";
+                    }
+                    
+                default:
+                    debug_x("P-DEFAULT");
+                    /* $content = "P-DEFAULT";*/
+                    break;
                 }
-                else{
-                    $content = "P-UPLOAD_CONTENT-NO-PATH";
-                }
-
-            default:
-                debug_x("P-DEFAULT");
-                /* $content = "P-DEFAULT";*/
-                break;
             }
         }
@@ -221,4 +274,10 @@
 #print_get_path_info( 0 );
 #print_get_path_info( 1 );
+#dump_url_data( 0 );
+#echo( get_setting_path_from_url_data( 0 ) );
+#var_dump( get_setting_path_list_by_url( 0 ) );
+#echo( get_setting_path_info( 0 ) );
+#print_get_setting_path_info( 0 );
+
 cmdx();
 
