From aa66a7644be76c6db67c49916a68d6329c7e8900 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Mon, 24 Feb 2020 01:46:50 +0100 Subject: [PATCH] Areatrigger/Names * fix unnamed areatrigger after fetching them from DB and not clientside Mail/Names * fix unnamed mails after fetching them from DB and not clientside --- includes/types/areatrigger.class.php | 9 +++++++++ includes/types/mail.class.php | 7 ++++++- localization/locale_dede.php | 2 +- localization/locale_enus.php | 2 +- localization/locale_eses.php | 2 +- localization/locale_frfr.php | 2 +- localization/locale_ruru.php | 2 +- localization/locale_zhcn.php | 2 +- pages/mail.php | 4 +--- pages/zone.php | 4 +--- template/listviews/areatrigger.tpl.php | 4 ---- template/listviews/mail.tpl.php | 4 ---- 12 files changed, 23 insertions(+), 21 deletions(-) diff --git a/includes/types/areatrigger.class.php b/includes/types/areatrigger.class.php index dc34233a..c4c9e369 100644 --- a/includes/types/areatrigger.class.php +++ b/includes/types/areatrigger.class.php @@ -18,6 +18,15 @@ class AreaTriggerList extends BaseType 's' => ['j' => ['?_spawns s ON s.type = 503 AND s.typeId = a.id', true], 's' => ', s.areaId'] ); + public function __construct($conditions) + { + parent::__construct($conditions); + + foreach ($this->iterate() as $id => &$_curTpl) + if (!$_curTpl['name']) + $_curTpl['name'] = 'Unnamed Areatrigger #' . $id; + } + public function getListviewData() { $data = []; diff --git a/includes/types/mail.class.php b/includes/types/mail.class.php index 25b7c3e6..07e7907f 100644 --- a/includes/types/mail.class.php +++ b/includes/types/mail.class.php @@ -21,9 +21,14 @@ class MailList extends BaseType return; // post processing - foreach ($this->iterate() as &$_curTpl) + foreach ($this->iterate() as $_id => &$_curTpl) { $_curTpl['name'] = Util::localizedString($_curTpl, 'subject', true); + if (!$_curTpl['name']) + { + $_curTpl['name'] = sprintf(Lang::mail('untitled'), $_id); + $_curTpl['subject_loc0'] = $_curTpl['name']; + } } } diff --git a/localization/locale_dede.php b/localization/locale_dede.php index 99b49c91..9dad95be 100644 --- a/localization/locale_dede.php +++ b/localization/locale_dede.php @@ -1164,7 +1164,7 @@ $lang = array( 'mailIn' => " nach %s", 'delay' => "Verzögerung", 'sender' => "Absender", - 'untitled' => "Unbetitelter Brief" + 'untitled' => "Unbetitelter Brief #%d" ), 'pet' => array( 'notFound' => "Diese Tierart existiert nicht.", diff --git a/localization/locale_enus.php b/localization/locale_enus.php index 263bec07..4d9782b8 100644 --- a/localization/locale_enus.php +++ b/localization/locale_enus.php @@ -1164,7 +1164,7 @@ $lang = array( 'mailIn' => " after %s", 'delay' => "Delay", 'sender' => "Sender", - 'untitled' => "Untitled Mail" + 'untitled' => "Untitled Mail #%d" ), 'pet' => array( 'notFound' => "This pet family doesn't exist.", diff --git a/localization/locale_eses.php b/localization/locale_eses.php index 4fbba791..22e7a02c 100644 --- a/localization/locale_eses.php +++ b/localization/locale_eses.php @@ -1164,7 +1164,7 @@ $lang = array( 'mailIn' => " después de %s", 'delay' => "Delay", 'sender' => "Sender", - 'untitled' => "Untitled Mail" + 'untitled' => "Untitled Mail #%d" ), 'pet' => array( 'notFound' => "Esta familia de mascotas no existe.", diff --git a/localization/locale_frfr.php b/localization/locale_frfr.php index d5dd6ba4..4056b65f 100644 --- a/localization/locale_frfr.php +++ b/localization/locale_frfr.php @@ -1164,7 +1164,7 @@ $lang = array( 'mailIn' => " après %s", 'delay' => "Delay", 'sender' => "Sender", - 'untitled' => "Untitled Mail" + 'untitled' => "Untitled Mail #%d" ), 'pet' => array( 'notFound' => "Cette famille de familiers n'existe pas.", diff --git a/localization/locale_ruru.php b/localization/locale_ruru.php index ae6a9e08..a04fa2cf 100644 --- a/localization/locale_ruru.php +++ b/localization/locale_ruru.php @@ -1164,7 +1164,7 @@ $lang = array( 'mailIn' => " через %s", 'delay' => "Delay", 'sender' => "Sender", - 'untitled' => "Untitled Mail" + 'untitled' => "Untitled Mail #%d" ), 'pet' => array( 'notFound' => "Такой породы питомцев не существует.", diff --git a/localization/locale_zhcn.php b/localization/locale_zhcn.php index 3fae88a1..30827482 100644 --- a/localization/locale_zhcn.php +++ b/localization/locale_zhcn.php @@ -1164,7 +1164,7 @@ $lang = array( 'mailIn' => " after %s", 'delay' => "Delay", 'sender' => "Sender", - 'untitled' => "Untitled Mail" + 'untitled' => "Untitled Mail #%d" ), 'pet' => array( 'notFound' => "这个宠物家族不存在。", diff --git a/pages/mail.php b/pages/mail.php index a827d4b3..17684b08 100644 --- a/pages/mail.php +++ b/pages/mail.php @@ -30,9 +30,7 @@ class MailPage extends GenericPage $this->extendGlobalData($this->subject->getJSGlobals()); - $this->name = Util::ucFirst($this->subject->getField('subject', true)); - if (!$this->name) - $this->name = Lang::mail('untitled'); + $this->name = Util::ucFirst($this->subject->getField('name', true)); } protected function generateContent() diff --git a/pages/zone.php b/pages/zone.php index 0c69e846..aed61db8 100644 --- a/pages/zone.php +++ b/pages/zone.php @@ -384,12 +384,10 @@ class ZonePage extends GenericPage if (!$tpl) continue; - $n = Util::localizedString($tpl, 'name'); - $addToSOM('areatrigger', array( 'coords' => [[$spawn['posX'], $spawn['posY']]], 'level' => $spawn['floor'], - 'name' => $tpl['name'] ?: 'Unnamed AT #'.$spawn['typeId'], + 'name' => Util::localizedString($tpl, 'name', true, true), 'type' => TYPE_AREATRIGGER, 'id' => $spawn['typeId'], 'description' => 'Type: '.Lang::areatrigger('types', $tpl['type']) diff --git a/template/listviews/areatrigger.tpl.php b/template/listviews/areatrigger.tpl.php index 6409e489..c9ee2816 100644 --- a/template/listviews/areatrigger.tpl.php +++ b/template/listviews/areatrigger.tpl.php @@ -27,10 +27,6 @@ Listview.templates.areatrigger = { var a = $WH.ce('a'); a.style.fontFamily = 'Verdana, sans-serif'; a.href = this.getItemLink(areatrigger); - if (!areatrigger.name){ - areatrigger.name = 'Unnamed Areatrigger' - a.className = 'q0'; - } $WH.ae(a, $WH.ct(areatrigger.name)); $WH.ae(wrapper, a); diff --git a/template/listviews/mail.tpl.php b/template/listviews/mail.tpl.php index 74acc7ec..2ebe19f4 100644 --- a/template/listviews/mail.tpl.php +++ b/template/listviews/mail.tpl.php @@ -27,10 +27,6 @@ Listview.templates.mail = { var a = $WH.ce('a'); a.style.fontFamily = 'Verdana, sans-serif'; a.href = this.getItemLink(mail); - if (!mail.subject){ - mail.subject = 'Untitled Mail' - a.className = 'q0'; - } $WH.ae(a, $WH.ct(mail.subject)); $WH.ae(wrapper, a);