Changeset 15149
- Timestamp:
- May 20, 2012, 12:38:07 PM (12 years ago)
- Location:
- extensions/typetags
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/typetags/admin.php
r12483 r15149 26 26 // +-----------------------------------------------------------------------+ 27 27 28 if ( isset($_POST['edittypetag']) and (empty($_POST['typetag_name']) or empty($_POST['typetag_color'])))28 if ( isset($_POST['edittypetag']) and (empty($_POST['typetag_name']) or empty($_POST['typetag_color'])) ) 29 29 { 30 30 $edited_typetag = array( … … 33 33 'color' => $_POST['typetag_color'], 34 34 ); 35 $page['errors'][] = l10n('typetag_error'); 35 36 array_push($page['errors'], l10n('typetag_error')); 36 37 } 37 38 else if (isset($_POST['edittypetag'])) 38 39 { 39 $typetag = mysql_escape_string($_POST['edited_typetag']);40 $typetag_name = mysql_escape_string($_POST['typetag_name']);41 $typetag_color = mysql_escape_string($_POST['typetag_color']);42 43 $all_typetags = pwg_query("44 SELECT45 id,46 name,47 color48 FROM `". typetags_TABLE ."`;49 ");50 51 while ($row = mysql_fetch_array($all_typetags))52 {53 $existing_names[] = $row['name'];54 if ($typetag == $row['id'])55 {56 $current_name = $row['name'];57 $current_color = $row['color'];58 }59 }60 61 40 // we must not rename typetag with an already existing name 62 if ($typetag_name != $current_name AND in_array($typetag_name, $existing_names)) 41 $query = ' 42 SELECT id 43 FROM '.typetags_TABLE.' 44 WHERE 45 name = "'.$_POST['typetag_name'].'" 46 AND id != '.$_POST['edited_typetag'].' 47 ;'; 48 49 if ( pwg_db_num_rows(pwg_query($query)) ) 63 50 { 64 51 $edited_typetag = array( 65 'id' => $ typetag,66 'name' => $ typetag_name,67 'color' => $ typetag_color,52 'id' => $_POST['edited_typetag'], 53 'name' => $_POST['typetag_name'], 54 'color' => $_POST['typetag_color'], 68 55 ); 69 56 70 $page['errors'][] = l10n('typetag_already_exists');57 array_push($page['errors'], l10n('typetag_already_exists')); 71 58 } 72 59 else 73 60 { 74 pwg_query(" 75 UPDATE `". typetags_TABLE ."` SET 76 `name` = '". $typetag_name ."', 77 `color` = '". $typetag_color ."' 78 WHERE `id` = ". $typetag ."; 79 "); 80 81 $page['infos'][] = l10n('typetag_saved'); 61 $query = ' 62 UPDATE '.typetags_TABLE.' 63 SET 64 name = "'.$_POST['typetag_name'].'", 65 color = "'.$_POST['typetag_color'].'" 66 WHERE id = '.$_POST['edited_typetag'].' 67 ;'; 68 pwg_query($query); 69 70 array_push($page['infos'], l10n('typetag_saved')); 82 71 } 83 72 } … … 89 78 if (isset($_GET['deletetypetag'])) 90 79 { 91 $query = " 92 SELECT name 93 FROM `". typetags_TABLE ."` 94 WHERE id = ". $_GET['deletetypetag'] ."; 95 "; 96 $typetag_name = array_from_query($query, 'name'); 97 98 if (count($typetag_name) != 0) 99 { 100 pwg_query(" 101 UPDATE `". TAGS_TABLE ."` 102 SET id_typetags = NULL 103 WHERE id_typetags = ". $_GET['deletetypetag'] ."; 104 "); 105 106 pwg_query(" 107 DELETE FROM `". typetags_TABLE ."` 108 WHERE id = ". $_GET['deletetypetag'] ."; 109 "); 110 111 $page['infos'][] = l10n('typetag_suppr').' : '.$typetag_name[0]; 80 $query = ' 81 SELECT id 82 FROM '.typetags_TABLE.' 83 WHERE id = '.$_GET['deletetypetag'].' 84 ;'; 85 86 if ( pwg_db_num_rows(pwg_query($query)) ) 87 { 88 $query = ' 89 UPDATE '.TAGS_TABLE.' 90 SET id_typetags = NULL 91 WHERE id_typetags = '.$_GET['deletetypetag'].' 92 ;'; 93 pwg_query($query); 94 95 $query = ' 96 DELETE FROM '.typetags_TABLE.' 97 WHERE id = '.$_GET['deletetypetag'].' 98 ;'; 99 pwg_query($query); 100 101 array_push($page['infos'], l10n('typetag_suppr')); 112 102 } 113 103 else 114 104 { 115 $page['errors'][] = l10n('typetag_unknown').' : '.$_GET['deletetypetag'];105 array_push($page['errors'], l10n('typetag_unknown')); 116 106 } 117 107 } … … 121 111 // +-----------------------------------------------------------------------+ 122 112 123 if ( isset($_POST['addtypetag']) and (empty($_POST['typetag_name']) or empty($_POST['typetag_color'])))113 if ( isset($_POST['addtypetag']) and (empty($_POST['typetag_name']) or empty($_POST['typetag_color'])) ) 124 114 { 125 115 $template->assign('typetag', array( 126 'NAME' => isset($_POST['typetag_name']) ? $_POST['typetag_name'] : '',127 'COLOR' => isset($_POST['typetag_color']) ? $_POST['typetag_color'] : '',116 'NAME' => $_POST['typetag_name'], 117 'COLOR' => $_POST['typetag_color'], 128 118 )); 129 119 130 $page['errors'][] = l10n('typetag_error');120 array_push($page['errors'], l10n('typetag_error')); 131 121 } 132 122 else if (isset($_POST['addtypetag'])) … … 136 126 137 127 // does the tag already exists? 138 $query = " 139 SELECT id 140 FROM `". typetags_TABLE ."` 141 WHERE name = '". $typetag_name ."'; 142 "; 143 $existing_tags = array_from_query($query, 'id'); 144 145 if (count($existing_tags) == 0) 146 { 147 pwg_query(" 148 INSERT INTO `". typetags_TABLE ."`( 149 `name`, 150 `color` 151 ) 152 VALUES( 153 '". $typetag_name ."', 154 '". $typetag_color ."' 155 ); 156 "); 157 158 $page['infos'][] = l10n('typetag_saved'); 128 $query = ' 129 SELECT id 130 FROM '.typetags_TABLE.' 131 WHERE name = "'.$_POST['typetag_name'].'" 132 '; 133 134 if ( pwg_db_num_rows(pwg_query($query)) ) 135 { 136 $template->assign('typetag', array( 137 'NAME' => $_POST['typetag_name'], 138 'COLOR' => $_POST['typetag_color'], 139 )); 140 141 array_push($page['errors'], l10n('typetag_already_exists')); 159 142 } 160 143 else 161 144 { 162 $template->assign('typetag', array( 163 'NAME' => $typetag_name, 164 'COLOR' => $typetag_color, 165 )); 166 167 $page['errors'][] = l10n('typetag_already_exists'); 145 $query = ' 146 INSERT INTO '.typetags_TABLE.'( 147 name, 148 color 149 ) 150 VALUES( 151 "'.$_POST['typetag_name'].'", 152 "'.$_POST['typetag_color'].'" 153 ) 154 ;'; 155 pwg_query($query); 156 157 array_push($page['infos'], l10n('typetag_saved')); 168 158 } 169 159 } … … 175 165 if (isset($_POST['delete_all_assoc'])) 176 166 { 177 pwg_query("UPDATE `". TAGS_TABLE ."` SET id_typetags = NULL;"); 178 $page['infos'][] = l10n('All associations have been removed'); 179 167 pwg_query('UPDATE '.TAGS_TABLE.' SET id_typetags = NULL;'); 168 array_push($page['infos'], l10n('All associations have been removed')); 180 169 } 181 170 else if (isset($_POST['associations'])) 182 171 { 183 // beautify the parameters array 184 $string = preg_replace('#[;]$#', '', $_POST['associations']); 185 $associations = array(); 186 $a = explode(';', $string); 187 188 foreach ($a as $s) 189 { 190 $v = explode(':', $s); 191 $associations[ltrim($v[0],'t-')] = ltrim($v[1],'tt-'); 192 } 193 194 // save associations 195 foreach ($associations AS $tag => $typetag) 196 { 197 pwg_query(" 198 UPDATE `". TAGS_TABLE ."` 199 SET id_typetags = ". $typetag ." 200 WHERE id = ". $tag ."; 201 "); 202 } 203 204 $page['infos'][] = l10n('typetags_associated'); 205 } 206 172 // beautify the parameters array 173 $string = preg_replace('#[;]$#', null, $_POST['associations']); 174 $associations = array(); 175 $a = explode(';', $string); 176 177 foreach ($a as $s) 178 { 179 $v = explode(':', $s); 180 $associations[ltrim($v[0],'t-')] = ltrim($v[1],'tt-'); 181 } 182 183 // save associations 184 $updates = array(); 185 foreach ($associations as $tag => $typetag) 186 { 187 array_push($updates, array( 188 'id' => $tag, 189 'id_typetags' => $typetag, 190 )); 191 } 192 193 mass_updates( 194 TAGS_TABLE, 195 array('primary' => array('id'), 'update' => array('id_typetags')), 196 $updates 197 ); 198 199 array_push($page['infos'], l10n('typetags_associated')); 200 } 201 202 // +-----------------------------------------------------------------------+ 203 // | Configuration | 204 // +-----------------------------------------------------------------------+ 205 if (isset($_POST['save_config'])) 206 { 207 $conf['TypeTags'] = array( 208 'show_all' => $_POST['show_all'] == 'true', 209 ); 210 211 conf_update_param('TypeTags', serialize($conf['TypeTags'])); 212 } 213 214 $template->assign('SHOW_ALL', $conf['TypeTags']['show_all']); 207 215 208 216 // +-----------------------------------------------------------------------+ … … 212 220 $template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin/typetags_admin.tpl')); 213 221 214 // Récupère tous les tags 215 $all_tags = pwg_query(" 216 SELECT 217 t.id as tagid, 218 t.name as tagname, 219 tt.id as typetagid, 220 tt.name as typetagname 221 FROM `". TAGS_TABLE ."` as t 222 LEFT JOIN `". typetags_TABLE ."` as tt 223 ON t.id_typetags = tt.id 224 ORDER BY t.name ASC; 225 "); 226 227 while ($row = pwg_db_fetch_assoc($all_tags)) { 228 if ($row['typetagname'] == null) $row['typetagid'] = 'NULL'; 229 $row['tagname'] = trigger_event('render_tag_name', $row['tagname']); 222 // get all tags 223 $query = ' 224 SELECT 225 id as tagid, 226 name as tagname, 227 id_typetags as typetagid 228 FROM '.TAGS_TABLE.' 229 ORDER BY name ASC 230 ;'; 231 $all_tags = pwg_query($query); 232 233 while ($row = pwg_db_fetch_assoc($all_tags)) 234 { 235 if (!$row['typetagid']) $row['typetagid'] = 'NULL'; 236 $row['tagname'] = strip_tags(trigger_event('render_tag_name', $row['tagname'])); 230 237 $template->append('typetags_association', $row); 231 238 } 232 239 233 // Récupère tous les typetags 234 $all_typetags = pwg_query("SELECT * FROM `". typetags_TABLE ."` ORDER BY `name`;"); 240 // get all typetags 241 $query = 'SELECT * FROM '.typetags_TABLE.' ORDER BY name;'; 242 $all_typetags = pwg_query($query); 235 243 236 244 while ($row = mysql_fetch_assoc($all_typetags)) … … 243 251 } 244 252 245 // formualire d'édition 246 if (isset($_GET['edittypetag'])) { 253 // edit form 254 if (isset($_GET['edittypetag'])) 255 { 247 256 $edited_typetag['id'] = $_GET['edittypetag']; 248 257 } … … 251 260 { 252 261 $template->assign('edited_typetag', $edited_typetag['id']); 253 254 $tag = pwg_query(" 255 256 257 258 259 FROM `". typetags_TABLE ."`260 WHERE id = ".$edited_typetag['id'].";261 ");262 $row = pwg_db_fetch_assoc( $tag);262 263 $query = ' 264 SELECT 265 id, 266 name, 267 color 268 FROM '.typetags_TABLE.' 269 WHERE id = '.$edited_typetag['id'].' 270 ;'; 271 $row = pwg_db_fetch_assoc(pwg_query($query)); 263 272 264 273 $template->assign('typetag', array( -
extensions/typetags/admin/typetags_admin.tpl
r10987 r15149 5 5 {combine_css path=$ROOT_URL|@cat:"plugins/typetags/admin/typetags_style.css"} 6 6 7 {footer_script} 8 {literal} 9 $(document).ready(function(){ 10 // colorpicker 11 $('#colorpicker').farbtastic('#hexval'); 12 13 // déplace chaque élément dans la bonne case 14 jQuery('ul#tt-NULL li').each(function() { 15 var $target = jQuery('ul#' + jQuery(this).attr('title')); 16 jQuery(this).appendTo($target).css('float', 'left'); 7 {footer_script}{literal} 8 // set all containers the same size 9 function equilibrate() { 10 var h=0; 11 jQuery("#associations ul") 12 .css('height', 'auto') 13 .each(function() { 14 h = Math.max(h, jQuery(this).height()); 15 }) 16 .promise().done(function() { 17 jQuery("#associations ul").css({'height': h+'px'}); 17 18 }); 18 19 19 // initialise les déplacement 20 jQuery("li").draggable({ 21 revert: "invalid", 22 helper: "clone", 23 cursor: "move" 20 //jQuery("#tt-NULL").css('height', 'auto'); 21 } 22 23 // generate tag:typetag couples before submit the form 24 function save_datas(form) { 25 var out = ''; 26 27 jQuery(".tt-container").each(function() { 28 var section = jQuery(this).attr('id'); 29 jQuery("> li", this).each(function() { 30 out += jQuery(this).attr('id') + ':' + section + ';'; 24 31 }); 32 }); 33 34 jQuery('#assoc-input').val(out); 35 submit(form); 36 } 25 37 26 // initialise le dépôt 27 jQuery('.tt-container').droppable({ 28 accept: "li", 29 hoverClass: "active", 30 drop: function(event, ui) { 31 var $gallery = this; 32 ui.draggable.fadeOut(function() { 33 jQuery(this).appendTo($gallery).fadeIn(); 34 equilibrate(); // on rééquilibre les colonnes à chaque déplacement 35 }); 36 } 37 }); 38 39 // équilibrage des colonnes 40 equilibrate(); 41 }); 42 43 function equilibrate() { 44 jQuery("#associations").each(function(){ 45 var h=0; 46 jQuery("> ul", this).css('height', 'auto') 47 .each(function(){ h=Math.max(h,jQuery(this).height()); }) 48 .css({'height': h+'px'}); 49 }); 38 // colorpicker 39 jQuery('#colorpicker').farbtastic('#hexval'); 40 41 // move each tag in it's typetag container 42 jQuery('ul#tt-NULL li').each(function() { 43 var $target = jQuery('ul#' + jQuery(this).attr('data')); 44 jQuery(this).appendTo($target).css('float', 'left'); 45 if ($($target).attr('id') == 'tt-NULL') jQuery(this).css({'display':'inline-block','float':'none'}); 46 }); 47 equilibrate(); 48 49 // init drag 50 jQuery("li").draggable({ 51 revert: "invalid", 52 helper: "clone", 53 cursor: "move" 54 }); 55 56 // init drop 57 jQuery('.tt-container').droppable({ 58 accept: "li", 59 hoverClass: "active", 60 drop: function(event, ui) { 61 var $gallery = this; 62 ui.draggable.fadeOut(function() { 63 jQuery(this).appendTo($gallery).css('float', 'left').css('display','').fadeIn(); 64 if ($($gallery).attr('id') == 'tt-NULL') jQuery(this).css({'display':'inline-block','float':'none'}); 65 equilibrate(); 66 }); 50 67 } 51 52 // génération des couples tag:typetag avant de valider le formulaire 53 function save_datas(form) { 54 var out = ''; 55 56 jQuery(".tt-container").each(function(){ 57 var section = jQuery(this).attr('id'); 58 jQuery("> li", this).each(function(){ 59 out += jQuery(this).attr('id') + ':' + section + ';'; 60 }); 61 }); 62 63 jQuery('#assoc-input').val(out); 64 submit(form); 65 } 66 {/literal} 67 {/footer_script} 68 }); 69 {/literal}{/footer_script} 68 70 69 71 <div class="titrePage"> … … 72 74 73 75 <form action="{$typetags_ADMIN}" method="post" name="form"> 76 <fieldset> 77 <legend>{'Configuration'|@translate}</legend> 78 <b>{'Display colored tags'|@translate}</b> 79 <label><input type="radio" name="show_all" value="false" {if not $SHOW_ALL}checked="checked"{/if}> {'Only on tags page'|@translate}</label> 80 <label><input type="radio" name="show_all" value="true" {if $SHOW_ALL}checked="checked"{/if}> {'Everywhere'|@translate}</label> 81 <p><input class="submit" type="submit" name="save_config" value="{'Submit'|@translate}"></p> 82 </fieldset> 83 </form> 84 85 <form action="{$typetags_ADMIN}" method="post" name="form"> 74 86 <fieldset> 75 87 {if isset($edited_typetag)} 76 88 <legend>{'Edit typetag'|@translate}</legend> 77 <input type="hidden" name="edited_typetag" value="{$edited_typetag}" />78 89 <div class="edit-container"> 79 90 <div id="colorpicker" style="float:right;"></div> 80 91 <p><b>{'Edited TypeTag'|@translate} : <input type="text" readonly="readonly" size="18" style="background-color:{$typetag.OLD_COLOR};color:{$typetag.COLOR_TEXT};" value="{$typetag.OLD_NAME}"></b></p> 81 92 <p> </p> 82 <p>{'New name'|@translate} : <input type="text" size="18" name="typetag_name" value="{$typetag.NAME}" /></p>83 <p>{'New color'|@translate} : <input type="text" id="hexval" name="typetag_color" size="7" maxlength="7" value="{$typetag.COLOR}" /></p>93 <p>{'New name'|@translate} : <input type="text" size="18" name="typetag_name" value="{$typetag.NAME}"></p> 94 <p>{'New color'|@translate} : <input type="text" id="hexval" name="typetag_color" size="7" maxlength="7" value="{$typetag.COLOR}"></p> 84 95 <p> </p> 85 96 <p> 86 <input class="submit" type="submit" name="edittypetag" value="{'Modify'|@translate}"/> 87 <input class="submit" type="submit" name="cancel" value="{'Reset'|@translate}"/> 97 <input type="hidden" name="edited_typetag" value="{$edited_typetag}"> 98 <input class="submit" type="submit" name="edittypetag" value="{'Modify'|@translate}"> 99 <input class="submit" type="submit" name="cancel" value="{'Reset'|@translate}"> 88 100 </p> 89 101 </div> … … 93 105 <div id="colorpicker" style="float:right;"></div> 94 106 <p> </p> 95 <p>{'New TypeTag'|@translate} : <input type="text" size="18" name="typetag_name" value="{if isset($typetag.NAME)}{$typetag.NAME}{/if}" /></p>96 <p>{'Color TypeTag'|@translate} : <input type="text" id="hexval" name="typetag_color" size="7" maxlength="7" value="{if isset($typetag.COLOR)}{$typetag.COLOR}{else}#444444{/if}" /></p>107 <p>{'New TypeTag'|@translate} : <input type="text" size="18" name="typetag_name" value="{if isset($typetag.NAME)}{$typetag.NAME}{/if}"></p> 108 <p>{'Color TypeTag'|@translate} : <input type="text" id="hexval" name="typetag_color" size="7" maxlength="7" value="{if isset($typetag.COLOR)}{$typetag.COLOR}{else}#444444{/if}"></p> 97 109 <p> </p> 98 110 <p> 99 <input class="submit" type="submit" name="addtypetag" value="{'Create a Typetag'|@translate}" />111 <input class="submit" type="submit" name="addtypetag" value="{'Create a Typetag'|@translate}"> 100 112 </p> 101 113 </div> … … 104 116 </form> 105 117 106 {if !empty($typetags_selection)} 118 {if !empty($typetags_selection)} 119 <form action="{$typetags_ADMIN}" method="post" name="form" onsubmit="save_datas(this);"> 107 120 <fieldset> 108 <legend>{'TypeTag selection'|@translate}</legend> 109 <ul class="tagSelection"> 110 {foreach from=$typetags_selection item=typetag} 111 <li> 112 <input type="text" readonly="readonly" style="background-color:{$typetag.color};color:{$typetag.color_text};margin:5px 0;" value="{$typetag.name}"> 113 <a href="{$typetag.u_edit}" title="{'edit'|@translate}"><img src="{$themeconf.icon_dir}/edit.png" class="button" alt="{'edit'|@translate}"/></a> 114 <a href="{$typetag.u_delete}" title="{'delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate}');"><img src="{$themeconf.admin_icon_dir}/plug_delete.png" class="button" alt="{'delete'|@translate}"/></a> 115 </li> 116 {/foreach} 117 </ul> 118 </fieldset> 119 {/if} 120 121 <form action="{$typetags_ADMIN}" method="post" name="form" onsubmit="save_datas(this);"> 122 {if !empty($typetags_association) and !empty($typetags_selection)} 123 <fieldset> 124 <legend>{'TypeTag association'|@translate}</legend> 121 <legend>{'Edit and associate TypeTags'|@translate}</legend> 125 122 126 123 <ul id="tt-NULL" class="tt-container NULL"> 127 <h5> Non associés</h5>124 <h5>{'Not associated'|@translate}</h5> 128 125 {foreach from=$typetags_association item=tag} 129 <li id="t-{$tag.tagid}" title="tt-{$tag.typetagid}">126 <li id="t-{$tag.tagid}" data="tt-{$tag.typetagid}"> 130 127 {$tag.tagname} 131 128 </li> … … 136 133 {foreach from=$typetags_selection item=typetag} 137 134 <ul id="tt-{$typetag.id}" class="tt-container" style="box-shadow:inset 0 0 5px {$typetag.color};"> 135 <span class="buttons"> 136 <a href="{$typetag.u_edit}" title="{'edit'|@translate}"><img src="{$themeconf.icon_dir}/edit.png" class="button" alt="{'edit'|@translate}"></a> 137 <a href="{$typetag.u_delete}" title="{'delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate}');"><img src="{$themeconf.icon_dir}/delete.png" class="button" alt="{'delete'|@translate}"></a> 138 </span> 138 139 <h5 style="background-color:{$typetag.color};color:{$typetag.color_text};">{$typetag.name}</h5> 139 140 </ul> … … 141 142 </div> 142 143 143 <p style="clear:both;"> 144 <input type="hidden" name="associations" id="assoc-input"/> 145 <input class="submit" type="submit" name="associate" value="{'Validate'|@translate}"/> 146 <input class="submit" type="submit" name="delete_all_assoc" value="{'Delete all associations'|@translate}" onclick="return confirm('{'Are you sure?'|@translate}');"/> 144 <div style="clear:both;"></div> 145 <p style="margin-top:20px;"> 146 <input type="hidden" name="associations" id="assoc-input"> 147 <input class="submit" type="submit" name="associate" value="{'Validate'|@translate}"> 148 <input class="submit" type="submit" name="delete_all_assoc" value="{'Delete all associations'|@translate}" onclick="return confirm('{'Are you sure?'|@translate}');"> 147 149 </p> 148 150 </fieldset> 149 {/if}150 151 </form> 152 {/if} -
extensions/typetags/admin/typetags_style.css
r10987 r15149 13 13 .tt-container { 14 14 float:left; 15 width: 150px;16 min-height: 50px;15 width:250px; 16 min-height:40px; 17 17 height:auto; 18 18 margin:5px !important; … … 25 25 display:inline; 26 26 float:none; 27 padding:2px 8px; 28 margin:5px; 27 padding:2px 5px; 28 margin:3px; 29 font-size:0.85em; 29 30 background-color:#ddd; 30 31 box-shadow:1px 1px 0px #fff; … … 37 38 } 38 39 .tt-container h5 { 39 margin:0 -5px ;40 margin:0 -5px 5px -5px; 40 41 border-radius:5px 5px 0 0; 41 42 padding:2px 0; … … 50 51 51 52 .tt-container.NULL { 52 width:98%; 53 float:none; 54 width:auto; 53 55 box-shadow:inset 0 0 5px #bbb; 54 56 padding-bottom:10px; … … 58 60 font-weight:bold; 59 61 } 62 63 .buttons { 64 float:right; 65 margin-left:-37px; 66 margin-top:2px; 67 } -
extensions/typetags/language/cs_CZ/plugin.lang.php
r14334 r15149 32 32 $lang['Edited TypeTag'] = 'TypeTag změněn'; 33 33 $lang['New TypeTag'] = 'Název TypeTagu'; 34 $lang['TypeTag association'] = 'Přiřadit - zrušit přiřazení TypeTagů';35 $lang['TypeTag selection'] = 'Změnit - smazat TypeTag';36 34 $lang['typetag_already_exists'] = 'Tento TypeTag už existuje'; 37 35 $lang['typetag_saved'] = 'TypeTag uložen'; -
extensions/typetags/language/de_DE/plugin.lang.php
r9863 r15149 4 4 $lang['Create a Typetag'] = 'Einen TypeTag erstellen'; 5 5 $lang['Edit typetag'] = 'TypeTag bearbeiten'; 6 $lang['TypeTag selection'] = 'TypeTags bearbeiten - löschen';7 $lang['TypeTag association'] = 'TypeTags assoziieren - dissoziieren';8 6 9 7 /* fields */ -
extensions/typetags/language/en_UK/plugin.lang.php
r9863 r15149 4 4 $lang['Create a Typetag'] = 'Create a TypeTag'; 5 5 $lang['Edit typetag'] = 'Edit TypeTag'; 6 $lang['TypeTag selection'] = 'Edit - Delete TypeTags'; 7 $lang['TypeTag association'] = 'Associate - Dissociate TypeTags'; 6 $lang['Edit and associate TypeTags'] = 'Edit and associate TypeTags'; 8 7 9 8 /* fields */ … … 13 12 $lang['New name'] = 'New name'; 14 13 $lang['Color TypeTag'] = 'TypeTag color'; 14 $lang['Not associated'] = 'Not associated'; 15 $lang['Display colored tags'] = 'Display colored tags'; 16 $lang['Only on tags page'] = 'Only on tags page'; 17 $lang['Everywhere'] = 'Everywhere'; 15 18 16 19 /* buttons */ -
extensions/typetags/language/es_ES/plugin.lang.php
r9863 r15149 4 4 $lang['Create a Typetag'] = 'Crear TypeTag'; 5 5 $lang['Edit typetag'] = 'Editar TypeTag'; 6 $lang['TypeTag selection'] = 'Editar - Suprimir TypeTags';7 $lang['TypeTag association'] = 'Asociar - Disociar TypeTags';8 6 9 7 /* fields */ -
extensions/typetags/language/fr_FR/plugin.lang.php
r9863 r15149 4 4 $lang['Create a Typetag'] = 'Créer un TypeTag'; 5 5 $lang['Edit typetag'] = 'Editer le TypeTag'; 6 $lang['TypeTag selection'] = 'Editer - Supprimer des TypeTags'; 7 $lang['TypeTag association'] = 'Associer - Dissocier des TypeTags'; 6 $lang['Edit and associate TypeTags'] = 'Editer et associer les TypeTags'; 8 7 9 8 /* fields */ … … 13 12 $lang['New name'] = 'Nouveau nom'; 14 13 $lang['Color TypeTag'] = 'Couleur du TypeTag'; 14 $lang['Not associated'] = 'Non associés'; 15 $lang['Display colored tags'] = 'Afficher les tags colorés'; 16 $lang['Only on tags page'] = 'Seulement sur la page des tags'; 17 $lang['Everywhere'] = 'Partout'; 15 18 16 19 /* buttons */ -
extensions/typetags/language/it_IT/plugin.lang.php
r13946 r15149 4 4 $lang['Create a Typetag'] = 'Creare un TypeTag'; 5 5 $lang['Edit typetag'] = 'Modificare i TypeTag'; 6 $lang['TypeTag selection'] = 'Modificare - Cancellare i TypeTags';7 $lang['TypeTag association'] = 'Associare - Dissociare i TypeTags';8 6 9 7 /* fields */ -
extensions/typetags/language/lv_LV/plugin.lang.php
r9863 r15149 4 4 $lang['Create a Typetag'] = 'Izveidot TypeTag'; 5 5 $lang['Edit typetag'] = 'Rediģēt TypeTag'; 6 $lang['TypeTag selection'] = 'Rediģēt - Dzēst TypeTags';7 $lang['TypeTag association'] = 'Sasaistīt - Atsaistīt TypeTags';8 6 9 7 /* fields */ -
extensions/typetags/language/nl_NL/plugin.lang.php
r14812 r15149 31 31 $lang['New color'] = 'Nieuwe kleur'; 32 32 $lang['New name'] = 'Nieuwe naam'; 33 $lang['TypeTag association'] = 'Toekennen - Verwijderen van TypeTags';34 $lang['TypeTag selection'] = 'Wijzig - Verwijder TypeTags';35 33 $lang['typetag_already_exists'] = 'Deze TypeTag bestaat al'; 36 34 $lang['typetag_error'] = 'Je moet alle velden invullen (naam en kleur)'; -
extensions/typetags/language/no_NO/plugin.lang.php
r9863 r15149 4 4 $lang['Create a Typetag'] = 'Lag en TypeTag'; 5 5 $lang['Edit typetag'] = 'Rediger TypeTag'; 6 $lang['TypeTag selection'] = 'Rediger - Slett TypeTags';7 $lang['TypeTag association'] = 'Assosier - Dissossier TypeTags';8 6 9 7 /* fields */ -
extensions/typetags/language/pl_PL/plugin.lang.php
r13780 r15149 31 31 $lang['New name'] = 'Nowa nazwa'; 32 32 $lang['New TypeTag'] = 'Nazwa TypeTag'; 33 $lang['TypeTag association'] = 'Powiązania - usuń powiązania TypeTag';34 $lang['TypeTag selection'] = 'Edycja - Usuwanie TypeTag';35 33 $lang['typetags_associated'] = 'Powiązano TypeTag'; 36 34 $lang['typetag_already_exists'] = 'Ten TypeTag już istnieje'; -
extensions/typetags/language/ru_RU/plugin.lang.php
r14439 r15149 31 31 $lang['New color'] = 'Новый цвет'; 32 32 $lang['New name'] = 'Новое название'; 33 $lang['TypeTag association'] = 'Связать - отделить типы тегов';34 $lang['TypeTag selection'] = 'Редактировать - Удалить типы тегов';35 33 $lang['typetag_already_exists'] = 'Этот тип тегов уже есть'; 36 34 $lang['typetag_error'] = 'Нужно заполнить все поля (название и цвет)'; -
extensions/typetags/language/sk_SK/plugin.lang.php
r13934 r15149 4 4 $lang['Create a Typetag'] = 'Vytvoriť kľúčové slovo'; 5 5 $lang['Edit typetag'] = 'Upraviť kľúčového slová'; 6 $lang['TypeTag selection'] = 'Upraviť - vymazať kľúčového slová';7 $lang['TypeTag association'] = 'Spojené - Rozdelené kľúčového slová';8 6 9 7 /* fields */ -
extensions/typetags/language/uk_UA/plugin.lang.php
r13794 r15149 31 31 $lang['New name'] = 'Нове ім\'я'; 32 32 $lang['New TypeTag'] = 'Ім\'я TypeTag'; 33 $lang['TypeTag association'] = 'Асоціювати - Дисоціювати TypeTags';34 $lang['TypeTag selection'] = 'Редагування - Видалити TypeTags';35 33 $lang['typetags_associated'] = 'TypeTags, пов\'язані'; 36 34 $lang['typetag_already_exists'] = 'Це TypeTag вже існує'; -
extensions/typetags/main.inc.php
r10987 r15149 10 10 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 11 11 12 global $prefixeTable 12 global $prefixeTable, $conf; 13 13 14 define('typetags_DIR' , basename(dirname(__FILE__))); 15 define('typetags_PATH' , PHPWG_PLUGINS_PATH . typetags_DIR . '/'); 14 define('typetags_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'); 16 15 define('typetags_TABLE' , $prefixeTable . 'typetags'); 17 define('typetags_ADMIN', get_root_url().'admin.php?page=plugin-' . typetags_DIR); 16 define('typetags_ADMIN', get_root_url().'admin.php?page=plugin-' . basename(dirname(__FILE__))); 17 18 19 include(typetags_PATH . 'typetags.php'); 20 $conf['TypeTags'] = unserialize($conf['TypeTags']); 21 22 // tags on picture page 23 /*if (script_basename() == 'picture') 24 { 25 add_event_handler('loc_end_picture', 'typetags_picture'); 26 }*/ 27 28 // tags everywhere 29 if ($conf['TypeTags']['show_all']) 30 { 31 add_event_handler('render_tag_name', 'typetags_render', 0); 32 } 33 // tags on tags page 34 else if (script_basename() == 'tags') 35 { 36 add_event_handler('loc_begin_page_header', 'typetags_tags'); 37 } 38 39 40 add_event_handler('get_admin_plugin_menu_links', 'typetags_admin_menu'); 18 41 19 42 function typetags_admin_menu($menu) … … 26 49 } 27 50 28 function typetags()29 {30 include(typetags_PATH . 'typetags.php');31 }32 33 if (script_basename() == 'tags')34 {35 add_event_handler('loc_begin_page_header', 'typetags', 60);36 }37 38 add_event_handler('get_admin_plugin_menu_links', 'typetags_admin_menu');39 40 51 ?> -
extensions/typetags/maintain.inc.php
r10987 r15149 10 10 if (!in_array('id_typetags', $result)) 11 11 { 12 pwg_query('ALTER TABLE '.TAGS_TABLE.' ADD COLUMN `id_typetags` SMALLINT(5) ');12 pwg_query('ALTER TABLE '.TAGS_TABLE.' ADD COLUMN `id_typetags` SMALLINT(5);'); 13 13 } 14 14 … … 16 16 if (!mysql_fetch_row($result)) 17 17 { 18 $q = 'CREATE TABLE '. $prefixeTable .'typetags( 19 id smallint(5) unsigned NOT NULL auto_increment, 20 name VARCHAR(255) NOT NULL, 21 color VARCHAR(255) NOT NULL, 22 PRIMARY KEY (id));'; 23 pwg_query($q); 18 $query = ' 19 CREATE TABLE `'. $prefixeTable .'typetags` ( 20 `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, 21 `name` varchar(255) NOT NULL, 22 `color` varchar(255) NOT NULL, 23 PRIMARY KEY (`id`) 24 ) DEFAULT CHARSET=utf8 25 ;'; 26 pwg_query($query); 27 } 28 29 conf_update_param('TypeTags', serialize(array('show_all'=>true))); 30 } 31 32 function plugin_activate() 33 { 34 global $conf; 35 36 if (!isset($conf['TypeTags'])) 37 { 38 conf_update_param('TypeTags', serialize(array('show_all'=>true))); 24 39 } 25 40 } … … 29 44 global $prefixeTable; 30 45 31 $q = ' ALTER TABLE '.TAGS_TABLE.' DROP COLUMN `id_typetags`'; 32 pwg_query( $q ); 33 34 $q = ' DROP TABLE '. $prefixeTable .'typetags;'; 35 pwg_query($q); 46 pwg_query('ALTER TABLE '.TAGS_TABLE.' DROP COLUMN `id_typetags`'); 47 pwg_query('DROP TABLE '. $prefixeTable .'typetags;'); 48 pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param = "TypeTags" LIMIT 1;'); 36 49 } 37 50 -
extensions/typetags/typetags.php
r3609 r15149 1 1 <?php 2 2 3 global $page, $template; 3 /** 4 * triggered by 'render_tag_name' 5 */ 6 function typetags_render($tag) 7 { 8 global $pwg_loaded_plugins; 9 10 $query = ' 11 SELECT color 12 FROM '.typetags_TABLE.' AS tt 13 INNER JOIN '.TAGS_TABLE.' AS t 14 ON t.id_typetags = tt.id 15 WHERE t.name = "'.mysql_real_escape_string($tag).'" 16 ;';; 17 list($color) = pwg_db_fetch_row(pwg_query($query)); 18 19 if ($color === null) 20 { 21 return $tag; 22 } 23 elseif (isset($pwg_loaded_plugins['ExtendedDescription'])) 24 { 25 return "[lang=all]<span style='color:".$color.";'>[/lang]".$tag."[lang=all]</span>[/lang]"; 26 } 27 else 28 { 29 return "<span style='color:".$color.";'>".$tag."</span>"; 30 } 31 } 4 32 5 $query = ' 6 SELECT t.id , tt.color 7 FROM ' . typetags_TABLE . ' AS tt 8 INNER JOIN ' . TAGS_TABLE . ' AS t 9 ON t.id_typetags = tt.id 10 WHERE t.id_typetags IS NOT NULL ;'; 11 12 $result = pwg_query($query); 13 $tagsColor = array(); 14 while ($row = mysql_fetch_assoc($result)) 33 /** 34 * colors tags on picture page 35 */ 36 /*function typetags_picture() 15 37 { 16 $tagsColor[$row['id']] = $row['color']; 17 } 18 $display = $template->get_template_vars('display_mode'); 19 20 if ($display == 'letters') 21 { 22 $letters = $template->get_template_vars('letters'); 23 if (empty($letters)) return; 24 $template->clear_assign('letters'); 25 26 foreach ($letters as $k1 => $letter) 27 { 28 foreach ($letter['tags'] as $k2 => $tag) 29 { 30 if (isset($tagsColor[$tag['id']])) 31 { 32 $letters[$k1]['tags'][$k2]['URL'] .= '" style="color:' . $tagsColor[$tag['id']]; 33 } 34 } 35 } 36 $template->assign('letters', $letters); 37 } 38 elseif ($display == 'cloud') 39 { 40 $tags = $template->get_template_vars('tags'); 38 global $template; 39 40 $tags = $template->get_template_vars('related_tags'); 41 41 if (empty($tags)) return; 42 $template->clear_assign('tags'); 42 43 $query = ' 44 SELECT 45 t.id , 46 tt.color 47 FROM '.typetags_TABLE.' AS tt 48 INNER JOIN '.TAGS_TABLE.' AS t 49 ON t.id_typetags = tt.id 50 WHERE t.id_typetags IS NOT NULL 51 ;'; 52 $tagsColor = simple_hash_from_query($query, 'id', 'color'); 53 if (empty($tagsColor)) return; 43 54 44 55 foreach ($tags as $key => $tag) 45 56 { 46 if (isset($tagsColor[ $tag['id']]))57 if (isset($tagsColor[ $tag['id'] ])) 47 58 { 48 $tags[$key]['URL'] .= '" style="color:' . $tagsColor[$tag['id']];59 $tags[$key]['URL'].= '" style="color:'.$tagsColor[ $tag['id'] ].';'; 49 60 } 50 61 } 51 $template->assign('tags', $tags); 52 } 53 elseif ($display == 'cumulus') 62 63 $template->clear_assign('related_tags'); 64 $template->assign('related_tags', $tags); 65 }*/ 66 67 /** 68 * colors tags on tags page 69 */ 70 function typetags_tags() 54 71 { 55 $tags = $template->get_template_vars('tags'); 56 if (empty($tags)) return; 57 $template->clear_assign('tags'); 72 global $template; 58 73 59 foreach ($tags as $key => $tag) 74 $query = ' 75 SELECT 76 t.id , 77 tt.color 78 FROM '.typetags_TABLE.' AS tt 79 INNER JOIN '.TAGS_TABLE.' AS t 80 ON t.id_typetags = tt.id 81 WHERE t.id_typetags IS NOT NULL 82 ;'; 83 $tagsColor = simple_hash_from_query($query, 'id', 'color'); 84 if (empty($tagsColor)) return; 85 86 $display = $template->get_template_vars('display_mode'); 87 if ($display == 'letters') 60 88 { 61 if (isset($tagsColor[$tag['id']])) 89 $letters = $template->get_template_vars('letters'); 90 if (empty($letters)) return; 91 92 foreach ($letters as $k1 => $letter) 62 93 { 63 $tagsColor[$tag['id']] = str_replace('#', '0x', $tagsColor[$tag['id']]); 64 $tags[$key]['URL'] .= '\' color=\'' . $tagsColor[$tag['id']] . '\' hicolor=\'' . $tagsColor[$tag['id']]; 94 foreach ($letter['tags'] as $k2 => $tag) 95 { 96 if (isset($tagsColor[ $tag['id'] ])) 97 { 98 $letters[$k1]['tags'][$k2]['URL'].= '" style="color:'.$tagsColor[ $tag['id'] ].';'; 99 } 100 } 65 101 } 102 103 $template->clear_assign('letters'); 104 $template->assign('letters', $letters); 66 105 } 67 $template->assign('tags', $tags); 106 elseif ($display == 'cloud') 107 { 108 $tags = $template->get_template_vars('tags'); 109 if (empty($tags)) return; 110 111 foreach ($tags as $key => $tag) 112 { 113 if (isset($tagsColor[ $tag['id'] ])) 114 { 115 $tags[$key]['URL'].= '" style="color:'.$tagsColor[ $tag['id'] ].';'; 116 } 117 } 118 119 $template->clear_assign('tags'); 120 $template->assign('tags', $tags); 121 } 122 elseif ($display == 'cumulus') 123 { 124 $tags = $template->get_template_vars('tags'); 125 if (empty($tags)) return; 126 127 foreach ($tags as $key => $tag) 128 { 129 if (isset($tagsColor[ $tag['id'] ])) 130 { 131 $tagsColor[ $tag['id'] ] = str_replace('#', '0x', $tagsColor[ $tag['id'] ]); 132 $tags[$key]['URL'].= '\' color=\''.$tagsColor[ $tag['id'] ].'\' hicolor=\''.$tagsColor[ $tag['id'] ]; 133 } 134 } 135 136 $template->clear_assign('tags'); 137 $template->assign('tags', $tags); 138 } 68 139 } 69 140 70 // Suppression des liens soulignés71 $template->block_html_head('', '<style type="text/css">#fullTagCloud a, .tagLetter a { border: none; }</style>', $smarty, $repeat);72 73 141 ?>
Note: See TracChangeset
for help on using the changeset viewer.