update
This commit is contained in:
parent
e6e2394d10
commit
48adc55bdc
1 changed files with 108 additions and 4 deletions
|
|
@ -2,9 +2,9 @@
|
||||||
/**
|
/**
|
||||||
* THIS MODULE PROHIBITS DISTRIBUTION TO OTHERS WITHOUT AUTHOR'S PERMISSION.
|
* THIS MODULE PROHIBITS DISTRIBUTION TO OTHERS WITHOUT AUTHOR'S PERMISSION.
|
||||||
* @class Setting
|
* @class Setting
|
||||||
* @author arcturus (contact@sharlayan.net / https://info.drk.st/about)
|
* @author amberstone ( contact@drk.st / https://amberst.one )
|
||||||
* @brief gnuboard config extend class
|
* @brief gnuboard config extend class
|
||||||
* @version 1.1.1
|
* @version 1.1.2
|
||||||
* @license LGPL 2.1
|
* @license LGPL 2.1
|
||||||
*/
|
*/
|
||||||
class Setting
|
class Setting
|
||||||
|
|
@ -89,9 +89,15 @@ class Setting
|
||||||
case "color2":
|
case "color2":
|
||||||
$this->addColor2Setting($set["desc"], array_key_exists("default", $set) ? (is_array($set["default"]) ? $set["default"] : []) : []);
|
$this->addColor2Setting($set["desc"], array_key_exists("default", $set) ? (is_array($set["default"]) ? $set["default"] : []) : []);
|
||||||
break;
|
break;
|
||||||
|
case "color3":
|
||||||
|
$this->addBackForeLine($set["desc"], array_key_exists("default", $set) ? (is_array($set["default"]) ? $set["default"] : []) : []);
|
||||||
|
break;
|
||||||
case "border":
|
case "border":
|
||||||
$this->addBorderSetting($set["desc"], array_key_exists("default", $set) ? (is_array($set["default"]) ? $set["default"] : []) : []);
|
$this->addBorderSetting($set["desc"], array_key_exists("default", $set) ? (is_array($set["default"]) ? $set["default"] : []) : []);
|
||||||
break;
|
break;
|
||||||
|
case "border2":
|
||||||
|
$this->addBorder2Setting($set["desc"], array_key_exists("default", $set) ? (is_array($set["default"]) ? $set["default"] : []) : []);
|
||||||
|
break;
|
||||||
case "rect":
|
case "rect":
|
||||||
$this->addRectSetting($set["desc"], array_key_exists("default", $set) ? (is_array($set["default"]) ? $set["default"] : []) : []);
|
$this->addRectSetting($set["desc"], array_key_exists("default", $set) ? (is_array($set["default"]) ? $set["default"] : []) : []);
|
||||||
break;
|
break;
|
||||||
|
|
@ -193,6 +199,9 @@ class Setting
|
||||||
$count += count(array_filter($this->settings, function ($setting) {
|
$count += count(array_filter($this->settings, function ($setting) {
|
||||||
return $setting["type"] == "background";
|
return $setting["type"] == "background";
|
||||||
})) ? 3 : 0;
|
})) ? 3 : 0;
|
||||||
|
$count += count(array_filter($this->settings, function ($setting) {
|
||||||
|
return $setting["type"] == "color3";
|
||||||
|
})) ? 2 : 0;
|
||||||
return "<tr><th rowspan=\"{$count}\" scope=\"row\"><em>{$this->idx}</em>{$this->title}<input type=\"text\" name=\"cs_name[{$this->idx}]\" value=\"{$this->cs_name}\" readonly size=\"15\" /></th>";
|
return "<tr><th rowspan=\"{$count}\" scope=\"row\"><em>{$this->idx}</em>{$this->title}<input type=\"text\" name=\"cs_name[{$this->idx}]\" value=\"{$this->cs_name}\" readonly size=\"15\" /></th>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -210,6 +219,10 @@ class Setting
|
||||||
case "border":
|
case "border":
|
||||||
$count += 2;
|
$count += 2;
|
||||||
break;
|
break;
|
||||||
|
case "border2":
|
||||||
|
case "color3":
|
||||||
|
$count += 3;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$count++;
|
$count++;
|
||||||
break;
|
break;
|
||||||
|
|
@ -478,7 +491,7 @@ class Setting
|
||||||
"outset" => "외부"
|
"outset" => "외부"
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($idx <= self::$etc_max - 1) {
|
if ($idx <= self::$etc_max - 2) {
|
||||||
$idx2 = $idx + 1;
|
$idx2 = $idx + 1;
|
||||||
$key1 = "cs_etc_{$idx}";
|
$key1 = "cs_etc_{$idx}";
|
||||||
$key2 = "cs_etc_{$idx2}";
|
$key2 = "cs_etc_{$idx2}";
|
||||||
|
|
@ -501,6 +514,77 @@ class Setting
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function addBorder2Setting($desc, $default)
|
||||||
|
{
|
||||||
|
$idx = $this->getCurrentCount() + 1;
|
||||||
|
$options = [
|
||||||
|
" " => "사용 안 함",
|
||||||
|
"dotted" => "점선",
|
||||||
|
"dashed" => "대시",
|
||||||
|
"solid" => "직선",
|
||||||
|
"double" => "이중선",
|
||||||
|
"groove" => "내부 경사",
|
||||||
|
"ridge" => "외부 경사",
|
||||||
|
"inset" => "내부",
|
||||||
|
"outset" => "외부"
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($idx <= self::$etc_max - 3) {
|
||||||
|
$idx2 = $idx + 1;
|
||||||
|
$idx3 = $idx + 2;
|
||||||
|
|
||||||
|
$key1 = "cs_etc_{$idx}";
|
||||||
|
$key2 = "cs_etc_{$idx2}";
|
||||||
|
$key3 = "cs_etc_{$idx3}";
|
||||||
|
|
||||||
|
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]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_array($default) && isset($default[2])) {
|
||||||
|
if (!isset($this->$key3))
|
||||||
|
$this->$key3 = intval($default[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$values = explode("||", $this->$key3);
|
||||||
|
|
||||||
|
$options_html = "";
|
||||||
|
|
||||||
|
foreach ($options as $key => $val) {
|
||||||
|
$k = trim($key);
|
||||||
|
$s = $this->$key1 == $k ? " selected" : "";
|
||||||
|
$options_html .= "<option value=\"{$k}\"{$s}>{$val}</option>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$checked_top = in_array("top", $values) ? " checked" : "";
|
||||||
|
$checked_bottom = in_array("bottom", $values) ? " checked" : "";
|
||||||
|
$checked_left = in_array("left", $values) ? " checked" : "";
|
||||||
|
$checked_right = in_array("right", $values) ? " checked" : "";
|
||||||
|
|
||||||
|
$this->settings[] = [
|
||||||
|
"type" => "border",
|
||||||
|
"html" => "<td class=\"bo-right\">{$desc}</td>
|
||||||
|
<td>
|
||||||
|
<div class=\"setter\">
|
||||||
|
<select name=\"cs_etc_{$idx}[{$this->idx}]\">{$options_html}</select>
|
||||||
|
두께<input type=\"number\" name=\"cs_etc_{$idx2}[{$this->idx}]\" value=\"{$this->$key2}\" placeholder=\"0\" title=\"두께\" style=\"width:45px;\"/>
|
||||||
|
</div>
|
||||||
|
<div class=\"setter\" style=\"margin-top: 8px\">
|
||||||
|
상<input type=\"checkbox\" name=\"cs_etc_{$idx3}[{$this->idx}][]\" id=\"cs_etc_{$idx3}_1_{$this->cs_name}\" style=\"max-width: 24px\" value=\"top\" {$checked_top}/>
|
||||||
|
하<input type=\"checkbox\" name=\"cs_etc_{$idx3}[{$this->idx}][]\" id=\"cs_etc_{$idx3}_2_{$this->cs_name}\" style=\"max-width: 24px\" value=\"bottom\" {$checked_bottom}/>
|
||||||
|
좌<input type=\"checkbox\" name=\"cs_etc_{$idx3}[{$this->idx}][]\" id=\"cs_etc_{$idx3}_3_{$this->cs_name}\" style=\"max-width: 24px\" value=\"left\" {$checked_left}/>
|
||||||
|
우<input type=\"checkbox\" name=\"cs_etc_{$idx3}[{$this->idx}][]\" id=\"cs_etc_{$idx3}_4_{$this->cs_name}\" style=\"max-width: 24px\" value=\"right\" {$checked_right}/>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function addBackgroundSetting($desc, $default)
|
public function addBackgroundSetting($desc, $default)
|
||||||
{
|
{
|
||||||
if ($this->is_value_added)
|
if ($this->is_value_added)
|
||||||
|
|
@ -531,7 +615,6 @@ class Setting
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch ($align) {
|
switch ($align) {
|
||||||
case "left center":
|
case "left center":
|
||||||
$aligns[0] = " selected";
|
$aligns[0] = " selected";
|
||||||
|
|
@ -628,6 +711,27 @@ class Setting
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function addBackForeLine($desc, $default)
|
||||||
|
{
|
||||||
|
$idx = $this->getCurrentCount() + 1;
|
||||||
|
if ($idx <= self::$etc_max - 3) {
|
||||||
|
$key1 = "cs_etc_{$idx}";
|
||||||
|
|
||||||
|
$idx2 = $idx + 1;
|
||||||
|
$key2 = "cs_etc_{$idx2}";
|
||||||
|
|
||||||
|
$idx3 = $idx + 2;
|
||||||
|
$key3 = "cs_etc_{$idx3}";
|
||||||
|
|
||||||
|
$this->settings[] = [
|
||||||
|
"type" => "color3",
|
||||||
|
"html" => "<td class=\"bo-right\">배경</td><td><div class=\"setter\">색상 <input type=\"text\" name=\"cs_etc_{$idx}[{$this->idx}]\" value=\"{$this->$key1}\" class=\"neo_color\" size=\"30\" maxlength=\"255\" placeholder=\"#색상코드\" /></div></td></tr>" .
|
||||||
|
"<tr><td class=\"bo-right\">폰트</td><td><div class=\"setter\">색상 <input type=\"text\" name=\"cs_etc_{$idx2}[{$this->idx}]\" value=\"{$this->$key2}\" class=\"neo_color\" size=\"30\" maxlength=\"255\" placeholder=\"#색상코드\" /></div></td></tr>" .
|
||||||
|
"<tr><td class=\"bo-right\">라인</td><td><div class=\"setter\">색상 <input type=\"text\" name=\"cs_etc_{$idx3}[{$this->idx}]\" value=\"{$this->$key3}\" class=\"neo_color\" size=\"20\" maxlength=\"255\" placeholder=\"#색상코드\" /></div></td></tr>"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function addSelectSetting($desc, $default, $values)
|
public function addSelectSetting($desc, $default, $values)
|
||||||
{
|
{
|
||||||
$idx = $this->getCurrentCount() + 1;
|
$idx = $this->getCurrentCount() + 1;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue