Templates/Listviews

* removed most templates by sensibly restructuring lvTab-data. Util::toJSON() does the rest.
 * taught Util::toJSON() to recognize values prefixed with $ as js-code
 * use Util::toJSON whenever possible
 * misc
   - mail attachments are displyed again
   - always show all currency rewards on Quest-LVs
   - suppress an error, when encountering unused ItemMods
This commit is contained in:
Sarjuuk
2016-02-10 00:14:55 +01:00
parent fe7f05c89c
commit 08717c36d0
97 changed files with 1638 additions and 2624 deletions

View File

@@ -312,10 +312,10 @@ class Loot
break; break;
} }
$this->extraCols[] = "Listview.funcBox.createSimpleCol('group', 'Group', '7%', 'group')"; $this->extraCols[] = "\$Listview.funcBox.createSimpleCol('group', 'Group', '7%', 'group')";
foreach ($fields as $idx => $field) foreach ($fields as $idx => $field)
if ($set & (1 << $idx)) if ($set & (1 << $idx))
$this->extraCols[] = "Listview.funcBox.createSimpleCol('".$field."', '".Util::ucFirst($field)."', '7%', '".$field."')"; $this->extraCols[] = "\$Listview.funcBox.createSimpleCol('".$field."', '".Util::ucFirst($field)."', '7%', '".$field."')";
} }
return true; return true;
@@ -505,7 +505,7 @@ class Loot
} }
$tabsFinal[$tabId][1][] = array_merge($srcData[$srcObj->id], $result[$srcObj->getField('lootId')]); $tabsFinal[$tabId][1][] = array_merge($srcData[$srcObj->id], $result[$srcObj->getField('lootId')]);
$tabsFinal[$tabId][4][] = 'Listview.extraCols.percent'; $tabsFinal[$tabId][4][] = '$Listview.extraCols.percent';
if ($tabId != 15) if ($tabId != 15)
$tabsFinal[$tabId][6][] = 'skill'; $tabsFinal[$tabId][6][] = 'skill';
} }
@@ -563,7 +563,7 @@ class Loot
$srcData = $srcObj->getListviewData(); $srcData = $srcObj->getListviewData();
if (!empty($result)) if (!empty($result))
$tabsFinal[16][4][] = 'Listview.extraCols.percent'; $tabsFinal[16][4][] = '$Listview.extraCols.percent';
if ($srcObj->hasSetFields(['reagent1'])) if ($srcObj->hasSetFields(['reagent1']))
$tabsFinal[16][6][] = 'reagents'; $tabsFinal[16][6][] = 'reagents';
@@ -601,14 +601,33 @@ class Loot
$tabId = abs($tabId); // general case (skinning) $tabId = abs($tabId); // general case (skinning)
$tabsFinal[$tabId][1][] = array_merge($srcData[$srcObj->id], $result[$srcObj->getField($field)]); $tabsFinal[$tabId][1][] = array_merge($srcData[$srcObj->id], $result[$srcObj->getField($field)]);
$tabsFinal[$tabId][4][] = 'Listview.extraCols.percent'; $tabsFinal[$tabId][4][] = '$Listview.extraCols.percent';
} }
} }
break; break;
} }
} }
$this->results = $tabsFinal; foreach ($tabsFinal as $tabId => $data)
{
$tabData = array(
'data' => $data[1],
'name' => $data[2],
'id' => $data[3]
);
if ($data[4])
$tabData['extraCols'] = array_unique($data[4]);
if ($data[5])
$tabData['hiddenCols'] = array_unique($data[5]);
if ($data[6])
$tabData['visibleCols'] = array_unique($data[6]);
$this->results[$tabId] = [$data[0], $tabData];
}
return true; return true;
} }

View File

@@ -1,6 +1,6 @@
<?php <?php
define('AOWOW_REVISION', 16); define('AOWOW_REVISION', 17);
define('CLI', PHP_SAPI === 'cli'); define('CLI', PHP_SAPI === 'cli');

View File

@@ -1318,11 +1318,19 @@ class ItemList extends BaseType
$reqLvl = $this->curTpl['requiredLevel'] > 1 ? $this->curTpl['requiredLevel'] : MAX_LEVEL; $reqLvl = $this->curTpl['requiredLevel'] > 1 ? $this->curTpl['requiredLevel'] : MAX_LEVEL;
$level = min(max($reqLvl, $ssdLvl), MAX_LEVEL); $level = min(max($reqLvl, $ssdLvl), MAX_LEVEL);
if (!Lang::item('statType', $type)) // unknown rating // unknown rating
if (in_array($type, [2, 8, 9, 10, 11]) || $type > ITEM_MOD_BLOCK_VALUE || $type < 0)
{
if (User::isInGroup(U_GROUP_EMPLOYEE))
return sprintf(Lang::item('statType', count(Lang::item('statType')) - 1), $type, $value); return sprintf(Lang::item('statType', count(Lang::item('statType')) - 1), $type, $value);
else if (in_array($type, Util::$lvlIndepRating)) // level independant Bonus else
return null;
}
// level independant Bonus
else if (in_array($type, Util::$lvlIndepRating))
return Lang::item('trigger', 1).str_replace('%d', '<!--rtg'.$type.'-->'.$value, Lang::item('statType', $type)); return Lang::item('trigger', 1).str_replace('%d', '<!--rtg'.$type.'-->'.$value, Lang::item('statType', $type));
else // rating-Bonuses // rating-Bonuses
else
{ {
$scaling = true; $scaling = true;

View File

@@ -400,10 +400,8 @@ class QuestList extends BaseType
// currencies // currencies
if (!empty($this->rewards[$this->id][TYPE_CURRENCY])) if (!empty($this->rewards[$this->id][TYPE_CURRENCY]))
{ foreach ($this->rewards[$this->id][TYPE_CURRENCY] as $id => $__)
$_ = $this->rewards[$this->id][TYPE_CURRENCY]; $data[TYPE_CURRENCY][$id] = $id;
$data[TYPE_CURRENCY] = array_combine(array_keys($_), array_keys($_));
}
} }
if ($addMask & GLOBALINFO_SELF) if ($addMask & GLOBALINFO_SELF)

View File

@@ -1576,10 +1576,13 @@ class Util
if (CFG_DEBUG) if (CFG_DEBUG)
$flags |= JSON_PRETTY_PRINT; $flags |= JSON_PRETTY_PRINT;
// just a thought: .. about prefixing variables with $ to mark them as function code and retroactively stripping escapes from them $json = json_encode($data, $flags);
// like it's done already in with listviews for example
return json_encode($data, $flags); // handle strings prefixed with $ as js-variables
// literal: match everything (lazy) between first pair of unescaped double quotes. First character must be $.
$json = preg_replace_callback('/(?<!\\\\)"\$(.+?)(?<!\\\\)"/i', function($m) { return str_replace('\"', '"', $m[1]); }, $json);
return $json;
} }
public static function checkOrCreateDirectory($path) public static function checkOrCreateDirectory($path)

View File

@@ -47,7 +47,6 @@ class Lang
self::$item['cat'][2][1][14] .= ' ('.self::$item['cat'][2][0].')'; self::$item['cat'][2][1][14] .= ' ('.self::$item['cat'][2][0].')';
} }
// todo: make static props private and access through this
public static function __callStatic($prop, $args) public static function __callStatic($prop, $args)
{ {
if (!isset(self::$$prop)) if (!isset(self::$$prop))

View File

@@ -578,6 +578,7 @@ $lang = array(
'spellLearn' => "Ihr erlernt", 'spellLearn' => "Ihr erlernt",
'bonusTalents' => "Talentpunkte", 'bonusTalents' => "Talentpunkte",
'spellDisplayed'=> ' (<a href="?spell=%d">%s</a> wird angezeigt)', 'spellDisplayed'=> ' (<a href="?spell=%d">%s</a> wird angezeigt)',
'attachment' => "Anlage",
'questInfo' => array( 'questInfo' => array(
0 => "Normal", 1 => "Gruppe", 21 => "Leben", 41 => "PvP", 62 => "Schlachtzug", 81 => "Dungeon", 82 => "Weltereignis", 0 => "Normal", 1 => "Gruppe", 21 => "Leben", 41 => "PvP", 62 => "Schlachtzug", 81 => "Dungeon", 82 => "Weltereignis",
83 => "Legendär", 84 => "Eskorte", 85 => "Heroisch", 88 => "Schlachtzug (10)", 89 => "Schlachtzug (25)" 83 => "Legendär", 84 => "Eskorte", 85 => "Heroisch", 88 => "Schlachtzug (10)", 89 => "Schlachtzug (25)"
@@ -761,6 +762,8 @@ $lang = array(
'pctCostOf' => "vom Grund%s", 'pctCostOf' => "vom Grund%s",
'costPerSec' => ", plus %s pro Sekunde", 'costPerSec' => ", plus %s pro Sekunde",
'costPerLevel' => ", plus %s pro Stufe", 'costPerLevel' => ", plus %s pro Stufe",
'stackGroup' => "Stack Gruppierung",
'linkedWith' => "Verknüpft mit",
'_scaling' => "Skalierung", '_scaling' => "Skalierung",
'scaling' => array( 'scaling' => array(
'directSP' => "+%.2f%% der Zaubermacht zum direkten Effekt", 'directAP' => "+%.2f%% der Angriffskraft zum direkten Effekt", 'directSP' => "+%.2f%% der Zaubermacht zum direkten Effekt", 'directAP' => "+%.2f%% der Angriffskraft zum direkten Effekt",

View File

@@ -573,6 +573,7 @@ $lang = array(
'spellLearn' => "You will learn", 'spellLearn' => "You will learn",
'bonusTalents' => "talent points", 'bonusTalents' => "talent points",
'spellDisplayed'=> ' (<a href="?spell=%d">%s</a> is displayed)', 'spellDisplayed'=> ' (<a href="?spell=%d">%s</a> is displayed)',
'attachment' => "Attachment",
'questInfo' => array( 'questInfo' => array(
0 => "Normal", 1 => "Group", 21 => "Life", 41 => "PvP", 62 => "Raid", 81 => "Dungeon", 82 => "World Event", 0 => "Normal", 1 => "Group", 21 => "Life", 41 => "PvP", 62 => "Raid", 81 => "Dungeon", 82 => "World Event",
83 => "Legendary", 84 => "Escort", 85 => "Heroic", 88 => "Raid (10)", 89 => "Raid (25)" 83 => "Legendary", 84 => "Escort", 85 => "Heroic", 88 => "Raid (10)", 89 => "Raid (25)"
@@ -756,6 +757,8 @@ $lang = array(
'pctCostOf' => "of base %s", 'pctCostOf' => "of base %s",
'costPerSec' => ", plus %s per sec", 'costPerSec' => ", plus %s per sec",
'costPerLevel' => ", plus %s per level", 'costPerLevel' => ", plus %s per level",
'stackGroup' => "Stack Group",
'linkedWith' => "Linked with",
'_scaling' => "Scaling", '_scaling' => "Scaling",
'scaling' => array( 'scaling' => array(
'directSP' => "+%.2f%% of spell power to direct component", 'directAP' => "+%.2f%% of attack power to direct component", 'directSP' => "+%.2f%% of spell power to direct component", 'directAP' => "+%.2f%% of attack power to direct component",

View File

@@ -577,6 +577,7 @@ $lang = array(
'spellLearn' => "Aprenderás", 'spellLearn' => "Aprenderás",
'bonusTalents' => "puntos de talento", 'bonusTalents' => "puntos de talento",
'spellDisplayed'=> ' (mostrando <a href="?spell=%d">%s</a>)', 'spellDisplayed'=> ' (mostrando <a href="?spell=%d">%s</a>)',
'attachment' => "[Attachment]",
'questInfo' => array( 'questInfo' => array(
0 => "Normal", 1 => "Élite", 21 => "Vida", 41 => "JcJ", 62 => "Banda", 81 => "Mazmorra", 82 => "Evento del mundo", 0 => "Normal", 1 => "Élite", 21 => "Vida", 41 => "JcJ", 62 => "Banda", 81 => "Mazmorra", 82 => "Evento del mundo",
83 => "Legendaria", 84 => "Escolta", 85 => "Heroica", 88 => "Banda (10)", 89 => "Banda (25)" 83 => "Legendaria", 84 => "Escolta", 85 => "Heroica", 88 => "Banda (10)", 89 => "Banda (25)"
@@ -760,6 +761,8 @@ $lang = array(
'pctCostOf' => "del %s base", 'pctCostOf' => "del %s base",
'costPerSec' => ", mas %s por segundo", 'costPerSec' => ", mas %s por segundo",
'costPerLevel' => ", mas %s por nivel", 'costPerLevel' => ", mas %s por nivel",
'stackGroup' => "[Stack Group]",
'linkedWith' => "[Linked with]",
'_scaling' => "[Scaling]", '_scaling' => "[Scaling]",
'scaling' => array( 'scaling' => array(
'directSP' => "[+%.2f%% of spell power to direct component]", 'directAP' => "[+%.2f%% of attack power to direct component]", 'directSP' => "[+%.2f%% of spell power to direct component]", 'directAP' => "[+%.2f%% of attack power to direct component]",

View File

@@ -576,6 +576,7 @@ $lang = array(
'spellLearn' => "Vous apprendrez", 'spellLearn' => "Vous apprendrez",
'bonusTalents' => "points de talent", 'bonusTalents' => "points de talent",
'spellDisplayed'=> ' (<a href="?spell=%d">%s</a> affichés)', 'spellDisplayed'=> ' (<a href="?spell=%d">%s</a> affichés)',
'attachment' => "[Attachment]",
'questInfo' => array( 'questInfo' => array(
0 => "Standard", 1 => "Groupe", 21 => "Vie", 41 => "JcJ", 62 => "Raid", 81 => "Donjon", 82 => "Évènement mondial", 0 => "Standard", 1 => "Groupe", 21 => "Vie", 41 => "JcJ", 62 => "Raid", 81 => "Donjon", 82 => "Évènement mondial",
83 => "Légendaire", 84 => "Escorte", 85 => "Héroïque", 88 => "Raid (10)", 89 => "Raid (25)" 83 => "Légendaire", 84 => "Escorte", 85 => "Héroïque", 88 => "Raid (10)", 89 => "Raid (25)"
@@ -758,6 +759,8 @@ $lang = array(
'pctCostOf' => "de la %s de base", 'pctCostOf' => "de la %s de base",
'costPerSec' => ", plus %s par seconde", 'costPerSec' => ", plus %s par seconde",
'costPerLevel' => ", plus %s par niveau", 'costPerLevel' => ", plus %s par niveau",
'stackGroup' => "[Stack Group]",
'linkedWith' => "[Linked with]",
'_scaling' => "[Scaling]", '_scaling' => "[Scaling]",
'scaling' => array( 'scaling' => array(
'directSP' => "+%.2f%% de la puissance des sorts directe", 'directAP' => "+%.2f%% de la puissance d'attaque directe", 'directSP' => "+%.2f%% de la puissance des sorts directe", 'directAP' => "+%.2f%% de la puissance d'attaque directe",

View File

@@ -576,6 +576,7 @@ $lang = array(
'spellLearn' => "Вы изучите", 'spellLearn' => "Вы изучите",
'bonusTalents' => "очков талантов", 'bonusTalents' => "очков талантов",
'spellDisplayed'=> ' (показано: <a href="?spell=%d">%s</a>)', 'spellDisplayed'=> ' (показано: <a href="?spell=%d">%s</a>)',
'attachment' => "[Attachment]",
'questInfo' => array( 'questInfo' => array(
0 => "Обычный", 1 => "Группа", 21 => "Жизнь", 41 => "PvP", 62 => "Рейд", 81 => "Подземелье", 82 => "Игровое событие", 0 => "Обычный", 1 => "Группа", 21 => "Жизнь", 41 => "PvP", 62 => "Рейд", 81 => "Подземелье", 82 => "Игровое событие",
83 => "Легенда", 84 => "Сопровождение", 85 => "Героическое", 88 => "Рейд (10)", 89 => "Рейд (25)" 83 => "Легенда", 84 => "Сопровождение", 85 => "Героическое", 88 => "Рейд (10)", 89 => "Рейд (25)"
@@ -760,6 +761,8 @@ $lang = array(
'pctCostOf' => "от базовой %s", 'pctCostOf' => "от базовой %s",
'costPerSec' => ", плюс %s в секунду", 'costPerSec' => ", плюс %s в секунду",
'costPerLevel' => ", плюс %s за уровень", 'costPerLevel' => ", плюс %s за уровень",
'stackGroup' => "[Stack Group]",
'linkedWith' => "[Linked with]",
'_scaling' => "[Scaling]", '_scaling' => "[Scaling]",
'scaling' => array( 'scaling' => array(
'directSP' => "[+%.2f%% of spell power to direct component]", 'directAP' => "[+%.2f%% of attack power to direct component]", 'directSP' => "[+%.2f%% of spell power to direct component]", 'directAP' => "[+%.2f%% of attack power to direct component]",

View File

@@ -218,7 +218,6 @@ class AccountPage extends GenericPage
/* Listview */ /* Listview */
/************/ /************/
$this->lvTabs = [];
$this->forceTabs = true; $this->forceTabs = true;
// Reputation changelog (params only for comment-events) // Reputation changelog (params only for comment-events)
@@ -227,11 +226,7 @@ class AccountPage extends GenericPage
foreach ($repData as &$r) foreach ($repData as &$r)
$r['when'] = date(Util::$dateFormatInternal, $r['when']); $r['when'] = date(Util::$dateFormatInternal, $r['when']);
$this->lvTabs[] = array( $this->lvTabs[] = ['reputationhistory', ['data' => $repData]];
'file' => 'reputationhistory',
'data' => $repData,
'params' => []
);
} }
// comments // comments
@@ -241,14 +236,11 @@ class AccountPage extends GenericPage
// _totalCount: 377, // _totalCount: 377,
// note: $WH.sprintf(LANG.lvnote_usercomments, 377), // note: $WH.sprintf(LANG.lvnote_usercomments, 377),
$this->lvTabs[] = array( $this->lvTabs[] = ['commentpreview', array(
'file' => 'commentpreview',
'data' => $_, 'data' => $_,
'params' => array( 'hiddenCols' => ['author'],
'hiddenCols' => "$['author']",
'onBeforeCreate' => '$Listview.funcBox.beforeUserComments' 'onBeforeCreate' => '$Listview.funcBox.beforeUserComments'
) )];
);
} }
// replies // replies
@@ -259,13 +251,10 @@ class AccountPage extends GenericPage
// _totalCount: 377, // _totalCount: 377,
// note: $WH.sprintf(LANG.lvnote_usercomments, 377), // note: $WH.sprintf(LANG.lvnote_usercomments, 377),
$this->lvTabs[] = array( $this->lvTabs[] = ['replypreview', array(
'file' => 'replypreview',
'data' => $_, 'data' => $_,
'params' => array( 'hiddenCols' => ['author']
'hiddenCols' => "$['author']" )];
)
);
} }
/* /*

View File

@@ -219,15 +219,12 @@ class AchievementPage extends GenericPage
['id', $this->typeId, '!'] ['id', $this->typeId, '!']
); );
$saList = new AchievementList($conditions); $saList = new AchievementList($conditions);
$this->lvTabs[] = array( $this->lvTabs[] = ['achievement', array(
'file' => 'achievement', 'data' => array_values($saList->getListviewData()),
'data' => $saList->getListviewData(),
'params' => array(
'id' => 'see-also', 'id' => 'see-also',
'name' => '$LANG.tab_seealso', 'name' => '$LANG.tab_seealso',
'visibleCols' => "$['category']" 'visibleCols' => ['category']
) )];
);
$this->extendGlobalData($saList->getJSGlobals()); $this->extendGlobalData($saList->getJSGlobals());
// tab: criteria of // tab: criteria of
@@ -238,15 +235,12 @@ class AchievementPage extends GenericPage
if (!empty($refs)) if (!empty($refs))
{ {
$coList = new AchievementList(array(['id', $refs])); $coList = new AchievementList(array(['id', $refs]));
$this->lvTabs[] = array( $this->lvTabs[] = ['achievement', array(
'file' => 'achievement', 'data' => array_values($coList->getListviewData()),
'data' => $coList->getListviewData(),
'params' => array(
'id' => 'criteria-of', 'id' => 'criteria-of',
'name' => '$LANG.tab_criteriaof', 'name' => '$LANG.tab_criteriaof',
'visibleCols' => "$['category']" 'visibleCols' => ['category']
) )];
);
$this->extendGlobalData($coList->getJSGlobals()); $this->extendGlobalData($coList->getJSGlobals());
} }

View File

@@ -88,37 +88,33 @@ class AchievementsPage extends GenericPage
$acvList = new AchievementList($conditions); $acvList = new AchievementList($conditions);
} }
$params = $data = []; $tabData = [];
if (!$acvList->error) if (!$acvList->error)
{ {
$data = $acvList->getListviewData(); $tabData['data'] = array_values($acvList->getListviewData());
// fill g_items, g_titles, g_achievements // fill g_items, g_titles, g_achievements
$this->extendGlobalData($acvList->getJSGlobals()); $this->extendGlobalData($acvList->getJSGlobals());
// if we are have different cats display field // if we are have different cats display field
if ($acvList->hasDiffFields(['category'])) if ($acvList->hasDiffFields(['category']))
$params['visibleCols'] = "$['category']"; $tabData['visibleCols'] = ['category'];
if (!empty($this->filter['fi']['extraCols'])) if (!empty($this->filter['fi']['extraCols']))
$params['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)'; $tabData['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
// create note if search limit was exceeded // create note if search limit was exceeded
if ($acvList->getMatches() > CFG_SQL_LIMIT_DEFAULT) if ($acvList->getMatches() > CFG_SQL_LIMIT_DEFAULT)
{ {
$params['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_achievementsfound', $acvList->getMatches(), CFG_SQL_LIMIT_DEFAULT); $tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_achievementsfound', $acvList->getMatches(), CFG_SQL_LIMIT_DEFAULT);
$params['_truncated'] = 1; $tabData['_truncated'] = 1;
} }
if ($this->filterObj->error) if ($this->filterObj->error)
$params['_errors'] = '$1'; $tabData['_errors'] = 1;
} }
$this->lvTabs[] = array( $this->lvTabs[] = ['achievement', $tabData];
'file' => 'achievement',
'data' => $data,
'params' => $params
);
// sort for dropdown-menus in filter // sort for dropdown-menus in filter
Lang::sort('game', 'si'); Lang::sort('game', 'si');

View File

@@ -362,24 +362,18 @@ class AdminPage extends GenericPage
} }
foreach ($mainTab as $n => $t) foreach ($mainTab as $n => $t)
$this->lvTabs[] = array( $this->lvTabs[] = [null, array(
'file' => null,
'data' => $t, 'data' => $t,
'params' => array(
'name' => $n, 'name' => $n,
'id' => Util::urlize($n) 'id' => Util::urlize($n)
) )];
);
foreach ($miscTab as $n => $t) foreach ($miscTab as $n => $t)
$this->lvTabs[] = array( $this->lvTabs[] = [null, array(
'file' => null,
'data' => $t, 'data' => $t,
'params' => array(
'name' => $n, 'name' => $n,
'id' => Util::urlize($n) 'id' => Util::urlize($n)
) )];
);
} }
private function handlePhpInfo() private function handlePhpInfo()
@@ -428,26 +422,20 @@ class AdminPage extends GenericPage
else else
$name .= $p[0]; $name .= $p[0];
$this->lvTabs[] = array( $this->lvTabs[] = [null, array(
'file' => null,
'data' => $body, 'data' => $body,
'params' => array(
'id' => strtolower(strtr($name, [' ' => ''])), 'id' => strtolower(strtr($name, [' ' => ''])),
'name' => $name 'name' => $name
) )];
);
} }
} }
else else
{ {
$this->lvTabs[] = array( $this->lvTabs[] = [null, array(
'file' => null,
'data' => $buff, 'data' => $buff,
'params' => array(
'id' => strtolower($names[$i]), 'id' => strtolower($names[$i]),
'name' => $names[$i] 'name' => $names[$i]
) )];
);
} }
} }
} }

View File

@@ -135,19 +135,16 @@ class ClassPage extends GenericPage
{ {
$this->extendGlobalData($genSpells->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($genSpells->getJSGlobals(GLOBALINFO_SELF));
$this->lvTabs[] = array( $this->lvTabs[] = ['spell', array(
'file' => 'spell', 'data' => array_values($genSpells->getListviewData()),
'data' => $genSpells->getListviewData(),
'params' => array(
'id' => 'spells', 'id' => 'spells',
'name' => '$LANG.tab_spells', 'name' => '$LANG.tab_spells',
'visibleCols' => "$['level', 'schools', 'type', 'classes']", 'visibleCols' => ['level', 'schools', 'type', 'classes'],
'hiddenCols' => "$['reagents', 'skill']", 'hiddenCols' => ['reagents', 'skill'],
'sort' => "$['-level', 'type', 'name']", 'sort' => ['-level', 'type', 'name'],
'computeDataFunc' => '$Listview.funcBox.initSpellFilter', 'computeDataFunc' => '$Listview.funcBox.initSpellFilter',
'onAfterCreate' => '$Listview.funcBox.addSpellIndicator' 'onAfterCreate' => '$Listview.funcBox.addSpellIndicator'
) )];
);
} }
// Tab: Items (grouped) // Tab: Items (grouped)
@@ -156,7 +153,7 @@ class ClassPage extends GenericPage
['requiredClass', $_mask, '&'], ['requiredClass', $_mask, '&'],
[['requiredClass', CLASS_MASK_ALL, '&'], CLASS_MASK_ALL, '!'], [['requiredClass', CLASS_MASK_ALL, '&'], CLASS_MASK_ALL, '!'],
['itemset', 0], // hmm, do or dont..? ['itemset', 0], // hmm, do or dont..?
0 CFG_SQL_LIMIT_NONE
); );
$items = new ItemList($conditions); $items = new ItemList($conditions);
@@ -164,23 +161,21 @@ class ClassPage extends GenericPage
{ {
$this->extendGlobalData($items->getJSGlobals()); $this->extendGlobalData($items->getJSGlobals());
if (!$items->hasDiffFields(['requiredRace'])) $hiddenCols = null;
$hidden = "$['side']"; if ($items->hasDiffFields(['requiredRace']))
$hiddenCols = ['side'];
$this->lvTabs[] = array( $this->lvTabs[] = ['item', array(
'file' => 'item', 'data' => array_values($items->getListviewData()),
'data' => $items->getListviewData(),
'params' => array(
'id' => 'items', 'id' => 'items',
'name' => '$LANG.tab_items', 'name' => '$LANG.tab_items',
'visibleCols' => "$['dps', 'armor', 'slot']", 'visibleCols' => ['dps', 'armor', 'slot'],
'hiddenCols' => isset($hidden) ? $hidden : null, 'hiddenCols' => $hiddenCols,
'computeDataFunc' => '$Listview.funcBox.initSubclassFilter', 'computeDataFunc' => '$Listview.funcBox.initSubclassFilter',
'onAfterCreate' => '$Listview.funcBox.addSubclassIndicator', 'onAfterCreate' => '$Listview.funcBox.addSubclassIndicator',
'note' => sprintf(Util::$filterResultString, '?items&filter=cr=152;crs='.$this->typeId.';crv=0'), 'note' => sprintf(Util::$filterResultString, '?items&filter=cr=152;crs='.$this->typeId.';crv=0'),
'_truncated' => 1 '_truncated' => 1
) )];
);
} }
// Tab: Quests // Tab: Quests
@@ -194,11 +189,10 @@ class ClassPage extends GenericPage
{ {
$this->extendGlobalData($quests->getJSGlobals()); $this->extendGlobalData($quests->getJSGlobals());
$this->lvTabs[] = array( $this->lvTabs[] = ['quest', array(
'file' => 'quest', 'data' => array_values($quests->getListviewData()),
'data' => $quests->getListviewData(), 'sort' => ['reqlevel', 'name']
'params' => ['sort' => "$['reqlevel', 'name']"] )];
);
} }
// Tab: Itemsets // Tab: Itemsets
@@ -207,15 +201,12 @@ class ClassPage extends GenericPage
{ {
$this->extendGlobalData($sets->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($sets->getJSGlobals(GLOBALINFO_SELF));
$this->lvTabs[] = array( $this->lvTabs[] = ['itemset', array(
'file' => 'itemset', 'data' => array_values($sets->getListviewData()),
'data' => $sets->getListviewData(),
'params' => array(
'note' => sprintf(Util::$filterResultString, '?itemsets&filter=cl='.$this->typeId), 'note' => sprintf(Util::$filterResultString, '?itemsets&filter=cl='.$this->typeId),
'hiddenCols' => "$['classes']", 'hiddenCols' => ['classes'],
'sort' => "$['-level', 'name']" 'sort' => ['-level', 'name']
) )];
);
} }
// Tab: Trainer // Tab: Trainer
@@ -228,26 +219,17 @@ class ClassPage extends GenericPage
$trainer = new CreatureList($conditions); $trainer = new CreatureList($conditions);
if (!$trainer->error) if (!$trainer->error)
{ {
$this->lvTabs[] = array( $this->lvTabs[] = ['creature', array(
'file' => 'creature', 'data' => array_values($trainer->getListviewData()),
'data' => $trainer->getListviewData(),
'params' => array(
'id' => 'trainers', 'id' => 'trainers',
'name' => '$LANG.tab_trainers' 'name' => '$LANG.tab_trainers'
) )];
);
} }
// Tab: Races // Tab: Races
$races = new CharRaceList(array(['classMask', $_mask, '&'])); $races = new CharRaceList(array(['classMask', $_mask, '&']));
if (!$races->error) if (!$races->error)
{ $this->lvTabs[] = ['race', ['data' => array_values($races->getListviewData())]];
$this->lvTabs[] = array(
'file' => 'race',
'data' => $races->getListviewData(),
'params' => []
);
}
} }
} }

View File

@@ -27,13 +27,7 @@ class ClassesPage extends GenericPage
{ {
$classes = new CharClassList(); $classes = new CharClassList();
if (!$classes->error) if (!$classes->error)
{ $this->lvTabs[] = ['class', ['data' => array_values($classes->getListviewData())]];
$this->lvTabs[] = array(
'file' => 'class',
'data' => $classes->getListviewData(),
'params' => []
);
}
} }
protected function generateTitle() protected function generateTitle()

View File

@@ -64,7 +64,12 @@ class ComparePage extends GenericPage
$outSet[] = $outString; $outSet[] = $outString;
} }
$this->summary = $outSet; $this->summary = array(
'template' => 'compare',
'id' => 'compare',
'parent' => 'compare-generic',
'groups' => $outSet
);
$iList = new ItemList(array(['i.id', $items])); $iList = new ItemList(array(['i.id', $items]));
$data = $iList->getListviewData(ITEMINFO_SUBITEMS | ITEMINFO_JSON); $data = $iList->getListviewData(ITEMINFO_SUBITEMS | ITEMINFO_JSON);
@@ -78,12 +83,11 @@ class ComparePage extends GenericPage
foreach ($data[$itemId]['subitems'] as &$si) foreach ($data[$itemId]['subitems'] as &$si)
$si['enchantment'] = implode(', ', $si['enchantment']); $si['enchantment'] = implode(', ', $si['enchantment']);
$this->cmpItems[] = [ $this->cmpItems[$itemId] = [
$itemId, 'name_'.User::$localeString => $iList->getField('name', true),
$iList->getField('name', true), 'quality' => $iList->getField('quality'),
$iList->getField('quality'), 'icon' => $iList->getField('iconString'),
$iList->getField('iconString'), 'jsonequip' => $data[$itemId]
$data[$itemId]
]; ];
} }
} }

View File

@@ -37,11 +37,7 @@ class CurrenciesPage extends GenericPage
$conditions[] = ['category', (int)$this->category[0]]; $conditions[] = ['category', (int)$this->category[0]];
$money = new CurrencyList($conditions); $money = new CurrencyList($conditions);
$this->lvTabs[] = array( $this->lvTabs[] = ['currency', ['data' => array_values($money->getListviewData())]];
'file' => 'currency',
'data' => $money->getListviewData(),
'params' => []
);
} }
protected function generateTitle() protected function generateTitle()

View File

@@ -87,20 +87,8 @@ class CurrencyPage extends GenericPage
{ {
$this->extendGlobalData($lootTabs->jsGlobals); $this->extendGlobalData($lootTabs->jsGlobals);
foreach ($lootTabs->iterate() as $tab) foreach ($lootTabs->iterate() as list($file, $tabData))
{ $this->lvTabs[] = [$file, $tabData];
$this->lvTabs[] = array(
'file' => $tab[0],
'data' => $tab[1],
'params' => [
'name' => $tab[2],
'id' => $tab[3],
'extraCols' => $tab[4] ? '$['.implode(', ', array_unique($tab[4])).']' : null,
'hiddenCols' => $tab[5] ? '$['.implode(', ', array_unique($tab[5])).']' : null,
'visibleCols' => $tab[6] ? '$'. Util::toJSON( array_unique($tab[6])) : null
]
);
}
} }
// tab: sold by // tab: sold by
@@ -114,7 +102,7 @@ class CurrencyPage extends GenericPage
if (!$soldBy->error) if (!$soldBy->error)
{ {
$sbData = $soldBy->getListviewData(); $sbData = $soldBy->getListviewData();
$extraCols = ['Listview.extraCols.stock', "Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')", 'Listview.extraCols.cost']; $extraCols = ['$Listview.extraCols.stock', "\$Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')", 'Listview.extraCols.cost'];
$holidays = []; $holidays = [];
foreach ($sbData as $k => &$row) foreach ($sbData as $k => &$row)
@@ -135,7 +123,7 @@ class CurrencyPage extends GenericPage
if ($vendors[$k]['event']) if ($vendors[$k]['event'])
{ {
if (count($extraCols) == 3) // not already pushed if (count($extraCols) == 3) // not already pushed
$extraCols[] = 'Listview.extraCols.condition'; $extraCols[] = '$Listview.extraCols.condition';
$this->extendGlobalIds(TYPE_WORLDEVENT, $vendors[$k]['event']); $this->extendGlobalIds(TYPE_WORLDEVENT, $vendors[$k]['event']);
$row['condition'][0][$this->typeId][] = [[CND_ACTIVE_EVENT, $vendors[$k]['event']]]; $row['condition'][0][$this->typeId][] = [[CND_ACTIVE_EVENT, $vendors[$k]['event']]];
@@ -150,16 +138,13 @@ class CurrencyPage extends GenericPage
); );
} }
$this->lvTabs[] = array( $this->lvTabs[] = ['creature', array(
'file' => 'creature', 'data' => array_values($sbData),
'data' => $sbData,
'params' => [
'name' => '$LANG.tab_soldby', 'name' => '$LANG.tab_soldby',
'id' => 'sold-by-npc', 'id' => 'sold-by-npc',
'extraCols' => '$['.implode(', ', $extraCols).']', 'extraCols' => $extraCols,
'hiddenCols' => "$['level', 'type']" 'hiddenCols' => ['level', 'type']
] )];
);
} }
} }
} }
@@ -172,18 +157,16 @@ class CurrencyPage extends GenericPage
{ {
$this->extendGlobalData($createdBy->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $this->extendGlobalData($createdBy->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
if ($createdBy->hasSetFields(['reagent1'])) $tabData = array(
$visCols = ['reagents']; 'data' => array_values($createdBy->getListviewData()),
$this->lvTabs[] = array(
'file' => 'spell',
'data' => $createdBy->getListviewData(),
'params' => [
'name' => '$LANG.tab_createdby', 'name' => '$LANG.tab_createdby',
'id' => 'created-by', 'id' => 'created-by',
'visibleCols' => isset($visCols) ? '$'.Util::toJSON($visCols) : null
]
); );
if ($createdBy->hasSetFields(['reagent1']))
$tabData['visibleCols'] = ['reagents'];
$this->lvTabs[] = ['spell', $tabData];
} }
} }
@@ -211,20 +194,18 @@ class CurrencyPage extends GenericPage
$boughtBy = new ItemList(array(['id', $boughtBy])); $boughtBy = new ItemList(array(['id', $boughtBy]));
if (!$boughtBy->error) if (!$boughtBy->error)
{ {
if ($boughtBy->getMatches() <= CFG_SQL_LIMIT_DEFAULT) $tabData = array(
$n = null; 'data' => array_values($boughtBy->getListviewData(ITEMINFO_VENDOR, [TYPE_CURRENCY => $this->typeId])),
$this->lvTabs[] = array(
'file' => 'item',
'data' => $boughtBy->getListviewData(ITEMINFO_VENDOR, [TYPE_CURRENCY => $this->typeId]),
'params' => [
'name' => '$LANG.tab_currencyfor', 'name' => '$LANG.tab_currencyfor',
'id' => 'currency-for', 'id' => 'currency-for',
'extraCols' => "$[Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')]", 'extraCols' => ["\$Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')"],
'note' => $n ? sprintf(Util::$filterResultString, $n) : null
]
); );
if ($boughtBy->getMatches() > CFG_SQL_LIMIT_DEFAULT)
$tabData['note'] = sprintf(Util::$filterResultString, $n);
$this->lvTabs[] = ['item', $tabData];
$this->extendGlobalData($boughtBy->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $this->extendGlobalData($boughtBy->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
} }
} }

View File

@@ -93,11 +93,7 @@ class EmotePage extends GenericPage
); );
$acv = new AchievementList($condition); $acv = new AchievementList($condition);
$this->lvTabs[] = array( $this->lvTabs[] = ['achievement', ['data' => array_values($acv->getListviewData())]];
'file' => 'achievement',
'data' => $acv->getListviewData(),
'params' => []
);
$this->extendGlobalData($acv->getJsGlobals()); $this->extendGlobalData($acv->getJsGlobals());
} }

View File

@@ -25,11 +25,12 @@ class EmotesPage extends GenericPage
protected function generateContent() protected function generateContent()
{ {
$this->lvTabs[] = array( $tabData = array(
'file' => 'emote', 'data' => array_values((new EmoteList())->getListviewData()),
'data' => (new EmoteList())->getListviewData(), 'name' => Util::ucFirst(Lang::game('emotes'))
'params' => []
); );
$this->lvTabs[] = ['emote', $tabData, 'emote'];
} }
protected function generateTitle() protected function generateTitle()

View File

@@ -175,14 +175,11 @@ class EnchantmentPage extends GenericPage
$gemList = new ItemList(array(['gemEnchantmentId', $this->typeId])); $gemList = new ItemList(array(['gemEnchantmentId', $this->typeId]));
if (!$gemList->error) if (!$gemList->error)
{ {
$this->lvTabs[] = array( $this->lvTabs[] = ['item', array(
'file' => 'item', 'data' => array_values($gemList->getListviewData()),
'data' => $gemList->getListviewData(),
'params' => array(
'name' => '$LANG.tab_usedby + \' \' + LANG.gems', 'name' => '$LANG.tab_usedby + \' \' + LANG.gems',
'id' => 'used-by-gem', 'id' => 'used-by-gem',
) )];
);
$this->extendGlobalData($gemList->getJsGlobals()); $this->extendGlobalData($gemList->getJsGlobals());
} }
@@ -191,14 +188,11 @@ class EnchantmentPage extends GenericPage
$socketsList = new ItemList(array(['socketBonus', $this->typeId])); $socketsList = new ItemList(array(['socketBonus', $this->typeId]));
if (!$socketsList->error) if (!$socketsList->error)
{ {
$this->lvTabs[] = array( $this->lvTabs[] = ['item', array(
'file' => 'item', 'data' => array_values($socketsList->getListviewData()),
'data' => $socketsList->getListviewData(),
'params' => array(
'name' => '$LANG.tab_usedby + \' \' + \''.Lang::item('socketBonus').'\'', 'name' => '$LANG.tab_usedby + \' \' + \''.Lang::item('socketBonus').'\'',
'id' => 'used-by-socketbonus', 'id' => 'used-by-socketbonus',
) )];
);
$this->extendGlobalData($socketsList->getJsGlobals()); $this->extendGlobalData($socketsList->getJsGlobals());
} }
@@ -230,14 +224,11 @@ class EnchantmentPage extends GenericPage
$ubItems = new ItemList($conditions); $ubItems = new ItemList($conditions);
if (!$ubItems->error) if (!$ubItems->error)
{ {
$this->lvTabs[] = array( $this->lvTabs[] = ['item', array(
'file' => 'item', 'data' => array_values($ubItems->getListviewData()),
'data' => $ubItems->getListviewData(),
'params' => array(
'name' => '$LANG.tab_usedby + \' \' + LANG.types[3][0]', 'name' => '$LANG.tab_usedby + \' \' + LANG.types[3][0]',
'id' => 'used-by-item', 'id' => 'used-by-item',
) )];
);
$this->extendGlobalData($ubItems->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($ubItems->getJSGlobals(GLOBALINFO_SELF));
} }
@@ -266,14 +257,11 @@ class EnchantmentPage extends GenericPage
} }
} }
$this->lvTabs[] = array( $this->lvTabs[] = ['spell', array(
'file' => 'spell', 'data' => array_values($spellData),
'data' => $spellData,
'params' => array(
'name' => '$LANG.tab_usedby + \' \' + LANG.types[6][0]', 'name' => '$LANG.tab_usedby + \' \' + LANG.types[6][0]',
'id' => 'used-by-spell', 'id' => 'used-by-spell',
) )];
);
} }
// used by randomAttrItem // used by randomAttrItem
@@ -303,15 +291,12 @@ class EnchantmentPage extends GenericPage
$data[$iId]['name'] .= ' '.Util::localizedString($ire[$iet[abs($re)]['ench']], 'name'); $data[$iId]['name'] .= ' '.Util::localizedString($ire[$iet[abs($re)]['ench']], 'name');
} }
$this->lvTabs[] = array( $this->lvTabs[] = ['item', array(
'file' => 'item', 'data' => array_values($data),
'data' => $data,
'params' => array(
'id' => 'used-by-rand', 'id' => 'used-by-rand',
'name' => '$LANG.tab_usedby + \' \' + \''.Lang::item('_rndEnchants').'\'', 'name' => '$LANG.tab_usedby + \' \' + \''.Lang::item('_rndEnchants').'\'',
'extraCols' => '$[Listview.extraCols.percent]' 'extraCols' => ['$Listview.extraCols.percent']
) )];
);
$this->extendGlobalData($randItems->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($randItems->getJSGlobals(GLOBALINFO_SELF));
} }

View File

@@ -30,10 +30,9 @@ class EnchantmentsPage extends GenericPage
protected function generateContent() protected function generateContent()
{ {
$tab = array( $tabData = array(
'file' => 'enchantment',
'data' => [], 'data' => [],
'params' => [] 'name' => Util::ucFirst(Lang::game('enchantments'))
); );
$conditions = []; $conditions = [];
@@ -46,7 +45,7 @@ class EnchantmentsPage extends GenericPage
$ench = new EnchantmentList($conditions); $ench = new EnchantmentList($conditions);
$tab['data'] = $ench->getListviewData(); $tabData['data'] = array_values($ench->getListviewData());
$this->extendGlobalData($ench->getJSGlobals()); $this->extendGlobalData($ench->getJSGlobals());
// recreate form selection // recreate form selection
@@ -56,34 +55,34 @@ class EnchantmentsPage extends GenericPage
$xCols = $this->filterObj->getForm('extraCols', true); $xCols = $this->filterObj->getForm('extraCols', true);
foreach (Util::$itemFilter as $fiId => $str) foreach (Util::$itemFilter as $fiId => $str)
if (array_column($tab['data'], $str)) if (array_column($tabData['data'], $str))
$xCols[] = $fiId; $xCols[] = $fiId;
if (array_column($tab['data'], 'dmg')) if (array_column($tabData['data'], 'dmg'))
$xCols[] = 34; $xCols[] = 34;
if ($xCols) if ($xCols)
$this->filter['fi']['extraCols'] = "fi_extraCols = ".Util::toJSON(array_values(array_unique($xCols))).";"; $this->filter['fi']['extraCols'] = "fi_extraCols = ".Util::toJSON(array_values(array_unique($xCols))).";";
if (!empty($this->filter['fi']['extraCols'])) if (!empty($this->filter['fi']['extraCols']))
$tab['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)'; $tabData['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
if ($ench->getMatches() > CFG_SQL_LIMIT_DEFAULT) if ($ench->getMatches() > CFG_SQL_LIMIT_DEFAULT)
{ {
$tab['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_enchantmentsfound', $ench->getMatches(), CFG_SQL_LIMIT_DEFAULT); $tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_enchantmentsfound', $ench->getMatches(), CFG_SQL_LIMIT_DEFAULT);
$tab['params']['_truncated'] = 1; $tabData['_truncated'] = 1;
} }
if (array_filter(array_column($tab['data'], 'spells'))) if (array_filter(array_column($tabData['data'], 'spells')))
$tab['params']['visibleCols'] = '$[\'trigger\']'; $tabData['visibleCols'] = ['trigger'];
if (!$ench->hasSetFields(['skillLine'])) if (!$ench->hasSetFields(['skillLine']))
$tab['params']['hiddenCols'] = '$[\'skill\']'; $tabData['hiddenCols'] = ['skill'];
if ($this->filterObj->error) if ($this->filterObj->error)
$tab['params']['_errors'] = '$1'; $tabData['_errors'] = '$1';
$this->lvTabs[] = $tab; $this->lvTabs[] = ['enchantment', $tabData, 'enchantment'];
} }
protected function generateTitle() protected function generateTitle()

View File

@@ -112,11 +112,12 @@ class EventPage extends GenericPage
foreach ($data as &$d) foreach ($data as &$d)
$d['method'] = $npcIds[$d['id']]; $d['method'] = $npcIds[$d['id']];
$this->lvTabs[] = array( $tabData = ['data' => array_values($data)];
'file' => CreatureList::$brickFile,
'data' => $data, if ($hasFilter)
'params' => ['note' => $hasFilter ? sprintf(Util::$filterResultString, '?npcs&filter=cr=38;crs='.$this->hId.';crv=0') : null] $tabData['note'] = sprintf(Util::$filterResultString, '?npcs&filter=cr=38;crs='.$this->hId.';crv=0');
);
$this->lvTabs[] = ['creature', $tabData];
} }
} }
@@ -130,11 +131,12 @@ class EventPage extends GenericPage
foreach ($data as &$d) foreach ($data as &$d)
$d['method'] = $objectIds[$d['id']]; $d['method'] = $objectIds[$d['id']];
$this->lvTabs[] = array( $tabData = ['data' => array_values($data)];
'file' => GameObjectList::$brickFile,
'data' => $data, if ($hasFilter)
'params' => ['note' => $hasFilter ? sprintf(Util::$filterResultString, '?objects&filter=cr=16;crs='.$this->hId.';crv=0') : null] $tabData['note'] = sprintf(Util::$filterResultString, '?objects&filter=cr=16;crs='.$this->hId.';crv=0');
);
$this->lvTabs[] = ['object', $tabData];
} }
} }
@@ -147,14 +149,15 @@ class EventPage extends GenericPage
{ {
$this->extendGlobalData($acvs->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $this->extendGlobalData($acvs->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
$this->lvTabs[] = array( $tabData = array(
'file' => AchievementList::$brickFile, 'data' => array_values($acvs->getListviewData()),
'data' => $acvs->getListviewData(), 'visibleCols' => ['category']
'params' => array(
'note' => $hasFilter ? sprintf(Util::$filterResultString, '?achievements&filter=cr=11;crs='.$this->hId.';crv=0') : null,
'visibleCols' => "$['category']"
)
); );
if ($hasFilter)
$tabData['note'] = sprintf(Util::$filterResultString, '?achievements&filter=cr=11;crs='.$this->hId.';crv=0');
$this->lvTabs[] = ['achievement', $tabData];
} }
} }
@@ -172,11 +175,12 @@ class EventPage extends GenericPage
{ {
$this->extendGlobalData($quests->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_REWARDS)); $this->extendGlobalData($quests->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_REWARDS));
$this->lvTabs[] = array( $tabData = ['data'=> array_values($quests->getListviewData())];
'file' => QuestList::$brickFile,
'data' => $quests->getListviewData(), if ($hasFilter)
'params' => ['note' => $hasFilter ? sprintf(Util::$filterResultString, '?quests&filter=cr=33;crs='.$this->hId.';crv=0') : null] $tabData['note'] = sprintf(Util::$filterResultString, '?quests&filter=cr=33;crs='.$this->hId.';crv=0');
);
$this->lvTabs[] = ['quest', $tabData];
$questItems = []; $questItems = [];
foreach (array_column($quests->rewards, TYPE_ITEM) as $arr) foreach (array_column($quests->rewards, TYPE_ITEM) as $arr)
@@ -208,11 +212,12 @@ class EventPage extends GenericPage
{ {
$this->extendGlobalData($eventItems->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($eventItems->getJSGlobals(GLOBALINFO_SELF));
$this->lvTabs[] = array( $tabData = ['data'=> array_values($eventItems->getListviewData())];
'file' => ItemList::$brickFile,
'data' => $eventItems->getListviewData(), if ($hasFilter)
'params' => ['note' => $hasFilter ? sprintf(Util::$filterResultString, '?items&filter=cr=160;crs='.$this->hId.';crv=0') : null] $tabData['note'] = sprintf(Util::$filterResultString, '?items&filter=cr=160;crs='.$this->hId.';crv=0');
);
$this->lvTabs[] = ['item', $tabData];
} }
} }
@@ -249,16 +254,13 @@ class EventPage extends GenericPage
$relData = array_merge($relData, $d); $relData = array_merge($relData, $d);
} }
$this->lvTabs[] = array( $this->lvTabs[] = ['event', array(
'file' => WorldEventList::$brickFile, 'data' => array_values($relData),
'data' => $relData,
'params' => array(
'id' => 'see-also', 'id' => 'see-also',
'name' => '$LANG.tab_seealso', 'name' => '$LANG.tab_seealso',
'hiddenCols' => "$['date']", 'hiddenCols' => ['date'],
'extraCols' => '$[Listview.extraCols.condition]' 'extraCols' => ['$Listview.extraCols.condition']
) )];
);
} }
} }
} }
@@ -308,10 +310,10 @@ class EventPage extends GenericPage
foreach ($this->lvTabs as &$view) foreach ($this->lvTabs as &$view)
{ {
if ($view['file'] != WorldEventList::$brickFile) if ($view[0] != WorldEventList::$brickFile)
continue; continue;
foreach ($view['data'] as &$data) foreach ($view[1]['data'] as &$data)
{ {
$updated = WorldEventList::updateDates($data['_date']); $updated = WorldEventList::updateDates($data['_date']);
unset($data['_date']); unset($data['_date']);

View File

@@ -52,19 +52,16 @@ class EventsPage extends GenericPage
if ($d = $events->getField('requires')) if ($d = $events->getField('requires'))
$this->deps[$events->id] = $d; $this->deps[$events->id] = $d;
$this->lvTabs[] = array( $data = array_values($events->getListviewData());
'file' => 'event',
'data' => $events->getListviewData(),
'params' => []
);
if ($_ = array_filter($events->getListviewData(), function($x) {return $x['id'] > 0;})) $this->lvTabs[] = ['event', ['data' => $data]];
if ($_ = array_filter($data, function($x) {return $x['id'] > 0;}))
{ {
$this->lvTabs[] = array( $this->lvTabs[] = ['calendar', array(
'file' => 'calendar',
'data' => $_, 'data' => $_,
'params' => ['hideCount' => 1] 'hideCount' => 1
); )];
} }
} }
@@ -86,7 +83,7 @@ class EventsPage extends GenericPage
// recalculate dates with now() // recalculate dates with now()
foreach ($this->lvTabs as &$views) foreach ($this->lvTabs as &$views)
{ {
foreach ($views['data'] as &$data) foreach ($views[1]['data'] as &$data)
{ {
// is a followUp-event // is a followUp-event
if (!empty($this->deps[$data['id']])) if (!empty($this->deps[$data['id']]))

View File

@@ -175,20 +175,16 @@ class FactionPage extends GenericPage
{ {
$this->extendGlobalData($items->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($items->getJSGlobals(GLOBALINFO_SELF));
$tab = array( $tabData = array(
'file' => 'item', 'data' => array_values($items->getListviewData()),
'data' => $items->getListviewData(),
'showRep' => true,
'params' => array(
'extraCols' => '$_', 'extraCols' => '$_',
'sort' => "$['standing', 'name']" 'sort' => ['standing', 'name']
)
); );
if ($items->getMatches() > CFG_SQL_LIMIT_DEFAULT) if ($items->getMatches() > CFG_SQL_LIMIT_DEFAULT)
$tab['params']['note'] = sprintf(Util::$filterResultString, '?items&filter=cr=17;crs='.$this->typeId.';crv=0'); $tabData['note'] = sprintf(Util::$filterResultString, '?items&filter=cr=17;crs='.$this->typeId.';crv=0');
$this->lvTabs[] = $tab; $this->lvTabs[] = ['item', $tabData, 'itemStandingCol'];
} }
// tab: creatures with onKill reputation // tab: creatures with onKill reputation
@@ -212,20 +208,16 @@ class FactionPage extends GenericPage
foreach ($data as $id => &$d) foreach ($data as $id => &$d)
$d['reputation'] = $cRep[$id]; $d['reputation'] = $cRep[$id];
$tab = array( $tabData = array(
'file' => 'creature', 'data' => array_values($data),
'data' => $data,
'showRep' => true,
'params' => array(
'extraCols' => '$_', 'extraCols' => '$_',
'sort' => "$['-reputation', 'name']" 'sort' => ['-reputation', 'name']
)
); );
if ($killCreatures->getMatches() > CFG_SQL_LIMIT_DEFAULT) if ($killCreatures->getMatches() > CFG_SQL_LIMIT_DEFAULT)
$tab['params']['note'] = sprintf(Util::$filterResultString, '?npcs&filter=cr=42;crs='.$this->typeId.';crv=0'); $tabData['note'] = sprintf(Util::$filterResultString, '?npcs&filter=cr=42;crs='.$this->typeId.';crv=0');
$this->lvTabs[] = $tab; $this->lvTabs[] = ['creature', $tabData, 'npcRepCol'];
} }
} }
} }
@@ -236,20 +228,16 @@ class FactionPage extends GenericPage
$members = new CreatureList(array(['faction', $_])); $members = new CreatureList(array(['faction', $_]));
if (!$members->error) if (!$members->error)
{ {
$tab = array( $tabData = array(
'file' => 'creature', 'data' => array_values($members->getListviewData()),
'data' => $members->getListviewData(),
'showRep' => true,
'params' => array(
'id' => 'member', 'id' => 'member',
'name' => '$LANG.tab_members' 'name' => '$LANG.tab_members'
)
); );
if ($members->getMatches() > CFG_SQL_LIMIT_DEFAULT) if ($members->getMatches() > CFG_SQL_LIMIT_DEFAULT)
$tab['params']['note'] = sprintf(Util::$filterResultString, '?npcs&filter=cr=3;crs='.$this->typeId.';crv=0'); $tabData['note'] = sprintf(Util::$filterResultString, '?npcs&filter=cr=3;crs='.$this->typeId.';crv=0');
$this->lvTabs[] = $tab; $this->lvTabs[] = ['creature', $tabData];
} }
} }
@@ -258,13 +246,7 @@ class FactionPage extends GenericPage
{ {
$objects = new GameObjectList(array(['faction', $_])); $objects = new GameObjectList(array(['faction', $_]));
if (!$objects->error) if (!$objects->error)
{ $this->lvTabs[] = ['object', ['data' => array_values($objects->getListviewData())]];
$this->lvTabs[] = array(
'file' => 'object',
'data' => $objects->getListviewData(),
'params' => []
);
}
} }
// tab: quests // tab: quests
@@ -281,17 +263,15 @@ class FactionPage extends GenericPage
{ {
$this->extendGlobalData($quests->getJSGlobals(GLOBALINFO_ANY)); $this->extendGlobalData($quests->getJSGlobals(GLOBALINFO_ANY));
$tab = array( $tabData = array(
'file' => 'quest', 'data' => array_values($quests->getListviewData($this->typeId)),
'data' => $quests->getListviewData($this->typeId), 'extraCols' => '$_'
'showRep' => true,
'params' => ['extraCols' => '$_']
); );
if ($quests->getMatches() > CFG_SQL_LIMIT_DEFAULT) if ($quests->getMatches() > CFG_SQL_LIMIT_DEFAULT)
$tab['params']['note'] = sprintf(Util::$filterResultString, '?quests&filter=cr=1;crs='.$this->typeId.';crv=0'); $tabData['note'] = sprintf(Util::$filterResultString, '?quests&filter=cr=1;crs='.$this->typeId.';crv=0');
$this->lvTabs[] = $tab; $this->lvTabs[] = ['quest', $tabData, 'questRepCol'];
} }
// tab: achievements // tab: achievements
@@ -304,15 +284,12 @@ class FactionPage extends GenericPage
{ {
$this->extendGlobalData($acvs->getJSGlobals(GLOBALINFO_ANY)); $this->extendGlobalData($acvs->getJSGlobals(GLOBALINFO_ANY));
$this->lvTabs[] = array( $this->lvTabs[] = ['achievement', array(
'file' => 'achievement', 'data' => array_values($acvs->getListviewData()),
'data' => $acvs->getListviewData(),
'params' => array(
'id' => 'criteria-of', 'id' => 'criteria-of',
'name' => '$LANG.tab_criteriaof', 'name' => '$LANG.tab_criteriaof',
'visibleCols' => "$['category']" 'visibleCols' => ['category']
) )];
);
} }
} }
} }

View File

@@ -53,13 +53,9 @@ class FactionsPage extends GenericPage
$data = []; $data = [];
$factions = new FactionList($conditions); $factions = new FactionList($conditions);
if (!$factions->error) if (!$factions->error)
$data = $factions->getListviewData(); $data = array_values($factions->getListviewData());
$this->lvTabs[] = array( $this->lvTabs[] = ['faction', ['data' => $data]];
'file' => 'faction',
'data' => $data,
'params' => []
);
} }
protected function generateTitle() protected function generateTitle()

View File

@@ -103,6 +103,36 @@ class GenericPage
private $memcached = null; private $memcached = null;
private $mysql = ['time' => 0, 'count' => 0]; private $mysql = ['time' => 0, 'count' => 0];
private $lvTemplates = array(
'achievement' => ['template' => 'achievement', 'id' => 'achievements', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_achievements' ],
'calendar' => ['template' => 'holidaycal', 'id' => 'calendar', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_calendar' ],
'class' => ['template' => 'classs', 'id' => 'classes', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_classes' ],
'commentpreview' => ['template' => 'commentpreview', 'id' => 'comments', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_comments' ],
'creature' => ['template' => 'npc', 'id' => 'npcs', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_npcs' ],
'currency' => ['template' => 'currency', 'id' => 'currencies', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_currencies' ],
'emote' => ['template' => 'emote', 'id' => 'emotes', 'parent' => 'lv-generic', 'data' => [] ],
'enchantment' => ['template' => 'enchantment', 'id' => 'enchantments', 'parent' => 'lv-generic', 'data' => [] ],
'event' => ['template' => 'holiday', 'id' => 'holidays', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_holidays' ],
'faction' => ['template' => 'faction', 'id' => 'factions', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_factions' ],
'genericmodel' => ['template' => 'genericmodel', 'id' => 'same-model-as', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_samemodelas' ],
'item' => ['template' => 'item', 'id' => 'items', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_items' ],
'itemset' => ['template' => 'itemset', 'id' => 'itemsets', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_itemsets' ],
'model' => ['template' => 'model', 'id' => 'gallery', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_gallery' ],
'object' => ['template' => 'object', 'id' => 'objects', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_objects' ],
'pet' => ['template' => 'pet', 'id' => 'hunter-pets', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_pets' ],
'profile' => ['template' => 'profile', 'id' => 'profiles', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_profiles' ],
'quest' => ['template' => 'quest', 'id' => 'quests', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_quests' ],
'race' => ['template' => 'race', 'id' => 'races', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_races' ],
'replypreview' => ['template' => 'replypreview', 'id' => 'comment-replies', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_commentreplies'],
'reputationhistory' => ['template' => 'reputationhistory', 'id' => 'reputation', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_reputation' ],
'screenshot' => ['template' => 'screenshot', 'id' => 'screenshots', 'parent' => 'lv-generic', 'data' => [] ],
'skill' => ['template' => 'skill', 'id' => 'skills', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_skills' ],
'spell' => ['template' => 'spell', 'id' => 'spells', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_spells' ],
'title' => ['template' => 'title', 'id' => 'titles', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_titles' ],
'video' => ['template' => 'video', 'id' => 'videos', 'parent' => 'lv-generic', 'data' => [], ],
'zone' => ['template' => 'zone', 'id' => 'zones', 'parent' => 'lv-generic', 'data' => [], 'name' => '$LANG.tab_zones' ]
);
public function __construct($pageCall/*, $pageParam */) public function __construct($pageCall/*, $pageParam */)
{ {
$this->time = microtime(true); $this->time = microtime(true);
@@ -518,18 +548,15 @@ class GenericPage
$$n = $v; $$n = $v;
if (!$this->isSaneInclude('template/bricks/', $file)) if (!$this->isSaneInclude('template/bricks/', $file))
echo User::isInGroup(U_GROUP_EMPLOYEE) ? "\n\nError: nonexistant template requested: template/bricks/".$file.".tpl.php\n\n" : null; trigger_error("Nonexistant template requested: template/bricks/".$file.".tpl.php");
else else
include('template/bricks/'.$file.'.tpl.php'); include('template/bricks/'.$file.'.tpl.php');
} }
public function lvBrick($file, array $localVars = []) // load listview public function lvBrick($file) // load listview addIns
{ {
foreach ($localVars as $n => $v)
$$n = $v;
if (!$this->isSaneInclude('template/listviews/', $file)) if (!$this->isSaneInclude('template/listviews/', $file))
echo User::isInGroup(U_GROUP_EMPLOYEE) ? "\n\nError: nonexistant template requested: template/listviews/".$file.".tpl.php\n\n" : null; trigger_error('Nonexistant Listview addin requested: template/listviews/'.$file.'.tpl.php');
else else
include('template/listviews/'.$file.'.tpl.php'); include('template/listviews/'.$file.'.tpl.php');
} }
@@ -539,7 +566,7 @@ class GenericPage
if (!$this->isSaneInclude('template/localized/', $file.'_'.$loc)) if (!$this->isSaneInclude('template/localized/', $file.'_'.$loc))
{ {
if ($loc == LOCALE_EN || !$this->isSaneInclude('template/localized/', $file.'_'.LOCALE_EN)) if ($loc == LOCALE_EN || !$this->isSaneInclude('template/localized/', $file.'_'.LOCALE_EN))
echo User::isInGroup(U_GROUP_EMPLOYEE) ? "\n\nError: nonexistant template requested: template/localized/".$file.'_'.$loc.".tpl.php\n\n" : null; trigger_error("Nonexistant template requested: template/localized/".$file.'_'.$loc.".tpl.php");
else else
include('template/localized/'.$file.'_'.LOCALE_EN.'.tpl.php'); include('template/localized/'.$file.'_'.LOCALE_EN.'.tpl.php');
} }

View File

@@ -438,15 +438,12 @@ class ItemPage extends genericPage
$this->extendGlobalIDs(TYPE_SPELL, $perfItem[$sId]['requiredSpecialization']); $this->extendGlobalIDs(TYPE_SPELL, $perfItem[$sId]['requiredSpecialization']);
} }
$this->lvTabs[] = array( $this->lvTabs[] = ['spell', array(
'file' => 'spell', 'data' => array_values($lvData),
'data' => $lvData,
'params' => [
'name' => '$LANG.tab_createdby', 'name' => '$LANG.tab_createdby',
'id' => 'created-by', // should by exclusive with created-by from spell_loot 'id' => 'created-by', // should by exclusive with created-by from spell_loot
'extraCols' => '$[Listview.extraCols.percent, Listview.extraCols.condition]' 'extraCols' => ['$Listview.extraCols.percent', '$Listview.extraCols.condition']
] )];
);
} }
} }
@@ -457,34 +454,24 @@ class ItemPage extends genericPage
{ {
$this->extendGlobalData($lootTabs->jsGlobals); $this->extendGlobalData($lootTabs->jsGlobals);
foreach ($lootTabs->iterate() as $idx => $tab) foreach ($lootTabs->iterate() as $idx => list($file, $tabData))
{ {
if (!$tab[1]) if (!$tabData['data'])
continue; continue;
if ($idx == 16) if ($idx == 16)
$createdBy = array_column($tab[1], 'id'); $createdBy = array_column($tabData['data'], 'id');
$this->lvTabs[] = array( $this->lvTabs[] = [$file, $tabData];
'file' => $tab[0],
'data' => $tab[1],
'params' => [
'name' => $tab[2],
'id' => $tab[3],
'extraCols' => $tab[4] ? '$['.implode(', ', array_unique($tab[4])).']' : null,
'hiddenCols' => $tab[5] ? '$ '.Util::toJSON( array_unique($tab[5])) : null,
'visibleCols' => $tab[6] ? '$'. Util::toJSON( array_unique($tab[6])) : null
]
);
} }
} }
// tabs: this item contains.. // tabs: this item contains..
$sourceFor = array( $sourceFor = array(
[LOOT_ITEM, $this->subject->id, '$LANG.tab_contains', 'contains', ['Listview.extraCols.percent'], [] , []], [LOOT_ITEM, $this->subject->id, '$LANG.tab_contains', 'contains', ['$Listview.extraCols.percent'], [] , []],
[LOOT_PROSPECTING, $this->subject->id, '$LANG.tab_prospecting', 'prospecting', ['Listview.extraCols.percent'], ['side', 'slot', 'reqlevel'], []], [LOOT_PROSPECTING, $this->subject->id, '$LANG.tab_prospecting', 'prospecting', ['$Listview.extraCols.percent'], ['side', 'slot', 'reqlevel'], []],
[LOOT_MILLING, $this->subject->id, '$LANG.tab_milling', 'milling', ['Listview.extraCols.percent'], ['side', 'slot', 'reqlevel'], []], [LOOT_MILLING, $this->subject->id, '$LANG.tab_milling', 'milling', ['$Listview.extraCols.percent'], ['side', 'slot', 'reqlevel'], []],
[LOOT_DISENCHANT, $this->subject->getField('disenchantId'), '$LANG.tab_disenchanting', 'disenchanting', ['Listview.extraCols.percent'], ['side', 'slot', 'reqlevel'], []] [LOOT_DISENCHANT, $this->subject->getField('disenchantId'), '$LANG.tab_disenchanting', 'disenchanting', ['$Listview.extraCols.percent'], ['side', 'slot', 'reqlevel'], []]
); );
$reqQuest = []; $reqQuest = [];
@@ -508,17 +495,22 @@ class ItemPage extends genericPage
$lv['condition'][0][$this->typeId][] = [[CND_QUESTTAKEN, &$reqQuest[$lv['id']]]]; $lv['condition'][0][$this->typeId][] = [[CND_QUESTTAKEN, &$reqQuest[$lv['id']]]];
} }
$this->lvTabs[] = array( $tabData = array(
'file' => 'item', 'data' => array_values($lootTab->getResult()),
'data' => $lootTab->getResult(),
'params' => [
'name' => $sf[2], 'name' => $sf[2],
'id' => $sf[3], 'id' => $sf[3],
'extraCols' => $sf[4] ? "$[".implode(', ', array_unique($sf[4]))."]" : null,
'hiddenCols' => $sf[5] ? "$".Util::toJSON($sf[5]) : null,
'visibleCols' => $sf[6] ? '$'.Util::toJSON($sf[6]) : null
]
); );
if ($sf[4])
$tabData['extraCols'] = array_unique($sf[4]);
if ($sf[5])
$tabData['hiddenCols'] = array_unique($sf[5]);
if ($sf[6])
$tabData['visibleCols'] = array_unique($sf[6]);
$this->lvTabs[] = ['item', $tabData];
} }
} }
@@ -558,15 +550,12 @@ class ItemPage extends genericPage
if (!$contains->hasSetFields(['slot'])) if (!$contains->hasSetFields(['slot']))
$hCols[] = 'slot'; $hCols[] = 'slot';
$this->lvTabs[] = array( $this->lvTabs[] = ['item', array(
'file' => 'item', 'data' => array_values($contains->getListviewData()),
'data' => $contains->getListviewData(),
'params' => [
'name' => '$LANG.tab_cancontain', 'name' => '$LANG.tab_cancontain',
'id' => 'can-contain', 'id' => 'can-contain',
'hiddenCols' => '$'.Util::toJSON($hCols) 'hiddenCols' => $hCols
] )];
);
} }
} }
@@ -578,15 +567,12 @@ class ItemPage extends genericPage
{ {
$this->extendGlobalData($contains->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($contains->getJSGlobals(GLOBALINFO_SELF));
$this->lvTabs[] = array( $this->lvTabs[] = ['item', array(
'file' => 'item', 'data' => array_values($contains->getListviewData()),
'data' => $contains->getListviewData(),
'params' => [
'name' => '$LANG.tab_canbeplacedin', 'name' => '$LANG.tab_canbeplacedin',
'id' => 'can-be-placed-in', 'id' => 'can-be-placed-in',
'hiddenCols' => "$['side']" 'hiddenCols' => ['side']
] )];
);
} }
} }
@@ -601,20 +587,17 @@ class ItemPage extends genericPage
{ {
$this->extendGlobalData($criteriaOf->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_REWARDS)); $this->extendGlobalData($criteriaOf->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_REWARDS));
$hCols = []; $tabData = array(
if (!$criteriaOf->hasSetFields(['reward_loc0'])) 'data' => array_values($criteriaOf->getListviewData()),
$hCols = ['rewards'];
$this->lvTabs[] = array(
'file' => 'achievement',
'data' => $criteriaOf->getListviewData(),
'params' => [
'name' => '$LANG.tab_criteriaof', 'name' => '$LANG.tab_criteriaof',
'id' => 'criteria-of', 'id' => 'criteria-of',
'visibleCols' => "$['category']", 'visibleCols' => ['category']
'hiddenCols' => '$'.Util::toJSON($hCols)
]
); );
if (!$criteriaOf->hasSetFields(['reward_loc0']))
$tabData['hiddenCols'] = ['rewards'];
$this->lvTabs[] = ['achievement', $tabData];
} }
// tab: reagent for // tab: reagent for
@@ -629,15 +612,12 @@ class ItemPage extends genericPage
{ {
$this->extendGlobalData($reagent->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $this->extendGlobalData($reagent->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
$this->lvTabs[] = array( $this->lvTabs[] = ['spell', array(
'file' => 'spell', 'data' => array_values($reagent->getListviewData()),
'data' => $reagent->getListviewData(),
'params' => [
'name' => '$LANG.tab_reagentfor', 'name' => '$LANG.tab_reagentfor',
'id' => 'reagent-for', 'id' => 'reagent-for',
'visibleCols' => "$['reagents']" 'visibleCols' => ['reagents']
] )];
);
} }
// tab: unlocks (object or item) // tab: unlocks (object or item)
@@ -654,14 +634,11 @@ class ItemPage extends genericPage
$lockedObj = new GameObjectList(array(['lockId', $lockIds])); $lockedObj = new GameObjectList(array(['lockId', $lockIds]));
if (!$lockedObj->error) if (!$lockedObj->error)
{ {
$this->lvTabs[] = array( $this->lvTabs[] = ['object', array(
'file' => 'object', 'data' => array_values($lockedObj->getListviewData()),
'data' => $lockedObj->getListviewData(),
'params' => [
'name' => '$LANG.tab_unlocks', 'name' => '$LANG.tab_unlocks',
'id' => 'unlocks-object' 'id' => 'unlocks-object'
] )];
);
} }
// items (generally unused. It's the spell on the item, that unlocks stuff) // items (generally unused. It's the spell on the item, that unlocks stuff)
@@ -670,14 +647,11 @@ class ItemPage extends genericPage
{ {
$this->extendGlobalData($lockedItm->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($lockedItm->getJSGlobals(GLOBALINFO_SELF));
$this->lvTabs[] = array( $this->lvTabs[] = ['item', array(
'file' => 'item', 'data' => array_values($lockedItm->getListviewData()),
'data' => $lockedItm->getListviewData(),
'params' => [
'name' => '$LANG.tab_unlocks', 'name' => '$LANG.tab_unlocks',
'id' => 'unlocks-item' 'id' => 'unlocks-item'
] )];
);
} }
} }
@@ -705,14 +679,11 @@ class ItemPage extends genericPage
{ {
$this->extendGlobalData($saItems->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($saItems->getJSGlobals(GLOBALINFO_SELF));
$this->lvTabs[] = array( $this->lvTabs[] = ['item', array(
'file' => 'item', 'data' => array_values($saItems->getListviewData()),
'data' => $saItems->getListviewData(),
'params' => [
'name' => '$LANG.tab_seealso', 'name' => '$LANG.tab_seealso',
'id' => 'see-also' 'id' => 'see-also'
] )];
);
} }
// tab: starts (quest) // tab: starts (quest)
@@ -723,14 +694,11 @@ class ItemPage extends genericPage
{ {
$this->extendGlobalData($starts->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_REWARDS)); $this->extendGlobalData($starts->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_REWARDS));
$this->lvTabs[] = array( $this->lvTabs[] = ['quest', array(
'file' => 'quest', 'data' => array_values($starts->getListviewData()),
'data' => $starts->getListviewData(),
'params' => [
'name' => '$LANG.tab_starts', 'name' => '$LANG.tab_starts',
'id' => 'starts-quest' 'id' => 'starts-quest'
] )];
);
} }
} }
@@ -745,14 +713,11 @@ class ItemPage extends genericPage
{ {
$this->extendGlobalData($objective->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_REWARDS)); $this->extendGlobalData($objective->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_REWARDS));
$this->lvTabs[] = array( $this->lvTabs[] = ['quest', array(
'file' => 'quest', 'data' => array_values($objective->getListviewData()),
'data' => $objective->getListviewData(),
'params' => [
'name' => '$LANG.tab_objectiveof', 'name' => '$LANG.tab_objectiveof',
'id' => 'objective-of-quest' 'id' => 'objective-of-quest'
] )];
);
} }
// tab: provided for (quest) // tab: provided for (quest)
@@ -766,14 +731,11 @@ class ItemPage extends genericPage
{ {
$this->extendGlobalData($provided->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_REWARDS)); $this->extendGlobalData($provided->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_REWARDS));
$this->lvTabs[] = array( $this->lvTabs[] = ['quest', array(
'file' => 'quest', 'data' => array_values($provided->getListviewData()),
'data' => $provided->getListviewData(),
'params' => [
'name' => '$LANG.tab_providedfor', 'name' => '$LANG.tab_providedfor',
'id' => 'provided-for-quest' 'id' => 'provided-for-quest'
] )];
);
} }
// tab: same model as // tab: same model as
@@ -785,15 +747,12 @@ class ItemPage extends genericPage
{ {
$this->extendGlobalData($sameModel->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($sameModel->getJSGlobals(GLOBALINFO_SELF));
$this->lvTabs[] = array( $this->lvTabs[] = ['genericmodel', array(
'file' => 'genericmodel', 'data' => array_values($sameModel->getListviewData(ITEMINFO_MODEL)),
'data' => $sameModel->getListviewData(ITEMINFO_MODEL),
'params' => [
'name' => '$LANG.tab_samemodelas', 'name' => '$LANG.tab_samemodelas',
'id' => 'same-model-as', 'id' => 'same-model-as',
'genericlinktype' => 'item' 'genericlinktype' => 'item'
] )];
);
} }
} }
@@ -807,7 +766,7 @@ class ItemPage extends genericPage
$sbData = $soldBy->getListviewData(); $sbData = $soldBy->getListviewData();
$this->extendGlobalData($soldBy->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($soldBy->getJSGlobals(GLOBALINFO_SELF));
$extraCols = ['Listview.extraCols.stock', "Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')", 'Listview.extraCols.cost']; $extraCols = ['$Listview.extraCols.stock', "\$Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')", '$Listview.extraCols.cost'];
$holidays = []; $holidays = [];
foreach ($sbData as $k => &$row) foreach ($sbData as $k => &$row)
@@ -837,7 +796,7 @@ class ItemPage extends genericPage
if ($e = $vendors[$k]['event']) if ($e = $vendors[$k]['event'])
{ {
if (count($extraCols) == 3) if (count($extraCols) == 3)
$extraCols[] = 'Listview.extraCols.condition'; $extraCols[] = '$Listview.extraCols.condition';
$this->extendGlobalIds(TYPE_WORLDEVENT, $e); $this->extendGlobalIds(TYPE_WORLDEVENT, $e);
$row['condition'][0][$this->typeId][] = [[CND_ACTIVE_EVENT, $e]]; $row['condition'][0][$this->typeId][] = [[CND_ACTIVE_EVENT, $e]];
@@ -860,16 +819,13 @@ class ItemPage extends genericPage
} }
$this->lvTabs[] = array( $this->lvTabs[] = ['creature', array(
'file' => 'creature', 'data' => array_values($sbData),
'data' => $sbData,
'params' => [
'name' => '$LANG.tab_soldby', 'name' => '$LANG.tab_soldby',
'id' => 'sold-by-npc', 'id' => 'sold-by-npc',
'extraCols' => '$['.implode(', ', $extraCols).']', 'extraCols' => $extraCols,
'hiddenCols' => "$['level', 'type']" 'hiddenCols' => ['level', 'type']
] )];
);
} }
} }
@@ -898,22 +854,21 @@ class ItemPage extends genericPage
$boughtBy = new ItemList(array(['id', $boughtBy])); $boughtBy = new ItemList(array(['id', $boughtBy]));
if (!$boughtBy->error) if (!$boughtBy->error)
{ {
if ($boughtBy->getMatches() <= CFG_SQL_LIMIT_DEFAULT)
$n = null;
$iCur = new CurrencyList(array(['itemId', $this->typeId])); $iCur = new CurrencyList(array(['itemId', $this->typeId]));
$filter = $iCur->error ? [TYPE_ITEM => $this->typeId] : [TYPE_CURRENCY => $iCur->id]; $filter = $iCur->error ? [TYPE_ITEM => $this->typeId] : [TYPE_CURRENCY => $iCur->id];
$this->lvTabs[] = array( $tabData = array(
'file' => 'item', 'data' => array_values($boughtBy->getListviewData(ITEMINFO_VENDOR, $filter)),
'data' => $boughtBy->getListviewData(ITEMINFO_VENDOR, $filter),
'params' => [
'name' => '$LANG.tab_currencyfor', 'name' => '$LANG.tab_currencyfor',
'id' => 'currency-for', 'id' => 'currency-for',
'extraCols' => "$[Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack'), Listview.extraCols.cost]", 'extraCols' => ["\$Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')", '$Listview.extraCols.cost'],
'note' => $n ? sprintf(Util::$filterResultString, $n) : null
]
); );
if ($boughtBy->getMatches() > CFG_SQL_LIMIT_DEFAULT && $n)
$tabData['note'] = sprintf(Util::$filterResultString, $n);
$this->lvTabs[] = ['item', $tabData];
$this->extendGlobalData($boughtBy->getJSGlobals(GLOBALINFO_ANY)); $this->extendGlobalData($boughtBy->getJSGlobals(GLOBALINFO_ANY));
} }
} }
@@ -951,15 +906,12 @@ class ItemPage extends genericPage
if ($taughtSpells->hasSetFields(['reagent1'])) if ($taughtSpells->hasSetFields(['reagent1']))
$visCols[] = 'reagents'; $visCols[] = 'reagents';
$this->lvTabs[] = array( $this->lvTabs[] = ['spell', array(
'file' => 'spell', 'data' => array_values($taughtSpells->getListviewData()),
'data' => $taughtSpells->getListviewData(),
'params' => [
'name' => '$LANG.tab_teaches', 'name' => '$LANG.tab_teaches',
'id' => 'teaches', 'id' => 'teaches',
'visibleCols' => '$'.Util::toJSON($visCols) 'visibleCols' => $visCols
] )];
);
} }
} }
@@ -982,14 +934,11 @@ class ItemPage extends genericPage
$cdItems = new ItemList($conditions); $cdItems = new ItemList($conditions);
if (!$cdItems->error) if (!$cdItems->error)
{ {
$this->lvTabs[] = array( $this->lvTabs[] = ['item', array(
'file' => 'item', 'data' => array_values($cdItems->getListviewData()),
'data' => $cdItems->getListviewData(),
'params' => [
'name' => '$LANG.tab_sharedcooldown', 'name' => '$LANG.tab_sharedcooldown',
'id' => 'shared-cooldown' 'id' => 'shared-cooldown'
] )];
);
$this->extendGlobalData($cdItems->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($cdItems->getJSGlobals(GLOBALINFO_SELF));
} }

View File

@@ -306,10 +306,9 @@ class ItemsPage extends GenericPage
continue; continue;
$this->extendGlobalData($items->getJSGlobals()); $this->extendGlobalData($items->getJSGlobals());
$tab = array( $tabData = array_merge(
'file' => 'item', ['data' => $items->getListviewData($infoMask)],
'data' => $items->getListviewData($infoMask), $this->sharedLV
'params' => $this->sharedLV
); );
$upg = []; $upg = [];
@@ -322,17 +321,17 @@ class ItemsPage extends GenericPage
})); }));
foreach ($upg as $uId) foreach ($upg as $uId)
$tab['data'][$uId] = $upgItemData[$uId]; $tabData['data'][$uId] = $upgItemData[$uId];
if ($upg) if ($upg)
$tab['params']['_upgradeIds'] = '$'.Util::toJSON($upg); $tabData['_upgradeIds'] = $upg;
} }
else if ($grouping) else if ($grouping)
{ {
$upg = array_keys($this->filter['upg']); $upg = array_keys($this->filter['upg']);
$tab['params']['_upgradeIds'] = '$'.Util::toJSON($upg); $tabData['_upgradeIds'] = $upg;
foreach ($upgItemData as $uId => $data) // using numeric keys => cant use array_merge foreach ($upgItemData as $uId => $data) // using numeric keys => cant use array_merge
$tab['data'][$uId] = $data; $tabData['data'][$uId] = $data;
} }
} }
@@ -341,28 +340,28 @@ class ItemsPage extends GenericPage
switch ($grouping) switch ($grouping)
{ {
case 1: case 1:
$tab['params']['id'] = 'slot-'.$group; $tabData['id'] = 'slot-'.$group;
break; break;
case 2: case 2:
$tab['params']['id'] = $group > 0 ? 'level-'.$group : 'other'; $tabData['id'] = $group > 0 ? 'level-'.$group : 'other';
break; break;
case 3: case 3:
$tab['params']['id'] = $group ? 'source-'.$group : 'unknown'; $tabData['id'] = $group ? 'source-'.$group : 'unknown';
break; break;
} }
$tab['params']['name'] = $nameSource[$group]; $tabData['name'] = $nameSource[$group];
$tab['params']['tabs'] = '$tabsGroups'; $tabData['tabs'] = '$tabsGroups';
} }
if (!empty($this->filter['fi']['setWeights'])) if (!empty($this->filter['fi']['setWeights']))
if ($items->hasSetFields(['armor'])) if ($items->hasSetFields(['armor']))
$tab['params']['visibleCols'][] = 'armor'; $tabData['visibleCols'][] = 'armor';
// create note if search limit was exceeded; overwriting 'note' is intentional // create note if search limit was exceeded; overwriting 'note' is intentional
if ($items->getMatches() > $maxResults && count($groups) > 1) if ($items->getMatches() > $maxResults && count($groups) > 1)
{ {
$tab['params']['_truncated'] = 1; $tabData['_truncated'] = 1;
$cls = isset($this->category[0]) ? '='.$this->category[0] : ''; $cls = isset($this->category[0]) ? '='.$this->category[0] : '';
$override = ['gb' => '']; $override = ['gb' => ''];
@@ -373,7 +372,7 @@ class ItemsPage extends GenericPage
{ {
case 1: case 1:
$override['sl'] = $group; $override['sl'] = $group;
$tab['params']['note'] = '$$WH.sprintf(LANG.lvnote_viewmoreslot, \''.$cls.'\', \''.$this->filterObj->urlize($override).'\')'; $tabData['note'] = '$$WH.sprintf(LANG.lvnote_viewmoreslot, \''.$cls.'\', \''.$this->filterObj->urlize($override).'\')';
break; break;
case 2: case 2:
if ($group > 0) if ($group > 0)
@@ -384,35 +383,31 @@ class ItemsPage extends GenericPage
else else
$override['maxle'] = abs($group) - 1; $override['maxle'] = abs($group) - 1;
$tab['params']['note'] = '$$WH.sprintf(LANG.lvnote_viewmorelevel, \''.$cls.'\', \''.$this->filterObj->urlize($override).'\')'; $tabData['note'] = '$$WH.sprintf(LANG.lvnote_viewmorelevel, \''.$cls.'\', \''.$this->filterObj->urlize($override).'\')';
break; break;
case 3: case 3:
if ($_ = [null, 3, 4, 5, 6, 7, 9, 10, 11][$group]) if ($_ = [null, 3, 4, 5, 6, 7, 9, 10, 11][$group])
$tab['params']['note'] = '$$WH.sprintf(LANG.lvnote_viewmoresource, \''.$cls.'\', \''.$this->filterObj->urlize($override, ['cr' => 128, 'crs' => $_, 'crv' => 0]).'\')'; $tabData['note'] = '$$WH.sprintf(LANG.lvnote_viewmoresource, \''.$cls.'\', \''.$this->filterObj->urlize($override, ['cr' => 128, 'crs' => $_, 'crv' => 0]).'\')';
break; break;
} }
} }
else if ($items->getMatches() > $maxResults) else if ($items->getMatches() > $maxResults)
{ {
$tab['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_itemsfound', $items->getMatches(), CFG_SQL_LIMIT_DEFAULT); $tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_itemsfound', $items->getMatches(), CFG_SQL_LIMIT_DEFAULT);
$tab['params']['_truncated'] = 1; $tabData['_truncated'] = 1;
} }
if (!empty($tab['params']['hiddenCols'])) foreach ($tabData as $k => $p)
$tab['params']['hiddenCols'] = '$'.Util::toJSON($tab['params']['hiddenCols']); if (!$p && $k != 'data')
unset($tabData[$k]);
if (!empty($tab['params']['visibleCols']))
$tab['params']['visibleCols'] = '$'.Util::toJSON($tab['params']['visibleCols']);
foreach ($tab['params'] as $k => $p)
if (!$p)
unset($tab['params'][$k]);
if ($grouping) if ($grouping)
$tab['params']['hideCount'] = '$1'; $tabData['hideCount'] = 1;
$this->lvTabs[] = $tab; $tabData['data'] = array_values($tabData['data']);
$this->lvTabs[] = ['item', $tabData];
} }
// reformat for use in template // reformat for use in template
@@ -423,7 +418,7 @@ class ItemsPage extends GenericPage
if (empty($this->lvTabs)) if (empty($this->lvTabs))
{ {
$this->forceTabs = false; $this->forceTabs = false;
$this->lvTabs[] = ['file' => 'item', 'data' => [], 'params' => []]; $this->lvTabs[] = ['item', ['data' => []]];
} }
// sort for dropdown-menus // sort for dropdown-menus
@@ -502,7 +497,7 @@ class ItemsPage extends GenericPage
$this->sharedLV['onBeforeCreate'] = '$fi_initWeightedListview'; $this->sharedLV['onBeforeCreate'] = '$fi_initWeightedListview';
$this->sharedLV['onAfterCreate'] = '$fi_addUpgradeIndicator'; $this->sharedLV['onAfterCreate'] = '$fi_addUpgradeIndicator';
$this->sharedLV['sort'] = "$['-score', 'name']"; $this->sharedLV['sort'] = ['-score', 'name'];
array_push($this->sharedLV['hiddenCols'], 'type', 'source'); array_push($this->sharedLV['hiddenCols'], 'type', 'source');

View File

@@ -139,12 +139,11 @@ class ItemsetPage extends GenericPage
$compare[] = $itemId; $compare[] = $itemId;
$pieces[] = array( $pieces[$itemId] = array(
'id' => $itemId, 'name_'.User::$localeString => $iList->getField('name', true),
'name' => $iList->getField('name', true),
'quality' => $iList->getField('quality'), 'quality' => $iList->getField('quality'),
'icon' => $iList->getField('iconString'), 'icon' => $iList->getField('iconString'),
'json' => $data[$itemId] 'jsonequip' => $data[$itemId]
); );
} }
@@ -168,11 +167,12 @@ class ItemsetPage extends GenericPage
BUTTON_VIEW3D => ['type' => TYPE_ITEMSET, 'typeId' => $this->typeId, 'equipList' => $eqList], BUTTON_VIEW3D => ['type' => TYPE_ITEMSET, 'typeId' => $this->typeId, 'equipList' => $eqList],
BUTTON_COMPARE => ['eqList' => implode(':', $compare), 'qty' => $_cnt] BUTTON_COMPARE => ['eqList' => implode(':', $compare), 'qty' => $_cnt]
); );
$this->compare = array( $this->summary = array(
'id' => 'itemset',
'template' => 'itemset',
'parent' => 'summary-generic',
'groups' => array_map(function ($v) { return [[$v]]; }, $compare),
'level' => $this->subject->getField('reqLevel'), 'level' => $this->subject->getField('reqLevel'),
'items' => array_map(function ($v) {
return [[$v]];
}, $compare)
); );
/**************/ /**************/
@@ -213,19 +213,16 @@ class ItemsetPage extends GenericPage
$relSets = new ItemsetList($rel); $relSets = new ItemsetList($rel);
if (!$relSets->error) if (!$relSets->error)
{ {
$lv = array( $tabData = array(
'file' => 'itemset', 'data' => array_values($relSets->getListviewData()),
'data' => $relSets->getListviewData(),
'params' => array(
'id' => 'see-also', 'id' => 'see-also',
'name' => '$LANG.tab_seealso' 'name' => '$LANG.tab_seealso'
)
); );
if (!$relSets->hasDiffFields(['classMask'])) if (!$relSets->hasDiffFields(['classMask']))
$lv['params']['hiddenCols'] = "$['classes']"; $tabData['hiddenCols'] = ['classes'];
$this->lvTabs[] = $lv; $this->lvTabs[] = ['itemset', $tabData];
$this->extendGlobalData($relSets->getJSGlobals()); $this->extendGlobalData($relSets->getJSGlobals());
} }

View File

@@ -47,26 +47,22 @@ class ItemsetsPage extends GenericPage
$this->addJS('?data=weight-presets&locale='.User::$localeId.'&t='.$_SESSION['dataKey']); $this->addJS('?data=weight-presets&locale='.User::$localeId.'&t='.$_SESSION['dataKey']);
$lv = array( $tabData = ['data' => array_values($itemsets->getListviewData())];
'file' => 'itemset',
'data' => $itemsets->getListviewData(), // listview content
'params' => []
);
if (!empty($this->filter['fi']['extraCols'])) if (!empty($this->filter['fi']['extraCols']))
$lv['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)'; $tabData['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
// create note if search limit was exceeded // create note if search limit was exceeded
if ($itemsets->getMatches() > CFG_SQL_LIMIT_DEFAULT) if ($itemsets->getMatches() > CFG_SQL_LIMIT_DEFAULT)
{ {
$lv['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_itemsetsfound', $itemsets->getMatches(), CFG_SQL_LIMIT_DEFAULT); $tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_itemsetsfound', $itemsets->getMatches(), CFG_SQL_LIMIT_DEFAULT);
$lv['params']['_truncated'] = 1; $tabData['_truncated'] = 1;
} }
if ($this->filterObj->error) if ($this->filterObj->error)
$lv['params']['_errors'] = '$1'; $tabData['_errors'] = 1;
$this->lvTabs[] = $lv; $this->lvTabs[] = ['itemset', $tabData];
// sort for dropdown-menus // sort for dropdown-menus
Lang::sort('itemset', 'notes', SORT_NATURAL); Lang::sort('itemset', 'notes', SORT_NATURAL);

View File

@@ -403,24 +403,18 @@ class NpcPage extends GenericPage
} }
if ($normal) if ($normal)
$this->lvTabs[] = array( $this->lvTabs[] = ['spell', array(
'file' => 'spell', 'data' => array_values($normal),
'data' => $normal,
'params' => array(
'name' => '$LANG.tab_abilities', 'name' => '$LANG.tab_abilities',
'id' => 'abilities' 'id' => 'abilities'
) )];
);
if ($controled) if ($controled)
$this->lvTabs[] = array( $this->lvTabs[] = ['spell', array(
'file' => 'spell', 'data' => array_values($controled),
'data' => $controled,
'params' => array(
'name' => '$LANG.tab_controlledabilities', 'name' => '$LANG.tab_controlledabilities',
'id' => 'controlled-abilities' 'id' => 'controlled-abilities'
) )];
);
} }
} }
@@ -437,14 +431,11 @@ class NpcPage extends GenericPage
{ {
$this->extendGlobalData($summoned->getJSGlobals()); $this->extendGlobalData($summoned->getJSGlobals());
$this->lvTabs[] = array( $this->lvTabs[] = ['spell', array(
'file' => 'spell', 'data' => array_values($summoned->getListviewData()),
'data' => $summoned->getListviewData(),
'params' => array(
'name' => '$LANG.tab_summonedby', 'name' => '$LANG.tab_summonedby',
'id' => 'summoned-by' 'id' => 'summoned-by'
) )];
);
} }
// tab: teaches // tab: teaches
@@ -496,16 +487,17 @@ class NpcPage extends GenericPage
$data[$sId]['trainingcost'] = $_; $data[$sId]['trainingcost'] = $_;
} }
$this->lvTabs[] = array( $tabData = array(
'file' => 'spell', 'data' => array_values($data),
'data' => $data,
'params' => array(
'name' => '$LANG.tab_teaches', 'name' => '$LANG.tab_teaches',
'id' => 'teaches', 'id' => 'teaches',
'visibleCols' => "$['trainingcost']", 'visibleCols' => ['trainingcost']
'extraCols' => $extra ? '$['.implode(', ', $extra).']' : null
)
); );
if ($extra)
$tabData['extraCols'] = $extra;
$this->lvTabs[] = ['spell', $tabData];
} }
} }
else else
@@ -518,9 +510,9 @@ class NpcPage extends GenericPage
$soldItems = new ItemList(array(['id', $sells])); $soldItems = new ItemList(array(['id', $sells]));
if (!$soldItems->error) if (!$soldItems->error)
{ {
$extraCols = ["Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')", 'Listview.extraCols.cost']; $extraCols = ["\$Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')", '$Listview.extraCols.cost'];
if ($soldItems->hasSetFields(['condition'])) if ($soldItems->hasSetFields(['condition']))
$extraCols[] = 'Listview.extraCols.condition'; $extraCols[] = '$Listview.extraCols.condition';
$lvData = $soldItems->getListviewData(ITEMINFO_VENDOR, [TYPE_NPC => [$this->typeId]]); $lvData = $soldItems->getListviewData(ITEMINFO_VENDOR, [TYPE_NPC => [$this->typeId]]);
@@ -529,7 +521,6 @@ class NpcPage extends GenericPage
{ {
$this->extendGlobalData($sc[1]); $this->extendGlobalData($sc[1]);
if (!array_search('Listview.extraCols.condition', $extraCols))
$extraCols[] = 'Listview.extraCols.condition'; $extraCols[] = 'Listview.extraCols.condition';
foreach ($lvData as $id => &$row) foreach ($lvData as $id => &$row)
@@ -538,15 +529,12 @@ class NpcPage extends GenericPage
$row['condition'][0][$id.':'.$this->typeId] = $cndData[$id.':'.$this->typeId]; $row['condition'][0][$id.':'.$this->typeId] = $cndData[$id.':'.$this->typeId];
} }
$this->lvTabs[] = array( $this->lvTabs[] = ['item', array(
'file' => 'item', 'data' => array_values($lvData),
'data' => $lvData,
'params' => array(
'name' => '$LANG.tab_sells', 'name' => '$LANG.tab_sells',
'id' => 'currency-for', 'id' => 'currency-for',
'extraCols' => '$['.implode(', ', $extraCols).']' 'extraCols' => array_unique($extraCols)
) )];
);
$this->extendGlobalData($soldItems->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $this->extendGlobalData($soldItems->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
} }
@@ -610,7 +598,7 @@ class NpcPage extends GenericPage
if ($creatureLoot->getByContainer($sf[0], $sf[1])) if ($creatureLoot->getByContainer($sf[0], $sf[1]))
{ {
$extraCols = $creatureLoot->extraCols; $extraCols = $creatureLoot->extraCols;
$extraCols[] = 'Listview.extraCols.percent'; $extraCols[] = '$Listview.extraCols.percent';
$this->extendGlobalData($creatureLoot->jsGlobals); $this->extendGlobalData($creatureLoot->jsGlobals);
@@ -619,27 +607,26 @@ class NpcPage extends GenericPage
if (!$lv['quest']) if (!$lv['quest'])
continue; continue;
$extraCols[] = 'Listview.extraCols.condition'; $extraCols[] = '$Listview.extraCols.condition';
$reqQuest[$lv['id']] = 0; $reqQuest[$lv['id']] = 0;
$lv['condition'][0][$this->typeId][] = [[CND_QUESTTAKEN, &$reqQuest[$lv['id']]]]; $lv['condition'][0][$this->typeId][] = [[CND_QUESTTAKEN, &$reqQuest[$lv['id']]]];
} }
$lootTab = array( $tabData = array(
'file' => 'item', 'data' => array_values($creatureLoot->getResult()),
'data' => $creatureLoot->getResult(),
'params' => array(
'name' => $sf[2], 'name' => $sf[2],
'id' => $sf[3], 'id' => $sf[3],
'extraCols' => "$[".implode(', ', array_unique($extraCols))."]", 'extraCols' => array_unique($extraCols),
'hiddenCols' => $sf[4] ? "$".Util::toJSON($sf[4]) : null, 'sort' => ['-percent', 'name'],
'sort' => "$['-percent', 'name']",
)
); );
if (!empty($sf['note'])) if (!empty($sf['note']))
$lootTab['params']['note'] = $sf['note']; $lootTab['note'] = $sf['note'];
$this->lvTabs[] = $lootTab; if ($sf[4])
$lootTab['hiddenCols'] = $sf[4];
$this->lvTabs[] = ['item', $tabData];
} }
} }
@@ -686,28 +673,18 @@ class NpcPage extends GenericPage
} }
if ($_[0]) if ($_[0])
{ $this->lvTabs[] = ['quest', array(
$this->lvTabs[] = array( 'data' => array_values($_[0]),
'file' => 'quest',
'data' => $_[0],
'params' => array(
'name' => '$LANG.tab_starts', 'name' => '$LANG.tab_starts',
'id' => 'starts' 'id' => 'starts'
) )];
);
}
if ($_[1]) if ($_[1])
{ $this->lvTabs[] = ['quest', array(
$this->lvTabs[] = array( 'data' => array_values($_[1]),
'file' => 'quest',
'data' => $_[1],
'params' => array(
'name' => '$LANG.tab_ends', 'name' => '$LANG.tab_ends',
'id' => 'ends' 'id' => 'ends'
) )];
);
}
} }
// tab: objective of quest // tab: objective of quest
@@ -724,14 +701,11 @@ class NpcPage extends GenericPage
{ {
$this->extendGlobalData($objectiveOf->getJSGlobals()); $this->extendGlobalData($objectiveOf->getJSGlobals());
$this->lvTabs[] = array( $this->lvTabs[] = ['quest', array(
'file' => 'quest', 'data' => aray_values($objectiveOf->getListviewData()),
'data' => $objectiveOf->getListviewData(),
'params' => array(
'name' => '$LANG.tab_objectiveof', 'name' => '$LANG.tab_objectiveof',
'id' => 'objective-of' 'id' => 'objective-of'
) )];
);
} }
// tab: criteria of [ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE have no data set to check for] // tab: criteria of [ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE have no data set to check for]
@@ -745,14 +719,11 @@ class NpcPage extends GenericPage
{ {
$this->extendGlobalData($crtOf->getJSGlobals()); $this->extendGlobalData($crtOf->getJSGlobals());
$this->lvTabs[] = array( $this->lvTabs[] = ['achievement', array(
'file' => 'achievement', 'data' => array_values($crtOf->getListviewData()),
'data' => $crtOf->getListviewData(),
'params' => array(
'name' => '$LANG.tab_criteriaof', 'name' => '$LANG.tab_criteriaof',
'id' => 'criteria-of' 'id' => 'criteria-of'
) )];
);
} }
// tab: passengers // tab: passengers
@@ -763,25 +734,22 @@ class NpcPage extends GenericPage
{ {
$data = $passengers->getListviewData(); $data = $passengers->getListviewData();
$xCols = null;
if (User::isInGroup(U_GROUP_STAFF)) if (User::isInGroup(U_GROUP_STAFF))
{
foreach ($data as $id => &$d) foreach ($data as $id => &$d)
$d['seat'] = str_replace(',', ', ', $_[$id]); $d['seat'] = str_replace(',', ', ', $_[$id]);
$xCols = "$[Listview.funcBox.createSimpleCol('seat', '".Lang::npc('seat')."', '10%', 'seat')]";
}
$this->extendGlobalData($passengers->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($passengers->getJSGlobals(GLOBALINFO_SELF));
$this->lvTabs[] = array(
'file' => 'creature', $tabData = array(
'data' => $data, 'data' => array_values($data),
'params' => array(
'extraCols' => $xCols,
'name' => Lang::npc('accessory'), 'name' => Lang::npc('accessory'),
'id' => 'accessory' 'id' => 'accessory'
)
); );
if (User::isInGroup(U_GROUP_STAFF))
$tabData['extraCols'] = ["\$Listview.funcBox.createSimpleCol('seat', '".Lang::npc('seat')."', '10%', 'seat')"];
$this->lvTabs[] = ['creature', $tabData];
} }
} }
} }

View File

@@ -59,31 +59,29 @@ class NpcsPage extends GenericPage
$repCols = $this->filterObj->getForm('reputationCols'); $repCols = $this->filterObj->getForm('reputationCols');
$lv = array( $tabData = array(
'file' => 'creature', 'data' => array_values($npcs->getListviewData($repCols ? NPCINFO_REP : 0x0)),
'data' => $npcs->getListviewData($repCols ? NPCINFO_REP : 0x0),
'params' => []
); );
if ($repCols) if ($repCols)
$lv['params']['extraCols'] = '$fi_getReputationCols('.Util::toJSON($repCols).')'; $tabData['extraCols'] = '$fi_getReputationCols('.Util::toJSON($repCols).')';
else if (!empty($this->filter['fi']['extraCols'])) else if (!empty($this->filter['fi']['extraCols']))
$lv['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)'; $tabData['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
if ($this->category) if ($this->category)
$lv['params']['hiddenCols'] = "$['type']"; $tabData['hiddenCols'] = ['type'];
// create note if search limit was exceeded // create note if search limit was exceeded
if ($npcs->getMatches() > CFG_SQL_LIMIT_DEFAULT) if ($npcs->getMatches() > CFG_SQL_LIMIT_DEFAULT)
{ {
$lv['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_npcsfound', $npcs->getMatches(), CFG_SQL_LIMIT_DEFAULT); $tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_npcsfound', $npcs->getMatches(), CFG_SQL_LIMIT_DEFAULT);
$lv['params']['_truncated'] = 1; $tabData['_truncated'] = 1;
} }
if ($this->filterObj->error) if ($this->filterObj->error)
$lv['params']['_errors'] = '$1'; $tabData['_errors'] = 1;
$this->lvTabs[] = $lv; $this->lvTabs[] = ['creature', $tabData];
// sort for dropdown-menus // sort for dropdown-menus
Lang::sort('game', 'fa'); Lang::sort('game', 'fa');

View File

@@ -271,14 +271,11 @@ class ObjectPage extends GenericPage
{ {
$this->extendGlobalData($summons->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $this->extendGlobalData($summons->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
$this->lvTabs[] = array( $this->lvTabs[] = ['spell', array(
'file' => 'spell', 'data' => array_values($summons->getListviewData()),
'data' => $summons->getListviewData(),
'params' => array(
'id' => 'summoned-by', 'id' => 'summoned-by',
'name' => '$LANG.tab_summonedby' 'name' => '$LANG.tab_summonedby'
) )];
);
} }
// tab: related spells // tab: related spells
@@ -293,16 +290,13 @@ class ObjectPage extends GenericPage
foreach ($data as $relId => $d) foreach ($data as $relId => $d)
$data[$relId]['trigger'] = array_search($relId, $_); $data[$relId]['trigger'] = array_search($relId, $_);
$this->lvTabs[] = array( $this->lvTabs[] = ['spell', array(
'file' => 'spell', 'data' => array_values($data),
'data' => $data,
'params' => array(
'id' => 'spells', 'id' => 'spells',
'name' => '$LANG.tab_spells', 'name' => '$LANG.tab_spells',
'hiddenCols' => "$['skill']", 'hiddenCols' => ['skill'],
'extraCols' => "$[Listview.funcBox.createSimpleCol('trigger', 'Condition', '10%', 'trigger')]" 'extraCols' => ["\$Listview.funcBox.createSimpleCol('trigger', 'Condition', '10%', 'trigger')"]
) )];
);
} }
} }
@@ -312,14 +306,11 @@ class ObjectPage extends GenericPage
{ {
$this->extendGlobalData($acvs->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $this->extendGlobalData($acvs->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
$this->lvTabs[] = array( $this->lvTabs[] = ['achievement', array(
'file' => 'achievement', 'data' => array_values($acvs->getListviewData()),
'data' => $acvs->getListviewData(),
'params' => array(
'id' => 'criteria-of', 'id' => 'criteria-of',
'name' => '$LANG.tab_criteriaof' 'name' => '$LANG.tab_criteriaof'
) )];
);
} }
// tab: starts quest // tab: starts quest
@@ -341,28 +332,18 @@ class ObjectPage extends GenericPage
} }
if ($_[0]) if ($_[0])
{ $this->lvTabs[] = ['quest', array(
$this->lvTabs[] = array( 'data' => array_values($_[0]),
'file' => 'quest',
'data' => $_[0],
'params' => array(
'name' => '$LANG.tab_starts', 'name' => '$LANG.tab_starts',
'id' => 'starts' 'id' => 'starts'
) )];
);
}
if ($_[1]) if ($_[1])
{ $this->lvTabs[] = ['quest', array(
$this->lvTabs[] = array( 'data' => array_values($_[1]),
'file' => 'quest',
'data' => $_[1],
'params' => array(
'name' => '$LANG.tab_ends', 'name' => '$LANG.tab_ends',
'id' => 'ends' 'id' => 'ends'
) )];
);
}
} }
// tab: related quests // tab: related quests
@@ -373,14 +354,11 @@ class ObjectPage extends GenericPage
{ {
$this->extendGlobalData($relQuest->getJSGlobals()); $this->extendGlobalData($relQuest->getJSGlobals());
$this->lvTabs[] = array( $this->lvTabs[] = ['quest', array(
'file' => 'quest', 'data' => array_values($relQuest->getListviewData()),
'data' => $relQuest->getListviewData(),
'params' => array(
'name' => '$LANG.tab_quests', 'name' => '$LANG.tab_quests',
'id' => 'quests' 'id' => 'quests'
) )];
);
} }
} }
@@ -412,17 +390,17 @@ class ObjectPage extends GenericPage
$lv['condition'][0][$this->typeId][] = [[CND_QUESTTAKEN, &$reqQuest[$lv['id']]]]; $lv['condition'][0][$this->typeId][] = [[CND_QUESTTAKEN, &$reqQuest[$lv['id']]]];
} }
$this->lvTabs[] = array( $tabData = array(
'file' => 'item', 'data' => array_values($goLoot->getResult()),
'data' => $goLoot->getResult(),
'params' => array(
'name' => '$LANG.tab_contains',
'id' => 'contains', 'id' => 'contains',
'extraCols' => "$[".implode(', ', array_unique($extraCols))."]", 'name' => '$LANG.tab_contains',
'hiddenCols' => $hiddenCols ? '$'.Util::toJSON(array_values($hiddenCols)) : null, 'sort' => ['-percent', 'name']
'sort' => "$['-percent', 'name']"
)
); );
if ($hiddenCols)
$tabData['hiddenCols'] = $hiddenCols;
$this->lvTabs[] = ['item', $tabData];
} }
} }
@@ -456,14 +434,11 @@ class ObjectPage extends GenericPage
{ {
$this->extendGlobalData($sameModel->getJSGlobals()); $this->extendGlobalData($sameModel->getJSGlobals());
$this->lvTabs[] = array( $this->lvTabs[] = ['object', array(
'file' => 'object', 'data' => array_values($sameModel->getListviewData()),
'data' => $sameModel->getListviewData(),
'params' => array(
'name' => '$LANG.tab_samemodelas', 'name' => '$LANG.tab_samemodelas',
'id' => 'same-model-as' 'id' => 'same-model-as'
) )];
);
} }
} }

View File

@@ -47,31 +47,26 @@ class ObjectsPage extends GenericPage
if ($_ = $this->filterObj->getConditions()) if ($_ = $this->filterObj->getConditions())
$conditions[] = $_; $conditions[] = $_;
$params = $data = []; $tabData = ['data' => []];
$objects = new GameObjectList($conditions, ['extraOpts' => $this->filterObj->extraOpts]); $objects = new GameObjectList($conditions, ['extraOpts' => $this->filterObj->extraOpts]);
if (!$objects->error) if (!$objects->error)
{ {
$data = $objects->getListviewData(); $tabData['data'] = array_values($objects->getListviewData());
if ($objects->hasSetFields(['reqSkill'])) if ($objects->hasSetFields(['reqSkill']))
$params['visibleCols'] = "$['skill']"; $tabData['visibleCols'] = ['skill'];
// create note if search limit was exceeded // create note if search limit was exceeded
if ($objects->getMatches() > CFG_SQL_LIMIT_DEFAULT) if ($objects->getMatches() > CFG_SQL_LIMIT_DEFAULT)
{ {
$params['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_objectsfound', $objects->getMatches(), CFG_SQL_LIMIT_DEFAULT); $tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_objectsfound', $objects->getMatches(), CFG_SQL_LIMIT_DEFAULT);
$params['_truncated'] = 1; $tabData['_truncated'] = 1;
} }
if ($this->filterObj->error) if ($this->filterObj->error)
$params['_errors'] = '$1'; $tabData['_errors'] = 1;
} }
$this->lvTabs[] = array( $this->lvTabs[] = ['object', $tabData];
'file' => 'object',
'data' => $data,
'params' => $params
);
} }
protected function generateTitle() protected function generateTitle()

View File

@@ -88,23 +88,17 @@ class PetPage extends GenericPage
); );
$tng = new CreatureList($condition); $tng = new CreatureList($condition);
$this->lvTabs[] = array( $this->lvTabs[] = ['creature', array(
'file' => 'creature', 'data' => array_values($tng->getListviewData(NPCINFO_TAMEABLE)),
'data' => $tng->getListviewData(NPCINFO_TAMEABLE),
'params' => array(
'name' => '$LANG.tab_tameable', 'name' => '$LANG.tab_tameable',
'hiddenCols' => "$['type']", 'hiddenCols' => ['type'],
'visibleCols' => "$['skin']", 'visibleCols' => ['skin'],
'note' => sprintf(Util::$filterResultString, '?npcs=1&filter=fa=38'), 'note' => sprintf(Util::$filterResultString, '?npcs=1&filter=fa=38'),
'id' => 'tameable' 'id' => 'tameable'
) )];
); $this->lvTabs[] = ['model', array(
'data' => array_values($tng->getListviewData(NPCINFO_MODEL))
$this->lvTabs[] = array( )];
'file' => 'model',
'data' => $tng->getListviewData(NPCINFO_MODEL),
'params' => []
);
// tab: diet // tab: diet
$list = []; $list = [];
@@ -116,16 +110,13 @@ class PetPage extends GenericPage
$food = new ItemList(array(['i.subClass', [5, 8]], ['i.FoodType', $list], CFG_SQL_LIMIT_NONE)); $food = new ItemList(array(['i.subClass', [5, 8]], ['i.FoodType', $list], CFG_SQL_LIMIT_NONE));
$this->extendGlobalData($food->getJSGlobals()); $this->extendGlobalData($food->getJSGlobals());
$this->lvTabs[] = array( $this->lvTabs[] = ['item', array(
'file' => 'item', 'data' => array_values($food->getListviewData()),
'data' => $food->getListviewData(),
'params' => array(
'name' => '$LANG.diet', 'name' => '$LANG.diet',
'hiddenCols' => "$['source', 'slot', 'side']", 'hiddenCols' => ['source', 'slot', 'side'],
'sort' => "$['level']", 'sort' => ['level'],
'id' => 'diet' 'id' => 'diet'
) )];
);
// tab: spells // tab: spells
$mask = 0x0; $mask = 0x0;
@@ -153,15 +144,12 @@ class PetPage extends GenericPage
$spells = new SpellList($conditions); $spells = new SpellList($conditions);
$this->extendGlobalData($spells->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($spells->getJSGlobals(GLOBALINFO_SELF));
$this->lvTabs[] = array( $this->lvTabs[] = ['spell', array(
'file' => 'spell', 'data' => array_values($spells->getListviewData()),
'data' => $spells->getListviewData(),
'params' => array(
'name' => '$LANG.tab_abilities', 'name' => '$LANG.tab_abilities',
'visibleCols' => "$['schools', 'level']", 'visibleCols' => ['schools', 'level'],
'id' => 'abilities' 'id' => 'abilities'
) )];
);
// tab: talents // tab: talents
$conditions = array( $conditions = array(
@@ -183,17 +171,14 @@ class PetPage extends GenericPage
$talents = new SpellList($conditions); $talents = new SpellList($conditions);
$this->extendGlobalData($talents->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($talents->getJSGlobals(GLOBALINFO_SELF));
$this->lvTabs[] = array( $this->lvTabs[] = ['spell', array(
'file' => 'spell', 'data' => array_values($talents->getListviewData()),
'data' => $talents->getListviewData(), 'visibleCols' => ['tier', 'level'],
'params' => array(
'visibleCols' => "$['tier', 'level']",
'name' => '$LANG.tab_talents', 'name' => '$LANG.tab_talents',
'id' => 'talents', 'id' => 'talents',
'sort' => "$['tier', 'name']", 'sort' => ['tier', 'name'],
'_petTalents' => 1 '_petTalents' => 1
) )];
);
} }
} }

View File

@@ -41,15 +41,16 @@ class PetsPage extends GenericPage
{ {
$this->extendGlobalData($pets->getJSGlobals(GLOBALINFO_RELATED)); $this->extendGlobalData($pets->getJSGlobals(GLOBALINFO_RELATED));
$params = ['visibleCols' => "$['abilities']"]; $data = array(
if (!$pets->hasDiffFields(['type'])) 'data' => array_values($pets->getListviewData()),
$params['hiddenCols'] = "$['type']"; 'visibleCols' => ['abilities'],
'computeDataFunc' => '$_'
$this->lvTabs[] = array(
'file' => 'pet',
'data' => $pets->getListviewData(),
'params' => $params
); );
if (!$pets->hasDiffFields(['type']))
$data['hiddenCols'] = ['type'];
$this->lvTabs[] = ['pet', $data, 'petFoodCol'];
}; };
} }

View File

@@ -93,20 +93,17 @@ class ProfilesPage extends GenericPage
// dont send ID for real chars unless they have some kind of custom avatar // dont send ID for real chars unless they have some kind of custom avatar
// on second thought .. ids are required for resync, but the function that generates the icon is faulty // on second thought .. ids are required for resync, but the function that generates the icon is faulty
$this->lvTabs[] = array( $this->lvTabs[] = ['profile', array(
'file' => 'profile',
'data' => [$exampleRow], 'data' => [$exampleRow],
'params' => [
'id' => 'characters', 'id' => 'characters',
'name' => '$LANG.tab_characters', 'name' => '$LANG.tab_characters',
'hideCount' => 1, 'hideCount' => 1,
'_truncated' => 1, '_truncated' => 1,
'roster' => 3, 'roster' => 3,
'visibleCols' => "$['race','classs','level','talents','achievementpoints']", 'visibleCols' => ['race','classs','level','talents','achievementpoints'],
'note' => '$$WH.sprintf(LANG.lvnote_charactersfound, \'20,592,390\', 200) + LANG.dash + LANG.lvnote_tryfiltering.replace(\'<a>\', \'<a href="javascript:;" onclick="fi_toggle()">\')', 'note' => '$$WH.sprintf(LANG.lvnote_charactersfound, \'20,592,390\', 200) + LANG.dash + LANG.lvnote_tryfiltering.replace(\'<a>\', \'<a href="javascript:;" onclick="fi_toggle()">\')',
'onBeforeCreate' => '$pr_initRosterListview' // $_GET['roster'] = 1|2|3|4 .. 2,3,4 arenateam-size (4 => 5-man), 1 guild .. it puts a resync button on the lv... 'onBeforeCreate' => '$pr_initRosterListview' // $_GET['roster'] = 1|2|3|4 .. 2,3,4 arenateam-size (4 => 5-man), 1 guild .. it puts a resync button on the lv...
] )];
);

View File

@@ -591,14 +591,11 @@ class QuestPage extends GenericPage
if (!$seeAlso->error) if (!$seeAlso->error)
{ {
$this->extendGlobalData($seeAlso->getJSGlobals()); $this->extendGlobalData($seeAlso->getJSGlobals());
$this->lvTabs[] = array( $this->lvTabs[] = ['quest', array(
'file' => 'quest', 'data' => array_values($seeAlso->getListviewData()),
'data' => $seeAlso->getListviewData(),
'params' => array(
'name' => '$LANG.tab_seealso', 'name' => '$LANG.tab_seealso',
'id' => 'see-also' 'id' => 'see-also'
) )];
);
} }
// tab: criteria of // tab: criteria of
@@ -606,14 +603,11 @@ class QuestPage extends GenericPage
if (!$criteriaOf->error) if (!$criteriaOf->error)
{ {
$this->extendGlobalData($criteriaOf->getJSGlobals()); $this->extendGlobalData($criteriaOf->getJSGlobals());
$this->lvTabs[] = array( $this->lvTabs[] = ['achievement', array(
'file' => 'achievement', 'data' => array_values($criteriaOf->getListviewData()),
'data' => $criteriaOf->getListviewData(),
'params' => array(
'name' => '$LANG.tab_criteriaof', 'name' => '$LANG.tab_criteriaof',
'id' => 'criteria-of' 'id' => 'criteria-of'
) )];
);
} }
// tab: conditions // tab: conditions
@@ -655,14 +649,11 @@ class QuestPage extends GenericPage
"Markup.printHtml(markup, 'tab-conditions', { allow: Markup.CLASS_STAFF })" . "Markup.printHtml(markup, 'tab-conditions', { allow: Markup.CLASS_STAFF })" .
"</script>"; "</script>";
$this->lvTabs[] = array( $this->lvTabs[] = [null, array(
'file' => null,
'data' => $tab, 'data' => $tab,
'params' => array(
'id' => 'conditions', 'id' => 'conditions',
'name' => '$LANG.requires' 'name' => '$LANG.requires'
) )];
);
} }
} }
@@ -891,29 +882,26 @@ class QuestPage extends GenericPage
if (!($se['method'] & 0x2) || $se['type'] != TYPE_NPC) if (!($se['method'] & 0x2) || $se['type'] != TYPE_NPC)
continue; continue;
if ($_ = CreatureList::getName($se['typeId'])) if ($ti = CreatureList::getName($se['typeId']))
{ {
$mail['sender'] = sprintf(Lang::quest('mailBy'), $se['typeId'], $_); $mail['sender'] = sprintf(Lang::quest('mailBy'), $se['typeId'], $ti);
break; break;
} }
} }
$extraCols = ['Listview.extraCols.percent']; $extraCols = ['$Listview.extraCols.percent'];
$mailLoot = new Loot(); $mailLoot = new Loot();
if ($mailLoot->getByContainer(LOOT_MAIL, $_)) if ($mailLoot->getByContainer(LOOT_MAIL, $_))
{ {
$this->extendGlobalData($mailLoot->jsGlobals); $this->extendGlobalData($mailLoot->jsGlobals);
$attachmentTab = array( $attachmentTab = ['item', array(
'file' => 'item', 'data' => array_values($mailLoot->getResult()),
'data' => $mailLoot->getResult(), 'name' => Lang::quest('attachment'),
'params' => array(
'name' => '[Mail Attachments]',
'id' => 'mail-attachments', 'id' => 'mail-attachments',
'extraCols' => "$[".implode(', ', array_merge($extraCols, $mailLoot->extraCols))."]", 'extraCols' => array_merge($extraCols, $mailLoot->extraCols),
'hiddenCols' => "$['side', 'slot', 'reqlevel']" 'hiddenCols' => ['side', 'slot', 'reqlevel']
) )];
);
} }
} }

View File

@@ -54,30 +54,26 @@ class QuestsPage extends GenericPage
$this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL; $this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL;
$this->filter['fi'] = $this->filterObj->getForm(); $this->filter['fi'] = $this->filterObj->getForm();
$lv = array( $tabData = ['data' => array_values($quests->getListviewData())];
'file' => 'quest',
'data' => $quests->getListviewData(),
'params' => []
);
if ($_ = $this->filterObj->getForm('reputationCols')) if ($_ = $this->filterObj->getForm('reputationCols'))
$lv['params']['extraCols'] = '$fi_getReputationCols('.Util::toJSON($_).')'; $tabData['extraCols'] = '$fi_getReputationCols('.json_encode($_, JSON_NUMERIC_CHECK).')';
else if (!empty($this->filter['fi']['extraCols'])) else if (!empty($this->filter['fi']['extraCols']))
$lv['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)'; $tabData['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
// create note if search limit was exceeded // create note if search limit was exceeded
if ($quests->getMatches() > CFG_SQL_LIMIT_DEFAULT) if ($quests->getMatches() > CFG_SQL_LIMIT_DEFAULT)
{ {
$lv['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_questsfound', $quests->getMatches(), CFG_SQL_LIMIT_DEFAULT); $tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_questsfound', $quests->getMatches(), CFG_SQL_LIMIT_DEFAULT);
$lv['params']['_truncated'] = 1; $tabData['_truncated'] = 1;
} }
else if (isset($this->category[1]) && $this->category[1] > 0) else if (isset($this->category[1]) && $this->category[1] > 0)
$lv['params']['note'] = '$$WH.sprintf(LANG.lvnote_questgivers, '.$this->category[1].', g_zones['.$this->category[1].'], '.$this->category[1].')'; $tabData['note'] = '$$WH.sprintf(LANG.lvnote_questgivers, '.$this->category[1].', g_zones['.$this->category[1].'], '.$this->category[1].')';
if ($this->filterObj->error) if ($this->filterObj->error)
$lv['params']['_errors'] = '$1'; $tabData['_errors'] = 1;
$this->lvTabs[] = $lv; $this->lvTabs[] = ['quest', $tabData];
} }
protected function generateTitle() protected function generateTitle()

View File

@@ -109,11 +109,7 @@ class RacePage extends GenericPage
if (!$classes->error) if (!$classes->error)
{ {
$this->extendGlobalData($classes->getJSGlobals()); $this->extendGlobalData($classes->getJSGlobals());
$this->lvTabs[] = array( $this->lvTabs[] = ['class', ['data' => array_values($classes->getListviewData())]];
'file' => 'class',
'data' => $classes->getListviewData(),
'params' => []
);
} }
// Tongues // Tongues
@@ -126,15 +122,12 @@ class RacePage extends GenericPage
if (!$tongues->error) if (!$tongues->error)
{ {
$this->extendGlobalData($tongues->getJSGlobals()); $this->extendGlobalData($tongues->getJSGlobals());
$this->lvTabs[] = array( $this->lvTabs[] = ['spell', array(
'file' => 'spell', 'data' => array_values($tongues->getListviewData()),
'data' => $tongues->getListviewData(),
'params' => array(
'id' => 'languages', 'id' => 'languages',
'name' => '$LANG.tab_languages', 'name' => '$LANG.tab_languages',
'hiddenCols' => "$['reagents']" 'hiddenCols' => ['reagents']
) )];
);
} }
// Racials // Racials
@@ -147,15 +140,12 @@ class RacePage extends GenericPage
if (!$racials->error) if (!$racials->error)
{ {
$this->extendGlobalData($racials->getJSGlobals()); $this->extendGlobalData($racials->getJSGlobals());
$this->lvTabs[] = array( $this->lvTabs[] = ['spell', array(
'file' => 'spell', 'data' => array_values($racials->getListviewData()),
'data' => $racials->getListviewData(),
'params' => array(
'id' => 'racial-traits', 'id' => 'racial-traits',
'name' => '$LANG.tab_racialtraits', 'name' => '$LANG.tab_racialtraits',
'hiddenCols' => "$['reagents']" 'hiddenCols' => ['reagents']
) )];
);
} }
// Quests // Quests
@@ -169,11 +159,7 @@ class RacePage extends GenericPage
if (!$quests->error) if (!$quests->error)
{ {
$this->extendGlobalData($quests->getJSGlobals()); $this->extendGlobalData($quests->getJSGlobals());
$this->lvTabs[] = array( $this->lvTabs[] = ['quest', ['data' => array_values($quests->getListviewData())]];
'file' => 'quest',
'data' => $quests->getListviewData(),
'params' => []
);
} }
// Mounts // Mounts
@@ -190,15 +176,12 @@ class RacePage extends GenericPage
if (!$mounts->error) if (!$mounts->error)
{ {
$this->extendGlobalData($mounts->getJSGlobals()); $this->extendGlobalData($mounts->getJSGlobals());
$this->lvTabs[] = array( $this->lvTabs[] = ['item', array(
'file' => 'item', 'data' => array_values($mounts->getListviewData()),
'data' => $mounts->getListviewData(),
'params' => array(
'id' => 'mounts', 'id' => 'mounts',
'name' => '$LANG.tab_mounts', 'name' => '$LANG.tab_mounts',
'hiddenCols' => "$['slot', 'type']" 'hiddenCols' => ['slot', 'type']
) )];
);
} }
} }
} }

View File

@@ -32,13 +32,7 @@ class RacesPage extends GenericPage
$races = new CharRaceList($conditions); $races = new CharRaceList($conditions);
if (!$races->error) if (!$races->error)
{ $this->lvTabs[] = ['race', ['data' => array_values($races->getListviewData())]];
$this->lvTabs[] = array(
'file' => 'race',
'data' => $races->getListviewData(),
'params' => []
);
}
} }
protected function generateTitle() protected function generateTitle()

File diff suppressed because it is too large Load Diff

View File

@@ -76,16 +76,13 @@ class SkillPage extends GenericPage
{ {
$this->extendGlobalData($recipes->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $this->extendGlobalData($recipes->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
$this->lvTabs[] = array( $this->lvTabs[] = ['spell', array(
'file' => 'spell', 'data' => array_values($recipes->getListviewData()),
'data' => $recipes->getListviewData(),
'params' => array(
'id' => 'recipes', 'id' => 'recipes',
'name' => '$LANG.tab_recipes', 'name' => '$LANG.tab_recipes',
'visibleCols' => "$['reagents', 'source']", 'visibleCols' => ['reagents', 'source'],
'note' => sprintf(Util::$filterResultString, '?spells='.$this->cat.'.'.$this->typeId.'&filter=cr=20;crs=1;crv=0') 'note' => sprintf(Util::$filterResultString, '?spells='.$this->cat.'.'.$this->typeId.'&filter=cr=20;crs=1;crv=0')
) )];
);
} }
// tab: recipe Items [items] (Books) // tab: recipe Items [items] (Books)
@@ -101,18 +98,16 @@ class SkillPage extends GenericPage
{ {
$this->extendGlobalData($recipeItems->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($recipeItems->getJSGlobals(GLOBALINFO_SELF));
if ($_ = array_search($this->typeId, $filterRecipe)) $tabData = array(
$_ = sprintf(Util::$filterResultString, "?items=9.".$_); 'data' => array_values($recipeItems->getListviewData()),
$this->lvTabs[] = array(
'file' => 'item',
'data' => $recipeItems->getListviewData(),
'params' => array(
'id' => 'recipe-items', 'id' => 'recipe-items',
'name' => '$LANG.tab_recipeitems', 'name' => '$LANG.tab_recipeitems',
'note' => $_
)
); );
if ($_ = array_search($this->typeId, $filterRecipe))
$tabData['note'] = sprintf(Util::$filterResultString, "?items=9.".$_);
$this->lvTabs[] = ['item', $tabData];
} }
// tab: crafted items [items] // tab: crafted items [items]
@@ -130,18 +125,16 @@ class SkillPage extends GenericPage
{ {
$this->extendGlobalData($created->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($created->getJSGlobals(GLOBALINFO_SELF));
if ($_ = array_search($this->typeId, $filterItem)) $tabData = array(
$_ = sprintf(Util::$filterResultString, "?items&filter=cr=86;crs=".$_.";crv=0"); 'data' => array_values($created->getListviewData()),
$this->lvTabs[] = array(
'file' => 'item',
'data' => $created->getListviewData(),
'params' => array(
'id' => 'crafted-items', 'id' => 'crafted-items',
'name' => '$LANG.tab_crafteditems', 'name' => '$LANG.tab_crafteditems',
'note' => $_
)
); );
if ($_ = array_search($this->typeId, $filterItem))
$tabData['note'] = sprintf(Util::$filterResultString, "?items&filter=cr=86;crs=".$_.";crv=0");
$this->lvTabs[] = ['item', $tabData];
} }
} }
@@ -157,18 +150,16 @@ class SkillPage extends GenericPage
{ {
$this->extendGlobalData($reqBy->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($reqBy->getJSGlobals(GLOBALINFO_SELF));
if ($_ = array_search($this->typeId, $filterItem)) $tabData = array(
$_ = sprintf(Util::$filterResultString, "?items&filter=cr=99:168;crs=".$_.":2;crv=0:0"); 'data' => array_values($reqBy->getListviewData()),
$this->lvTabs[] = array(
'file' => 'item',
'data' => $reqBy->getListviewData(),
'params' => array(
'id' => 'required-by', 'id' => 'required-by',
'name' => '$LANG.tab_requiredby', 'name' => '$LANG.tab_requiredby',
'note' => $_
)
); );
if ($_ = array_search($this->typeId, $filterItem))
$tabData['note'] = sprintf(Util::$filterResultString, "?items&filter=99:168;crs=".$_.":2;crv=0:0");
$this->lvTabs[] = ['item', $tabData];
} }
// tab: required by [itemset] // tab: required by [itemset]
@@ -182,14 +173,11 @@ class SkillPage extends GenericPage
{ {
$this->extendGlobalData($reqBy->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($reqBy->getJSGlobals(GLOBALINFO_SELF));
$this->lvTabs[] = array( $this->lvTabs[] = ['itemset', array(
'file' => 'itemset', 'data' => array_values($reqBy->getListviewData()),
'data' => $reqBy->getListviewData(),
'params' => array(
'id' => 'required-by-set', 'id' => 'required-by-set',
'name' => '$LANG.tab_requiredby' 'name' => '$LANG.tab_requiredby'
) )];
);
} }
} }
@@ -221,28 +209,27 @@ class SkillPage extends GenericPage
$this->extendGlobalData($spells->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($spells->getJSGlobals(GLOBALINFO_SELF));
$lv = array( $tabData = array(
'file' => 'spell', 'data' => array_values($spells->getListviewData()),
'data' => $spells->getListviewData(), 'visibleCols' => ['source']
'params' => ['visibleCols' => "$['source']"]
); );
switch ($this->cat) switch ($this->cat)
{ {
case -4: case -4:
$lv['params']['note'] = sprintf(Util::$filterResultString, '?spells=-4'); $tabData['note'] = sprintf(Util::$filterResultString, '?spells=-4');
break; break;
case 7: case 7:
if ($this->typeId != 769) // Internal if ($this->typeId != 769) // Internal
$lv['params']['note'] = sprintf(Util::$filterResultString, '?spells='.$this->cat.'.'.(log($reqClass, 2) + 1).'.'.$this->typeId); // doesn't matter what spell; reqClass should be identical for all Class Spells $tabData['note'] = sprintf(Util::$filterResultString, '?spells='.$this->cat.'.'.(log($reqClass, 2) + 1).'.'.$this->typeId); // doesn't matter what spell; reqClass should be identical for all Class Spells
break; break;
case 9: case 9:
case 11: case 11:
$lv['params']['note'] = sprintf(Util::$filterResultString, '?spells='.$this->cat.'.'.$this->typeId); $tabData['note'] = sprintf(Util::$filterResultString, '?spells='.$this->cat.'.'.$this->typeId);
break; break;
} }
$this->lvTabs[] = $lv; $this->lvTabs[] = ['spell', $tabData];
} }
// tab: trainers [npcs] // tab: trainers [npcs]
@@ -284,14 +271,11 @@ class SkillPage extends GenericPage
{ {
$this->extendGlobalData($trainer->getJSGlobals()); $this->extendGlobalData($trainer->getJSGlobals());
$this->lvTabs[] = array( $this->lvTabs[] = ['creature', array(
'file' => 'creature', 'data' => array_values($trainer->getListviewData()),
'data' => $trainer->getListviewData(),
'params' => array(
'id' => 'trainer', 'id' => 'trainer',
'name' => '$LANG.tab_trainers', 'name' => '$LANG.tab_trainers',
) )];
);
} }
} }
} }
@@ -321,11 +305,7 @@ class SkillPage extends GenericPage
if (!$quests->error) if (!$quests->error)
{ {
$this->extendGlobalData($quests->getJSGlobals()); $this->extendGlobalData($quests->getJSGlobals());
$this->lvTabs[] = array( $this->lvTabs[] = ['quest', ['data' => array_values($quests->getListviewData())]];
'file' => 'quest',
'data' => $quests->getListviewData(),
'params' => []
);
} }
} }
} }
@@ -340,13 +320,7 @@ class SkillPage extends GenericPage
{ {
$classes = new CharClassList(array(['id', $class])); $classes = new CharClassList(array(['id', $class]));
if (!$classes->error) if (!$classes->error)
{ $this->lvTabs[] = ['class', ['data' => array_values($classes->getListviewData())]];
$this->lvTabs[] = array(
'file' => 'class',
'data' => $classes->getListviewData(),
'params' => []
);
}
} }
// tab: related races (apply races from [spells]) // tab: related races (apply races from [spells])
@@ -359,13 +333,7 @@ class SkillPage extends GenericPage
{ {
$races = new CharRaceList(array(['id', $race])); $races = new CharRaceList(array(['id', $race]));
if (!$races->error) if (!$races->error)
{ $this->lvTabs[] = ['race', ['data' => array_values($races->getListviewData())]];
$this->lvTabs[] = array(
'file' => 'race',
'data' => $races->getListviewData(),
'params' => []
);
}
} }
} }
} }

View File

@@ -38,11 +38,7 @@ class SkillsPage extends GenericPage
$skills = new SkillList($conditions); $skills = new SkillList($conditions);
$this->lvTabs[] = array( $this->lvTabs[] = ['skill', ['data' => array_values($skills->getListviewData())]];
'file' => 'skill',
'data' => $skills->getListviewData(), // listview content
'params' => []
);
} }
protected function generateTitle() protected function generateTitle()

View File

@@ -321,20 +321,18 @@ class SpellPage extends GenericPage
$abilities = new SpellList(array(['id', $formSpells])); $abilities = new SpellList(array(['id', $formSpells]));
if (!$abilities->error) if (!$abilities->error)
{ {
if (!$abilities->hasSetFields(['skillLines'])) $tabData = array(
$abH = "$['skill']"; 'data' => array_values($abilities->getListviewData()),
$this->lvTabs[] = array(
'file' => 'spell',
'data' => $abilities->getListviewData(),
'params' => array(
'id' => 'controlledabilities', 'id' => 'controlledabilities',
'name' => '$LANG.tab_controlledabilities', 'name' => '$LANG.tab_controlledabilities',
'visibleCols' => "$['level']", 'visibleCols' => ['level'],
'hiddenCols' => isset($abH) ? $abH : null
)
); );
if (!$abilities->hasSetFields(['skillLines']))
$tabData['hiddenCols'] = ['skill'];
$this->lvTabs[] = ['spell', $tabData];
$this->extendGlobalData($abilities->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($abilities->getJSGlobals(GLOBALINFO_SELF));
} }
} }
@@ -370,20 +368,18 @@ class SpellPage extends GenericPage
$modSpells = new SpellList($conditions); $modSpells = new SpellList($conditions);
if (!$modSpells->error) if (!$modSpells->error)
{ {
if (!$modSpells->hasSetFields(['skillLines'])) $tabData = array(
$msH = "$['skill']"; 'data' => array_values($modSpells->getListviewData()),
$this->lvTabs[] = array(
'file' => 'spell',
'data' => $modSpells->getListviewData(),
'params' => array(
'id' => 'modifies', 'id' => 'modifies',
'name' => '$LANG.tab_modifies', 'name' => '$LANG.tab_modifies',
'visibleCols' => "$['level']", 'visibleCols' => ['level'],
'hiddenCols' => isset($msH) ? $msH : null
)
); );
if (!$modSpells->hasSetFields(['skillLines']))
$tabData['hiddenCols'] = ['skill'];
$this->lvTabs[] = ['spell', $tabData];
$this->extendGlobalData($modSpells->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $this->extendGlobalData($modSpells->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
} }
} }
@@ -421,20 +417,18 @@ class SpellPage extends GenericPage
$modsSpell = new SpellList($conditions); $modsSpell = new SpellList($conditions);
if (!$modsSpell->error) if (!$modsSpell->error)
{ {
if (!$modsSpell->hasSetFields(['skillLines'])) $tabData = array(
$mbH = "$['skill']"; 'data' => array_values($modsSpell->getListviewData()),
$this->lvTabs[] = array(
'file' => 'spell',
'data' => $modsSpell->getListviewData(),
'params' => array(
'id' => 'modified-by', 'id' => 'modified-by',
'name' => '$LANG.tab_modifiedby', 'name' => '$LANG.tab_modifiedby',
'visibleCols' => "$['level']", 'visibleCols' => ['level'],
'hiddenCols' => isset($mbH) ? $mbH : null
)
); );
if (!$modsSpell->hasSetFields(['skillLines']))
$tabData['hiddenCols'] = ['skill'];
$this->lvTabs[] = ['spell', $tabData];
$this->extendGlobalData($modsSpell->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $this->extendGlobalData($modsSpell->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
} }
} }
@@ -455,7 +449,7 @@ class SpellPage extends GenericPage
$data = $saSpells->getListviewData(); $data = $saSpells->getListviewData();
if ($this->difficulties) // needs a way to distinguish between dungeon and raid :x; creature using this -> map -> areaType? if ($this->difficulties) // needs a way to distinguish between dungeon and raid :x; creature using this -> map -> areaType?
{ {
$saE = '$[Listview.extraCols.mode]'; $saE = ['$Listview.extraCols.mode'];
foreach ($data as $id => &$d) foreach ($data as $id => &$d)
{ {
@@ -485,21 +479,21 @@ class SpellPage extends GenericPage
} }
} }
if (!$saSpells->hasSetFields(['skillLines'])) $tabData = array(
$saH = "$['skill']"; 'data' => array_values($data),
$this->lvTabs[] = array(
'file' => 'spell',
'data' => $data,
'params' => array(
'id' => 'see-also', 'id' => 'see-also',
'name' => '$LANG.tab_seealso', 'name' => '$LANG.tab_seealso',
'visibleCols' => "$['level']", 'visibleCols' => ['level'],
'extraCols' => isset($saE) ? $saE : null,
'hiddenCols' => isset($saH) ? $saH : null
)
); );
if (!$saSpells->hasSetFields(['skillLines']))
$tabData['hiddenCols'] = ['skill'];
if (isset($saE))
$tabData['extraCols'] = $saE;
$this->lvTabs[] = ['spell', $tabData];
$this->extendGlobalData($saSpells->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $this->extendGlobalData($saSpells->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
} }
@@ -513,14 +507,11 @@ class SpellPage extends GenericPage
$ubSets = new ItemsetList($conditions); $ubSets = new ItemsetList($conditions);
if (!$ubSets->error) if (!$ubSets->error)
{ {
$this->lvTabs[] = array( $this->lvTabs[] = ['itemset', array(
'file' => 'itemset', 'data' => array_values($ubSets->getListviewData()),
'data' => $ubSets->getListviewData(),
'params' => array(
'id' => 'used-by-itemset', 'id' => 'used-by-itemset',
'name' => '$LANG.tab_usedby' 'name' => '$LANG.tab_usedby'
) )];
);
$this->extendGlobalData($ubSets->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $this->extendGlobalData($ubSets->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
} }
@@ -538,14 +529,11 @@ class SpellPage extends GenericPage
$ubItems = new ItemList($conditions); $ubItems = new ItemList($conditions);
if (!$ubItems->error) if (!$ubItems->error)
{ {
$this->lvTabs[] = array( $this->lvTabs[] = ['item', array(
'file' => 'item', 'data' => array_values($ubItems->getListviewData()),
'data' => $ubItems->getListviewData(),
'params' => array(
'id' => 'used-by-item', 'id' => 'used-by-item',
'name' => '$LANG.tab_usedby' 'name' => '$LANG.tab_usedby'
) )];
);
$this->extendGlobalData($ubItems->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($ubItems->getJSGlobals(GLOBALINFO_SELF));
} }
@@ -560,14 +548,11 @@ class SpellPage extends GenericPage
$ubObjects = new GameObjectList($conditions); $ubObjects = new GameObjectList($conditions);
if (!$ubObjects->error) if (!$ubObjects->error)
{ {
$this->lvTabs[] = array( $this->lvTabs[] = ['object', array(
'file' => 'object', 'data' => array_values($ubObjects->getListviewData()),
'data' => $ubObjects->getListviewData(),
'params' => array(
'id' => 'used-by-object', 'id' => 'used-by-object',
'name' => '$LANG.tab_usedby' 'name' => '$LANG.tab_usedby'
) )];
);
$this->extendGlobalData($ubObjects->getJSGlobals()); $this->extendGlobalData($ubObjects->getJSGlobals());
} }
@@ -582,14 +567,11 @@ class SpellPage extends GenericPage
$coAchievemnts = new AchievementList($conditions); $coAchievemnts = new AchievementList($conditions);
if (!$coAchievemnts->error) if (!$coAchievemnts->error)
{ {
$this->lvTabs[] = array( $this->lvTabs[] = ['achievement', array(
'file' => 'achievement', 'data' => array_values($coAchievemnts->getListviewData()),
'data' => $coAchievemnts->getListviewData(),
'params' => array(
'id' => 'criteria-of', 'id' => 'criteria-of',
'name' => '$LANG.tab_criteriaof' 'name' => '$LANG.tab_criteriaof'
) )];
);
$this->extendGlobalData($coAchievemnts->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $this->extendGlobalData($coAchievemnts->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
} }
@@ -605,7 +587,7 @@ class SpellPage extends GenericPage
$lv = $spellLoot->getResult(); $lv = $spellLoot->getResult();
$extraCols = $spellLoot->extraCols; $extraCols = $spellLoot->extraCols;
$extraCols[] = 'Listview.extraCols.percent'; $extraCols[] = '$Listview.extraCols.percent';
if ($extraItem && $this->subject->canCreateItem()) if ($extraItem && $this->subject->canCreateItem())
{ {
@@ -619,7 +601,7 @@ class SpellPage extends GenericPage
$lv[$bar]['percent'] = $extraItem['additionalCreateChance']; $lv[$bar]['percent'] = $extraItem['additionalCreateChance'];
$lv[$bar]['condition'][0][$this->typeId][] = [[CND_SPELL, $extraItem['requiredSpecialization']]]; $lv[$bar]['condition'][0][$this->typeId][] = [[CND_SPELL, $extraItem['requiredSpecialization']]];
$this->extendGlobalIds(TYPE_SPELL, $extraItem['requiredSpecialization']); $this->extendGlobalIds(TYPE_SPELL, $extraItem['requiredSpecialization']);
$extraCols[] = 'Listview.extraCols.condition'; $extraCols[] = '$Listview.extraCols.condition';
if ($max = $extraItem['additionalMaxNum']) if ($max = $extraItem['additionalMaxNum'])
{ {
$lv[$bar]['mincount'] = 1; $lv[$bar]['mincount'] = 1;
@@ -631,16 +613,13 @@ class SpellPage extends GenericPage
} }
} }
$this->lvTabs[] = array( $this->lvTabs[] = ['item', array(
'file' => 'item', 'data' => array_values($lv),
'data' => $lv,
'params' => array(
'name' => '$LANG.tab_contains', 'name' => '$LANG.tab_contains',
'id' => 'contains', 'id' => 'contains',
'hiddenCols' => "$['side', 'slot', 'source', 'reqlevel']", 'hiddenCols' => ['side', 'slot', 'source', 'reqlevel'],
'extraCols' => '$['.implode(', ', $extraCols).']' 'extraCols' => $extraCols
) )];
);
} }
// tab: exclusive with // tab: exclusive with
@@ -689,19 +668,20 @@ class SpellPage extends GenericPage
$data[$k]['stackRule'] = $groups[$k]; $data[$k]['stackRule'] = $groups[$k];
if (!$stacks->hasSetFields(['skillLines'])) if (!$stacks->hasSetFields(['skillLines']))
$sH = "$['skill']"; $sH = ['skill'];
$this->lvTabs[] = array( $tabData = array(
'file' => 'spell', 'data' => array_values($data),
'data' => $data,
'params' => array(
'id' => 'spell-group-stack', 'id' => 'spell-group-stack',
'name' => 'Stack Group', // todo (med): localize 'name' => Lang::spell('stackGroup'),
'visibleCols' => "$['stackRules']", 'visibleCols' => ['stackRules']
'hiddenCols' => isset($sH) ? $sH : null
)
); );
if (isset($sH))
$tabData['hiddenCols'] = $sH;
$this->lvTabs[] = ['spell', $tabData];
$this->extendGlobalData($stacks->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $this->extendGlobalData($stacks->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
} }
} }
@@ -743,16 +723,13 @@ class SpellPage extends GenericPage
} }
} }
$this->lvTabs[] = array( $this->lvTabs[] = ['spell', array(
'file' => 'spell', 'data' => array_values($data),
'data' => $data,
'params' => array(
'id' => 'spell-link', 'id' => 'spell-link',
'name' => 'Linked with', // todo (med): localize 'name' => Lang::spell('linkedWith'),
'hiddenCols' => "$['skill', 'name']", 'hiddenCols' => ['skill', 'name'],
'visibleCols' => "$['linkedTrigger', 'linkedEffect']" 'visibleCols' => ['linkedTrigger', 'linkedEffect']
) )];
);
$this->extendGlobalData($linked->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $this->extendGlobalData($linked->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
} }
@@ -769,14 +746,11 @@ class SpellPage extends GenericPage
$trigger = new SpellList($conditions); $trigger = new SpellList($conditions);
if (!$trigger->error) if (!$trigger->error)
{ {
$this->lvTabs[] = array( $this->lvTabs[] = ['spell', array(
'file' => 'spell', 'data' => array_values($trigger->getListviewData()),
'data' => $trigger->getListviewData(),
'params' => array(
'id' => 'triggered-by', 'id' => 'triggered-by',
'name' => '$LANG.tab_triggeredby' 'name' => '$LANG.tab_triggeredby'
) )];
);
$this->extendGlobalData($trigger->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($trigger->getJSGlobals(GLOBALINFO_SELF));
} }
@@ -794,14 +768,11 @@ class SpellPage extends GenericPage
$ubCreature = new CreatureList($conditions); $ubCreature = new CreatureList($conditions);
if (!$ubCreature->error) if (!$ubCreature->error)
{ {
$this->lvTabs[] = array( $this->lvTabs[] = ['creature', array(
'file' => 'creature', 'data' => array_values($ubCreature->getListviewData()),
'data' => $ubCreature->getListviewData(),
'params' => array(
'id' => 'used-by-npc', 'id' => 'used-by-npc',
'name' => '$LANG.tab_usedby' 'name' => '$LANG.tab_usedby'
) )];
);
$this->extendGlobalData($ubCreature->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($ubCreature->getJSGlobals(GLOBALINFO_SELF));
} }
@@ -944,14 +915,15 @@ class SpellPage extends GenericPage
$_ = array_merge($_, $parents[$_['parentArea']]); $_ = array_merge($_, $parents[$_['parentArea']]);
} }
$this->lvTabs[] = array( $tabData = ['data' => array_values($lv)];
'file' => 'zone',
'data' => $lv, if ($extra)
'params' => array( {
'extraCols' => $extra ? '$[Listview.extraCols.condition]' : null, $tabData['extraCols'] = ['$Listview.extraCols.condition'];
'hiddenCols' => $extra ? "$['instancetype']" : null $tabData['hiddenCols'] = ['instancetype'];
) }
);
$this->lvTabs[] = ['zone', $tabData];
} }
} }
@@ -963,9 +935,6 @@ class SpellPage extends GenericPage
{ {
$this->extendGlobalData($teaches->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $this->extendGlobalData($teaches->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
$vis = ['level', 'schools']; $vis = ['level', 'schools'];
$hid = [];
if (!$teaches->hasSetFields(['skillLines']))
$hid[] = 'skill';
foreach ($teaches->iterate() as $__) foreach ($teaches->iterate() as $__)
{ {
@@ -976,16 +945,17 @@ class SpellPage extends GenericPage
break; break;
} }
$this->lvTabs[] = array( $tabData = array(
'file' => 'spell', 'data' => array_values($teaches->getListviewData()),
'data' => $teaches->getListviewData(),
'params' => array(
'id' => 'teaches-spell', 'id' => 'teaches-spell',
'name' => '$LANG.tab_teaches', 'name' => '$LANG.tab_teaches',
'visibleCols' => '$'.Util::toJSON($vis), 'visibleCols' => $vis,
'hiddenCols' => $hid ? '$'.Util::toJSON($hid) : null
)
); );
if (!$teaches->hasSetFields(['skillLines']))
$tabData['hiddenCols'] = ['skill'];
$this->lvTabs[] = ['spell', $tabData];
} }
} }
@@ -1036,14 +1006,11 @@ class SpellPage extends GenericPage
if (!$tbTrainer->error) if (!$tbTrainer->error)
{ {
$this->extendGlobalData($tbTrainer->getJSGlobals()); $this->extendGlobalData($tbTrainer->getJSGlobals());
$this->lvTabs[] = array( $this->lvTabs[] = ['creature', array(
'file' => 'creature', 'data' => array_values($tbTrainer->getListviewData()),
'data' => $tbTrainer->getListviewData(),
'params' => array(
'id' => 'taught-by-npc', 'id' => 'taught-by-npc',
'name' => '$LANG.tab_taughtby', 'name' => '$LANG.tab_taughtby',
) )];
);
} }
} }
} }
@@ -1061,14 +1028,11 @@ class SpellPage extends GenericPage
if (!$tbSpell->error) if (!$tbSpell->error)
{ {
$tbsData = $tbSpell->getListviewData(); $tbsData = $tbSpell->getListviewData();
$this->lvTabs[] = array( $this->lvTabs[] = ['spell', array(
'file' => 'spell', 'data' => array_values($tbsData),
'data' => $tbsData,
'params' => array(
'id' => 'taught-by-spell', 'id' => 'taught-by-spell',
'name' => '$LANG.tab_taughtby' 'name' => '$LANG.tab_taughtby'
) )];
);
$this->extendGlobalData($tbSpell->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($tbSpell->getJSGlobals(GLOBALINFO_SELF));
} }
@@ -1087,14 +1051,11 @@ class SpellPage extends GenericPage
$tbQuest = new QuestList($conditions); $tbQuest = new QuestList($conditions);
if (!$tbQuest->error) if (!$tbQuest->error)
{ {
$this->lvTabs[] = array( $this->lvTabs[] = ['quest', array(
'file' => 'quest', 'data' => array_values($tbQuest->getListviewData()),
'data' => $tbQuest->getListviewData(),
'params' => array(
'id' => 'reward-from-quest', 'id' => 'reward-from-quest',
'name' => '$LANG.tab_rewardfrom' 'name' => '$LANG.tab_rewardfrom'
) )];
);
$this->extendGlobalData($tbQuest->getJSGlobals()); $this->extendGlobalData($tbQuest->getJSGlobals());
} }
@@ -1112,14 +1073,11 @@ class SpellPage extends GenericPage
$tbItem = new ItemList($conditions); $tbItem = new ItemList($conditions);
if (!$tbItem->error) if (!$tbItem->error)
{ {
$this->lvTabs[] = array( $this->lvTabs[] = ['item', array(
'file' => 'item', 'data' => array_values($tbItem->getListviewData()),
'data' => $tbItem->getListviewData(),
'params' => array(
'id' => 'taught-by-item', 'id' => 'taught-by-item',
'name' => '$LANG.tab_taughtby' 'name' => '$LANG.tab_taughtby'
) )];
);
$this->extendGlobalData($tbItem->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($tbItem->getJSGlobals(GLOBALINFO_SELF));
} }
@@ -1134,11 +1092,10 @@ class SpellPage extends GenericPage
$enchList = new EnchantmentList($conditions); $enchList = new EnchantmentList($conditions);
if (!$enchList->error) if (!$enchList->error)
{ {
$this->lvTabs[] = array( $this->lvTabs[] = ['enchantment', array(
'file' => 'enchantment', 'data' => array_values($enchList->getListviewData()),
'data' => $enchList->getListviewData(), 'name' => Util::ucFirst(Lang::game('enchantments'))
'params' => [] ), 'enchantment'];
);
$this->extendGlobalData($enchList->getJSGlobals()); $this->extendGlobalData($enchList->getJSGlobals());
} }
@@ -1159,14 +1116,11 @@ class SpellPage extends GenericPage
"Markup.printHtml(markup, 'tab-conditions', { allow: Markup.CLASS_STAFF })" . "Markup.printHtml(markup, 'tab-conditions', { allow: Markup.CLASS_STAFF })" .
"</script>"; "</script>";
$this->lvTabs[] = array( $this->lvTabs[] = [null, array(
'file' => null,
'data' => $tab, 'data' => $tab,
'params' => array(
'id' => 'conditions', 'id' => 'conditions',
'name' => '$LANG.requires' 'name' => '$LANG.requires'
) )];
);
} }
} }

View File

@@ -100,11 +100,7 @@ class SpellsPage extends GenericPage
$conditions = []; $conditions = [];
$visibleCols = []; $visibleCols = [];
$hiddenCols = []; $hiddenCols = [];
$tab = array( $tabData = ['data' => []];
'file' => 'spell',
'data' => [],
'params' => []
);
// the next lengthy ~250 lines determine $conditions and lvParams // the next lengthy ~250 lines determine $conditions and lvParams
if ($this->category) if ($this->category)
@@ -200,10 +196,10 @@ class SpellsPage extends GenericPage
break; break;
} }
$tab['params']['note'] = '$$WH.sprintf(LANG.lvnote_pettalents, "'.$url.'")'; $tabData['note'] = '$$WH.sprintf(LANG.lvnote_pettalents, "'.$url.'")';
} }
$tab['params']['_petTalents'] = 1; // not conviced, this is correct, but .. it works $tabData['_petTalents'] = 1; // not conviced, this is correct, but .. it works
break; break;
case -11: // Proficiencies ... the subIds are actually SkillLineCategories case -11: // Proficiencies ... the subIds are actually SkillLineCategories
@@ -299,8 +295,8 @@ class SpellsPage extends GenericPage
if (is_array($note)) if (is_array($note))
$note = $note[0]; $note = $note[0];
$tab['params']['note'] = sprintf(Lang::spell('relItems', 'base'), $txt, $note); $tabData['note'] = sprintf(Lang::spell('relItems', 'base'), $txt, $note);
$tab['params']['sort'] = "$['skill', 'name']"; $tabData['sort'] = ['skill', 'name'];
} }
} }
@@ -339,8 +335,8 @@ class SpellsPage extends GenericPage
if (is_array($note)) if (is_array($note))
$note = $note[0]; $note = $note[0];
$tab['params']['note'] = sprintf(Lang::spell('relItems', 'base'), $txt, $note); $tabData['note'] = sprintf(Lang::spell('relItems', 'base'), $txt, $note);
$tab['params']['sort'] = "$['skill', 'name']"; $tabData['sort'] = ['skill', 'name'];
} }
} }
@@ -367,7 +363,7 @@ class SpellsPage extends GenericPage
$spells = new SpellList($conditions); $spells = new SpellList($conditions);
$this->extendGlobalData($spells->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $this->extendGlobalData($spells->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
$tab['data'] = $spells->getListviewData(); $tabData['data'] = array_values($spells->getListviewData());
// recreate form selection // recreate form selection
$this->filter = array_merge($this->filterObj->getForm('form'), $this->filter); $this->filter = array_merge($this->filterObj->getForm('form'), $this->filter);
@@ -375,17 +371,17 @@ class SpellsPage extends GenericPage
$this->filter['fi'] = $this->filterObj->getForm(); $this->filter['fi'] = $this->filterObj->getForm();
if (!empty($this->filter['fi']['extraCols'])) if (!empty($this->filter['fi']['extraCols']))
$tab['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)'; $tabData['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
// create note if search limit was exceeded; overwriting 'note' is intentional // create note if search limit was exceeded; overwriting 'note' is intentional
if ($spells->getMatches() > CFG_SQL_LIMIT_DEFAULT) if ($spells->getMatches() > CFG_SQL_LIMIT_DEFAULT)
{ {
$tab['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_spellsfound', $spells->getMatches(), CFG_SQL_LIMIT_DEFAULT); $tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_spellsfound', $spells->getMatches(), CFG_SQL_LIMIT_DEFAULT);
$tab['params']['_truncated'] = 1; $tabData['_truncated'] = 1;
} }
if ($this->filterObj->error) if ($this->filterObj->error)
$tab['params']['_errors'] = '$1'; $tabData['_errors'] = 1;
// add source to cols if explicitly searching for it // add source to cols if explicitly searching for it
if ($_ = $this->filterObj->getForm('setCriteria', true)) if ($_ = $this->filterObj->getForm('setCriteria', true))
@@ -404,12 +400,12 @@ class SpellsPage extends GenericPage
if ($visibleCols) if ($visibleCols)
$tab['params']['visibleCols'] = '$'.Util::toJSON($visibleCols); $tabData['visibleCols'] = $visibleCols;
if ($hiddenCols) if ($hiddenCols)
$tab['params']['hiddenCols'] = '$'.Util::toJSON($hiddenCols); $tabData['hiddenCols'] = $hiddenCols;
$this->lvTabs[] = $tab; $this->lvTabs[] = ['spell', $tabData];
// sort for dropdown-menus // sort for dropdown-menus
Lang::sort('game', 'ra'); Lang::sort('game', 'ra');

View File

@@ -104,16 +104,13 @@ class TitlePage extends GenericPage
{ {
$this->extendGlobalData($quests->getJSGlobals(GLOBALINFO_REWARDS)); $this->extendGlobalData($quests->getJSGlobals(GLOBALINFO_REWARDS));
$this->lvTabs[] = array( $this->lvTabs[] = ['quest', array(
'file' => 'quest', 'data' => array_values($quests->getListviewData()),
'data' => $quests->getListviewData(),
'params' => array(
'id' => 'reward-from-quest', 'id' => 'reward-from-quest',
'name' => '$LANG.tab_rewardfrom', 'name' => '$LANG.tab_rewardfrom',
'hiddenCols' => "$['experience', 'money']", 'hiddenCols' => ['experience', 'money'],
'visibleCols' => "$['category']" 'visibleCols' => ['category']
) )];
);
} }
// tab: achievement source // tab: achievement source
@@ -124,16 +121,13 @@ class TitlePage extends GenericPage
{ {
$this->extendGlobalData($acvs->getJSGlobals()); $this->extendGlobalData($acvs->getJSGlobals());
$this->lvTabs[] = array( $this->lvTabs[] = ['achievement', array(
'file' => 'achievement', 'data' => array_values($acvs->getListviewData()),
'data' => $acvs->getListviewData(),
'params' => array(
'id' => 'reward-from-achievement', 'id' => 'reward-from-achievement',
'name' => '$LANG.tab_rewardfrom', 'name' => '$LANG.tab_rewardfrom',
'visibleCols' => "$['category']", 'visibleCols' => ['category'],
'sort' => "$['reqlevel', 'name']" 'sort' => ['reqlevel', 'name']
) )];
);
} }
} }

View File

@@ -36,22 +36,20 @@ class TitlesPage extends GenericPage
if ($this->category) if ($this->category)
$conditions[] = ['category', $this->category[0]]; $conditions[] = ['category', $this->category[0]];
$tabData = ['data' => []];
$titles = new TitleList($conditions); $titles = new TitleList($conditions);
if (!$titles->error) if (!$titles->error)
{ {
$params = []; $tabData['data'] = array_values($titles->getListviewData());
if ($titles->hasDiffFields(['category'])) if ($titles->hasDiffFields(['category']))
$params['visibleCols'] = "$['category']"; $tabData['visibleCols'] = ['category'];
if (!$titles->hasAnySource()) if (!$titles->hasAnySource())
$params['hiddenCols'] = "$['source']"; $tabData['hiddenCols'] = ['source'];
$this->lvTabs[] = array(
'file' => 'title',
'data' => $titles->getListviewData(),
'params' => $params
);
} }
$this->lvTabs[] = ['title', $tabData];
} }
protected function generateTitle() protected function generateTitle()

View File

@@ -138,95 +138,79 @@ class UserPage extends GenericPage
foreach ($repData as &$r) foreach ($repData as &$r)
$r['when'] = date(Util::$dateFormatInternal, $r['when']); $r['when'] = date(Util::$dateFormatInternal, $r['when']);
$this->lvTabs[] = array( $this->lvTabs[] = ['reputationhistory', ['data' => $repData]];
'file' => 'reputationhistory',
'data' => $repData,
'params' => []
);
} }
// Comments // Comments
if ($_ = CommunityContent::getCommentPreviews(['user' => $this->user['id'], 'replies' => false], $nFound)) if ($_ = CommunityContent::getCommentPreviews(['user' => $this->user['id'], 'replies' => false], $nFound))
{ {
$lvData = array( $tabData = array(
'file' => 'commentpreview',
'data' => $_, 'data' => $_,
'params' => array( 'hiddenCols' => ['author'],
'hiddenCols' => "$['author']",
'onBeforeCreate' => '$Listview.funcBox.beforeUserComments', 'onBeforeCreate' => '$Listview.funcBox.beforeUserComments',
'_totalCount' => $nFound '_totalCount' => $nFound
)
); );
if ($nFound > CFG_SQL_LIMIT_DEFAULT) if ($nFound > CFG_SQL_LIMIT_DEFAULT)
{ {
$lvData['params']['name'] = '$LANG.tab_latestcomments'; $tabData['name'] = '$LANG.tab_latestcomments';
$lvData['params']['note'] = '$$WH.sprintf(LANG.lvnote_usercomments, '.$nFound.')'; $tabData['note'] = '$$WH.sprintf(LANG.lvnote_usercomments, '.$nFound.')';
} }
$this->lvTabs[] = $lvData; $this->lvTabs[] = ['commentpreview', $tabData];
} }
// Comment Replies // Comment Replies
if ($_ = CommunityContent::getCommentPreviews(['user' => $this->user['id'], 'replies' => true], $nFound)) if ($_ = CommunityContent::getCommentPreviews(['user' => $this->user['id'], 'replies' => true], $nFound))
{ {
$lvData = array( $tabData = array(
'file' => 'replypreview',
'data' => $_, 'data' => $_,
'params' => array( 'hiddenCols' => ['author'],
'hiddenCols' => "$['author']",
'onBeforeCreate' => '$Listview.funcBox.beforeUserComments', 'onBeforeCreate' => '$Listview.funcBox.beforeUserComments',
'_totalCount' => $nFound '_totalCount' => $nFound
)
); );
if ($nFound > CFG_SQL_LIMIT_DEFAULT) if ($nFound > CFG_SQL_LIMIT_DEFAULT)
{ {
$lvData['params']['name'] = '$LANG.tab_latestreplies'; $tabData['name'] = '$LANG.tab_latestreplies';
$lvData['params']['note'] = '$$WH.sprintf(LANG.lvnote_userreplies, '.$nFound.')'; $tabData['note'] = '$$WH.sprintf(LANG.lvnote_userreplies, '.$nFound.')';
} }
$this->lvTabs[] = $lvData; $this->lvTabs[] = ['replypreview', $tabData];
} }
// Screenshots // Screenshots
if ($_ = CommunityContent::getScreenshots(-$this->user['id'], 0, $nFound)) if ($_ = CommunityContent::getScreenshots(-$this->user['id'], 0, $nFound))
{ {
$lvData = array( $tabData = array(
'file' => 'screenshot',
'data' => $_, 'data' => $_,
'params' => array(
'_totalCount' => $nFound '_totalCount' => $nFound
)
); );
if ($nFound > CFG_SQL_LIMIT_DEFAULT) if ($nFound > CFG_SQL_LIMIT_DEFAULT)
{ {
$lvData['params']['name'] = '$LANG.tab_latestscreenshots'; $tabData['name'] = '$LANG.tab_latestscreenshots';
$lvData['params']['note'] = '$$WH.sprintf(LANG.lvnote_userscreenshots, '.$nFound.')'; $tabData['note'] = '$$WH.sprintf(LANG.lvnote_userscreenshots, '.$nFound.')';
} }
$this->lvTabs[] = $lvData; $this->lvTabs[] = ['screenshot', $tabData];
} }
// Videos // Videos
if ($_ = CommunityContent::getVideos(-$this->user['id'], 0, $nFound)) if ($_ = CommunityContent::getVideos(-$this->user['id'], 0, $nFound))
{ {
$lvData = array( $tabData = array(
'file' => 'video',
'data' => $_, 'data' => $_,
'params' => array(
'_totalCount' => $nFound '_totalCount' => $nFound
)
); );
if ($nFound > CFG_SQL_LIMIT_DEFAULT) if ($nFound > CFG_SQL_LIMIT_DEFAULT)
{ {
$lvData['params']['name'] = '$LANG.tab_latestvideos'; $tabData['name'] = '$LANG.tab_latestvideos';
$lvData['params']['note'] = '$$WH.sprintf(LANG.lvnote_uservideos, '.$nFound.')'; $tabData['note'] = '$$WH.sprintf(LANG.lvnote_uservideos, '.$nFound.')';
} }
$this->lvTabs[] = $lvData; $this->lvTabs[] = ['video', $tabData];
} }
// forum -> latest topics [unused] // forum -> latest topics [unused]
@@ -235,6 +219,34 @@ class UserPage extends GenericPage
// Characters [todo] // Characters [todo]
$this->user['characterData'] = []; $this->user['characterData'] = [];
/*
us_addCharactersTab([
{
id:763,
"name":"Lilywhite",
"achievementpoints":"0",
"guild":"whatever",
"guildrank":"0",
"realm":"draenor",
"realmname":"Draenor",
"battlegroup":"cyclone",
"battlegroupname":"Cyclone",
"region":"us",
"level":"10",
"race":"7",
"gender":"0",
"classs":"1",
"faction":"0",
"gearscore":"0",
"talenttree1":"0",
"talenttree2":"0",
"talenttree3":"0",
"talentspec":0,
"published":1,
"pinned":0
}
]);
*/
// Profiles [todo] // Profiles [todo]
$this->user['profileData'] = []; $this->user['profileData'] = [];

View File

@@ -91,13 +91,8 @@ class UtilityPage extends GenericPage
} }
} }
else else
{ $this->lvTabs[] = ['commentpreview', ['data' => $data]];
$this->lvTabs[] = array(
'file' => 'commentpreview',
'data' => $data,
'params' => []
);
}
break; break;
case 'latest-screenshots': // rss case 'latest-screenshots': // rss
$data = CommunityContent::getScreenshots(); $data = CommunityContent::getScreenshots();
@@ -124,13 +119,8 @@ class UtilityPage extends GenericPage
} }
} }
else else
{ $this->lvTabs[] = ['screenshot', ['data' => $data]];
$this->lvTabs[] = array(
'file' => 'screenshot',
'data' => $data,
'params' => []
);
}
break; break;
case 'latest-videos': // rss case 'latest-videos': // rss
$data = CommunityContent::getVideos(); $data = CommunityContent::getVideos();
@@ -157,13 +147,8 @@ class UtilityPage extends GenericPage
} }
} }
else else
{ $this->lvTabs[] = ['video', ['data' => $data]];
$this->lvTabs[] = array(
'file' => 'video',
'data' => $data,
'params' => []
);
}
break; break;
case 'latest-articles': // rss case 'latest-articles': // rss
$this->lvTabs = []; $this->lvTabs = [];
@@ -172,11 +157,7 @@ class UtilityPage extends GenericPage
$extraText = ''; $extraText = '';
break; break;
case 'unrated-comments': case 'unrated-comments':
$this->lvTabs[] = array( $this->lvTabs[] = ['commentpreview', ['data' => []]];
'file' => 'commentpreview',
'data' => [],
'params' => []
);
break; break;
case 'missing-screenshots': case 'missing-screenshots':
// limit to 200 entries each (it generates faster, consumes less memory and should be enough options) // limit to 200 entries each (it generates faster, consumes less memory and should be enough options)
@@ -193,11 +174,7 @@ class UtilityPage extends GenericPage
if (!$typeObj->error) if (!$typeObj->error)
{ {
$this->extendGlobalData($typeObj->getJSGlobals(GLOBALINFO_ANY)); $this->extendGlobalData($typeObj->getJSGlobals(GLOBALINFO_ANY));
$this->lvTabs[] = array( $this->lvTabs[] = [$typeObj::$brickFile, ['data' => array_values($typeObj->getListviewData())]];
'file' => $typeObj::$brickFile,
'data' => $typeObj->getListviewData(),
'params' => []
);
} }
} }
break; break;
@@ -205,9 +182,9 @@ class UtilityPage extends GenericPage
if ($this->category && !in_array($this->category[0], [1, 7, 30])) if ($this->category && !in_array($this->category[0], [1, 7, 30]))
header('Location: ?most-comments=1'.($this->rss ? '&rss' : null), true, 302); header('Location: ?most-comments=1'.($this->rss ? '&rss' : null), true, 302);
$params = array( $tabBase = array(
'extraCols' => '$[Listview.funcBox.createSimpleCol(\'ncomments\', \'tab_comments\', \'10%\', \'ncomments\')]', 'extraCols' => ["\$Listview.funcBox.createSimpleCol('ncomments', 'tab_comments', '10%', 'ncomments')"],
'sort' => '$[\'-ncomments\']' 'sort' => ['-ncomments']
); );
foreach (Util::$typeClasses as $type => $classStr) foreach (Util::$typeClasses as $type => $classStr)
@@ -250,11 +227,7 @@ class UtilityPage extends GenericPage
$d['ncomments'] = $comments[$typeId]; $d['ncomments'] = $comments[$typeId];
$this->extendGlobalData($typeClass->getJSGlobals(GLOBALINFO_ANY)); $this->extendGlobalData($typeClass->getJSGlobals(GLOBALINFO_ANY));
$this->lvTabs[] = array( $this->lvTabs[] = [$typeClass::$brickFile, array_merge($tabBase, ['data' => array_values($data)])];
'file' => $typeClass::$brickFile,
'data' => $data,
'params' => $params
);
} }
} }
} }
@@ -263,14 +236,9 @@ class UtilityPage extends GenericPage
} }
// found nothing => set empty content // found nothing => set empty content
// tpl: commentpreview - anything, doesn't matter what
if (!$this->lvTabs && !$this->rss) if (!$this->lvTabs && !$this->rss)
{ $this->lvTabs[] = ['commentpreview', ['data' => []]];
$this->lvTabs[] = array(
'file' => 'commentpreview', // anything, doesn't matter what
'data' => [],
'params' => []
);
}
} }
protected function generateRSS() protected function generateRSS()

View File

@@ -460,45 +460,42 @@ class ZonePage extends GenericPage
// tab: NPCs // tab: NPCs
if ($cSpawns && !$creatureSpawns->error) if ($cSpawns && !$creatureSpawns->error)
{ {
$lvData = array( $tabData = array(
'file' => 'creature', 'data' => array_values($creatureSpawns->getListviewData()),
'data' => $creatureSpawns->getListviewData(), 'note' => sprintf(Util::$filterResultString, '?npcs&filter=cr=6;crs='.$this->typeId.';crv=0')
'params' => ['note' => sprintf(Util::$filterResultString, '?npcs&filter=cr=6;crs='.$this->typeId.';crv=0')]
); );
if ($creatureSpawns->getMatches() > CFG_SQL_LIMIT_DEFAULT) if ($creatureSpawns->getMatches() > CFG_SQL_LIMIT_DEFAULT)
$lvData['params']['_truncated'] = 1; $tabData['_truncated'] = 1;
$this->extendGlobalData($creatureSpawns->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($creatureSpawns->getJSGlobals(GLOBALINFO_SELF));
$this->lvTabs[] = $lvData; $this->lvTabs[] = ['creature', $tabData];
} }
// tab: Objects // tab: Objects
if ($oSpawns && !$objectSpawns->error) if ($oSpawns && !$objectSpawns->error)
{ {
$lvData = array( $tabData = array(
'file' => 'object', 'data' => array_values($objectSpawns->getListviewData()),
'data' => $objectSpawns->getListviewData(), 'note' => sprintf(Util::$filterResultString, '?objects&filter=cr=1;crs='.$this->typeId.';crv=0')
'params' => ['note' => sprintf(Util::$filterResultString, '?objects&filter=cr=1;crs='.$this->typeId.';crv=0')]
); );
if ($objectSpawns->getMatches() > CFG_SQL_LIMIT_DEFAULT) if ($objectSpawns->getMatches() > CFG_SQL_LIMIT_DEFAULT)
$lvData['params']['_truncated'] = 1; $tabData['_truncated'] = 1;
$this->extendGlobalData($objectSpawns->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($objectSpawns->getJSGlobals(GLOBALINFO_SELF));
$this->lvTabs[] = $lvData; $this->lvTabs[] = ['object', $tabData];
} }
// tab: Quests [data collected by SOM-routine] // tab: Quests [data collected by SOM-routine]
if ($questsLV) if ($questsLV)
{ {
$this->lvTabs[] = array( $this->lvTabs[] = ['quest', array(
'file' => 'quest', 'data' => array_values($questsLV),
'data' => $questsLV, 'note' => '$$WH.sprintf(LANG.lvnote_zonequests, '.$this->subject->getField('mapId').', '.$this->typeId.', \''.Util::jsEscape($this->subject->getField('name', true)).'\', '.$this->typeId.')'
'params' => ['note' => '$$WH.sprintf(LANG.lvnote_zonequests, '.$this->subject->getField('mapId').', '.$this->typeId.', \''.Util::jsEscape($this->subject->getField('name', true)).'\', '.$this->typeId.')'] )];
);
} }
// tab: item-quest starter // tab: item-quest starter
@@ -517,14 +514,11 @@ class ZonePage extends GenericPage
$qsiList = new ItemList(array(['id', array_keys($questStartItem)])); $qsiList = new ItemList(array(['id', array_keys($questStartItem)]));
if (!$qsiList->error) if (!$qsiList->error)
{ {
$this->lvTabs[] = array( $this->lvTabs[] = ['item', array(
'file' => 'item', 'data' => array_values($qsiList->getListviewData()),
'data' => $qsiList->getListviewData(),
'params' => [
'name' => '$LANG.tab_startsquest', 'name' => '$LANG.tab_startsquest',
'id' => 'starts-quest' 'id' => 'starts-quest'
] )];
);
$this->extendGlobalData($qsiList->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($qsiList->getJSGlobals(GLOBALINFO_SELF));
} }
@@ -536,15 +530,12 @@ class ZonePage extends GenericPage
$rewards = new ItemList(array(['id', array_unique($rewardsLV)])); $rewards = new ItemList(array(['id', array_unique($rewardsLV)]));
if (!$rewards->error) if (!$rewards->error)
{ {
$this->lvTabs[] = array( $this->lvTabs[] = ['item', array(
'file' => 'item', 'data' => array_values($rewards->getListviewData()),
'data' => $rewards->getListviewData(),
'params' => [
'name' => '$LANG.tab_questrewards', 'name' => '$LANG.tab_questrewards',
'id' => 'quest-rewards', 'id' => 'quest-rewards',
'note' => sprintf(Util::$filterResultString, '?items&filter=cr=126;crs='.$this->typeId.';crv=0') 'note' => sprintf(Util::$filterResultString, '?items&filter=cr=126;crs='.$this->typeId.';crv=0')
] )];
);
$this->extendGlobalData($rewards->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($rewards->getJSGlobals(GLOBALINFO_SELF));
} }
@@ -557,30 +548,27 @@ class ZonePage extends GenericPage
if ($fish->getByContainer(LOOT_FISHING, $this->typeId)) if ($fish->getByContainer(LOOT_FISHING, $this->typeId))
{ {
$this->extendGlobalData($fish->jsGlobals); $this->extendGlobalData($fish->jsGlobals);
$xCols = array_merge(['Listview.extraCols.percent'], $fish->extraCols); $xCols = array_merge(['$Listview.extraCols.percent'], $fish->extraCols);
foreach ($fish->iterate() as $lv) foreach ($fish->iterate() as $lv)
{ {
if (!$lv['quest']) if (!$lv['quest'])
continue; continue;
$xCols = array_merge($xCols, ['Listview.extraCols.condition']); $xCols = array_merge($xCols, ['$Listview.extraCols.condition']);
$reqQuest[$lv['id']] = 0; $reqQuest[$lv['id']] = 0;
$lv['condition'][0][$this->typeId][] = [[CND_QUESTTAKEN, &$reqQuest[$lv['id']]]]; $lv['condition'][0][$this->typeId][] = [[CND_QUESTTAKEN, &$reqQuest[$lv['id']]]];
} }
$this->lvTabs[] = array( $this->lvTabs[] = ['item', array(
'file' => 'item', 'data' => array_values($fish->getResult()),
'data' => $fish->getResult(),
'params' => [
'name' => '$LANG.tab_fishing', 'name' => '$LANG.tab_fishing',
'id' => 'fishing', 'id' => 'fishing',
'extraCols' => $xCols ? "$[".implode(', ', array_unique($xCols))."]" : null, 'extraCols' => array_unique($xCols),
'hiddenCols' => "$['side']" 'hiddenCols' => ['side']
] )];
);
} }
// tab: spells // tab: spells
@@ -672,14 +660,15 @@ class ZonePage extends GenericPage
} }
} }
$this->lvTabs[] = array( $tabData = array(
'file' => 'spell', 'data' => array_values($lvSpells),
'data' => $lvSpells, 'hiddenCols' => ['skill']
'params' => array(
'extraCols' => $extra ? '$[Listview.extraCols.condition]' : null,
'hiddenCols' => "$['skill']"
)
); );
if ($extra)
$tabData['extraCols'] = ['$Listview.extraCols.condition'];
$this->lvTabs[] = ['spell', $tabData];
} }
} }
@@ -687,15 +676,12 @@ class ZonePage extends GenericPage
$subZones = new ZoneList(array(['parentArea', $this->typeId])); $subZones = new ZoneList(array(['parentArea', $this->typeId]));
if (!$subZones->error) if (!$subZones->error)
{ {
$this->lvTabs[] = array( $this->lvTabs[] = ['zone', array(
'file' => 'zone', 'data' => array_values($subZones->getListviewData()),
'data' => $subZones->getListviewData(),
'params' => [
'name' => '$LANG.tab_zones', 'name' => '$LANG.tab_zones',
'id' => 'subzones', 'id' => 'subzones',
'hiddenCols' => "$['territory', 'instancetype']" 'hiddenCols' => ['territory', 'instancetype']
] )];
);
$this->extendGlobalData($subZones->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($subZones->getJSGlobals(GLOBALINFO_SELF));
} }

View File

@@ -32,7 +32,6 @@ class ZonesPage extends GenericPage
$conditions = [CFG_SQL_LIMIT_NONE]; $conditions = [CFG_SQL_LIMIT_NONE];
$visibleCols = []; $visibleCols = [];
$hiddenCols = []; $hiddenCols = [];
$params = [];
$mapFile = 0; $mapFile = 0;
$spawnMap = -1; $spawnMap = -1;
@@ -75,18 +74,16 @@ class ZonesPage extends GenericPage
if (!$zones->hasSetFields(['type'])) if (!$zones->hasSetFields(['type']))
$hiddenCols[] = 'instancetype'; $hiddenCols[] = 'instancetype';
$tabData = ['data' => array_values($zones->getListviewData())];
if ($visibleCols) if ($visibleCols)
$params['visibleCols'] = "$['".implode("', '", $visibleCols)."']"; $tabData['visibleCols'] = $visibleCols;
if ($hiddenCols) if ($hiddenCols)
$params['hiddenCols'] = "$['".implode("', '", $hiddenCols)."']"; $tabData['hiddenCols'] = $hiddenCols;
$this->map = null; $this->map = null;
$this->lvTabs[] = array( $this->lvTabs[] = ['zone', $tabData];
'file' => 'zone',
'data' => $zones->getListviewData(),
'params' => $params
);
// create flight map // create flight map
if ($mapFile) if ($mapFile)

View File

@@ -1,12 +1,9 @@
<?php <?php
foreach ($this->announcements as $id => $data): foreach ($this->announcements as $id => $data):
$data = json_encode($data, JSON_NUMERIC_CHECK);
// json_encode does not recognize variables
$data = preg_replace('/"\$((.+?)([^\\\\]))"/i', '$1', $data);
?> ?>
<div id="announcement-<?php echo $id; ?>"></div> <div id="announcement-<?=$id; ?>"></div>
<script type="text/javascript"> <script type="text/javascript">
new Announcement(<?php echo $data; ?>); new Announcement(<?=Util::toJSON($data); ?>);
</script> </script>
<?php <?php
endforeach; endforeach;

View File

@@ -2,11 +2,11 @@
if (!empty($this->pageText)): if (!empty($this->pageText)):
?> ?>
<div class="clear"></div> <div class="clear"></div>
<h3><?php echo Lang::item('content'); ?></h3> <h3><?=Lang::item('content'); ?></h3>
<div id="book-generic"></div> <div id="book-generic"></div>
<script>//<![CDATA[ <script>//<![CDATA[
new Book({ parent: 'book-generic', pages: <?php echo json_encode($this->pageText); ?>}) new Book({ parent: 'book-generic', pages: <?=Util::toJSON($this->pageText); ?>})
//]]></script> //]]></script>
<?php <?php
endif; endif;

View File

@@ -3,6 +3,8 @@ $relTabs = !empty($relTabs);
$tabVar = $relTabs || !empty($this->user) ? 'tabsRelated' : 'myTabs'; $tabVar = $relTabs || !empty($this->user) ? 'tabsRelated' : 'myTabs';
$isTabbed = !empty($this->forceTabs) || $relTabs || count($this->lvTabs) > 1; $isTabbed = !empty($this->forceTabs) || $relTabs || count($this->lvTabs) > 1;
// lvTab: [file, data, extraInclude]
if ($isTabbed): if ($isTabbed):
?> ?>
<div class="clear"></div> <div class="clear"></div>
@@ -10,17 +12,17 @@ if ($isTabbed):
<?php endif; ?> <?php endif; ?>
<div id="lv-generic" class="listview"><?php <div id="lv-generic" class="listview"><?php
foreach ($this->lvTabs as $lv): foreach ($this->lvTabs as $lv):
if ($lv['file']): if ($lv[0]):
continue; continue;
endif; endif;
echo '<div class="text tabbed-contents" id="tab-'.$lv['params']['id'].'" style="display:none;">'.$lv['data'].'</div>'; echo '<div class="text tabbed-contents" id="tab-'.$lv[1]['id'].'" style="display:none;">'.$lv[1]['data'].'</div>';
endforeach; endforeach;
?></div> ?></div>
<script type="text/javascript">//<![CDATA[ <script type="text/javascript">//<![CDATA[
<?php <?php
if (!empty($this->gemScores)): // inherited from items.tpl.php if (!empty($this->gemScores)): // inherited from items.tpl.php
echo " var fi_gemScores = ".json_encode($this->gemScores, JSON_NUMERIC_CHECK).";\n"; echo " var fi_gemScores = ".Util::toJSON($this->gemScores).";\n";
endif; endif;
if ($isTabbed): if ($isTabbed):
@@ -28,16 +30,26 @@ if ($isTabbed):
endif; endif;
foreach ($this->lvTabs as $lv): foreach ($this->lvTabs as $lv):
if (!empty($lv['data']) || (count($this->lvTabs) == 1 && !$relTabs)): if (!empty($lv[1]['data']) || (count($this->lvTabs) == 1 && !$relTabs)):
if ($isTabbed): if ($isTabbed):
$lv['params']['tabs'] = '$'.$tabVar; $lv[1]['tabs'] = '$'.$tabVar;
endif; endif;
if ($lv['file']): if ($lv[0]):
$this->lvBrick($lv['file'], ['data' => $lv['data'], 'params' => $lv['params']]); // extra functions on top of lv
if (isset($lv[2])):
$this->lvBrick($lv[2]);
endif;
if (isset($this->lvTemplates[$lv[0]])):
echo "new Listview(".Util::toJSON(array_merge($this->lvTemplates[$lv[0]], $lv[1])).");\n";
else:
// does not appear as announcement, those have already been handled at this point
trigger_error('requested undefined listview: '.$lv[0], E_USER_ERROR);
endif;
elseif ($isTabbed): elseif ($isTabbed):
$n = $lv['params']['name'][0] == '$' ? substr($lv['params']['name'], 1) : "'".$lv['params']['name']."'"; $n = $lv[1]['name'][0] == '$' ? substr($lv[1]['name'], 1) : "'".$lv[1]['name']."'";
echo $tabVar.".add(".$n.", { id: '".$lv['params']['id']."' });\n"; echo $tabVar.".add(".$n.", { id: '".$lv[1]['id']."' });\n";
endif; endif;
endif; endif;
endforeach; endforeach;
@@ -51,10 +63,10 @@ if (!empty($this->user)):
endif; endif;
elseif ($relTabs): elseif ($relTabs):
?> ?>
new Listview({template: 'comment', id: 'comments', name: LANG.tab_comments, tabs: <?php echo $tabVar; ?>, parent: 'lv-generic', data: lv_comments}); new Listview({template: 'comment', id: 'comments', name: LANG.tab_comments, tabs: <?=$tabVar; ?>, parent: 'lv-generic', data: lv_comments});
new Listview({template: 'screenshot', id: 'screenshots', name: LANG.tab_screenshots, tabs: <?php echo $tabVar; ?>, parent: 'lv-generic', data: lv_screenshots}); new Listview({template: 'screenshot', id: 'screenshots', name: LANG.tab_screenshots, tabs: <?=$tabVar; ?>, parent: 'lv-generic', data: lv_screenshots});
if (lv_videos.length || (g_user && g_user.roles & (U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_VIDEO))) if (lv_videos.length || (g_user && g_user.roles & (U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_VIDEO)))
new Listview({template: 'video', id: 'videos', name: LANG.tab_videos, tabs: <?php echo $tabVar; ?>, parent: 'lv-generic', data: lv_videos}); new Listview({template: 'video', id: 'videos', name: LANG.tab_videos, tabs: <?=$tabVar; ?>, parent: 'lv-generic', data: lv_videos});
<?php <?php
endif; endif;

View File

@@ -53,14 +53,14 @@ elseif (!empty($this->map['data'])):
if (!empty($this->map['data']['zone'])): if (!empty($this->map['data']['zone'])):
echo " ".(!empty($this->gPageInfo) ? "$.extend(g_pageInfo, {id: ".$this->map['data']['zone']."})" : "var g_pageInfo = {id: ".$this->map['data']['zone']."}").";\n"; echo " ".(!empty($this->gPageInfo) ? "$.extend(g_pageInfo, {id: ".$this->map['data']['zone']."})" : "var g_pageInfo = {id: ".$this->map['data']['zone']."}").";\n";
elseif (!empty($this->map['mapperData'])): elseif (!empty($this->map['mapperData'])):
echo " var g_mapperData = ".json_encode($this->map['mapperData'], JSON_NUMERIC_CHECK).";\n"; echo " var g_mapperData = ".Util::toJSON($this->map['mapperData']).";\n";
endif; endif;
// dont forget to set "parent: 'mapper-generic'" // dont forget to set "parent: 'mapper-generic'"
echo " var myMapper = new Mapper(".json_encode($this->map['data'], JSON_NUMERIC_CHECK).");\n"; echo " var myMapper = new Mapper(".Util::toJSON($this->map['data']).");\n";
if (isset($this->map['som'])): if (isset($this->map['som'])):
echo " new ShowOnMap(".json_encode($this->map['som'], JSON_NUMERIC_CHECK).");\n"; echo " new ShowOnMap(".Util::toJSON($this->map['som']).");\n";
endif; endif;
if ($this->type != TYPE_ZONE): if ($this->type != TYPE_ZONE):

View File

@@ -1,13 +1,13 @@
<script type="text/javascript">//<![CDATA[ <script type="text/javascript">//<![CDATA[
<?php <?php
if (!empty($this->hasComContent)): if (!empty($this->hasComContent)):
echo " var lv_comments = ".json_encode($this->community['co'], JSON_NUMERIC_CHECK).";\n"; echo " var lv_comments = ".Util::toJSON($this->community['co']).";\n";
echo " var lv_screenshots = ".json_encode($this->community['sc'], JSON_NUMERIC_CHECK).";\n"; echo " var lv_screenshots = ".Util::toJSON($this->community['sc']).";\n";
echo " var lv_videos = ".json_encode($this->community['vi'], JSON_NUMERIC_CHECK).";\n"; echo " var lv_videos = ".Util::toJSON($this->community['vi']).";\n";
endif; endif;
if (!empty($this->gPageInfo)): if (!empty($this->gPageInfo)):
echo " var g_pageInfo = ".json_encode($this->gPageInfo, JSON_NUMERIC_CHECK).";\n"; echo " var g_pageInfo = ".Util::toJSON($this->gPageInfo).";\n";
// only used by item.php // only used by item.php
if (User::$id > 0 && isset($this->redButtons[BUTTON_EQUIP]) && $this->redButtons[BUTTON_EQUIP]): if (User::$id > 0 && isset($this->redButtons[BUTTON_EQUIP]) && $this->redButtons[BUTTON_EQUIP]):
@@ -20,7 +20,7 @@ if (!empty($this->pageTemplate)):
echo " Locale.set(".User::$localeId.");\n"; echo " Locale.set(".User::$localeId.");\n";
endif; endif;
echo " PageTemplate.set(".json_encode($this->pageTemplate, JSON_NUMERIC_CHECK).");\n"; echo " PageTemplate.set(".Util::toJSON($this->pageTemplate).");\n";
echo " PageTemplate.init();\n"; echo " PageTemplate.init();\n";
endif; endif;

View File

@@ -21,15 +21,8 @@ endif;
// view in 3D // view in 3D
if (isset($this->redButtons[BUTTON_VIEW3D])): if (isset($this->redButtons[BUTTON_VIEW3D])):
if ($b = $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 '<a href="javascript:;" id="view3D-button" class="button-red" onclick="this.blur(); ModelViewer.show({'.strtr(Util::toJSON($b), ['"' => '']).'})"><em><b><i>'.Lang::main('view3D').'</i></b><span>'.Lang::main('view3D').'</span></em></a>';
// json_encode puts property names in brackets wich is not cool with inline javascript
$data = [];
foreach ($b as $k => $v)
$data[] = $k.': '.json_encode($v, JSON_NUMERIC_CHECK);
echo '<a href="javascript:;" id="view3D-button" class="button-red" onclick="this.blur(); ModelViewer.show({'.implode(', ', $data).'})"><em><b><i>'.Lang::main('view3D').'</i></b><span>'.Lang::main('view3D').'</span></em></a>';
}
else: else:
echo '<a href="javascript:;" id="view3D-button" class="button-red button-red-disabled"><em><b><i>'.Lang::main('view3D').'</i></b><span>'.Lang::main('view3D').'</span></em></a>'; echo '<a href="javascript:;" id="view3D-button" class="button-red button-red-disabled"><em><b><i>'.Lang::main('view3D').'</i></b><span>'.Lang::main('view3D').'</span></em></a>';
endif; endif;

View File

@@ -1,17 +0,0 @@
new Listview({
template:'achievement',
<?php
echo !isset($params['id']) ? "id:'achievements'," : null;
echo !isset($params['name']) ? "name:LANG.tab_achievements," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -1,17 +0,0 @@
new Listview({
template:'holidaycal',
<?php
echo !isset($params['id']) ? "id:'calendar'," : null;
echo !isset($params['name']) ? "name:LANG.tab_calendar," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -1,26 +0,0 @@
us_addCharactersTab([
{
id:763,
"name":"Lilywhite",
"achievementpoints":"0",
"guild":"whatever",
"guildrank":"0",
"realm":"draenor",
"realmname":"Draenor",
"battlegroup":"cyclone",
"battlegroupname":"Cyclone",
"region":"us",
"level":"10",
"race":"7",
"gender":"0",
"classs":"1",
"faction":"0",
"gearscore":"0",
"talenttree1":"0",
"talenttree2":"0",
"talenttree3":"0",
"talentspec":0,
"published":1,
"pinned":0
}
]);

View File

@@ -1,17 +0,0 @@
new Listview({
template:'classs',
<?php
echo !isset($params['id']) ? "id:'classes'," : null;
echo !isset($params['name']) ? "name:LANG.tab_classes," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -1,17 +0,0 @@
new Listview({
template:'commentpreview',
<?php
echo !isset($params['id']) ? "id:'comments'," : null;
echo !isset($params['name']) ? "name:LANG.tab_comments," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -1,34 +0,0 @@
<?php
if (!empty($params['extraCols']) && strpos($params['extraCols'], '_')):
?>
var _ = [
{
id: 'reputation',
after: 'location',
name: LANG.rep,
tooltip: LANG.tooltip_repgain,
width: '8%',
value: 'reputation'
}
];
<?php
endif;
?>
new Listview({
template:'npc',
<?php
echo !isset($params['id']) ? "id:'npcs'," : null;
echo !isset($params['name']) ? "name:LANG.tab_npcs," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -1,17 +0,0 @@
new Listview({
template:'currency',
<?php
echo !isset($params['id']) ? "id:'currencies'," : null;
echo !isset($params['name']) ? "name:LANG.tab_currencies," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -70,21 +70,3 @@ Listview.templates.emote = {
return '?emote=' + emote.id; return '?emote=' + emote.id;
} }
} }
new Listview({
template:'emote',
<?php
echo !isset($params['id']) ? "id:'emote'," : null;
echo !isset($params['name']) ? "name:'".Util::ucFirst(Lang::game('emotes'))."'," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -138,21 +138,3 @@ Listview.templates.enchantment = {
return '?enchantment=' + enchantment.id; return '?enchantment=' + enchantment.id;
} }
} }
new Listview({
template:'enchantment',
<?php
echo !isset($params['id']) ? "id:'enchantment'," : null;
echo !isset($params['name']) ? "name:'".Util::ucFirst(Lang::game('enchantments'))."'," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -1,17 +0,0 @@
new Listview({
template:'holiday',
<?php
echo !isset($params['id']) ? "id:'holidays'," : null;
echo !isset($params['name']) ? "name:LANG.tab_holidays," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -1,17 +0,0 @@
new Listview({
template:'faction',
<?php
echo !isset($params['id']) ? "id:'factions'," : null;
echo !isset($params['name']) ? "name:LANG.tab_factions," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -1,18 +0,0 @@
new Listview({
template:'genericmodel',
<?php
echo !isset($params['id']) ? "id:'same-model-as'," : null;
echo !isset($params['name']) ? "name:LANG.tab_samemodelas," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
/* genericlinktype: 'item|object', */
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -1,6 +1,3 @@
<?php
if (!empty($params['extraCols']) && strpos($params['extraCols'], '_')):
?>
var _ = [ var _ = [
{ {
id: 'standing', id: 'standing',
@@ -20,28 +17,7 @@ var _ = [
} }
]; ];
<?php <?php
endif;
?>
new Listview({
template:'item',
<?php
echo !isset($params['id']) ? "id:'items'," : null;
echo !isset($params['name']) ? "name:LANG.tab_items," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});
<?php
// 4.3 loot-example // 4.3 loot-example
// template: 'item', // template: 'item',

View File

@@ -1,17 +0,0 @@
new Listview({
template:'itemset',
<?php
echo !isset($params['id']) ? "id:'itemsets'," : null;
echo !isset($params['name']) ? "name:LANG.tab_itemsets," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -1,17 +0,0 @@
new Listview({
template:'model',
<?php
echo !isset($params['id']) ? "id:'gallery'," : null;
echo !isset($params['name']) ? "name:LANG.tab_gallery," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -0,0 +1,10 @@
var _ = [
{
id: 'reputation',
after: 'location',
name: LANG.rep,
tooltip: LANG.tooltip_repgain,
width: '8%',
value: 'reputation'
}
];

View File

@@ -1,17 +0,0 @@
new Listview({
template:'object',
<?php
echo !isset($params['id']) ? "id:'objects'," : null;
echo !isset($params['name']) ? "name:LANG.tab_objects," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -1,36 +0,0 @@
var _ = function(family)
{
family.foodCount = 0;
for (var food in g_pet_foods)
{
if( family.diet & food)
family.foodCount++;
}
family.spellCount = 0;
for (var i = 0, len = family.spells.length; i < len; ++i)
{
if (family.spells[i])
family.spellCount++;
}
};
new Listview({
template:'pet',
computeDataFunc: _,
<?php
echo !isset($params['id']) ? "id:'hunter-pets'," : null;
echo !isset($params['name']) ? "name:LANG.tab_pets," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -0,0 +1,17 @@
var _ = function(family)
{
family.foodCount = 0;
for (var food in g_pet_foods)
{
if( family.diet & food)
family.foodCount++;
}
family.spellCount = 0;
for (var i = 0, len = family.spells.length; i < len; ++i)
{
if (family.spells[i])
family.spellCount++;
}
};

View File

@@ -1,21 +1,3 @@
new Listview({
template:'profile',
<?php
echo !isset($params['id']) ? "id:'profiles'," : null;
echo !isset($params['name']) ? "name:LANG.tab_profiles," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});
<?php <?php
Util::addNote(U_GROUP_NONE, 'Profile-listview NYI'); Util::addNote(U_GROUP_NONE, 'Profile-listview NYI');
/* data: /* data:
@@ -56,3 +38,4 @@ new Listview({
region:'{$curr.region|escape:"javascript"}' region:'{$curr.region|escape:"javascript"}'
} }
*/ */
?>

View File

@@ -1,34 +0,0 @@
<?php
if (!empty($params['extraCols']) && strpos($params['extraCols'], '_')):
?>
var _ = [
{
id: 'reputation',
after: 'rewards',
name: LANG.rep,
tooltip: LANG.tooltip_repgain,
width: '8%',
value: 'reputation'
}
];
<?php
endif;
?>
new Listview({
template:'quest',
<?php
echo !isset($params['id']) ? "id:'quests'," : null;
echo !isset($params['name']) ? "name:LANG.tab_quests," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -0,0 +1,10 @@
var _ = [
{
id: 'reputation',
after: 'rewards',
name: LANG.rep,
tooltip: LANG.tooltip_repgain,
width: '8%',
value: 'reputation'
}
];

View File

@@ -1,17 +0,0 @@
new Listview({
template:'race',
<?php
echo !isset($params['id']) ? "id:'races'," : null;
echo !isset($params['name']) ? "name:LANG.tab_races," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -1,17 +0,0 @@
new Listview({
template:'replypreview',
<?php
echo !isset($params['id']) ? "id:'comment-replies'," : null;
echo !isset($params['name']) ? "name:LANG.tab_commentreplies," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -1,17 +0,0 @@
new Listview({
template:'reputationhistory',
<?php
echo !isset($params['id']) ? "id:'reputation'," : null;
echo !isset($params['name']) ? "name:LANG.tab_reputation," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -1,17 +0,0 @@
new Listview({
template:'screenshot',
<?php
echo !isset($params['id']) ? "id:'screenshots'," : null;
echo !isset($params['name']) ? "name:LANG.tab_screenshots," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -1,17 +0,0 @@
new Listview({
template:'skill',
<?php
echo !isset($params['id']) ? "id:'skills'," : null;
echo !isset($params['name']) ? "name:LANG.tab_skills," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -1,17 +0,0 @@
new Listview({
template:'spell',
<?php
echo !isset($params['id']) ? "id:'spells'," : null;
echo !isset($params['name']) ? "name:LANG.tab_spells," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -1,17 +0,0 @@
new Listview({
template:'title',
<?php
echo !isset($params['id']) ? "id:'titles'," : null;
echo !isset($params['name']) ? "name:LANG.tab_titles," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -1,16 +0,0 @@
new Listview({
template:'video',
<?php
echo !isset($params['id']) ? "id:'videos'," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -1,17 +0,0 @@
new Listview({
template:'zone',
<?php
echo !isset($params['id']) ? "id:'zones'," : null;
echo !isset($params['name']) ? "name:LANG.tab_zones," : null;
echo !isset($params['parent']) ? "parent:'lv-generic'," : null;
foreach ($params as $k => $v):
if ($v[0] == '$'):
echo $k.':'.substr($v, 1).',';
elseif ($v):
echo $k.":'".$v."',";
endif;
endforeach;
?>
data:<?php echo json_encode(array_values($data), JSON_NUMERIC_CHECK); ?>
});

View File

@@ -10,7 +10,7 @@ $this->brick('announcement');
$this->brick('pageTemplate'); $this->brick('pageTemplate');
?> ?>
<div class="text"> <div class="text">
<h1><?php echo $this->name; ?></h1> <h1><?=$this->name; ?></h1>
<table> <table>
<tr> <tr>
@@ -40,7 +40,7 @@ endforeach;
<thead><tr><th style="width:135px;"><div>Menu</div></th><th style="width:400px;">Pages</th><th>Screenshots: <span id="screenshotTotal"></span></th></tr></thead> <thead><tr><th style="width:135px;"><div>Menu</div></th><th style="width:400px;">Pages</th><th>Screenshots: <span id="screenshotTotal"></span></th></tr></thead>
<tbody><tr> <tbody><tr>
<td id="menu-container" style="vertical-align: top;"> <td id="menu-container" style="vertical-align: top;">
<div id="show-all-pages"><?php echo $this->ssNFound ? ' &ndash; <a href="?admin=screenshots&all">Show All</a> ('.$this->ssNFound.')' : null; ?></div> <div id="show-all-pages"><?=($this->ssNFound ? ' &ndash; <a href="?admin=screenshots&all">Show All</a> ('.$this->ssNFound.')' : null); ?></div>
<h4>Mass Select</h4> <h4>Mass Select</h4>
&ndash; <a href="#" onClick="ssm_MassSelect(1);">Select All</a><br> &ndash; <a href="#" onClick="ssm_MassSelect(1);">Select All</a><br>
&ndash; <a href="#" onClick="ssm_MassSelect(0);">Deselect All</a><br> &ndash; <a href="#" onClick="ssm_MassSelect(0);">Deselect All</a><br>
@@ -122,10 +122,10 @@ if ($this->getAll):
echo " var ss_getAll = true;\n"; echo " var ss_getAll = true;\n";
endif; endif;
if ($this->ssPages): if ($this->ssPages):
echo " var ssm_screenshotPages = ".json_encode($this->ssPages, JSON_NUMERIC_CHECK).";\n"; echo " var ssm_screenshotPages = ".Util::toJSON($this->ssPages).";\n";
echo " ssm_UpdatePages();\n"; echo " ssm_UpdatePages();\n";
elseif ($this->ssData): elseif ($this->ssData):
echo " var ssm_screenshotData = ".json_encode($this->ssData, JSON_NUMERIC_CHECK).";\n"; echo " var ssm_screenshotData = ".Util::toJSON($this->ssData).";\n";
echo " ssm_UpdateList();\n"; echo " ssm_UpdateList();\n";
endif; endif;
?> ?>

View File

@@ -14,11 +14,11 @@
<div id="compare-generic"></div> <div id="compare-generic"></div>
<script type="text/javascript">//<![CDATA[ <script type="text/javascript">//<![CDATA[
<?php <?php
foreach ($this->cmpItems as $item): foreach ($this->cmpItems as $iId => $iData):
echo ' g_items.add('.$item[0].', {name_'.User::$localeString.':\''.Util::jsEscape($item[1]).'\', quality:'.$item[2].', icon:\''.$item[3].'\', jsonequip:'.json_encode($item[4], JSON_NUMERIC_CHECK)."});\n"; echo ' g_items.add('.$iId.', '.Util::toJSON($iData).");\n";
endforeach; endforeach;
?> ?>
new Summary({template:'compare',id:'compare',parent:'compare-generic',groups:<?php echo json_encode($this->summary, JSON_NUMERIC_CHECK); ?>}); new Summary(<?=Util::toJSON($this->summary); ?>);
//]]></script> //]]></script>
</div> </div>

View File

@@ -58,7 +58,7 @@ endif;
echo $this->writeGlobalVars(); echo $this->writeGlobalVars();
if ($this->news): if ($this->news):
echo " Markup.printHtml(".json_encode($this->news['text']).", 'news-generic', { allow: Markup.CLASS_ADMIN });\n"; echo " Markup.printHtml(".Util::toJSON($this->news['text']).", 'news-generic', { allow: Markup.CLASS_ADMIN });\n";
endif; endif;
?> ?>
//]]></script> //]]></script>

View File

@@ -28,24 +28,26 @@ echo $this->description;
?> ?>
<script type="text/javascript">//<![CDATA[ <script type="text/javascript">//<![CDATA[
<?php <?php
foreach ($this->pieces as $p): foreach ($this->pieces as $iId => $piece):
echo " g_items.add(".$p['id'].", {name_".User::$localeString.":'".Util::jsEscape($p['name'])."', quality:".$p['quality'].", icon:'".$p['icon']."', jsonequip:".json_encode($p['json'])."});\n"; echo " g_items.add(".$iId.", ".Util::toJSON($piece).");\n";
endforeach; endforeach;
?> ?>
//]]></script> //]]></script>
<table class="iconlist"> <table class="iconlist">
<?php <?php
foreach ($this->pieces as $i => $p): $idx = 0;
echo ' <tr><th align="right" id="iconlist-icon'.($i + 1).'"></th><td><span class="q'.$p['quality'].'"><a href="?item='.$p['id'].'">'.$p['name']."</a></span></td></tr>\n"; foreach ($this->pieces as $iId => $piece):
echo ' <tr><th align="right" id="iconlist-icon'.(++$idx).'"></th><td><span class="q'.$piece['quality'].'"><a href="?item='.$iId.'">'.$piece['name_'.User::$localeString]."</a></span></td></tr>\n";
endforeach; endforeach;
?> ?>
</table> </table>
<script type="text/javascript">//<![CDATA[ <script type="text/javascript">//<![CDATA[
<?php <?php
foreach ($this->pieces as $i => $p): $idx = 0;
echo " \$WH.ge('iconlist-icon".($i + 1)."').appendChild(g_items.createIcon(".$p['id'].", 0, 0));\n"; foreach ($this->pieces as $iId => $__):
echo " \$WH.ge('iconlist-icon".(++$idx)."').appendChild(g_items.createIcon(".$iId.", 0, 0));\n";
endforeach; endforeach;
?> ?>
//]]></script> //]]></script>
@@ -54,12 +56,12 @@ endforeach;
if ($this->unavailable): if ($this->unavailable):
?> ?>
<div class="pad"></div> <div class="pad"></div>
<b style="color: red"><?php echo Lang::itemset('_unavailable'); ?></b> <b style="color: red"><?=Lang::itemset('_unavailable'); ?></b>
<?php endif; ?> <?php endif; ?>
<h3><?php echo Lang::itemset('_setBonuses').$this->bonusExt; ?></h3> <h3><?=Lang::itemset('_setBonuses').$this->bonusExt; ?></h3>
<?php echo " ".Lang::itemset('_conveyBonus')."\n"; ?> <?=" ".Lang::itemset('_conveyBonus')."\n"; ?>
<ul> <ul>
<?php <?php
foreach ($this->spells as $i => $s): foreach ($this->spells as $i => $s):
@@ -68,14 +70,14 @@ endforeach;
?> ?>
</ul> </ul>
<h2 class="clear"><?php echo Lang::itemset('summary'); ?></h2> <h2 class="clear"><?=Lang::itemset('summary'); ?></h2>
<div id="summary-generic"></div> <div id="summary-generic"></div>
<script type="text/javascript">//<![CDATA[ <script type="text/javascript">//<![CDATA[
new Summary({ id: 'itemset', template: 'itemset', parent: 'summary-generic', groups: <?php echo json_encode($this->compare['items'], JSON_NUMERIC_CHECK).', level: '.$this->compare['level']; ?>}); new Summary(<?=Util::toJSON($this->summary); ?>);
//]]></script> //]]></script>
<h2 class="clear"><?php echo Lang::main('related'); ?></h2> <h2 class="clear"><?=Lang::main('related'); ?></h2>
</div> </div>
<?php <?php

View File

@@ -13,27 +13,27 @@ $this->brick('infobox');
?> ?>
<div class="text"> <div class="text">
<h1><?php echo $this->name; ?></h1> <h1><?=$this->name; ?></h1>
<span><?php echo Lang::screenshot('cropHint'); ?></span> <span><?=Lang::screenshot('cropHint'); ?></span>
<div class="pad"></div> <div class="pad"></div>
<div id="ss-container"></div><script type="text/javascript">//<![CDATA[ <div id="ss-container"></div><script type="text/javascript">//<![CDATA[
var myCropper = new Cropper(<?php echo json_encode($this->cropper, JSON_NUMERIC_CHECK); ?>); var myCropper = new Cropper(<?=Util::toJSON($this->cropper); ?>);
//]]></script> //]]></script>
<div class="pad"></div> <div class="pad"></div>
<button style="margin:4px 0 0 5px" onclick="myCropper.selectAll()"><?php echo Lang::screenshot('selectAll'); ?></button> <button style="margin:4px 0 0 5px" onclick="myCropper.selectAll()"><?=Lang::screenshot('selectAll'); ?></button>
<div class="clear"></div> <div class="clear"></div>
<div class="pad3"></div> <div class="pad3"></div>
<form action="?screenshot=complete&amp;<?php echo $this->destType.'.'.$this->destTypeId.'.'.$this->imgHash; ?>" method="post" onsubmit="this.elements['coords'].value = myCropper.getCoords()"> <form action="?screenshot=complete&amp;<?=$this->destType.'.'.$this->destTypeId.'.'.$this->imgHash; ?>" method="post" onsubmit="this.elements['coords'].value = myCropper.getCoords()">
<?php echo Lang::screenshot('caption').Lang::main('colon'); ?><input type="text" name="screenshotalt" style="width: 55%" maxlength="200" /> <small> <?php echo Lang::screenshot('charLimit'); ?></small><br /> <?=Lang::screenshot('caption').Lang::main('colon'); ?><input type="text" name="screenshotalt" style="width: 55%" maxlength="200" /> <small> <?=Lang::screenshot('charLimit'); ?></small><br />
<div class="pad"></div> <div class="pad"></div>
<?php $this->localizedBrick('ssReminder', User::$localeId); ?> <?php $this->localizedBrick('ssReminder', User::$localeId); ?>
<input type="submit" value="<?php echo Lang::main('submit'); ?>" /> <input type="submit" value="<?=Lang::main('submit'); ?>" />
<input type="hidden" name="coords" /> <input type="hidden" name="coords" />
</form> </form>