Skip to content
Browse files

Merge pull request #7 from colinmollenhour/master

Admin cleanup
  • Loading branch information...
2 parents b83f3be + 3c27ab4 commit a796c1f65297280d7573e0bf1626da9bd2d8031c @datenbrille datenbrille committed
View
1 app/code/community/Hackathon/Logger/Block/Adminhtml/Logger.php
@@ -14,5 +14,6 @@ public function __construct()
$this->_controller = 'adminhtml_logger';
$this->_blockGroup = 'hackathon_logger';
$this->_headerText = Mage::helper('hackathon_logger')->__('Database entries');
+ $this->removeButton('add');
}
}
View
11 app/code/community/Hackathon/Logger/controllers/Adminhtml/LoggerController.php
@@ -4,14 +4,13 @@ class Hackathon_Logger_Adminhtml_LoggerController extends Mage_Adminhtml_Control
public function indexAction()
{
- Mage::log("Hello", Zend_Log::CRIT);
- Mage::log("Hello2", Zend_Log::CRIT);
-
$this->loadLayout();
- $this->renderLayout();
+ $this->_setActiveMenu('system/logger');
+ $this->renderLayout();
}
- public function testAction(){
- exit();
+ protected function _isAllowed()
+ {
+ return Mage::getStoreConfigFlag('logger/db/viewer_enabled') && Mage::getSingleton('admin/session')->isAllowed('system/logger');
}
}
View
26 app/code/community/Hackathon/Logger/etc/adminhtml.xml
@@ -1,18 +1,34 @@
<?xml version="1.0"?>
<config>
+ <menu>
+ <system>
+ <children>
+ <logger translate="title" module="hackathon_logger">
+ <title>View Error Log</title>
+ <sort_order>60</sort_order>
+ <action>adminhtml/logger/index</action>
+ <depends>
+ <config>logger/db/viewer_enabled</config>
+ </depends>
+ </logger>
+ </children>
+ </system>
+ </menu>
<acl>
<resources>
- <all>
- <title>Allow Everything</title>
- </all>
<admin>
<children>
<system>
<children>
+ <logger translate="title" module="hackathon_logger">
+ <title>View Error Log</title>
+ <sort_order>60</sort_order>
+ </logger>
<config>
<children>
- <logger>
- <title>Advanced Logger</title>
+ <logger translate="title" module="hackathon_logger">
+ <title>Advanced Logger Section</title>
+ <sort_order>60</sort_order>
</logger>
</children>
</config>
View
30 app/code/community/Hackathon/Logger/etc/config.xml
@@ -17,35 +17,6 @@
</routers>
</admin>
<adminhtml>
- <menu>
- <logger translate="title" module="hackathon_logger">
- <title>View Error Log</title>
- <sort_order>60</sort_order>
- <children>
- <viewer module="hackathon_logger">
- <title>View database log</title>
- <action>adminhtml/logger/index</action>
- </viewer>
- </children>
- </logger>
- </menu>
- <acl>
- <resources>
- <admin>
- <children>
- <menu1 translate="title" module="hackathon_logger">
- <title>View Error Log</title>
- <sort_order>60</sort_order>
- <children>
- <menuitem1>
- <title>Logs</title>
- </menuitem1>
- </children>
- </menu1>
- </children>
- </admin>
- </resources>
- </acl>
<layout>
<updates>
<hackathon_logger>
@@ -119,6 +90,7 @@
</mailconfig>
<db>
<priority>default</priority>
+ <viewer_enabled>0</viewer_enabled>
</db>
<xmpp>
<priority>default</priority>
View
8 app/code/community/Hackathon/Logger/etc/system.xml
@@ -161,6 +161,14 @@
<show_in_default>1</show_in_default>
<comment>Choose the lowest priority level to be logged.</comment>
</priority>
+ <viewer_enabled translate="label">
+ <label>Enable Log Viewer</label>
+ <frontend_type>select</frontend_type>
+ <source_model>adminhtml/system_config_source_yesno</source_model>
+ <sort_order>10</sort_order>
+ <show_in_default>1</show_in_default>
+ <comment>If "No", the "View Error Log" menu item will not be present.</comment>
+ </viewer_enabled>
</fields>
</db>
<xmpp translate="label">

0 comments on commit a796c1f

Please sign in to comment.
Something went wrong with that request. Please try again.