Browsable interface for batch add files - Page 2 Browsable interface for batch add files - Page 2
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Browsable interface for batch add files

Started by jpaffett, April 26, 2005, 03:17:51 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

tutone

kegobeer,

that didn't work either.  I made the change in functions.inc.php that you said... still says "There are no folders inside the "albums" folder yet. Make sure to create at least one custom folder within "albums" folder and ftp-upload your files there. You mustn't upload to the "userpics" nor "edit" folders, they are reserved for http uploads and internal purposes." But it works fine in non browsable mode.

Joachim Müller

The function cpg_get_webroot_path()  was introduced by me as a cheap workaround to catch the webroot path on as many server setups as possible. I tested in on all servers I could (which are not that many though ;)). The function is still "experimental". Feel free to add whatever you could come up with that will improve the probability to catch the correct path even on exocit server setups.
This issue is tricky however: I had a look into many other openSource apps that need to have the webroot path: they all have some way of workaround and fallback option that should catch the path for most server setups, but not all.
In the particular case of tutone I recommend just switching to the "traditional" batch-add interface that displays all folders on one screen at once, i.e. skip the "browsable batch-add" interface feature.

kegobeer

Hmm.  I'll also do some looking and playing around with this.  Joachim, I also noticed when I "fixed" my browsasble interface problem that limits were ignored.  Started at /albums/, navigated one deep to /albums/uploads/, navigated back to /albums/, and I get the go up link.  I could then browse my entire root directory.

What do you think about a link tree type display - the initial browse will grab all valid directories and display them as clickable links.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

Joachim Müller

link tree would be another option imo that should rather replace the first screen of the "traditional" batch-add interface in the future. The reason why I created the browsable batch-add interface was that I didn't want all sub-folders to be expanded in the first place. If you could come up with a good mixture (i.e. a linktree where only the first level is displayed by default and all sub-level are only visisble if the particular branch is clicked; similar to Windows Explorer) this would be a big plus imo. I'm not sure though if this should go into cpg1.4, as it would be an additional feature, not a fix for an existing one.

kegobeer

I was thinking more of a left/right window division, with a linktree in the left pane, and when a link is clicked, the files will display in the right pane.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

tutone

GauGau,

Are you implying that there is something incompatible with my server?  It appears that some people have had this same problem... is this a feature that when released will work for some and not for others?  Let me know if you need more info or if it is not worth pursuing any further.


kegobeer

@tutone:  Not all servers are the same - depending on how an administrator wants to set up the server is how that server will function and what $_SERVER variables will be available.  Writing an interface that works with all servers is hard, and quite often a particular setup will not work with the code.  We will do our best to achieve the most compatibility, but there is always a chance that someone won't be able to use the browsable interface.

Let's see if this works for you.  Make a new php file called testroot.php with this in it:

<?php
function cpg_get_webroot_path() {
    
$rootpath __FILE__;
    
$strloc strrpos($rootpath'/include/');
    return 
substr($rootpath0$strloc-8);
}
echo 
cpg_get_webroot_path();
?>


Put it in your Coppermine's /include/ directory.  Execute the file and post your results.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

kegobeer

The code in my previous post is incorrect.  Use this instead:

<?php
// Let's see what's enabled!

$path= (__FILE__);
echo 
$path.'<br>';

if (
eregi("win",getenv('OS'))) {
  
$schstr chr(92);
} else {
  
$schstr '/';
}

$loc strrpos($path$schstr);

if (
$loc 0) {
  
$testpath substr($path0$loc-8);
  echo 
$testpath;
}

?>
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

tutone

#28
kegobeer,

I totally understand.  I am just trying to be helpful and test it out and report back to you guys.  I just wanted to know if you guys wanted me to try anything else.  I was not implying, nor was I intending anything negative.  I have not seen the browsable interface... i am actually happy with the current meathod.  But if i can be of help to you guys to improve the code i am willing to be of assistance (especially since i am out of law school for the summer).  If my setup just won't work (or would take to much work) please let me know... it is by no means a big deal.

I put the code you indicated in a file called testroot.php

testroot.php has the following in it:

Quote
<?php
// Let's see what's enabled!

$path= (__FILE__);
echo $path.'<br>';

if (eregi("win",getenv('OS'))) {
 $schstr = chr(92);
} else {
 $schstr = '/';
}

$loc = strrpos($path, $schstr);

if ($loc > 0) {
 $testpath = substr($path, 0, $loc-8);
 echo $testpath;
}

?>

The following appeared when i browsed to the file:

/home/content/w/e/b/website/html/portal/gallery/include/testroot.php
/home/content/w/e/b/website/html/portal/gallery


I have a hunch you were looking for something more (so i must have done something wrong).  Either way... let me know what you would like me to do next. Even if it is to take a flying leep or stick something somewhere...  ;)

Joachim Müller

@tutone: don't get me wrong, I appreciate your readiness to help and improve coppermine. What kegobeer said is right: server setups differ, that's all. The "traditional" batch-add uses relative paths, that's why it works on all server setup. The browsable interface has the option to go down in the tree, but to go up as well. That's why we have to take care that the user doesn't go up the tree too much. To do this, we have to determine the webroot. This is hard to accomplish, as there is no server var that reliably holds this piece of information on all setups. Windows servers cause most troubles in this aspect: the server sided vars are nearly the same on most Lunix systems, but somehow the IIS versions as well as the apache installs on Windows differ very much.

kegobeer

@tutone:  That's exactly what I was looking for.  That script should spit out the Coppermine root directory, which is what happened.  I'm working on a slightly different browser interface that will hopefully eliminate this issue.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

tutone

GauGau,

I totally understand how difficult it is.  I apologize if i gave the impression that i didn't think that or i was trying to rush you guys. Previous to Law School i worked as a program/project manager working with developers... they were always getting pissed at me thinking that i was rushing them... when i was really just trying to figure out what the problem was... just because i am curious by nature.  You guys have created an awesome piece of work.  Whatever little help i can do... please let me know.


kegobeer

#32
@tutone:  Make a small change to your init.inc.php file and upload the attached file (rename it to path.php) to your Coppermine root directory.  See if you get a browsable listing.  You should get a list of valid directories on the left (indented entries mean subdirectories), and a list of files on the right when you click one of the directories on the left.  All files except directories are listed as there is no filter set up.

In init.inc.php, after

// Check for GD GIF Create support
if ($CONFIG['thumb_method'] == 'im' || function_exists('imagecreatefromgif'))
  $CONFIG['GIF_support'] = 1;
else
  $CONFIG['GIF_support'] = 0;


add

// Windows or *nix? keg
if (eregi("win",getenv('OS'))) {
  $CONFIG['filesep'] = chr(92);
} else {
  $CONFIG['filesep'] = '/';
}

$tmppath = (__FILE__);

$tmploc = strrpos($tmppath, $CONFIG['filesep']);

if ($tmploc > 0) {
  $CONFIG['rootpath'] = substr($tmppath, 0, $tmploc-7);
}


Tested on Linux/Apache 1.3.33/PHP 4.3.11 and Windows XP Pro/Apache 2.0.54/PHP 5.0.4
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

tutone

still get the same message:

There are no folders inside the "albums" folder yet. Make sure to create at least one custom folder within "albums" folder and ftp-upload your files there. You mustn't upload to the "userpics" nor "edit" folders, they are reserved for http uploads and internal purposes.

kegobeer

Uhhh, just point your browser to path.php and see what happens.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

kegobeer

#35
Found an error in my previous code.  I corrected my previous post, tutone, so copy and paste the init.inc.php code again.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

tutone

Sorry... i didn't know i was supposed to point to path.php.  When i point to path.php i can see the folders on the left and then when i click on a folder it shows the files in that folder on the right.  All of the folders under albums/ appear on the left.

kegobeer

Good, I was hoping it would work for you.  I'll work on a better interface and incorporate it into Coppermine for further testing.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

tutone

kegobeer,

Anything new with this?  Do you need help testing anything?

kegobeer

Things are progressing nicely - seems to be working for nix and windows without any errors.  The code is pretty different from what I've posted here, and it works better.

I haven't integrated it with 1.4.1 yet, so nothing to be tested.  I'm working on other things that are directly related, so everything will be rolled up into one update.  I'll post when it's done.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots