FML Update
This commit is contained in:
		| @@ -14,6 +14,91 @@ class Quad_Icons64x64_1 extends Quad { | |||||||
| 	 * Constants | 	 * Constants | ||||||
| 	 */ | 	 */ | ||||||
| 	const STYLE = 'Icons64x64_1'; | 	const STYLE = 'Icons64x64_1'; | ||||||
|  | 	const SUBSTYLE_3DStereo = '3DStereo'; | ||||||
|  | 	const SUBSTYLE_Add = 'Add'; | ||||||
|  | 	const SUBSTYLE_ArrowBlue = 'ArrowBlue'; | ||||||
|  | 	const SUBSTYLE_ArrowDisabled = 'ArrowDisabled'; | ||||||
|  | 	const SUBSTYLE_ArrowDown = 'ArrowDown'; | ||||||
|  | 	const SUBSTYLE_ArrowFastNext = 'ArrowFastNext'; | ||||||
|  | 	const SUBSTYLE_ArrowFastPrev = 'ArrowFastPrev'; | ||||||
|  | 	const SUBSTYLE_ArrowFirst = 'ArrowFirst'; | ||||||
|  | 	const SUBSTYLE_ArrowGreen = 'ArrowGreen'; | ||||||
|  | 	const SUBSTYLE_ArrowLast = 'ArrowLast'; | ||||||
|  | 	const SUBSTYLE_ArrowNext = 'ArrowNext'; | ||||||
|  | 	const SUBSTYLE_ArrowPrev = 'ArrowPrev'; | ||||||
|  | 	const SUBSTYLE_ArrowRed = 'ArrowRed'; | ||||||
|  | 	const SUBSTYLE_ArrowUp = 'ArrowUp'; | ||||||
|  | 	const SUBSTYLE_Browser = 'Browser'; | ||||||
|  | 	const SUBSTYLE_Buddy = 'Buddy'; | ||||||
|  | 	const SUBSTYLE_ButtonLeagues = 'ButtonLeagues'; | ||||||
|  | 	const SUBSTYLE_Camera = 'Camera'; | ||||||
|  | 	const SUBSTYLE_CameraLocal = 'CameraLocal'; | ||||||
|  | 	const SUBSTYLE_Check = 'Check'; | ||||||
|  | 	const SUBSTYLE_ClipPause = 'ClipPause'; | ||||||
|  | 	const SUBSTYLE_ClipPlay = 'ClipPlay'; | ||||||
|  | 	const SUBSTYLE_ClipRewind = 'ClipRewind'; | ||||||
|  | 	const SUBSTYLE_Close = 'Close'; | ||||||
|  | 	const SUBSTYLE_Empty = 'Empty'; | ||||||
|  | 	const SUBSTYLE_Finish = 'Finish'; | ||||||
|  | 	const SUBSTYLE_FinishGrey = 'FinishGrey'; | ||||||
|  | 	const SUBSTYLE_First = 'First'; | ||||||
|  | 	const SUBSTYLE_GenericButton = 'GenericButton'; | ||||||
|  | 	const SUBSTYLE_Green = 'Green'; | ||||||
|  | 	const SUBSTYLE_IconLeaguesLadder = 'IconLeaguesLadder'; | ||||||
|  | 	const SUBSTYLE_IconPlayers = 'IconPlayers'; | ||||||
|  | 	const SUBSTYLE_IconPlayersLadder = 'IconPlayersLadder'; | ||||||
|  | 	const SUBSTYLE_IconServers = 'IconServers'; | ||||||
|  | 	const SUBSTYLE_Inbox = 'Inbox'; | ||||||
|  | 	const SUBSTYLE_LvlGreen = 'LvlGreen'; | ||||||
|  | 	const SUBSTYLE_LvlRed = 'LvlRed'; | ||||||
|  | 	const SUBSTYLE_LvlYellow = 'LvlYellow'; | ||||||
|  | 	const SUBSTYLE_ManiaLinkNext = 'ManiaLinkNext'; | ||||||
|  | 	const SUBSTYLE_ManiaLinkPrev = 'ManiaLinkPrev'; | ||||||
|  | 	const SUBSTYLE_Maximize = 'Maximize'; | ||||||
|  | 	const SUBSTYLE_MediaAudioDownloading = 'MediaAudioDownloading'; | ||||||
|  | 	const SUBSTYLE_MediaPlay = 'MediaPlay'; | ||||||
|  | 	const SUBSTYLE_MediaStop = 'MediaStop'; | ||||||
|  | 	const SUBSTYLE_MediaVideoDownloading = 'MediaVideoDownloading'; | ||||||
|  | 	const SUBSTYLE_NewMessage = 'NewMessage'; | ||||||
|  | 	const SUBSTYLE_NotBuddy = 'NotBuddy'; | ||||||
|  | 	const SUBSTYLE_OfficialRace = 'OfficialRace'; | ||||||
|  | 	const SUBSTYLE_Opponents = 'Opponents'; | ||||||
|  | 	const SUBSTYLE_Outbox = 'Outbox'; | ||||||
|  | 	const SUBSTYLE_QuitRace = 'QuitRace'; | ||||||
|  | 	const SUBSTYLE_RedHigh = 'RedHigh'; | ||||||
|  | 	const SUBSTYLE_RedLow = 'RedLow'; | ||||||
|  | 	const SUBSTYLE_Refresh = 'Refresh'; | ||||||
|  | 	const SUBSTYLE_RestartRace = 'RestartRace'; | ||||||
|  | 	const SUBSTYLE_Save = 'Save'; | ||||||
|  | 	const SUBSTYLE_Second = 'Second'; | ||||||
|  | 	const SUBSTYLE_ShowDown = 'ShowDown'; | ||||||
|  | 	const SUBSTYLE_ShowDown2 = 'ShowDown2'; | ||||||
|  | 	const SUBSTYLE_ShowLeft = 'ShowLeft'; | ||||||
|  | 	const SUBSTYLE_ShowLeft2 = 'ShowLeft2'; | ||||||
|  | 	const SUBSTYLE_ShowRight = 'ShowRight'; | ||||||
|  | 	const SUBSTYLE_ShowRight2 = 'ShowRight2'; | ||||||
|  | 	const SUBSTYLE_ShowUp = 'ShowUp'; | ||||||
|  | 	const SUBSTYLE_ShowUp2 = 'ShowUp2'; | ||||||
|  | 	const SUBSTYLE_SliderCursor = 'SliderCursor'; | ||||||
|  | 	const SUBSTYLE_SliderCursor2 = 'SliderCursor2'; | ||||||
|  | 	const SUBSTYLE_StateFavourite = 'StateFavourite'; | ||||||
|  | 	const SUBSTYLE_StatePrivate = 'StatePrivate'; | ||||||
|  | 	const SUBSTYLE_StateSuggested = 'StateSuggested'; | ||||||
|  | 	const SUBSTYLE_Sub = 'Sub'; | ||||||
|  | 	const SUBSTYLE_TagTypeBronze = 'TagTypeBronze'; | ||||||
|  | 	const SUBSTYLE_TagTypeGold = 'TagTypeGold'; | ||||||
|  | 	const SUBSTYLE_TagTypeNadeo = 'TagTypeNadeo'; | ||||||
|  | 	const SUBSTYLE_TagTypeNone = 'TagTypeNone'; | ||||||
|  | 	const SUBSTYLE_TagTypeSilver = 'TagTypeSilver'; | ||||||
|  | 	const SUBSTYLE_Third = 'Third'; | ||||||
|  | 	const SUBSTYLE_ToolLeague1 = 'ToolLeague1'; | ||||||
|  | 	const SUBSTYLE_ToolRoot = 'ToolRoot'; | ||||||
|  | 	const SUBSTYLE_ToolTree = 'ToolTree'; | ||||||
|  | 	const SUBSTYLE_ToolUp = 'ToolUp'; | ||||||
|  | 	const SUBSTYLE_TrackInfo = 'TrackInfo'; | ||||||
|  | 	const SUBSTYLE_TV = 'TV'; | ||||||
|  | 	const SUBSTYLE_YellowHigh = 'YellowHigh'; | ||||||
|  | 	const SUBSTYLE_YellowLow = 'YellowLow'; | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Construct Icons64x64_1 quad | 	 * Construct Icons64x64_1 quad | ||||||
| @@ -21,16 +106,6 @@ class Quad_Icons64x64_1 extends Quad { | |||||||
| 	public function __construct() { | 	public function __construct() { | ||||||
| 		parent::__construct(); | 		parent::__construct(); | ||||||
| 		$this->setStyle(self::STYLE); | 		$this->setStyle(self::STYLE); | ||||||
| 		array("3DStereo", "Add", "ArrowBlue", "ArrowDisabled", "ArrowDown", "ArrowFastNext", "ArrowFastPrev", "ArrowFirst",  |  | ||||||
| 			"ArrowGreen", "ArrowLast", "ArrowNext", "ArrowPrev", "ArrowRed", "ArrowUp", "Browser", "Buddy", "ButtonLeagues", "Camera",  |  | ||||||
| 			"CameraLocal", "Check", "ClipPause", "ClipPlay", "ClipRewind", "Close", "Empty", "Finish", "FinishGrey", "First",  |  | ||||||
| 			"GenericButton", "Green", "IconLeaguesLadder", "IconPlayers", "IconPlayersLadder", "IconServers", "Inbox", "LvlGreen",  |  | ||||||
| 			"LvlRed", "LvlYellow", "ManiaLinkNext", "ManiaLinkPrev", "Maximize", "MediaAudioDownloading", "MediaPlay", "MediaStop",  |  | ||||||
| 			"MediaVideoDownloading", "NewMessage", "NotBuddy", "OfficialRace", "Opponents", "Outbox", "QuitRace", "RedHigh", "RedLow",  |  | ||||||
| 			"Refresh", "RestartRace", "Save", "Second", "ShowDown", "ShowDown2", "ShowLeft", "ShowLeft2", "ShowRight", "ShowRight2",  |  | ||||||
| 			"ShowUp", "ShowUp2", "SliderCursor", "SliderCursor2", "StateFavourite", "StatePrivate", "StateSuggested", "Sub",  |  | ||||||
| 			"TagTypeBronze", "TagTypeGold", "TagTypeNadeo", "TagTypeNone", "TagTypeSilver", "Third", "ToolLeague1", "ToolRoot",  |  | ||||||
| 			"ToolTree", "ToolUp", "TrackInfo", "TV", "YellowHigh", "YellowLow"); |  | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										103
									
								
								application/core/FML/Script/Menus.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										103
									
								
								application/core/FML/Script/Menus.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,103 @@ | |||||||
|  | <?php | ||||||
|  |  | ||||||
|  | namespace FML\Script; | ||||||
|  |  | ||||||
|  | use FML\Controls\Control; | ||||||
|  | use FML\Script\Sections\Constants; | ||||||
|  | use FML\Script\Sections\Labels; | ||||||
|  | use FML\Types\Scriptable; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * ScriptFeature class offering menu behaviors | ||||||
|  |  * | ||||||
|  |  * @author steeffeen | ||||||
|  |  */ | ||||||
|  | class Menus implements Constants, Labels, ScriptFeature { | ||||||
|  | 	/** | ||||||
|  | 	 * Constants | ||||||
|  | 	 */ | ||||||
|  | 	const C_MENUIDS = 'C_FML_MenuIds'; | ||||||
|  | 	 | ||||||
|  | 	/** | ||||||
|  | 	 * Protected properties | ||||||
|  | 	 */ | ||||||
|  | 	protected $menus = array(); | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Add menu behavior defined by the given relationships | ||||||
|  | 	 * | ||||||
|  | 	 * @param array $menuRelationships        	 | ||||||
|  | 	 * @return \FML\Script\Menus | ||||||
|  | 	 */ | ||||||
|  | 	public function add(array $menuRelationships) { | ||||||
|  | 		$menuIndex = count($this->menus); | ||||||
|  | 		$menus = array(); | ||||||
|  | 		$submenus = array(); | ||||||
|  | 		foreach ($menuRelationships as $relationship) { | ||||||
|  | 			$menuItemControl = $relationship[0]; | ||||||
|  | 			$subMenuControl = $relationship[1]; | ||||||
|  | 			 | ||||||
|  | 			if (!($menuItemControl instanceof Scriptable)) { | ||||||
|  | 				trigger_error('No Scriptable instance given as menu item.', E_USER_ERROR); | ||||||
|  | 			} | ||||||
|  | 			if (!($subMenuControl instanceof Control)) { | ||||||
|  | 				trigger_error('No Control instance given as submenu.', E_USER_ERROR); | ||||||
|  | 			} | ||||||
|  | 			 | ||||||
|  | 			$menuItemControl->assignId(); | ||||||
|  | 			$menuItemControl->setScriptEvents(true); | ||||||
|  | 			$subMenuControl->assignId(); | ||||||
|  | 			 | ||||||
|  | 			array_push($menus, array($menuItemControl->getId(), $subMenuControl->getId())); | ||||||
|  | 			array_push($submenus, $subMenuControl->getId()); | ||||||
|  | 		} | ||||||
|  | 		array_push($this->menus, array($menus, $submenus)); | ||||||
|  | 		return $this; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * | ||||||
|  | 	 * @see \FML\Script\Sections\Constants::getConstants() | ||||||
|  | 	 */ | ||||||
|  | 	public function getConstants() { | ||||||
|  | 		$constant = '['; | ||||||
|  | 		$index = 0; | ||||||
|  | 		foreach ($this->menus as $menu) { | ||||||
|  | 			$constant .= '['; | ||||||
|  | 			foreach ($menu[0] as $menuRel) { | ||||||
|  | 				$constant .= '"' . $menuRel[0] . '" => ["' . $menuRel[1] . '"], '; | ||||||
|  | 			} | ||||||
|  | 			$constant .= '"__FML__Sub__Menus__" => ['; | ||||||
|  | 			$subIndex = 0; | ||||||
|  | 			foreach ($menu[1] as $subMenu) { | ||||||
|  | 				$constant .= '"' . $subMenu . '"'; | ||||||
|  | 				if ($subIndex < count($menu[1]) - 1) { | ||||||
|  | 					$constant .= ', '; | ||||||
|  | 				} | ||||||
|  | 				$subIndex++; | ||||||
|  | 			} | ||||||
|  | 			$constant .= ']]'; | ||||||
|  | 			if ($index < count($this->menus) - 1) { | ||||||
|  | 				$constant .= ', '; | ||||||
|  | 			} | ||||||
|  | 			$index++; | ||||||
|  | 		} | ||||||
|  | 		$constant .= ']'; | ||||||
|  | 		$constants = array(); | ||||||
|  | 		$constants[self::C_MENUIDS] = $constant; | ||||||
|  | 		return $constants; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * | ||||||
|  | 	 * @see \FML\Script\Sections\Labels::getLabels() | ||||||
|  | 	 */ | ||||||
|  | 	public function getLabels() { | ||||||
|  | 		$labels = array(); | ||||||
|  | 		$labelMouseClick = file_get_contents(__DIR__ . '/Templates/MenuMouseClick.txt'); | ||||||
|  | 		$labels[Labels::MOUSECLICK] = $labelMouseClick; | ||||||
|  | 		return $labels; | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | ?> | ||||||
							
								
								
									
										144
									
								
								application/core/FML/Script/Pages.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										144
									
								
								application/core/FML/Script/Pages.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,144 @@ | |||||||
|  | <?php | ||||||
|  |  | ||||||
|  | namespace FML\Script; | ||||||
|  |  | ||||||
|  | use FML\Controls\Control; | ||||||
|  | use FML\Script\Sections\Constants; | ||||||
|  | use FML\Script\Sections\Globals; | ||||||
|  | use FML\Script\Sections\Includes; | ||||||
|  | use FML\Script\Sections\Labels; | ||||||
|  | use FML\Types\Scriptable; | ||||||
|  | use FML\Controls\Label; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * ScriptFeature class offering paging | ||||||
|  |  * | ||||||
|  |  * @author steeffeen | ||||||
|  |  */ | ||||||
|  | class Pages implements Constants, Globals, Includes, Labels, ScriptFeature { | ||||||
|  | 	/** | ||||||
|  | 	 * Constants | ||||||
|  | 	 */ | ||||||
|  | 	const C_PAGEIDS = 'C_FML_PageIds'; | ||||||
|  | 	 | ||||||
|  | 	/** | ||||||
|  | 	 * Protected properties | ||||||
|  | 	 */ | ||||||
|  | 	protected $pages = array(); | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Add paging behavior | ||||||
|  | 	 * | ||||||
|  | 	 * @param array $pageButtons        	 | ||||||
|  | 	 * @param array $pages        	 | ||||||
|  | 	 * @param Label $counterLabel        	 | ||||||
|  | 	 * @return \FML\Script\Pages | ||||||
|  | 	 */ | ||||||
|  | 	public function add(array $pageButtons, array $pages, Label $counterLabel = null) { | ||||||
|  | 		$actionIds = array(); | ||||||
|  | 		foreach ($pageButtons as $action => $pageButton) { | ||||||
|  | 			if (!($pageButton instanceof Control)) { | ||||||
|  | 				trigger_error('No Control instance given.', E_USER_ERROR); | ||||||
|  | 			} | ||||||
|  | 			$pageButton->assignId(); | ||||||
|  | 			if (!($pageButton instanceof Scriptable)) { | ||||||
|  | 				trigger_error('No Scriptable instance given.', E_USER_ERROR); | ||||||
|  | 			} | ||||||
|  | 			$pageButton->setScriptEvents(true); | ||||||
|  | 			 | ||||||
|  | 			$actionIds[$pageButton->getId()] = $action; | ||||||
|  | 		} | ||||||
|  | 		 | ||||||
|  | 		$pageIds = array(); | ||||||
|  | 		foreach ($pages as $page) { | ||||||
|  | 			if (!($page instanceof Control)) { | ||||||
|  | 				trigger_error('No Control instance given.', E_USER_ERROR); | ||||||
|  | 			} | ||||||
|  | 			$page->assignId(); | ||||||
|  | 			if (!empty($pageIds)) { | ||||||
|  | 				$page->setVisible(false); | ||||||
|  | 			} | ||||||
|  | 			array_push($pageIds, $page->getId()); | ||||||
|  | 		} | ||||||
|  | 		 | ||||||
|  | 		if ($counterLabel) { | ||||||
|  | 			$counterLabel->assignId(); | ||||||
|  | 			$counterId = $counterLabel->getId(); | ||||||
|  | 		} | ||||||
|  | 		else { | ||||||
|  | 			$counterId = uniqid(); | ||||||
|  | 		} | ||||||
|  | 		 | ||||||
|  | 		array_push($this->pages, array($actionIds, $pageIds, $counterId)); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * | ||||||
|  | 	 * @see \FML\Script\Sections\Includes::getIncludes() | ||||||
|  | 	 */ | ||||||
|  | 	public function getIncludes() { | ||||||
|  | 		$includes = array(); | ||||||
|  | 		$includes["TextLib"] = "TextLib"; | ||||||
|  | 		return $includes; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * | ||||||
|  | 	 * @see \FML\Script\Sections\Constants::getConstants() | ||||||
|  | 	 */ | ||||||
|  | 	public function getConstants() { | ||||||
|  | 		$constant = '['; | ||||||
|  | 		$index = 0; | ||||||
|  | 		foreach ($this->pages as $page) { | ||||||
|  | 			$constant .= '['; | ||||||
|  | 			$actionIds = $page[0]; | ||||||
|  | 			foreach ($actionIds as $actionId => $action) { | ||||||
|  | 				$constant .= '"' . $actionId . '" => ["' . $action . '"], '; | ||||||
|  | 			} | ||||||
|  | 			$constant .= '"__FML__Pages__Id__" => ["' . $page[2] . '"], '; | ||||||
|  | 			$constant .= '"__FML__Pages__Ids__" => ['; | ||||||
|  | 			$subIndex = 0; | ||||||
|  | 			foreach ($page[1] as $pageId) { | ||||||
|  | 				$constant .= '"' . $pageId . '"'; | ||||||
|  | 				if ($subIndex < count($page[1]) - 1) { | ||||||
|  | 					$constant .= ', '; | ||||||
|  | 				} | ||||||
|  | 				$subIndex++; | ||||||
|  | 			} | ||||||
|  | 			$constant .= ']]'; | ||||||
|  | 			if ($index < count($this->pages) - 1) { | ||||||
|  | 				$constant .= ', '; | ||||||
|  | 			} | ||||||
|  | 			$index++; | ||||||
|  | 		} | ||||||
|  | 		$constant .= ']'; | ||||||
|  | 		$constants = array(); | ||||||
|  | 		$constants[self::C_PAGEIDS] = $constant; | ||||||
|  | 		return $constants; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * | ||||||
|  | 	 * @see \FML\Script\Sections\Globals::getGlobals() | ||||||
|  | 	 */ | ||||||
|  | 	public function getGlobals() { | ||||||
|  | 		$globals = array(); | ||||||
|  | 		$globals['G_FML_PageIndexes'] = 'Integer[Text]'; | ||||||
|  | 		return $globals; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * | ||||||
|  | 	 * @see \FML\Script\Sections\Labels::getLabels() | ||||||
|  | 	 */ | ||||||
|  | 	public function getLabels() { | ||||||
|  | 		$labels = array(); | ||||||
|  | 		$labelOnInit = file_get_contents(__DIR__ . '/Templates/PageOnInit.txt'); | ||||||
|  | 		$labels[Labels::ONINIT] = $labelOnInit; | ||||||
|  | 		$labelMouseClick = file_get_contents(__DIR__ . '/Templates/PageMouseClick.txt'); | ||||||
|  | 		$labels[Labels::MOUSECLICK] = $labelMouseClick; | ||||||
|  | 		return $labels; | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | ?> | ||||||
| @@ -62,14 +62,27 @@ class Script { | |||||||
| 	 */ | 	 */ | ||||||
| 	private function buildScriptText() { | 	private function buildScriptText() { | ||||||
| 		$scriptText = ""; | 		$scriptText = ""; | ||||||
|  | 		$scriptText = $this->addHeaderPart($scriptText); | ||||||
| 		$scriptText = $this->addIncludesPart($scriptText); | 		$scriptText = $this->addIncludesPart($scriptText); | ||||||
| 		$scriptText = $this->addConstantsPart($scriptText); | 		$scriptText = $this->addConstantsPart($scriptText); | ||||||
|  | 		$scriptText = $this->addGlobalsPart($scriptText); | ||||||
| 		$scriptText = $this->addLabelsPart($scriptText); | 		$scriptText = $this->addLabelsPart($scriptText); | ||||||
| 		$scriptText = $this->addFunctionsPart($scriptText); | 		$scriptText = $this->addFunctionsPart($scriptText); | ||||||
| 		$scriptText = $this->addMainPart($scriptText); | 		$scriptText = $this->addMainPart($scriptText); | ||||||
| 		return $scriptText; | 		return $scriptText; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Add the header comment to the script | ||||||
|  | 	 *  | ||||||
|  | 	 * @param script $scriptText        	 | ||||||
|  | 	 * @return string | ||||||
|  | 	 */ | ||||||
|  | 	private function addHeaderPart($scriptText) { | ||||||
|  | 		$headerPart = file_get_contents(__DIR__ . '/Templates/Header.txt'); | ||||||
|  | 		return $scriptText . $headerPart; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Add the includes to the script | 	 * Add the includes to the script | ||||||
| 	 * | 	 * | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								application/core/FML/Script/Templates/Header.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								application/core/FML/Script/Templates/Header.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | /********************************* | ||||||
|  | *  FancyManiaLinks by steeffeen	 * | ||||||
|  | *    http://fml.steeffeen.com	 * | ||||||
|  | *********************************/ | ||||||
| @@ -1,3 +1,4 @@ | |||||||
|  | Void Dummy() {} | ||||||
|  |  | ||||||
| main() { | main() { | ||||||
| 	+++OnInit+++ | 	+++OnInit+++ | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								application/core/FML/Script/Templates/MenuMouseClick.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								application/core/FML/Script/Templates/MenuMouseClick.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | |||||||
|  | foreach (MenuIds in C_FML_MenuIds) { | ||||||
|  | 	if (!MenuIds.existskey(Event.ControlId)) continue; | ||||||
|  | 	 | ||||||
|  | 	declare MenuId = MenuIds[Event.ControlId][0]; | ||||||
|  | 	declare SubMenuIds = MenuIds["__FML__Sub__Menus__"]; | ||||||
|  | 	 | ||||||
|  | 	foreach (SubMenuId in SubMenuIds) { | ||||||
|  | 		declare SubMenu <=> Page.GetFirstChild(SubMenuId); | ||||||
|  | 		if (SubMenu == Null) continue; | ||||||
|  | 		SubMenu.Visible = (SubMenu.ControlId == MenuId); | ||||||
|  | 	} | ||||||
|  | } | ||||||
							
								
								
									
										27
									
								
								application/core/FML/Script/Templates/PageMouseClick.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								application/core/FML/Script/Templates/PageMouseClick.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | |||||||
|  | foreach (PageIds in C_FML_PageIds) { | ||||||
|  | 	if (!PageIds.existskey(Event.ControlId)) continue; | ||||||
|  | 	 | ||||||
|  | 	declare Action = TextLib::ToInteger(PageIds[Event.ControlId][0]); | ||||||
|  | 	declare PagesId = PageIds["__FML__Pages__Id__"][0]; | ||||||
|  | 	declare PagesIds = PageIds["__FML__Pages__Ids__"]; | ||||||
|  | 	 | ||||||
|  | 	if (!G_FML_PageIndexes.existskey(PagesId)) { | ||||||
|  | 		G_FML_PageIndexes[PagesId] = 0; | ||||||
|  | 	} | ||||||
|  | 	G_FML_PageIndexes[PagesId] += Action; | ||||||
|  | 	if (G_FML_PageIndexes[PagesId] < 0) { | ||||||
|  | 		G_FML_PageIndexes[PagesId] = 0; | ||||||
|  | 	} else if (G_FML_PageIndexes[PagesId] >= PagesIds.count) { | ||||||
|  | 		G_FML_PageIndexes[PagesId] = PagesIds.count - 1; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	foreach (PageIndex => PageId in PagesIds) { | ||||||
|  | 		declare Control <=> Page.GetFirstChild(PageId); | ||||||
|  | 		if (Control == Null) continue; | ||||||
|  | 		Control.Visible = (PageIndex == G_FML_PageIndexes[PagesId]); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	declare Label_Counter <=> (Page.GetFirstChild(PagesId) as CMlLabel); | ||||||
|  | 	if (Label_Counter == Null) continue; | ||||||
|  | 	Label_Counter.Value = (G_FML_PageIndexes[PagesId]+1)^"/"^PagesIds.count; | ||||||
|  | } | ||||||
							
								
								
									
										18
									
								
								application/core/FML/Script/Templates/PageOnInit.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								application/core/FML/Script/Templates/PageOnInit.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | |||||||
|  | foreach (PageIds in C_FML_PageIds) { | ||||||
|  | 	declare PagesId = PageIds["__FML__Pages__Id__"][0]; | ||||||
|  | 	declare PagesIds = PageIds["__FML__Pages__Ids__"]; | ||||||
|  | 	 | ||||||
|  | 	if (!G_FML_PageIndexes.existskey(PagesId)) { | ||||||
|  | 		G_FML_PageIndexes[PagesId] = 0; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	foreach (PageIndex => PageId in PagesIds) { | ||||||
|  | 		declare Control <=> Page.GetFirstChild(PageId); | ||||||
|  | 		if (Control == Null) continue; | ||||||
|  | 		Control.Visible = (PageIndex == G_FML_PageIndexes[PagesId]); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	declare Label_Counter <=> (Page.GetFirstChild(PagesId) as CMlLabel); | ||||||
|  | 	if (Label_Counter == Null) continue; | ||||||
|  | 	Label_Counter.Value = (G_FML_PageIndexes[PagesId]+1)^"/"^PagesIds.count; | ||||||
|  | } | ||||||
| @@ -5,6 +5,7 @@ namespace FML\Script; | |||||||
| use FML\Controls\Control; | use FML\Controls\Control; | ||||||
| use FML\Script\Sections\Constants; | use FML\Script\Sections\Constants; | ||||||
| use FML\Script\Sections\Labels; | use FML\Script\Sections\Labels; | ||||||
|  | use FML\Types\Scriptable; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * ScriptFeature class offering tooltip behaviors |  * ScriptFeature class offering tooltip behaviors | ||||||
| @@ -25,13 +26,17 @@ class Tooltips implements Constants, Labels, ScriptFeature { | |||||||
| 	/** | 	/** | ||||||
| 	 * Add a tooltip behavior showing the tooltipControl while hovering over the hoverControl | 	 * Add a tooltip behavior showing the tooltipControl while hovering over the hoverControl | ||||||
| 	 * | 	 * | ||||||
| 	 * @param Control $hoverControl        	 | 	 * @param Scriptable $hoverControl        	 | ||||||
| 	 * @param Control $tooltipControl        	 | 	 * @param Control $tooltipControl        	 | ||||||
| 	 * @return \FML\Script\Tooltips | 	 * @return \FML\Script\Tooltips | ||||||
| 	 */ | 	 */ | ||||||
| 	public function add(Control $hoverControl, Control $tooltipControl) { | 	public function add(Scriptable $hoverControl, Control $tooltipControl) { | ||||||
|  | 		if ($hoverControl instanceof Control) { | ||||||
| 			$hoverControl->assignId(); | 			$hoverControl->assignId(); | ||||||
|  | 		} | ||||||
|  | 		$hoverControl->setScriptEvents(true); | ||||||
| 		$tooltipControl->assignId(); | 		$tooltipControl->assignId(); | ||||||
|  | 		$tooltipControl->setVisible(false); | ||||||
| 		$this->tooltips[$hoverControl->getId()] = $tooltipControl->getId(); | 		$this->tooltips[$hoverControl->getId()] = $tooltipControl->getId(); | ||||||
| 		return $this; | 		return $this; | ||||||
| 	} | 	} | ||||||
| @@ -42,11 +47,13 @@ class Tooltips implements Constants, Labels, ScriptFeature { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function getConstants() { | 	public function getConstants() { | ||||||
| 		$constant = '['; | 		$constant = '['; | ||||||
|  | 		$index = 0; | ||||||
| 		foreach ($this->tooltips as $hoverId => $tooltipId) { | 		foreach ($this->tooltips as $hoverId => $tooltipId) { | ||||||
| 			$constant .= '"' . $hoverId . '" => "' . $tooltipId . '"'; | 			$constant .= '"' . $hoverId . '" => "' . $tooltipId . '"'; | ||||||
| 			if ($index < count($this->tooltips) - 1) { | 			if ($index < count($this->tooltips) - 1) { | ||||||
| 				$constant .= ','; | 				$constant .= ','; | ||||||
| 			} | 			} | ||||||
|  | 			$index++; | ||||||
| 		} | 		} | ||||||
| 		$constant .= ']'; | 		$constant .= ']'; | ||||||
| 		$constants = array(); | 		$constants = array(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user