mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
expiration date can be selected from list and entered by calendar
This commit is contained in:
parent
cb6dbd0c8d
commit
727f93eafa
|
@ -116,14 +116,31 @@ if (!is_numeric($sequence)) {
|
|||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("invalid_sequence"));
|
||||
}
|
||||
|
||||
$expires = false;
|
||||
if (!isset($_POST['expires']) || $_POST["expires"] != "false") {
|
||||
if($_POST["expdate"]) {
|
||||
$tmp = explode('-', $_POST["expdate"]);
|
||||
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]);
|
||||
} else {
|
||||
$expires = mktime(0,0,0, $_POST["expmonth"], $_POST["expday"], $_POST["expyear"]);
|
||||
}
|
||||
switch($_POST["presetexpdate"]) {
|
||||
case "date":
|
||||
$tmp = explode('-', $_POST["expdate"]);
|
||||
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]);
|
||||
break;
|
||||
case "1w":
|
||||
$tmp = explode('-', date('Y-m-d'));
|
||||
$expires = mktime(0,0,0, $tmp[1], $tmp[2]+7, $tmp[0]);
|
||||
break;
|
||||
case "1m":
|
||||
$tmp = explode('-', date('Y-m-d'));
|
||||
$expires = mktime(0,0,0, $tmp[1]+1, $tmp[2], $tmp[0]);
|
||||
break;
|
||||
case "1y":
|
||||
$tmp = explode('-', date('Y-m-d'));
|
||||
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]+1);
|
||||
break;
|
||||
case "2y":
|
||||
$tmp = explode('-', date('Y-m-d'));
|
||||
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]+2);
|
||||
break;
|
||||
case "never":
|
||||
default:
|
||||
$expires = null;
|
||||
break;
|
||||
}
|
||||
|
||||
// Get the list of reviewers and approvers for this document.
|
||||
|
|
|
@ -43,14 +43,35 @@ if ($document->getAccessMode($user) < M_READWRITE) {
|
|||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
$expires = false;
|
||||
if (!isset($_POST["expires"]) || $_POST["expires"] != "false") {
|
||||
if(isset($_POST["expdate"]) && $_POST["expdate"]) {
|
||||
$tmp = explode('-', $_POST["expdate"]);
|
||||
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]);
|
||||
} else {
|
||||
$expires = mktime(0,0,0, $_POST["expmonth"], $_POST["expday"], $_POST["expyear"]);
|
||||
}
|
||||
if (!isset($_POST["presetexpdate"]) || $_POST["presetexpdate"] == "") {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_expiration_date"));
|
||||
}
|
||||
|
||||
switch($_POST["presetexpdate"]) {
|
||||
case "date":
|
||||
$tmp = explode('-', $_POST["expdate"]);
|
||||
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]);
|
||||
break;
|
||||
case "1w":
|
||||
$tmp = explode('-', date('Y-m-d'));
|
||||
$expires = mktime(0,0,0, $tmp[1], $tmp[2]+7, $tmp[0]);
|
||||
break;
|
||||
case "1m":
|
||||
$tmp = explode('-', date('Y-m-d'));
|
||||
$expires = mktime(0,0,0, $tmp[1]+1, $tmp[2], $tmp[0]);
|
||||
break;
|
||||
case "1y":
|
||||
$tmp = explode('-', date('Y-m-d'));
|
||||
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]+1);
|
||||
break;
|
||||
case "2y":
|
||||
$tmp = explode('-', date('Y-m-d'));
|
||||
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]+2);
|
||||
break;
|
||||
case "never":
|
||||
default:
|
||||
$expires = null;
|
||||
break;
|
||||
}
|
||||
|
||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['setExpires'])) {
|
||||
|
|
|
@ -373,14 +373,31 @@ if ($_FILES['userfile']['error'] == 0) {
|
|||
}
|
||||
}
|
||||
|
||||
$expires = false;
|
||||
if (!isset($_POST['expires']) || $_POST["expires"] != "false") {
|
||||
if($_POST["expdate"]) {
|
||||
$tmp = explode('-', $_POST["expdate"]);
|
||||
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]);
|
||||
} else {
|
||||
$expires = mktime(0,0,0, $_POST["expmonth"], $_POST["expday"], $_POST["expyear"]);
|
||||
}
|
||||
switch($_POST["presetexpdate"]) {
|
||||
case "date":
|
||||
$tmp = explode('-', $_POST["expdate"]);
|
||||
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]);
|
||||
break;
|
||||
case "1w":
|
||||
$tmp = explode('-', date('Y-m-d'));
|
||||
$expires = mktime(0,0,0, $tmp[1], $tmp[2]+7, $tmp[0]);
|
||||
break;
|
||||
case "1m":
|
||||
$tmp = explode('-', date('Y-m-d'));
|
||||
$expires = mktime(0,0,0, $tmp[1]+1, $tmp[2], $tmp[0]);
|
||||
break;
|
||||
case "1y":
|
||||
$tmp = explode('-', date('Y-m-d'));
|
||||
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]+1);
|
||||
break;
|
||||
case "2y":
|
||||
$tmp = explode('-', date('Y-m-d'));
|
||||
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]+2);
|
||||
break;
|
||||
case "never":
|
||||
default:
|
||||
$expires = null;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($expires) {
|
||||
|
|
|
@ -122,6 +122,12 @@ $(document).ready(function() {
|
|||
}
|
||||
}
|
||||
});
|
||||
$('#presetexpdate').on('change', function(ev){
|
||||
if($(this).val() == 'date')
|
||||
$('#control_expdate').show();
|
||||
else
|
||||
$('#control_expdate').hide();
|
||||
});
|
||||
});
|
||||
<?php
|
||||
$this->printKeywordChooserJs("form1");
|
||||
|
@ -209,6 +215,37 @@ $(document).ready(function() {
|
|||
<td><?php printMLText("sequence");?>:</td>
|
||||
<td><?php $this->printSequenceChooser($folder->getDocuments('s')); if($orderby != 's') echo "<br />".getMLText('order_by_sequence_off'); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
if($presetexpiration) {
|
||||
if(!($expts = strtotime($presetexpiration)))
|
||||
$expts = false;
|
||||
} else {
|
||||
$expts = false;
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td><?php printMLText("preset_expires");?>:</td>
|
||||
<td>
|
||||
<select class="span3" name="presetexpdate" id="presetexpdate">
|
||||
<option value="never"><?php printMLText('does_not_expire');?></option>
|
||||
<option value="date"<?php echo ($expts != '' ? " selected" : ""); ?>><?php printMLText('expire_by_date');?></option>
|
||||
<option value="1w"><?php printMLText('expire_in_1w');?></option>
|
||||
<option value="1m"><?php printMLText('expire_in_1m');?></option>
|
||||
<option value="1y"><?php printMLText('expire_in_1y');?></option>
|
||||
<option value="2y"><?php printMLText('expire_in_2y');?></option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="control_expdate" <?php echo ($expts == false ? 'style="display: none;"' : ''); ?>>
|
||||
<td><?php printMLText("expires");?>:</td>
|
||||
<td>
|
||||
<span class="input-append date span6" id="expirationdate" data-date="<?php echo ($expts ? date('Y-m-d', $expts) : ''); ?>" data-date-format="yyyy-mm-dd" data-date-language="<?php echo str_replace('_', '-', $this->params['session']->getLanguage()); ?>" data-checkbox="#expires">
|
||||
<input class="span3" size="16" name="expdate" type="text" value="<?php echo ($expts ? date('Y-m-d', $expts) : ''); ?>">
|
||||
<span class="add-on"><i class="icon-calendar"></i></span>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php if($user->isAdmin()) { ?>
|
||||
<tr>
|
||||
<td><?php printMLText("owner");?>:</td>
|
||||
|
@ -247,26 +284,16 @@ $(document).ready(function() {
|
|||
}
|
||||
}
|
||||
}
|
||||
if($presetexpiration) {
|
||||
if(!($expts = strtotime($presetexpiration)))
|
||||
$expts = time();
|
||||
} else {
|
||||
$expts = time();
|
||||
$arrs = $this->callHook('addDocumentAttributes', $folder);
|
||||
if(is_array($arrs)) {
|
||||
foreach($arrs as $arr) {
|
||||
echo "<tr>";
|
||||
echo "<td>".$arr[0].":</td>";
|
||||
echo "<td>".$arr[1]."</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td><?php printMLText("expires");?>:</td>
|
||||
<td>
|
||||
<span class="input-append date span12" id="expirationdate" data-date="<?php echo date('Y-m-d', $expts); ?>" data-date-format="yyyy-mm-dd" data-date-language="<?php echo str_replace('_', '-', $this->params['session']->getLanguage()); ?>" data-checkbox="#expires">
|
||||
<input class="span3" size="16" name="expdate" type="text" value="<?php echo date('Y-m-d', $expts); ?>">
|
||||
<span class="add-on"><i class="icon-calendar"></i></span>
|
||||
</span>
|
||||
<label class="checkbox inline">
|
||||
<input type="checkbox" id="expires" name="expires" value="false" <?php echo ($presetexpiration ? "" : "checked");?>><?php printMLText("does_not_expire");?>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<?php $this->contentSubHeading(getMLText("version_info")); ?>
|
||||
|
|
|
@ -31,6 +31,20 @@ require_once("class.Bootstrap.php");
|
|||
*/
|
||||
class SeedDMS_View_SetExpires extends SeedDMS_Bootstrap_Style {
|
||||
|
||||
function js() { /* {{{ */
|
||||
header('Content-Type: application/javascript');
|
||||
?>
|
||||
$(document).ready( function() {
|
||||
$('#presetexpdate').on('change', function(ev){
|
||||
if($(this).val() == 'date')
|
||||
$('#control_expdate').show();
|
||||
else
|
||||
$('#control_expdate').hide();
|
||||
});
|
||||
});
|
||||
<?php
|
||||
} /* }}} */
|
||||
|
||||
function show() { /* {{{ */
|
||||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
|
@ -53,15 +67,25 @@ class SeedDMS_View_SetExpires extends SeedDMS_Bootstrap_Style {
|
|||
<form class="form-horizontal" action="../op/op.SetExpires.php" method="post">
|
||||
<input type="hidden" name="documentid" value="<?php print $document->getID();?>">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="login"><?php printMLText("preset_expires");?>:</label>
|
||||
<div class="controls">
|
||||
<select name="presetexpdate" id="presetexpdate">
|
||||
<option value="never"><?php printMLText('does_not_expire');?></option>
|
||||
<option value="date"<?php echo ($expdate != '' ? " selected" : ""); ?>><?php printMLText('expire_by_date');?></option>
|
||||
<option value="1w"><?php printMLText('expire_in_1w');?></option>
|
||||
<option value="1m"><?php printMLText('expire_in_1m');?></option>
|
||||
<option value="1y"><?php printMLText('expire_in_1y');?></option>
|
||||
<option value="2y"><?php printMLText('expire_in_2y');?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group" id="control_expdate">
|
||||
<label class="control-label"><?php printMLText("expires");?>:</label>
|
||||
<div class="controls">
|
||||
<span class="input-append date span12" id="expirationdate" data-date="<?php echo $expdate; ?>" data-date-format="yyyy-mm-dd" data-date-language="<?php echo str_replace('_', '-', $this->params['session']->getLanguage()); ?>">
|
||||
<input class="span6" name="expdate" type="text" value="<?php echo $expdate; ?>">
|
||||
<input class="span3" name="expdate" type="text" value="<?php echo $expdate; ?>">
|
||||
<span class="add-on"><i class="icon-calendar"></i></span>
|
||||
</span><br />
|
||||
<label class="checkbox inline">
|
||||
<input type="checkbox" name="expires" value="false"<?php if (!$document->expires()) print " checked";?>><?php printMLText("does_not_expire");?><br>
|
||||
</label>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="controls">
|
||||
|
|
|
@ -119,6 +119,12 @@ console.log(element);
|
|||
}
|
||||
}
|
||||
});
|
||||
$('#presetexpdate').on('change', function(ev){
|
||||
if($(this).val() == 'date')
|
||||
$('#control_expdate').show();
|
||||
else
|
||||
$('#control_expdate').hide();
|
||||
});
|
||||
});
|
||||
<?php
|
||||
} /* }}} */
|
||||
|
@ -233,21 +239,31 @@ console.log(element);
|
|||
<?php
|
||||
if($presetexpiration) {
|
||||
if(!($expts = strtotime($presetexpiration)))
|
||||
$expts = time();
|
||||
$expts = false;
|
||||
} else {
|
||||
$expts = time();
|
||||
$expts = false;
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td><?php printMLText("preset_expires");?>:</td>
|
||||
<td>
|
||||
<select class="span6" name="presetexpdate" id="presetexpdate">
|
||||
<option value="never"><?php printMLText('does_not_expire');?></option>
|
||||
<option value="date"<?php echo ($expts != '' ? " selected" : ""); ?>><?php printMLText('expire_by_date');?></option>
|
||||
<option value="1w"><?php printMLText('expire_in_1w');?></option>
|
||||
<option value="1m"><?php printMLText('expire_in_1m');?></option>
|
||||
<option value="1y"><?php printMLText('expire_in_1y');?></option>
|
||||
<option value="2y"><?php printMLText('expire_in_2y');?></option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="control_expdate" <?php echo ($expts == false ? 'style="display: none;"' : ''); ?>>
|
||||
<td><?php printMLText("expires");?>:</td>
|
||||
<td class="standardText">
|
||||
<span class="input-append date span12" id="expirationdate" data-date="<?php echo date('Y-m-d', $expts); ?>" data-date-format="yyyy-mm-dd" data-date-language="<?php echo str_replace('_', '-', $this->params['session']->getLanguage()); ?>">
|
||||
<input class="span3" size="16" name="expdate" type="text" value="<?php echo date('Y-m-d', $expts); ?>">
|
||||
<span class="input-append date span12" id="expirationdate" data-date="<?php echo ($expts ? date('Y-m-d', $expts) : ''); ?>" data-date-format="yyyy-mm-dd" data-date-language="<?php echo str_replace('_', '-', $this->params['session']->getLanguage()); ?>">
|
||||
<input class="span6" size="16" name="expdate" type="text" value="<?php echo ($expts ? date('Y-m-d', $expts) : ''); ?>">
|
||||
<span class="add-on"><i class="icon-calendar"></i></span>
|
||||
</span><br />
|
||||
<label class="checkbox inline">
|
||||
<input type="checkbox" name="expires" value="false"<?php if (!$document->expires()) print " checked";?>><?php printMLText("does_not_expire");?><br>
|
||||
</label>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
|
Loading…
Reference in New Issue
Block a user