Changeset 1223

Show
Ignore:
Timestamp:
08/23/07 11:20:59 (1 year ago)
Author:
ben
Message:

You can now upload up to five files at once into the repository.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/mod/file/lib/edit_folder.php

    r1114 r1223  
    192192END; 
    193193 
    194 $title = __gettext("Upload a file"); 
     194$title = __gettext("Upload files"); 
    195195 
    196196$body = <<< END 
     
    210210    $body .= sprintf(__gettext("Used space: %s Mb."),round(($usedquota / 1000000),4)); 
    211211} 
    212 $fileLabel = __gettext("File to upload:"); //gettext variable 
    213 $fileTitle = __gettext("File title:"); //gettext variable 
    214 $fileDesc = __gettext("File Description:"); //gettext variable 
     212$fileLabel = __gettext("Files to upload:"); //gettext variable 
     213$fileTitle = __gettext("Title for files:"); //gettext variable 
     214$fileDesc = __gettext("File description:"); //gettext variable 
    215215$fileAccess = __gettext("Access restrictions:"); //gettext variable 
    216216$body .= <<< END 
     
    223223                </p></td> 
    224224                <td><p> 
    225                         <input name="new_file" id="new_file" type="file" /> 
     225                        <input name="new_file1" id="new_file1" type="file" /><br /> 
     226                        <input name="new_file2" id="new_file1" type="file" /><br /> 
     227                        <input name="new_file3" id="new_file1" type="file" /><br /> 
     228                        <input name="new_file4" id="new_file1" type="file" /><br /> 
     229                        <input name="new_file5" id="new_file1" type="file" /> 
    226230                </p></td> 
    227231            </tr> 
     
    283287$body .= run("metadata:edit"); 
    284288             
    285 $copyright = __gettext("By checking this box, you are asserting that you have the legal right to share this file, and that you understand you are sharing it with other users of the system."); //gettext variable 
     289$copyright = __gettext("By checking this box, you are asserting that you have the legal right to share these uploaded files, and that you understand you are sharing it with other users of the system."); //gettext variable 
    286290$upload = __gettext("Upload"); //gettext variable 
    287291$body .= <<< END 
  • devel/mod/file/lib/files_actions.php

    r1119 r1223  
    6060            $max_quota = user_info('file_quota',$page_owner); 
    6161            $maxbytes = $max_quota - $total_quota; 
    62             $um = new upload_manager('new_file',false,true,false,$maxbytes,true); 
     62            // $um = new upload_manager('new_file',false,true,true,$maxbytes,true); 
     63            $um = new upload_manager('',false,true,true,$maxbytes,true); 
    6364            $reldir =  "files/" . $upload_folder . "/" . $ul_username . "/";  
    6465            $dir = $CFG->dataroot .$reldir; 
    6566            if ($um->process_file_uploads($dir)) { 
    66                 $f = new StdClass; 
    67                 $f->owner = $USER->ident; 
    68                 $f->files_owner = $page_owner; 
    69                 $f->folder =  $folderid; 
    70                 $f->originalname = $um->get_original_filename(); 
    71                 $f->title = $title; 
    72                 $f->description = $description; 
    73                 $f->location = $reldir . $um->get_new_filename(); 
    74                 $f->access = $access; 
    75                 $f->size = $um->get_filesize(); 
    76                 $f->time_uploaded = time(); 
    77                 $f = plugin_hook("file","create",$f); 
    78                 if (!empty($f)) { 
    79                     $file_id = insert_record('files',$f); 
    80                     $f->ident = $file_id; 
    81                     $value = trim(optional_param('new_file_keywords')); 
    82                     insert_tags_from_string ($value, 'file', $file_id, $access, $page_owner); 
    83                     $metadata = optional_param('metadata'); 
    84                     if (is_array($metadata)) { 
    85                         foreach($metadata as $name => $value) { 
    86                             $m = new StdClass; 
    87                             $m->name = trim($name); 
    88                             $m->value = trim($value); 
    89                             $m->file_id = $file_id; 
    90                             insert_record('file_metadata',$m); 
     67                foreach($um->files as $file) { 
     68                    if ($file['error'] == 0) { 
     69                        $f = new StdClass; 
     70                        $f->owner = $USER->ident; 
     71                        $f->files_owner = $page_owner; 
     72                        $f->folder =  $folderid; 
     73                        $f->originalname = $file['originalname']; 
     74                        $f->title = $title; 
     75                        $f->description = $description; 
     76                        $f->location = $reldir . $file['name']; 
     77                        $f->access = $access; 
     78                        $f->size = $file['size']; 
     79                        $f->time_uploaded = time(); 
     80                        $f = plugin_hook("file","create",$f); 
     81                        if (!empty($f)) { 
     82                            $file_id = insert_record('files',$f); 
     83                            $f->ident = $file_id; 
     84                            $value = trim(optional_param('new_file_keywords')); 
     85                            insert_tags_from_string ($value, 'file', $file_id, $access, $page_owner); 
     86                            $metadata = optional_param('metadata'); 
     87                            if (is_array($metadata)) { 
     88                                foreach($metadata as $name => $value) { 
     89                                    $m = new StdClass; 
     90                                    $m->name = trim($name); 
     91                                    $m->value = trim($value); 
     92                                    $m->file_id = $file_id; 
     93                                    insert_record('file_metadata',$m); 
     94                                } 
     95                            } 
     96                            plugin_hook("file","publish",$f); 
     97                            $rssresult = run("files:rss:publish", array($page_owner, false)); 
     98                            $rssresult = run("profile:rss:publish", array($page_owner, false)); 
     99                            $messages[] = __gettext("{$f->originalname} was successfully uploaded."); 
    91100                        } 
    92101                    } 
    93                     plugin_hook("file","publish",$f); 
    94                     $rssresult = run("files:rss:publish", array($page_owner, false)); 
    95                     $rssresult = run("profile:rss:publish", array($page_owner, false)); 
    96                     $messages[] = __gettext("The file was successfully uploaded."); 
    97102                } 
    98103            } else {