Changeset 805


Ignore:
Timestamp:
Jan 13, 2024 6:04:15 PM (4 months ago)
Author:
anonymous
Message:

Add return false from printRaisedMessages() if no messages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/App.inc.php

    r796 r805  
    827827
    828828        $messages = $this->getRaisedMessages();
    829         if (!empty($messages)) {
    830             ?><div id="sc-msg" class="sc-msg"><?php
    831             if ('' != $above) {
    832                 ?><div class="sc-above"><?php echo oTxt($above); ?></div><?php
    833             }
    834             foreach ($messages as $m) {
    835                 if (error_reporting() > 0 && $this->getParam('display_errors') && isset($m['file']) && isset($m['line'])) {
    836                     echo "\n<!-- [" . $m['file'] . ' : ' . $m['line'] . '] -->';
    837                 }
    838                 switch ($m['type']) {
    839                 case MSG_ERR:
    840                     echo '<div data-alert data-closable class="sc-msg-error alert-box callout alert">' . $m['message'] . '<a class="close close-button" aria-label="Dismiss alert" data-close><span aria-hidden="true">&times;</span></a></div>';
    841                     break;
    842 
    843                 case MSG_WARNING:
    844                     echo '<div data-alert data-closable class="sc-msg-warning alert-box callout warning">' . $m['message'] . '<a class="close close-button" aria-label="Dismiss alert" data-close><span aria-hidden="true">&times;</span></a></div>';
    845                     break;
    846 
    847                 case MSG_SUCCESS:
    848                     echo '<div data-alert data-closable class="sc-msg-success alert-box callout success">' . $m['message'] . '<a class="close close-button" aria-label="Dismiss alert" data-close><span aria-hidden="true">&times;</span></a></div>';
    849                     break;
    850 
    851                 case MSG_NOTICE:
    852                 default:
    853                     echo '<div data-alert data-closable class="sc-msg-notice alert-box callout primary info">' . $m['message'] . '<a class="close close-button" aria-label="Dismiss alert" data-close><span aria-hidden="true">&times;</span></a></div>';
    854                     break;
    855                 }
    856             }
    857             if ('' != $below) {
    858                 ?><div class="sc-below"><?php echo oTxt($below); ?></div><?php
    859             }
    860             ?></div><?php
    861             if ($print_gotohash_js) {
    862                 ?>
    863                 <script type="text/javascript">
    864                 /* <![CDATA[ */
    865                 window.location.hash = '#<?php echo urlencode($hash); ?>';
    866                 /* ]]> */
    867                 </script>
    868                 <?php
    869             }
    870         }
     829        if (empty($messages)) {
     830            return false;
     831        }
     832
     833        ?><div id="sc-msg" class="sc-msg"><?php
     834        if ('' != $above) {
     835            ?><div class="sc-above"><?php echo oTxt($above); ?></div><?php
     836        }
     837        foreach ($messages as $m) {
     838            if (error_reporting() > 0 && $this->getParam('display_errors') && isset($m['file']) && isset($m['line'])) {
     839                echo "\n<!-- [" . $m['file'] . ' : ' . $m['line'] . '] -->';
     840            }
     841            switch ($m['type']) {
     842            case MSG_ERR:
     843                echo '<div data-alert data-closable class="sc-msg-error alert-box callout alert">' . $m['message'] . '<a class="close close-button" aria-label="Dismiss alert" data-close><span aria-hidden="true">&times;</span></a></div>';
     844                break;
     845
     846            case MSG_WARNING:
     847                echo '<div data-alert data-closable class="sc-msg-warning alert-box callout warning">' . $m['message'] . '<a class="close close-button" aria-label="Dismiss alert" data-close><span aria-hidden="true">&times;</span></a></div>';
     848                break;
     849
     850            case MSG_SUCCESS:
     851                echo '<div data-alert data-closable class="sc-msg-success alert-box callout success">' . $m['message'] . '<a class="close close-button" aria-label="Dismiss alert" data-close><span aria-hidden="true">&times;</span></a></div>';
     852                break;
     853
     854            case MSG_NOTICE:
     855            default:
     856                echo '<div data-alert data-closable class="sc-msg-notice alert-box callout primary info">' . $m['message'] . '<a class="close close-button" aria-label="Dismiss alert" data-close><span aria-hidden="true">&times;</span></a></div>';
     857                break;
     858            }
     859        }
     860        if ('' != $below) {
     861            ?><div class="sc-below"><?php echo oTxt($below); ?></div><?php
     862        }
     863        ?></div><?php
     864        if ($print_gotohash_js) {
     865            ?>
     866            <script type="text/javascript">
     867            /* <![CDATA[ */
     868            window.location.hash = '#<?php echo urlencode($hash); ?>';
     869            /* ]]> */
     870            </script>
     871            <?php
     872        }
     873
    871874        $this->clearRaisedMessages();
     875        return true;
    872876    }
    873877
Note: See TracChangeset for help on using the changeset viewer.