* add icon to infobox for db types with icon (*duh!*)
 * fixed a couple issues with markup icondb in the process
 * fixed wrong data display due to shared name fields on joined table
This commit is contained in:
Sarjuuk
2018-12-14 23:09:32 +01:00
parent ead6e72668
commit 392610b899
18 changed files with 84 additions and 18 deletions

View File

@@ -10,7 +10,7 @@ class CharClassList extends BaseType
public static $brickFile = 'class'; public static $brickFile = 'class';
public static $dataTable = '?_classes'; public static $dataTable = '?_classes';
protected $queryBase = 'SELECT *, id AS ARRAY_KEY FROM ?_classes c'; protected $queryBase = 'SELECT c.*, id AS ARRAY_KEY FROM ?_classes c';
public function __construct($conditions = []) public function __construct($conditions = [])
{ {

View File

@@ -10,7 +10,7 @@ class CharRaceList extends BaseType
public static $brickFile = 'race'; public static $brickFile = 'race';
public static $dataTable = '?_races'; public static $dataTable = '?_races';
protected $queryBase = 'SELECT *, id AS ARRAY_KEY FROM ?_races r'; protected $queryBase = 'SELECT r.*, id AS ARRAY_KEY FROM ?_races r';
public function getListviewData() public function getListviewData()
{ {

View File

@@ -10,7 +10,7 @@ class CurrencyList extends BaseType
public static $brickFile = 'currency'; public static $brickFile = 'currency';
public static $dataTable = '?_currencies'; public static $dataTable = '?_currencies';
protected $queryBase = 'SELECT *, c.id AS ARRAY_KEY FROM ?_currencies c'; protected $queryBase = 'SELECT c.*, c.id AS ARRAY_KEY FROM ?_currencies c';
protected $queryOpts = array( protected $queryOpts = array(
'c' => [['ic']], 'c' => [['ic']],
'ic' => ['j' => ['?_icons ic ON ic.id = c.iconId', true], 's' => ', ic.name AS iconString'] 'ic' => ['j' => ['?_icons ic ON ic.id = c.iconId', true], 's' => ', ic.name AS iconString']

View File

@@ -10,7 +10,7 @@ class EmoteList extends BaseType
public static $brickFile = 'emote'; public static $brickFile = 'emote';
public static $dataTable = '?_emotes'; public static $dataTable = '?_emotes';
protected $queryBase = 'SELECT *, e.id AS ARRAY_KEY FROM ?_emotes e'; protected $queryBase = 'SELECT e.*, e.id AS ARRAY_KEY FROM ?_emotes e';
public function __construct($conditions = []) public function __construct($conditions = [])
{ {

View File

@@ -12,7 +12,7 @@ class PetList extends BaseType
public static $brickFile = 'pet'; public static $brickFile = 'pet';
public static $dataTable = '?_pet'; public static $dataTable = '?_pet';
protected $queryBase = 'SELECT *, p.id AS ARRAY_KEY FROM ?_pet p'; protected $queryBase = 'SELECT p.*, p.id AS ARRAY_KEY FROM ?_pet p';
protected $queryOpts = array( protected $queryOpts = array(
'p' => [['ic']], 'p' => [['ic']],
'ic' => ['j' => ['?_icons ic ON p.iconId = ic.id', true], 's' => ', ic.name AS iconString'], 'ic' => ['j' => ['?_icons ic ON p.iconId = ic.id', true], 's' => ', ic.name AS iconString'],

View File

@@ -10,7 +10,7 @@ class SkillList extends BaseType
public static $brickFile = 'skill'; public static $brickFile = 'skill';
public static $dataTable = '?_skillline'; public static $dataTable = '?_skillline';
protected $queryBase = 'SELECT *, sl.id AS ARRAY_KEY FROM ?_skillline sl'; protected $queryBase = 'SELECT sl.*, sl.id AS ARRAY_KEY FROM ?_skillline sl';
protected $queryOpts = array( protected $queryOpts = array(
'sl' => [['ic']], 'sl' => [['ic']],
'ic' => ['j' => ['?_icons ic ON ic.id = sl.iconId', true], 's' => ', ic.name AS iconString'], 'ic' => ['j' => ['?_icons ic ON ic.id = sl.iconId', true], 's' => ', ic.name AS iconString'],

View File

@@ -13,7 +13,7 @@ class SoundList extends BaseType
public static $dataTable = '?_sounds'; public static $dataTable = '?_sounds';
public static $contribute = CONTRIBUTE_CO; public static $contribute = CONTRIBUTE_CO;
protected $queryBase = 'SELECT *, s.id AS ARRAY_KEY FROM ?_sounds s'; protected $queryBase = 'SELECT s.*, s.id AS ARRAY_KEY FROM ?_sounds s';
private $fileBuffer = []; private $fileBuffer = [];
private static $fileTypes = array( private static $fileTypes = array(

View File

@@ -12,7 +12,7 @@ class ZoneList extends BaseType
public static $brickFile = 'zone'; public static $brickFile = 'zone';
public static $dataTable = '?_zones'; public static $dataTable = '?_zones';
protected $queryBase = 'SELECT *, id AS ARRAY_KEY FROM ?_zones z'; protected $queryBase = 'SELECT z.*, id AS ARRAY_KEY FROM ?_zones z';
public function __construct($conditions = [], $miscData = null) public function __construct($conditions = [], $miscData = null)
{ {

View File

@@ -99,6 +99,13 @@ class AchievementPage extends GenericPage
$infobox[] = Lang::main('side').Lang::main('colon').Lang::game('si', SIDE_BOTH); $infobox[] = Lang::main('side').Lang::main('colon').Lang::game('si', SIDE_BOTH);
} }
// icon
if ($_ = $this->subject->getField('iconId'))
{
$infobox[] = Util::ucFirst(lang::game('icon')).Lang::main('colon').'[icondb='.$_.' name=true]';
$this->extendGlobalIds(TYPE_ICON, $_);
}
// realm first available? // realm first available?
if ($this->subject->getField('flags') & 0x100 && DB::isConnectable(DB_AUTH)) if ($this->subject->getField('flags') & 0x100 && DB::isConnectable(DB_AUTH))
{ {

View File

@@ -56,9 +56,17 @@ class CurrencyPage extends GenericPage
$infobox = Lang::getInfoBoxForFlags(intval($this->subject->getField('cuFlags'))); $infobox = Lang::getInfoBoxForFlags(intval($this->subject->getField('cuFlags')));
// cap
if ($_ = $this->subject->getField('cap')) if ($_ = $this->subject->getField('cap'))
$infobox[] = Lang::currency('cap').Lang::main('colon').Lang::nf($_); $infobox[] = Lang::currency('cap').Lang::main('colon').Lang::nf($_);
// icon
if ($_ = $this->subject->getField('iconId'))
{
$infobox[] = Util::ucFirst(lang::game('icon')).Lang::main('colon').'[icondb='.$_.' name=true]';
$this->extendGlobalIds(TYPE_ICON, $_);
}
/****************/ /****************/
/* Main Content */ /* Main Content */
/****************/ /****************/

View File

@@ -665,8 +665,8 @@ class GenericPage
{ {
foreach ($data as $k => $v) foreach ($data as $k => $v)
{ {
// localizes expected fields // localizes expected fields .. except for icons .. icons are special
if (in_array($k, ['name', 'namefemale'])) if (in_array($k, ['name', 'namefemale']) && $struct[0] != 'g_icons')
{ {
$data[$k.'_'.User::$localeString] = $v; $data[$k.'_'.User::$localeString] = $v;
unset($data[$k]); unset($data[$k]);
@@ -754,8 +754,8 @@ class GenericPage
public function extendGlobalData($data, $extra = null) // add jsGlobals or typeIds (can be mixed in one array: TYPE => [mixeddata]) to display on the page public function extendGlobalData($data, $extra = null) // add jsGlobals or typeIds (can be mixed in one array: TYPE => [mixeddata]) to display on the page
{ {
if ($data === null) if ($data === null)
throw new ErrorException('ffffuuuu.....!'); throw new ErrorException('ffffuuuu.....!');
foreach ($data as $type => $globals) foreach ($data as $type => $globals)
{ {
@@ -848,6 +848,7 @@ class GenericPage
case TYPE_SKILL: $obj = new SkillList($cnd); break; case TYPE_SKILL: $obj = new SkillList($cnd); break;
case TYPE_CURRENCY: $obj = new CurrencyList($cnd); break; case TYPE_CURRENCY: $obj = new CurrencyList($cnd); break;
case TYPE_SOUND: $obj = new SoundList($cnd); break; case TYPE_SOUND: $obj = new SoundList($cnd); break;
case TYPE_ICON: $obj = new IconList($cnd); break;
// "um, eh":, he ums and ehs. // "um, eh":, he ums and ehs.
case TYPE_USER: $obj = new UserList($cnd); break; case TYPE_USER: $obj = new UserList($cnd); break;
case TYPE_EMOTE: $obj = new EmoteList($cnd); break; case TYPE_EMOTE: $obj = new EmoteList($cnd); break;

View File

@@ -144,6 +144,13 @@ class ItemPage extends genericPage
if ($si != 3) if ($si != 3)
$infobox[] = Lang::main('side').Lang::main('colon').'[span class=icon-'.($si == 1 ? 'alliance' : 'horde').']'.Lang::game('si', $si).'[/span]'; $infobox[] = Lang::main('side').Lang::main('colon').'[span class=icon-'.($si == 1 ? 'alliance' : 'horde').']'.Lang::game('si', $si).'[/span]';
// icon
if ($_ = $this->subject->getField('iconId'))
{
$infobox[] = Util::ucFirst(lang::game('icon')).Lang::main('colon').'[icondb='.$_.' name=true]';
$this->extendGlobalIds(TYPE_ICON, $_);
}
// consumable / not consumable // consumable / not consumable
if (!$_slot) if (!$_slot)
{ {

View File

@@ -58,6 +58,13 @@ class PetPage extends GenericPage
if ($this->subject->getField('exotic')) if ($this->subject->getField('exotic'))
$infobox[] = '[url=?spell=53270]'.Lang::pet('exotic').'[/url]'; $infobox[] = '[url=?spell=53270]'.Lang::pet('exotic').'[/url]';
// icon
if ($_ = $this->subject->getField('iconId'))
{
$infobox[] = Util::ucFirst(lang::game('icon')).Lang::main('colon').'[icondb='.$_.' name=true]';
$this->extendGlobalIds(TYPE_ICON, $_);
}
/****************/ /****************/
/* Main Content */ /* Main Content */
/****************/ /****************/

View File

@@ -45,10 +45,24 @@ class SkillPage extends GenericPage
protected function generateContent() protected function generateContent()
{ {
/***********/
/* Infobox */
/**********/
$infobox = Lang::getInfoBoxForFlags(intval($this->subject->getField('cuFlags')));
// icon
if ($_ = $this->subject->getField('iconId'))
{
$infobox[] = Util::ucFirst(lang::game('icon')).Lang::main('colon').'[icondb='.$_.' name=true]';
$this->extendGlobalIds(TYPE_ICON, $_);
}
/****************/ /****************/
/* Main Content */ /* Main Content */
/****************/ /****************/
$this->infobox = $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null;
$this->headIcons = [$this->subject->getField('iconString')]; $this->headIcons = [$this->subject->getField('iconString')];
$this->redButtons = array( $this->redButtons = array(
BUTTON_WOWHEAD => true, BUTTON_WOWHEAD => true,

View File

@@ -232,6 +232,13 @@ class SpellPage extends GenericPage
if ($cost = $this->subject->getField('trainingCost')) if ($cost = $this->subject->getField('trainingCost'))
$infobox[] = Lang::spell('trainingCost').Lang::main('colon').'[money='.$cost.'][/li]'; $infobox[] = Lang::spell('trainingCost').Lang::main('colon').'[money='.$cost.'][/li]';
// icon
if ($_ = $this->subject->getField('iconId'))
{
$infobox[] = Util::ucFirst(lang::game('icon')).Lang::main('colon').'[icondb='.$_.' name=true]';
$this->extendGlobalIds(TYPE_ICON, $_);
}
// used in mode // used in mode
foreach ($this->difficulties as $n => $id) foreach ($this->difficulties as $n => $id)
if ($id == $this->typeId) // "Mode" seems to be multilingual acceptable if ($id == $this->typeId) // "Mode" seems to be multilingual acceptable

View File

@@ -948,6 +948,14 @@ a.dialog-right {
#statweight-help div { position: absolute; right: -9px; top: -33px; } #statweight-help div { position: absolute; right: -9px; top: -33px; }
#fi_weight { margin-top: 10px; padding-top: 12px; border-top: 1px solid #484848; } #fi_weight { margin-top: 10px; padding-top: 12px; border-top: 1px solid #484848; }
span.iconsmall,
span.iconmedium,
span.iconlarge,
span.iconblizzard {
display: inline-block;
vertical-align: middle;
}
.iconsmall, .iconsmall,
.iconmedium, .iconmedium,
.iconlarge, .iconlarge,

View File

@@ -1025,7 +1025,7 @@ var Markup = {
if (g_icons[id] && g_icons[id].name) if (g_icons[id] && g_icons[id].name)
{ {
// href += '/' + $WH.urlize(g_icons[id].name); AoWoW - not used // href += '/' + $WH.urlize(g_icons[id].name); AoWoW - SEO not used
var icon = g_icons[id]; var icon = g_icons[id];
if (hasName) if (hasName)
{ {

View File

@@ -17785,6 +17785,11 @@ ProgressBar.prototype.getContainer = function()
var Icon = { var Icon = {
sizes: ['small', 'medium', 'large'], sizes: ['small', 'medium', 'large'],
sizes2: [18, 36, 56], sizes2: [18, 36, 56],
sizeIds: {
small: 0,
medium: 1,
large: 2
},
premiumOffsets: [[-56, -36], [-56, 0], [0, 0]], premiumOffsets: [[-56, -36], [-56, 0], [0, 0]],
premiumBorderClasses: ['-premium', '-gold', '', '-premiumred', '-red'], premiumBorderClasses: ['-premium', '-gold', '', '-premiumred', '-red'],
STANDARD_BORDER: 2, STANDARD_BORDER: 2,
@@ -17794,9 +17799,9 @@ var Icon = {
epic: '-q4', epic: '-q4',
legendary: '-q5' legendary: '-q5'
}, },
create: function(name, size, UNUSED, url, num, qty, noBorder, rel) { create: function(name, size, UNUSED, url, num, qty, noBorder, rel, span) {
var var
icon = $WH.ce('div'), icon = $WH.ce(span ? 'span' : 'div'),
image = $WH.ce('ins'), image = $WH.ce('ins'),
tile = $WH.ce('del'); tile = $WH.ce('del');
@@ -17829,9 +17834,11 @@ var Icon = {
if (!avatarIcon) { if (!avatarIcon) {
icon.onclick = Icon.onClick; icon.onclick = Icon.onClick;
var a = $WH.ce('a'); if (url !== false) {
a.href = "javascript:;"; var a = $WH.ce('a');
$WH.ae(icon, a); a.href = "javascript:;";
$WH.ae(icon, a);
}
} }
} }