33
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2025-01-12 17:51:11 +00:00

the check is now an ajax request. (one need just to add rules in the libraries/rules and they

will be automatically called by the component - no further actions necessary)
layout improvements
This commit is contained in:
Daniel Dimitrov 2012-06-09 15:34:32 +02:00
parent c9608e6fea
commit 7dc7fd3ab0
8 changed files with 78 additions and 9 deletions

View File

@ -16,11 +16,14 @@ jimport('joomla.filesystem.archive');
class jedcheckerControllerPolice extends JController { class jedcheckerControllerPolice extends JController {
public function check() { public function check() {
require_once JPATH_COMPONENT_ADMINISTRATOR . '/libraries/rules/htmlindexes.php'; $rule = JRequest::getString('rule');
JLoader::discover('jedcheckerRules',JPATH_COMPONENT_ADMINISTRATOR . '/libraries/rules/');
// require_once JPATH_COMPONENT_ADMINISTRATOR . '/libraries/rules/'.$rule.'.php';
$path = JFactory::getConfig()->get('tmp_path') . '/jed_checker/unzipped'; $path = JFactory::getConfig()->get('tmp_path') . '/jed_checker/unzipped';
$police = new jedcheckerRulesHtmlindexes; $class = 'jedcheckerRules'.ucfirst($rule);
$folders = JFolder::folders($path); $police = new $class;
$folders = JFolder::folders($path);
$police->check($path.'/'.$folders[0]); $police->check($path.'/'.$folders[0]);
} }

View File

@ -10,6 +10,10 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.controller'); jimport('joomla.application.component.controller');
$view = JRequest::getCmd('view','');
if($view == '' && JRequest::getCmd('task') == '') {
JRequest::setVar('view', 'uploads');
}
$controller = JController::getInstance('jedchecker'); $controller = JController::getInstance('jedchecker');
$controller->execute(JRequest::getCmd('task')); $controller->execute(JRequest::getCmd('task'));
$controller->redirect(); $controller->redirect();

View File

@ -12,8 +12,20 @@ defined('_JEXEC') or die('Restricted access');
JHTML::_('behavior.mootools', true); JHTML::_('behavior.mootools', true);
JHtml::_('behavior.formvalidation'); JHtml::_('behavior.formvalidation');
JHtml::_('behavior.keepalive'); JHtml::_('behavior.keepalive');
JHtml::stylesheet('media/com_jedchecker/css/css.css');
JHtml::script('media/com_jedchecker/js/police.js');
?> ?>
<script type="text/javascript">
Joomla.submitbutton = function(task) {
var options = <?php echo json_encode($this->jsOptions); ?>;
if (task == 'police.check') {
new police(options);
return false;
}
Joomla.submitform(task);
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_jedchecker&view=uploads'); ?>" <form action="<?php echo JRoute::_('index.php?option=com_jedchecker&view=uploads'); ?>"
method="post" class="form form-validate" name="adminForm" id="adminForm" enctype="multipart/form-data"> method="post" class="form form-validate" name="adminForm" id="adminForm" enctype="multipart/form-data">
@ -24,3 +36,5 @@ JHtml::_('behavior.keepalive');
<input type="hidden" name="task" value="" /> <input type="hidden" name="task" value="" />
<?php echo JHTML::_('form.token'); ?> <?php echo JHTML::_('form.token'); ?>
</form> </form>
<div id="police-check-result"></div>

View File

@ -11,14 +11,29 @@ defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.view'); jimport('joomla.application.component.view');
class jedcheckerViewUploads extends JView { class jedcheckerViewUploads extends JView
{
public function display($tpl = null) { public function display($tpl = null)
{
$this->setToolbar(); $this->setToolbar();
$this->jsOptions['url'] = JURI::base();
$this->jsOptions['rules'] = $this->getRules();
parent::display($tpl); parent::display($tpl);
} }
public function setToolbar() { public function getRules()
{
$exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX', 'index.html');
$files = JFolder::files(JPATH_COMPONENT_ADMINISTRATOR . '/libraries/rules', '.', false, false, $exclude);
foreach ($files as $file) {
$rules[] = str_replace('.php', '', $file);
}
return $rules;
}
public function setToolbar()
{
JToolBarHelper::custom('uploads.unzip', 'unzip', 'unzip', 'unzip', false); JToolBarHelper::custom('uploads.unzip', 'unzip', 'unzip', 'unzip', false);
JToolBarHelper::custom('police.check', 'police-check', 'police-check', 'check', false); JToolBarHelper::custom('police.check', 'police-check', 'police-check', 'check', false);
} }

View File

@ -0,0 +1,6 @@
.icon-32-unzip {
background-image: url(../icons/unzip.png);
}
.icon-32-police-check {
background-image: url(../icons/inspect.png);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -5,3 +5,30 @@
* @copyright Copyright (C) 2008 - 2012 compojoom.com . All rights reserved. * @copyright Copyright (C) 2008 - 2012 compojoom.com . All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE * @license GNU General Public License version 2 or later; see LICENSE
*/ */
var police = new Class({
Implements:[Options],
options:{},
initialize:function (options) {
var self = this;
this.setOptions(options);
this.options.rules.each(function(rule){
self.check(rule);
});
},
check: function(rule) {
var self = this;
new Request({
url: self.options.url + '/index.php?option=com_jedchecker&task=police.check&format=raw&rule='+rule,
async: false,
onComplete: function(result) {
var div = new Element('div', {
html: result
});
div.inject(document.id('police-check-result'));
}
}).send();
}
});