diff --git a/AvocadoAmber/classes/setting/setting.class.php b/AvocadoAmber/classes/setting/setting.class.php
index 6638254..cadacb9 100644
--- a/AvocadoAmber/classes/setting/setting.class.php
+++ b/AvocadoAmber/classes/setting/setting.class.php
@@ -9,6 +9,7 @@
*/
class Setting
{
+ public static $etc_max = 20;
public static $fonts;
public $idx;
public $html;
@@ -106,6 +107,12 @@ class Setting
case "fontsize":
$this->addFontSizeSetting($set["desc"], array_key_exists("default", $set) ? (is_array($set["default"]) ? $set["default"] : "16") : []);
break;
+ case "number":
+ $this->addNumberSetting($set["desc"], array_key_exists("default", $set) ? $set["default"] : "0");
+ break;
+ case "background":
+ $this->addBackgroundSetting($set["desc"], array_key_exists("default", $set) ? (is_array($set["default"]) ? $set["default"] : []) : []);
+ break;
}
}
@@ -121,7 +128,7 @@ class Setting
$set->cs_value = $row['cs_value'];
$set->cs_name = $row['cs_name'];
$set->cs_descript = $row['cs_descript'];
- for ($i = 1; $i <= 20; $i++) {
+ for ($i = 1; $i <= self::$etc_max; $i++) {
$key = "cs_etc_{$i}";
$set->$key = $row[$key];
}
@@ -143,7 +150,7 @@ class Setting
$set->cs_value = $row['cs_value'];
$set->cs_name = $row['cs_name'];
$set->cs_descript = $row['cs_descript'];
- for ($i = 1; $i <= 20; $i++) {
+ for ($i = 1; $i <= self::$etc_max; $i++) {
$key = "cs_etc_{$i}";
$set->$key = $row[$key];
}
@@ -161,14 +168,14 @@ class Setting
$this->cs_name = $data['cs_name'];
$this->cs_value = $data['cs_value'];
$this->cs_descript = $data['cs_descript'];
- for ($i = 1; $i <= 20; $i++) {
+ for ($i = 1; $i <= self::$etc_max; $i++) {
$key = "cs_etc_{$i}";
$this->$key = $data[$key];
}
} else {
$this->cs_value = "";
$this->cs_descript = "";
- for ($i = 1; $i <= 20; $i++) {
+ for ($i = 1; $i <= self::$etc_max; $i++) {
$key = "cs_etc_{$i}";
$this->$key = "";
}
@@ -183,6 +190,9 @@ class Setting
$count += count(array_filter($this->settings, function ($setting) {
return $setting["type"] == "image";
})) ? 2 : 0;
+ $count += count(array_filter($this->settings, function ($setting) {
+ return $setting["type"] == "background";
+ })) ? 3 : 0;
return "
| {$this->idx}{$this->title}idx}]\" value=\"{$this->cs_name}\" readonly size=\"15\" /> | ";
}
@@ -265,7 +275,7 @@ class Setting
public function addFontSetting($desc, $default, $placeholder = "")
{
$idx = $this->getCurrentCount() + 1;
- if ($idx <= 20) {
+ if ($idx <= self::$etc_max) {
$key1 = "cs_etc_{$idx}";
$val = $this->$key1 ? $this->$key1 : (isset($default) ? $default : "");
@@ -279,7 +289,7 @@ class Setting
public function addFontSizeSetting($desc, $default)
{
$idx = $this->getCurrentCount() + 1;
- if ($idx <= 20) {
+ if ($idx <= self::$etc_max) {
$key1 = "cs_etc_{$idx}";
$val = $this->$key1 ? $this->$key1 : (isset($default) ? $default : 16);
@@ -290,10 +300,24 @@ class Setting
}
}
+ public function addNumberSetting($desc, $default)
+ {
+ $idx = $this->getCurrentCount() + 1;
+ if ($idx <= self::$etc_max) {
+ $key1 = "cs_etc_{$idx}";
+ $val = $this->$key1 ? $this->$key1 : (isset($default) ? $default : 0);
+
+ $this->settings[] = [
+ "type" => "number",
+ "html" => "{$desc} | idx}]\" value=\"{$val}\" style=\"width: 60px\" min=\"-5000\" max=\"5000\" /> |
"
+ ];
+ }
+ }
+
public function addRectSetting($desc, $default)
{
$idx = $this->getCurrentCount() + 1;
- if ($idx <= 20) {
+ if ($idx <= self::$etc_max) {
$key1 = "cs_etc_{$idx}";
$values = explode("||", $this->$key1);
@@ -329,7 +353,7 @@ class Setting
public function addRadiusSetting($desc, $default)
{
$idx = $this->getCurrentCount() + 1;
- if ($idx <= 20) {
+ if ($idx <= self::$etc_max) {
$key1 = "cs_etc_{$idx}";
$values = explode("||", $this->$key1);
@@ -365,7 +389,7 @@ class Setting
public function addMarginSetting($desc, $default)
{
$idx = $this->getCurrentCount() + 1;
- if ($idx <= 20) {
+ if ($idx <= self::$etc_max) {
$key1 = "cs_etc_{$idx}";
$values = explode("||", $this->$key1);
@@ -401,7 +425,7 @@ class Setting
public function addColorSetting($desc, $default)
{
$idx = $this->getCurrentCount() + 1;
- if ($idx <= 19) {
+ if ($idx <= self::$etc_max - 1) {
$idx2 = $idx + 1;
$key1 = "cs_etc_{$idx}";
$key2 = "cs_etc_{$idx2}";
@@ -422,7 +446,7 @@ class Setting
public function addColor2Setting($desc, $default)
{
$idx = $this->getCurrentCount() + 1;
- if ($idx <= 20) {
+ if ($idx <= self::$etc_max) {
$key1 = "cs_etc_{$idx}";
if (empty($default)) {
if ($this->$key1 === "")
@@ -454,10 +478,16 @@ class Setting
"outset" => "외부"
];
- if ($idx <= 19) {
+ if ($idx <= self::$etc_max - 1) {
$idx2 = $idx + 1;
$key1 = "cs_etc_{$idx}";
$key2 = "cs_etc_{$idx2}";
+ if (is_array($default) && isset($default[0]) && isset($default[1])) {
+ if (!isset($this->$key1))
+ $this->$key1 = array_key_exists($default[0], $options) ? $default[0] : "";
+ if (!isset($this->$key2))
+ $this->$key2 = intval($default[1]);
+ }
$options_html = "";
foreach ($options as $key => $val) {
$k = trim($key);
@@ -471,11 +501,137 @@ class Setting
}
}
+ public function addBackgroundSetting($desc, $default)
+ {
+ if ($this->is_value_added)
+ return;
+ $idx = $this->getCurrentCount();
+ if ($idx == 0) {
+ $imgval = $this->cs_value;
+ $img = $this->cs_value ? "
" : "이미지 미등록";
+ $color1 = $this->cs_etc_1;
+ $repeat = $this->cs_etc_2;
+ $align = $this->cs_etc_3;
+ $size = $this->cs_etc_4;
+ $position = $this->cs_etc_5 == "fixed" ? " selected" : "";
+
+ $repeats = ["", "", ""];
+ $aligns = ["", "", "", "", "", "", "", ""];
+ $sizes = ["", "", ""];
+
+ switch ($repeat) {
+ case "no-repeat":
+ $repeats[0] = " selected";
+ break;
+ case "repeat-x":
+ $repeats[1] = " selected";
+ break;
+ case "repeat-y":
+ $repeats[2] = " selected";
+ break;
+ }
+
+
+ switch ($align) {
+ case "left center":
+ $aligns[0] = " selected";
+ break;
+ case "left bottom":
+ $aligns[1] = " selected";
+ break;
+ case "center top":
+ $aligns[2] = " selected";
+ break;
+ case "center center":
+ $aligns[3] = " selected";
+ break;
+ case "center bottom":
+ $aligns[4] = " selected";
+ break;
+ case "right top":
+ $aligns[5] = " selected";
+ break;
+ case "right center":
+ $aligns[6] = " selected";
+ break;
+ case "right bottom":
+ $aligns[7] = " selected";
+ break;
+ }
+
+ switch ($size) {
+ case "contain":
+ $sizes[0] = " selected";
+ break;
+ case "cover":
+ $sizes[0] = " selected";
+ break;
+ case "100% 100%":
+ $sizes[0] = " selected";
+ break;
+ }
+
+ $this->settings[] = [
+ "type" => "background",
+ "html" => "
+
+ {$img}
+ |
+
+ 직접등록idx}]\" value=\"\" size=\"50\">
+ |
+ |
+ 외부경로idx}]\" value=\"{$imgval}\" size=\"50\"/>
+ |
+ |
+ 색상idx}]\" value=\"{$color1}\" class=\"neo_color\" size=\"30\" maxlength=\"255\" placeholder=\"#색상코드\" />
+ |
+ |
+ 배경반복
+
+ 배경위치
+
+
+
+
+ 배경크기
+
+ 고정
+
+ | "
+ ];
+ }
+ }
public function addSelectSetting($desc, $default, $values)
{
$idx = $this->getCurrentCount() + 1;
- if ($idx <= 19) {
+ if ($idx <= self::$etc_max - 1) {
$key1 = "cs_etc_{$idx}";
$options_html = "";
foreach ($values as $key => $val) {
@@ -509,11 +665,11 @@ class Setting
}
return $html;
}
-
+
public function get_editor_js($id, $is_dhtml_editor = true)
{
if ($is_dhtml_editor) {
- $js = "var {$id}_editor_data = oEditors.getById['{$id}'].getIR();\n";
+ $js = "var {$id}_editor_data = oEditors.getById['{$id}'].getIR();\n";
$js .= "oEditors.getById['{$id}'].exec('UPDATE_CONTENTS_FIELD', []);\n";
$js .= "if (jQuery.inArray(document.getElementById('{$id}').value.toLowerCase().replace(/^\s*|\s*$/g, ''), [' ','
','
','
','','
','']) != -1) {\n";
$js .= "document.getElementById('{$id}').value='';\n";
@@ -552,16 +708,16 @@ class Setting
if (!self::$fonts) {
$sql = "SELECT * FROM {$g5['font_table']} ORDER BY font_name ASC";
$result = sql_query($sql);
-
+
$addFontList = [];
-
+
while ($row = sql_fetch_array($result)) {
$font_name = addslashes($row['font_name']);
$font_family = addslashes($row['font_family']);
-
+
$addFontList[] = "['{$font_family}', '{$font_name}']";
}
-
+
if (count($addFontList) > 0) {
self::$fonts = implode(",", $addFontList);
}