Changeset 11678
- Timestamp:
- Jul 9, 2011, 4:43:05 PM (13 years ago)
- Location:
- extensions/Copyrights
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Copyrights/TODO
r11675 r11678 2 2 - Add Icon field to copyrights 3 3 - Show the copyright when image is displayed 4 It doesnt show a picture yet, but it does show the name of the copyright4 + It doesnt show a picture yet, but it does show the name of the copyright 5 5 6 6 === Bugs === -
extensions/Copyrights/admin.tpl
r11656 r11678 68 68 {else}{'No'|@translate}{/if} 69 69 </td> 70 <!-- Show nice Edit and Delete icons --> 70 71 <td> 71 72 <a href="{$COPYRIGHTS_PATH}-edit&id={$CR.cr_id}"> -
extensions/Copyrights/batch_global.php
r11439 r11678 21 21 22 22 // Assign the template for batch management 23 $template->set_filename(' batch_global', dirname(__FILE__).'/batch_global.tpl');23 $template->set_filename('CR_batch_global', dirname(__FILE__).'/batch_global.tpl'); 24 24 25 25 // Fetch all the copyrights and assign them to the template … … 39 39 40 40 // Add info on the "choose action" dropdown in the batch manager 41 42 41 $template->append('element_set_global_plugins_actions', array( 42 'ID' => 'copyrights', // ID of the batch manager action 43 43 'NAME' => l10n('Edit copyright'), // Description of the batch manager action 44 'CONTENT' => $template->parse('batch_global', true)45 44 'CONTENT' => $template->parse('CR_batch_global', true) 45 ) 46 46 ); 47 47 } 48 48 49 // * Deze functie wordt een keer aangeroepen, nadat de gebruiker submit. 50 // * Fietst met een foreach loop over de geselecteerde fotos 51 // * Rammelt alle toevoegingen in 1x met mass_updates naar de db. 49 // Process the submit action 52 50 function copyrights_batch_global_submit($action, $collection) 53 51 { … … 57 55 $crID = pwg_db_real_escape_string($_POST['copyrightID']); 58 56 59 if (count($collection) > 0) { 60 $query = sprintf( 57 // Delete any previously assigned copyrights 58 if (count($collection) > 0) { 59 $query = sprintf( 61 60 'DELETE 62 61 FROM %s … … 67 66 } 68 67 68 // Add the copyrights from the submit form to an array 69 69 $edits = array(); 70 70 foreach ($collection as $image_id) … … 79 79 } 80 80 81 // Insert the array into the database 81 82 mass_inserts( 82 COPYRIGHTS_MEDIA, // Table name83 array_keys($edits[0]), // Columns84 $edits // Data83 COPYRIGHTS_MEDIA, // Table name 84 array_keys($edits[0]), // Columns 85 $edits // Data 85 86 ); 86 87 } -
extensions/Copyrights/batch_global.tpl
r11635 r11678 1 <!-- Template for the copyright selector --> 1 2 <div id="copyrights"> 2 3 {'Copyright'|@translate} -
extensions/Copyrights/batch_single.php
r11635 r11678 1 1 <?php 2 2 3 // Add aprefilter3 // Add event handlers for the prefilter 4 4 add_event_handler('loc_end_element_set_unit', 'CR_set_prefilter_batch_single', 55 ); 5 5 add_event_handler('loc_begin_element_set_unit', 'CR_batch_single_submit', 50 ); … … 8 8 add_event_handler('loc_end_element_set_unit', 'CR_add_batch_single_vars_to_template'); 9 9 10 // Add a prefilter to the template 10 11 function CR_set_prefilter_batch_single() 11 12 { … … 14 15 } 15 16 17 // Insert the copyright selector to the template 16 18 function CR_batch_single($content, &$smarty) 17 19 { 18 $search = "#<td><strong>{'Creation date'#"; // Not ideal, but ok for now :)20 $search = "#<td><strong>{'Creation date'#"; 19 21 20 22 // We use the <tr> from the Creation date, and give them a new <tr> … … 31 33 <td><strong>{\'Creation date\''; 32 34 33 return preg_replace($search, $replacement, $content); 34 35 // Dit is een interresant testje - deze functie word dus een aantal keren (3) aangeroepen, 36 // en pas de laatste keer is bevat $content meer dan een aantal enters... 37 // return $content.'<div id="dwo_test" style="display: none;">'.$content.'</div>'; 35 return preg_replace($search, $replacement, $content); 38 36 } 39 37 38 // Assign the variables to the Smarty template 40 39 function CR_add_batch_single_vars_to_template() 41 40 { … … 70 69 while ($row = pwg_db_fetch_assoc($result)) { 71 70 $CRcopyrights[$row['media_id']] = $row['cr_id']; 72 } 71 } 72 73 // Assign the copyrights to the template 73 74 $template->assign('CRcopyrights', $CRcopyrights); 74 75 } 75 76 77 // Catch the submit and update the copyrights tables 76 78 function CR_batch_single_submit() 77 79 { … … 81 83 $collection = explode(',', $_POST['element_ids']); 82 84 83 // Delete all existing id's of which the Copyright is going to be set85 // Delete all existing id's of which the copyright is going to be set 84 86 if (count($collection) > 0) { 85 87 $query = sprintf( … … 90 92 COPYRIGHTS_MEDIA, implode(',', $collection)); 91 93 pwg_query($query); 92 } 93 // Add all Copyrights to an array 94 } 95 96 // Add all copyrights to an array 94 97 $edits = array(); 95 98 foreach ($collection as $image_id) { … … 105 108 ) 106 109 ); 107 } 108 // Add the array to the database 110 } 111 112 // Insert the array to the database 109 113 mass_inserts( 110 114 COPYRIGHTS_MEDIA, // Table name -
extensions/Copyrights/image.php
r11675 r11678 1 1 <?php 2 2 3 // Add a prefilter3 // Add an event handler for a prefilter 4 4 add_event_handler('loc_begin_picture', 'copyrights_set_prefilter_add_to_pic_info', 55 ); 5 5 … … 7 7 add_event_handler('loc_begin_picture', 'copyrights_add_image_vars_to_template'); 8 8 9 // Add the prefilter to the template 9 10 function copyrights_set_prefilter_add_to_pic_info() 10 11 { … … 13 14 } 14 15 16 // Insert the template for the copyright display 15 17 function copyrights_add_to_pic_info($content, &$smarty) 16 18 { … … 32 34 } 33 35 36 // Assign values to the variables in the template 34 37 function copyrights_add_image_vars_to_template() 35 38 { … … 40 43 { 41 44 // Get the copyright name, url and description that belongs to the current media_item 42 $query = '45 $query = sprintf(' 43 46 select name, url, descr 44 FROM '.COPYRIGHTS_ADMIN.' NATURAL JOIN '.COPYRIGHTS_MEDIA.'45 WHERE media_id = '.$page['image_id'].'47 FROM %s NATURAL JOIN %s 48 WHERE media_id = %s 46 49 AND visible = 1 47 ;'; 50 ;', 51 COPYRIGHTS_ADMIN, COPYRIGHTS_MEDIA, $page['image_id']); 48 52 $result = pwg_query($query); 49 53 $row = pwg_db_fetch_row($result); … … 58 62 59 63 // Sending data to the template 60 $template->assign( 61 array ( 62 'CR_INFO_NAME' => $name, 63 'CR_INFO_URL' => $url, 64 'CR_INFO_DESCR' => $descr 65 )); 64 $template->assign( 65 array ( 66 'CR_INFO_NAME' => $name, 67 'CR_INFO_URL' => $url, 68 'CR_INFO_DESCR' => $descr 69 ) 70 ); 66 71 } 67 72 } -
extensions/Copyrights/modify.php
r11676 r11678 21 21 $replacement = '<td><strong>{\'Copyright\'|@translate}</strong></td> 22 22 <td> 23 <select id="copyright _selector" name="copyright_selector">23 <select id="copyrightID" name="copyrightID"> 24 24 <option value="0">--</option> 25 25 {html_options options=$CRoptions selected=$CRid} … … 85 85 // The data from the submit 86 86 $image_id = $_GET['image_id']; 87 $CRid = $_POST['copyright _selector'];87 $CRid = $_POST['copyrightID']; 88 88 89 89 // Delete the Copyright if it allready exists
Note: See TracChangeset
for help on using the changeset viewer.