mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Template/Update (Part 37)
* convert dbtype 'sound'
This commit is contained in:
@@ -6,97 +6,82 @@ if (!defined('AOWOW_REVISION'))
|
|||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
|
|
||||||
// menuId 19: Sound g_initPath()
|
class SoundBaseResponse extends TemplateResponse implements ICache
|
||||||
// tabId 0: Database g_initHeader()
|
|
||||||
class SoundPage extends GenericPage
|
|
||||||
{
|
{
|
||||||
use TrDetailPage;
|
use TrDetailPage, TrCache;
|
||||||
|
|
||||||
protected $type = Type::SOUND;
|
protected int $cacheType = CACHE_TYPE_PAGE;
|
||||||
protected $typeId = 0;
|
|
||||||
protected $tpl = 'sound';
|
|
||||||
protected $path = [0, 19];
|
|
||||||
protected $tabId = 0;
|
|
||||||
protected $mode = CACHE_TYPE_PAGE;
|
|
||||||
|
|
||||||
protected $special = false;
|
protected string $template = 'sound';
|
||||||
protected $_get = ['playlist' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkEmptySet']];
|
protected string $pageName = 'sound';
|
||||||
|
protected ?int $activeTab = parent::TAB_DATABASE;
|
||||||
|
protected array $breadcrumb = [0, 19];
|
||||||
|
|
||||||
private $cat = 0;
|
public int $type = Type::SOUND;
|
||||||
|
public int $typeId = 0;
|
||||||
|
|
||||||
public function __construct($pageCall, $id)
|
private SoundList $subject;
|
||||||
|
|
||||||
|
public function __construct(string $id)
|
||||||
{
|
{
|
||||||
parent::__construct($pageCall, $id);
|
parent::__construct($id);
|
||||||
|
|
||||||
// special case
|
$this->typeId = intVal($id);
|
||||||
if (!$id && $this->_get['playlist'])
|
$this->contribute = Type::getClassAttrib($this->type, 'contribute') ?? CONTRIBUTE_NONE;
|
||||||
{
|
|
||||||
$this->special = true;
|
|
||||||
$this->name = Lang::sound('cat', 1000);
|
|
||||||
$this->cat = 1000;
|
|
||||||
$this->articleUrl = 'sound&playlist';
|
|
||||||
$this->contribute = CONTRIBUTE_NONE;
|
|
||||||
$this->mode = CACHE_TYPE_NONE;
|
|
||||||
}
|
|
||||||
// regular case
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->typeId = intVal($id);
|
|
||||||
|
|
||||||
$this->subject = new SoundList(array(['id', $this->typeId]));
|
|
||||||
if ($this->subject->error)
|
|
||||||
$this->notFound(Lang::game('sound'), Lang::sound('notFound'));
|
|
||||||
|
|
||||||
$this->name = $this->subject->getField('name');
|
|
||||||
$this->cat = $this->subject->getField('cat');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function generatePath()
|
protected function generate() : void
|
||||||
{
|
{
|
||||||
$this->path[] = $this->cat;
|
$this->subject = new SoundList(array(['id', $this->typeId]));
|
||||||
}
|
if ($this->subject->error)
|
||||||
|
$this->generateNotFound(Lang::game('sound'), Lang::sound('notFound'));
|
||||||
|
|
||||||
protected function generateTitle()
|
$this->h1 = $this->subject->getField('name');
|
||||||
{
|
|
||||||
array_unshift($this->title, $this->name, Util::ucFirst(Lang::game('sound')));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function generateContent()
|
$this->gPageInfo += array(
|
||||||
{
|
'type' => $this->type,
|
||||||
if ($this->special)
|
'typeId' => $this->typeId,
|
||||||
$this->generatePlaylistContent();
|
'name' => $this->h1
|
||||||
else
|
);
|
||||||
$this->generateDefaultContent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private function generatePlaylistContent()
|
$_cat = $this->subject->getField('cat');
|
||||||
{
|
|
||||||
|
|
||||||
|
/*************/
|
||||||
|
/* Menu Path */
|
||||||
|
/*************/
|
||||||
|
|
||||||
|
$this->breadcrumb[] = $_cat;
|
||||||
|
|
||||||
|
|
||||||
|
/**************/
|
||||||
|
/* Page Title */
|
||||||
|
/**************/
|
||||||
|
|
||||||
|
array_unshift($this->title, $this->h1, Util::ucFirst(Lang::game('sound')));
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private function generateDefaultContent()
|
|
||||||
{
|
|
||||||
/****************/
|
/****************/
|
||||||
/* Main Content */
|
/* Main Content */
|
||||||
/****************/
|
/****************/
|
||||||
|
|
||||||
$this->addScript([SC_JS_FILE, '?data=zones']);
|
|
||||||
|
|
||||||
// get spawns
|
// get spawns
|
||||||
$map = null;
|
|
||||||
if ($spawns = $this->subject->getSpawns(SPAWNINFO_FULL))
|
if ($spawns = $this->subject->getSpawns(SPAWNINFO_FULL))
|
||||||
{
|
{
|
||||||
$map = ['data' => ['parent' => 'mapper-generic'], 'mapperData' => &$spawns, 'foundIn' => Lang::sound('foundIn')];
|
$this->addDataLoader('zones');
|
||||||
foreach ($spawns as $areaId => &$areaData)
|
$this->map = array(
|
||||||
$map['extra'][$areaId] = ZoneList::getName($areaId);
|
['parent' => 'mapper-generic'], // Mapper
|
||||||
|
$spawns, // mapperData
|
||||||
|
null, // ShowOnMap
|
||||||
|
[Lang::sound('foundIn')] // foundIn
|
||||||
|
);
|
||||||
|
foreach ($spawns as $areaId => $__)
|
||||||
|
$this->map[3][$areaId] = ZoneList::getName($areaId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get full path ingame for sound (workaround for missing PlaySoundKit())
|
// get full path in-game for sound (workaround for missing PlaySoundKit())
|
||||||
$fullpath = DB::Aowow()->selectCell('SELECT IF(sf.`path` <> "", CONCAT(sf.`path`, "\\\\", sf.`file`), sf.`file`) FROM ?_sounds_files sf JOIN ?_sounds s ON s.`soundFile1` = sf.`id` WHERE s.`id` = ?d', $this->typeId);
|
$fullpath = DB::Aowow()->selectCell('SELECT IF(sf.`path` <> "", CONCAT(sf.`path`, "\\\\", sf.`file`), sf.`file`) FROM ?_sounds_files sf JOIN ?_sounds s ON s.`soundFile1` = sf.`id` WHERE s.`id` = ?d', $this->typeId);
|
||||||
|
|
||||||
$this->map = $map;
|
|
||||||
$this->headIcons = [$this->subject->getField('iconString')];
|
|
||||||
$this->redButtons = array(
|
$this->redButtons = array(
|
||||||
BUTTON_WOWHEAD => true,
|
BUTTON_WOWHEAD => true,
|
||||||
BUTTON_PLAYLIST => true,
|
BUTTON_PLAYLIST => true,
|
||||||
@@ -109,11 +94,15 @@ class SoundPage extends GenericPage
|
|||||||
|
|
||||||
$this->extendGlobalData($this->subject->getJSGlobals());
|
$this->extendGlobalData($this->subject->getJSGlobals());
|
||||||
|
|
||||||
|
parent::generate();
|
||||||
|
|
||||||
|
|
||||||
/**************/
|
/**************/
|
||||||
/* Extra Tabs */
|
/* Extra Tabs */
|
||||||
/**************/
|
/**************/
|
||||||
|
|
||||||
|
$this->lvTabs = new Tabs(['parent' => "\$\$WH.ge('tabs-generic')"], 'tabsRelated', true);
|
||||||
|
|
||||||
// tab: Spells
|
// tab: Spells
|
||||||
// skipping (always empty): ready, castertargeting, casterstate, targetstate
|
// skipping (always empty): ready, castertargeting, casterstate, targetstate
|
||||||
$displayIds = DB::Aowow()->selectCol(
|
$displayIds = DB::Aowow()->selectCol(
|
||||||
@@ -134,9 +123,9 @@ class SoundPage extends GenericPage
|
|||||||
|
|
||||||
$cnd = array(
|
$cnd = array(
|
||||||
'OR',
|
'OR',
|
||||||
['AND', ['effect1Id', 132], ['effect1MiscValue', $this->typeId]],
|
['AND', ['effect1Id', [SPELL_EFFECT_PLAY_MUSIC, SPELL_EFFECT_PLAY_SOUND]], ['effect1MiscValue', $this->typeId]],
|
||||||
['AND', ['effect2Id', 132], ['effect2MiscValue', $this->typeId]],
|
['AND', ['effect2Id', [SPELL_EFFECT_PLAY_MUSIC, SPELL_EFFECT_PLAY_SOUND]], ['effect2MiscValue', $this->typeId]],
|
||||||
['AND', ['effect3Id', 132], ['effect3MiscValue', $this->typeId]]
|
['AND', ['effect3Id', [SPELL_EFFECT_PLAY_MUSIC, SPELL_EFFECT_PLAY_SOUND]], ['effect3MiscValue', $this->typeId]]
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($displayIds)
|
if ($displayIds)
|
||||||
@@ -145,19 +134,18 @@ class SoundPage extends GenericPage
|
|||||||
if ($seMiscValues)
|
if ($seMiscValues)
|
||||||
$cnd[] = array(
|
$cnd[] = array(
|
||||||
'OR',
|
'OR',
|
||||||
['AND', ['effect1AuraId', 260], ['effect1MiscValue', $seMiscValues]],
|
['AND', ['effect1AuraId', SPELL_AURA_SCREEN_EFFECT], ['effect1MiscValue', $seMiscValues]],
|
||||||
['AND', ['effect2AuraId', 260], ['effect2MiscValue', $seMiscValues]],
|
['AND', ['effect2AuraId', SPELL_AURA_SCREEN_EFFECT], ['effect2MiscValue', $seMiscValues]],
|
||||||
['AND', ['effect3AuraId', 260], ['effect3MiscValue', $seMiscValues]]
|
['AND', ['effect3AuraId', SPELL_AURA_SCREEN_EFFECT], ['effect3MiscValue', $seMiscValues]]
|
||||||
);
|
);
|
||||||
|
|
||||||
$spells = new SpellList($cnd);
|
$spells = new SpellList($cnd);
|
||||||
if (!$spells->error)
|
if (!$spells->error)
|
||||||
{
|
{
|
||||||
$this->extendGlobalData($spells->getJSGlobals(GLOBALINFO_SELF));
|
$this->extendGlobalData($spells->getJSGlobals(GLOBALINFO_SELF));
|
||||||
$this->lvTabs[] = [SpellList::$brickFile, ['data' => array_values($spells->getListviewData())]];
|
$this->lvTabs->addListviewTab(new Listview(['data' => $spells->getListviewData()], SpellList::$brickFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// tab: Items
|
// tab: Items
|
||||||
$subClasses = [];
|
$subClasses = [];
|
||||||
if ($subClassMask = DB::Aowow()->selectCell('SELECT `subClassMask` FROM ?_items_sounds WHERE `soundId` = ?d', $this->typeId))
|
if ($subClassMask = DB::Aowow()->selectCell('SELECT `subClassMask` FROM ?_items_sounds WHERE `soundId` = ?d', $this->typeId))
|
||||||
@@ -179,11 +167,10 @@ class SoundPage extends GenericPage
|
|||||||
if (!$items->error)
|
if (!$items->error)
|
||||||
{
|
{
|
||||||
$this->extendGlobalData($items->getJSGlobals(GLOBALINFO_SELF));
|
$this->extendGlobalData($items->getJSGlobals(GLOBALINFO_SELF));
|
||||||
$this->lvTabs[] = [ItemList::$brickFile, ['data' => array_values($items->getListviewData())]];
|
$this->lvTabs->addListviewTab(new Listview(['data' => $items->getListviewData()], ItemList::$brickFile));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// tab: Zones
|
// tab: Zones
|
||||||
if ($zoneIds = DB::Aowow()->select('SELECT `id`, `worldStateId`, `worldStateValue` FROM ?_zones_sounds WHERE `ambienceDay` = ?d OR `ambienceNight` = ?d OR `musicDay` = ?d OR `musicNight` = ?d OR `intro` = ?d', $this->typeId, $this->typeId, $this->typeId, $this->typeId, $this->typeId))
|
if ($zoneIds = DB::Aowow()->select('SELECT `id`, `worldStateId`, `worldStateValue` FROM ?_zones_sounds WHERE `ambienceDay` = ?d OR `ambienceNight` = ?d OR `musicDay` = ?d OR `musicNight` = ?d OR `intro` = ?d', $this->typeId, $this->typeId, $this->typeId, $this->typeId, $this->typeId))
|
||||||
{
|
{
|
||||||
@@ -240,14 +227,13 @@ class SoundPage extends GenericPage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$tabData['data'] = array_values($zoneData);
|
$tabData['data'] = $zoneData;
|
||||||
$tabData['hiddenCols'] = ['territory'];
|
$tabData['hiddenCols'] = ['territory'];
|
||||||
|
|
||||||
$this->lvTabs[] = [ZoneList::$brickFile, $tabData];
|
$this->lvTabs->addListviewTab(new Listview($tabData, ZoneList::$brickFile));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// tab: Races (VocalUISounds (containing error voice overs))
|
// tab: Races (VocalUISounds (containing error voice overs))
|
||||||
if ($vo = DB::Aowow()->selectCol('SELECT `raceId` FROM ?_races_sounds WHERE `soundId` = ?d GROUP BY `raceId`', $this->typeId))
|
if ($vo = DB::Aowow()->selectCol('SELECT `raceId` FROM ?_races_sounds WHERE `soundId` = ?d GROUP BY `raceId`', $this->typeId))
|
||||||
{
|
{
|
||||||
@@ -255,11 +241,10 @@ class SoundPage extends GenericPage
|
|||||||
if (!$races->error)
|
if (!$races->error)
|
||||||
{
|
{
|
||||||
$this->extendGlobalData($races->getJSGlobals(GLOBALINFO_SELF));
|
$this->extendGlobalData($races->getJSGlobals(GLOBALINFO_SELF));
|
||||||
$this->lvTabs[] = [CharRaceList::$brickFile, ['data' => array_values($races->getListviewData())]];
|
$this->lvTabs->addListviewTab(new Listview(['data' => $races->getListviewData()], CharRaceList::$brickFile));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// tab: Emotes (EmotesTextSound (containing emote audio))
|
// tab: Emotes (EmotesTextSound (containing emote audio))
|
||||||
if ($em = DB::Aowow()->selectCol('SELECT `emoteId` FROM ?_emotes_sounds WHERE `soundId` = ?d GROUP BY `emoteId` UNION SELECT `id` FROM ?_emotes WHERE `soundId` = ?d', $this->typeId, $this->typeId))
|
if ($em = DB::Aowow()->selectCol('SELECT `emoteId` FROM ?_emotes_sounds WHERE `soundId` = ?d GROUP BY `emoteId` UNION SELECT `id` FROM ?_emotes WHERE `soundId` = ?d', $this->typeId, $this->typeId))
|
||||||
{
|
{
|
||||||
@@ -267,10 +252,10 @@ class SoundPage extends GenericPage
|
|||||||
if (!$races->error)
|
if (!$races->error)
|
||||||
{
|
{
|
||||||
$this->extendGlobalData($races->getJSGlobals(GLOBALINFO_SELF));
|
$this->extendGlobalData($races->getJSGlobals(GLOBALINFO_SELF));
|
||||||
$this->lvTabs[] = [EmoteList::$brickFile, array(
|
$this->lvTabs->addListviewTab(new Listview(array(
|
||||||
'data' => array_values($races->getListviewData()),
|
'data' => $races->getListviewData(),
|
||||||
'name' => Util::ucFirst(Lang::game('emotes'))
|
'name' => Util::ucFirst(Lang::game('emotes'))
|
||||||
), 'emote'];
|
), EmoteList::$brickFile, 'emote'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,7 +274,7 @@ class SoundPage extends GenericPage
|
|||||||
`injury` = ?d OR `injurycritical` = ?d OR `death` = ?d OR `stun` = ?d OR `stand` = ?d OR
|
`injury` = ?d OR `injurycritical` = ?d OR `death` = ?d OR `stun` = ?d OR `stand` = ?d OR
|
||||||
`aggro` = ?d OR `wingflap` = ?d OR `wingglide` = ?d OR `alert` = ?d OR `fidget` = ?d OR
|
`aggro` = ?d OR `wingflap` = ?d OR `wingglide` = ?d OR `alert` = ?d OR `fidget` = ?d OR
|
||||||
`customattack` = ?d OR `loop` = ?d OR `jumpstart` = ?d OR `jumpend` = ?d OR `petattack` = ?d OR
|
`customattack` = ?d OR `loop` = ?d OR `jumpstart` = ?d OR `jumpend` = ?d OR `petattack` = ?d OR
|
||||||
`petorder` = ?d OR `petdismiss` = ?d OR `birth` = ?d OR `spellcast` = ?d OR `submerge` = ?d OR `submerged` = ?d',
|
`petorder` = ?d OR `petdismiss` = ?d OR `birth` = ?d OR `spellcast` = ?d OR `submerge` = ?d OR `submerged` = ?d',
|
||||||
$this->typeId, $this->typeId, $this->typeId, $this->typeId, $this->typeId,
|
$this->typeId, $this->typeId, $this->typeId, $this->typeId, $this->typeId,
|
||||||
$this->typeId, $this->typeId, $this->typeId, $this->typeId, $this->typeId,
|
$this->typeId, $this->typeId, $this->typeId, $this->typeId, $this->typeId,
|
||||||
$this->typeId, $this->typeId, $this->typeId, $this->typeId, $this->typeId,
|
$this->typeId, $this->typeId, $this->typeId, $this->typeId, $this->typeId,
|
||||||
@@ -319,10 +304,10 @@ class SoundPage extends GenericPage
|
|||||||
$npcs = new CreatureList($cnds);
|
$npcs = new CreatureList($cnds);
|
||||||
if (!$npcs->error)
|
if (!$npcs->error)
|
||||||
{
|
{
|
||||||
$this->addScript([SC_JS_FILE, '?data=zones']);
|
|
||||||
|
|
||||||
$this->extendGlobalData($npcs->getJSGlobals(GLOBALINFO_SELF));
|
$this->extendGlobalData($npcs->getJSGlobals(GLOBALINFO_SELF));
|
||||||
$this->lvTabs[] = [CreatureList::$brickFile, ['data' => array_values($npcs->getListviewData())]];
|
|
||||||
|
$this->addDataLoader('zones');
|
||||||
|
$this->lvTabs->addListviewTab(new Listview(['data' => $npcs->getListviewData()], CreatureList::$brickFile));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
26
endpoints/sound/sound_playlist.php
Normal file
26
endpoints/sound/sound_playlist.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Aowow;
|
||||||
|
|
||||||
|
if (!defined('AOWOW_REVISION'))
|
||||||
|
die('illegal access');
|
||||||
|
|
||||||
|
|
||||||
|
class SoundPlaylistResponse extends TemplateResponse
|
||||||
|
{
|
||||||
|
protected string $template = 'sound-playlist';
|
||||||
|
protected string $pageName = 'sound&playlist';
|
||||||
|
protected ?int $activeTab = parent::TAB_DATABASE;
|
||||||
|
protected array $breadcrumb = [0, 19, 1000];
|
||||||
|
|
||||||
|
protected function generate() : void
|
||||||
|
{
|
||||||
|
$this->h1 = Lang::sound('cat', 1000);
|
||||||
|
|
||||||
|
array_unshift($this->title, $this->h1, Util::ucFirst(Lang::game('sound')));
|
||||||
|
|
||||||
|
parent::generate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
117
endpoints/sounds/sounds.php
Normal file
117
endpoints/sounds/sounds.php
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Aowow;
|
||||||
|
|
||||||
|
if (!defined('AOWOW_REVISION'))
|
||||||
|
die('illegal access');
|
||||||
|
|
||||||
|
|
||||||
|
class SoundsBaseResponse extends TemplateResponse implements ICache
|
||||||
|
{
|
||||||
|
use TrListPage, TrCache;
|
||||||
|
|
||||||
|
protected int $type = Type::SOUND;
|
||||||
|
protected int $cacheType = CACHE_TYPE_PAGE;
|
||||||
|
|
||||||
|
protected string $template = 'sounds';
|
||||||
|
protected string $pageName = 'sounds';
|
||||||
|
protected ?int $activeTab = parent::TAB_DATABASE;
|
||||||
|
protected array $breadcrumb = [0, 19];
|
||||||
|
|
||||||
|
protected array $scripts = [[SC_JS_FILE, 'js/filters.js']];
|
||||||
|
protected array $expectedGET = array(
|
||||||
|
'filter' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => Filter::PATTERN_PARAM]]
|
||||||
|
);
|
||||||
|
protected array $validCats = [1, 2, 3, 4, 6, 9, 10, 12, 13, 14, 16, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 50, 52, 53];
|
||||||
|
|
||||||
|
public function __construct(string $pageParam)
|
||||||
|
{
|
||||||
|
$this->getCategoryFromUrl($pageParam);
|
||||||
|
if ($this->category)
|
||||||
|
$this->forward('?sounds&filter=ty='.$this->category[0]);
|
||||||
|
|
||||||
|
parent::__construct($pageParam);
|
||||||
|
|
||||||
|
$this->subCat = $pageParam !== '' ? '='.$pageParam : '';
|
||||||
|
$this->filter = new SoundListFilter($this->_get['filter'] ?? '', ['parentCats' => $this->category]);
|
||||||
|
$this->filterError = $this->filter->error;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function generate() : void
|
||||||
|
{
|
||||||
|
$this->h1 = Util::ucFirst(Lang::game('sounds'));
|
||||||
|
|
||||||
|
$this->filter->evalCriteria();
|
||||||
|
|
||||||
|
$conditions = [];
|
||||||
|
|
||||||
|
if (!User::isInGroup(U_GROUP_EMPLOYEE))
|
||||||
|
$conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
|
||||||
|
|
||||||
|
if ($_ = $this->filter->getConditions())
|
||||||
|
$conditions[] = $_;
|
||||||
|
|
||||||
|
$this->filterError = $this->filter->error; // maybe the evalX() caused something
|
||||||
|
|
||||||
|
|
||||||
|
/**************/
|
||||||
|
/* Page Title */
|
||||||
|
/**************/
|
||||||
|
|
||||||
|
$fiForm = $this->filter->values;
|
||||||
|
|
||||||
|
array_unshift($this->title, $this->h1);
|
||||||
|
if (count($fiForm['ty']) == 1)
|
||||||
|
array_unshift($this->title, Lang::sound('cat', $fiForm['ty'][0]));
|
||||||
|
|
||||||
|
|
||||||
|
/*************/
|
||||||
|
/* Menu Path */
|
||||||
|
/*************/
|
||||||
|
|
||||||
|
if (count($fiForm['ty']) == 1)
|
||||||
|
$this->breadcrumb[] = $fiForm['ty'][0];
|
||||||
|
|
||||||
|
|
||||||
|
/****************/
|
||||||
|
/* Main Content */
|
||||||
|
/****************/
|
||||||
|
|
||||||
|
$this->redButtons = array(
|
||||||
|
BUTTON_WOWHEAD => true,
|
||||||
|
BUTTON_PLAYLIST => true
|
||||||
|
);
|
||||||
|
if ($fiQuery = $this->filter->buildGETParam())
|
||||||
|
$this->wowheadLink .= '&filter='.$fiQuery;
|
||||||
|
|
||||||
|
$tabData = [];
|
||||||
|
$sounds = new SoundList($conditions, ['calcTotal' => true]);
|
||||||
|
if (!$sounds->error)
|
||||||
|
{
|
||||||
|
$tabData['data'] = $sounds->getListviewData();
|
||||||
|
|
||||||
|
// create note if search limit was exceeded; overwriting 'note' is intentional
|
||||||
|
if ($sounds->getMatches() > Cfg::get('SQL_LIMIT_DEFAULT'))
|
||||||
|
{
|
||||||
|
$tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_soundsfound', $sounds->getMatches(), Cfg::get('SQL_LIMIT_DEFAULT'));
|
||||||
|
$tabData['_truncated'] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->lvTabs = new Tabs(['parent' => "\$\$WH.ge('tabs-generic')"]);
|
||||||
|
|
||||||
|
$this->lvTabs->addListviewTab(new Listview($tabData, SoundList::$brickFile));
|
||||||
|
|
||||||
|
parent::generate();
|
||||||
|
|
||||||
|
$this->setOnCacheLoaded([self::class, 'onBeforeDisplay']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function onBeforeDisplay()
|
||||||
|
{
|
||||||
|
// sort for dropdown-menus in filter
|
||||||
|
Lang::sort('sound', 'cat');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Aowow;
|
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
|
||||||
die('illegal access');
|
|
||||||
|
|
||||||
|
|
||||||
// menuId 19: Sounds g_initPath()
|
|
||||||
// tabId 0: Database g_initHeader()
|
|
||||||
class SoundsPage extends GenericPage
|
|
||||||
{
|
|
||||||
use TrListPage;
|
|
||||||
|
|
||||||
protected $type = Type::SOUND;
|
|
||||||
protected $tpl = 'sounds';
|
|
||||||
protected $path = [0, 19];
|
|
||||||
protected $tabId = 0;
|
|
||||||
protected $mode = CACHE_TYPE_PAGE;
|
|
||||||
protected $validCats = [1, 2, 3, 4, 6, 9, 10, 12, 13, 14, 16, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 50, 52, 53];
|
|
||||||
protected $scripts = [[SC_JS_FILE, 'js/filters.js']];
|
|
||||||
|
|
||||||
protected $_get = ['filter' => ['filter' => FILTER_UNSAFE_RAW]];
|
|
||||||
|
|
||||||
public function __construct($pageCall, $pageParam)
|
|
||||||
{
|
|
||||||
$this->getCategoryFromUrl($pageParam);
|
|
||||||
if (isset($this->category[0]))
|
|
||||||
header('Location: ?sounds&filter=ty='.$this->category[0], true, 302);
|
|
||||||
|
|
||||||
parent::__construct($pageCall, $pageParam);
|
|
||||||
|
|
||||||
$this->filterObj = new SoundListFilter($this->_get['filter'] ?? '', ['parentCats' => $this->category]);
|
|
||||||
|
|
||||||
$this->name = Util::ucFirst(Lang::game('sounds'));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function generateContent()
|
|
||||||
{
|
|
||||||
$this->redButtons = array(
|
|
||||||
BUTTON_WOWHEAD => true,
|
|
||||||
BUTTON_PLAYLIST => true
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->filterObj->evalCriteria();
|
|
||||||
|
|
||||||
$conditions = [];
|
|
||||||
if ($_ = $this->filterObj->getConditions())
|
|
||||||
$conditions[] = $_;
|
|
||||||
|
|
||||||
$tabData = [];
|
|
||||||
$sounds = new SoundList($conditions, ['calcTotal' => true]);
|
|
||||||
if (!$sounds->error)
|
|
||||||
{
|
|
||||||
$tabData['data'] = array_values($sounds->getListviewData());
|
|
||||||
|
|
||||||
// create note if search limit was exceeded; overwriting 'note' is intentional
|
|
||||||
if ($sounds->getMatches() > Cfg::get('SQL_LIMIT_DEFAULT'))
|
|
||||||
{
|
|
||||||
$tabData['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_soundsfound', $sounds->getMatches(), Cfg::get('SQL_LIMIT_DEFAULT'));
|
|
||||||
$tabData['_truncated'] = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->filterObj->error)
|
|
||||||
$tabData['_errors'] = 1;
|
|
||||||
}
|
|
||||||
$this->lvTabs[] = [SoundList::$brickFile, $tabData];
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function postCache()
|
|
||||||
{
|
|
||||||
// sort for dropdown-menus
|
|
||||||
Lang::sort('sound', 'cat');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function generateTitle()
|
|
||||||
{
|
|
||||||
array_unshift($this->title, $this->name);
|
|
||||||
|
|
||||||
$form = $this->filterObj->values;
|
|
||||||
if (count($form['ty']) == 1)
|
|
||||||
array_unshift($this->title, Lang::sound('cat', $form['ty'][0]));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function generatePath()
|
|
||||||
{
|
|
||||||
$form = $this->filterObj->values;
|
|
||||||
if (count($form['ty']) == 1)
|
|
||||||
$this->path[] = $form['ty'][0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
68
template/pages/sound-playlist.tpl.php
Normal file
68
template/pages/sound-playlist.tpl.php
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
namespace Aowow\Template;
|
||||||
|
|
||||||
|
use \Aowow\Lang;
|
||||||
|
|
||||||
|
$this->brick('header');
|
||||||
|
?>
|
||||||
|
<div class="main" id="main">
|
||||||
|
<div class="main-precontents" id="main-precontents"></div>
|
||||||
|
<div class="main-contents" id="main-contents">
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$this->brick('announcement');
|
||||||
|
|
||||||
|
$this->brick('pageTemplate');
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="text">
|
||||||
|
<h1><?=$this->h1; ?></h1>
|
||||||
|
|
||||||
|
<?php $this->brick('markup', ['markup' => $this->article]); ?>
|
||||||
|
|
||||||
|
<div id="playlistcontrols" style="margin: 20px"></div><div id="playlisttracks"></div>
|
||||||
|
<script type="text/javascript">//<![CDATA[
|
||||||
|
g_audioplaylist.setAudioControls($WH.ge('playlistcontrols'));
|
||||||
|
(function(){
|
||||||
|
var delline = function()
|
||||||
|
{
|
||||||
|
var li = this.parentNode;
|
||||||
|
var siblings = li.parentNode.childNodes;
|
||||||
|
|
||||||
|
for (var id = 0; id < siblings.length; id++)
|
||||||
|
if (siblings[id] === li)
|
||||||
|
break;
|
||||||
|
|
||||||
|
g_audioplaylist.deleteSound(id);
|
||||||
|
li.parentNode.removeChild(li);
|
||||||
|
}
|
||||||
|
|
||||||
|
var l = g_audioplaylist.getList();
|
||||||
|
var ol = $WH.ce('ol');
|
||||||
|
var s, li;
|
||||||
|
for (var x in l)
|
||||||
|
{
|
||||||
|
li = $WH.ce('li');
|
||||||
|
|
||||||
|
s = $WH.ce('span');
|
||||||
|
s.className = 'icon-delete';
|
||||||
|
s.style.cursor = 'pointer';
|
||||||
|
$WH.Tooltip.simple(s, LANG.delete, 'q2');
|
||||||
|
$WH.aE(s, 'click', delline);
|
||||||
|
$WH.ae(li, s);
|
||||||
|
|
||||||
|
s = $WH.ce('span');
|
||||||
|
$WH.st(s, l[x]);
|
||||||
|
$WH.ae(li, s);
|
||||||
|
|
||||||
|
$WH.ae(ol, li);
|
||||||
|
}
|
||||||
|
$WH.ae($WH.ge('playlisttracks'),ol);
|
||||||
|
})();
|
||||||
|
//]]></script></div>
|
||||||
|
|
||||||
|
<div class="clear"></div>
|
||||||
|
</div><!-- main-contents -->
|
||||||
|
</div><!-- main -->
|
||||||
|
|
||||||
|
<?php $this->brick('footer'); ?>
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
<?php namespace Aowow; ?>
|
<?php
|
||||||
|
namespace Aowow\Template;
|
||||||
|
|
||||||
<?php $this->brick('header'); ?>
|
use \Aowow\Lang;
|
||||||
|
|
||||||
|
$this->brick('header');
|
||||||
|
?>
|
||||||
<div class="main" id="main">
|
<div class="main" id="main">
|
||||||
<div class="main-precontents" id="main-precontents"></div>
|
<div class="main-precontents" id="main-precontents"></div>
|
||||||
<div class="main-contents" id="main-contents">
|
<div class="main-contents" id="main-contents">
|
||||||
@@ -17,68 +20,19 @@
|
|||||||
$this->brick('redButtons');
|
$this->brick('redButtons');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<h1><?=$this->name; ?></h1>
|
<h1><?=$this->h1; ?></h1>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$this->brick('article');
|
$this->brick('markup', ['markup' => $this->article]);
|
||||||
|
|
||||||
if ($this->special):
|
$this->brickIf($this->map, 'mapper');
|
||||||
?>
|
|
||||||
<div id="playlistcontrols" style="margin: 20px"></div><div id="playlisttracks"></div>
|
|
||||||
<script type="text/javascript">//<![CDATA[
|
|
||||||
g_audioplaylist.setAudioControls($WH.ge('playlistcontrols'));
|
|
||||||
(function(){
|
|
||||||
var delline = function()
|
|
||||||
{
|
|
||||||
var li = this.parentNode;
|
|
||||||
var siblings = li.parentNode.childNodes;
|
|
||||||
|
|
||||||
for (var id = 0; id < siblings.length; id++)
|
|
||||||
if (siblings[id] === li)
|
|
||||||
break;
|
|
||||||
|
|
||||||
g_audioplaylist.deleteSound(id);
|
|
||||||
li.parentNode.removeChild(li);
|
|
||||||
}
|
|
||||||
|
|
||||||
var l = g_audioplaylist.getList();
|
|
||||||
var ol = $WH.ce('ol');
|
|
||||||
var s, li;
|
|
||||||
for (var x in l)
|
|
||||||
{
|
|
||||||
li = $WH.ce('li');
|
|
||||||
|
|
||||||
s = $WH.ce('span');
|
|
||||||
s.className = 'icon-delete';
|
|
||||||
s.style.cursor = 'pointer';
|
|
||||||
$WH.Tooltip.simple(s, LANG.delete, 'q2');
|
|
||||||
$WH.aE(s, 'click', delline);
|
|
||||||
$WH.ae(li, s);
|
|
||||||
|
|
||||||
s = $WH.ce('span');
|
|
||||||
$WH.st(s, l[x]);
|
|
||||||
$WH.ae(li, s);
|
|
||||||
|
|
||||||
$WH.ae(ol, li);
|
|
||||||
}
|
|
||||||
$WH.ae($WH.ge('playlisttracks'),ol);
|
|
||||||
})();
|
|
||||||
//]]></script></div>
|
|
||||||
|
|
||||||
<div class="clear"></div>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
else:
|
|
||||||
|
|
||||||
if (!empty($this->map)):
|
|
||||||
$this->brick('mapper');
|
|
||||||
endif;
|
|
||||||
?>
|
?>
|
||||||
<ol id="soundfilelist"></ol>
|
<ol id="soundfilelist"></ol>
|
||||||
<div id="mainsound"></div>
|
<div id="mainsound"></div>
|
||||||
<script type="text/javascript">//<![CDATA[
|
<script type="text/javascript">//<![CDATA[
|
||||||
var soundpaths = g_sounds[<?=$this->typeId; ?>].files;
|
var soundpaths = g_sounds[<?=$this->typeId; ?>].files;
|
||||||
soundpaths.sort(function(a, b) { return $WH.stringCompare(a.title, b.title) || $WH.stringCompare(a.id, b.id); });
|
soundpaths.sort(function(a, b) { return $WH.strcmp(a.title, b.title) || $WH.strcmp(a.id, b.id); });
|
||||||
|
// aowow - see $WH.strcmp - soundpaths.sort(function(a, b) { return $WH.stringCompare(a.title, b.title) || $WH.stringCompare(a.id, b.id); });
|
||||||
var sounddialog = new Dialog();
|
var sounddialog = new Dialog();
|
||||||
|
|
||||||
Dialog.templates.sound = {
|
Dialog.templates.sound = {
|
||||||
@@ -113,7 +67,7 @@ g_audioplaylist.setAudioControls($WH.ge('playlistcontrols'));
|
|||||||
sounddialog.show('sound', { data: data, onSubmit: $WH.rf });
|
sounddialog.show('sound', { data: data, onSubmit: $WH.rf });
|
||||||
}
|
}
|
||||||
|
|
||||||
(new AudioControls()).init(soundpaths,$WH.ge('mainsound'));
|
(new AudioControls()).init(soundpaths, $WH.ge('mainsound'));
|
||||||
|
|
||||||
(function(){
|
(function(){
|
||||||
var ol = $WH.ge('soundfilelist');
|
var ol = $WH.ge('soundfilelist');
|
||||||
@@ -135,10 +89,9 @@ g_audioplaylist.setAudioControls($WH.ge('playlistcontrols'));
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$this->brick('lvTabs', ['relTabs' => true]);
|
$this->brick('lvTabs');
|
||||||
|
|
||||||
$this->brick('contribute');
|
$this->brick('contribute');
|
||||||
endif;
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<?php namespace Aowow; ?>
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$this->brick('header');
|
namespace Aowow\Template;
|
||||||
$f = $this->filterObj->values // shorthand
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
use \Aowow\Lang;
|
||||||
|
|
||||||
|
$this->brick('header');
|
||||||
|
$f = $this->filter->values; // shorthand
|
||||||
|
?>
|
||||||
<div class="main" id="main">
|
<div class="main" id="main">
|
||||||
<div class="main-precontents" id="main-precontents"></div>
|
<div class="main-precontents" id="main-precontents"></div>
|
||||||
<div class="main-contents" id="main-contents">
|
<div class="main-contents" id="main-contents">
|
||||||
@@ -12,31 +13,32 @@ $f = $this->filterObj->values // shorthand
|
|||||||
<?php
|
<?php
|
||||||
$this->brick('announcement');
|
$this->brick('announcement');
|
||||||
|
|
||||||
$this->brick('pageTemplate', ['fiQuery' => $this->filterObj->query, 'fiMenuItem' => [101]]);
|
$this->brick('pageTemplate', ['fiQuery' => $this->filter->query, 'fiMenuItem' => [19]]);
|
||||||
?>
|
?>
|
||||||
<div class="text"><h1><?=$this->name; ?> <?=$this->brick('redButtons'); ?></h1></div>
|
<div id="fi" style="display: <?=($this->filter->query ? 'block' : 'none'); ?>;">
|
||||||
<div id="fi" style="display: <?=($this->filterObj->query ? 'block' : 'none'); ?>;">
|
|
||||||
<form action="?filter=sounds" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)">
|
<form action="?filter=sounds" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)">
|
||||||
|
<div class="text">
|
||||||
|
<?php
|
||||||
|
$this->brick('headIcons');
|
||||||
|
|
||||||
|
$this->brick('redButtons');
|
||||||
|
?>
|
||||||
|
<h1><?=$this->h1; ?></h1>
|
||||||
|
</div>
|
||||||
<div class="rightpanel">
|
<div class="rightpanel">
|
||||||
<div style="float: left"><?=Util::ucFirst(Lang::game('type')).Lang::main('colon'); ?></div>
|
<div style="float: left"><?=Lang::game('type').Lang::main('colon'); ?></div>
|
||||||
<small><a href="javascript:;" onclick="document.forms['fi'].elements['ty[]'].selectedIndex = -1; return false" onmousedown="return false"><?=Lang::main('clear'); ?></a></small>
|
<small><a href="javascript:;" onclick="document.forms['fi'].elements['ty[]'].selectedIndex = -1; return false" onmousedown="return false"><?=Lang::main('clear'); ?></a></small>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
<select name="ty[]" size="6" multiple="multiple" class="rightselect">
|
<select name="ty[]" size="6" multiple="multiple" class="rightselect">
|
||||||
<?php
|
<?=$this->makeOptionsList(Lang::sound('cat'), $f['ty'], 28, fn($v, $k) => $v && $k < 1000); ?>
|
||||||
foreach (Lang::sound('cat') as $i => $str):
|
|
||||||
if ($str && $i < 1000):
|
|
||||||
echo ' <option value="'.$i.'"'.(isset($f['ty']) && in_array($i, (array)$f['ty']) ? ' selected' : null).' >'.$str."</option>\n";
|
|
||||||
endif;
|
|
||||||
endforeach;
|
|
||||||
?>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?=Util::ucFirst(Lang::main('name')).Lang::main('colon'); ?></td>
|
<td><?=$this->ucFirst(Lang::main('name')).Lang::main('colon'); ?></td>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<table><tr>
|
<table><tr>
|
||||||
<td> <input type="text" name="na" size="30" <?=(isset($f['na']) ? 'value="'.Util::htmlEscape($f['na']).'" ' : null); ?>/></td>
|
<td> <input type="text" name="na" size="30" <?=($f['na'] ? 'value="'.$this->escHTML($f['na']).'" ' : ''); ?>/></td>
|
||||||
</tr></table>
|
</tr></table>
|
||||||
</td>
|
</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user