Changeset 23259 for trunk/admin


Ignore:
Timestamp:
Jun 16, 2013, 6:23:45 PM (11 years ago)
Author:
mistic100
Message:

feature:2884 Display "i" tooltip on themes
+ simplify layout (like plugins_installed)

Location:
trunk/admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/themes/default/template/themes_installed.tpl

    r14192 r23259  
    11{include file='include/colorbox.inc.tpl'}
     2
    23{footer_script}{literal}
    34jQuery(document).ready(function() {
    4   $("a.preview-box").colorbox();
    5 });
     5  $("a.preview-box").colorbox();
     6 
     7  jQuery('.showInfo').tipTip({
     8    'delay' : 0,
     9    'fadeIn' : 200,
     10    'fadeOut' : 200,
     11    'maxWidth':'300px',
     12    'keepAlive':true,
     13    'activation':'click'
     14  });
     15});
    616{/literal}{/footer_script}
    717
     
    1222<div id="themesContent">
    1323
    14 <fieldset>
    15 <legend>{'Active Themes'|@translate}</legend>
    16 {if isset($active_themes)}
    17 <div class="themeBoxes">
    18 {foreach from=$active_themes item=theme}
    19   <div class="themeBox{if $theme.is_default} themeDefault{/if}">
    20     <div class="themeName">{$theme.name}{if $theme.is_default} <em>({'default'|@translate})</em>{/if} {if $theme.mobile} <em>({'Mobile'|@translate})</em>{/if}</div>
    21     <div class="themeShot"><a href="{$theme.screenshot}" class="preview-box" title="{$theme.name}"><img src="{$theme.screenshot}" alt=""></a></div>
     24{assign var='field_name' value='null'} {* <!-- 'counter' for fieldset management --> *}
     25{foreach from=$tpl_themes item=theme}
     26   
     27{if $field_name != $theme.STATE}
     28  {if $field_name != 'null'}
     29    </div>
     30  </fieldset>
     31  {/if}
     32 
     33  <fieldset>
     34    <legend>
     35    {if $theme.STATE == 'active'}
     36      {'Active Themes'|@translate}
     37    {else}
     38      {'Inactive Themes'|@translate}
     39    {/if}
     40    </legend>
     41    <div class="themeBoxes">
     42  {assign var='field_name' value=$theme.STATE}
     43{/if}
     44
     45  {if not empty($theme.AUTHOR)}
     46    {if not empty($theme.AUTHOR_URL)}
     47      {assign var='author' value="<a href='%s'>%s</a>"|@sprintf:$theme.AUTHOR_URL:$theme.AUTHOR}
     48    {else}
     49      {assign var='author' value='<u>'|cat:$theme.AUTHOR|cat:'</u>'}
     50    {/if}
     51  {/if}
     52  {if not empty($theme.VISIT_URL)}
     53    {assign var='version' value="<a class='externalLink' href='"|cat:$theme.VISIT_URL|cat:"'>"|cat:$theme.VERSION|cat:"</a>"}
     54  {else}
     55    {assign var='version' value=$theme.VERSION}
     56  {/if}
     57 
     58  <div class="themeBox{if $theme.IS_DEFAULT} themeDefault{/if}">
     59    <div class="themeName">
     60      {$theme.NAME} {if $theme.IS_DEFAULT}<em>({'default'|@translate})</em>{/if} {if $theme.IS_MOBILE}<em>({'Mobile'|@translate})</em>{/if}
     61      <a class="showInfo" title="{if !empty($author)}{'By %s'|@translate|@sprintf:$author} | {/if}{'Version'|@translate} {$version}<br/>{$theme.DESC|@escape:'html'}">i</a>
     62    </div>
     63    <div class="themeShot"><a href="{$theme.SCREENSHOT}" class="preview-box" title="{$theme.NAME}"><img src="{$theme.SCREENSHOT}" alt=""></a></div>
    2264    <div class="themeActions">
    2365      <div>
    24 {if $theme.deactivable}
    25       <a href="{$deactivate_baseurl}{$theme.id}" class="tiptip" title="{'Forbid this theme to users'|@translate}">{'Deactivate'|@translate}</a>
     66{if $theme.STATE == 'active'}
     67  {if $theme.DEACTIVABLE}
     68      <a href="{$deactivate_baseurl}{$theme.ID}" class="tiptip" title="{'Forbid this theme to users'|@translate}">{'Deactivate'|@translate}</a>
     69  {else}
     70      <span title="{$theme.DEACTIVATE_TOOLTIP}" class="tiptip">{'Deactivate'|@translate}</span>
     71  {/if}
     72
     73  {if not $theme.IS_DEFAULT}
     74      | <a href="{$set_default_baseurl}{$theme.ID}" class="tiptip" title="{'Set as default theme for unregistered and new users'|@translate}">{'Default'|@translate}</a>
     75  {/if}
     76  {if $theme.ADMIN_URI}
     77      <br><a href="{$theme.ADMIN_URI}" class="tiptip" title="{'Configuration'|@translate}">{'Configuration'|@translate}</a>
     78  {/if}
    2679{else}
    27       <span title="{$theme.deactivate_tooltip}" class="tiptip">{'Deactivate'|@translate}</span>
    28 {/if}
    29      
    30 {if not $theme.is_default}
    31       | <a href="{$set_default_baseurl}{$theme.id}" class="tiptip" title="{'Set as default theme for unregistered and new users'|@translate}">{'Default'|@translate}</a>
    32 {/if}
    33 {if isset($theme.admin_uri)}
    34       <br><a href="{$theme.admin_uri}" class="tiptip" title="{'Configuration'|@translate}">{'Configuration'|@translate}</a>
     80  {if $theme.ACTIVABLE}
     81      <a href="{$activate_baseurl}{$theme.ID}" title="{'Make this theme available to users'|@translate}" class="tiptip">{'Activate'|@translate}</a>
     82  {else}
     83      <span title="{$theme.ACTIVATE_TOOLTIP}" class="tiptip">{'Activate'|@translate}</span>
     84  {/if}
     85      |
     86  {if $theme.DELETABLE}
     87      <a href="{$delete_baseurl}{$theme.ID}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');" title="{'Delete this theme'|@translate}">{'Delete'|@translate}</a>
     88  {else}
     89      <span title="{$theme.DELETE_TOOLTIP}" class="tiptip">{'Delete'|@translate}</span>
     90  {/if}
    3591{/if}
    3692      </div>
    3793    </div> <!-- themeActions -->
    3894  </div>
    39 {/foreach}
    40 </div> <!-- themeBoxes -->
    41 {/if}
    42 </fieldset>
    43 
    44 {if isset($inactive_themes)}
    45 <fieldset>
    46 <legend>{'Inactive Themes'|@translate}</legend>
    47 <div class="themeBoxes">
    48 {foreach from=$inactive_themes item=theme}
    49   <div class="themeBox">
    50     <div class="themeName">{$theme.name}{if $theme.mobile} <em>({'Mobile'|@translate})</em>{/if}</div>
    51     <div class="themeShot"><a href="{$theme.screenshot}" class="preview-box" title="{$theme.name}"><img src="{$theme.screenshot}" alt=""></a></div>
    52     <div class="themeActions">
    53       <div>
    54   {if $theme.activable}
    55       <a href="{$activate_baseurl}{$theme.id}" title="{'Make this theme available to users'|@translate}" class="tiptip">{'Activate'|@translate}</a>
    56   {else}
    57       <span title="{$theme.activate_tooltip}" class="tiptip">{'Activate'|@translate}</span>
    58   {/if}
    59 
    60       |
    61 
    62   {if $theme.deletable}
    63       <a href="{$delete_baseurl}{$theme.id}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');" title="{'Delete this theme'|@translate}">{'Delete'|@translate}</a>
    64   {else}
    65       <span title="{$theme.delete_tooltip}" class="tiptip">{'Delete'|@translate}</span>
    66   {/if}
    67       </div>
    68     </div>
    69    
    70   </div>
     95 
    7196{/foreach}
    7297</div> <!-- themeBoxes -->
    7398</fieldset>
    74 {/if}
    7599
    76100</div> <!-- themesContent -->
  • trunk/admin/themes/default/theme.css

    r23121 r23259  
    759759#thePopuphelpPage #footer  {display:none}
    760760
    761 .themeBox {display:inline-table; text-align:center; height:192px; background-color:#eee; margin:5px; -moz-border-radius:5px; overflow:hidden; }
     761.themeBox {display:inline-table; text-align:center; height:192px; background-color:#eee; margin:5px; border-radius:5px; overflow:hidden; }
    762762
    763763.themeBox IMG {border:1px solid white; margin:0 15px;}
    764 .themeName {font-size:1.1em; margin:5px 0;}
     764.themeName {font-size:1em; margin:5px 0; position:relative; }
    765765.themeActions {display: table-row; font-size:12px; height: 43px; }
    766766.themeActions DIV {display: table-cell; vertical-align: middle; line-height:18px; }
     
    865865.languageActions DIV {display: table-cell; vertical-align: middle; line-height:18px; }
    866866
    867 #ui-datepicker-div {-moz-border-radius:5px;}
     867#ui-datepicker-div {-moz-border-radius:5px; border-radius:5px;}
    868868#ui-datepicker-div .ui-icon-circle-triangle-w, #ui-datepicker-div .ui-icon-circle-triangle-e {color:transparent;}
    869869#ui-datepicker-div A.ui-datepicker-prev, #ui-datepicker-div A.ui-datepicker-next {background-color:transparent;}
     
    11011101  -moz-border-radius:10px;
    11021102  -webkit-border-radius:10px;
    1103   -border-radius:10px;
    11041103  margin-left:5px;
    11051104}
  • trunk/admin/themes_installed.php

    r19703 r23259  
    6666}
    6767
    68 $active_themes = array();
    69 $inactive_themes = array();
     68$tpl_themes = array();
    7069
    7170foreach ($themes->fs_themes as $theme_id => $fs_theme)
     
    7574    continue;
    7675  }
     76 
     77  $tpl_theme = array(
     78    'ID' => $theme_id,
     79    'NAME' => $fs_theme['name'],
     80    'VISIT_URL' => $fs_theme['uri'],
     81    'VERSION' => $fs_theme['version'],
     82    'DESC' => $fs_theme['description'],
     83    'AUTHOR' => $fs_theme['author'],
     84    'AUTHOR_URL' => @$fs_theme['author uri'],
     85    'PARENT' => @$fs_theme['parent'],
     86    'SCREENSHOT' => $fs_theme['screenshot'],
     87    'IS_MOBILE' => $fs_theme['mobile'],
     88    'ADMIN_URI' => @$fs_theme['admin_uri'],
     89    );
    7790
    7891  if (in_array($theme_id, $db_theme_ids))
    7992  {
    80     $fs_theme['deactivable'] = true;
     93    $tpl_theme['STATE'] = 'active';
     94    $tpl_theme['DEACTIVABLE'] = true;
    8195
    8296    if (count($db_theme_ids) <= 1)
    8397    {
    84       $fs_theme['deactivable'] = false;
    85       $fs_theme['deactivate_tooltip'] = l10n('Impossible to deactivate this theme, you need at least one theme.');
     98      $tpl_theme['DEACTIVABLE'] = false;
     99      $tpl_theme['DEACTIVATE_TOOLTIP'] = l10n('Impossible to deactivate this theme, you need at least one theme.');
    86100    }
    87 
    88     if ($theme_id == $default_theme)
     101   
     102    $tpl_theme['IS_DEFAULT'] = ($theme_id == $default_theme);
     103  }
     104  else
     105  {
     106    $tpl_theme['STATE'] = 'inactive';
     107   
     108    // is the theme "activable" ?
     109    if (isset($fs_theme['activable']) and !$fs_theme['activable'])
    89110    {
    90       $fs_theme['is_default'] = true;
    91       array_unshift($active_themes, $fs_theme);
     111      $tpl_theme['ACTIVABLE'] = false;
     112      $tpl_theme['ACTIVABLE_TOOLTIP'] = l10n('This theme was not designed to be directly activated');
    92113    }
    93114    else
    94115    {
    95       $fs_theme['is_default'] = false;
    96       array_push($active_themes, $fs_theme);
    97     }
    98   }
    99   else
    100   {
    101     // is the theme "activable" ?
    102     if (isset($fs_theme['activable']) and !$fs_theme['activable'])
    103     {
    104       $fs_theme['activate_tooltip'] = l10n('This theme was not designed to be directly activated');
    105     }
    106     else
    107     {
    108       $fs_theme['activable'] = true;
     116      $tpl_theme['ACTIVABLE'] = true;
    109117    }
    110118
     
    112120    if (isset($missing_parent))
    113121    {
    114       $fs_theme['activable'] = false;
     122      $tpl_theme['ACTIVABLE'] = false;
    115123
    116       $fs_theme['activate_tooltip'] = sprintf(
     124      $tpl_theme['ACTIVABLE_TOOLTIP'] = sprintf(
    117125        l10n('Impossible to activate this theme, the parent theme is missing: %s'),
    118126        $missing_parent
     
    123131    $children = $themes->get_children_themes($theme_id);
    124132
    125     $fs_theme['deletable'] = true;
     133    $tpl_theme['DELETABLE'] = true;
    126134
    127135    if (count($children) > 0)
    128136    {
    129       $fs_theme['deletable'] = false;
     137      $tpl_theme['DELETABLE'] = false;
    130138
    131       $fs_theme['delete_tooltip'] = sprintf(
     139      $tpl_theme['DELETE_TOOLTIP'] = sprintf(
    132140        l10n('Impossible to delete this theme. Other themes depends on it: %s'),
    133141        implode(', ', $children)
    134142        );
    135143    }
     144  }
     145 
     146  array_push($tpl_themes, $tpl_theme);
     147}
    136148
    137     array_push($inactive_themes, $fs_theme);
    138   }
     149// sort themes by state then by name
     150function cmp($a, $b)
     151{
     152  $s = array('active' => 0, 'inactive' => 1);
     153 
     154  if (@$a['IS_DEFAULT']) return -1;
     155  if (@$b['IS_DEFAULT']) return 1;
     156 
     157  if($a['STATE'] == $b['STATE'])
     158    return strcasecmp($a['NAME'], $b['NAME']);
     159  else
     160    return $s[$a['STATE']] >= $s[$b['STATE']];
    139161}
     162usort($tpl_themes, 'cmp');
    140163
    141164$template->assign(
     
    146169      'delete_baseurl' => $base_url.'&amp;action=delete&amp;theme=',
    147170
    148       'active_themes' => $active_themes,
    149       'inactive_themes' => $inactive_themes,
     171      'tpl_themes' => $tpl_themes,
    150172    )
    151173  );
Note: See TracChangeset for help on using the changeset viewer.