Advertisement

[SOLVED] Autopopulate docman or remository

Discuss the development and implementation of Joomla! components here.

Moderator: General Support Moderators

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.
kwc
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 170
Joined: Tue Sep 27, 2005 6:33 pm
Location: Maryland

[SOLVED] Autopopulate docman or remository

Post by kwc » Wed Mar 22, 2006 5:26 am

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.

Advertisement
User avatar
mjaz
Joomla! Guru
Joomla! Guru
Posts: 821
Joined: Thu Nov 10, 2005 10:08 am
Contact:

Re: Autopopulate docman or remository

Post by mjaz » Fri Mar 24, 2006 2:56 pm

EDIT: see below...
Last edited by mjaz on Tue Apr 04, 2006 6:51 pm, edited 1 time in total.
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

kwc
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 170
Joined: Tue Sep 27, 2005 6:33 pm
Location: Maryland

Re: Autopopulate docman or remository

Post by kwc » Sun Mar 26, 2006 1:03 am

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

User avatar
mjaz
Joomla! Guru
Joomla! Guru
Posts: 821
Joined: Thu Nov 10, 2005 10:08 am
Contact:

Component: Autopopulate For Docman

Post by mjaz » Sun Mar 26, 2006 3:56 pm

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 [email protected]
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
Last edited by mjaz on Tue May 23, 2006 9:45 pm, edited 1 time in total.
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

kwc
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 170
Joined: Tue Sep 27, 2005 6:33 pm
Location: Maryland

Re: Autopopulate docman or remository

Post by kwc » Sun Mar 26, 2006 9:16 pm

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

User avatar
researchtoxic
Joomla! Ace
Joomla! Ace
Posts: 1023
Joined: Fri Mar 03, 2006 3:52 pm
Location: Macon, GA
Contact:

Re: Autopopulate docman or remository

Post by researchtoxic » Sun Mar 26, 2006 10:52 pm

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.

joevv3
Joomla! Apprentice
Joomla! Apprentice
Posts: 26
Joined: Tue Feb 07, 2006 6:22 am
Location: Portland, OR

Re: Autopopulate docman or remository

Post by joevv3 » Mon Mar 27, 2006 3:25 am

I agree w/ kwc... AWESOME addon com... ;D

thanks!

joe...
j...

joevv3
Joomla! Apprentice
Joomla! Apprentice
Posts: 26
Joined: Tue Feb 07, 2006 6:22 am
Location: Portland, OR

Re: Autopopulate docman or remository

Post by joevv3 » Mon Mar 27, 2006 4:20 am

one suggestion: maybe use "Assign" instead of "New"...

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

:)
j...

User avatar
tobi
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Wed Sep 28, 2005 3:31 pm
Location: Hitchin - Hertforshire - UK

Re: Autopopulate docman or remository

Post by tobi » Mon Mar 27, 2006 9:13 am

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? :-\

User avatar
kenmcd
Joomla! Champion
Joomla! Champion
Posts: 5672
Joined: Thu Aug 18, 2005 2:09 am
Location: California
Contact:

Re: Autopopulate docman or remository

Post by kenmcd » Mon Mar 27, 2006 9:30 am

File is attached to Reply #3 above.
██ LibreTraining

User avatar
mjaz
Joomla! Guru
Joomla! Guru
Posts: 821
Joined: Thu Nov 10, 2005 10:08 am
Contact:

Re: Autopopulate docman or remository

Post by mjaz » Mon Mar 27, 2006 10:14 am

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/ ... 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

User avatar
tobi
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Wed Sep 28, 2005 3:31 pm
Location: Hitchin - Hertforshire - UK

Re: Autopopulate docman or remository

Post by tobi » Mon Mar 27, 2006 10:44 am

:P
thank you  ;)
I didn't behold  :-\

rubes
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Mar 29, 2006 9:55 am

Autopopulate docman or remository

Post by rubes » Wed Mar 29, 2006 10:40 am

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

arthurvdmolen
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Mon Apr 03, 2006 11:00 am

Re: [SOLVED] Autopopulate docman or remository

Post by arthurvdmolen » Mon Apr 03, 2006 11:11 am

Will this work on ""old" Mambo sites I can not change yet to joomla???

User avatar
mjaz
Joomla! Guru
Joomla! Guru
Posts: 821
Joined: Thu Nov 10, 2005 10:08 am
Contact:

Re: [SOLVED] Autopopulate docman or remository

Post by mjaz » Mon Apr 03, 2006 1:21 pm

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

akausch
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Tue Apr 04, 2006 8:30 am

Re: [SOLVED] Autopopulate docman or remository

Post by akausch » Tue Apr 04, 2006 11:01 am

I cannot download this zip File.

User avatar
mjaz
Joomla! Guru
Joomla! Guru
Posts: 821
Joined: Thu Nov 10, 2005 10:08 am
Contact:

Re: [SOLVED] Autopopulate docman or remository

Post by mjaz » Tue Apr 04, 2006 1:07 pm

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

User avatar
pointri
Joomla! Explorer
Joomla! Explorer
Posts: 283
Joined: Wed Aug 24, 2005 2:02 pm
Location: Rhode Island, USA

Re: [SOLVED] Autopopulate docman or remository

Post by pointri » Wed Apr 05, 2006 2:25 am

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.

User avatar
mjaz
Joomla! Guru
Joomla! Guru
Posts: 821
Joined: Thu Nov 10, 2005 10:08 am
Contact:

Files a tree

Post by mjaz » Wed Apr 05, 2006 10:01 am

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

User avatar
pointri
Joomla! Explorer
Joomla! Explorer
Posts: 283
Joined: Wed Aug 24, 2005 2:02 pm
Location: Rhode Island, USA

Moving files...

Post by pointri » Wed Apr 05, 2006 1:52 pm

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: Select all

<?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 ) ;
}

?>

User avatar
mjaz
Joomla! Guru
Joomla! Guru
Posts: 821
Joined: Thu Nov 10, 2005 10:08 am
Contact:

Re: Moving files...

Post by mjaz » Wed Apr 05, 2006 2:08 pm

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

User avatar
Rafmeister
Joomla! Apprentice
Joomla! Apprentice
Posts: 44
Joined: Mon Apr 03, 2006 5:52 pm
Location: Blackpool, UK
Contact:

Re: [SOLVED] Autopopulate docman or remository

Post by Rafmeister » Fri Apr 07, 2006 8:24 am

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 ;)

User avatar
mjaz
Joomla! Guru
Joomla! Guru
Posts: 821
Joined: Thu Nov 10, 2005 10:08 am
Contact:

Re: [SOLVED] Autopopulate docman or remository

Post by mjaz » Fri Apr 07, 2006 10:02 am

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

User avatar
Rafmeister
Joomla! Apprentice
Joomla! Apprentice
Posts: 44
Joined: Mon Apr 03, 2006 5:52 pm
Location: Blackpool, UK
Contact:

Re: [SOLVED] Autopopulate docman or remository

Post by Rafmeister » Fri Apr 07, 2006 11:01 am

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)

User avatar
mjaz
Joomla! Guru
Joomla! Guru
Posts: 821
Joined: Thu Nov 10, 2005 10:08 am
Contact:

Re: [SOLVED] Autopopulate docman or remository

Post by mjaz » Fri Apr 07, 2006 11:20 am

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: Select all

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

maddunr
Joomla! Explorer
Joomla! Explorer
Posts: 312
Joined: Thu Oct 06, 2005 4:43 pm

Re: [SOLVED] Autopopulate docman or remository

Post by maddunr » Tue Apr 11, 2006 12:19 am

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

User avatar
mjaz
Joomla! Guru
Joomla! Guru
Posts: 821
Joined: Thu Nov 10, 2005 10:08 am
Contact:

hack file list

Post by mjaz » Tue Apr 11, 2006 12:32 am

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: Select all

$FilesInDatabase	= Autopopulate::GetFilesInDatabase();
into this:

Code: Select all

$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

maddunr
Joomla! Explorer
Joomla! Explorer
Posts: 312
Joined: Thu Oct 06, 2005 4:43 pm

Re: [SOLVED] Autopopulate docman or remository

Post by maddunr » Tue Apr 11, 2006 12:39 am

sweeeeeeet!

- V

User avatar
nathandiehl
Joomla! Champion
Joomla! Champion
Posts: 6044
Joined: Fri Aug 19, 2005 3:03 pm
Location: Indiana, USA
Contact:

Re: [SOLVED] Autopopulate docman or remository

Post by nathandiehl » Tue Apr 11, 2006 1:49 pm

thank you very much. this was extrememly helpful.
If you're new to Joomla, Please read Anna's Joomla! Tips: http://forum.joomla.org/viewtopic.php?t=5503

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

matthewlking
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Fri Feb 17, 2006 6:24 pm

Re: [SOLVED] Autopopulate docman or remository

Post by matthewlking » Sun Apr 23, 2006 8:57 pm

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.
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); } ?>

Advertisement

Locked

Return to “Components”