Skip to content

Commit

Permalink
Clean system-message-container if no message found
Browse files Browse the repository at this point in the history
  • Loading branch information
joomlart committed Feb 1, 2013
1 parent 1879476 commit a217b24
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 0 deletions.
9 changes: 9 additions & 0 deletions source/plg_system_t3/includes/core/t3.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ public static function relativePath($path1, $path2='') {

return rtrim ($path, '/');
}

public static function error($msg, $code = 500){
if (JError::$legacy) {
JError::setErrorHandling(E_ERROR, 'die');
return JError::raiseError($code, $msg);
} else {
throw new Exception($msg, $code);
}
}
}

T3::init();
Expand Down
26 changes: 26 additions & 0 deletions source/plg_system_t3/includes/core/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,32 @@ function checkSpotlight($name, $positions)
return $this->_tpl && method_exists($this->_tpl, 'countModules') ? $this->_tpl->countModules (implode(' or ', $poss)) : 0;
}

/**
* Check system messages
*/
private function checkSysMsg()
{
// Initialise variables.
$lists = array();

// Get the message queue
$messages = JFactory::getApplication()->getMessageQueue();

// Build the sorted message list
if (is_array($messages) && !empty($messages))
{
foreach ($messages as $msg)
{
if (isset($msg['type']) && isset($msg['message']))
{
$lists[$msg['type']][] = $msg['message'];
}
}
}

return count($lists);
}

/**
* Get position name
*
Expand Down
2 changes: 2 additions & 0 deletions source/tpl_t3_blank/tpls/blocks/mainbody-content-left.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@

<!-- MAIN CONTENT -->
<div id="t3-content" class="t3-content <?php echo $this->getClass($layout, $col) ?>" <?php echo $this->getData ($layout, $col++) ?>>
<?php if($this->checkSysMsg()):?>
<jdoc:include type="message" />
<?php endif; ?>
<jdoc:include type="component" />
</div>
<!-- //MAIN CONTENT -->
Expand Down
2 changes: 2 additions & 0 deletions source/tpl_t3_blank/tpls/blocks/mainbody-content-right.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@

<!-- MAIN CONTENT -->
<div id="t3-content" class="t3-content <?php echo $this->getClass($layout, $col) ?>" <?php echo $this->getData ($layout, $col++) ?>>
<?php if($this->checkSysMsg()):?>
<jdoc:include type="message" />
<?php endif; ?>
<jdoc:include type="component" />
</div>
<!-- //MAIN CONTENT -->
Expand Down
2 changes: 2 additions & 0 deletions source/tpl_t3_blank/tpls/blocks/mainbody.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@

<!-- MAIN CONTENT -->
<div id="t3-content" class="t3-content <?php echo $this->getClass($layout, $col) ?>" <?php echo $this->getData ($layout, $col++) ?>>
<?php if($this->checkSysMsg()):?>
<jdoc:include type="message" />
<?php endif; ?>
<jdoc:include type="component" />
</div>
<!-- //MAIN CONTENT -->
Expand Down

0 comments on commit a217b24

Please sign in to comment.