diff options
author | Antonio Gallo <tonicucoz@gmail.com> | 2011-10-09 21:03:50 +0000 |
---|---|---|
committer | Antonio Gallo <tonicucoz@gmail.com> | 2011-10-09 21:03:50 +0000 |
commit | 9e0955c96d888fc2e00014498d095a7d65ab48fb (patch) | |
tree | 72a08e21be4d61b7ea2ec56891652355c22c5e2c | |
parent | f8f3c572e55c90ae13253eb8c910a030bf175e09 (diff) |
improved the way modules are taken from an xml configuration string
-rw-r--r-- | h-source/Application/Controllers/BaseController.php | 24 | ||||
-rw-r--r-- | h-source/Application/Controllers/GenericController.php | 20 | ||||
-rw-r--r-- | h-source/Application/Controllers/HomeController.php | 10 | ||||
-rw-r--r-- | h-source/Application/Views/page.php | 4 | ||||
-rw-r--r-- | 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'] = "<input type='hidden' name='id_hard' value='".$clean['id_hard']."'>\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 @@ <?php echo gtext("This is an old revision of this page, as edited by");?> <b><?php echo $u->getLinkToUserFromId($updated_by);?></b> <?php echo gtext('at');?> <b><?php echo smartDate($update_date); ?></b>. <?php echo gtext("It may differ significantly from the");?> <a href="<?php echo $this->baseUrl."/".$this->controller."/view/$lang/$id_hard/".$name.$this->viewStatus;?>"><?php echo gtext("Current revision");?></a>. </div> <?php } ?> + + <?php if ( strcmp($item[$tableName]['it_tracks_users'],'yes') === 0 ) { ?> + <?php echo $tracksHelpTop;?> + <?php } ?> <div class="notebook_model"> <img align="top" class="catalogue_item_icon" src="<?php echo Hardware::getIconFromType($item[$tableName]['type']);?>"> <span class="span_model_name"><?php echo gtext("model");?>: <b><?php echo $item[$tableName]['model'];?></b><span class="model_id">(<?php echo gtext("model id");?>: <?php echo $id_hard;?>)</span></span> 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; } /* |