20 include_once (
"Class.Style.php");
21 include_once (
"Lib.Color.php");
25 if (file_exists(GetParam(
"CORE_PUBDIR",
DEFAULT_PUBDIR) .
"/STYLE/{$name}/{$name}.sty")) {
27 include (
"STYLE/{$name}/{$name}.sty");
29 $sty_consth = $sty_const;
30 $sty_colorsh = $sty_colors;
31 $sty_localsh = $sty_local;
42 include (
"STYLE/{$name}/{$name}.sty");
44 if (isset($sty_inherit)) {
46 getStyleInherit($sty_inherit, $sty_colors_inherit, $sty_const_inherit, $sty_local_inherit);
48 if (isset($sty_const)) {
49 foreach ($sty_const_inherit as $k => $v) {
50 if (!isset($sty_const[$k])) $sty_const[$k] = $v;
53 $sty_const = $sty_const_inherit;
55 if (!isset($sty_colors)) $sty_colors = $sty_colors_inherit;
58 if (
sizeof($sty_desc) > 0) {
61 while (list($k, $v) = each($sty_desc)) {
64 if (!$sty->isAffected()) $sty->Add();
72 while (list($k, $v) = each(
$list)) {
79 $action->parent->SetVolatileParam($v[
"name"], $v[
"val"]);
82 if (isset($sty_colors)) {
85 if (isset($sty_const[
"COLOR_WHITE"])) {
86 $basehsl =
srgb2hsl($sty_const[
"COLOR_WHITE"]);
88 $dark = ($basehsl[2] < 0.5);
90 foreach ($sty_colors as $k => $v) {
92 if ($basecolor[0] ==
'#') {
93 $r = hexdec(substr($basecolor, 1, 2));
94 $g = hexdec(substr($basecolor, 3, 2));
95 $b = hexdec(substr($basecolor, 5, 2));
100 if (
$html) print
"<table><tr>";
101 if ($dark) $idx = - ($l / 10);
102 else $idx = (1 - $l) / 10;
104 for ($i = 0; $i < 10; $i++) {
107 $pcolor =
"COLOR_{$k}{$i}";
109 $action->parent->SetVolatileParam($pcolor, $rgb);
111 if (
$html) print
"<td style='background-color:$rgb'>$pcolor: $rgb</td>\n";
113 if (
$html) print
"</tr></table>";
118 if (isset($sty_const)) {
120 while (list($k, $v) = each($sty_const)) {
121 $vv =
$action->getParam($v, $v);
123 $action->parent->SetVolatileParam($k, $vv);
127 if (isset($sty_local_inherit)) {
128 foreach ($sty_local_inherit as $k => $v) {
133 if (isset($sty_local)) {
134 foreach ($sty_local as $k => $v) {
140 $inputlay =
new Layout(
"STYLE/$name/Layout/$name.css",
$action);
142 if ($inputlay->file ==
"") {
143 $inputlay =
new Layout(
"STYLE/$sty_inherit/Layout/$sty_inherit.css",
$action);
146 $inputlayh =
new Layout(
"STYLE/$sty_inherit/Layout/$sty_inherit.css",
$action);
148 if ($inputlayh->file !=
"") {
149 $inputlay->template = $inputlayh->template .
"\n" . $inputlay->template;
154 $out = $inputlay->gen();
156 if (!is_dir(
$action->GetParam(
"CORE_PUBDIR") .
"/STYLE/$name/Layout")) {
157 mkdir(
$action->GetParam(
"CORE_PUBDIR") .
"/STYLE/$name/Layout");
159 file_put_contents(
$action->GetParam(
"CORE_PUBDIR") .
"/STYLE/$name/Layout/gen.css",
$out);
162 $list = $query->Query();
163 if ($query->nb > 0) {
165 while (list($k, $v) = each(
$list)) {
166 if (substr($v->name, 0, 4) !=
"SIZE") $ndef.= $v->name .
"|";
168 $ndef = substr($ndef, 0, -1) .
")";
175 print sprintf(_(
"%s style updated\n") , $name);