Changeset 11621
- Timestamp:
- Jul 4, 2011, 2:17:12 PM (13 years ago)
- Location:
- extensions/Copyrights
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Copyrights/TODO
r11615 r11621 6 6 - Add Icon field to copyrights 7 7 - Show the copyright when image is displayed 8 (It doesnt show the picture, but it does show the name of the copyright)8 (It doesnt show a picture yet, but it does show the name of the copyright) 9 9 10 10 === Bugs === 11 11 - If you create a new copyright with a name that's already used 12 12 - Description doesnt show with the copyright info (on the admin page) 13 - The warning triangle saying our plugin does not seem compatible 13 - The warning triangle saying our plugin does not seem compatible (version: ...) 14 14 - Cannot create a new copyright??? -
extensions/Copyrights/batch_single.php
r11619 r11621 2 2 3 3 // Add a prefilter 4 add_event_handler('loc_end_element_set_unit', ' set_prefilter_batch_single', 55 );4 add_event_handler('loc_end_element_set_unit', 'CR_set_prefilter_batch_single', 55 ); 5 5 add_event_handler('loc_end_element_set_unit', 'CR_batch_single_submit', 55 ); 6 6 7 7 // Change the variables used by the function that changes the template 8 //add_event_handler('loc_begin_admin', 'CR_add_bsm_vars_to_template');8 add_event_handler('loc_begin_admin', 'CR_add_batch_single_vars_to_template'); 9 9 10 function set_prefilter_batch_single()10 function CR_set_prefilter_batch_single() 11 11 { 12 12 global $template; … … 16 16 function CR_batch_single($content, &$smarty) 17 17 { 18 18 $search = "#<td><strong>{'Creation date'#"; // Not ideal, but ok for now :) 19 19 20 21 $replacement = '<td><strong>DWO TESTJE</strong></td>20 // We use the <tr> from the Creation date, and give them a new <tr> 21 $replacement = '<td><strong>{\'Copyright\'|@translate}</strong></td> 22 22 <td> 23 DWO TESTJE23 {html_options name=copyright-{$element.ID} options=$CRoptions} 24 24 </td> 25 25 </tr> … … 32 32 // Dit is een interresant testje - deze functie word dus een aantal keren (3) aangeroepen, 33 33 // en pas de laatste keer is bevat $content meer dan een aantal enters... 34 // return $content.'<div id="dwo_test" style="display: none;">'.$content.'</div>';34 // return $content.'<div id="dwo_test" style="display: none;">'.$content.'</div>'; 35 35 } 36 36 37 function CR_add_b sm_vars_to_template()37 function CR_add_batch_single_vars_to_template() 38 38 { 39 // set template variables ($CRoptions) 40 global $template; 41 load_language('plugin.lang', dirname(__FILE__).'/'); 42 // Fetch all the copyrights and assign them to the template 43 $query = sprintf( 44 'SELECT `cr_id`,`name` 45 FROM %s 46 WHERE `visible`<>0 47 ;', 48 COPYRIGHTS_ADMIN); 49 $result = pwg_query($query); 50 $CRoptions = array(); 51 while ($row = pwg_db_fetch_assoc($result)) { 52 $CRoptions[$row['cr_id']] = $row['name']; 53 } 54 $template->assign('CRoptions', $CRoptions); 39 global $template; 40 41 load_language('plugin.lang', dirname(__FILE__).'/'); 42 43 // Fetch all the copyrights and assign them to the template 44 $query = sprintf( 45 'SELECT `cr_id`,`name` 46 FROM %s 47 WHERE `visible`<>0 48 ;', 49 COPYRIGHTS_ADMIN); 50 $result = pwg_query($query); 51 52 $CRoptions = array(); 53 while ($row = pwg_db_fetch_assoc($result)) { 54 $CRoptions[$row['cr_id']] = $row['name']; 55 } 56 $template->assign('CRoptions', $CRoptions); 55 57 } 56 58 57 59 function CR_batch_single_submit() 58 60 { 59 // The image id's: 60 $collection = explode(',', $_POST['element_ids']); 61 62 // Delete all existing id's of which the Copyright is going to be set 63 if (count($collection) > 0) { 64 $query = sprintf( 65 'DELETE 66 FROM %s 67 WHERE media_id IN (%s) 68 ;', 69 COPYRIGHTS_MEDIA, implode(',', $collection)); 70 pwg_query($query); 71 } 72 $edits = array(); 73 foreach ($collection as $image_id) 74 { 75 // The copyright id's 76 $crID = pwg_db_real_escape_string($_POST['copyrightID-'.$image_id]); 77 78 array_push( 79 $edits, 80 array( 81 'media_id' => $image_id, 82 'cr_id' => $crID, 83 ) 84 ); 85 } 86 mass_inserts( 87 COPYRIGHTS_MEDIA, // Table name 88 array_keys($edits[0]), // Columns 89 $edits // Data 90 ); 61 // The image id's: 62 $collection = explode(',', $_POST['element_ids']); 63 64 // Delete all existing id's of which the Copyright is going to be set 65 if (count($collection) > 0) { 66 $query = sprintf( 67 'DELETE 68 FROM %s 69 WHERE media_id IN (%s) 70 ;', 71 COPYRIGHTS_MEDIA, implode(',', $collection)); 72 pwg_query($query); 73 } 74 // Add all Copyrights to an array 75 $edits = array(); 76 foreach ($collection as $image_id) { 77 // The copyright id's 78 $crID = pwg_db_real_escape_string($_POST['copyrightID-'.$image_id]); 79 80 array_push( 81 $edits, 82 array( 83 'media_id' => $image_id, 84 'cr_id' => $crID, 85 ) 86 ); 87 } 88 // Add the array to the database 89 mass_inserts( 90 COPYRIGHTS_MEDIA, // Table name 91 array_keys($edits[0]), // Columns 92 $edits // Data 93 ); 91 94 } 92 95 -
extensions/Copyrights/image.php
r11505 r11621 17 17 18 18 // Change the variables used by the function that changes the template 19 add_event_handler('loc_begin_picture', 'copyrights_add_ vars_to_template');19 add_event_handler('loc_begin_picture', 'copyrights_add_image_vars_to_template'); 20 20 21 21 function copyrights_set_prefilter_add_to_pic_info() … … 24 24 $template->set_prefilter('picture', 'copyrights_add_to_pic_info'); 25 25 } 26 27 26 28 // This function is called by the set_prefilter_add_to_pic_info function. It has something to do with the prefilter stuff, whatever it may be :p29 27 function copyrights_add_to_pic_info($content, &$smarty) 30 28 { 31 // Voeg de informatie toe na de auteur - dus voor de datum dat ie gemaakt is...29 // Add the information after the author - so before the createdate 32 30 $search = '#<tr id="datecreate">#'; 33 31 … … 46 44 } 47 45 48 function copyrights_add_ vars_to_template()46 function copyrights_add_image_vars_to_template() 49 47 { 50 48 // For as far as i know i only need the $prefixtable, $page and $template
Note: See TracChangeset
for help on using the changeset viewer.