33
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2024-12-24 11:25:26 +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 {
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';
$police = new jedcheckerRulesHtmlindexes;
$folders = JFolder::folders($path);
$class = 'jedcheckerRules'.ucfirst($rule);
$police = new $class;
$folders = JFolder::folders($path);
$police->check($path.'/'.$folders[0]);
}

View File

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

View File

@ -12,8 +12,20 @@ defined('_JEXEC') or die('Restricted access');
JHTML::_('behavior.mootools', true);
JHtml::_('behavior.formvalidation');
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'); ?>"
method="post" class="form form-validate" name="adminForm" id="adminForm" enctype="multipart/form-data">
@ -23,4 +35,6 @@ JHtml::_('behavior.keepalive');
</button>
<input type="hidden" name="task" value="" />
<?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');
class jedcheckerViewUploads extends JView {
class jedcheckerViewUploads extends JView
{
public function display($tpl = null) {
public function display($tpl = null)
{
$this->setToolbar();
$this->jsOptions['url'] = JURI::base();
$this->jsOptions['rules'] = $this->getRules();
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('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

@ -4,4 +4,31 @@
*
* @copyright Copyright (C) 2008 - 2012 compojoom.com . All rights reserved.
* @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();
}
});