Skip to content
Code-Schnipsel Gruppen Projekte
Commit 60c7ee11 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

window cron, parameter angefangen

Übergeordneter e5fea6ec
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
Keine zugehörigen Merge Requests gefunden
<?php
/**
* activate a cron
* @param Integer $cronId - Cron-ID
*/
function package_quiqqer_cron_ajax_cron_get($cronId)
{
$Manager = new \QUI\Cron\Manager();
return $Manager->getCronById( $cronId );
}
\QUI::$Ajax->register(
'package_quiqqer_cron_ajax_cron_get',
array( 'cronId' ),
'Permission::checkAdminUser'
);
<?php
/**
* Add a cron to the cron list
*
* @param {String} $cron
* @param {String} $min
* @param {String} $hour
* @param {String} $day
* @param {String} $month
*/
function package_quiqqer_cron_ajax_edit($cronId, $cron, $min, $hour, $day, $month)
{
$Manager = new \QUI\Cron\Manager();
$Manager->edit( $cronId, $cron, $min, $hour, $day, $month );
}
\QUI::$Ajax->register(
'package_quiqqer_cron_ajax_add',
array( 'cronId', 'cron', 'min', 'hour', 'day', 'month' ),
'Permission::checkAdminUser'
);
......@@ -51,4 +51,8 @@
clear: both;
margin: 0 0 0 2px;
width: 50px;
}
\ No newline at end of file
}
#control-cron-add-params {
margin: 0;
}
/**
* This file contains package/quiqqer/cron/bin/CronWindow
*
* @author www.namerobot.com (Henning Leutz)
*/
define('package/quiqqer/cron/bin/AddCronWindow', [
define('package/quiqqer/cron/bin/CronWindow', [
'qui/controls/windows/Confirm',
'qui/controls/input/Params',
'Ajax',
'css!package/quiqqer/cron/bin/AddCronWindow'
'css!package/quiqqer/cron/bin/CronWindow'
], function(QUIConfirm, Ajax)
], function(QUIConfirm, QUIParams, Ajax)
{
"use strict";
return new Class({
Type : 'package/quiqqer/cron/bin/AddCronWindow',
Type : 'package/quiqqer/cron/bin/CronWindow',
Extends : QUIConfirm,
options : {
title : 'Cron hinzufügen',
icon : 'icon-time',
maxWidth : 500,
maxHeight : 300
title : 'Cron hinzufügen',
icon : 'icon-time',
maxWidth : 500,
maxHeight : 300,
cronId : null // if you want to edit a cron
},
initialize : function(options)
......@@ -35,6 +42,8 @@ define('package/quiqqer/cron/bin/AddCronWindow', [
this.$Hour = null;
this.$Day = null;
this.$Month = null;
this.$ParamsControl = null;
},
/**
......@@ -87,6 +96,11 @@ define('package/quiqqer/cron/bin/AddCronWindow', [
'</div>' +
'</div>' +
'<label for="control-cron-add-params">' +
'Parameter' +
'</label>' +
'<input type="text" name="params" id="control-cron-add-params" />' +
'</div>'
);
......@@ -97,6 +111,8 @@ define('package/quiqqer/cron/bin/AddCronWindow', [
this.$Day = Content.getElement( '[name="day"]' );
this.$Month = Content.getElement( '[name="month"]' );
this.$Params = Content.getElement( '[name="params"]' );
Ajax.get('package_quiqqer_cron_ajax_getAvailableCrons', function(result)
{
......@@ -108,11 +124,38 @@ define('package/quiqqer/cron/bin/AddCronWindow', [
{
new Element('option', {
value : result[ i ].title,
html : result[ i ].description
html : result[ i ].title +' - '+ result[ i ].description
}).inject( self.$List );
}
self.Loader.hide();
if ( !self.getAttribute( 'cronId' ) )
{
self.Loader.hide();
return;
}
Ajax.get('package_quiqqer_cron_ajax_cron_get', function(result)
{
var size = self.getElm().getSize();
self.$List.value = result.title;
self.$Min.value = result.min;
self.$Hour.value = result.hour;
self.$Day.value = result.day;
self.$Month.value = result.month;
self.$Params.value = result.params;
self.$ParamsControl = new QUIParams( self.$Params, {
windowMaxHeight : size.y,
windowMaxWidth : size.x
} );
self.Loader.hide();
}, {
'package' : 'quiqqer/cron',
cronId : self.getAttribute( 'cronId' )
});
}, {
'package' : 'quiqqer/cron'
......@@ -139,18 +182,41 @@ define('package/quiqqer/cron/bin/AddCronWindow', [
return this;
}
if ( this.getAttribute( 'cronId' ) )
{
Ajax.post('package_quiqqer_cron_ajax_edit', function(result)
{
self.fireEvent( 'submit' );
self.close();
}, {
'package' : 'quiqqer/cron',
cronId : this.getAttribute( 'cronId' ),
cron : this.$List.value,
min : this.$Min.value,
hour : this.$Hour.value,
day : this.$Day.value,
month : this.$Month.value,
params : JSON.decode( this.$ParamsControl.getValue() )
});
return this;
}
Ajax.post('package_quiqqer_cron_ajax_add', function(result)
{
self.fireEvent( 'submit' );
self.close();
}, {
'package' : 'quiqqer/cron',
cron : this.$List.value,
min : this.$Min.value,
hour : this.$Hour.value,
day : this.$Day.value,
month : this.$Month.value
cron : this.$List.value,
min : this.$Min.value,
hour : this.$Hour.value,
day : this.$Day.value,
month : this.$Month.value,
params : JSON.decode( this.$ParamsControl.getValue() )
});
return this;
}
});
......
......@@ -128,10 +128,26 @@ define('package/quiqqer/cron/bin/Manager', [
})
);
this.addButton( new QUIButtonSeperator() );
this.addButton(
new QUIButton({
name : 'edit',
text : 'Markierten Cron editieren',
textimage : 'icon-pencil',
events :
{
onClick : function() {
self.editMarkedCron();
}
}
})
);
this.addButton(
new QUIButton({
name : 'delete',
text : 'Markierte Cron löschen',
text : 'Markierte(n) Cron(s) löschen',
textimage : 'icon-trash',
events :
{
......@@ -158,6 +174,7 @@ define('package/quiqqer/cron/bin/Manager', [
})
);
this.getButtons( 'edit' ).disable();
this.getButtons( 'delete' ).disable();
......@@ -240,15 +257,32 @@ define('package/quiqqer/cron/bin/Manager', [
},
onClick : function()
{
var delButton = self.getButtons( 'delete' );
var delButton = self.getButtons( 'delete' ),
editButton = self.getButtons( 'edit' ),
selected = self.$Grid.getSelectedIndices().length;
if ( self.$Grid.getSelectedIndices().length )
if ( selected == 1 )
{
editButton.enable();
} else
{
editButton.disable();
}
if ( selected )
{
delButton.enable();
} else
{
delButton.disable()
}
},
onDblClick : function(data)
{
var rowData = self.$Grid.getDataByRow( data.row );
self.editCron( rowData.id );
}
});
......@@ -321,7 +355,51 @@ define('package/quiqqer/cron/bin/Manager', [
},
/**
* Open the addCronWindow
* Edit a cron, opens the cron Edit-Window
*
* @param {String} cronId - ID of the Cron
*/
editCron : function(cronId)
{
var self = this;
require(['package/quiqqer/cron/bin/CronWindow'], function(Window)
{
new Window({
cronId : cronId,
events :
{
onSubmit : function() {
self.loadCrons();
}
}
}).open();
});
return this;
},
/**
* Opens the Edit-Window for the marked cron
*/
editMarkedCron : function()
{
if ( !this.$Grid ) {
return this;
}
var self = this,
data = this.$Grid.getSelectedData();
if ( !data.length ) {
return this;
}
this.editCron( data[ 0 ].id );
},
/**
* Open the add Cron-Window
*
* @return {self}
*/
......@@ -329,7 +407,7 @@ define('package/quiqqer/cron/bin/Manager', [
{
var self = this;
require(['package/quiqqer/cron/bin/AddCronWindow'], function(Window)
require(['package/quiqqer/cron/bin/CronWindow'], function(Window)
{
new Window({
events :
......
......@@ -4,4 +4,16 @@
<title>Temp Ordner leeren</title>
<description>Ordner für temporäre Daten leeren</description>
</cron>
<cron exec="\QUI\Cron\QuiqqerCrons::clearCache">
<title>Cache leeren</title>
<description>Kompletten Cache leeren</description>
</cron>
<cron exec="\QUI\Cron\QuiqqerCrons::purgeCache">
<title>Cache säubern</title>
<description>
The purge function removes stale data from the cache backends while leaving current data intact
</description>
</cron>
</crons>
\ No newline at end of file
......@@ -55,12 +55,12 @@ class Manager
/**
* Edit the cron
*
* @param unknown $cronId
* @param unknown $min
* @param unknown $hour
* @param unknown $day
* @param unknown $month
* @param unknown $params
* @param Integer $cronId
* @param String $min
* @param String $hour
* @param String $day
* @param String $month
* @param Array $params
*/
public function edit($cronId, $min, $hour, $day, $month, $params=array())
{
......
......@@ -22,4 +22,20 @@ class QuiqqerCrons
$Temp = \QUI::getTemp();
$Temp->clear();
}
/**
* Clear complete cache
*/
static function clearCache()
{
\QUI\Cache\Manager::clearAll();
}
/**
* Purge the cache
*/
static function purgeCache()
{
\QUI\Cache\Manager::purge();
}
}
\ No newline at end of file
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren