From 7d8a09d7ceae7fbeaba4dbf5cfc20b0648ecf517 Mon Sep 17 00:00:00 2001 From: Arcturus Date: Sat, 5 Oct 2024 08:22:40 +0900 Subject: [PATCH] add admin colortheme addon and fix amber color picker, bump version to 2.2.13 --- .../addons/admcolor/admcolor.addon.php | 78 ++++++++++++ .../addons/admcolor/config.php | 117 ++++++++++++++++++ .../addons/sample/sample.addon.php | 11 +- .../adm/css/amberstone.cp.css | 2 +- AvocadoEdition_Light/adm/js/amberstone.cp.js | 10 +- .../classes/setting/setting.class.php | 2 +- AvocadoEdition_Light/config.php | 2 +- 7 files changed, 213 insertions(+), 9 deletions(-) create mode 100644 AvocadoEdition_Light/addons/admcolor/admcolor.addon.php create mode 100644 AvocadoEdition_Light/addons/admcolor/config.php diff --git a/AvocadoEdition_Light/addons/admcolor/admcolor.addon.php b/AvocadoEdition_Light/addons/admcolor/admcolor.addon.php new file mode 100644 index 0000000..9932655 --- /dev/null +++ b/AvocadoEdition_Light/addons/admcolor/admcolor.addon.php @@ -0,0 +1,78 @@ +getConfig(); + + $c1 = $config["color1"] ? $config["color1"] : "#FFF8F0"; + $c2 = $config["color2"] ? $config["color2"] : "#edd0b6"; + $c3 = $config["color3"] ? $config["color3"] : "#e3bb82"; + $c4 = $config["color4"] ? $config["color4"] : "#c7996b"; + $c5 = $config["color5"] ? $config["color5"] : "hsl(30, 72%, 55%)"; + $c6 = $config["color6"] ? $config["color6"] : "hsla(30, 72%, 55%, .2)"; + $c7 = $config["color7"] ? $config["color7"] : "hsl(45, 100%, 50%)"; + $c8 = $config["color8"] ? $config["color8"] : "#4a797b"; + $c9 = $config["color9"] ? $config["color9"] : "#A8DADC"; + + // add style to head + $html_process->merge_stylesheet("", 99); + } + }, 10); + } + + public function printConfigForm() + { + $config = $this->getConfig(); + include_once __DIR__ . "/config.php"; + } + + public function saveAction($data = []) + { + + } + + public function getConfig() + { + global $g5; + + $sql = "SELECT addon_config FROM {$g5['addons_config_table']} WHERE addon_name = '{$this->className}'"; + $result = sql_fetch($sql); + + if ($result && isset($result['addon_config'])) { + return json_decode($result['addon_config'], true) ?: []; + } + + return []; + } +} diff --git a/AvocadoEdition_Light/addons/admcolor/config.php b/AvocadoEdition_Light/addons/admcolor/config.php new file mode 100644 index 0000000..f612427 --- /dev/null +++ b/AvocadoEdition_Light/addons/admcolor/config.php @@ -0,0 +1,117 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
색상1 (배경색 전용) +
색상" + class="neo_color" size="30" maxlength="255" placeholder="#색상코드" /> + +
+
색상2 +
색상" + class="neo_color" size="30" maxlength="255" placeholder="#색상코드" /> + +
+
색상3 +
색상" + class="neo_color" size="30" maxlength="255" placeholder="#색상코드" /> + +
+
색상4 +
색상" + class="neo_color" size="30" maxlength="255" placeholder="#색상코드" /> + +
+
색상5 +
색상" + class="neo_color" size="30" maxlength="255" placeholder="#색상코드" /> + +
+
색상6 (좌측메뉴 배경) +
색상" + class="neo_color" size="30" maxlength="255" placeholder="#색상코드" /> + +
+
색상7 +
색상" + class="neo_color" size="30" maxlength="255" placeholder="#색상코드" /> + +
+
색상8 +
색상" + class="neo_color" size="30" maxlength="255" placeholder="#색상코드" /> + +
+
색상9 +
색상" + class="neo_color" size="30" maxlength="255" placeholder="#색상코드" /> + +
+
+
diff --git a/AvocadoEdition_Light/addons/sample/sample.addon.php b/AvocadoEdition_Light/addons/sample/sample.addon.php index 774848b..1e53741 100644 --- a/AvocadoEdition_Light/addons/sample/sample.addon.php +++ b/AvocadoEdition_Light/addons/sample/sample.addon.php @@ -77,7 +77,16 @@ class SampleAddon extends Addon public function saveAction($data = []) { - + // 이미지 업로드 등 입력 후처리가 필요한 경우에 사용합니다. + // $data 에는 입력값 ($_POST) 가 전달됩니다. + /* + if (!empty($data)) { + // ... 이미지 업로드 처리 예시 ... + $extension = emplode(".", $_FILES['input_name']['name']); + $extension = $extension[-1]; + // ... 이미지 업로드 처리 예시 ... + } + */ } public function getConfig() diff --git a/AvocadoEdition_Light/adm/css/amberstone.cp.css b/AvocadoEdition_Light/adm/css/amberstone.cp.css index f517c0f..1672649 100644 --- a/AvocadoEdition_Light/adm/css/amberstone.cp.css +++ b/AvocadoEdition_Light/adm/css/amberstone.cp.css @@ -179,7 +179,7 @@ display: grid; position: relative; border: 1px solid #E8E7E0; - grid-template-columns: repeat(5, 1fr); + grid-template-columns: repeat(5, 20px); grid-template-rows: repeat(9, 1fr); width: calc(21px * 5 - 1); gap: 1px; diff --git a/AvocadoEdition_Light/adm/js/amberstone.cp.js b/AvocadoEdition_Light/adm/js/amberstone.cp.js index b2e2d45..07d1bd5 100644 --- a/AvocadoEdition_Light/adm/js/amberstone.cp.js +++ b/AvocadoEdition_Light/adm/js/amberstone.cp.js @@ -364,7 +364,7 @@ class ColorPicker { let s = parseInt(match[2]) / 100; let v = parseInt(match[3]) / 100; let a = match[4] ? parseFloat(match[4]) : 1; - return hsvToRgb(h, s, v, a); + return this.hsvToRgb(h, s, v, a); } // HSL and HSLA @@ -374,7 +374,7 @@ class ColorPicker { let s = parseInt(match[2]) / 100; let l = parseInt(match[3]) / 100; let a = match[4] ? parseFloat(match[4]) : 1; - return hslToRgb(h, s, l, a); + return this.hslToRgb(h, s, l, a); } // HWB @@ -384,7 +384,7 @@ class ColorPicker { let w = parseInt(match[2]) / 100; let b = parseInt(match[3]) / 100; let a = match[4] ? parseFloat(match[4]) : 1; - return hwbToRgb(h, w, b, a); + return this.hwbToRgb(h, w, b, a); } // LAB @@ -394,7 +394,7 @@ class ColorPicker { let a = parseFloat(match[2]); let b = parseFloat(match[3]); let alpha = match[4] ? parseFloat(match[4]) : 1; - return labToRgb(l, a, b, alpha); + return this.labToRgb(l, a, b, alpha); } // LCH @@ -404,7 +404,7 @@ class ColorPicker { let c = parseFloat(match[2]); let h = parseFloat(match[3]); let alpha = match[4] ? parseFloat(match[4]) : 1; - return lchToRgb(l, c, h, alpha); + return this.lchToRgb(l, c, h, alpha); } // If no match found, return null diff --git a/AvocadoEdition_Light/classes/setting/setting.class.php b/AvocadoEdition_Light/classes/setting/setting.class.php index 3c888e7..0743dd3 100644 --- a/AvocadoEdition_Light/classes/setting/setting.class.php +++ b/AvocadoEdition_Light/classes/setting/setting.class.php @@ -360,7 +360,7 @@ class Setting } $this->settings[] = [ "type" => "color2", - "html" => "{$desc}
색상idx}]\" value=\"{$this->$key1}\" class=\"neo_color\" size=\"30\" maxlength=\"255\" placeholder=\"#색상코드\" />" + "html" => "{$desc}
색상idx}]\" value=\"{$this->$key1}\" class=\"neo_color\" size=\"30\" maxlength=\"255\" placeholder=\"#색상코드\" />
" ]; } // error diff --git a/AvocadoEdition_Light/config.php b/AvocadoEdition_Light/config.php index 7b82efa..493936f 100644 --- a/AvocadoEdition_Light/config.php +++ b/AvocadoEdition_Light/config.php @@ -7,7 +7,7 @@ ********************/ define('G5_VERSION', '아보카도 에디션 : Amber'); -define('G5_GNUBOARD_VER', '2.2.12'); +define('G5_GNUBOARD_VER', '2.2.13'); define('G5_AMBER', true); define('_GNUBOARD_', true);