From 090410cbf854e45425753a84e5dc9c1d17190c03 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Mon, 20 Feb 2017 02:34:26 +0100 Subject: [PATCH] Nav/RedButtons * pass parameters as ready to use - objects --- pages/achievement.php | 10 ++++++++-- pages/class.php | 2 +- pages/emote.php | 4 ++++ pages/enchantment.php | 5 +++++ pages/event.php | 2 +- pages/faction.php | 2 +- pages/item.php | 10 ++++++++-- pages/itemset.php | 2 +- pages/npc.php | 2 +- pages/object.php | 2 +- pages/pet.php | 2 +- pages/quest.php | 8 +++++++- pages/race.php | 2 +- pages/skill.php | 2 +- pages/spell.php | 10 ++++++++-- pages/title.php | 2 +- pages/zone.php | 2 +- template/bricks/redButtons.tpl.php | 8 +++----- 18 files changed, 54 insertions(+), 23 deletions(-) diff --git a/pages/achievement.php b/pages/achievement.php index 127c9ea7..20616950 100644 --- a/pages/achievement.php +++ b/pages/achievement.php @@ -146,8 +146,14 @@ class AchievementPage extends GenericPage $this->series = $series ? [[$series, null]] : null; $this->description = $this->subject->getField('description', true); $this->redButtons = array( - BUTTON_LINKS => ['color' => 'ffffff00', 'linkId' => Util::$typeStrings[TYPE_ACHIEVEMENT].':'.$this->typeId.':"..UnitGUID("player")..":0:0:0:0:0:0:0:0'], - BUTTON_WOWHEAD => !($this->subject->getField('cuFlags') & CUSTOM_SERVERSIDE) + BUTTON_WOWHEAD => !($this->subject->getField('cuFlags') & CUSTOM_SERVERSIDE), + BUTTON_LINKS => array( + 'linkColor' => 'ffffff00', + 'linkId' => Util::$typeStrings[TYPE_ACHIEVEMENT].':'.$this->typeId.':"..UnitGUID("player")..":0:0:0:0:0:0:0:0', + 'linkName' => $this->name, + 'type' => $this->type, + 'typeId' => $this->typeId + ) ); $this->criteria = array( 'reqQty' => $this->subject->getField('reqCriteriaCount'), diff --git a/pages/class.php b/pages/class.php index b5352966..16f858be 100644 --- a/pages/class.php +++ b/pages/class.php @@ -96,7 +96,7 @@ class ClassPage extends GenericPage $this->expansion = Util::$expansionString[$this->subject->getField('expansion')]; $this->headIcons = ['class_'.strtolower($this->subject->getField('fileString'))]; $this->redButtons = array( - BUTTON_LINKS => ['color' => '', 'linkId' => ''], + BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId], BUTTON_WOWHEAD => true, BUTTON_TALENT => ['href' => '?talent#'.Util::$tcEncoding[$tcClassId[$this->typeId] * 3], 'pet' => false], BUTTON_FORUM => false // todo (low): CFG_BOARD_URL + X diff --git a/pages/emote.php b/pages/emote.php index ec25689f..9490f7d6 100644 --- a/pages/emote.php +++ b/pages/emote.php @@ -81,6 +81,10 @@ class EmotePage extends GenericPage $this->extraText = $text; $this->infobox = $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null; + $this->redButtons = array( + BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId], + BUTTON_WOWHEAD => false + ); /**************/ /* Extra Tabs */ diff --git a/pages/enchantment.php b/pages/enchantment.php index 47fc5e32..56a182dd 100644 --- a/pages/enchantment.php +++ b/pages/enchantment.php @@ -80,6 +80,11 @@ class EnchantmentPage extends GenericPage $this->infobox = $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null; + $this->redButtons = array( + BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId], + BUTTON_WOWHEAD => false + ); + $this->effects = []; // 3 effects for ($i = 1; $i < 4; $i++) diff --git a/pages/event.php b/pages/event.php index 56f417f5..93eae6ec 100644 --- a/pages/event.php +++ b/pages/event.php @@ -94,7 +94,7 @@ class EventPage extends GenericPage $this->headIcons = [$this->subject->getField('iconString')]; $this->redButtons = array( BUTTON_WOWHEAD => $this->hId > 0, - BUTTON_LINKS => true + BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId] ); /**************/ diff --git a/pages/faction.php b/pages/faction.php index 5ad439a8..43f0fbaf 100644 --- a/pages/faction.php +++ b/pages/faction.php @@ -88,7 +88,7 @@ class FactionPage extends GenericPage $this->infobox = $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null; $this->redButtons = array( BUTTON_WOWHEAD => true, - BUTTON_LINKS => true + BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId] ); // Spillover Effects diff --git a/pages/item.php b/pages/item.php index c67c1d93..e67f85d9 100644 --- a/pages/item.php +++ b/pages/item.php @@ -360,11 +360,17 @@ class ItemPage extends genericPage $this->tooltip = $this->subject->renderTooltip(true); $this->redButtons = array( BUTTON_WOWHEAD => true, - BUTTON_LINKS => ['color' => 'ff'.Util::$rarityColorStings[$this->subject->getField('quality')], 'linkId' => 'item:'.$this->typeId.':0:0:0:0:0:0:0:0'], BUTTON_VIEW3D => in_array($_slot, $_visSlots) && $_model ? ['displayId' => $this->subject->getField('displayId'), 'slot' => $_slot, 'type' => TYPE_ITEM, 'typeId' => $this->typeId] : false, BUTTON_COMPARE => $_cu, BUTTON_EQUIP => in_array($_class, [ITEM_CLASS_WEAPON, ITEM_CLASS_ARMOR]), - BUTTON_UPGRADE => $_cu ? ['class' => $_class, 'slot' => $_slot] : false + BUTTON_UPGRADE => ($_cu ? ['class' => $_class, 'slot' => $_slot] : false), + BUTTON_LINKS => array( + 'linkColor' => 'ff'.Util::$rarityColorStings[$this->subject->getField('quality')], + 'linkId' => 'item:'.$this->typeId.':0:0:0:0:0:0:0:0', + 'linkName' => $this->name, + 'type' => $this->type, + 'typeId' => $this->typeId + ) ); // availablility diff --git a/pages/itemset.php b/pages/itemset.php index 403bf707..fd6b7990 100644 --- a/pages/itemset.php +++ b/pages/itemset.php @@ -163,7 +163,7 @@ class ItemsetPage extends GenericPage $this->expansion = 0; $this->redButtons = array( BUTTON_WOWHEAD => $this->typeId > 0, // bool only - BUTTON_LINKS => ['color' => '', 'linkId' => ''], + BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId], BUTTON_VIEW3D => ['type' => TYPE_ITEMSET, 'typeId' => $this->typeId, 'equipList' => $eqList], BUTTON_COMPARE => ['eqList' => implode(':', $compare), 'qty' => $_cnt] ); diff --git a/pages/npc.php b/pages/npc.php index 18e7509b..1c1148a4 100644 --- a/pages/npc.php +++ b/pages/npc.php @@ -323,7 +323,7 @@ class NpcPage extends GenericPage $this->reputation = $this->getOnKillRep($_altIds, $mapType); $this->redButtons = array( BUTTON_WOWHEAD => true, - BUTTON_LINKS => true, + BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId], BUTTON_VIEW3D => ['type' => TYPE_NPC, 'typeId' => $this->typeId, 'displayId' => $this->subject->getRandomModelId()] ); diff --git a/pages/object.php b/pages/object.php index ac2a97ab..c2165bc9 100644 --- a/pages/object.php +++ b/pages/object.php @@ -249,7 +249,7 @@ class ObjectPage extends GenericPage $this->relBoss = $relBoss; $this->redButtons = array( BUTTON_WOWHEAD => true, - BUTTON_LINKS => true, + BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId], BUTTON_VIEW3D => ['displayId' => $this->subject->getField('displayId'), 'type' => TYPE_OBJECT, 'typeId' => $this->typeId] ); diff --git a/pages/pet.php b/pages/pet.php index 9828f90d..c592c6b9 100644 --- a/pages/pet.php +++ b/pages/pet.php @@ -67,7 +67,7 @@ class PetPage extends GenericPage $this->expansion = Util::$expansionString[$this->subject->getField('expansion')]; $this->redButtons = array( BUTTON_WOWHEAD => true, - BUTTON_LINKS => true, + BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId], BUTTON_TALENT => ['href' => '?petcalc#'.Util::$tcEncoding[(int)($this->typeId / 10)] . Util::$tcEncoding[(2 * ($this->typeId % 10) + ($this->subject->getField('exotic') ? 1 : 0))], 'pet' => true] ); diff --git a/pages/quest.php b/pages/quest.php index f5b25683..7cbfbd3d 100644 --- a/pages/quest.php +++ b/pages/quest.php @@ -559,8 +559,14 @@ class QuestPage extends GenericPage $this->suggestedPl = $this->subject->getField('suggestedPlayers'); $this->unavailable = $_flags & QUEST_FLAG_UNAVAILABLE || $this->subject->getField('cuFlags') & CUSTOM_EXCLUDE_FOR_LISTVIEW; $this->redButtons = array( - BUTTON_LINKS => ['color' => 'ffffff00', 'linkId' => 'quest:'.$this->typeId.':'.$_level.''], BUTTON_WOWHEAD => true + BUTTON_LINKS => array( + 'linkColor' => 'ffffff00', + 'linkId' => 'quest:'.$this->typeId.':'.$_level; + 'linkName' => $this->name, + 'type' => $this->type, + 'typeId' => $this->typeId + ) ); if ($maTab) diff --git a/pages/race.php b/pages/race.php index 2dd74980..fd5ddcc9 100644 --- a/pages/race.php +++ b/pages/race.php @@ -96,7 +96,7 @@ class RacePage extends GenericPage ); $this->redButtons = array( BUTTON_WOWHEAD => true, - BUTTON_LINKS => true + BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId] ); diff --git a/pages/skill.php b/pages/skill.php index 60e4014c..71e04998 100644 --- a/pages/skill.php +++ b/pages/skill.php @@ -52,7 +52,7 @@ class SkillPage extends GenericPage $this->headIcons = [$this->subject->getField('iconString')]; $this->redButtons = array( BUTTON_WOWHEAD => true, - BUTTON_LINKS => true + BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId] ); if ($_ = $this->subject->getField('description', true)) diff --git a/pages/spell.php b/pages/spell.php index e12e8071..5d0f8da0 100644 --- a/pages/spell.php +++ b/pages/spell.php @@ -122,9 +122,15 @@ class SpellPage extends GenericPage $_cat = $this->subject->getField('typeCat'); $redButtons = array( - BUTTON_LINKS => ['color' => 'ff71d5ff', 'linkId' => Util::$typeStrings[TYPE_SPELL].':'.$this->typeId], BUTTON_VIEW3D => false, - BUTTON_WOWHEAD => true + BUTTON_WOWHEAD => true, + BUTTON_LINKS => array( + 'linkColor' => 'ff71d5ff', + 'linkId' => Util::$typeStrings[TYPE_SPELL].':'.$this->typeId, + 'linkName' => $this->name, + 'type' => $this->type, + 'typeId' => $this->typeId + ) ); /***********/ diff --git a/pages/title.php b/pages/title.php index 47dde429..c940599f 100644 --- a/pages/title.php +++ b/pages/title.php @@ -75,7 +75,7 @@ class TitlePage extends GenericPage $this->expansion = Util::$expansionString[$this->subject->getField('expansion')]; $this->redButtons = array( BUTTON_WOWHEAD => true, - BUTTON_LINKS => ['name' => $this->nameFixed] + BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId] ); // factionchange-equivalent diff --git a/pages/zone.php b/pages/zone.php index 806aadba..53a7cb05 100644 --- a/pages/zone.php +++ b/pages/zone.php @@ -446,7 +446,7 @@ class ZonePage extends GenericPage $this->expansion = Util::$expansionString[$this->subject->getField('expansion')]; $this->redButtons = array( BUTTON_WOWHEAD => true, - BUTTON_LINKS => true + BUTTON_LINKS => ['type' => $this->type, 'typeId' => $this->typeId] ); /* diff --git a/template/bricks/redButtons.tpl.php b/template/bricks/redButtons.tpl.php index 00bda71d..186338dc 100644 --- a/template/bricks/redButtons.tpl.php +++ b/template/bricks/redButtons.tpl.php @@ -11,9 +11,7 @@ endif; // ingame-links/markdown/ect if (isset($this->redButtons[BUTTON_LINKS])): if ($b = $this->redButtons[BUTTON_LINKS]): - echo 'name)."', type: ".$this->type.', typeId: '.$this->typeId.' });">'.Lang::main('links').''.Lang::main('links').''; + echo ' "'"]).');">'.Lang::main('links').''.Lang::main('links').''; else: echo ''.Lang::main('links').''.Lang::main('links').''; endif; @@ -22,7 +20,7 @@ endif; // view in 3D if (isset($this->redButtons[BUTTON_VIEW3D])): if ($b = $this->redButtons[BUTTON_VIEW3D]): // json_encode puts property names in brackets wich is not cool with inline javascript - echo ' '']).')">'.Lang::main('view3D').''.Lang::main('view3D').''; + echo ' "'"]).')">'.Lang::main('view3D').''.Lang::main('view3D').''; else: echo ''.Lang::main('view3D').''.Lang::main('view3D').''; endif; @@ -51,7 +49,7 @@ if (isset($this->redButtons[BUTTON_TALENT])): if ($b = $this->redButtons[BUTTON_TALENT]): echo ''.($b['pet'] ? Lang::main('petCalc') : Lang::main('talentCalc')).''.($b['pet'] ? Lang::main('petCalc') : Lang::main('talentCalc')).''; else: - echo '{if $b.pet}'.Lang::main('petCalc').'else:'.Lang::main('talentCalc').'endif;{if $b.pet}'.Lang::main('petCalc').'else:'.Lang::main('talentCalc').'endif;'; + echo ''.Lang::main('talentCalc').''.Lang::main('talentCalc').''; endif; endif;