Skip to content
Permalink
Browse files

Icons

 * 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
  • Loading branch information...
Sarjuuk committed Dec 14, 2018
1 parent ead6e72 commit 392610b899952885b691220e867f5bee14a0324e
@@ -10,7 +10,7 @@ class CharClassList extends BaseType
public static $brickFile = 'class';
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 = [])
{
@@ -10,7 +10,7 @@ class CharRaceList extends BaseType
public static $brickFile = 'race';
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()
{
@@ -10,7 +10,7 @@ class CurrencyList extends BaseType
public static $brickFile = 'currency';
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(
'c' => [['ic']],
'ic' => ['j' => ['?_icons ic ON ic.id = c.iconId', true], 's' => ', ic.name AS iconString']
@@ -10,7 +10,7 @@ class EmoteList extends BaseType
public static $brickFile = 'emote';
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 = [])
{
@@ -12,7 +12,7 @@ class PetList extends BaseType
public static $brickFile = '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(
'p' => [['ic']],
'ic' => ['j' => ['?_icons ic ON p.iconId = ic.id', true], 's' => ', ic.name AS iconString'],
@@ -10,7 +10,7 @@ class SkillList extends BaseType
public static $brickFile = 'skill';
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(
'sl' => [['ic']],
'ic' => ['j' => ['?_icons ic ON ic.id = sl.iconId', true], 's' => ', ic.name AS iconString'],
@@ -13,7 +13,7 @@ class SoundList extends BaseType
public static $dataTable = '?_sounds';
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 static $fileTypes = array(
@@ -12,7 +12,7 @@ class ZoneList extends BaseType
public static $brickFile = 'zone';
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)
{
@@ -99,6 +99,13 @@ protected function generateContent()
$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?
if ($this->subject->getField('flags') & 0x100 && DB::isConnectable(DB_AUTH))
{
@@ -56,9 +56,17 @@ protected function generateContent()
$infobox = Lang::getInfoBoxForFlags(intval($this->subject->getField('cuFlags')));
// cap
if ($_ = $this->subject->getField('cap'))
$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 */
/****************/
@@ -665,8 +665,8 @@ public function writeGlobalVars() // load jsGlobal
{
foreach ($data as $k => $v)
{
// localizes expected fields
if (in_array($k, ['name', 'namefemale']))
// localizes expected fields .. except for icons .. icons are special
if (in_array($k, ['name', 'namefemale']) && $struct[0] != 'g_icons')
{
$data[$k.'_'.User::$localeString] = $v;
unset($data[$k]);
@@ -754,8 +754,8 @@ public function extendGlobalIds($type, $data) // add typeIds <int|arra
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)
throw new ErrorException('ffffuuuu.....!');
if ($data === null)
throw new ErrorException('ffffuuuu.....!');
foreach ($data as $type => $globals)
{
@@ -848,6 +848,7 @@ private function applyGlobals() // lookup jsGlobals from
case TYPE_SKILL: $obj = new SkillList($cnd); break;
case TYPE_CURRENCY: $obj = new CurrencyList($cnd); break;
case TYPE_SOUND: $obj = new SoundList($cnd); break;
case TYPE_ICON: $obj = new IconList($cnd); break;
// "um, eh":, he ums and ehs.
case TYPE_USER: $obj = new UserList($cnd); break;
case TYPE_EMOTE: $obj = new EmoteList($cnd); break;
@@ -144,6 +144,13 @@ protected function generateContent()
if ($si != 3)
$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
if (!$_slot)
{
@@ -58,6 +58,13 @@ protected function generateContent()
if ($this->subject->getField('exotic'))
$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 */
/****************/
@@ -45,10 +45,24 @@ protected function generateTitle()
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 */
/****************/
$this->infobox = $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null;
$this->headIcons = [$this->subject->getField('iconString')];
$this->redButtons = array(
BUTTON_WOWHEAD => true,
@@ -232,6 +232,13 @@ protected function generateContent()
if ($cost = $this->subject->getField('trainingCost'))
$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
foreach ($this->difficulties as $n => $id)
if ($id == $this->typeId) // "Mode" seems to be multilingual acceptable
@@ -948,6 +948,14 @@ a.dialog-right {
#statweight-help div { position: absolute; right: -9px; top: -33px; }
#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,
.iconmedium,
.iconlarge,
@@ -1025,7 +1025,7 @@ var Markup = {

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];
if (hasName)
{
var Icon = {
sizes: ['small', 'medium', 'large'],
sizes2: [18, 36, 56],
sizeIds: {
small: 0,
medium: 1,
large: 2
},
premiumOffsets: [[-56, -36], [-56, 0], [0, 0]],
premiumBorderClasses: ['-premium', '-gold', '', '-premiumred', '-red'],
STANDARD_BORDER: 2,
epic: '-q4',
legendary: '-q5'
},
create: function(name, size, UNUSED, url, num, qty, noBorder, rel) {
create: function(name, size, UNUSED, url, num, qty, noBorder, rel, span) {
var
icon = $WH.ce('div'),
icon = $WH.ce(span ? 'span' : 'div'),
image = $WH.ce('ins'),
tile = $WH.ce('del');

if (!avatarIcon) {
icon.onclick = Icon.onClick;

var a = $WH.ce('a');
a.href = "javascript:;";
$WH.ae(icon, a);
if (url !== false) {
var a = $WH.ce('a');
a.href = "javascript:;";
$WH.ae(icon, a);
}
}
}

0 comments on commit 392610b

Please sign in to comment.
You can’t perform that action at this time.