Elxis CMS Forum
Extensions => Components => Topic started by: Ru Dee on February 27, 2008, 15:28:56
-
Hello everybody. Not sure if im not in the right place to start this thread, please excuse.
Going to be straight. Have a project in my mind for user build database or free share of authors made midi files/scores.
For example: Allow users after reg. to submit/upload files. Automaticly submited files to be announced in front page. Thats my basic need at this time. Could anyone guide me wich components/modules/plugins can help me out.
Thanx in andvance!
Ru..
ps. mr. Trebješanin a way to fast whois'in me up :D
-
Hi Ru Dee, and welcome!
It looks like what you described could be solved with simple use of DocMan and it's latest downloads module. DocMan is not tested with Elxis 2008, however.
Try, and let me know if you can't handle it.
https://www.elxis.org/extensions/legacy-downloads/elxis-2006-components.html
PS
I might even submit some of my works there ;)
-
Ive downloaded docman from your link..i install the component but it is something wrong with the menu....actualy i cant do nothing to configure it and i get one big logo that says its 1.4..
Also i did try to install remository on elx but i get something wrong with the database..ill figure it out later
-
I have given you the link to download DocMan for Elxis! You cannot use Mambo verion. Same goes for ReMository.
-
Hello Im back :)...
Actualy i waz here..anyway i almost finish everything on my project.
To improve the whole system using docman i need to do 2 things :
1. Is it possible to add a prefix in the filename to avoid "filename already exist" when a user uploading (did not found anything like in configs)
2. For registrated users with uploads is it possible for link to "my files" to index submited files by this user only along with its task buttons for easy maintain.
I think i might get lucky with 1...but dont have much brain to 2.
Any suggestions?
-
You must hack docman source code to do this. Exactly the same thing does Elxis for all files/images/avatars submitted from frontend. Elxis adds the user id in front of the file name so afterwards can filter files by user and users can edit/delete only their own files.
Here is a quick sample:
<?php
global $mainframe, $fmanager, $my;
if ( isset($_FILES['docmanfile']) && is_array($_FILES['docmanfile'])) {
$file = $_FILES['docmanfile'];
$name = preg_replace("/[\s]/", "_", eUTF::utf8_strtolower($file['name']));
$lowfilename = $my->id.'_'.$name;
$uploaddir = $mainframe->getCfg('absolute_path').'/docmanfiles';
$ext = $fmanager->FileExt($lowfilename);
$valid_exts = array('zip', 'rar', 'tar', 'gz');
if (in_array($ext, $valid_exts)) {
if (file_exists($uploaddir.'/'.$lowfilename)) { $lowfilename = $my->id.'_'.time().'.'.$ext; }
if ($fmanager->upload( $file['tmp_name'], $uploaddir.'/'.$lowfilename )) {
$fmanager->spChmod( $uploaddir.'/'.$lowfilename, '0666' );
}
}
}
?>
And here is a sample of how you can afterwards filter files by user:
<?php
global $fmanager, $my, $mainframe;
$userFiles = array(); //array of user submitted files
$allFiles = $fmanager->listFiles( $mainframe->getCfg('absolute_path').'/docmanfiles' );
foreach ( $allFiles as $file ) {
if (eregi( "\.(tar|zip|gz|rar)$", $file )) {
if (ereg("^".$my->id."_", $file)) { $userFiles[] = $file; }
}
}
?>
-
At this point the configuration is like that. The user can delete/move/..etc, only his files...but actualy the user should start browsing in the categories to see wich files belongs to her/him.
Just like that
(http://rudee.info/trackit/1.png)
The first file is submited by other user..
But thanks for your response im reading your code carefuly..its gona be hard but ill do my best..I suppouse to be a musician :D