Changeset 2461 for trunk


Ignore:
Timestamp:
Jul 24, 2008, 11:56:35 PM (16 years ago)
Author:
vdigital
Message:

Swift Theme Creator (minor changes): Still incomplete but first operational version (6).
Just a bug squashed draft version. Enjoy it.

Location:
trunk/plugins/SwiftThemeCreator
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/SwiftThemeCreator/theme.tpl

    r2454 r2461  
    55INPUT.rateButtonSelected /* <= why IE doesn't inherit this ? */ {ldelim}
    66        color:{$main.color2}; }
    7 #theImage IMG {ldelim} border-color: {$main.color2}; }
     7#theImage IMG {ldelim} border: 3px ridge {$main.color2}; }
    88
    99H2, #menubar DT, .throw,
    1010A, INPUT.rateButton {ldelim} color: {$main.color3}; }
    1111
    12 UL.tabsheet LI.normal_tab:hover {ldelim} border-color: {$main.color4}; }
     12UL.tabsheet LI.normal_tab:hover {ldelim} border: 1px solid {$main.color4}; }
    1313A:hover {ldelim}        color: {$main.color4}; }
    1414
     
    1616.content UL.thumbnailCategories DIV.thumbnailCategory:hover,
    1717.content UL.thumbnailCategories DIV.thumbnailCategory:hover A {ldelim}
    18  color: {$main.color4}; border-color: {$main.color5}; background-color: {$main.color6}; }
     18 color: {$main.color4}; border: 1px solid {$main.color5}; background-color: {$main.color6}; }
    1919
    2020#menubar DL, .content, #comments DIV.comment BLOCKQUOTE,
    21 #imageHeaderBar, H2, #menubar DT, #imageToolBar {ldelim} border-color: {$main.color5}; }
     21#imageHeaderBar, H2, #menubar DT, #imageToolBar {ldelim} border: 1px solid {$main.color5}; }
    2222
    2323#menubar DL, .content, #imageToolBar, .header_notes, UL.tabsheet LI.selected_tab {ldelim}
     
    2626FIELDSET, INPUT, SELECT, TEXTAREA, .content DIV.comment  A.illustration IMG,
    2727.content DIV.thumbnailCategory, .content UL.thumbnails SPAN.wrap2 {ldelim}
    28  border-color: {$main.color6}; }
     28 border: 1px solid {$main.color6}; }
    2929
    30 #comments DIV.comment BLOCKQUOTE {ldelim} border-color: {$main.color7}; }
     30#comments DIV.comment BLOCKQUOTE {ldelim} border-left: 1px solid {$main.color7}; }
    3131
    3232H2, #menubar DT, .throw {ldelim} background-image: url(stc.png); }
  • trunk/plugins/SwiftThemeCreator/theme_creator.php

    r2454 r2461  
    2525if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    2626if (!defined('IN_ADMIN') or !IN_ADMIN) die('Hacking attempt!');
    27 
     27define(STC_PATH, PHPWG_PLUGINS_PATH.'SwiftThemeCreator/');
    2828/*
    2929 * stc_hex2rgb convert any string to array of RGB values
     
    6969function stc_newfile( $filename, $data )
    7070{
    71   $fp = fopen($filename, 'w');
    72   if ($fp)
    73   {
     71  $fp = @fopen($filename, 'w');
     72  if ($fp) {
    7473    $ret = fwrite($fp, $data);
    75     fclose($fp);
     74    @fclose($fp);
    7675    return $ret;
    7776  }
     
    137136
    138137  // 2.2 - Background and Internal links control
    139   list($r1,$g1,$b1) = stc_hex2rgb($main['color'][0]);
    140   list($r2,$g2,$b2) = stc_hex2rgb($main['color'][2]);
    141   // Background and Internal links "brightness" difference control:
    142   $dif = abs( ( (($r1*299)+($g1*587)+($b1*114)) / 1000 )
    143           - ( (($r2*299)+($g2*587)+($b2*114)) / 1000 ));
    144   if ( $dif < 65 )
     138  if (isset($do_it))
     139  {
     140    list($r1,$g1,$b1) = stc_hex2rgb($main['color'][0]);
     141    list($r2,$g2,$b2) = stc_hex2rgb($main['color'][2]);
     142    // Background and Internal links "brightness" difference control:
     143    $dif = abs( ( (($r1*299)+($g1*587)+($b1*114)) / 1000 )
     144            - ( (($r2*299)+($g2*587)+($b2*114)) / 1000 ));
     145    if ( $dif < 65 )
     146        array_push($errors,
     147         l10n('Insufficient brightness difference between '
     148              . 'Internal links and background. dif=') . $dif);
     149    // Background and Internal links "colour" difference control:
     150    $dif = (max($r1, $r2) - min($r1, $r2))
     151       + (max($g1, $g2) - min($g1, $g2))
     152       + (max($b1, $b2) - min($b1, $b2));
     153    if ( $dif < 200 )
    145154      array_push($errors,
    146        l10n('Insufficient brightness difference between '
    147             . 'Internal links and background. dif=') . $dif);
    148   // Background and Internal links "colour" difference control:
    149   $dif = (max($r1, $r2) - min($r1, $r2))
    150      + (max($g1, $g2) - min($g1, $g2))
    151      + (max($b1, $b2) - min($b1, $b2));
    152   if ( $dif < 200 )
    153     array_push($errors,
    154        l10n('Insufficient colour difference between '
    155             . 'Internal links and background. dif=') . $dif);
    156 
     155         l10n('Insufficient colour difference between '
     156              . 'Internal links and background. dif=') . $dif);
     157  }
    157158  // 3 - Directory control
    158159  $main['templatedir'] = PHPWG_ROOT_PATH . 'template/'
     
    199200  if (count($errors) == 0) {
    200201    umask(0000);
    201     mkdir($themedir, 0777);
     202    @mkdir($themedir, 0705);
    202203    if (!is_dir(  $themedir ))
    203204        array_push($errors,
     
    211212      $plugin_tpl = new Template();
    212213      $plugin_tpl->set_filenames(array('themeconf'=>
    213       dirname(__FILE__) . '/themeconf.inc.tpl'));
     214      STC_PATH . 'themeconf.inc.tpl'));
    214215      $plugin_tpl->assign('main',$main);
    215216      $main['themeconf_inc_php'] = $plugin_tpl->parse('themeconf', true);
     
    220221       **/ 
    221222      $plugin_tpl->set_filenames(array('mailcss'=>
    222       dirname(__FILE__) . '/mail-css.tpl2'));
     223      STC_PATH . 'mail-css.tpl2'));
    223224      $plugin_tpl->assign('main',$main);
    224225      $main['mail-css.tpl'] = $plugin_tpl->parse('mailcss', true); 
     
    229230       **/ 
    230231      $plugin_tpl->set_filenames(array('theme'=>
    231       dirname(__FILE__) . '/theme.tpl'));
     232      STC_PATH . 'theme.tpl'));
    232233      $plugin_tpl->assign('main',$main);
    233234      $main['theme.css'] = $plugin_tpl->parse('theme', true); 
     
    239240      if (function_exists('imagecreatefrompng'))
    240241      {
    241         $img = imagecreatefrompng(dirname(__FILE__) . '/titrePage-bg.png');
     242        $img = imagecreatefrompng(STC_PATH . '/titrePage-bg.png');
    242243        $dest = imagecreate(1, 64);
    243244        for ($i=0; $i<256; $i++) {
     
    256257        imagedestroy ($dest);
    257258      }
    258       else @copy( dirname(__FILE__)
     259      else @copy( STC_PATH
    259260                 . '/titrePage-bg.png', $themedir . '/stc.png');     
    260261      if ($r == false) {
     
    274275    }
    275276  }
    276  
     277  // TODO       ********   HEADER   *********
    277278  // Interesting Graphic Charter
    278279  // http://accessites.org/site/2006/08/visual-vs-structural/
     
    284285// |                            reset values
    285286// +-----------------------------------------------------------------------+
    286 
     287if (isset($_POST['reset']) and (!is_adviser())) {
     288  $main = array();
     289  $swift_theme_creator->theme_config = $main;
     290  $swift_theme_creator->save_theme_config(); 
     291  redirect( get_admin_plugin_menu_link(dirname(__FILE__).'/theme_creator.php'));
     292}
    287293// To be implemented delete $main save and redirect
    288294
  • trunk/plugins/SwiftThemeCreator/theme_creator.tpl

    r2447 r2461  
    146146</fieldset>
    147147
    148 <p><input name="submit" class="submit" type="submit" value="{'Submit'|@translate}" /></p>
     148<p>
     149<input name="reset" class="submit" type="submit" value="{'Reset'|@translate}" /> &nbsp;
     150<input name="submit" class="submit" type="submit" value="{'Submit'|@translate}" />
     151</p>
    149152</form>
Note: See TracChangeset for help on using the changeset viewer.