The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 45 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Wed Mar 22, 2006 5:26 am 
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Tue Sep 27, 2005 6:33 pm
Posts: 170
Location: Maryland
Does anyone know of an easy method for autopopulating docman with a bunch of files at once?  What I'd like to do is assign a category for all the files in a directory (previously FTP'd to that folder), and ignore the description and other fields for now... just use the filename as the title.  However, with a set of 200+ files, doing this manually is pretty labor intensive.  Being able to import a lot of files at once would be very helpful.

If this isn't possible with docman, are there other file utilities that can do this?  Has anyone tried it with remository?  Are there other non-Joomla! PHP scripts that could be easily integrated into Joomla! to take advantage of the permission features?

Thanks!
kwc


Last edited by kwc on Mon Mar 27, 2006 2:54 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Fri Mar 24, 2006 2:56 pm 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Thu Nov 10, 2005 10:08 am
Posts: 821
EDIT: see below...

_________________
Better SEO & multi-lingual Joomla sites with Nooku Content
http://www.nooku.org
Nooku Framework for advanced Joomla extension development
http://www.nooku.org/framework


Last edited by mjaz on Tue Apr 04, 2006 6:51 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Sun Mar 26, 2006 1:03 am 
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Tue Sep 27, 2005 6:33 pm
Posts: 170
Location: Maryland
mjaz,

Thanks for the code!  I'm not experienced in PHP at all so at this point I'd be hesitant to attempt to implement/debug it.

If you perceive others may have the same need, and you have the time/interest/opportunity to perfect this, by all means I would welcome your contribution.  Thanks for your generous offer!  At the same time, please don't feel obligated if you decide to not attempt this.

You might consider suggesting to the docman author that this be incorporated into a future release of his code as well.

Regards,
kwc


Top
 Profile  
 
PostPosted: Sun Mar 26, 2006 3:56 pm 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Thu Nov 10, 2005 10:08 am
Posts: 821
EDIT: find v1.1.0 here:http://forum.joomla.org/index.php/topic,64008.0.html


Autopopulate for Docman v1.0.1

Joomla component that automatically adds files from a directory to Docman.

Author: Mjaz Lives mjazlives@gmail.com
http://forum.joomla.org/index.php/topic,48491.0.html

Please don't contact me through email but by using this forum. Suggestions and bug reports are welcome.

This component was tested using Joomla! 1.0.8 and Docman 1.3RC2
Use at own risk!
Backup your Joomla installation and database before usage.

Usage:
1) Install as component
2) FTP your files to your /dmdocuments/ folder
3) Edit 'autopopulate_for_docman.config.php' (Optional)
4) In your Joomla backend, go to Components -> Autopopulate
5) Select files and a category
6) Click New'
7) Go to Components -> Docman -> Documents to edit and publish the entries
8) Repeat 2-7 for more files

Download from the forge:
http://forge.joomla.org/sf/projects/mjaztools

_________________
Better SEO & multi-lingual Joomla sites with Nooku Content
http://www.nooku.org
Nooku Framework for advanced Joomla extension development
http://www.nooku.org/framework


Last edited by mjaz on Tue May 23, 2006 9:45 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Sun Mar 26, 2006 9:16 pm 
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Tue Sep 27, 2005 6:33 pm
Posts: 170
Location: Maryland
mjaz,

This is absolutely brilliant.  Thanks so much for putting this together -- it worked exceptionally well and did exactly what I needed it to do.  What a timesaver!

Recommend uploading this to the Extensions site for all to see!

Thanks again,
kwc


Top
 Profile  
 
PostPosted: Sun Mar 26, 2006 10:52 pm 
User avatar
Joomla! Ace
Joomla! Ace
Offline

Joined: Fri Mar 03, 2006 3:52 pm
Posts: 1023
Location: Macon, GA
I can't even figure out to manually populate remository from the backend. Is there an upload button or do you have to ftp everything?

_________________
http://www.netentropy.com - Drupal, Joomla and whatever performance.


Top
 Profile  
 
PostPosted: Mon Mar 27, 2006 3:25 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Tue Feb 07, 2006 6:22 am
Posts: 26
Location: Portland, OR
I agree w/ kwc... AWESOME addon com... ;D

thanks!

joe...

_________________
j...


Top
 Profile  
 
PostPosted: Mon Mar 27, 2006 4:20 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Tue Feb 07, 2006 6:22 am
Posts: 26
Location: Portland, OR
one suggestion: maybe use "Assign" instead of "New"...

6. then click Assign to assign the file(s) to the catagory...

:)

_________________
j...


Top
 Profile  
 
PostPosted: Mon Mar 27, 2006 9:13 am 
User avatar
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Wed Sep 28, 2005 3:31 pm
Posts: 4
Location: Hitchin - Hertforshire - UK
Sorry, but where can I find the component to download? Or how can I use?
I didn't find any link to get it  ???
Am I fumbling? :-\


Top
 Profile  
 
PostPosted: Mon Mar 27, 2006 9:30 am 
User avatar
Joomla! Virtuoso
Joomla! Virtuoso
Offline

Joined: Thu Aug 18, 2005 2:09 am
Posts: 4805
Location: California
File is attached to Reply #3 above.

_________________
██ AllMedia4Joomla Project
██ http://sourceforge.net/projects/allmedia4joomla/
██ AllMedia YouTube Feed Gallery module released
██ Download: http://sourceforge.net/projects/allmedia4joomla/files/


Top
 Profile  
 
PostPosted: Mon Mar 27, 2006 10:14 am 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Thu Nov 10, 2005 10:08 am
Posts: 821
kwc wrote:
This is absolutely brilliant.  Thanks so much for putting this together -- it worked exceptionally well and did exactly what I needed it to do.  What a timesaver!

Recommend uploading this to the Extensions site for all to see!

Glad you like it, I spend most of my sunday on it. It's already in Extensions: http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,527/Itemid,35/

joevv3 wrote:
one suggestion: maybe use "Assign" instead of "New"...
6. then click Assign to assign the file(s) to the catagory...


Great suggestion, though not enough to justify a 1.0.1 release ;-) Keep posting feature requests, if a lot of people use this comp, I'll spend another sunday on it. 

_________________
Better SEO & multi-lingual Joomla sites with Nooku Content
http://www.nooku.org
Nooku Framework for advanced Joomla extension development
http://www.nooku.org/framework


Top
 Profile  
 
PostPosted: Mon Mar 27, 2006 10:44 am 
User avatar
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Wed Sep 28, 2005 3:31 pm
Posts: 4
Location: Hitchin - Hertforshire - UK
:P
thank you  ;)
I didn't behold  :-\


Top
 Profile  
 
PostPosted: Wed Mar 29, 2006 10:40 am 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Wed Mar 29, 2006 9:55 am
Posts: 2
I've been hanging out for this feature for Docman... excellent component... brilliant idea.

Thanks for making my life that little bit easier.

Rubes. ;D


Top
 Profile  
 
PostPosted: Mon Apr 03, 2006 11:11 am 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Mon Apr 03, 2006 11:00 am
Posts: 1
Will this work on ""old" Mambo sites I can not change yet to joomla???


Top
 Profile  
 
PostPosted: Mon Apr 03, 2006 1:21 pm 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Thu Nov 10, 2005 10:08 am
Posts: 821
arthurvdmolen wrote:
Will this work on ""old" Mambo sites I can not change yet to joomla???


I have no idea, I only joined at 1.0.3. You could test in on a local installation. In any case, I don't think the component can do any harm whatsoever, but making backups of your site and your database is a good habit.  :)

_________________
Better SEO & multi-lingual Joomla sites with Nooku Content
http://www.nooku.org
Nooku Framework for advanced Joomla extension development
http://www.nooku.org/framework


Top
 Profile  
 
PostPosted: Tue Apr 04, 2006 11:01 am 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Tue Apr 04, 2006 8:30 am
Posts: 1
I cannot download this zip File.


Top
 Profile  
 
PostPosted: Tue Apr 04, 2006 1:07 pm 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Thu Nov 10, 2005 10:08 am
Posts: 821
I think the forum requires you to be logged in to download.

_________________
Better SEO & multi-lingual Joomla sites with Nooku Content
http://www.nooku.org
Nooku Framework for advanced Joomla extension development
http://www.nooku.org/framework


Top
 Profile  
 
PostPosted: Wed Apr 05, 2006 2:25 am 
User avatar
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Wed Aug 24, 2005 2:02 pm
Posts: 283
Location: Rhode Island, USA
Maybe I've been hanging around in Joomlapolis too long, but I'd give you 'Karma' if I could.  I've got about 100 pdfs uploaded vis mosCE I need to load into DocMan and it's going to save me a lot of time.  Thanks for putting it together!

Here's a feature request that might be relatively easy and could qualify as a motive for a 1.0.1: A recursive drill-down of the documents contained within the default 'files' directory you're searching through.  Bonus points (or karma...whatever...) if you can call it back as a file tree rather than a flat list.


Top
 Profile  
 
 Post subject: Files a tree
PostPosted: Wed Apr 05, 2006 10:01 am 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Thu Nov 10, 2005 10:08 am
Posts: 821
pointri wrote:
Here's a feature request that might be relatively easy and could qualify as a motive for a 1.0.1: A recursive drill-down of the documents contained within the default 'files' directory you're searching through.  Bonus points (or karma...whatever...) if you can call it back as a file tree rather than a flat list.


Displaying files as a tree should be simple. However, AFAIK, Docman doesn't currently support subdirectories in /dmdocuments. What I could do is have the component move all files from the subdirectories to the /dmdocuments-root, rename them (eg. "subdir_filename.ext") and create subcategories that reflect the original directory structure. I'd have to find a way to keep it simple, so the component is can be used without reading a manual. Let me know what you think.

pointri wrote:
Maybe I've been hanging around in Joomlapolis too long, but I'd give you 'Karma' if I could.

Glad to help  :) Voting at the extensions directory will do the trick  ;D

_________________
Better SEO & multi-lingual Joomla sites with Nooku Content
http://www.nooku.org
Nooku Framework for advanced Joomla extension development
http://www.nooku.org/framework


Top
 Profile  
 
 Post subject: Moving files...
PostPosted: Wed Apr 05, 2006 1:52 pm 
User avatar
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Wed Aug 24, 2005 2:02 pm
Posts: 283
Location: Rhode Island, USA
mjaz wrote:
What I could do is have the component move all files from the subdirectories to the /dmdocuments-root, rename them (eg. "subdir_filename.ext") and create subcategories that reflect the original directory structure. I'd have to find a way to keep it simple, so the component is can be used without reading a manual. Let me know what you think.


That would be okay, except that shifting all of the documents up to one directory would break the links to those same files generated in content items.  Since it looks like DocMan stores file information in a database table, and the file name is stored as a URL, would it be possible to loop recursively through a file directory and build an array of those file URLs to select from?  Here's a function I found in the PHP manual that might do the job with a little tweaking to prepend $mosConfig_live_site and build it into an option list...

Code:
<?php

// $path : path to browse
// $maxdepth : how deep to browse (-1=unlimited)
// $mode : "FULL"|"DIRS"|"FILES"
// $d : must not be defined
 
function searchdir ( $path , $maxdepth = -1 , $mode = "FULL" , $d = 0 )
{
   if ( substr ( $path , strlen ( $path ) - 1 ) != '/' ) { $path .= '/' ; }    
   $dirlist = array () ;
   if ( $mode != "FILES" ) { $dirlist[] = $path ; }
   if ( $handle = opendir ( $path ) )
   {
       while ( false !== ( $file = readdir ( $handle ) ) )
       {
           if ( $file != '.' && $file != '..' )
           {
               $file = $path . $file ;
               if ( ! is_dir ( $file ) ) { if ( $mode != "DIRS" ) { $dirlist[] = $file ; } }
               elseif ( $d >=0 && ($d < $maxdepth || $maxdepth < 0) )
               {
                   $result = searchdir ( $file . '/' , $maxdepth , $mode , $d + 1 ) ;
                   $dirlist = array_merge ( $dirlist , $result ) ;
               }
       }
       }
       closedir ( $handle ) ;
   }
   if ( $d == 0 ) { natcasesort ( $dirlist ) ; }
   return ( $dirlist ) ;
}

?>


Top
 Profile  
 
 Post subject: Re: Moving files...
PostPosted: Wed Apr 05, 2006 2:08 pm 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Thu Nov 10, 2005 10:08 am
Posts: 821
pointri wrote:
That would be okay, except that shifting all of the documents up to one directory would break the links to those same files generated in content items.  Since it looks like DocMan stores file information in a database table, and the file name is stored as a URL, would it be possible to loop recursively through a file directory and build an array of those file URLs to select from?  Here's a function I found in the PHP manual that might do the job with a little tweaking to prepend $mosConfig_live_site and build it into an option list...


If you change the dmfilename field in the #__docman table, eg to subdir/myfile.ext, then docman has some trouble when a user tries to download the file. So using the original paths in dmfilename would require docman core files to be patched.

In your case, you could always use doclink to link to files in your content, instead of using direct links to files in subdirs.

Thanks for the code, but I'll probably make the next version for Joomla 1.5 only, so I can use the new framework with the ftp-filesystem etc.

_________________
Better SEO & multi-lingual Joomla sites with Nooku Content
http://www.nooku.org
Nooku Framework for advanced Joomla extension development
http://www.nooku.org/framework


Top
 Profile  
 
PostPosted: Fri Apr 07, 2006 8:24 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Mon Apr 03, 2006 5:52 pm
Posts: 44
Location: Blackpool, UK
Can anyone answer me this ??

On my v1.0.8 J installation "Autopopulate" works like a dream (I applaude you!), but on my v1.0.3-upgraded-to-v1.0.8 J installation it says on a blank white screen "Problem opening".

Can anyone tell me how to get this working on my upgraded site??

Thanks people ;)


Top
 Profile  
 
PostPosted: Fri Apr 07, 2006 10:02 am 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Thu Nov 10, 2005 10:08 am
Posts: 821
Rafmeister wrote:
but on my v1.0.3-upgraded-to-v1.0.8 J installation it says on a blank white screen "Problem opening".


Autopop can't find the path to your docman files.
Go to Components / Docman / Configuration and make sure that the 'Path for storing files' is correctly set to an existing path on your site. Usually something like 'var/usr/www/dmdocuments'. Save your config.

_________________
Better SEO & multi-lingual Joomla sites with Nooku Content
http://www.nooku.org
Nooku Framework for advanced Joomla extension development
http://www.nooku.org/framework


Top
 Profile  
 
PostPosted: Fri Apr 07, 2006 11:01 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Mon Apr 03, 2006 5:52 pm
Posts: 44
Location: Blackpool, UK
Thanks for replying, however the path is correct or at least in my eyes it is.

I'm using the default path of /home/rafnet/public_html/v2/dmdocuments which is exactly where the files are stored, could it be something to do with this site being an upgraded v1.0.3 installation as the v1.0.8 full package installation I also use works perfectly?

Thanks for trying, but I desperately don't want to revert back to ReMOSitory as the process of adding files is laborious to say the least, so any further help would be very much appreciated.

8)


Top
 Profile  
 
PostPosted: Fri Apr 07, 2006 11:20 am 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Thu Nov 10, 2005 10:08 am
Posts: 821
Rafmeister wrote:
could it be something to do with this site being an upgraded v1.0.3 installation as the v1.0.8 full package installation I also use works perfectly?


That is possible, but I still think the problem lies elsewhere.

- Are you sure you're using Docman v1.3 RC2?

- Autopop only generates a "Problem Opening" message when it can't open dmdocuments. Take a look at /administrator/components/com_docman/docman.config.php
There should be a line like this:
Code:
var $dmpath = "/home/rafnet/public_html/v2/dmdocuments";

Add it if it's not there.

- Check the chmod and owner permissions for /dmdocuments

Good luck!

_________________
Better SEO & multi-lingual Joomla sites with Nooku Content
http://www.nooku.org
Nooku Framework for advanced Joomla extension development
http://www.nooku.org/framework


Top
 Profile  
 
PostPosted: Tue Apr 11, 2006 12:19 am 
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Thu Oct 06, 2005 4:43 pm
Posts: 312
thanks for a great extension! :) saves me sooo much trouble.

just one feature request: would it be possible to add the same doc to diff categories? right now, once i assign a doc to a cat, it disappears from the list.

thanks,
-V


Top
 Profile  
 
 Post subject: hack file list
PostPosted: Tue Apr 11, 2006 12:32 am 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Thu Nov 10, 2005 10:08 am
Posts: 821
maddunr wrote:
would it be possible to add the same doc to diff categories? right now, once i assign a doc to a cat, it disappears from the list.


Open admin.autopopulate_for_docman.php and change this line:
Code:
$FilesInDatabase   = Autopopulate::GetFilesInDatabase();

into this:
Code:
$FilesInDatabase   = array();


I'll see if I can add it as an config option in the next version.

_________________
Better SEO & multi-lingual Joomla sites with Nooku Content
http://www.nooku.org
Nooku Framework for advanced Joomla extension development
http://www.nooku.org/framework


Top
 Profile  
 
PostPosted: Tue Apr 11, 2006 12:39 am 
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Thu Oct 06, 2005 4:43 pm
Posts: 312
sweeeeeeet!

- V


Top
 Profile  
 
PostPosted: Tue Apr 11, 2006 1:49 pm 
User avatar
Joomla! Champion
Joomla! Champion
Offline

Joined: Fri Aug 19, 2005 3:03 pm
Posts: 6046
Location: Indiana, USA
thank you very much. this was extrememly helpful.

_________________
If you're new to Joomla, Please read Anna's Joomla! Tips: viewtopic.php?t=5503

http://nathandiehl.com | Find out what makes me tick


Top
 Profile  
 
PostPosted: Sun Apr 23, 2006 8:57 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Fri Feb 17, 2006 6:24 pm
Posts: 8
I have needed this feature in Joomla for 6 months now.  Of course when I go to use it it doesnt work.

Anyhow, enough crying.

Installed as per instructions.

When I go to components--->autopopulate

I get this output in my Joomla backend.  All my normal Joomla backend is there, but the buttons for this component are not.  They get errors as well.
Hopefully this isnt a php5 issue.  I have no choice in that matter.

Quote:
getPath( 'admin_html' ) ); require_once( $mainframe->getPath( 'class' ) ); require_once ($mosConfig_absolute_path . '/administrator/components/com_docman/docman.config.php'); require_once ($mosConfig_absolute_path . '/administrator/components/com_autopopulate_for_docman/autopopulate_for_docman.config.php'); $dmConfig = new dmConfig(); $AConf = new AutopopulateConf(); switch ($task) { case "new" : tasknew(); break; default: taskdefault(); break; } function taskdefault() { global $dmConfig, $AConf, $option; $files = false; $FilesInDatabase = Autopopulate::GetFilesInDatabase(); //files that already have a doc entry $Categories = Autopopulate::GetCategories(); $handle = opendir($dmConfig->dmpath) or die ("Problem opening " . $dmConfig->dmpath); while (false !== ($file = readdir($handle))) { if ( (!in_array($file, $AConf->skipfiles)) AND (!in_array($file, $FilesInDatabase))) { $files[] = $file; } } if (!$files) { echo "All files in ".$dmConfig->dmpath." are already present in the docman database"; } else { sort($files); HTML_Autopopulate::taskdefault($option, $files, $dmConfig, $Categories); }; } function tasknew() { global $database, $dmConfig, $AConf; $files = mosGetParam( $_POST, 'files', false ); $catid = mosGetParam( $_POST, 'catid', 0 ); $msg = ""; if (!$files) { echo "No files selected"; return false; } foreach ($files as $file) { $database->setQuery( "INSERT INTO `#__docman` SET `dmfilename` = '".$file."', `dmname` = '".$file."', `catid` = '".$catid."', `dmdescription` = '".$AConf->dmdescription."', `dmdate_published` = '".$AConf->dmdate_published."', `dmowner` = '".$AConf->dmowner."', `published` = '".$AConf->published."', `dmurl` = '".$AConf->dmurl."', `dmcounter` = '".$AConf->dmcounter."', `checked_out` = '".$AConf->checked_out."', `checked_out_time` = '".$AConf->checked_out_time."', `approved` = '".$AConf->approved."', `dmthumbnail` = '".$AConf->dmthumbnail."', `dmlastupdateon` = '".$AConf->dmlastupdateon."', `dmlastupdateby` = '".$AConf->dmlastupdateby."', `dmsubmitedby` = '".$AConf->dmsubmitedby."', `dmmantainedby` = '".$AConf->dmmantainedby."', `dmlicense_id` = '".$AConf->dmlicense_id."', `dmlicense_display` = '".$AConf->dmlicense_display."', `access` = '".$AConf->access."', `attribs` = '".$AConf->attribs."' ;" ); if (!$database->query()) { $msg[$file] = "". $database->getErrorMsg() .""; } else { $msg[$file] = "Added to database"; } } HTML_Autopopulate::tasknew($msg); } ?>


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 45 posts ]  Go to page 1, 2  Next



Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group