Jocy 2017-05-12 11:04:26 +02:00
parent 023581c195
commit 2a70e840e2
8 changed files with 26 additions and 16 deletions

View File

@ -15,7 +15,7 @@ namespace ManiaControl\Manialinks;
interface SidebarMenuEntryRenderable { interface SidebarMenuEntryRenderable {
/** /**
* Call here the function which updates the MenuIcon Manialink * Call here the function which updates the MenuIcon ManiaLink
*/ */
public function renderMenuEntry(); public function renderMenuEntry();
} }

View File

@ -13,7 +13,6 @@ use FML\Types\ScriptFeatureable;
/** /**
* CheckBox Component * CheckBox Component
* *
* @uses Quad
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
@ -74,6 +73,8 @@ class CheckBox implements Renderable, ScriptFeatureable
public function setName($name) public function setName($name)
{ {
$this->name = (string)$name; $this->name = (string)$name;
$this->getEntry()
->setName($this->name);
return $this; return $this;
} }
@ -221,6 +222,7 @@ class CheckBox implements Renderable, ScriptFeatureable
* *
* @param Entry $entry Hidden Entry * @param Entry $entry Hidden Entry
* @return static * @return static
* @deprecated
*/ */
public function setEntry(Entry $entry) public function setEntry(Entry $entry)
{ {
@ -236,9 +238,11 @@ class CheckBox implements Renderable, ScriptFeatureable
protected function createEntry() protected function createEntry()
{ {
$entry = new Entry(); $entry = new Entry();
$entry->setVisible(false) $entry->setVisible(false);
->setName($this->name); if ($this->name) {
$this->setEntry($entry); $entry->setName($this->name);
}
$this->feature->setEntry($entry);
return $entry; return $entry;
} }
@ -247,7 +251,7 @@ class CheckBox implements Renderable, ScriptFeatureable
*/ */
public function getScriptFeatures() public function getScriptFeatures()
{ {
return ScriptFeature::collect($this->feature, $this->getQuad(), $this->feature->getEntry()); return ScriptFeature::collect($this->feature, $this->getQuad(), $this->getEntry());
} }
/** /**

View File

@ -13,7 +13,6 @@ use FML\Types\ScriptFeatureable;
/** /**
* ValuePicker Component * ValuePicker Component
* *
* @uses Entry
* @author steeffeen <mail@steeffeen.com> * @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3

View File

@ -65,7 +65,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, MultiL
/** /**
* @var int $actionKey Action key * @var int $actionKey Action key
*/ */
protected $actionKey = -1; protected $actionKey = null;
/** /**
* @var string $url Url * @var string $url Url
@ -651,7 +651,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, MultiL
if ($this->action) { if ($this->action) {
$domElement->setAttribute("action", $this->action); $domElement->setAttribute("action", $this->action);
} }
if ($this->actionKey >= 0) { if ($this->actionKey) {
$domElement->setAttribute("actionkey", $this->actionKey); $domElement->setAttribute("actionkey", $this->actionKey);
} }
if ($this->url) { if ($this->url) {

View File

@ -98,7 +98,7 @@ class Quad extends Control implements Actionable, BackgroundColorable, BgColorab
/** /**
* @var int $actionKey Action key * @var int $actionKey Action key
*/ */
protected $actionKey = -1; protected $actionKey = null;
/** /**
* @var string $url Link url * @var string $url Link url
@ -676,6 +676,8 @@ class Quad extends Control implements Actionable, BackgroundColorable, BgColorab
* @api * @api
* @param CheckBoxDesign $checkBoxDesign CheckBox Design * @param CheckBoxDesign $checkBoxDesign CheckBox Design
* @return static * @return static
* @deprecated Use CheckBoxDesign::applyToQuad()
* @see CheckBoxDesign::applyToQuad()
*/ */
public function applyCheckBoxDesign(CheckBoxDesign $checkBoxDesign) public function applyCheckBoxDesign(CheckBoxDesign $checkBoxDesign)
{ {

View File

@ -146,7 +146,7 @@ abstract class Builder
* @param bool $associative (optional) Whether the array should be associative * @param bool $associative (optional) Whether the array should be associative
* @return string * @return string
*/ */
public static function getArray(array $array, $associative = false) public static function getArray(array $array, $associative = true)
{ {
$arrayText = "["; $arrayText = "[";
$index = 0; $index = 0;
@ -180,6 +180,9 @@ abstract class Builder
if (is_bool($value)) { if (is_bool($value)) {
return static::getBoolean($value); return static::getBoolean($value);
} }
if (is_array($value)) {
return static::getArray($value);
}
return $value; return $value;
} }

View File

@ -265,14 +265,14 @@ class Script
*/ */
protected function getHeaderComment() protected function getHeaderComment()
{ {
$headerComment = '/**************************************************** $headerComment = '/**************************************************
* FancyManiaLinks'; * FancyManiaLinks';
if (defined('FML_VERSION')) { if (defined('FML_VERSION')) {
$headerComment .= ' v' . FML_VERSION; $headerComment .= ' v' . FML_VERSION;
} }
$headerComment .= ' by steeffeen * $headerComment .= ' by steeffeen *
* http://github.com/steeffeen/FancyManiaLinks * * http://github.com/steeffeen/FancyManiaLinks *
****************************************************/ **************************************************/
'; ';
return $headerComment; return $headerComment;
@ -349,6 +349,7 @@ main() {
} }
case CMlEvent::Type::MouseClick: { case CMlEvent::Type::MouseClick: {
+++' . ScriptLabel::MOUSECLICK . '+++ +++' . ScriptLabel::MOUSECLICK . '+++
+++' . ScriptLabel::MOUSECLICK2 . '+++
} }
case CMlEvent::Type::MouseOut: { case CMlEvent::Type::MouseOut: {
+++' . ScriptLabel::MOUSEOUT . '+++ +++' . ScriptLabel::MOUSEOUT . '+++

View File

@ -21,6 +21,7 @@ class ScriptLabel
const ENTRYSUBMIT = 'FML_EntrySubmit'; const ENTRYSUBMIT = 'FML_EntrySubmit';
const KEYPRESS = 'FML_KeyPress'; const KEYPRESS = 'FML_KeyPress';
const MOUSECLICK = 'FML_MouseClick'; const MOUSECLICK = 'FML_MouseClick';
const MOUSECLICK2 = 'FML_MouseClick2';
const MOUSEOUT = 'FML_MouseOut'; const MOUSEOUT = 'FML_MouseOut';
const MOUSEOVER = 'FML_MouseOver'; const MOUSEOVER = 'FML_MouseOver';