Changeset 4807
- Timestamp:
- Jan 31, 2010, 1:54:55 AM (14 years ago)
- Location:
- extensions/upload_form
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/upload_form/include/functions_upload.inc.php
r4805 r4807 122 122 123 123 invalidate_user_cache(); 124 125 return $image_id; 124 126 } 125 127 -
extensions/upload_form/language/en_UK/plugin.lang.php
r4796 r4807 31 31 $lang['Category name'] = 'Category name'; 32 32 $lang['Category "%s" has been added'] = 'Category "%s" has been added'; 33 $lang['Uploaded Photos'] = 'Uploaded Photos'; 34 $lang['%d photos uploaded'] = '%d photos uploaded'; 35 $lang['Privacy level set to "%s"'] = 'Privacy level set to "%s"'; 36 $lang['Category "%s" now contains %d photos'] = 'Category "%s" now contains %d photos'; 33 37 ?> -
extensions/upload_form/language/fr_FR/plugin.lang.php
r4796 r4807 31 31 $lang['Category name'] = 'Nom de la catégorie'; 32 32 $lang['Category "%s" has been added'] = 'La catégorie "%s" a été ajoutée'; 33 $lang['Uploaded Photos'] = 'Photos ajoutées '; 34 $lang['%d photos uploaded'] = '%d photos ajoutées'; 35 $lang['Privacy level set to "%s"'] = 'Niveau de confidentialité "%s"'; 36 $lang['Category "%s" now contains %d photos'] = 'La catégorie "%s" contient désormais %d photos'; 33 37 ?> -
extensions/upload_form/upload.php
r4806 r4807 30 30 31 31 $admin_base_url = get_root_url().'admin.php?page=plugin§ion=upload_form%2Fupload.php'; 32 $thumbnails = array(); 32 33 33 34 // +-----------------------------------------------------------------------+ … … 53 54 (0 == $_POST['category_parent'] ? null : $_POST['category_parent']) 54 55 ); 56 57 $category_id = $output_create['id']; 55 58 56 59 if (isset($output_create['error'])) … … 60 63 else 61 64 { 65 $category_name = get_cat_display_name_from_id($category_id, 'admin.php?page=cat_modify&cat_id='); 62 66 // information 63 67 array_push( … … 65 69 sprintf( 66 70 l10n('Category "%s" has been added'), 67 '<em>'.get_cat_display_name_from_id($output_create['id']).'</em>' 68 ) 69 ); 70 } 71 72 $category_id = $output_create['id']; 71 '<em>'.$category_name.'</em>' 72 ) 73 ); 74 // TODO: add the onclick="window.open(this.href); return false;" 75 // attribute with jQuery on upload.tpl side for href containing 76 // "cat_modify" 77 } 73 78 } 74 79 … … 81 86 $source_filepath = $_FILES['image_upload']['tmp_name'][$idx]; 82 87 $original_filename = $_FILES['image_upload']['name'][$idx]; 83 add_uploaded_file($source_filepath, $original_filename, array($category_id), $_POST['level']); 88 89 $image_id = add_uploaded_file( 90 $source_filepath, 91 $original_filename, 92 array($category_id), 93 $_POST['level'] 94 ); 95 96 // TODO: if $image_id is not an integer, something went wrong 97 98 // we could return the list of properties from the add_uploaded_file 99 // function, but I like the "double check". And it costs nothing 100 // compared to the upload process. 101 $thumbnail = array(); 102 103 $query = ' 104 SELECT 105 file, 106 path, 107 tn_ext 108 FROM '.IMAGES_TABLE.' 109 WHERE id = '.$image_id.' 110 ;'; 111 $image_infos = mysql_fetch_assoc(pwg_query($query)); 112 113 $thumbnail['file'] = $image_infos['file']; 114 115 $thumbnail['src'] = get_thumbnail_location( 116 array( 117 'path' => $image_infos['path'], 118 'tn_ext' => $image_infos['tn_ext'], 119 ) 120 ); 121 122 // TODO: when implementing this plugin in Piwigo core, we should have 123 // a function get_image_name($name, $file) (if name is null, then 124 // compute a temporary name from filename) that would be also used in 125 // picture.php. UPDATE: in fact, "get_name_from_file($file)" already 126 // exists and is used twice (element_set_unit + comments, but not in 127 // picture.php I don't know why) with the same pattern if 128 // (empty($name)) {$name = get_name_from_file($file)}, a clean 129 // function get_image_name($name, $file) would be better 130 $thumbnail['title'] = get_name_from_file($image_infos['file']); 131 132 $thumbnail['link'] = PHPWG_ROOT_PATH.'admin.php?page=picture_modify' 133 .'&image_id='.$image_id 134 .'&cat_id='.$category_id 135 ; 136 137 array_push($thumbnails, $thumbnail); 84 138 } 85 139 } … … 88 142 $elapsed = ($endtime - $starttime) * 1000; 89 143 // printf('%.2f ms', $elapsed); 144 145 if (!empty($thumbnails)) 146 { 147 array_push( 148 $page['infos'], 149 sprintf( 150 l10n('%d photos uploaded'), 151 count($thumbnails) 152 ) 153 ); 154 155 if (0 != $_POST['level']) 156 { 157 array_push( 158 $page['infos'], 159 sprintf( 160 l10n('Privacy level set to "%s"'), 161 l10n( 162 sprintf('Level %d', $_POST['level']) 163 ) 164 ) 165 ); 166 } 167 168 if ('existing' == $_POST['category_type']) 169 { 170 $query = ' 171 SELECT 172 COUNT(*) 173 FROM '.IMAGE_CATEGORY_TABLE.' 174 WHERE category_id = '.$category_id.' 175 ;'; 176 list($count) = mysql_fetch_row(pwg_query($query)); 177 $category_name = get_cat_display_name_from_id($category_id, 'admin.php?page=cat_modify&cat_id='); 178 179 // information 180 array_push( 181 $page['infos'], 182 sprintf( 183 l10n('Category "%s" now contains %d photos'), 184 '<em>'.$category_name.'</em>', 185 $count 186 ) 187 ); 188 } 189 } 90 190 } 91 191 … … 104 204 'F_ADD_ACTION'=> $admin_base_url, 105 205 'plugin_path' => UPLOAD_FORM_PATH, 206 'thumbnails' => $thumbnails, 106 207 ) 107 208 ); … … 131 232 ) 132 233 ); 133 134 234 135 235 // +-----------------------------------------------------------------------+ -
extensions/upload_form/upload.tpl
r4805 r4807 39 39 </div> 40 40 {else} 41 42 {if !empty($thumbnails)} 43 <fieldset> 44 <legend>{'Uploaded Photos'|@translate}</legend> 45 <div> 46 {foreach from=$thumbnails item=thumbnail} 47 <a href="{$thumbnail.link}" onclick="window.open(this.href); return false;"> 48 <img src="{$thumbnail.src}" alt="{$thumbnail.file}" title="{$thumbnail.title}" class="thumbnail"> 49 </a> 50 {/foreach} 51 </div> 52 </fieldset> 53 {/if} 54 55 41 56 <form enctype="multipart/form-data" method="post" action="{$F_ACTION}" class="properties"> 42 57 <fieldset>
Note: See TracChangeset
for help on using the changeset viewer.