Changeset 5446

Show
Ignore:
Timestamp:
03/29/10 15:30:02 (3 years ago)
Author:
patdenice
Message:

feature 1502: Allow to have configuration page for each theme.css.
About string for theme has to be saved in language theme directory (about.html)

Location:
trunk
Files:
1 added
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/about.php

    r5208 r5446  
    3939include(PHPWG_ROOT_PATH.'include/page_header.php'); 
    4040 
    41 /** 
    42  * set in ./local/language/en_UK.lang.php (maybe to create) 
    43  * for example for clear theme: 
    44   $lang['Theme: clear'] = 'This is the clear theme based on yoga template. '. 
    45   ' A standard template/theme of PhpWebgallery.'; 
    46  * 
    47  * Don't forget php tags !!! 
    48  * 
    49  * Another way is to code it thru the theme itself in ./themeconf.inc.php 
    50  */ 
    51 @include(PHPWG_ROOT_PATH.'template/'.$user['template']. 
    52   '/theme/'.$user['theme'].'/themeconf.inc.php'); 
    53  
    54 $template->set_filenames( 
    55   array( 
    56     'about'=>'about.tpl', 
    57     ) 
    58   ); 
    59 if ( isset($lang['Theme: '.$user['theme']]) ) 
    60 { 
    61   $template->assign( 
    62     'THEME_ABOUT',l10n('Theme: '.$user['theme']) 
    63     ); 
    64 } 
     41$template->set_filename('about', 'about.tpl'); 
    6542 
    6643$template->assign('ABOUT_MESSAGE', load_language('about.html','', array('return'=>true)) ); 
     44 
     45$theme_about = load_language('about.html', PHPWG_THEMES_PATH.$user['theme'].'/', array('return' => true)); 
     46if ( $theme_about !== false ) 
     47{ 
     48  $template->assign('THEME_ABOUT', $theme_about); 
     49} 
    6750 
    6851$template->pparse('about'); 
  • trunk/admin/include/themes.class.php

    r5382 r5446  
    7171    } 
    7272 
     73    $file_to_include = PHPWG_THEMES_PATH.'/'.$theme_id.'/admin/maintain.inc.php'; 
     74 
    7375    $errors = array(); 
    7476 
     
    101103          break; 
    102104        } 
    103          
    104         $query = " 
     105 
     106        if (file_exists($file_to_include)) 
     107        { 
     108          include($file_to_include); 
     109          if (function_exists('theme_activate')) 
     110          { 
     111            theme_activate($theme_id, $this->fs_themes[$theme_id]['version'], $errors); 
     112          } 
     113        } 
     114 
     115        if (empty($errors)) 
     116        { 
     117          $query = " 
    105118INSERT INTO ".THEMES_TABLE." 
    106119  SET id = '".$theme_id."' 
     
    108121    , name = '".$this->fs_themes[$theme_id]['name']."' 
    109122;"; 
    110         pwg_query($query); 
     123          pwg_query($query); 
     124        } 
    111125        break; 
    112126 
     
    151165          $this->set_default_theme($new_theme); 
    152166        } 
    153          
     167 
     168        if (file_exists($file_to_include)) 
     169        { 
     170          include($file_to_include); 
     171          if (function_exists('theme_deactivate')) 
     172          { 
     173            theme_deactivate($theme_id); 
     174          } 
     175        } 
     176 
    154177        $query = " 
    155178DELETE 
     
    375398              ; 
    376399          } 
    377            
     400 
     401          $admin_file = $path.'/admin/admin.inc.php'; 
     402          if (file_exists($admin_file)) 
     403          { 
     404            $theme['admin_uri'] = get_root_url().'admin.php?page=theme&theme='.$file; 
     405          } 
     406 
    378407          // IMPORTANT SECURITY ! 
    379408          $theme = array_map('htmlspecialchars', $theme); 
  • trunk/admin/themes/default/default-layout.css

    r5383 r5446  
    750750} 
    751751 
    752 .themeBox {display:inline-block; text-align:center; height:180px; background-color:#eee; margin:5px; -moz-border-radius:5px;} 
     752.themeBox {display:inline-table; text-align:center; height:192px; background-color:#eee; margin:5px; -moz-border-radius:5px; overflow:hidden; } 
    753753 
    754754.themeBox IMG {border:1px solid white; margin:0 15px;} 
    755755.themeName {font-size:1.1em; margin:5px 0;} 
    756 .themeActions {margin:5px 0; font-size:12px;} 
     756.themeActions {display: table-row; font-size:12px; height: 43px; } 
     757.themeActions DIV {display: table-cell; vertical-align: middle; line-height:18px; } 
    757758.themeActions A {} 
    758759 
  • trunk/admin/themes/default/template/themes_installed.tpl

    r5382 r5446  
    1414    <div class="themeShot"><img src="{$theme.screenshot}"></div> 
    1515    <div class="themeActions"> 
    16  
     16      <div> 
    1717{if $theme.deactivable} 
    1818      <a href="{$deactivate_baseurl}{$theme.id}" title="{'Forbid this theme to users'|@translate}">{'Deactivate'|@translate}</a> 
     
    2424      | <a href="{$set_default_baseurl}{$theme.id}" title="{'Set as default theme for unregistered and new users'|@translate}">{'Default'|@translate}</a> 
    2525{/if} 
     26{if isset($theme.admin_uri)} 
     27      <br><a href="{$theme.admin_uri}" title="{'Configuration'|@translate}">{'Configuration'|@translate}</a> 
     28{/if} 
     29      </div> 
    2630    </div> <!-- themeActions --> 
    2731  </div> 
     
    4044    <div class="themeShot"><img src="{$theme.screenshot}"></div> 
    4145    <div class="themeActions"> 
    42  
     46      <div> 
    4347  {if $theme.activable} 
    4448      <a href="{$activate_baseurl}{$theme.id}" title="{'Make this theme available to users'|@translate}">{'Activate'|@translate}</a> 
     
    5458      <span title="{$theme.delete_tooltip}">{'Delete'|@translate}</span> 
    5559  {/if} 
    56  
     60      </div> 
    5761    </div> 
    5862     
  • trunk/include/template.class.php

    r5434 r5446  
    9595    $this->set_template_dir($root.'/'.$theme.'/'.$path); 
    9696 
    97     include($root.'/'.$theme.'/themeconf.inc.php'); 
     97    $themeconf = $this->load_themeconf($root.'/'.$theme); 
    9898 
    9999    if (isset($themeconf['parent']) and $themeconf['parent'] != $theme) 
     
    574574    return $source; 
    575575  } 
     576 
     577  function load_themeconf($dir) 
     578  { 
     579    global $themeconfs, $conf, $page; 
     580 
     581    $dir = realpath($dir); 
     582    if (!isset($themeconfs[$dir])) 
     583    { 
     584      $themeconf = array(); 
     585      include($dir.'/themeconf.inc.php'); 
     586      // Put themeconf in cache 
     587      $themeconfs[$dir] = $themeconf; 
     588    } 
     589    return $themeconfs[$dir]; 
     590  } 
    576591} 
    577592