seeddms-code/views/bootstrap/class.EditDocument.php

176 lines
5.4 KiB
PHP
Raw Normal View History

2012-12-14 07:53:13 +00:00
<?php
/**
* Implementation of EditDocument view
*
* @category DMS
* @package SeedDMS
2012-12-14 07:53:13 +00:00
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2002-2005 Markus Westphal,
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
* 2010-2012 Uwe Steinmann
* @version Release: @package_version@
*/
/**
* Include parent class
*/
require_once("class.Bootstrap.php");
/**
* Class which outputs the html page for EditDocument view
*
* @category DMS
* @package SeedDMS
2012-12-14 07:53:13 +00:00
* @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2002-2005 Markus Westphal,
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
* 2010-2012 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_View_EditDocument extends SeedDMS_Bootstrap_Style {
2012-12-14 07:53:13 +00:00
function js() { /* {{{ */
2012-12-14 07:53:13 +00:00
$strictformcheck = $this->params['strictformcheck'];
$this->printKeywordChooserJs('form1');
2012-12-14 07:53:13 +00:00
?>
function checkForm()
{
2013-05-23 14:07:00 +00:00
msg = new Array();
if ($("#name").val() == "") msg.push("<?php printMLText("js_no_name");?>");
2012-12-14 07:53:13 +00:00
<?php
if ($strictformcheck) {
?>
if ($("#comment").val() == "") msg.push("<?php printMLText("js_no_comment");?>");
if ($("#keywords").val() == "") msg.push("<?php printMLText("js_no_keywords");?>");
2012-12-14 07:53:13 +00:00
<?php
}
?>
if (msg != "")
{
2013-05-23 14:07:00 +00:00
noty({
text: msg.join('<br />'),
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
_timeout: 1500,
});
2012-12-14 07:53:13 +00:00
return false;
}
else
return true;
}
$(document).ready( function() {
$('body').on('submit', '#form1', function(ev){
if(checkForm()) return;
event.preventDefault();
});
});
2012-12-14 07:53:13 +00:00
<?php
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$attrdefs = $this->params['attrdefs'];
$strictformcheck = $this->params['strictformcheck'];
$orderby = $this->params['orderby'];
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
$this->globalNavigation($folder);
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document);
2012-12-14 07:53:13 +00:00
$this->contentHeading(getMLText("edit_document_props"));
$this->contentContainerStart();
if($document->expires())
2015-10-30 07:02:57 +00:00
$expdate = date('Y-m-d', $document->getExpires());
else
$expdate = '';
2012-12-14 07:53:13 +00:00
?>
<form action="../op/op.EditDocument.php" name="form1" id="form1" method="post">
2012-12-14 07:53:13 +00:00
<input type="hidden" name="documentid" value="<?php echo $document->getID() ?>">
<table cellpadding="3">
<tr>
<td class="inputDescription"><?php printMLText("name");?>:</td>
<td><input type="text" name="name" id="name" value="<?php print htmlspecialchars($document->getName());?>" size="60"></td>
2012-12-14 07:53:13 +00:00
</tr>
<tr>
<td valign="top" class="inputDescription"><?php printMLText("comment");?>:</td>
<td><textarea name="comment" id="comment" rows="4" cols="80"><?php print htmlspecialchars($document->getComment());?></textarea></td>
2012-12-14 07:53:13 +00:00
</tr>
<tr>
<td valign="top" class="inputDescription"><?php printMLText("keywords");?>:</td>
<td class="standardText">
<?php
$this->printKeywordChooserHtml('form1', $document->getKeywords());
2012-12-14 07:53:13 +00:00
?>
</td>
</tr>
<tr>
<td><?php printMLText("categories")?>:</td>
2013-01-29 08:16:26 +00:00
<td>
<select class="chzn-select" name="categories[]" multiple="multiple" data-placeholder="<?php printMLText('select_category'); ?>" data-no_results_text="<?php printMLText('unknown_document_category'); ?>">
2013-01-29 08:16:26 +00:00
<?php
$categories = $dms->getDocumentCategories();
foreach($categories as $category) {
echo "<option value=\"".$category->getID()."\"";
if(in_array($category, $document->getCategories()))
echo " selected";
echo ">".$category->getName()."</option>";
}
?>
</select>
</td>
2012-12-14 07:53:13 +00:00
</tr>
2013-04-30 15:02:03 +00:00
<tr>
<td><?php printMLText("expires");?>:</td>
<td>
2015-10-30 07:02:57 +00:00
<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="span3" size="16" name="expdate" type="text" value="<?php echo $expdate; ?>">
2013-04-30 15:02:03 +00:00
<span class="add-on"><i class="icon-calendar"></i></span>
2013-06-17 05:12:37 +00:00
</span><br />
2013-04-30 15:02:03 +00:00
<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>
</tr>
2012-12-14 07:53:13 +00:00
<?php
if ($folder->getAccessMode($user) > M_READ) {
print "<tr>";
print "<td class=\"inputDescription\">" . getMLText("sequence") . ":</td>";
print "<td>";
$this->printSequenceChooser($folder->getDocuments('s'), $document->getID());
if($orderby != 's') echo "<br />".getMLText('order_by_sequence_off');
2012-12-14 07:53:13 +00:00
print "</td></tr>";
}
if($attrdefs) {
foreach($attrdefs as $attrdef) {
?>
<tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
<td><?php $this->printAttributeEditField($attrdef, $document->getAttributeValue($attrdef)) ?></td>
</tr>
<?php
}
}
?>
<tr>
<td></td>
2013-04-19 13:22:25 +00:00
<td><button type="submit" class="btn"><i class="icon-save"></i> <?php printMLText("save")?></button></td>
2012-12-14 07:53:13 +00:00
</tr>
</table>
</form>
<?php
$this->contentContainerEnd();
$this->htmlEndPage();
} /* }}} */
}
?>