Changeset 11623 for extensions
- Timestamp:
- Jul 4, 2011, 4:14:36 PM (13 years ago)
- Location:
- extensions/Copyrights
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Copyrights/TODO
r11621 r11623 4 4 SOURCES: "loc_begin_admin": http://piwigo.org/forum/viewtopic.php?id=17468 5 5 "use prefilters": http://piwigo.org/forum/viewtopic.php?id=17551&p=2 6 - This is almost done, except that you need to refresh the batch_unit page, to see the updated copyright 6 7 - Add Icon field to copyrights 7 8 - Show the copyright when image is displayed … … 12 13 - Description doesnt show with the copyright info (on the admin page) 13 14 - The warning triangle saying our plugin does not seem compatible (version: ...) 14 - Cannot create a new copyright??? 15 - Cannot create a new copyright??? (i assume its fixed, but Johan did, so he can remove the todo ;-) ) -
extensions/Copyrights/batch_single.php
r11622 r11623 3 3 // Add a prefilter 4 4 add_event_handler('loc_end_element_set_unit', 'CR_set_prefilter_batch_single', 55 ); 5 add_event_handler('loc_end_element_set_unit', 'CR_batch_single_submit', 5 5);5 add_event_handler('loc_end_element_set_unit', 'CR_batch_single_submit', 50 ); 6 6 7 7 // Change the variables used by the function that changes the template 8 add_event_handler('loc_ begin_admin', 'CR_add_batch_single_vars_to_template');8 add_event_handler('loc_end_element_set_unit', 'CR_add_batch_single_vars_to_template'); 9 9 10 10 function CR_set_prefilter_batch_single() … … 21 21 $replacement = '<td><strong>{\'Copyright\'|@translate}</strong></td> 22 22 <td> 23 {html_options name=copyright-{$element.ID} options=$CRoptions} 23 <select id="copyright-{$element.ID}" name="copyright-{$element.ID}"> 24 <option value="0">--</option> 25 {html_options options=$CRoptions selected=$CRcopyrights[$element.ID]} 26 </select> 24 27 </td> 25 28 </tr> … … 55 58 } 56 59 $template->assign('CRoptions', $CRoptions); 60 61 // Get the copyright for each element 62 $query = sprintf( 63 'SELECT `media_id`, `cr_id` 64 FROM %s 65 ;', 66 COPYRIGHTS_MEDIA); 67 $result = pwg_query($query); 68 69 $CRcopyrights = array(); 70 while ($row = pwg_db_fetch_assoc($result)) { 71 $CRcopyrights[$row['media_id']] = $row['cr_id']; 72 } 73 $template->assign('CRcopyrights', $CRcopyrights); 57 74 } 58 75 59 76 function CR_batch_single_submit() 60 77 { 61 // The image id's: 62 $collection = explode(',', $_POST['element_ids']); 78 if (isset($_POST['submit'])) 79 { 80 // The image id's: 81 $collection = explode(',', $_POST['element_ids']); 63 82 64 // Delete all existing id's of which the Copyright is going to be set65 if (count($collection) > 0) {66 $query = sprintf(67 'DELETE68 FROM %s69 WHERE media_id IN (%s)70 ;',71 COPYRIGHTS_MEDIA, implode(',', $collection));72 pwg_query($query);73 }74 // Add all Copyrights to an array75 $edits = array();76 foreach ($collection as $image_id) {77 // The copyright id's78 $crID = pwg_db_real_escape_string($_POST['copyrightID-'.$image_id]);83 // Delete all existing id's of which the Copyright is going to be set 84 if (count($collection) > 0) { 85 $query = sprintf( 86 'DELETE 87 FROM %s 88 WHERE media_id IN (%s) 89 ;', 90 COPYRIGHTS_MEDIA, implode(',', $collection)); 91 pwg_query($query); 92 } 93 // Add all Copyrights to an array 94 $edits = array(); 95 foreach ($collection as $image_id) { 96 // The copyright id's 97 $crID = pwg_db_real_escape_string($_POST['copyright-'.$image_id]); 79 98 80 array_push( 81 $edits, 82 array( 83 'media_id' => $image_id, 84 'cr_id' => $crID, 85 ) 99 array_push( 100 $edits, 101 array( 102 'media_id' => $image_id, 103 104 'cr_id' => $crID, 105 ) 106 ); 107 } 108 // Add the array to the database 109 mass_inserts( 110 COPYRIGHTS_MEDIA, // Table name 111 array_keys($edits[0]), // Columns 112 $edits // Data 86 113 ); 87 114 } 88 // Add the array to the database89 mass_inserts(90 COPYRIGHTS_MEDIA, // Table name91 array_keys($edits[0]), // Columns92 $edits // Data93 );94 115 } 95 116
Note: See TracChangeset
for help on using the changeset viewer.