[vhffs-dev] [2174] harcoded a bit the cron path, so that users know more what the cron path should be

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 2174
Author:   gradator
Date:     2012-05-05 00:26:31 +0200 (Sat, 05 May 2012)
Log Message:
-----------
harcoded a bit the cron path, so that users know more what the cron path should be

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Panel/Cron.pm
    trunk/vhffs-panel/templates/cron/create.tt

Modified: trunk/vhffs-api/src/Vhffs/Panel/Cron.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Cron.pm	2012-05-04 20:15:40 UTC (rev 2173)
+++ trunk/vhffs-api/src/Vhffs/Panel/Cron.pm	2012-05-04 22:26:31 UTC (rev 2174)
@@ -122,6 +122,7 @@
 	my $vars = {};
 
 	if( $submitted ) {
+		my $fullcronpath;
 		$cronpath = $cgi->param('cronpath');
 		$interval = $cgi->param('interval');
 		$reportmail = $cgi->param('reportmail');
@@ -131,14 +132,15 @@
 			$panel->add_error( gettext('CGI Error !') );
 			return;
 		} else {
+			$fullcronpath = '/home/'.$group->get_groupname.'/'.$cronpath;
 			$panel->add_error( gettext('You must enter a description') ) unless $description !~ /^\s*$/;
-			$panel->add_error( gettext('Invalid cronpath, it must contain only letters, numbers, underscore, dash, dot or slash. A valid cronpath will be something like /home/group/script.sh)') ) unless Vhffs::Services::Cron::check_cronpath($cronpath);
+			$panel->add_error( gettext('Invalid cronpath, it must contain only letters, numbers, underscore, dash, dot or slash. A valid cronpath will be something like /home/group/script.sh)') ) unless Vhffs::Services::Cron::check_cronpath($fullcronpath);
 			$panel->add_error( gettext('Invalid interval, it must be a positive integer') ) unless $interval =~ /^\d+$/ and $interval > 0;
 			$panel->add_error( gettext('The email you entered fails syntax check') ) unless( ($reportmail eq '') or Vhffs::Functions::valid_mail( $reportmail ) );
 		}
 
 		unless( $panel->has_errors() ) {
-			my $mail = Vhffs::Panel::Cron::create_cron($vhffs, $cronpath, $interval*60, $reportmail , $description, $user, $group);
+			my $mail = Vhffs::Panel::Cron::create_cron($vhffs, $fullcronpath, $interval*60, $reportmail , $description, $user, $group);
 			if( defined $mail ) {
 				my $url = '?do=groupview;group='.$group->get_groupname.';msg='.gettext('The Cron job was successfully created !');
 				$panel->redirect($url);

Modified: trunk/vhffs-panel/templates/cron/create.tt
===================================================================
--- trunk/vhffs-panel/templates/cron/create.tt	2012-05-04 20:15:40 UTC (rev 2173)
+++ trunk/vhffs-panel/templates/cron/create.tt	2012-05-04 22:26:31 UTC (rev 2174)
@@ -5,7 +5,7 @@
 	</p>
 	<p>
 		<label for="cron_path">[% 'Path:' | i18n | html %]</label>
-		<input type="text" name="cronpath" id="cronpath" value="[% cronpath | html %]"/>
+		/home/[% group.get_groupname | html %]/<input type="text" name="cronpath" id="cronpath" value="[% cronpath | html %]"/>
 		[% 'Absolute path of the command to run' | i18n | html %]
 	</p>
 	<p>


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/