mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-13 21:21:27 +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"));
|
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("invalid_sequence"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$expires = false;
|
switch($_POST["presetexpdate"]) {
|
||||||
if (!isset($_POST['expires']) || $_POST["expires"] != "false") {
|
case "date":
|
||||||
if($_POST["expdate"]) {
|
$tmp = explode('-', $_POST["expdate"]);
|
||||||
$tmp = explode('-', $_POST["expdate"]);
|
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]);
|
||||||
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]);
|
break;
|
||||||
} else {
|
case "1w":
|
||||||
$expires = mktime(0,0,0, $_POST["expmonth"], $_POST["expday"], $_POST["expyear"]);
|
$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.
|
// 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"));
|
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$expires = false;
|
if (!isset($_POST["presetexpdate"]) || $_POST["presetexpdate"] == "") {
|
||||||
if (!isset($_POST["expires"]) || $_POST["expires"] != "false") {
|
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_expiration_date"));
|
||||||
if(isset($_POST["expdate"]) && $_POST["expdate"]) {
|
}
|
||||||
$tmp = explode('-', $_POST["expdate"]);
|
|
||||||
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]);
|
switch($_POST["presetexpdate"]) {
|
||||||
} else {
|
case "date":
|
||||||
$expires = mktime(0,0,0, $_POST["expmonth"], $_POST["expday"], $_POST["expyear"]);
|
$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'])) {
|
if(isset($GLOBALS['SEEDDMS_HOOKS']['setExpires'])) {
|
||||||
|
|
|
@ -373,14 +373,31 @@ if ($_FILES['userfile']['error'] == 0) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$expires = false;
|
switch($_POST["presetexpdate"]) {
|
||||||
if (!isset($_POST['expires']) || $_POST["expires"] != "false") {
|
case "date":
|
||||||
if($_POST["expdate"]) {
|
$tmp = explode('-', $_POST["expdate"]);
|
||||||
$tmp = explode('-', $_POST["expdate"]);
|
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]);
|
||||||
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]);
|
break;
|
||||||
} else {
|
case "1w":
|
||||||
$expires = mktime(0,0,0, $_POST["expmonth"], $_POST["expday"], $_POST["expyear"]);
|
$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) {
|
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
|
<?php
|
||||||
$this->printKeywordChooserJs("form1");
|
$this->printKeywordChooserJs("form1");
|
||||||
|
@ -209,6 +215,37 @@ $(document).ready(function() {
|
||||||
<td><?php printMLText("sequence");?>:</td>
|
<td><?php printMLText("sequence");?>:</td>
|
||||||
<td><?php $this->printSequenceChooser($folder->getDocuments('s')); if($orderby != 's') echo "<br />".getMLText('order_by_sequence_off'); ?></td>
|
<td><?php $this->printSequenceChooser($folder->getDocuments('s')); if($orderby != 's') echo "<br />".getMLText('order_by_sequence_off'); ?></td>
|
||||||
</tr>
|
</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()) { ?>
|
<?php if($user->isAdmin()) { ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php printMLText("owner");?>:</td>
|
<td><?php printMLText("owner");?>:</td>
|
||||||
|
@ -247,26 +284,16 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($presetexpiration) {
|
$arrs = $this->callHook('addDocumentAttributes', $folder);
|
||||||
if(!($expts = strtotime($presetexpiration)))
|
if(is_array($arrs)) {
|
||||||
$expts = time();
|
foreach($arrs as $arr) {
|
||||||
} else {
|
echo "<tr>";
|
||||||
$expts = time();
|
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>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<?php $this->contentSubHeading(getMLText("version_info")); ?>
|
<?php $this->contentSubHeading(getMLText("version_info")); ?>
|
||||||
|
|
|
@ -31,6 +31,20 @@ require_once("class.Bootstrap.php");
|
||||||
*/
|
*/
|
||||||
class SeedDMS_View_SetExpires extends SeedDMS_Bootstrap_Style {
|
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() { /* {{{ */
|
function show() { /* {{{ */
|
||||||
$dms = $this->params['dms'];
|
$dms = $this->params['dms'];
|
||||||
$user = $this->params['user'];
|
$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">
|
<form class="form-horizontal" action="../op/op.SetExpires.php" method="post">
|
||||||
<input type="hidden" name="documentid" value="<?php print $document->getID();?>">
|
<input type="hidden" name="documentid" value="<?php print $document->getID();?>">
|
||||||
<div class="control-group">
|
<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>
|
<label class="control-label"><?php printMLText("expires");?>:</label>
|
||||||
<div class="controls">
|
<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()); ?>">
|
<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 class="add-on"><i class="icon-calendar"></i></span>
|
||||||
</span><br />
|
</span>
|
||||||
<label class="checkbox inline">
|
|
||||||
<input type="checkbox" name="expires" value="false"<?php if (!$document->expires()) print " checked";?>><?php printMLText("does_not_expire");?><br>
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="controls">
|
<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
|
<?php
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
@ -233,21 +239,31 @@ console.log(element);
|
||||||
<?php
|
<?php
|
||||||
if($presetexpiration) {
|
if($presetexpiration) {
|
||||||
if(!($expts = strtotime($presetexpiration)))
|
if(!($expts = strtotime($presetexpiration)))
|
||||||
$expts = time();
|
$expts = false;
|
||||||
} else {
|
} else {
|
||||||
$expts = time();
|
$expts = false;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<tr>
|
<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><?php printMLText("expires");?>:</td>
|
||||||
<td class="standardText">
|
<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()); ?>">
|
<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="span3" size="16" name="expdate" type="text" value="<?php echo date('Y-m-d', $expts); ?>">
|
<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 class="add-on"><i class="icon-calendar"></i></span>
|
||||||
</span><br />
|
</span>
|
||||||
<label class="checkbox inline">
|
|
||||||
<input type="checkbox" name="expires" value="false"<?php if (!$document->expires()) print " checked";?>><?php printMLText("does_not_expire");?><br>
|
|
||||||
</label>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
|
|
Loading…
Reference in New Issue
Block a user