Changeset 67 for branches/testa-single-bookmark
- Timestamp:
- Sep 5, 2019 9:42:27 AM (6 years ago)
- Location:
- branches/testa-single-bookmark
- Files:
-
- 8 edited
-
index.html (modified) (2 diffs)
-
js/build.js (modified) (3 diffs)
-
js/main.js (modified) (2 diffs)
-
js/remotex.js (modified) (1 diff)
-
js/sidemenu.js (modified) (4 diffs)
-
php/content3.php (modified) (16 diffs)
-
tmp/num.txt (modified) (previous)
-
tmp/tmp.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/testa-single-bookmark/index.html
r65 r67 8 8 <link rel="stylesheet" href="./css/style.css" /> 9 9 <link href='https://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'> 10 <link rel="stylesheet" href="css/style-3.css?1 46">11 <link rel="stylesheet" href="css/tab.css?1 46">12 <link rel="stylesheet" href="css/menu.css?1 46">10 <link rel="stylesheet" href="css/style-3.css?170"> 11 <link rel="stylesheet" href="css/tab.css?170"> 12 <link rel="stylesheet" href="css/menu.css?170"> 13 13 <link href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet" /> 14 14 <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> 15 15 <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script> 16 16 <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.5/ace.js"></script> 17 <script src="js/storagex.js?1 46>"></script>18 <script src="js/sidemenu.js?1 46>"></script>19 <script src="js/bookmark.js?1 46>"></script>20 <script src="js/bookmarkmgr.js?1 46"></script>21 <script src="js/bookmarkmenu.js?1 46"></script>22 <script src="js/tab.js?1 46"></script>23 <script src="js/topmenu.js?1 46"></script>24 <script src="js/remotex.js?1 46"></script>25 <script src="js/build.js?1 46"></script>26 <script src="js/main.js?1 46"></script>17 <script src="js/storagex.js?170>"></script> 18 <script src="js/sidemenu.js?170>"></script> 19 <script src="js/bookmark.js?170>"></script> 20 <script src="js/bookmarkmgr.js?170"></script> 21 <script src="js/bookmarkmenu.js?170"></script> 22 <script src="js/tab.js?170"></script> 23 <script src="js/topmenu.js?170"></script> 24 <script src="js/remotex.js?170"></script> 25 <script src="js/build.js?170"></script> 26 <script src="js/main.js?170"></script> 27 27 28 28 <!-- AREA-END --> … … 238 238 </script> 239 239 </body> 240 </html>241 242 243 244 -
branches/testa-single-bookmark/js/build.js
r66 r67 1 1 class Build { 2 2 constructor(){ 3 }4 5 set_anchor_url( part, item_name, href, text , kind){6 if( href === undefined ){7 href = ""8 }9 Globalx.output_url_listx[text] = href10 Globalx[part].sidemenu.set_anchor_down_url( item_name, href, text , kind)11 3 } 12 4 … … 18 10 const content = textarea.val() 19 11 20 this.set_anchor_url( part, Globalx[part].item_name, "", "" , "full") 21 this.set_anchor_url( part, Globalx[part].item_name, "", "" , "partial") 12 let words = Globalx[part].item_name.split('.') 13 let base = words[0] 14 Globalx[part].sidemenu.set_anchor_url( part, base, "", "" , "full") 15 Globalx[part].sidemenu.set_anchor_url( part, base, "", "" , "partial") 22 16 23 17 Globalx.remotex.upload_file( cmd, Globalx.num, part, Globalx[part].key, content , (data) => { … … 27 21 console.log("partial_download_url=" + obj["partial_download_url"]) 28 22 29 this.set_anchor_url( part, Globalx[part].item_name, obj["full_download_url"], Globalx[part].item_name, "full")30 this.set_anchor_url( part, Globalx[part].item_name, obj["partial_download_url"], Globalx[part].item_name, "partial")23 Globalx[part].sidemenu.set_anchor_url( part, base, obj["full_download_url"], Globalx[part].item_name, "full") 24 Globalx[part].sidemenu.set_anchor_url( part, base, obj["partial_download_url"], Globalx[part].item_name, "partial") 31 25 } 32 26 else{ -
branches/testa-single-bookmark/js/main.js
r66 r67 45 45 } 46 46 47 function set_output_url_listx(text){ 48 if( text.match( /{.*}/ ) !== null ){ 49 const obj = JSON.parse( text ) 50 //console.log("update_all_info_on_host text=" + text ) 51 Globalx.output_url_listx = {} 52 obj["htmlfname"].forEach( (item) => { 53 let words = item.full.split('.') 54 let base = words[0] 55 Globalx.output_url_listx[ base ] = {} 56 Globalx.output_url_listx[ base ].full = `${obj["output_url"]}/${item.full}` 57 Globalx.output_url_listx[ base ].partial = `${obj["output_url"]}/${item.partial}` 58 console.log(`${words[0].full}=${ Globalx.output_url_listx[ base ].full }`) 59 console.log(`${words[0].partial}=${ Globalx.output_url_listx[ base ].partial }`) 60 } ) 61 Globalx.storagex.save_as_info_from_globalx() 62 } 63 } 64 47 65 async function update_all_info_on_host_async( ) { 48 await Globalx.remotex.get_output_url_listx( Globalx.num , (text) => { 49 if( text.match( /{.*}/ ) !== null ){ 50 const obj = JSON.parse( text ) 51 //console.log("update_all_info_on_host text=" + text ) 52 Globalx.output_url_listx = obj 53 Globalx.storagex.save_as_info_from_globalx() 54 } 66 await Globalx.remotex.update_output_url_listx( Globalx.num , (text) => { 67 set_output_url_listx(text) 55 68 } ) 56 69 … … 86 99 async function get_output_url_listx_async( num ) { 87 100 await Globalx.remotex.get_output_url_listx( num , (text) => { 88 if( text.match( /{.*}/ ) !== null ){ 89 const obj = JSON.parse( text ) 90 //console.log("update_all_info_on_host text=" + text ) 91 Globalx.output_url_listx = obj 92 Globalx.storagex.save_as_info_from_globalx() 93 } 101 set_output_url_listx(text) 94 102 } ) 95 103 } 104 96 105 async function setup(){ 97 106 await get_output_url_listx_async( Globalx.num ) 98 await get_output_url( Globalx.num )107 // await get_output_url( Globalx.num ) 99 108 } 100 109 -
branches/testa-single-bookmark/js/remotex.js
r66 r67 38 38 async get_output_url_listx( num, func) { 39 39 let param_array = [['cmd', 'get_output_url_listx'] , ['num', num]] 40 await this.fetchx( this.filename , param_array, 2, func ) 41 } 42 43 async update_output_url_listx( num, func) { 44 let param_array = [['cmd', 'update_output_url_listx'] , ['num', num]] 40 45 await this.fetchx( this.filename , param_array, 2, func ) 41 46 } -
branches/testa-single-bookmark/js/sidemenu.js
r66 r67 83 83 Globalx[part].editor.getSession().setValue( "" ); 84 84 85 let words = Globalx[part].item_name.split('.') 86 let base = words[0] 85 87 $( this.textarea_sel ).val( "" ); 86 this.set_anchor_url( part, Globalx[part].item_name, "", "" , "full")87 this.set_anchor_url( part, Globalx[part].item_name, "", "" , "partial")88 this.set_anchor_url( part, base, "", "" , "full") 89 this.set_anchor_url( part, base, "", "" , "partial") 88 90 89 91 if( Globalx[part].key != '/' ){ … … 128 130 129 131 if( jsondata !== undefined && jsondata[Globalx[part].key] !== undefined ){ 132 let words = item_name.split('.') 133 let base = words[0] 130 134 if( jsondata[Globalx[part].key].length == 0 ){ 131 135 Globalx[part].key_indicate_file = true; 132 136 console.log("Globalx[" + part + "].key_indicate_file = " + Globalx[part].key_indicate_file) 133 let url = "" 137 let url = Globalx.output_url_listx[base].full 138 console.log( "item_name="+item_name ) 139 console.log( "base="+base ) 140 console.log( "url="+url ) 134 141 $( Globalx[part].download_url_sel ).val( Globalx[part].key ) 135 142 $( Globalx[part].download_url_sel ).attr('href' , url ) … … 142 149 }); 143 150 144 this.set_anchor_down_url( item_name, Globalx.output_url_listx[item_name], item_name , "full" )145 this.set_anchor_down_url( item_name, Globalx.output_url_listx[item_name], item_name , "partial" )151 this.set_anchor_down_url( base, Globalx.output_url_listx[base].full, item_name , "full" ) 152 this.set_anchor_down_url( base, Globalx.output_url_listx[base].partial, item_name , "partial" ) 146 153 } 147 154 else{ 148 this.set_anchor_url( part, Globalx[part].item_name, "", "" , "full")149 this.set_anchor_url( part, Globalx[part].item_name, "", "" , "partial")155 this.set_anchor_url( part, base, "", "" , "full") 156 this.set_anchor_url( part, base, "", "" , "partial") 150 157 } 151 158 } … … 184 191 } 185 192 186 set_anchor_down_url( item_name, href, text , kind ){ 193 set_anchor_url( part, base, href, text , kind){ 194 if( href === undefined ){ 195 href = "" 196 } 197 if( text === "" ){ 198 Globalx[part].sidemenu.set_anchor_down_url( base, href, text , kind) 199 } 200 else{ 201 let words = text.split('.') 202 let base = words[0] 203 if( Globalx.output_url_listx[base] !== undefined ){ 204 Globalx[part].sidemenu.set_anchor_down_url( base, href, text , kind) 205 } 206 } 207 } 208 209 set_anchor_down_url( base, href, text , kind ){ 187 210 let sel = null 188 211 if( href === undefined ){ 189 212 href = "" 190 213 } 191 Globalx.output_url_listx[item_name] = href 192 214 if( href === "" ){ 215 text = "" 216 } 217 if( text !== "" ){ 218 if( kind == "full" ){ 219 Globalx.output_url_listx[base].full = href 220 } 221 else{ 222 Globalx.output_url_listx[base].partial = href 223 } 224 } 193 225 if( kind === "full" ){ 194 226 sel = this.full_download_url_sel -
branches/testa-single-bookmark/php/content3.php
r63 r67 15 15 require_once( dirname(__FILE__) . "/spyc-0.5/spyc.php"); // ★の部分にはspyc.phpを置いたパスを入れます 16 16 17 $exec_path = dirname(__FILE__) . "/.."; 17 $Top_path = dirname(__FILE__) . "/.."; 18 $Url_data = null; 19 $Url_data_array = null; 18 20 19 21 function get_url_data_array() … … 25 27 } 26 28 27 function get_url_data_array0()28 {29 $array = array(30 array('url' => 'https://toppers.jp', 'path' => '/var/www/vhosts/devconf.northern-cross.info/httpdocs/a/tmp/devconf-guest-4/tmp/md2site-x/_xtest/wtjx/t12/src') );31 32 return $array;33 }34 35 29 function get_url_data( $num ){ 36 $array = get_url_data_array();37 return $ array[$num];30 global $Url_data_array; 31 return $Url_data_array[$num]; 38 32 } 39 33 … … 43 37 44 38 function get_path_from_url_data( $num , $part){ 39 global $Url_data_array; 40 45 41 switch($part){ 46 42 case 'data': 47 $ret = get_url_data( $num )['path'];43 $ret = $Url_data_array[$num]['path']; 48 44 break; 49 45 case 'conf': 50 $ret = get_url_data( $num )['conf_path'];46 $ret = $Url_data_array[$num]['conf_path']; 51 47 break; 52 48 case 'output': 53 $ret = get_url_data( $num )['output_path'];49 $ret = $Url_data_array[$num]['output_path']; 54 50 break; 55 51 default: … … 123 119 } 124 120 125 126 121 function get_path_info( $num , $part){ 127 122 $path_info = get_path_list_by_url( $num , $part); … … 138 133 function ensure_storage_dir( $storage_dir , $num, $filename ) { 139 134 $dir = implode( "/" , array( $storage_dir , $num) ); 140 mkdir($dir); 135 if( !file_exists( $dir ) ){ 136 mkdir($dir); 137 } 141 138 $path = implode( "/" , array( $dir , $filename) ); 142 139 ensure_dir( $dir ); … … 152 149 } 153 150 154 function build_one_html( $ exec_path, $num , $md_path , $part) {151 function build_one_html( $top_path, $num , $md_path , $part) { 155 152 $pathinfo = pathinfo( $md_path ); 156 153 $md_fname = $pathinfo['basename']; … … 169 166 $output_url = $url_data["output_url"]; 170 167 171 $cmd_line_items = array( $ exec_path . "/bin/build.sh" , $bundle_path , $t, $s, $conf_path);168 $cmd_line_items = array( $top_path . "/bin/build.sh" , $bundle_path , $t, $s, $conf_path); 172 169 173 170 $cmd_line = implode(" " , $cmd_line_items); … … 191 188 192 189 function cmdx(){ 193 global $exec_path; 190 global $Top_path; 191 global $Url_data; 192 global $Url_data_array; 193 194 $Url_data_array = get_url_data_array(); 194 195 195 196 $filelist_filename = array("data"=> "filelist.json", "conf"=> "conf-filelist.json", "output" => "output-filelist.json"); 197 $output_url_filename = "output_url.json"; 196 198 # $storage_dir = dirname(__FILE__) . '/../storage'; 197 199 $storage_dir = dirname(__FILE__) . '/../storage-devconf'; … … 202 204 if (isset($_GET['num'])) { 203 205 $num = $_GET['num']; 206 207 $Url_data = get_url_data($num); 208 204 209 if (isset($_GET['part'])) { 205 210 $part = $_GET['part']; … … 237 242 $content = json_encode($info); 238 243 break; 244 case 'update_output_url_listx': 245 $content = update_output_url_list( $num ); 246 case 'get_output_url_listx': 247 $path = ensure_storage_dir( $storage_dir , $num , $output_url_filename ); 248 if( file_exists($path) ){ 249 $content = input_file( $path ); 250 } 251 else { 252 $content = update_output_url_list( $num ); 253 } 254 break; 239 255 default: 256 $content = "bad cmd=" . $cmd; 240 257 break; 241 258 } … … 248 265 if (isset($_POST['num'])) { 249 266 $num = $_POST['num']; 267 268 $Url_data = get_url_data($num); 269 250 270 if (isset($_POST['part'])) { 251 271 $part = $_POST['part']; … … 259 279 $top_path = get_path_from_url_data( $num , $part); 260 280 $filename_abs_path = $top_path . DIRECTORY_SEPARATOR . $path; 261 $ret = build_one_html( $ exec_path , $num, $path, $part );281 $ret = build_one_html( $Top_path , $num, $path, $part ); 262 282 } 263 283 else{ … … 304 324 } 305 325 else{ 306 echo( $content);326 echo("no content"); 307 327 } 308 328 } … … 331 351 332 352 function get_full_path($num, $key, $fname){ 333 $array = get_url_data_array(); 334 return $array[$num][$key] . "/" . $fname; 335 } 336 337 function get_restrict_from_settings_yml() { 338 $settings = get_url_data_array(); 339 $array = $settings[0]['restrict']; 353 global $Url_data_array; 354 return $Url_data_array[$num][$key] . "/" . $fname; 355 } 356 357 function get_restrict_from_settings_yml( $num ) { 358 global $Url_data_array; 359 360 /* $settings = get_url_data_array();*/ 361 $settings = $Url_data_array; 362 if( !isset($settings[$num]) ){ 363 return array(); 364 } 365 $array = $settings[$num]['restrict']; 366 if( !isset( $array ) ){ 367 return array(); 368 } 340 369 341 370 $r_keys = array_keys( $array ); … … 361 390 $list = get_site_tsv($num ); 362 391 363 $restrict_array = get_restrict_from_settings_yml( );392 $restrict_array = get_restrict_from_settings_yml( $num ); 364 393 365 394 foreach( $list as $k => $v ){ … … 399 428 } 400 429 430 function update_output_url_list( $num ){ 431 $json_data = get_output_url_list( $num ); 432 $content = json_encode($json_data); 433 output_file( $path , $content ); 434 435 return $content; 436 } 437 438 function get_output_url_list( $num ){ 439 $output_url = get_output_url($num); 440 $data = array( "output_url" => get_output_url($num), 441 "htmlfname" => array() 442 ); 443 444 $list = get_site_tsv( $num ); 445 $restrict_htmlnames = get_restrict_basenames( $num ); 446 447 $output_path = get_path_from_url_data( $num, 'output' ); 448 foreach( $list as $k => $v ){ 449 $htmlfname = $v["output_html"]; 450 if( $htmlfname !== null ){ 451 $array = array( "full" => "", "partial" => "" ); 452 if( !isset( $restrict_htmlnames[$htmlfname] ) ){ 453 $fpath = $output_path . '/' . $htmlfname; 454 if( file_exist($fpath) ){ 455 $array["full"] = $htmlfname; 456 } 457 $fpath_tmp = $fpath . '.tmp'; 458 if( file_exist($fpath_tmp) ){ 459 $array["partial"] = $htmlfname_tmp; 460 } 461 array_push( $data["htmlfname"] , $array); 462 } 463 } 464 } 465 466 return $data; 467 } 468 401 469 function get_output_url($num){ 402 $settings = get_url_data_array(); 403 return $settings[$num]['output_url']; 470 return $Url_data['output_url']; 404 471 } 405 472 406 473 function get_restrict($num){ 407 $settings = get_url_data_array(); 408 return $settings[$num]['restrict']; 409 } 410 411 function get_item($num, $name){ 412 $settings = get_url_data_array(); 413 return $settings[$num][$name]; 414 } 415 416 function get_settings_file( $name ){ 417 $dir = get_item( 0 , "conf_path" ); 418 $path = implode( "/" , [$dir, $name] ); 419 420 return $path; 421 } 422 423 function do_exec(){ 424 $cmd = "ls -l /z"; 425 426 exec($cmd, $opt, $ret); 427 428 # print_r($opt); 429 # echo "ret=" . $ret . "\n"; 474 /* $settings = get_url_data_array();*/ 475 global $Url_data_array; 476 return $Url_data_array[$num]['restrict']; 430 477 } 431 478 432 479 cmdx(); 433 /* 434 do_exec(); 435 */ 436 /* 437 $num = 0; 438 $path = "/attempt/devconf2018/data/devconf2018.md"; 439 $part = "data"; 440 $lines = build_one_html( $exec_path, $num , $path , $part ); 441 442 var_dump( $lines ); 443 444 foreach( $lines as $k => $v ){ 445 if( is_array( $v )){ 446 echo implode( "\n" , $v ); 447 } 448 else{ 449 echo $v . "\n"; 450 } 451 } 452 */ 480 481 #echo json_encode( get_output_url_list(0) ); 482 # var_dump( get_output_url_list(0) ); 483 #var_dump( get_output_url_list(0) ); 484 #echo json_encode( get_output_url_list(0) ); 453 485 ?> -
branches/testa-single-bookmark/tmp/tmp.txt
r66 r67 8 8 <link rel="stylesheet" href="./css/style.css" /> 9 9 <link href='https://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'> 10 <link rel="stylesheet" href="css/style-3.css?1 46">11 <link rel="stylesheet" href="css/tab.css?1 46">12 <link rel="stylesheet" href="css/menu.css?1 46">10 <link rel="stylesheet" href="css/style-3.css?170"> 11 <link rel="stylesheet" href="css/tab.css?170"> 12 <link rel="stylesheet" href="css/menu.css?170"> 13 13 <link href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet" /> 14 14 <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> 15 15 <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script> 16 16 <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.5/ace.js"></script> 17 <script src="js/storagex.js?1 46>"></script>18 <script src="js/sidemenu.js?1 46>"></script>19 <script src="js/bookmark.js?1 46>"></script>20 <script src="js/bookmarkmgr.js?1 46"></script>21 <script src="js/bookmarkmenu.js?1 46"></script>22 <script src="js/tab.js?1 46"></script>23 <script src="js/topmenu.js?1 46"></script>24 <script src="js/remotex.js?1 46"></script>25 <script src="js/build.js?1 46"></script>26 <script src="js/main.js?1 46"></script>17 <script src="js/storagex.js?170>"></script> 18 <script src="js/sidemenu.js?170>"></script> 19 <script src="js/bookmark.js?170>"></script> 20 <script src="js/bookmarkmgr.js?170"></script> 21 <script src="js/bookmarkmenu.js?170"></script> 22 <script src="js/tab.js?170"></script> 23 <script src="js/topmenu.js?170"></script> 24 <script src="js/remotex.js?170"></script> 25 <script src="js/build.js?170"></script> 26 <script src="js/main.js?170"></script> 27 27 28 28 <!-- AREA-END --> … … 72 72 <ul> 73 73 <li><a id="data-host-update-all" onclick="update_all_info_on_host_async()">Update all on host</a></li> 74 <!-- <li><a id="data-host-update" onclick="Globalx.remotex.update('data')">Update on host</a></li> -->75 74 <li><a href="#" onclick="Globalx.storagex.save_info_from_globalx()">Save info</a></li> 76 75 <li><a href="#" onclick="Globalx.storagex.reset_info()">Reset Info</a></li> … … 171 170 <ul> 172 171 <li><a id="conf-file-upload" onclick="upload_to_host('conf')">Save on host</a></li> 173 <!-- <li><a id="conf-file-download" onclick="download_cmd('data')">Download</a></li> -->174 172 <li><a id="conf-file-rename" class="disabled" >-Rename</a></li> 175 173 <li><a id="conf-file-move" class="disabled" >-Move</a></li> … … 181 179 <ul> 182 180 <li><a id="conf-dir-create" class="disabled" href="#">-Create</a></li> 183 <li><a id="conf-dir-rename" class="disabled" href="#">-Rename</a></li>181 p <li><a id="conf-dir-rename" class="disabled" href="#">-Rename</a></li> 184 182 <li><a id="conf-dir-move" class="disabled" href="#">-Move</a></li> 185 183 <li><a id="conf-dir-delete" class="disabled" href="#">-Delete</a></li>
Note: See TracChangeset
for help on using the changeset viewer.
![(trac.ini の [header_logo] セクションを設定してください)](/python/trac/Flist/chrome/common/trac_logo_mini.png)