aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorvdigital <vdigital@piwigo.org>2008-07-24 21:56:35 +0000
committervdigital <vdigital@piwigo.org>2008-07-24 21:56:35 +0000
commitc8c61b7f3af2cf48ee72b3b3fe9fca1376a5cf13 (patch)
tree9214fda60c9bc57568e058048b0b40e0ae59ac39 /plugins
parent35c2aeca68298ec24a4e7cdb0912b7c6573f7766 (diff)
Swift Theme Creator (minor changes): Still incomplete but first operational version (6).
Just a bug squashed draft version. Enjoy it. git-svn-id: http://piwigo.org/svn/trunk@2461 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'plugins')
-rw-r--r--plugins/SwiftThemeCreator/theme.tpl12
-rw-r--r--plugins/SwiftThemeCreator/theme_creator.php66
-rw-r--r--plugins/SwiftThemeCreator/theme_creator.tpl5
3 files changed, 46 insertions, 37 deletions
diff --git a/plugins/SwiftThemeCreator/theme.tpl b/plugins/SwiftThemeCreator/theme.tpl
index 05f8a8a03..b56d2e217 100644
--- a/plugins/SwiftThemeCreator/theme.tpl
+++ b/plugins/SwiftThemeCreator/theme.tpl
@@ -4,30 +4,30 @@ BODY, H3, #imageHeaderBar, #imageToolBar A:hover,
BODY, H1, H3, DT,
INPUT.rateButtonSelected /* <= why IE doesn't inherit this ? */ {ldelim}
color:{$main.color2}; }
-#theImage IMG {ldelim} border-color: {$main.color2}; }
+#theImage IMG {ldelim} border: 3px ridge {$main.color2}; }
H2, #menubar DT, .throw,
A, INPUT.rateButton {ldelim} color: {$main.color3}; }
-UL.tabsheet LI.normal_tab:hover {ldelim} border-color: {$main.color4}; }
+UL.tabsheet LI.normal_tab:hover {ldelim} border: 1px solid {$main.color4}; }
A:hover {ldelim} color: {$main.color4}; }
.content UL.thumbnails SPAN.wrap2:hover,
.content UL.thumbnailCategories DIV.thumbnailCategory:hover,
.content UL.thumbnailCategories DIV.thumbnailCategory:hover A {ldelim}
- color: {$main.color4}; border-color: {$main.color5}; background-color: {$main.color6}; }
+ color: {$main.color4}; border: 1px solid {$main.color5}; background-color: {$main.color6}; }
#menubar DL, .content, #comments DIV.comment BLOCKQUOTE,
-#imageHeaderBar, H2, #menubar DT, #imageToolBar {ldelim} border-color: {$main.color5}; }
+#imageHeaderBar, H2, #menubar DT, #imageToolBar {ldelim} border: 1px solid {$main.color5}; }
#menubar DL, .content, #imageToolBar, .header_notes, UL.tabsheet LI.selected_tab {ldelim}
background-color: {$main.color6}; }
FIELDSET, INPUT, SELECT, TEXTAREA, .content DIV.comment A.illustration IMG,
.content DIV.thumbnailCategory, .content UL.thumbnails SPAN.wrap2 {ldelim}
- border-color: {$main.color6}; }
+ border: 1px solid {$main.color6}; }
-#comments DIV.comment BLOCKQUOTE {ldelim} border-color: {$main.color7}; }
+#comments DIV.comment BLOCKQUOTE {ldelim} border-left: 1px solid {$main.color7}; }
H2, #menubar DT, .throw {ldelim} background-image: url(stc.png); }
#imageHeaderBar H2 {ldelim} background-image: none; background-color: transparent; border: none; }
diff --git a/plugins/SwiftThemeCreator/theme_creator.php b/plugins/SwiftThemeCreator/theme_creator.php
index 7bac595ef..7e9d6f006 100644
--- a/plugins/SwiftThemeCreator/theme_creator.php
+++ b/plugins/SwiftThemeCreator/theme_creator.php
@@ -24,7 +24,7 @@
/* Ajouter le lien au menu de l'admin */
if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
if (!defined('IN_ADMIN') or !IN_ADMIN) die('Hacking attempt!');
-
+define(STC_PATH, PHPWG_PLUGINS_PATH.'SwiftThemeCreator/');
/*
* stc_hex2rgb convert any string to array of RGB values
*/
@@ -68,11 +68,10 @@ function darken( $r, $g, $b, $percent)
*/
function stc_newfile( $filename, $data )
{
- $fp = fopen($filename, 'w');
- if ($fp)
- {
+ $fp = @fopen($filename, 'w');
+ if ($fp) {
$ret = fwrite($fp, $data);
- fclose($fp);
+ @fclose($fp);
return $ret;
}
return false;
@@ -136,24 +135,26 @@ if (isset($_POST['submit']) and (!is_adviser()))
. 'text and background. dif=') . $dif);
// 2.2 - Background and Internal links control
- list($r1,$g1,$b1) = stc_hex2rgb($main['color'][0]);
- list($r2,$g2,$b2) = stc_hex2rgb($main['color'][2]);
- // Background and Internal links "brightness" difference control:
- $dif = abs( ( (($r1*299)+($g1*587)+($b1*114)) / 1000 )
- - ( (($r2*299)+($g2*587)+($b2*114)) / 1000 ));
- if ( $dif < 65 )
+ if (isset($do_it))
+ {
+ list($r1,$g1,$b1) = stc_hex2rgb($main['color'][0]);
+ list($r2,$g2,$b2) = stc_hex2rgb($main['color'][2]);
+ // Background and Internal links "brightness" difference control:
+ $dif = abs( ( (($r1*299)+($g1*587)+($b1*114)) / 1000 )
+ - ( (($r2*299)+($g2*587)+($b2*114)) / 1000 ));
+ if ( $dif < 65 )
+ array_push($errors,
+ l10n('Insufficient brightness difference between '
+ . 'Internal links and background. dif=') . $dif);
+ // Background and Internal links "colour" difference control:
+ $dif = (max($r1, $r2) - min($r1, $r2))
+ + (max($g1, $g2) - min($g1, $g2))
+ + (max($b1, $b2) - min($b1, $b2));
+ if ( $dif < 200 )
array_push($errors,
- l10n('Insufficient brightness difference between '
- . 'Internal links and background. dif=') . $dif);
- // Background and Internal links "colour" difference control:
- $dif = (max($r1, $r2) - min($r1, $r2))
- + (max($g1, $g2) - min($g1, $g2))
- + (max($b1, $b2) - min($b1, $b2));
- if ( $dif < 200 )
- array_push($errors,
- l10n('Insufficient colour difference between '
- . 'Internal links and background. dif=') . $dif);
-
+ l10n('Insufficient colour difference between '
+ . 'Internal links and background. dif=') . $dif);
+ }
// 3 - Directory control
$main['templatedir'] = PHPWG_ROOT_PATH . 'template/'
. $available_templates[$_POST['template']];
@@ -198,7 +199,7 @@ if (isset($_POST['submit']) and (!is_adviser()))
// Go ahead
if (count($errors) == 0) {
umask(0000);
- mkdir($themedir, 0777);
+ @mkdir($themedir, 0705);
if (!is_dir( $themedir ))
array_push($errors,
l10n('Theme directory creation failure: '
@@ -210,7 +211,7 @@ if (isset($_POST['submit']) and (!is_adviser()))
**/
$plugin_tpl = new Template();
$plugin_tpl->set_filenames(array('themeconf'=>
- dirname(__FILE__) . '/themeconf.inc.tpl'));
+ STC_PATH . 'themeconf.inc.tpl'));
$plugin_tpl->assign('main',$main);
$main['themeconf_inc_php'] = $plugin_tpl->parse('themeconf', true);
$r = stc_newfile( $themedir . '/themeconf.inc.php',
@@ -219,7 +220,7 @@ if (isset($_POST['submit']) and (!is_adviser()))
* Build mail-css.tpl
**/
$plugin_tpl->set_filenames(array('mailcss'=>
- dirname(__FILE__) . '/mail-css.tpl2'));
+ STC_PATH . 'mail-css.tpl2'));
$plugin_tpl->assign('main',$main);
$main['mail-css.tpl'] = $plugin_tpl->parse('mailcss', true);
$r = $r && stc_newfile( $themedir . '/mail-css.tpl',
@@ -228,7 +229,7 @@ if (isset($_POST['submit']) and (!is_adviser()))
* Build theme.css
**/
$plugin_tpl->set_filenames(array('theme'=>
- dirname(__FILE__) . '/theme.tpl'));
+ STC_PATH . 'theme.tpl'));
$plugin_tpl->assign('main',$main);
$main['theme.css'] = $plugin_tpl->parse('theme', true);
$r = $r && stc_newfile( $themedir . '/theme.css',
@@ -238,7 +239,7 @@ if (isset($_POST['submit']) and (!is_adviser()))
**/
if (function_exists('imagecreatefrompng'))
{
- $img = imagecreatefrompng(dirname(__FILE__) . '/titrePage-bg.png');
+ $img = imagecreatefrompng(STC_PATH . '/titrePage-bg.png');
$dest = imagecreate(1, 64);
for ($i=0; $i<256; $i++) {
imagecolorallocate($dest, $i, $i, $i);
@@ -255,7 +256,7 @@ if (isset($_POST['submit']) and (!is_adviser()))
imagedestroy ($img);
imagedestroy ($dest);
}
- else @copy( dirname(__FILE__)
+ else @copy( STC_PATH
. '/titrePage-bg.png', $themedir . '/stc.png');
if ($r == false) {
array_push($errors,
@@ -273,7 +274,7 @@ if (isset($_POST['submit']) and (!is_adviser()))
}
}
}
-
+ // TODO ******** HEADER *********
// Interesting Graphic Charter
// http://accessites.org/site/2006/08/visual-vs-structural/
@@ -283,7 +284,12 @@ if (isset($_POST['submit']) and (!is_adviser()))
// +-----------------------------------------------------------------------+
// | reset values
// +-----------------------------------------------------------------------+
-
+if (isset($_POST['reset']) and (!is_adviser())) {
+ $main = array();
+ $swift_theme_creator->theme_config = $main;
+ $swift_theme_creator->save_theme_config();
+ redirect( get_admin_plugin_menu_link(dirname(__FILE__).'/theme_creator.php'));
+}
// To be implemented delete $main save and redirect
// Don't forget to re-read because some statements are superfluous
diff --git a/plugins/SwiftThemeCreator/theme_creator.tpl b/plugins/SwiftThemeCreator/theme_creator.tpl
index c859651c7..bc8604e85 100644
--- a/plugins/SwiftThemeCreator/theme_creator.tpl
+++ b/plugins/SwiftThemeCreator/theme_creator.tpl
@@ -145,5 +145,8 @@ You can update later the result as you need.'|@translate}
</table>
</fieldset>
-<p><input name="submit" class="submit" type="submit" value="{'Submit'|@translate}" /></p>
+<p>
+<input name="reset" class="submit" type="submit" value="{'Reset'|@translate}" /> &nbsp;
+<input name="submit" class="submit" type="submit" value="{'Submit'|@translate}" />
+</p>
</form> \ No newline at end of file