public function before() { parent::before(); Lang::load('filebrowser::global'); if(!is_dir($this->image_thumbs)) { mkdir($this->image_thumbs, 0777); } $this->config = Config::load('upload'); if($this->config['ext_whitelist']) { $this->swf_upload['file_types'] = "*." . implode(';*.', $this->config['ext_whitelist']); } $this->template->config = $this->config; $this->path = new Path(Input::get('path', $this->root_path)); $data['mode'] = Input::get('mode', 'none'); $data['field'] = Input::get('field', 'default'); $data['type'] = Input::get('type', 'all'); $data['query'] = $this->build_query($data); $data['uri'] = Uri::current() . $data['query']; $this->data = $data; } public function action_add_folder() { $directory = null; if(Input::post('name')) { $this->path = new Path(Input::post('path', Input::get('path', $this->config['path']))); $name = Inflector::friendly_title(Input::post('name'), '_'); $directory = File::create_dir(Input::post('path'), $name); if($directory) { $delete_tree = Cache::delete('filebrowser-directory-tree'); $delete_files = Cache::delete('filebrowser-files-' . $this->path->slug()); } file_put_contents('add-dir.txt', 'Add folder:' . Input::post('name'). ' ', FILE_APPEND); } $response = $this->response(array( 'directory' => $directory, )); return $response; $this->template = null; }
$( "#dialog-form-directory" ).dialog({ autoOpen: false, resizable: false, draggable: false, height: 160, width: 360, modal: true, buttons: { "Create": function() { var bValid = true; bValid = bValid && checkLength( name, "nazwa", 3, 16 ); if ( bValid ) { $.ajax({ type: 'POST', url: "http://fuelphp/admin/filebrowser/add_folder", data: {path: pathq.val(), name: name.val()}, success: function(data){ location.reload(true); } }); } }, "Cancel": function() { $( this ).dialog( "close" ); } }, close: function() { tips.removeClass( "error3"); } });
It looks like you're new here. If you want to get involved, click one of these buttons!