From 9e0955c96d888fc2e00014498d095a7d65ab48fb Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Sun, 9 Oct 2011 21:03:50 +0000 Subject: improved the way modules are taken from an xml configuration string --- .../Application/Controllers/BaseController.php | 24 ++++++++++++++-------- .../Application/Controllers/GenericController.php | 20 ++++-------------- .../Application/Controllers/HomeController.php | 10 ++------- h-source/Application/Views/page.php | 4 ++++ h-source/Public/Css/main.css | 7 +++++++ 5 files changed, 33 insertions(+), 32 deletions(-) diff --git a/h-source/Application/Controllers/BaseController.php b/h-source/Application/Controllers/BaseController.php index 13bbb66..2d8c0a7 100644 --- a/h-source/Application/Controllers/BaseController.php +++ b/h-source/Application/Controllers/BaseController.php @@ -168,6 +168,20 @@ class BaseController extends Controller return null; } +// get the HTML of a module from the xml configuration string +// $xmlPath: array conitaining the path + protected function getModule($xmlPath) + { + $tracksHelpLabel = null; + $xml = $this->getBox($xmlPath); + if ($xml) + { + $box_news = new BoxParser($xml); + $tracksHelpLabel = $box_news->render(); + } + return $tracksHelpLabel; + } + protected function right($lang = 'en') { $hard = new HardwareModel(); @@ -179,14 +193,8 @@ class BaseController extends Controller $data['numbLogged'] = count($logged); //render the boxes inside the right column - $data['htmlRightBox'] = null; - $xml = $this->getBox(array('right_column')); - if ($xml) - { - $box_news = new BoxParser($xml); - $data['htmlRightBox'] = $box_news->render(); - } - + $data['htmlRightBox'] = $this->getModule(array('right_column')); + $data['language_links'] = $this->buildLanguageLinks($this->lang); $data['lastModif'] = $this->m['HistoryModel'] diff --git a/h-source/Application/Controllers/GenericController.php b/h-source/Application/Controllers/GenericController.php index f1f1d70..d466d61 100644 --- a/h-source/Application/Controllers/GenericController.php +++ b/h-source/Application/Controllers/GenericController.php @@ -130,7 +130,7 @@ class GenericController extends BaseController $data['submitName'] = "insertAction"; $data['hiddenInput'] = null; - $data['tracksHelpLabel'] = $this->getEntryLabel('it_tracks_users'); + $data['tracksHelpLabel'] = $this->getModule(array('devices',$this->controller,'form','it_tracks_users')); $data['values'] = $this->m['HardwareModel']->getFormValues('insert','sanitizeHtml'); $this->append($data); @@ -291,7 +291,7 @@ class GenericController extends BaseController $data['values'] = $this->m['HardwareModel']->getFormValues('update','sanitizeHtml'); $data['hiddenInput'] = "\n"; - $data['tracksHelpLabel'] = $this->getEntryLabel('it_tracks_users'); + $data['tracksHelpLabel'] = $this->getModule(array('devices',$this->controller,'form','it_tracks_users')); $this->append($data); @@ -326,19 +326,6 @@ class GenericController extends BaseController } } -// get the help label for the "it_tracks_users" entry - protected function getEntryLabel($entryName) - { - $tracksHelpLabel = null; - $xml = $this->getBox(array('devices',$this->controller,'form',$entryName)); - if ($xml) - { - $box_news = new BoxParser($xml); - $tracksHelpLabel = $box_news->render(); - } - return $tracksHelpLabel; - } - //get the preview of the description entry protected function getPreview() { @@ -549,7 +536,8 @@ class GenericController extends BaseController $data['isDeleted'] = $this->m['HardwareModel']->isDeleted($clean['id_hard']); $data['isApproved'] = strcmp($data['table'][0]['hardware']['approved'],'yes') === 0 ? true : false; - $data['tracksHelpLabel'] = $this->getEntryLabel('it_tracks_users'); + $data['tracksHelpTop'] = $this->getModule(array('devices',$this->controller,'page','it_tracks_users')); + $data['tracksHelpLabel'] = $this->getModule(array('devices',$this->controller,'form','it_tracks_users')); $this->passWhoAskedForDeletion($clean['id_hard']); } diff --git a/h-source/Application/Controllers/HomeController.php b/h-source/Application/Controllers/HomeController.php index 96479f3..eecb53f 100644 --- a/h-source/Application/Controllers/HomeController.php +++ b/h-source/Application/Controllers/HomeController.php @@ -37,14 +37,8 @@ class HomeController extends BaseController public function index($lang = 'en') { // get the news container - $data['htmlNewsBox'] = null; - $xml = $this->getBox(array('top_news')); - if ($xml) - { - $box_news = new BoxParser($xml); - $data['htmlNewsBox'] = $box_news->render(); - } - + $data['htmlNewsBox'] = $this->getModule(array('top_news')); + $this->append($data); $this->cleverLoad('left'); $this->right($lang); diff --git a/h-source/Application/Views/page.php b/h-source/Application/Views/page.php index 6b7e539..e59aa87 100644 --- a/h-source/Application/Views/page.php +++ b/h-source/Application/Views/page.php @@ -36,6 +36,10 @@ getLinkToUserFromId($updated_by);?> . controller."/view/$lang/$id_hard/".$name.$this->viewStatus;?>">. + + + +
: (: ) diff --git a/h-source/Public/Css/main.css b/h-source/Public/Css/main.css index 5afe645..97c7da7 100644 --- a/h-source/Public/Css/main.css +++ b/h-source/Public/Css/main.css @@ -1999,6 +1999,13 @@ div#description_tabs_content .box_module_label a { color:#FF4500; + font-size:12px; +} + +.track_alert +{ + border:10px solid red; + padding:5px; } /* -- cgit v1.2.3