Bugfixes cron

This commit is contained in:
Alan Garcia 2012-08-22 07:21:35 +00:00
parent 9238f82604
commit 47cc5fd799
2 changed files with 29 additions and 11 deletions

View File

@ -3,12 +3,12 @@ require_once("../class/config.php");
include_once("head.php"); include_once("head.php");
$fields = array ( $fields = array (
"cron" => array ("post", "array", ""), "cronupdate" => array ("post", "array", ""),
); );
getFields($fields); getFields($fields);
if (!empty($cron) { if (!empty($cronupdate)) {
if (! $cron->update($cron) { if (! $cron->update($cronupdate)) {
$error=_("There was an error during the record."); $error=_("There was an error during the record.");
} else { } else {
$error=_("Save done."); $error=_("Save done.");
@ -31,6 +31,7 @@ $lst_cron = $cron->lst_cron();
<table> <table>
<tr> <tr>
<th/>
<th><?php __("URL"); ?></th> <th><?php __("URL"); ?></th>
<th><?php __("Schedule"); ?></th> <th><?php __("Schedule"); ?></th>
<th><?php __("User"); ?></th> <th><?php __("User"); ?></th>
@ -45,10 +46,15 @@ if ( sizeof($lst_cron) > $max_cron ) $max_cron=sizeof($lst_cron);
for ($i=0; $i < $max_cron ; $i++) { for ($i=0; $i < $max_cron ; $i++) {
?> ?>
<tr> <tr>
<?php if (isset($lst_cron[$i])) echo "<input type='hidden' name='cron[$i][id]' value='".$lst_cron[$i]['id']."' />"; ?> <?php if (isset($lst_cron[$i])) echo "<input type='hidden' name='cronupdate[$i][id]' value='".$lst_cron[$i]['id']."' />"; ?>
<td><input type="text" name="<?php echo "cron[$i][url]";?>" size="30" maxlength="255" value="<?php if (isset($lst_cron[$i]['url'])) { echo htmlentities($lst_cron[$i]['url']);} ?>"/></td>
<td> <td>
<select name='cron[<?php echo $i; ?>][schedule]'> <a href="javascript:cleancron('<?php echo $i ?>');"><img src="images/delete.png" alt="<?php __("Delete");?>" title="<?php __("Delete");?>"/></a>
</td>
<td>
<input type="text" id="crup_url_<?php echo $i?>" name="<?php echo "cronupdate[$i][url]";?>" size="30" maxlength="255" value="<?php if (isset($lst_cron[$i]['url'])) { echo htmlentities($lst_cron[$i]['url']);} ?>"/>
</td>
<td>
<select name='cronupdate[<?php echo $i; ?>][schedule]'>
<?php <?php
foreach ($cron->schedule() as $cs) { foreach ($cron->schedule() as $cs) {
echo "<option value='".$cs['unit']."'"; echo "<option value='".$cs['unit']."'";
@ -61,15 +67,28 @@ foreach ($cron->schedule() as $cs) {
?> ?>
</select> </select>
</td> </td>
<td><input type="text" name="<?php echo "cron[$i][user]";?>" size="10" maxlength="64" value="<?php if (isset($lst_cron[$i]['user'])) { echo htmlentities($lst_cron[$i]['user']);} ?>"/></td> <td><input type="text" id="crup_user_<?php echo $i?>" name="<?php echo "cronupdate[$i][user]";?>" size="10" maxlength="64" value="<?php if (isset($lst_cron[$i]['user'])) { echo htmlentities($lst_cron[$i]['user']);} ?>"/></td>
<td><input type="text" name="<?php echo "cron[$i][password]";?>" size="10" maxlength="64" value="<?php if (isset($lst_cron[$i]['password'])) { echo htmlentities($lst_cron[$i]['password']);} ?>"/></td> <td><input type="text" id="crup_pass_<?php echo $i?>" name="<?php echo "cronupdate[$i][password]";?>" size="10" maxlength="64" value="<?php if (isset($lst_cron[$i]['password'])) { echo htmlentities($lst_cron[$i]['password']);} ?>"/></td>
<td><input type="text" name="<?php echo "cron[$i][email]";?>" size="10" maxlength="64" value="<?php if (isset($lst_cron[$i]['email'])) { echo htmlentities($lst_cron[$i]['email']);} ?>"/></td> <td><input type="text" id="crup_mail_<?php echo $i?>" name="<?php echo "cronupdate[$i][email]";?>" size="10" maxlength="64" value="<?php if (isset($lst_cron[$i]['email'])) { echo htmlentities($lst_cron[$i]['email']);} ?>"/></td>
</tr> </tr>
<?php } //foreach ?> <?php } //foreach ?>
<tr>
<td/>
<td>
<input type="submit" name="submit" class="inb" value="<?php __("Save"); ?>" />
</td>
</table> </table>
<input type="submit" name="submit" class="inb" value="<?php __("Save"); ?>" />
</form> </form>
<script type="text/javascript">
function cleancron(i) {
document.getElementById('crup_url_'+i).value = '';
document.getElementById('crup_user_'+i).value = '';
document.getElementById('crup_pass_'+i).value = '';
document.getElementById('crup_mail_'+i).value = '';
}
</script>
<?php include_once("foot.php"); ?> <?php include_once("foot.php"); ?>

View File

@ -174,5 +174,4 @@ for($i=0;$i<count($classes);$i++) {
$$name2= new $name1(); $$name2= new $name1();
} }
?> ?>