00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 class Mage_Adminhtml_Block_Notification_Window extends Mage_Adminhtml_Block_Notification_Toolbar
00028 {
00029
00030
00031
00032
00033
00034 protected $_available;
00035
00036
00037
00038
00039
00040 protected function _construct()
00041 {
00042 parent::_construct();
00043
00044 $this->setHeaderText(addslashes($this->__('Incoming Message')));
00045 $this->setCloseText(addslashes($this->__('close')));
00046 $this->setReadDetailsText(addslashes($this->__('Read details')));
00047 $this->setNoticeText(addslashes($this->__('NOTICE')));
00048 $this->setMinorText(addslashes($this->__('MINOR')));
00049 $this->setMajorText(addslashes($this->__('MAJOR')));
00050 $this->setCriticalText(addslashes($this->__('CRITICAL')));
00051
00052
00053 $this->setNoticeMessageText(addslashes($this->getLastNotice()->getTitle()));
00054 $this->setNoticeMessageUrl(addslashes($this->getLastNotice()->getUrl()));
00055
00056 switch ($this->getLastNotice()->getSeverity()) {
00057 default:
00058 case Mage_AdminNotification_Model_Inbox::SEVERITY_NOTICE:
00059 $severity = 'SEVERITY_NOTICE';
00060 break;
00061 case Mage_AdminNotification_Model_Inbox::SEVERITY_MINOR:
00062 $severity = 'SEVERITY_MINOR';
00063 break;
00064 case Mage_AdminNotification_Model_Inbox::SEVERITY_MAJOR:
00065 $severity = 'SEVERITY_MAJOR';
00066 break;
00067 case Mage_AdminNotification_Model_Inbox::SEVERITY_CRITICAL:
00068 $severity = 'SEVERITY_CRITICAL';
00069 break;
00070 }
00071
00072 $this->setNoticeSeverity($severity);
00073 }
00074
00075
00076
00077
00078
00079
00080 public function canShow()
00081 {
00082 if (!$this->isOutputEnabled('Mage_AdminNotification')) {
00083 $this->_available = false;
00084 return false;
00085 }
00086
00087 if (!$this->_getHelper()->isReadablePopupObject()) {
00088 $this->_available = false;
00089 return false;
00090 }
00091
00092 if (!$this->_isAllowed()) {
00093 $this->_available = false;
00094 return false;
00095 }
00096
00097 if (is_null($this->_available)) {
00098 if (!Mage::getSingleton('admin/session')->isFirstPageAfterLogin()) {
00099 $this->_available = false;
00100 return false;
00101 }
00102 $this->_available = $this->isShow();
00103 }
00104 return $this->_available;
00105 }
00106
00107
00108
00109
00110
00111
00112
00113 public function getObjectUrl()
00114 {
00115 return $this->_getHelper()->getPopupObjectUrl();
00116 }
00117
00118
00119
00120
00121
00122
00123 public function getLastNotice()
00124 {
00125 return $this->_getHelper()->getLatestNotice();
00126 }
00127
00128
00129
00130
00131
00132
00133
00134 protected function _isAllowed()
00135 {
00136 if (!is_null($this->_aclResourcePath)) {
00137 return Mage::getSingleton('admin/session')
00138 ->isAllowed('admin/system/adminnotification/show_toolbar');
00139 }
00140 else {
00141 return true;
00142 }
00143 }
00144 }