Changeset 11675 for extensions
- Timestamp:
- Jul 9, 2011, 3:30:34 PM (13 years ago)
- Location:
- extensions/Copyrights
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Copyrights/TODO
r11635 r11675 6 6 === Bugs === 7 7 - We don't check if the CR url has 'http://' (or is this a TODO?) 8 - Go to "unit mode", click "information", and you wont see the copyright...8 - Modify php, the copyrights select box is aligned center, and has a weird height, everythings works though -
extensions/Copyrights/admin.php
r11656 r11675 63 63 64 64 if ($counter != 0) { // The copyright exists already 65 array_push($page['errors'], l10n('This copyright already exists '));65 array_push($page['errors'], l10n('This copyright already exists.')); 66 66 } else { // The copyright did not yet exist 67 67 // Compose a query to insert the copyright -
extensions/Copyrights/image.php
r11656 r11675 1 1 <?php 2 /*3 This php file will insert the names of the copyrights into the images description,4 so you can see below the image what copyright it has.5 */6 2 7 3 // Add a prefilter … … 38 34 function copyrights_add_image_vars_to_template() 39 35 { 40 // For as far as i know i only need the $prefixtable, $page and $template41 //global $conf, $page, $template, $tab, $cit, $nbr, $prefixeTable;42 36 global $page, $template, $prefixeTable; 43 //load_language('plugin.lang', ADDINFO_PATH);44 //load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) );45 37 46 38 // Show block only on the photo page 47 39 if ( !empty($page['image_id']) ) 48 40 { 49 // Get the copyright name and url (FROM cr_admin) that belongs to the current media_item (FROM cr_media)41 // Get the copyright name, url and description that belongs to the current media_item 50 42 $query = ' 51 43 select name, url, descr -
extensions/Copyrights/language/en_UK/plugin.lang.php
r11292 r11675 8 8 $lang['Delete copyright'] = 'Delete copyright'; 9 9 $lang['Visible'] = 'Visible'; 10 11 // Isnt it smarter to translate them seperate - so you dont have to put so many entries in here... 10 $lang['This copyright already exists.'] = 'This copyright already exists.'; 12 11 13 12 ?> -
extensions/Copyrights/language/nl_NL/plugin.lang.php
r11292 r11675 8 8 $lang['Delete copyright'] = 'Verwijder copyright'; 9 9 $lang['Visible'] = 'Zichtbaar'; 10 $lang['This copyright already exists.'] = 'Deze copyright bestaat al.'; 10 11 11 12 ?> -
extensions/Copyrights/modify.php
r11638 r11675 3 3 // Add a prefilter 4 4 add_event_handler('loc_begin_admin', 'CR_set_prefilter_modify', 50 ); 5 add_event_handler('loc_ end_admin', 'CR_modify_submit', 50 );5 add_event_handler('loc_begin_admin', 'CR_modify_submit', 50 ); 6 6 7 7 // Change the variables used by the function that changes the template 8 add_event_handler('loc_ end_admin', 'CR_add_modify_vars_to_template');8 add_event_handler('loc_begin_admin', 'CR_add_modify_vars_to_template'); 9 9 10 10 function CR_set_prefilter_modify() … … 23 23 <select id="copyright" name="copyright"> 24 24 <option value="0">--</option> 25 {html_options options=$CRoptions selected=$CR copyrights[$CRid]}25 {html_options options=$CRoptions selected=$CRid} 26 26 </select> 27 27 </td> … … 36 36 function CR_add_modify_vars_to_template() 37 37 { 38 global $template; 38 // Check if we are at the modify page (the problem is that this will send the stuff to every admin page that has an ?image_id... 39 if (isset($_GET['image_id'])) 40 { 41 global $template; 39 42 40 load_language('plugin.lang', dirname(__FILE__).'/');43 load_language('plugin.lang', dirname(__FILE__).'/'); 41 44 42 // Fetch all the copyrights and assign them to the template43 $query = sprintf(44 'SELECT `cr_id`,`name`45 FROM %s46 WHERE `visible`<>047 ;',48 COPYRIGHTS_ADMIN);49 $result = pwg_query($query);45 // Fetch all the copyrights and assign them to the template 46 $query = sprintf( 47 'SELECT `cr_id`,`name` 48 FROM %s 49 WHERE `visible`<>0 50 ;', 51 COPYRIGHTS_ADMIN); 52 $result = pwg_query($query); 50 53 51 $CRoptions = array(); 52 while ($row = pwg_db_fetch_assoc($result)) { 53 $CRoptions[$row['cr_id']] = $row['name']; 54 $CRoptions = array(); 55 while ($row = pwg_db_fetch_assoc($result)) { 56 $CRoptions[$row['cr_id']] = $row['name']; 57 } 58 $template->assign('CRoptions', $CRoptions); 59 60 // Get the current Copyright 61 $image_id = $_GET['image_id']; 62 $query = sprintf( 63 'SELECT `media_id`, `cr_id` 64 FROM %s 65 WHERE `media_id` = %d 66 ;', 67 COPYRIGHTS_MEDIA, $image_id); 68 $result = pwg_query($query); 69 70 $CRid = 0; // Default is '--' 71 while ($row = pwg_db_fetch_assoc($result)) { 72 $CRid = $row['cr_id']; 73 } 74 $template->assign('CRid', $CRid); 54 75 } 55 $template->assign('CRoptions', $CRoptions);56 57 // Get the current Copyright58 $image_id = $_GET['image_id']);59 $query = sprintf(60 'SELECT `media_id`, `cr_id`61 FROM %s62 WHERE `media_id` = %d63 ;',64 COPYRIGHTS_MEDIA, $image_id);65 $result = pwg_query($query);66 67 $CRid = 0; // Default is '--'68 while ($row = pwg_db_fetch_assoc($result)) {69 $CRid = $row['cr_id'];70 }71 $template->assign('CRid', $CRid);72 76 } 73 77 74 78 function CR_modify_submit() 75 79 { 76 if (isset($_POST['submit'])) 80 // Check if we are at the modify page (the problem is that this will send the stuff to every admin page that has an ?image_id... 81 if (isset($_GET['image_id'])) 77 82 { 78 // The data from the submit 79 $image_id = $_GET['image_id']); 80 $CRid = $_POST['copyright']; 83 if (isset($_POST['submit'])) 84 { 85 // The data from the submit 86 $image_id = $_GET['image_id']; 87 $CRid = $_POST['copyright']; 81 88 82 // Delete the Copyright if it allready exists 89 // Delete the Copyright if it allready exists 90 $query = sprintf( 91 'DELETE 92 FROM %s 93 WHERE `media_id` = %d 94 ;', 95 COPYRIGHTS_MEDIA, $image_id); 96 pwg_query($query); 97 98 // Insert the Copyright 83 99 $query = sprintf( 84 'DELETE 85 FROM %s 86 WHERE `media_id` = %d 87 ;', 88 COPYRIGHTS_MEDIA, $image_id); 100 'INSERT INTO %s 101 VALUES (%d, %d) 102 ;', 103 COPYRIGHTS_MEDIA, $image_id, $CRid); 89 104 pwg_query($query); 90 91 // Insert the Copyright 92 $query = sprintf( 93 'INSERT INTO %s 94 VALUES (%d, %d) 95 ;', 96 COPYRIGHTS_MEDIA, $image_id, $CRid); 97 pwg_query($query); 105 } 98 106 } 99 107 }
Note: See TracChangeset
for help on using the changeset viewer.