kingr13 / kfm

Automatically exported from code.google.com/p/kfm
0 stars 0 forks source link

New Multi Dir Select Panel #42

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, 

can we add a new panel over dirctory panel like the screenshot to handle 
more different dirs in the same browser window.

This issue is instead of issue 34. 

Whats your opinion about this ?

At moment, i have to close kfm for this setting and reload the page 
(iframe) with new settings again.
The user and file settings are managed about cms in background.

Original issue reported on code.google.com by nilsfeld@gmail.com on 2 Jan 2010 at 1:05

Attachments:

GoogleCodeExporter commented 9 years ago
This looks promising. The KFM system expects one root directory, but with this 
select 
option it will be technically easier to realize than the previous post. I 
assume you 
want to have another system next to KFM determining what users have which root 
folders?

Original comment by bterku...@gmail.com on 2 Jan 2010 at 4:38

GoogleCodeExporter commented 9 years ago
I use php explorer for some settings, but the explorer is to slowly for old 
machines,
and have not so much plugins, like "image rotate", ...

Original comment by nilsfeld@gmail.com on 2 Jan 2010 at 6:05

GoogleCodeExporter commented 9 years ago
I noticed yesterday that you are a co-developer now. Welcome! According to my 
strategy of the KFM project this kind of custom system should be possible 
without 
changing the core. The approach I would take to accomplish this is to create a 
templated theme, which I think should be the only kind of theme in the future 
and add 
a div in that theme where you include a php script written by you generating 
the root 
folders list with some javascript to change the kfm_vars.root_folder_name, 
kfm_vars.root_folder_id and refresh the directory list and file list on root 
directory change. 

I expect that this is possible without adjusting KFM or maybe really small 
modifications.

Look at the bb theme for a theming example: themes/bb/template.html

Success!

Original comment by bterku...@gmail.com on 3 Jan 2010 at 12:44

GoogleCodeExporter commented 9 years ago
Hi,

i add a new panel to change the root folder.

How can i change the root dir in javascripts ?
(root_folder_id) ... 

The backend in php is working very good.
Example:
http://nilsfeld.de/filemanager/

Original comment by nilsfeld@gmail.com on 21 Feb 2010 at 1:48

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
patch file
codebase: r985

Original comment by nilsfeld@gmail.com on 21 Feb 2010 at 1:58

Attachments:

GoogleCodeExporter commented 9 years ago
step 1(ready): it can be switch between different root folders.
easy config:
/* Normal Root Dir */
#$kfm_userfiles_address = './userfiles3';
/* Multi Root Dir */
$kfm_userfiles_address = array(
    'Home'      =>'./userfiles', 
    'Folder 1'  =>'./userfiles2',
    'Folder 2'  =>'./userfiles3'
);

step 2(in process): change folders in javascript and add copy / move function

I can upload it to svn, the normal version with kfm_userfiles_address is 
working 
normaly with this patch file.

I think it is a nice thing.

Please check it.

Original comment by nilsfeld@gmail.com on 21 Feb 2010 at 7:22

Attachments:

GoogleCodeExporter commented 9 years ago
here is an working example:
http://nilsfeld.de/filemanager/

Original comment by nilsfeld@gmail.com on 21 Feb 2010 at 7:23

GoogleCodeExporter commented 9 years ago
do you have this hard-coded into KFM, or as an optional plugin? From the 
descriptions
so far, I think you've hard-coded it. I have not tried your code yet (already 
spent a
few hours this weekend on KFM; I'll have a proper look next weekend).

most people will not need this, so it's best to have it as a plugin.

also, plugins allow us to add code to KFM and "turn it off" for non-developers, 
until
it's ready for use.

Original comment by kae.verens@gmail.com on 21 Feb 2010 at 7:30

GoogleCodeExporter commented 9 years ago
I've had a look at the example. Looks good.

it would be interesting if, instead of having yet another panel, the multiple 
roots
could be incorporated into the current directory panel.

this is just a suggestion - your panel works as it is, and there's no real need 
to
change it if it works.

what I'm suggesting would probably be tricky anyway. it would show up as an 
example
tree such as this:
==============================
Home
  +-- dir1
  | +-- example subdir
  +-- dir2
Folder 1
  +-- dir1
  +-- dir2
Folder 2
  +-- dir1
  +-- dir2
==============================

I'll take a proper look at this during the week. How are you setting the various
alternative directories?

Original comment by kae.verens@gmail.com on 21 Feb 2010 at 7:51

GoogleCodeExporter commented 9 years ago
I played around with this idea and it works without changing a single line of 
code. 
Create a plugin called multiroot and put the following in the plugin.php:

<?php
$p = new kfmPlugin('multiroot');
$my_roots = array(
    'Root1' => array(),
    'Root2'=>array('user_root_folder'=>'Documents','root_folder_name'=>'My 
Documents'),
    'Root3'=>array('user_root_folder'=>'Images', 'root_folder_name' => 'My images')
);
$my_folder = isset($_REQUEST['root_folder']) ? $_REQUEST['root_folder'] : false;
if($my_folder) $kfm->setSettings($my_roots[$my_folder], true);
$js = '$j(function(){var mr_selector = $j(\'<select 
id="new_root_select"></select>\')';
foreach($my_roots as $my_root => $my_sets){
  $selected = isset($_REQUEST['root_folder']) && $my_root == $my_folder ? 
'selected="selected"': '';
  $js.='.append(\'<option '.$selected.'>'.$my_root.'</option>\')';
}
$js .= ".change(function(){
  window.location=(window.location.toString().replace(/root_folder=.*&?/g, '')
      +(window.location.toString().indexOf('?')!=-1?'&':'?')+
      'root_folder=' +
      \$j('#new_root_select').val()
      ).replace(/&+/,'&')})";
$js .= ".appendTo('#root_directory_selector');";
$js .= '});';
$p->addJavascript($js);
$kfm->addPlugin($p);
?>

Go to the themes
create a new one based on the bb:
cp -r bb bb_multiroot

add in the template.html:
  <div id="directories_canvas">
      <div id="root_directory_selector"></div>

Now try:
index.php?theme=bb_multiroot

the setSettings true value is making use of a new feature in the latest svn, 
setting 
freezing. 

If the $my_folder setting default is changed from false to for example Root2, 
server 
errors might appear as reported in Issue 50.

Original comment by bterku...@gmail.com on 23 Feb 2010 at 10:35

GoogleCodeExporter commented 9 years ago
I meant Issue 55. Also make sure there the root folders Documents and Images 
exist

Original comment by bterku...@gmail.com on 23 Feb 2010 at 10:37

GoogleCodeExporter commented 9 years ago
ok, i will test it tomorrow.

Original comment by nilsfeld@gmail.com on 3 May 2010 at 9:13

GoogleCodeExporter commented 9 years ago
Don't forget to set the GET_PARAMS in configuration.php. Will save a lot of 
debug time 
:)

Original comment by bterku...@gmail.com on 4 May 2010 at 5:13