Changeset 26665


Ignore:
Timestamp:
Jan 12, 2014, 7:13:40 PM (7 years ago)
Author:
mistic100
Message:

integrate in new tags manager + rename in Coloured Tags
(my apologies to translators :-) )

Location:
extensions/typetags
Files:
8 added
1 deleted
26 edited
2 copied
1 moved

Legend:

Unmodified
Added
Removed
  • extensions/typetags/admin.php

    r21361 r26665  
    11<?php
    2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    3 
    4 load_language('plugin.lang', typetags_PATH);
    5 
    6 function get_color_text($color)
    7 {
    8   if (strlen($color) == 7)
    9   {
    10     $rgb[] = hexdec(substr($color, 1, 2))/255;
    11     $rgb[] = hexdec(substr($color, 3, 2))/255;
    12     $rgb[] = hexdec(substr($color, 5, 2))/255;
    13   }
    14   else if (strlen($color) == 4)
    15   {
    16     $rgb[] = hexdec(substr($color, 1, 1))/15;
    17     $rgb[] = hexdec(substr($color, 2, 1))/15;
    18     $rgb[] = hexdec(substr($color, 3, 1))/15;
    19   }
    20   $l = (min($rgb) + max($rgb)) / 2;
    21   return $l > 0.45 ? '#000' : '#fff';
    22 }
     2defined('TYPETAGS_PATH') or die('Hacking attempt!');
     3
     4load_language('plugin.lang', TYPETAGS_PATH);
     5
     6include_once(TYPETAGS_PATH . 'include/functions.inc.php');
     7
    238
    249// +-----------------------------------------------------------------------+
    2510// |                                edit typetags                          |
    2611// +-----------------------------------------------------------------------+
    27 
    28 if ( isset($_POST['edittypetag']) and (empty($_POST['typetag_name']) or empty($_POST['typetag_color'])) )
    29 {
    30   $edited_typetag = array(
    31     'id' => $_POST['edited_typetag'],
    32     'name' => $_POST['typetag_name'],
    33     'color' => $_POST['typetag_color'],
    34   );
    35  
    36   array_push($page['errors'],  l10n('typetag_error'));
    37 }
    38 else if (isset($_POST['edittypetag']))
    39 {
    40   // we must not rename typetag with an already existing name
    41   $query = '
     12if (isset($_POST['edittypetag']))
     13{
     14  if (empty($_POST['typetag_name']) or empty($_POST['typetag_color']))
     15  {
     16    $page['errors'][] = l10n('You must fill all fields (name and color)');
     17  }
     18  else
     19  {
     20    // we must not rename typetag with an already existing name
     21    $query = '
    4222SELECT id
    43   FROM '.typetags_TABLE.'
     23  FROM ' . TYPETAGS_TABLE . '
    4424  WHERE
    45     name = "'.$_POST['typetag_name'].'"
    46     AND id != '.$_POST['edited_typetag'].'
    47 ;';
    48 
    49   if ( pwg_db_num_rows(pwg_query($query)) )
     25    name = "' . pwg_db_real_escape_string($_POST['typetag_name']) . '"
     26    AND id != ' . $_POST['edited_typetag'] . '
     27;';
     28
     29    if (pwg_db_num_rows(pwg_query($query)))
     30    {
     31      $page['errors'][] = l10n('This name is already used');
     32    }
     33    else if ( ($color = check_color($_POST['typetag_color'])) === false )
     34    {
     35      $page['errors'][] = l10n('Invalid color');
     36    }
     37    else
     38    {
     39      $query = '
     40UPDATE '.TYPETAGS_TABLE.'
     41  SET
     42    name = "' . pwg_db_real_escape_string($_POST['typetag_name']) . '",
     43    color = "' . $color . '"
     44  WHERE id = ' . $_POST['edited_typetag'] . '
     45;';
     46      pwg_query($query);
     47
     48      $page['infos'][] = l10n('Color saved');
     49    }
     50  }
     51
     52  if (count($page['errors']))
    5053  {
    5154    $edited_typetag = array(
     
    5356      'name' => $_POST['typetag_name'],
    5457      'color' => $_POST['typetag_color'],
    55     );
    56    
    57     array_push($page['errors'], l10n('typetag_already_exists'));
     58      );
     59  }
     60}
     61
     62// +-----------------------------------------------------------------------+
     63// |                           delete typetags                             |
     64// +-----------------------------------------------------------------------+
     65if (isset($_GET['deletetypetag']))
     66{
     67  $query = '
     68UPDATE ' . TAGS_TABLE . '
     69  SET id_typetags = NULL
     70  WHERE id_typetags = ' . intval($_GET['deletetypetag']) . '
     71;';
     72  pwg_query($query);
     73
     74  $query = '
     75DELETE FROM ' . TYPETAGS_TABLE . '
     76  WHERE id = ' . intval($_GET['deletetypetag']) . '
     77;';
     78  pwg_query($query);
     79
     80  if (pwg_db_changes())
     81  {
     82    $page['infos'][] = l10n('Color deleted');
     83  }
     84}
     85
     86// +-----------------------------------------------------------------------+
     87// |                               add a typetag                           |
     88// +-----------------------------------------------------------------------+
     89if (isset($_POST['addtypetag']))
     90{
     91  if (empty($_POST['typetag_name']) or empty($_POST['typetag_color']))
     92  {
     93    $page['errors'][] = l10n('You must fill all fields (name and color)');
    5894  }
    5995  else
    6096  {
     97    $typetag_name = $_POST['typetag_name'];
     98    $typetag_color = $_POST['typetag_color'];
     99
     100    // does the tag already exists?
    61101    $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'));
    71   }
    72 }
    73 
    74 // +-----------------------------------------------------------------------+
    75 // |                           delete typetags                             |
    76 // +-----------------------------------------------------------------------+
    77 
    78 if (isset($_GET['deletetypetag']))
    79 {
    80   $query = '
    81102SELECT 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'));
    102   }
    103   else
    104   {
    105     array_push($page['errors'], l10n('typetag_unknown'));
    106   }
    107 }
    108 
    109 // +-----------------------------------------------------------------------+
    110 // |                               add a typetag                           |
    111 // +-----------------------------------------------------------------------+
    112 
    113 if ( isset($_POST['addtypetag']) and (empty($_POST['typetag_name']) or empty($_POST['typetag_color'])) )
    114 {
    115   $template->assign('typetag', array(
    116     'NAME' => $_POST['typetag_name'],
    117     'COLOR' => $_POST['typetag_color'],
    118   ));
    119  
    120   array_push($page['errors'], l10n('typetag_error'));
    121 }
    122 else if (isset($_POST['addtypetag']))
    123 {
    124   $typetag_name = $_POST['typetag_name'];
    125   $typetag_color = $_POST['typetag_color'];
    126 
    127   // does the tag already exists?
    128   $query = '
    129 SELECT id
    130   FROM '.typetags_TABLE.'
    131   WHERE name = "'.$_POST['typetag_name'].'"
     103  FROM ' . TYPETAGS_TABLE . '
     104  WHERE name = "' . pwg_db_real_escape_string($_POST['typetag_name']) . '"
    132105';
    133106
    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'));
    142   }
    143   else
    144   {
    145     $query = '
    146 INSERT INTO '.typetags_TABLE.'(
     107    if (pwg_db_num_rows(pwg_query($query)))
     108    {
     109      $page['errors'][] = l10n('This name is already used');
     110    }
     111    else if ( ($color = check_color($_POST['typetag_color'])) === false )
     112    {
     113      $page['errors'][] = l10n('Invalid color');
     114    }
     115    else
     116    {
     117      $query = '
     118INSERT INTO ' . TYPETAGS_TABLE . '(
    147119    name,
    148120    color
    149121  )
    150122  VALUES(
    151     "'.$_POST['typetag_name'].'",
    152     "'.$_POST['typetag_color'].'"
     123    "' . pwg_db_real_escape_string($_POST['typetag_name']) . '",
     124    "' . $color . '"
    153125  )
    154126;';
    155     pwg_query($query);
    156 
    157     array_push($page['infos'], l10n('typetag_saved'));
    158   }
    159 }
    160 
    161 // +-----------------------------------------------------------------------+
    162 // |                           Associate Tag to Typetage                   |
    163 // +-----------------------------------------------------------------------+
    164 
    165 if (isset($_POST['delete_all_assoc']))
    166 {
    167   pwg_query('UPDATE '.TAGS_TABLE.' SET id_typetags = NULL;');
    168   array_push($page['infos'], l10n('All associations have been removed'));
    169 }
    170 else if (isset($_POST['associations']))
    171 {
    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,
     127      pwg_query($query);
     128
     129      $page['infos'][] = l10n('Color added');
     130    }
     131  }
     132
     133  if (count($page['errors']))
     134  {
     135    $template->assign('typetag', array(
     136      'NAME' => $_POST['typetag_name'],
     137      'COLOR' => $_POST['typetag_color'],
    190138      ));
    191139  }
    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'));
    200140}
    201141
     
    208148    'show_all' => $_POST['show_all'] == 'true',
    209149    );
    210    
     150
    211151  conf_update_param('TypeTags', serialize($conf['TypeTags']));
     152  $page['infos'][] = l10n('Information data registered in database');
    212153}
    213154
     
    217158// |                             template init                             |
    218159// +-----------------------------------------------------------------------+
    219 
    220 $template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin/typetags_admin.tpl'));
    221 
    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']));
    237   $template->append('typetags_association', $row);
    238 }
     160$template->assign('TYPETAGS_PATH', TYPETAGS_PATH);
     161$template->assign('F_ACTION', TYPETAGS_ADMIN);
    239162
    240163// get all typetags
    241 $query = 'SELECT * FROM '.typetags_TABLE.' ORDER BY name;';
    242 $all_typetags = pwg_query($query);
    243 
    244 while ($row = pwg_db_fetch_assoc($all_typetags))
     164$query = 'SELECT * FROM ' . TYPETAGS_TABLE . ' ORDER BY name;';
     165$result = pwg_query($query);
     166
     167while ($row = pwg_db_fetch_assoc($result))
    245168{
    246169  $row['color_text'] = get_color_text($row['color']);
    247   $row['u_edit'] = typetags_ADMIN . '&edittypetag=' . $row['id'];
    248   $row['u_delete'] = typetags_ADMIN . '&deletetypetag=' . $row['id'];
    249  
    250   $template->append('typetags_selection', $row);
     170  $row['u_edit'] = TYPETAGS_ADMIN . '&amp;edittypetag=' . $row['id'];
     171  $row['u_delete'] = TYPETAGS_ADMIN . '&amp;deletetypetag=' . $row['id'];
     172
     173  $template->append('typetags', $row);
    251174}
    252175
     
    254177if (isset($_GET['edittypetag']))
    255178{
    256   $edited_typetag['id'] = $_GET['edittypetag'];
    257 }
    258 
    259 if (isset($edited_typetag['id']))
     179  $edited_typetag['id'] = intval($_GET['edittypetag']);
     180}
     181
     182if (isset($edited_typetag['id']) and $edited_typetag['id']>0)
    260183{
    261184  $template->assign('edited_typetag', $edited_typetag['id']);
    262  
     185
    263186$query = '
    264 SELECT
    265     id,
    266     name,
    267     color
    268   FROM '.typetags_TABLE.'
    269   WHERE id = '.$edited_typetag['id'].'
     187SELECT *
     188  FROM ' . TYPETAGS_TABLE . '
     189  WHERE id = ' . $edited_typetag['id'] . '
    270190;';
    271191  $row = pwg_db_fetch_assoc(pwg_query($query));
     
    278198    'NAME' => isset($edited_typetag['name']) ? $edited_typetag['name'] : $row['name'],
    279199    'COLOR'=> isset($edited_typetag['color']) ? $edited_typetag['color'] : $row['color'],
    280   ));
    281  
     200    ));
     201
    282202  $template->assign('IN_EDIT', true);
    283203}
     
    286206// |                           sending html code                           |
    287207// +-----------------------------------------------------------------------+
    288 
    289 $template->assign('typetags_ADMIN', typetags_ADMIN);
    290 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
    291 
    292 ?>
     208$template->set_filename('typetags', realpath(TYPETAGS_PATH . 'template/admin.tpl'));
     209$template->assign_var_from_handle('ADMIN_CONTENT', 'typetags');
  • extensions/typetags/include/events_public.inc.php

    r24342 r26665  
    11<?php
     2defined('TYPETAGS_PATH') or die('Hacking attempt!');
    23
    34/**
    45 * triggered by 'render_tag_name'
    56 */
    6 function typetags_render($tag)
     7function typetags_render($tag_name, $tag=array())
    78{
    8   global $pwg_loaded_plugins, $page;
    9  
    10   if ( defined('IN_ADMIN') and in_array($page['page'], array('photo', 'batch_manager')) )
     9  global $pwg_loaded_plugins, $page, $typetags_cache;
     10
     11  if (defined('IN_ADMIN') and in_array($page['page'], array('photo', 'batch_manager', 'tags')))
    1112  {
    12     return $tag;
     13    return $tag_name;
    1314  }
    14  
    15   $query = '
     15
     16  if (isset($typetags_cache['tags'][$tag_name]))
     17  {
     18    return $typetags_cache['tags'][$tag_name];
     19  }
     20
     21  if (!isset($typetags_cache['colors']))
     22  {
     23    $query = '
     24SELECT id, color
     25  FROM ' . TYPETAGS_TABLE . '
     26;';
     27    $typetags_cache['colors'] = query2array($query, 'id', 'color');
     28  }
     29
     30  if (!empty($tag['id_typetags']))
     31  {
     32    $color = $typetags_cache['colors'][ $tag['id_typetags'] ];
     33  }
     34  else
     35  {
     36    if (isset($tag['id']))
     37    {
     38      $where = 't.id = ' . $tag['id'];
     39    }
     40    else
     41    {
     42      $where = 't.name = "' . pwg_db_real_escape_string($tag_name) . '"';
     43    }
     44
     45    $query = '
    1646SELECT color
    17   FROM '.typetags_TABLE.' AS tt
    18     INNER JOIN '.TAGS_TABLE.' AS t
    19       ON t.id_typetags = tt.id
    20   WHERE t.name = "'.pwg_db_real_escape_string($tag).'"
    21 ;';;
    22   list($color) = pwg_db_fetch_row(pwg_query($query));
    23  
    24   if ($color === null)
     47  FROM ' . TYPETAGS_TABLE . ' AS tt
     48    INNER JOIN ' . TAGS_TABLE . ' AS t
     49    ON t.id_typetags = tt.id
     50  WHERE ' . $where . '
     51;';
     52    list($color) = pwg_db_fetch_row(pwg_query($query));
     53  }
     54
     55  if ($color === null)
    2556  {
    26     return $tag;
     57    $ret = $tag_name;
    2758  }
    2859  elseif (isset($pwg_loaded_plugins['ExtendedDescription']))
    2960  {
    30     return "[lang=all]<span style='color:".$color.";'>[/lang]".$tag."[lang=all]</span>[/lang]";
     61    $ret = '[lang=all]<span style="color:' . $color . ';">[/lang]' . $tag_name . '[lang=all]</span>[/lang]';
    3162  }
    3263  else
    3364  {
    34     return "<span style='color:".$color.";'>".$tag."</span>";
     65    $ret = '<span style="color:' . $color . ';">' . $tag_name . '</span>';
    3566  }
     67
     68  $typetags_cache['tags'][$tag_name] = $ret;
     69  return $ret;
    3670}
    3771
     
    4276{
    4377  global $template;
    44    
     78
    4579  $tags = $template->get_template_vars('related_tags');
    4680  if (empty($tags)) return;
    47  
     81
    4882  $query = '
    4983SELECT
    5084    t.id ,
    5185    tt.color
    52   FROM '.typetags_TABLE.' AS tt
     86  FROM '.TYPETAGS_TABLE.' AS tt
    5387    INNER JOIN '.TAGS_TABLE.' AS t
    5488      ON t.id_typetags = tt.id
     
    6599    }
    66100  }
    67  
     101
    68102  $template->clear_assign('related_tags');
    69103  $template->assign('related_tags', $tags);
     
    75109function typetags_tags()
    76110{
    77   global $template;
     111  global $template, $page, $tags;
     112
     113  if (empty($tags))
     114  {
     115    return;
     116  }
    78117
    79118  $query = '
    80119SELECT
    81     t.id ,
     120    t.id,
    82121    tt.color
    83   FROM '.typetags_TABLE.' AS tt
    84     INNER JOIN '.TAGS_TABLE.' AS t
    85       ON t.id_typetags = tt.id
     122  FROM ' . TYPETAGS_TABLE . ' AS tt
     123    INNER JOIN ' . TAGS_TABLE . ' AS t
     124    ON t.id_typetags = tt.id
    86125  WHERE t.id_typetags IS NOT NULL
    87126;';
    88   $tagsColor = simple_hash_from_query($query, 'id', 'color');
    89   if (empty($tagsColor)) return;
     127  $tagsColor = query2array($query, 'id', 'color');
    90128
    91   $display = $template->get_template_vars('display_mode');
    92   if ($display == 'letters')
     129  if (empty($tagsColor))
     130  {
     131    return;
     132  }
     133
     134  // LETTERS
     135  if ($page['display_mode'] == 'letters')
    93136  {
    94137    $letters = $template->get_template_vars('letters');
    95     if (empty($letters)) return;
    96138
    97     foreach ($letters as $k1 => $letter)
     139    foreach ($letters as &$letter)
    98140    {
    99       foreach ($letter['tags'] as $k2 => $tag)
     141      foreach ($letter['tags'] as &$tag)
    100142      {
    101143        if (isset($tagsColor[ $tag['id'] ]))
    102144        {
    103           $letters[$k1]['tags'][$k2]['URL'].= '" style="color:'.$tagsColor[ $tag['id'] ].';';
     145          $tag['URL'].= '" style="color:' . $tagsColor[ $tag['id'] ] . ';';
    104146        }
    105147      }
     148      unset($tag);
    106149    }
    107    
    108     $template->clear_assign('letters');
     150    unset($letter);
     151
    109152    $template->assign('letters', $letters);
    110153  }
    111   elseif ($display == 'cloud')
     154  // CLOUD
     155  else if ($page['display_mode'] == 'cloud')
    112156  {
    113157    $tags = $template->get_template_vars('tags');
    114     if (empty($tags)) return;
    115158
    116     foreach ($tags as $key => $tag)
     159    foreach ($tags as &$tag)
    117160    {
    118161      if (isset($tagsColor[ $tag['id'] ]))
    119162      {
    120         $tags[$key]['URL'].= '" style="color:'.$tagsColor[ $tag['id'] ].';';
     163        $tag['URL'].= '" style="color:' . $tagsColor[ $tag['id'] ] . ';';
    121164      }
    122165    }
    123    
    124     $template->clear_assign('tags');
     166    unset($tag);
     167
    125168    $template->assign('tags', $tags);
    126169  }
    127   elseif ($display == 'cumulus')
     170  // CUMULUS
     171  else if ($page['display_mode'] == 'cumulus')
    128172  {
    129173    $tags = $template->get_template_vars('tags');
    130     if (empty($tags)) return;
    131174
    132     foreach ($tags as $key => $tag)
     175    foreach ($tags as &$tag)
    133176    {
    134177      if (isset($tagsColor[ $tag['id'] ]))
    135178      {
    136179        $tagsColor[ $tag['id'] ] = str_replace('#', '0x', $tagsColor[ $tag['id'] ]);
    137         $tags[$key]['URL'].= '\' color=\''.$tagsColor[ $tag['id'] ].'\' hicolor=\''.$tagsColor[ $tag['id'] ];
     180        $tag['URL'].= '\' color=\'' . $tagsColor[ $tag['id'] ] . '\' hicolor=\'' . $tagsColor[ $tag['id'] ];
    138181      }
    139182    }
    140    
    141     $template->clear_assign('tags');
     183    unset($tag);
     184
    142185    $template->assign('tags', $tags);
    143186  }
    144187}
    145 
    146 ?>
  • extensions/typetags/language/ca_ES/plugin.lang.php

    r15355 r26665  
    3737$lang['Only on tags page'] = 'Només a la pàgina etiquetes';
    3838$lang['typetag_already_exists'] = 'Aquest TypeTag ja existeix';
    39 $lang['typetag_error'] = 'Cal omplir tots els camps (nom i color)';
     39$lang['You must fill all fields (name and color)'] = 'Cal omplir tots els camps (nom i color)';
    4040$lang['typetag_saved'] = 'TypeTag desat';
    4141$lang['typetag_suppr'] = 'TypeTag eliminat';
  • extensions/typetags/language/cs_CZ/plugin.lang.php

    r15356 r26665  
    2626$lang['New color'] = 'Nová barva';
    2727$lang['New name'] = 'Nový název';
    28 $lang['typetag_error'] = 'Musíte vyplnit všechna pole (název a barva)';
     28$lang['You must fill all fields (name and color)'] = 'Musíte vyplnit všechna pole (název a barva)';
    2929$lang['Color TypeTag'] = 'Barva TypeTagu';
    3030$lang['Create a Typetag'] = 'Vytvořit TypeTag';
  • extensions/typetags/language/da_DK/plugin.lang.php

    r18318 r26665  
    3838$lang['Only on tags page'] = 'Kun på tagside';
    3939$lang['typetag_already_exists'] = 'Dette TypeTag findes allerede';
    40 $lang['typetag_error'] = 'Du skal udfylde alle felter (navn og farve)';
     40$lang['You must fill all fields (name and color)'] = 'Du skal udfylde alle felter (navn og farve)';
    4141$lang['typetag_saved'] = 'TypeTag gemt';
    4242$lang['typetag_suppr'] = 'TypeTag slettet';
  • extensions/typetags/language/de_DE/plugin.lang.php

    r15313 r26665  
    2121$lang['typetag_suppr'] = 'TypeTag gelöscht';
    2222$lang['typetag_unknown'] = 'Unknown TypeTag';
    23 $lang['typetag_error'] = 'Alle Felder müssen ausgefüllt werden (Name und Farbe)';
     23$lang['You must fill all fields (name and color)'] = 'Alle Felder müssen ausgefüllt werden (Name und Farbe)';
    2424$lang['All associations have been removed'] = 'All associations have been removed';
    2525$lang['typetags_associated'] = 'TypeTags wurde assoziiert';
  • extensions/typetags/language/el_GR/plugin.lang.php

    r15317 r26665  
    3737$lang['Only on tags page'] = 'Μόνο στη σελίδα ετικετών';
    3838$lang['typetag_already_exists'] = 'Αυτό το TypeTag υπάρχει ήδη ';
    39 $lang['typetag_error'] = 'Θα πρέπει να συμπληρώσετε όλα τα πεδία (όνομα και το χρώμα)';
     39$lang['You must fill all fields (name and color)'] = 'Θα πρέπει να συμπληρώσετε όλα τα πεδία (όνομα και το χρώμα)';
    4040$lang['typetag_saved'] = 'TypeTag αποθηκεύτηκε ';
    4141$lang['typetag_suppr'] = 'TypeTag διεγράφη';
  • extensions/typetags/language/en_UK/plugin.lang.php

    r15149 r26665  
    11<?php
    22
    3 /* section */
    4 $lang['Create a Typetag'] = 'Create a TypeTag';
    5 $lang['Edit typetag'] = 'Edit TypeTag';
    6 $lang['Edit and associate TypeTags'] = 'Edit and associate TypeTags';
    7 
    8 /* fields */
    9 $lang['Edited TypeTag'] = 'TypeTag edited';
    10 $lang['New color'] = 'New color';
    11 $lang['New TypeTag'] = 'TypeTag name';
    12 $lang['New name'] = 'New name';
    13 $lang['Color TypeTag'] = 'TypeTag color';
    14 $lang['Not associated'] = 'Not associated';
     3$lang['Add a new color'] = 'Add a new color';
     4$lang['Apply the same color to all tags'] = 'Apply the same color to all tags';
     5$lang['Color'] = 'Color';
     6$lang['Color added'] = 'Color added';
     7$lang['Color deleted'] = 'Color deleted';
     8$lang['Color saved'] = 'Color saved';
     9$lang['Edit color'] = 'Edit color';
     10$lang['Go to <a href="%s">Photos/Tags</a> to manage associations.'] = 'Go to <a href="%s">Photos/Tags</a> to manage associations.';
     11$lang['Invalid color'] = 'Invalid color';
     12$lang['Manage colors'] = 'Manage colors';
     13$lang['This name is already used'] = 'This name is already used';
     14$lang['Set a different color for each tag'] = 'Set a different color for each tag';
     15$lang['Set tags color'] = 'Set tags color';
    1516$lang['Display colored tags'] = 'Display colored tags';
    1617$lang['Only on tags page'] = 'Only on tags page';
    1718$lang['Everywhere'] = 'Everywhere';
    18 
    19 /* buttons */
    20 $lang['Modify'] = 'Modify';
    21 $lang['Delete all associations'] = 'Delete all associations';
    22 
    23 /* messages */
    24 $lang['typetag_already_exists'] = 'This TypeTag already exists';
    25 $lang['typetag_saved'] = 'TypeTag saved';
    26 $lang['typetag_suppr'] = 'TypeTag deleted';
    27 $lang['typetag_unknown'] = 'Unknown TypeTag';
    28 $lang['typetag_error'] = 'You must fill all fields (name and color)';
    29 $lang['All associations have been removed'] = 'All associations have been removed';
    30 $lang['typetags_associated'] = 'TypeTags associated';
     19$lang['New color'] = 'New color';
     20$lang['You must fill all fields (name and color)'] = 'You must fill all fields (name and color)';
    3121
    3222?>
  • extensions/typetags/language/es_ES/plugin.lang.php

    r15303 r26665  
    2121$lang['typetag_suppr'] = 'TypeTag suprimido';
    2222$lang['typetag_unknown'] = 'Unknown TypeTag';
    23 $lang['typetag_error'] = 'Usted debe informar todos los campos (nombre y color)';
     23$lang['You must fill all fields (name and color)'] = 'Usted debe informar todos los campos (nombre y color)';
    2424$lang['All associations have been removed'] = 'All associations have been removed';
    2525$lang['typetags_associated'] = 'TypeTags asociado';
  • extensions/typetags/language/fr_FR/plugin.lang.php

    r15149 r26665  
    11<?php
    22
    3 /* section */
    4 $lang['Create a Typetag'] = 'Créer un TypeTag';
    5 $lang['Edit typetag'] = 'Editer le TypeTag';
    6 $lang['Edit and associate TypeTags'] = 'Editer et associer les TypeTags';
    7 
    8 /* fields */
    9 $lang['Edited TypeTag'] = 'TypeTag édité';
     3$lang['Add a new color'] = 'Ajouter une nouvelle couleur';
     4$lang['Apply the same color to all tags'] = 'Appliquer la même couleur à tous les tags';
     5$lang['Color'] = 'Couleur';
     6$lang['Color added'] = 'Couleur ajoutée';
     7$lang['Color deleted'] = 'Couleur supprimée';
     8$lang['Color saved'] = 'Couleur sauvegardée';
     9$lang['Edit color'] = 'Editer une couleur';
     10$lang['Go to <a href="%s">Photos/Tags</a> to manage associations.'] = 'Allez sur <a href="%s">Photos/Tags</a> pour gérer les associations.';
     11$lang['Invalid color'] = 'Couleur invalide';
     12$lang['Manage colors'] = 'Gérer les couleurs';
     13$lang['This name is already used'] = 'The nom est déjà utilisé';
     14$lang['Set a different color for each tag'] = 'Appliquer une couleur différente à chaque tag';
     15$lang['Set tags color'] = 'Changer la couleur des tags';
     16$lang['Display colored tags'] = 'Afficher les tags colorés';
     17$lang['Only on tags page'] = 'Uniquement sur la liste des tags';
     18$lang['Everywhere'] = 'Partout';
    1019$lang['New color'] = 'Nouvelle couleur';
    11 $lang['New TypeTag'] = 'Nom du TypeTag';
    12 $lang['New name'] = 'Nouveau nom';
    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';
    18 
    19 /* buttons */
    20 $lang['Modify'] = 'Modifier';
    21 $lang['Delete all associations'] = 'Supprimer toutes les associations';
    22 
    23 /* messages */
    24 $lang['typetag_already_exists'] = 'Ce TypeTag existe déjà';
    25 $lang['typetag_saved'] = 'TypeTag enregistré';
    26 $lang['typetag_suppr'] = 'TypeTag supprimé';
    27 $lang['typetag_unknown'] = 'TypeTag inconnu';
    28 $lang['typetag_error'] = 'Vous devez renseigner tous les champs (nom et couleur)';
    29 $lang['All associations have been removed'] = 'Tous les associations ont été supprimées';
    30 $lang['typetags_associated'] = 'TypeTags associés';
     20$lang['You must fill all fields (name and color)'] = 'Vous devez remplir tous les champs (nom et couleur)';
    3121
    3222?>
  • extensions/typetags/language/gl_ES/plugin.lang.php

    r21031 r26665  
    3232$lang['typetag_unknown'] = 'EtiquetaTipo descoñecida';
    3333$lang['typetags_associated'] = 'EtiquetasTipo asociadas';
    34 $lang['typetag_error'] = 'Debes encher tódolos campos (nome e cor)';
     34$lang['You must fill all fields (name and color)'] = 'Debes encher tódolos campos (nome e cor)';
    3535$lang['Delete all associations'] = 'Eliminar todas as asociacións';
    3636$lang['Display colored tags'] = 'Amosar as etiquetas coloreadas';
  • extensions/typetags/language/hu_HU/plugin.lang.php

    r15751 r26665  
    3737$lang['Only on tags page'] = 'Csak a címkék oldalon';
    3838$lang['typetag_already_exists'] = 'Ilyes címke típus már létezik';
    39 $lang['typetag_error'] = 'Ki kel tölteni a mezőket (név és szín)';
     39$lang['You must fill all fields (name and color)'] = 'Ki kel tölteni a mezőket (név és szín)';
    4040$lang['typetag_saved'] = 'Címke típus mentve';
    4141$lang['typetag_suppr'] = 'Címke típus törölve';
  • extensions/typetags/language/it_IT/plugin.lang.php

    r15397 r26665  
    2121$lang['typetag_suppr'] = 'TypeTag cancellato';
    2222$lang['typetag_unknown'] = 'TypeTag sconosciuto';
    23 $lang['typetag_error'] = 'Dovete inserire tutti campi (nome e colore)';
     23$lang['You must fill all fields (name and color)'] = 'Dovete inserire tutti campi (nome e colore)';
    2424$lang['All associations have been removed'] = 'Tutte le associazioni sono state rimosse';
    2525$lang['typetags_associated'] = 'TypeTag associato';
  • extensions/typetags/language/lv_LV/plugin.lang.php

    r15616 r26665  
    2121$lang['typetag_suppr'] = 'TypeTag dzēsti';
    2222$lang['typetag_unknown'] = 'Unknown TypeTag';
    23 $lang['typetag_error'] = 'Jums jāinformē visus laukus (nosaukums un krāsa)';
     23$lang['You must fill all fields (name and color)'] = 'Jums jāinformē visus laukus (nosaukums un krāsa)';
    2424$lang['All associations have been removed'] = 'All associations have been removed';
    2525$lang['typetags_associated'] = 'TypeTags sasaistīts';
  • extensions/typetags/language/nb_NO/plugin.lang.php

    r15417 r26665  
    2121$lang['typetag_suppr'] = 'TypeTag slettet';
    2222$lang['typetag_unknown'] = 'Unknown TypeTag';
    23 $lang['typetag_error'] = 'Du må inkludere alle felter (navn og farge)';
     23$lang['You must fill all fields (name and color)'] = 'Du må inkludere alle felter (navn og farge)';
    2424$lang['All associations have been removed'] = 'All associations have been removed';
    2525$lang['typetags_associated'] = 'TypeTags assossiert';
  • extensions/typetags/language/nl_NL/plugin.lang.php

    r15157 r26665  
    3232$lang['New name'] = 'Nieuwe naam';
    3333$lang['typetag_already_exists'] = 'Deze TypeTag bestaat al';
    34 $lang['typetag_error'] = 'Je moet alle velden invullen (naam en kleur)';
     34$lang['You must fill all fields (name and color)'] = 'Je moet alle velden invullen (naam en kleur)';
    3535$lang['typetag_saved'] = 'TypeTag opgeslagen';
    3636$lang['typetag_suppr'] = 'TypeTag verwijderd';
  • extensions/typetags/language/pl_PL/plugin.lang.php

    r15321 r26665  
    3333$lang['typetags_associated'] = 'Powiązano TypeTag';
    3434$lang['typetag_already_exists'] = 'Ten TypeTag już istnieje';
    35 $lang['typetag_error'] = 'Należy uzupełnić wszystkie pola (nazwę i kolor)';
     35$lang['You must fill all fields (name and color)'] = 'Należy uzupełnić wszystkie pola (nazwę i kolor)';
    3636$lang['typetag_saved'] = 'Zapisano TypeTag';
    3737$lang['typetag_suppr'] = 'Skasowano TypeTag';
  • extensions/typetags/language/pt_BR/plugin.lang.php

    r21492 r26665  
    3838$lang['Only on tags page'] = 'Somente na página etiquetas';
    3939$lang['typetag_already_exists'] = 'Este TipoEtiqueta já existe';
    40 $lang['typetag_error'] = 'Você deve preencher todos os campos (nome e cor)';
     40$lang['You must fill all fields (name and color)'] = 'Você deve preencher todos os campos (nome e cor)';
    4141$lang['typetag_saved'] = 'TipoEtiqueta salvo';
    4242$lang['typetag_suppr'] = 'TipoEtiqueta eliminado';
  • extensions/typetags/language/pt_PT/plugin.lang.php

    r15550 r26665  
    3737$lang['Only on tags page'] = 'Apenas na página de etiquetas';
    3838$lang['typetag_already_exists'] = 'Já existe o tipo de etiqueta';
    39 $lang['typetag_error'] = 'Deve preencher todos os campos ( nome e cor)';
     39$lang['You must fill all fields (name and color)'] = 'Deve preencher todos os campos ( nome e cor)';
    4040$lang['typetag_saved'] = 'Tipo de etiqueta salvo';
    4141$lang['typetag_suppr'] = 'Apagado o tipo de etiqueta';
  • extensions/typetags/language/ru_RU/plugin.lang.php

    r15185 r26665  
    3232$lang['New name'] = 'Новое название';
    3333$lang['typetag_already_exists'] = 'Этот тип тегов уже есть';
    34 $lang['typetag_error'] = 'Нужно заполнить все поля (название и цвет)';
     34$lang['You must fill all fields (name and color)'] = 'Нужно заполнить все поля (название и цвет)';
    3535$lang['typetag_saved'] = 'Тип тегов сохранен';
    3636$lang['typetag_suppr'] = 'Тип тегов удален';
  • extensions/typetags/language/sk_SK/plugin.lang.php

    r15304 r26665  
    1919$lang['typetag_already_exists'] = 'Tento typ kľúčového slova už existuje';
    2020$lang['typetag_unknown'] = 'Unknown TypeTag';
    21 $lang['typetag_error'] = 'Môžete meniť všetky údaje (názov a farbu)';
     21$lang['You must fill all fields (name and color)'] = 'Môžete meniť všetky údaje (názov a farbu)';
    2222$lang['All associations have been removed'] = 'All associations have been removed';
    2323$lang['typetags_associated'] = 'Kľúčové slovo spojené';
  • extensions/typetags/language/tr_TR/plugin.lang.php

    r17195 r26665  
    3737$lang['Only on tags page'] = 'Sadece bir etiket sayfası';
    3838$lang['typetag_already_exists'] = 'Bu TypeTag zaten var';
    39 $lang['typetag_error'] = 'Tüm alanları doldurmalısınız (isim ve renk)';
     39$lang['You must fill all fields (name and color)'] = 'Tüm alanları doldurmalısınız (isim ve renk)';
    4040$lang['typetag_saved'] = 'TypeTag kaydedildi';
    4141$lang['typetag_suppr'] = 'TypeTag silindi';
  • extensions/typetags/language/uk_UA/plugin.lang.php

    r15243 r26665  
    3333$lang['typetags_associated'] = 'TypeTags, пов\'язані';
    3434$lang['typetag_already_exists'] = 'Це TypeTag вже існує';
    35 $lang['typetag_error'] = 'Ви повинні заповнити всі поля (ім\'я та колір)';
     35$lang['You must fill all fields (name and color)'] = 'Ви повинні заповнити всі поля (ім\'я та колір)';
    3636$lang['typetag_saved'] = 'TypeTag збережено';
    3737$lang['typetag_suppr'] = 'TypeTag видалено';
  • extensions/typetags/language/zh_CN/plugin.lang.php

    r20726 r26665  
    2323$lang['Edit and associate TypeTags'] = '编辑和关联TypeTag(标签组)';
    2424$lang['Not associated'] = '尚未关联到标签组的标签';
    25 $lang['typetag_error'] = '请完整填写信息(名称与颜色)';
     25$lang['You must fill all fields (name and color)'] = '请完整填写信息(名称与颜色)';
    2626$lang['typetags_associated'] = 'TypeTag(标签组)已关联';
    2727$lang['All associations have been removed'] = '所有关联已删除';
  • extensions/typetags/language/zh_TW/plugin.lang.php

    r24481 r26665  
    2828$lang['Only on tags page'] = '僅在標籤頁';
    2929$lang['typetag_already_exists'] = '此TypeTag(標籤組)已存在';
    30 $lang['typetag_error'] = '請完整填寫信息(名稱與顏色)';
     30$lang['You must fill all fields (name and color)'] = '請完整填寫信息(名稱與顏色)';
    3131$lang['typetag_saved'] = 'TypeTag(標籤組)已保存';
    3232$lang['typetag_suppr'] = 'TypeTag(標籤組)已刪除';
  • extensions/typetags/main.inc.php

    r21361 r26665  
    11<?php
    22/*
    3 Plugin Name: TypeT@gs
     3Plugin Name: Coloured Tags (TypeT@gs)
    44Version: auto
    55Description: Allow to manage color of tags, as you want...
    6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=166
    7 Author: Sakkhho & P@t & Mistic
     6Plugin URI: auto
     7Author: Mistic
    88*/
    99
    10 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     10defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
    1111
    1212global $prefixeTable, $conf;
    1313
    14 define('typetags_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
    15 define('typetags_TABLE' , $prefixeTable . 'typetags');
    16 define('typetags_ADMIN', get_root_url().'admin.php?page=plugin-' . basename(dirname(__FILE__)));
     14define('TYPETAGS_ID',      basename(dirname(__FILE__)));
     15define('TYPETAGS_PATH' ,   PHPWG_PLUGINS_PATH . TYPETAGS_ID . '/');
     16define('TYPETAGS_TABLE' ,  $prefixeTable . 'typetags');
     17define('TYPETAGS_ADMIN',   get_root_url().'admin.php?page=plugin-' . TYPETAGS_ID);
     18define('TYPETAGS_VERSION', 'auto');
    1719
    1820
    19 include_once(typetags_PATH . 'typetags.php');
    2021$conf['TypeTags'] = unserialize($conf['TypeTags']);
     22
     23
     24include_once(TYPETAGS_PATH . 'include/events_public.inc.php');
    2125
    2226// tags on picture page
     
    2731
    2832// tags everywhere
    29 if ( $conf['TypeTags']['show_all'] and script_basename() != 'tags' )
     33if ($conf['TypeTags']['show_all'] and script_basename() != 'tags')
    3034{
    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');
     35  add_event_handler('render_tag_name', 'typetags_render', 0, 2);
    3736}
    3837
     38// tags on tags page
     39add_event_handler('loc_end_tags', 'typetags_tags');
    3940
    40 add_event_handler('get_admin_plugin_menu_links', 'typetags_admin_menu');
    4141
    42 function typetags_admin_menu($menu)
     42if (defined('IN_ADMIN'))
    4343{
    44   array_push($menu, array(
    45     'NAME' => 'TypeT@gs',
    46     'URL' => typetags_ADMIN,
    47   ));
    48   return $menu;
     44  add_event_handler('get_admin_plugin_menu_links', 'typetags_admin_menu');
     45
     46  add_event_handler('loc_begin_admin_page', 'typetags_admin');
     47
     48  include_once(TYPETAGS_PATH . 'include/events_admin.inc.php');
    4949}
    50 
    51 ?>
  • extensions/typetags/maintain.inc.php

    r21361 r26665  
    11<?php
    2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     2defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
    33
    4 function plugin_install()
     4class typetags_maintain extends PluginMaintain
    55{
    6   global $prefixeTable;
     6  private $installed = false;
    77
    8   $query = 'SHOW FULL COLUMNS FROM ' . TAGS_TABLE . ';';
    9   $result = array_from_query($query, 'Field');
    10   if (!in_array('id_typetags', $result))
     8  private $default_conf = array(
     9    'show_all'=>true,
     10    );
     11
     12  function install($plugin_version, &$errors=array())
    1113  {
    12     pwg_query('ALTER TABLE '.TAGS_TABLE.' ADD COLUMN `id_typetags` SMALLINT(5);');
    13   }
     14    global $conf, $prefixeTable;
    1415
    15   $result = pwg_query('SHOW TABLES LIKE "' . $prefixeTable .'typetags"');
    16   if (!pwg_db_num_rows($result))
    17   {
     16    if (empty($conf['TypeTags']))
     17    {
     18      $conf['TypeTags'] = serialize($this->default_conf);
     19      conf_update_param('TypeTags', $conf['TypeTags']);
     20    }
     21
     22    $result = pwg_query('SHOW COLUMNS FROM `' . TAGS_TABLE . '` LIKE "id_typetags";');
     23    if (!pwg_db_num_rows($result))
     24    {
     25      pwg_query('ALTER TABLE `' . TAGS_TABLE . '` ADD `id_typetags` SMALLINT(5) DEFAULT NULL;');
     26    }
     27
    1828    $query = '
    19 CREATE TABLE `'. $prefixeTable .'typetags` (
     29CREATE TABLE IF NOT EXISTS `' . $prefixeTable . 'typetags` (
    2030  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
    2131  `name` varchar(255) NOT NULL,
     
    2535;';
    2636    pwg_query($query);
     37
     38    $this->installed = true;
    2739  }
    28  
    29   conf_update_param('TypeTags', serialize(array('show_all'=>true)));
    30 }
    3140
    32 function plugin_activate()
    33 {
    34   global $conf;
    35  
    36   if (!isset($conf['TypeTags']))
     41  function activate($plugin_version, &$errors=array())
    3742  {
    38     conf_update_param('TypeTags', serialize(array('show_all'=>true)));
     43    if (!$this->installed)
     44    {
     45      $this->install($plugin_version, $errors);
     46    }
     47  }
     48
     49  function deactivate()
     50  {
     51  }
     52
     53  function uninstall()
     54  {
     55    global $prefixeTable;
     56
     57    conf_delete_param('TypeTags');
     58
     59    pwg_query('ALTER TABLE `' . TAGS_TABLE . '` DROP `id_typetags`');
     60    pwg_query('DROP TABLE `' . $prefixeTable . 'typetags`;');
    3961  }
    4062}
    41 
    42 function plugin_uninstall()
    43 {
    44   global $prefixeTable;
    45 
    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;');
    49 }
    50 
    51 ?>
  • extensions/typetags/template/admin.tpl

    r26663 r26665  
    1 {combine_script id="jquery.ui.draggable"}
    2 {combine_script id="jquery.ui.droppable"}
    3 {combine_script id="farbtastic" require="jquery" path=$ROOT_URL|@cat:"plugins/typetags/admin/farbtastic/farbtastic.js"}
    4 {combine_css path=$ROOT_URL|@cat:"plugins/typetags/admin/farbtastic/farbtastic.css"}
    5 {combine_css path=$ROOT_URL|@cat:"plugins/typetags/admin/typetags_style.css"}
     1{combine_script id="farbtastic" require="jquery" path=$TYPETAGS_PATH|cat:"template/farbtastic/farbtastic.js"}
     2{combine_css path=$TYPETAGS_PATH|cat:"template/farbtastic/farbtastic.css"}
     3{combine_css path=$TYPETAGS_PATH|cat:"template/style.css"}
    64
    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'});
    18     });
    19    
    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 + ';';
    31     });
    32   });
    33  
    34   jQuery('#assoc-input').val(out);
    35   submit(form);
    36 }
    37 
    38 // colorpicker
     5{footer_script}
     6// init colorpicker
    397jQuery('#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     });     
    67   }
    68 });
    69 {/literal}{/footer_script}
     8{/footer_script}
    709
    7110<div class="titrePage">
    72   <h2>TypeT@gs</h2>
     11  <h2>Coloured Tags</h2>
    7312</div>
    74  
    75 <form action="{$typetags_ADMIN}" method="post" name="form">
     13
     14<form action="{$F_ACTION}" method="post" name="form">
    7615  <fieldset>
    7716  {if isset($IN_EDIT)}
    78     <legend>{'Edit typetag'|@translate}</legend>
     17    <legend>{'Edit color'|translate}</legend>
    7918    <div class="edit-container">
    8019      <div id="colorpicker"></div>
    81       <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>
     20      <p><b>{'Edit color'|translate} : <input type="text" readonly="readonly" size="18" style="background-color:{$typetag.OLD_COLOR};color:{$typetag.COLOR_TEXT};" value="{$typetag.OLD_NAME}"></b></p>
    8221      <p>&nbsp;</p>
    83       <p>{'New name'|@translate} : <input type="text" size="18" name="typetag_name" value="{$typetag.NAME}"></p>
    84       <p>{'New color'|@translate} : <input type="text" id="hexval" name="typetag_color" size="7" maxlength="7" value="{$typetag.COLOR}"></p>
     22      <p>{'New name'|translate} : <input type="text" size="18" name="typetag_name" value="{$typetag.NAME}"></p>
     23      <p>{'New color'|translate} : <input type="text" id="hexval" name="typetag_color" size="7" maxlength="7" value="{$typetag.COLOR}"></p>
    8524      <p>&nbsp;</p>
    8625      <p>
    8726        <input type="hidden" name="edited_typetag" value="{$edited_typetag}">
    88         <input class="submit" type="submit" name="edittypetag" value="{'Modify'|@translate}">
    89         <input class="submit" type="submit" name="cancel" value="{'Reset'|@translate}">
     27        <input class="submit" type="submit" name="edittypetag" value="{'Save'|translate}">
     28        <input class="submit" type="submit" name="cancel" value="{'Reset'|translate}">
    9029      </p>
    9130    </div>
    9231  {else}
    93     <legend>{'Create a Typetag'|@translate}</legend>
     32    <legend>{'Add a new color'|translate}</legend>
    9433    <div class="edit-container">
    9534      <div id="colorpicker"></div>
    96       <p>{'New TypeTag'|@translate} : <input type="text" size="18" name="typetag_name" value="{if isset($typetag.NAME)}{$typetag.NAME}{/if}"></p>
    97       <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>
     35      <p>&nbsp;</p>
     36      <p>{'Name'|translate} : <input type="text" size="18" name="typetag_name" value="{if isset($typetag.NAME)}{$typetag.NAME}{/if}"></p>
     37      <p>{'Color'|translate} : <input type="text" id="hexval" name="typetag_color" size="7" maxlength="7" value="{if isset($typetag.COLOR)}{$typetag.COLOR}{else}#444444{/if}"></p>
    9838      <p>&nbsp;</p>
    9939      <p>
    100         <input class="submit" type="submit" name="addtypetag" value="{'Create a Typetag'|@translate}">
     40        <input class="submit" type="submit" name="addtypetag" value="{'Add'|translate}">
    10141      </p>
    10242    </div>
     
    10545</form>
    10646
    107 {if !empty($typetags_selection) and !isset($IN_EDIT)}
    108 <form action="{$typetags_ADMIN}" method="post" name="form" onsubmit="save_datas(this);">
     47{if !empty($typetags)}
     48<fieldset>
     49  <legend>{'Manage colors'|translate}</legend>
     50
     51  <ul class="tagSelection typetagSelection">
     52  {foreach from=$typetags item=typetag}
     53    <li style="background-color:{$typetag.color};color:{$typetag.color_text};">
     54      <span class="buttons">
     55        <a href="{$typetag.u_edit}" title="{'edit'|translate}"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/edit_s.png" class="button" alt="{'edit'|translate}"></a>
     56        <a href="{$typetag.u_delete}" title="{'delete'|translate}" onclick="return confirm('{'Are you sure?'|translate}');"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/delete.png" class="button" alt="{'delete'|translate}"></a>
     57      </span>
     58      {$typetag.name}
     59    </li>
     60  {/foreach}
     61  </ul>
     62
     63  <p style="text-align:left;">{'Go to <a href="%s">Photos/Tags</a> to manage associations.'|translate:($ROOT_URL|cat:'admin.php?page=tags')}</p>
     64</fieldset>
     65{/if}
     66
     67
     68<form action="{$F_ACTION}" method="post" name="form">
    10969  <fieldset>
    110     <legend>{'Edit and associate TypeTags'|@translate}</legend>
    111    
    112     <ul id="tt-NULL" class="tt-container NULL">
    113       <h5>{'Not associated'|@translate}</h5>
    114       {foreach from=$typetags_association item=tag}
    115       <li id="t-{$tag.tagid}" data="tt-{$tag.typetagid}">
    116         {$tag.tagname}
    117       </li>
    118       {/foreach}
    119     </ul>
    120    
    121     <div id="associations">
    122     {foreach from=$typetags_selection item=typetag}
    123       <ul id="tt-{$typetag.id}" class="tt-container" style="box-shadow:inset 0 0 5px {$typetag.color};">
    124         <span class="buttons">
    125           <a href="{$typetag.u_edit}" title="{'edit'|@translate}"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/edit_s.png" class="button" alt="{'edit'|@translate}"></a>
    126           <a href="{$typetag.u_delete}" title="{'delete'|@translate}" onclick="return confirm('{'Are you sure?'|@translate}');"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/delete.png" class="button" alt="{'delete'|@translate}"></a>
    127         </span>
    128         <h5 style="background-color:{$typetag.color};color:{$typetag.color_text};">{$typetag.name}</h5>
    129       </ul>
    130     {/foreach}
    131     </div>
    132    
    133     <div style="clear:both;"></div>
    134     <p style="margin-top:20px;">
    135       <input type="hidden" name="associations" id="assoc-input">
    136       <input class="submit" type="submit" name="associate" value="{'Validate'|@translate}">
    137       <input class="submit" type="submit" name="delete_all_assoc" value="{'Delete all associations'|@translate}" onclick="return confirm('{'Are you sure?'|@translate}');">
    138     </p>
     70    <legend>{'Configuration'|translate}</legend>
     71
     72    <b>{'Display colored tags'|translate}</b>
     73    <label><input type="radio" name="show_all" value="false" {if not $SHOW_ALL}checked="checked"{/if}> {'Only on tags page'|translate}</label>
     74    <label><input type="radio" name="show_all" value="true" {if $SHOW_ALL}checked="checked"{/if}> {'Everywhere'|translate}</label>
     75
     76    <p><input class="submit" type="submit" name="save_config" value="{'Submit'|translate}"></p>
    13977  </fieldset>
    14078</form>
    141 {/if}
    142 
    143 {if !isset($IN_EDIT)}
    144 <form action="{$typetags_ADMIN}" method="post" name="form">
    145 <fieldset>
    146   <legend>{'Configuration'|@translate}</legend>
    147   <b>{'Display colored tags'|@translate}</b>
    148   <label><input type="radio" name="show_all" value="false" {if not $SHOW_ALL}checked="checked"{/if}> {'Only on tags page'|@translate}</label>
    149   <label><input type="radio" name="show_all" value="true" {if $SHOW_ALL}checked="checked"{/if}> {'Everywhere'|@translate}</label>
    150   <p><input class="submit" type="submit" name="save_config" value="{'Submit'|@translate}"></p>
    151 </fieldset>
    152 </form>
    153 {/if}
Note: See TracChangeset for help on using the changeset viewer.