From 58316679bf75c4cd127d770b6072f0d66481af9e Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Sat, 23 Mar 2013 12:56:51 +0100 Subject: [PATCH] ordered bricks somewhat simple listview-pages now use one shared template (instead of having the same file multiple times) some bug fixing here and there - achievement: faction is no longer out of range (need to reparse the faction :/) - item: quality is prepended to the name again and wont be left out in case of heirlooms (is 0) - general: forgot to change some error()-calls in index - and some more wich i forgot.. --- includes/class.achievement.php | 2 +- includes/class.charclass.php | 2 +- includes/class.currency.php | 4 +- includes/class.item.php | 16 +++-- index.php | 4 +- pages/achievement.php | 15 ++--- pages/compare.php | 2 +- pages/events.php | 13 ++-- pages/spell.php | 2 +- pages/title.php | 64 ++++++++++--------- pages/titles.php | 9 ++- search.php | 2 +- template/bricks/allachievements_table.tpl | 6 -- template/bricks/allclasses_table.tpl | 6 -- template/bricks/allcurrencies_table.tpl | 8 --- template/bricks/allitems_table.tpl | 10 --- template/bricks/allraces_table.tpl | 6 -- template/bricks/class_table.tpl | 37 ----------- template/bricks/globals/achievements.tpl | 9 +++ template/bricks/globals/classes.tpl | 8 +++ template/bricks/globals/currencies.tpl | 9 +++ .../holidays.tpl} | 0 template/bricks/globals/items.tpl | 10 +++ template/bricks/globals/races.tpl | 8 +++ template/bricks/globals/spells.tpl | 9 +++ .../titles.tpl} | 0 template/bricks/infobox.tpl | 2 +- template/bricks/itemset_table.tpl | 33 ---------- .../achievement.tpl} | 0 .../calendar.tpl} | 0 template/bricks/listviews/class.tpl | 37 +++++++++++ .../currency.tpl} | 0 .../{event_table.tpl => listviews/event.tpl} | 0 .../{item_table.tpl => listviews/item.tpl} | 60 ++++++++--------- template/bricks/listviews/itemset.tpl | 34 ++++++++++ .../{quest_table.tpl => listviews/quest.tpl} | 0 template/bricks/listviews/race.tpl | 34 ++++++++++ .../{title_table.tpl => listviews/title.tpl} | 0 template/bricks/race_table.tpl | 34 ---------- template/compare.tpl | 4 +- template/events.tpl | 29 --------- .../{titles.tpl => generic-no-filter.tpl} | 11 +++- template/head.tpl | 2 +- template/header.tpl | 16 ++--- template/search.tpl | 44 ++++++------- template/title.tpl | 10 +-- 46 files changed, 305 insertions(+), 306 deletions(-) delete mode 100644 template/bricks/allachievements_table.tpl delete mode 100644 template/bricks/allclasses_table.tpl delete mode 100644 template/bricks/allcurrencies_table.tpl delete mode 100644 template/bricks/allitems_table.tpl delete mode 100644 template/bricks/allraces_table.tpl delete mode 100644 template/bricks/class_table.tpl create mode 100644 template/bricks/globals/achievements.tpl create mode 100644 template/bricks/globals/classes.tpl create mode 100644 template/bricks/globals/currencies.tpl rename template/bricks/{allholidays_table.tpl => globals/holidays.tpl} (100%) create mode 100644 template/bricks/globals/items.tpl create mode 100644 template/bricks/globals/races.tpl create mode 100644 template/bricks/globals/spells.tpl rename template/bricks/{alltitles_table.tpl => globals/titles.tpl} (100%) delete mode 100644 template/bricks/itemset_table.tpl rename template/bricks/{achievement_table.tpl => listviews/achievement.tpl} (100%) rename template/bricks/{calendar_table.tpl => listviews/calendar.tpl} (100%) create mode 100644 template/bricks/listviews/class.tpl rename template/bricks/{currency_table.tpl => listviews/currency.tpl} (100%) rename template/bricks/{event_table.tpl => listviews/event.tpl} (100%) rename template/bricks/{item_table.tpl => listviews/item.tpl} (72%) create mode 100644 template/bricks/listviews/itemset.tpl rename template/bricks/{quest_table.tpl => listviews/quest.tpl} (100%) create mode 100644 template/bricks/listviews/race.tpl rename template/bricks/{title_table.tpl => listviews/title.tpl} (100%) delete mode 100644 template/bricks/race_table.tpl delete mode 100644 template/events.tpl rename template/{titles.tpl => generic-no-filter.tpl} (52%) diff --git a/includes/class.achievement.php b/includes/class.achievement.php index de30088f..d2c56c8c 100644 --- a/includes/class.achievement.php +++ b/includes/class.achievement.php @@ -88,7 +88,7 @@ class AchievementList extends BaseType 'name' => Util::localizedString($this->curTpl, 'name'), 'description' => Util::localizedString($this->curTpl, 'description'), 'points' => $this->curTpl['points'], - 'faction' => $this->curTpl['faction'] + 1, + 'faction' => $this->curTpl['faction'], 'category' => $this->curTpl['category'], 'parentCat' => $this->curTpl['parentCat'], ); diff --git a/includes/class.charclass.php b/includes/class.charclass.php index 74feb196..f3789573 100644 --- a/includes/class.charclass.php +++ b/includes/class.charclass.php @@ -40,7 +40,7 @@ class CharClassList extends BaseType $refs['gClasses'] = []; while ($this->iterate()) - $refs['gClasses'][$this->id] = Util::jsEscape($this->names[$this->id]); + $refs['gClasses'][$this->id] = ['name' => $this->names[$this->id]]; } public function addRewardsToJScript(&$ref) { } diff --git a/includes/class.currency.php b/includes/class.currency.php index 768c1e3e..69526701 100644 --- a/includes/class.currency.php +++ b/includes/class.currency.php @@ -35,8 +35,8 @@ class CurrencyList extends BaseType while ($this->iterate()) { $refs['gCurrencies'][$this->id] = array( - 'name_'.User::$localeString => Util::jsEscape($this->names[$this->id]), - 'icon' => $this->curTpl['iconString'] + 'name' => $this->names[$this->id], + 'icon' => $this->curTpl['iconString'] ); } diff --git a/includes/class.item.php b/includes/class.item.php index a74d1b08..a23cd11b 100644 --- a/includes/class.item.php +++ b/includes/class.item.php @@ -96,6 +96,10 @@ class ItemList extends BaseType $data[$this->id] = $this->json[$this->id]; + // json vs listview quirk + $data[$this->id]['name'] = $data[$this->id]['quality'].$data[$this->id]['name']; + unset($data[$this->id]['quality']); + if (isset($this->itemMods[$this->id])) // due to ITEMINFO_JSON foreach ($this->itemMods[$this->id] as $k => $v) $data[$this->id][Util::$itemMods[$k]] = $v; @@ -499,7 +503,7 @@ class ItemList extends BaseType // required skill if ($this->curTpl['RequiredSkill']) { - $skillText = DB::Aowow()->selectRow('SELECT * FROM ?_skill WHERE skillID = ?d', $this->curTpl['RequiredSkill']); + $skillText = DB::Aowow()->selectRow('SELECT * FROM ?_skill WHERE skillId = ?d', $this->curTpl['RequiredSkill']); $x .= '
'.Lang::$game['requires'].' '.Util::localizedString($skillText, 'name').''; if ($this->curTpl['RequiredSkillRank']) $x .= ' ('.$this->curTpl['RequiredSkillRank'].')'; @@ -595,10 +599,10 @@ class ItemList extends BaseType $xSet = '
'.Util::localizedString($itemset, 'name').' (0/'.$num.')'; - if ($itemset['skillID']) // bonus requires skill to activate + if ($itemset['skillId']) // bonus requires skill to activate { - $name = DB::Aowow()->selectRow('SELECT * FROM ?_skill WHERE skillID=?d', $itemset['skillID']); - $xSet .= '
'.Lang::$game['requires'].' '.Util::localizedString($name, 'name').''; + $name = DB::Aowow()->selectRow('SELECT * FROM ?_skill WHERE skillId=?d', $itemset['skillId']); + $xSet .= '
'.Lang::$game['requires'].' '.Util::localizedString($name, 'name').''; if ($itemset['skillLevel']) $xSet .= ' ('.$itemset['skillLevel'].')'; @@ -881,7 +885,7 @@ class ItemList extends BaseType } foreach ($this->json[$this->id] as $k => $v) - if (!isset($v) || $v === "false" || (!in_array($k, ['classs', 'subclass']) && $v == "0")) + if (!isset($v) || $v === "false" || (!in_array($k, ['classs', 'subclass', 'quality']) && $v == "0")) unset($this->json[$this->id][$k]); } @@ -1058,7 +1062,7 @@ class ItemList extends BaseType // clear zero-values afterwards foreach ($json as $k => $v) - if (!isset($v) || $v === "false" || (!in_array($k, ['classs', 'subclass']) && $v == "0")) + if (!isset($v) || $v === "false" || (!in_array($k, ['classs', 'subclass', 'quality']) && $v == "0")) unset($json[$k]); $this->json[$json['id']] = $json; diff --git a/index.php b/index.php index 843e3e68..8c10ea31 100644 --- a/index.php +++ b/index.php @@ -60,7 +60,7 @@ switch ($pageCall) if (file_exists('pages/'.$pageCall.'.php')) require 'pages/'.$pageCall.'.php'; else - require 'pages/error.php'; + $smarty->error(); break; case 'talent': // tool: talent calculator case 'petcalc': // tool: pet talent calculator @@ -123,7 +123,7 @@ switch ($pageCall) if (isset($_GET['power'])) die('$WowheadPower.register(0, '.User::$localeId.', {})'); else // in conjunction with a propper rewriteRule in .htaccess... - require 'pages/error.php'; + $smarty->error(); break; } diff --git a/pages/achievement.php b/pages/achievement.php index b6f2a9fd..8f07b25c 100644 --- a/pages/achievement.php +++ b/pages/achievement.php @@ -53,13 +53,11 @@ if (isset($_GET['power'])) // regular page if (!$smarty->loadCache($cacheKeyPage, $pageData)) { - if ($acv->error) $smarty->notFound(Lang::$achievement['achievement']); $pageData['path'] = []; $pageData['title'] = [ucfirst(Lang::$achievement['achievement'])]; - $acv->renderTooltip(); // create page title and path $curCat = $acv->getField('category'); @@ -75,8 +73,8 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) array_unshift($pageData['title'], $acv->names[$id]); $acv->addRewardsToJscript($pageData); - $pageData['page'] = $acv->getDetailedData(); - + $pageData['page'] = $acv->getDetailedData()[$id]; + $acv->reset(); // infobox content switch ($acv->getField('faction')) { @@ -132,7 +130,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) // create rewards $pageData['page']['titleReward'] = []; $pageData['page']['itemReward'] = []; - $acv->addRewardsToJscript($pageData); + foreach ($pageData['page']['titleReward'] as $k => $v) $pageData['page']['titleReward'][$k] = sprintf(Lang::$achievement['titleReward'], $k, trim(str_replace('%s', '', $v['name']))); @@ -368,6 +366,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $smarty->saveCache($cacheKeyPage, $pageData); } + $vars = array( 'title' => implode(" - ", $pageData['title']), 'path' => "[".implode(", ", $pageData['path'])."]",// menuId 9: Achievement (g_initPath) @@ -379,12 +378,8 @@ $vars = array( $smarty->updatePageVars($vars); $smarty->assign('community', CommunityContent::getAll(TYPE_ACHIEVEMENT, $id)); // comments, screenshots, videos $smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$achievement)); -$smarty->assign('data', $pageData); - -// Mysql query execution statistics +$smarty->assign('lvData', $pageData); $smarty->assign('mysql', DB::Aowow()->getStatistics()); - -// load the page $smarty->display('achievement.tpl'); ?> \ No newline at end of file diff --git a/pages/compare.php b/pages/compare.php index 466d4b48..42a21052 100644 --- a/pages/compare.php +++ b/pages/compare.php @@ -83,7 +83,7 @@ $page = array( $smarty->updatePageVars($page); -$smarty->assign('data', $pageData); +$smarty->assign('lvData', $pageData); $smarty->assign('lang', array_merge(Lang::$main, Lang::$compare)); $smarty->assign('mysql', DB::Aowow()->getStatistics()); $smarty->display('compare.tpl'); diff --git a/pages/events.php b/pages/events.php index f036a532..e9c3c990 100644 --- a/pages/events.php +++ b/pages/events.php @@ -42,27 +42,28 @@ if (!$smarty->loadCache($cacheKey, $pageData)) $events = new WorldEventList($condition); - $events->addGlobalsToJScript($pageData); - $deps = []; while ($events->iterate()) if ($d = $events->getField('requires')) $deps[$events->id] = $d; $pageData = array( - 'page' => $events->getListviewData(), + 'file' => 'event', + 'data' => $events->getListviewData(), 'deps' => $deps, + 'calendar' => false, // todo: fix it Felix! 'params' => array( 'tabs' => '$myTabs' ) ); + $events->addGlobalsToJScript($pageData); $smarty->saveCache($cacheKey, $pageData); } // recalculate dates with now(); can't be cached, obviously -foreach ($pageData['page'] as &$data) +foreach ($pageData['data'] as &$data) { // is a followUp-event if (!empty($pageData['deps'][$data['id']])) @@ -86,7 +87,7 @@ $page = array( $smarty->updatePageVars($page); $smarty->assign('lang', Lang::$main); $smarty->assign('mysql', DB::Aowow()->getStatistics()); -$smarty->assign('data', $pageData); -$smarty->display('events.tpl'); +$smarty->assign('lvData', $pageData); +$smarty->display('generic-no-filter.tpl'); ?> diff --git a/pages/spell.php b/pages/spell.php index 57417e26..aab020e1 100644 --- a/pages/spell.php +++ b/pages/spell.php @@ -608,7 +608,7 @@ $smarty->updatePageVars(array( // comments, screenshots, videos // $smarty->assign('community', CommunityContent::getAll(9, $id)); $smarty->assign('lang', array_merge(Lang::$main, Lang::$spell)); -$smarty->assign('data', $pageData); +$smarty->assign('lvData', $pageData); $smarty->assign('spell', $spell); // Mysql query execution statistics diff --git a/pages/title.php b/pages/title.php index c25aa744..3f2376b0 100644 --- a/pages/title.php +++ b/pages/title.php @@ -17,9 +17,11 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $smarty->notFound(Lang::$game['title']); $title->addGlobalsToJscript($pageData); + $title->reset(); $infobox = []; $colon = User::$localeId == LOCALE_FR ? ' : ' : ': '; // Je suis un prick! <_< + if ($title->getField('side') == 1) $infobox[] = Lang::$main['side'].$colon.'[span class=alliance-icon]'.Lang::$game['alliance'].'[/span]'; else if ($title->getField('side') == 2) @@ -33,7 +35,6 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) if ($e = $title->getField('eventId')) $infobox[] = Lang::$game['eventShort'].$colon.'[url=?event='.$e.']'.WorldEvent::getName($e).'[/url]'; - $title->reset(); $pageData = array( 'page' => array( 'name' => $title->getHtmlizedName(), @@ -43,40 +44,43 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) 'infobox' => '[li][ul]'.implode('[/ul][ul]', $infobox).'[/ul][/li]', ); - foreach ($title->sources[$id] as $type => $entries) + if (!empty($title->sources[$id])) { - // todo: hidden-/visibleCols by actual use - switch ($type) + foreach ($title->sources[$id] as $type => $entries) { - case 4: - $quests = new QuestList(array(['id', $entries])); - $quests->addRewardsToJscript($pageData); + switch ($type) + { + case 4: + $quests = new QuestList(array(['id', $entries])); + $quests->addRewardsToJscript($pageData); - $pageData['page']['questReward'] = $quests->getListviewData(); - $pageData['page']['questParams'] = array( - 'id' => 'reward-from-quest', - 'name' => '$LANG.tab_rewardfrom', - 'hiddenCols' => "$['side']", - 'visibleCols' => "$['category']" - ); - break; - case 12: - $acvs = new AchievementList(array(['id', $entries])); - $acvs->addGlobalsToJscript($pageData); - $acvs->addRewardsToJscript($pageData); + $pageData['page']['questReward'] = $quests->getListviewData(); + $pageData['page']['questParams'] = array( + 'id' => 'reward-from-quest', + 'name' => '$LANG.tab_rewardfrom', + 'hiddenCols' => "$['side']", + 'visibleCols' => "$['category']" + ); + break; + case 12: + $acvs = new AchievementList(array(['id', $entries])); + $acvs->addGlobalsToJscript($pageData); + $acvs->addRewardsToJscript($pageData); - $pageData['page']['acvReward'] = $acvs->getListviewData(); - $pageData['page']['acvParams'] = array( - 'id' => 'reward-from-achievement', - 'name' => '$LANG.tab_rewardfrom', - 'visibleCols' => "$['category']", - 'sort' => "$['reqlevel', 'name']" - ); - break; - // case 13: - // not displayed + $pageData['page']['acvReward'] = $acvs->getListviewData(); + $pageData['page']['acvParams'] = array( + 'id' => 'reward-from-achievement', + 'name' => '$LANG.tab_rewardfrom', + 'visibleCols' => "$['category']", + 'sort' => "$['reqlevel', 'name']" + ); + break; + // case 13: + // not displayed + } } } + $pageData['title'] = ucFirst(trim(str_replace('%s', '', str_replace(',', '', $title->names[$title->id][0])))); $pageData['path'] = '[0, 10, '.$title->getField('category').']'; @@ -94,7 +98,7 @@ $smarty->updatePageVars(array( $smarty->assign('community', CommunityContent::getAll(TYPE_TITLE, $id)); // comments, screenshots, videos $smarty->assign('lang', array_merge(Lang::$main)); -$smarty->assign('data', $pageData); +$smarty->assign('lvData', $pageData); $smarty->assign('mysql', DB::Aowow()->getStatistics()); $smarty->display('title.tpl'); diff --git a/pages/titles.php b/pages/titles.php index 522363da..6fe5cbd2 100644 --- a/pages/titles.php +++ b/pages/titles.php @@ -21,12 +21,11 @@ if (isset($cat)) if (!$smarty->loadCache($cacheKey, $pageData)) { $titles = new TitleList(isset($cat) ? array(['category', (int)$cat]) : []); - $listview = $titles->getListviewData(); $pageData = array( - 'page' => $listview, + 'file' => 'title', + 'data' => $titles->getListviewData(), 'params' => array( - 'parent' => false, 'tabs' => false ) ); @@ -49,8 +48,8 @@ $page = array( $smarty->updatePageVars($page); $smarty->assign('lang', Lang::$main); -$smarty->assign('data', $pageData); +$smarty->assign('lvData', $pageData); $smarty->assign('mysql', DB::Aowow()->getStatistics()); -$smarty->display('titles.tpl'); +$smarty->display('generic-no-filter.tpl'); ?> diff --git a/search.php b/search.php index 0daf1c22..8c536feb 100644 --- a/search.php +++ b/search.php @@ -519,7 +519,7 @@ else /* if ($searchMask & SEARCH_TYPE_REGULAR) */ $smarty->updatePageVars($vars); $smarty->assign('lang', array_merge(Lang::$main, Lang::$search)); $smarty->assign('found', $found); - $smarty->assign('data', $jsGlobals); + $smarty->assign('lvData', $jsGlobals); $smarty->assign('search', $search); $smarty->assign('mysql', DB::Aowow()->getStatistics()); $smarty->assign('util', new Util); // just for debugging / optimizing diff --git a/template/bricks/allachievements_table.tpl b/template/bricks/allachievements_table.tpl deleted file mode 100644 index 5c9d9a6f..00000000 --- a/template/bricks/allachievements_table.tpl +++ /dev/null @@ -1,6 +0,0 @@ -var _ = g_achievements; -{strip} -{foreach from=$data key=id item=item} - _[{$id}]={ldelim}icon:'{$item.icon|escape:"javascript"}',name_{$user.language}:'{$item.name|escape:"javascript"}'{rdelim}; -{/foreach} -{/strip} diff --git a/template/bricks/allclasses_table.tpl b/template/bricks/allclasses_table.tpl deleted file mode 100644 index 522d0621..00000000 --- a/template/bricks/allclasses_table.tpl +++ /dev/null @@ -1,6 +0,0 @@ -var _ = g_classes; -{strip} -{foreach from=$data key=id item=item} - _[{$id}]={ldelim}name_{$user.language}:'{$item|escape:"javascript"}'{rdelim}; -{/foreach} -{/strip} diff --git a/template/bricks/allcurrencies_table.tpl b/template/bricks/allcurrencies_table.tpl deleted file mode 100644 index 461d3223..00000000 --- a/template/bricks/allcurrencies_table.tpl +++ /dev/null @@ -1,8 +0,0 @@ -{strip} - -var _ = g_gatheredcurrencies; -{foreach from=$data key=id item=item} - _[{$id}]={ldelim}icon:'{$item.icon|escape:"javascript"}',name_{$user.language}:'{$item.name|escape:"javascript"}'{rdelim}; -{/foreach} - -{/strip} \ No newline at end of file diff --git a/template/bricks/allitems_table.tpl b/template/bricks/allitems_table.tpl deleted file mode 100644 index efbdc659..00000000 --- a/template/bricks/allitems_table.tpl +++ /dev/null @@ -1,10 +0,0 @@ -var _ = g_items; -{strip} -{foreach from=$data key=id item=item} - _[{$id}]={ldelim} - icon:'{$item.icon|escape:"javascript"}', - name_{$user.language}:'{$item.name|escape:"javascript"}' - {if isset($item.quality)}, quality:'{$item.quality}'{/if} - {rdelim}; -{/foreach} -{/strip} diff --git a/template/bricks/allraces_table.tpl b/template/bricks/allraces_table.tpl deleted file mode 100644 index eaae9168..00000000 --- a/template/bricks/allraces_table.tpl +++ /dev/null @@ -1,6 +0,0 @@ -var _ = g_races; -{strip} -{foreach from=$data key=id item=item} - _[{$id}]={ldelim}name_{$user.language}:'{$item.name|escape:"javascript"}'{rdelim}; -{/foreach} -{/strip} diff --git a/template/bricks/class_table.tpl b/template/bricks/class_table.tpl deleted file mode 100644 index 15fb8235..00000000 --- a/template/bricks/class_table.tpl +++ /dev/null @@ -1,37 +0,0 @@ -{strip} - new Listview({ldelim} - template:'classs', - {if !isset($params.id)}id:'classes',{/if} - {if !isset($params.tabs)}tabs:'listview-generic',{/if} - {if !isset($params.name)}name:LANG.tab_classes,{/if} - {if !isset($params.parent)}parent:'listview-generic',{/if} - {if isset($params.note)}_truncated: 1,{/if} - {foreach from=$params key=k item=v} - {if $v[0] == '$'} - {$k}:{$v|substr:1}, - {else if $v} - {$k}:'{$v}', - {/if} - {/foreach} - data:[ - {foreach name=i from=$data item=curr} - {ldelim} - id:{$curr.id}, - name:'{$curr.name|escape:"javascript"}', - races:{$curr.races}, - roles:{$curr.roles}, - power:{$curr.power}, - weapon:{$curr.weapon}, - armor:{$curr.armor} - {if isset($curr.hero)} - ,hero:1 - {/if} - {if isset($curr.expansion)} - ,expansion:{$curr.expansion} - {/if} - {rdelim} - {if $smarty.foreach.i.last}{else},{/if} - {/foreach} - ] - {rdelim}); -{/strip} \ No newline at end of file diff --git a/template/bricks/globals/achievements.tpl b/template/bricks/globals/achievements.tpl new file mode 100644 index 00000000..e815dc1a --- /dev/null +++ b/template/bricks/globals/achievements.tpl @@ -0,0 +1,9 @@ +var _ = g_achievements; +{strip} +{foreach from=$data key=id item=item} + _[{$id}]={ldelim} + name_{$user.language}:'{$item.name|escape:"javascript"}', + icon:'{$item.icon|escape:"javascript"}' + {rdelim}; +{/foreach} +{/strip} diff --git a/template/bricks/globals/classes.tpl b/template/bricks/globals/classes.tpl new file mode 100644 index 00000000..98612d9f --- /dev/null +++ b/template/bricks/globals/classes.tpl @@ -0,0 +1,8 @@ +var _ = g_classes; +{strip} +{foreach from=$data key=id item=item} + _[{$id}]={ldelim} + name_{$user.language}:'{$item.name|escape:"javascript"}' + {rdelim}; +{/foreach} +{/strip} diff --git a/template/bricks/globals/currencies.tpl b/template/bricks/globals/currencies.tpl new file mode 100644 index 00000000..e7f08632 --- /dev/null +++ b/template/bricks/globals/currencies.tpl @@ -0,0 +1,9 @@ +var _ = g_gatheredcurrencies; +{strip} +{foreach from=$data key=id item=item} + _[{$id}]={ldelim} + name_{$user.language}:'{$item.name|escape:"javascript"}', + icon:'{$item.icon|escape:"javascript"}' + {rdelim}; +{/foreach} +{/strip} \ No newline at end of file diff --git a/template/bricks/allholidays_table.tpl b/template/bricks/globals/holidays.tpl similarity index 100% rename from template/bricks/allholidays_table.tpl rename to template/bricks/globals/holidays.tpl diff --git a/template/bricks/globals/items.tpl b/template/bricks/globals/items.tpl new file mode 100644 index 00000000..5bb5859b --- /dev/null +++ b/template/bricks/globals/items.tpl @@ -0,0 +1,10 @@ +var _ = g_items; +{strip} +{foreach from=$data key=id item=item} + _[{$id}]={ldelim} + name_{$user.language}:'{$item.name|escape:"javascript"}', + icon:'{$item.icon|escape:"javascript"}' + {if isset($item.quality)}, quality:'{$item.quality}'{/if} + {rdelim}; +{/foreach} +{/strip} diff --git a/template/bricks/globals/races.tpl b/template/bricks/globals/races.tpl new file mode 100644 index 00000000..3bb9a662 --- /dev/null +++ b/template/bricks/globals/races.tpl @@ -0,0 +1,8 @@ +var _ = g_races; +{strip} +{foreach from=$data key=id item=item} + _[{$id}]={ldelim} + name_{$user.language}:'{$item.name|escape:"javascript"}' + {rdelim}; +{/foreach} +{/strip} diff --git a/template/bricks/globals/spells.tpl b/template/bricks/globals/spells.tpl new file mode 100644 index 00000000..23b163ee --- /dev/null +++ b/template/bricks/globals/spells.tpl @@ -0,0 +1,9 @@ +var _ = g_spells; +{strip} +{foreach from=$data key=id item=item} + _[{$id}]={ldelim} + name_{$user.language}:'{$item.name|escape:"javascript"}', + icon:'{$item.icon|escape:"javascript"}' + {rdelim}; +{/foreach} +{/strip} diff --git a/template/bricks/alltitles_table.tpl b/template/bricks/globals/titles.tpl similarity index 100% rename from template/bricks/alltitles_table.tpl rename to template/bricks/globals/titles.tpl diff --git a/template/bricks/infobox.tpl b/template/bricks/infobox.tpl index 3179eb5a..529a6b2f 100644 --- a/template/bricks/infobox.tpl +++ b/template/bricks/infobox.tpl @@ -9,5 +9,5 @@ \ No newline at end of file diff --git a/template/bricks/itemset_table.tpl b/template/bricks/itemset_table.tpl deleted file mode 100644 index f28235c3..00000000 --- a/template/bricks/itemset_table.tpl +++ /dev/null @@ -1,33 +0,0 @@ -{strip} - new Listview({ldelim} - template:'itemset', - {if !isset($params.id)}id:'itemsets',{/if} - {if !isset($params.tabs)}tabs:'listview-generic',{/if} - {if !isset($params.name)}name:LANG.tab_itemsets,{/if} - {if !isset($params.parent)}parent:'listview-generic',{/if} - {if isset($params.note)}_truncated: 1,{/if} - {foreach from=$params key=k item=v} - {if $v[0] == '$'} - {$k}:{$v|substr:1}, - {else if $v} - {$k}:'{$v}', - {/if} - {/foreach} - data:[ - {foreach name=i from=$data item=curr} - {ldelim} - name:'{$curr.quality}{$curr.name|escape:"quotes"}', - {if $curr.minlevel}minlevel:{$curr.minlevel},{/if} - {if $curr.maxlevel}maxlevel:{$curr.maxlevel},{/if} - {if $curr.classes}classes:[{section name=j loop=$curr.classes}{$curr.classes[j]}{if $smarty.section.j.last}{else},{/if}{/section}],{/if} - {if $curr.reqclass}reqclass:{$curr.reqclass},{/if} - {if $curr.note}note:{$curr.note},{/if} - {if $curr.pieces}pieces:[{section name=j loop=$curr.pieces}{$curr.pieces[j]}{if $smarty.section.j.last}{else},{/if}{/section}],{/if} - {if isset($curr.type)}type:{$curr.type},{/if} - id:{$curr.id} - {rdelim} - {if $smarty.foreach.i.last}{else},{/if} - {/foreach} - ] - {rdelim}); -{/strip} diff --git a/template/bricks/achievement_table.tpl b/template/bricks/listviews/achievement.tpl similarity index 100% rename from template/bricks/achievement_table.tpl rename to template/bricks/listviews/achievement.tpl diff --git a/template/bricks/calendar_table.tpl b/template/bricks/listviews/calendar.tpl similarity index 100% rename from template/bricks/calendar_table.tpl rename to template/bricks/listviews/calendar.tpl diff --git a/template/bricks/listviews/class.tpl b/template/bricks/listviews/class.tpl new file mode 100644 index 00000000..e0863635 --- /dev/null +++ b/template/bricks/listviews/class.tpl @@ -0,0 +1,37 @@ +{strip} + new Listview({ldelim} + template:'classs', + {if !isset($params.id)}id:'classes',{/if} + {if !isset($params.tabs)}tabs:'listview-generic',{/if} + {if !isset($params.name)}name:LANG.tab_classes,{/if} + {if !isset($params.parent)}parent:'listview-generic',{/if} + {if isset($params.note)}_truncated: 1,{/if} + {foreach from=$params key=k item=v} + {if $v[0] == '$'} + {$k}:{$v|substr:1}, + {else if $v} + {$k}:'{$v}', + {/if} + {/foreach} + data:[ + {foreach name=i from=$data item=curr} + {ldelim} + id:{$curr.id}, + name:'{$curr.name|escape:"javascript"}', + races:{$curr.races}, + roles:{$curr.roles}, + power:{$curr.power}, + weapon:{$curr.weapon}, + armor:{$curr.armor} + {if isset($curr.hero)} + ,hero:1 + {/if} + {if isset($curr.expansion)} + ,expansion:{$curr.expansion} + {/if} + {rdelim} + {if $smarty.foreach.i.last}{else},{/if} + {/foreach} + ] + {rdelim}); +{/strip} \ No newline at end of file diff --git a/template/bricks/currency_table.tpl b/template/bricks/listviews/currency.tpl similarity index 100% rename from template/bricks/currency_table.tpl rename to template/bricks/listviews/currency.tpl diff --git a/template/bricks/event_table.tpl b/template/bricks/listviews/event.tpl similarity index 100% rename from template/bricks/event_table.tpl rename to template/bricks/listviews/event.tpl diff --git a/template/bricks/item_table.tpl b/template/bricks/listviews/item.tpl similarity index 72% rename from template/bricks/item_table.tpl rename to template/bricks/listviews/item.tpl index 52328fb6..a9384bf6 100644 --- a/template/bricks/item_table.tpl +++ b/template/bricks/listviews/item.tpl @@ -16,7 +16,7 @@ data:[ {foreach name=i from=$data item=curr} {ldelim} - name:'{$curr.quality}{$curr.name|escape:"quotes"}', + name:'{$curr.name|escape:"quotes"}', {if isset($curr.level)} level:{$curr.level}, {/if} @@ -83,35 +83,35 @@ {* 4.3 loot-example - template: 'item', - id: 'drops', - name: LANG.tab_drops, - tabs: tabsRelated, - parent: 'lkljbjkb574', - extraCols: [Listview.extraCols.count, Listview.extraCols.percent], - sort:['-percent', 'name'], - _totalCount: 448092, /* total # creature killed/looted */ - computeDataFunc: Listview.funcBox.initLootTable, - onAfterCreate: Listview.funcBox.addModeIndicator, - data: [ - { - "classs":15, /* Tab Type */ - "commondrop":true, /* loot filtered as "not noteworthy" */ - "id":25445, - "level":1, - "name":"7Wretched Ichor", - "slot":0, - "source":[2], /* 1: crafted; 2:zonedrop; 3:pvp; 4:quest; 5: Vendors; 6:Trainer; 7:Discovery; 8:Redemption; 9: Talent; 10:Starter; 11: Event; 12:Achievement; */ - "sourcemore":[{"z":3520}], /* z: zone... */ - "subclass":0, /* Tab:Type */ - modes:{ - "mode":4, /* &1: heroic; &4: noteworthy(?); &8: reg10; &16: reg25; &32: hc10; &64: hc25; &128: RaidFinder */ - "4":{"count":363318,"outof":448092} /* calculate pct chance */ - }, - count:363318, - stack:[1,1], /* [min, max] */ - pctstack:'{1: 50.0123,2: 49.9877}' /* {dropCount: relChanceForThisStack} */ + template: 'item', + id: 'drops', + name: LANG.tab_drops, + tabs: tabsRelated, + parent: 'lkljbjkb574', + extraCols: [Listview.extraCols.count, Listview.extraCols.percent], + sort:['-percent', 'name'], + _totalCount: 448092, /* total # creature killed/looted */ + computeDataFunc: Listview.funcBox.initLootTable, + onAfterCreate: Listview.funcBox.addModeIndicator, + data: [ + { + "classs":15, /* Tab Type */ + "commondrop":true, /* loot filtered as "not noteworthy" */ + "id":25445, + "level":1, + "name":"7Wretched Ichor", + "slot":0, + "source":[2], /* 1: crafted; 2:zonedrop; 3:pvp; 4:quest; 5: Vendors; 6:Trainer; 7:Discovery; 8:Redemption; 9: Talent; 10:Starter; 11: Event; 12:Achievement; */ + "sourcemore":[{"z":3520}], /* z: zone... */ + "subclass":0, /* Tab:Type */ + modes:{ + "mode":4, /* &1: heroic; &4: noteworthy(?); &8: reg10; &16: reg25; &32: hc10; &64: hc25; &128: RaidFinder */ + "4":{"count":363318,"outof":448092} /* calculate pct chance */ + }, + count:363318, + stack:[1,1], /* [min, max] */ + pctstack:'{1: 50.0123,2: 49.9877}' /* {dropCount: relChanceForThisStack} */ } - ] + ] }); *} \ No newline at end of file diff --git a/template/bricks/listviews/itemset.tpl b/template/bricks/listviews/itemset.tpl new file mode 100644 index 00000000..0c846932 --- /dev/null +++ b/template/bricks/listviews/itemset.tpl @@ -0,0 +1,34 @@ +{strip} + new Listview({ldelim} + template:'itemset', + {if !isset($params.id)}id:'itemsets',{/if} + {if !isset($params.tabs)}tabs:'listview-generic',{/if} + {if !isset($params.name)}name:LANG.tab_itemsets,{/if} + {if !isset($params.parent)}parent:'listview-generic',{/if} + {if isset($params.note)}_truncated: 1,{/if} + {foreach from=$params key=k item=v} + {if $v[0] == '$'} + {$k}:{$v|substr:1}, + {else if $v} + {$k}:'{$v}', + {/if} + {/foreach} + data:[ + {foreach name=i from=$data item=curr} + {ldelim} + name:'{$curr.quality}{$curr.name|escape:"quotes"}', + {if $curr.minlevel}minlevel:{$curr.minlevel},{/if} + {if $curr.maxlevel}maxlevel:{$curr.maxlevel},{/if} + {if $curr.classes}classes:[{section name=j loop=$curr.classes}{$curr.classes[j]}{if $smarty.section.j.last}{else},{/if}{/section}],{/if} + {if $curr.reqclass}reqclass:{$curr.reqclass},{/if} + {if $curr.note}note:{$curr.note},{/if} + {if $curr.pieces}pieces:[{section name=j loop=$curr.pieces}{$curr.pieces[j]}{if $smarty.section.j.last}{else},{/if}{/section}],{/if} + {if isset($curr.type)}type:{$curr.type},{/if} + heroic:{if isset($curr.heroic) && $curr.heroic == 1}true{else}false{/if}, + id:{$curr.id} + {rdelim} + {if $smarty.foreach.i.last}{else},{/if} + {/foreach} + ] + {rdelim}); +{/strip} diff --git a/template/bricks/quest_table.tpl b/template/bricks/listviews/quest.tpl similarity index 100% rename from template/bricks/quest_table.tpl rename to template/bricks/listviews/quest.tpl diff --git a/template/bricks/listviews/race.tpl b/template/bricks/listviews/race.tpl new file mode 100644 index 00000000..c60db91f --- /dev/null +++ b/template/bricks/listviews/race.tpl @@ -0,0 +1,34 @@ +{strip} + new Listview({ldelim} + template:'race', + {if !isset($params.id)}id:'races',{/if} + {if !isset($params.tabs)}tabs:'listview-generic',{/if} + {if !isset($params.name)}name:LANG.tab_races,{/if} + {if !isset($params.parent)}parent:'listview-generic',{/if} + {if isset($params.note)}_truncated: 1,{/if} + {foreach from=$params key=k item=v} + {if $v[0] == '$'} + {$k}:{$v|substr:1}, + {else if $v} + {$k}:'{$v}', + {/if} + {/foreach} + data:[ + {foreach name=i from=$data item=curr} + {ldelim} + id:{$curr.id}, + name:'{$curr.name|escape:"javascript"}', + classes:{$curr.classes}, + faction:{$curr.faction}, + leader:{$curr.leader}, + zone:{$curr.zone}, + side:{$curr.side} + {if isset($curr.expansion)} + ,expansion:{$curr.expansion} + {/if} + {rdelim} + {if $smarty.foreach.i.last}{else},{/if} + {/foreach} + ] + {rdelim}); +{/strip} diff --git a/template/bricks/title_table.tpl b/template/bricks/listviews/title.tpl similarity index 100% rename from template/bricks/title_table.tpl rename to template/bricks/listviews/title.tpl diff --git a/template/bricks/race_table.tpl b/template/bricks/race_table.tpl deleted file mode 100644 index 3b56dfa9..00000000 --- a/template/bricks/race_table.tpl +++ /dev/null @@ -1,34 +0,0 @@ -{strip} - new Listview({ldelim} - template:'race', - {if !isset($params.id)}id:'races',{/if} - {if !isset($params.tabs)}tabs:'listview-generic',{/if} - {if !isset($params.name)}name:LANG.tab_races,{/if} - {if !isset($params.parent)}parent:'listview-generic',{/if} - {if isset($params.note)}_truncated: 1,{/if} - {foreach from=$params key=k item=v} - {if $v[0] == '$'} - {$k}:{$v|substr:1}, - {else if $v} - {$k}:'{$v}', - {/if} - {/foreach} - data:[ - {foreach name=i from=$data item=curr} - {ldelim} - id:{$curr.id}, - name:'{$curr.name|escape:"javascript"}', - classes:{$curr.classes}, - faction:{$curr.faction}, - leader:{$curr.leader}, - zone:{$curr.zone}, - side:{$curr.side} - {if isset($curr.expansion)} - ,expansion:{$curr.expansion} - {/if} - {rdelim} - {if $smarty.foreach.i.last}{else},{/if} - {/foreach} - ] - {rdelim}); -{/strip} diff --git a/template/compare.tpl b/template/compare.tpl index d39a4157..3d093b86 100644 --- a/template/compare.tpl +++ b/template/compare.tpl @@ -13,10 +13,10 @@
diff --git a/template/events.tpl b/template/events.tpl deleted file mode 100644 index 4c6d2c49..00000000 --- a/template/events.tpl +++ /dev/null @@ -1,29 +0,0 @@ -{include file='header.tpl'} - -
-
-
-{if !empty($announcements)} - {foreach from=$announcements item=item} - {include file='bricks/announcement.tpl' an=$item} - {/foreach} -{/if} - - -
-
- - - -
-
-
- -{include file='footer.tpl'} diff --git a/template/titles.tpl b/template/generic-no-filter.tpl similarity index 52% rename from template/titles.tpl rename to template/generic-no-filter.tpl index ace03734..8d0066c0 100644 --- a/template/titles.tpl +++ b/template/generic-no-filter.tpl @@ -1,20 +1,27 @@ {include file='header.tpl'} +{assign var="file" value=$lvData.file}
+ {if !empty($announcements)} {foreach from=$announcements item=item} {include file='bricks/announcement.tpl' an=$item} {/foreach} {/if} + -
+
+
diff --git a/template/head.tpl b/template/head.tpl index 975f7ad3..63f0141d 100644 --- a/template/head.tpl +++ b/template/head.tpl @@ -1,4 +1,4 @@ - {if $page.title}{$page.title|escape:"html"} - {/if}{$app_name} + {if $page.title}{$page.title|escape:"html"} - {/if}{$appName} diff --git a/template/header.tpl b/template/header.tpl index 317c004c..40abff9a 100644 --- a/template/header.tpl +++ b/template/header.tpl @@ -31,13 +31,13 @@ {strip}{/strip} diff --git a/template/search.tpl b/template/search.tpl index 8210b56e..c15836c1 100644 --- a/template/search.tpl +++ b/template/search.tpl @@ -17,28 +17,28 @@
{else} diff --git a/template/title.tpl b/template/title.tpl index 55586c3f..25a0ae92 100644 --- a/template/title.tpl +++ b/template/title.tpl @@ -11,18 +11,18 @@ {include file='bricks/infobox.tpl'}
- + {$lang.link}{$lang.link} WowheadWowhead -

{if isset($data.page.expansion)}{$data.page.name}{else}{$data.page.name}{/if}

+

{if isset($lvData.page.expansion)}{$lvData.page.name}{else}{$lvData.page.name}{/if}

{$lang.related}

@@ -30,8 +30,8 @@