2015-04-30 05:09:21 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Implementation of TransmittalMgr view
|
|
|
|
*
|
|
|
|
* @category DMS
|
|
|
|
* @package SeedDMS
|
|
|
|
* @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
|
|
|
|
*/
|
2021-04-19 17:45:40 +00:00
|
|
|
//require_once("class.Bootstrap.php");
|
2015-04-30 05:09:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class which outputs the html page for TransmittalMgr view
|
|
|
|
*
|
|
|
|
* @category DMS
|
|
|
|
* @package SeedDMS
|
|
|
|
* @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@
|
|
|
|
*/
|
2021-04-19 17:45:40 +00:00
|
|
|
class SeedDMS_View_TransmittalMgr extends SeedDMS_Theme_Style {
|
2015-04-30 05:09:21 +00:00
|
|
|
|
2022-03-09 15:11:43 +00:00
|
|
|
use TransmittalDeleteButton;
|
|
|
|
use TransmittalUpdateButton;
|
|
|
|
|
2016-03-21 05:22:01 +00:00
|
|
|
function js() { /* {{{ */
|
2020-05-13 12:51:52 +00:00
|
|
|
$showtree = $this->params['showtree'];
|
|
|
|
$onepage = $this->params['onepage'];
|
|
|
|
|
2016-03-21 05:22:01 +00:00
|
|
|
header('Content-Type: application/javascript; charset=UTF-8');
|
2021-06-01 05:05:59 +00:00
|
|
|
parent::jsTranslations(array('js_form_error', 'js_form_errors', 'cancel', 'splash_move_document', 'confirm_move_document', 'move_document', 'confirm_transfer_link_document', 'transfer_content', 'link_document', 'splash_move_folder', 'confirm_move_folder', 'move_folder'));
|
2016-03-21 05:22:01 +00:00
|
|
|
$this->printDeleteDocumentButtonJs();
|
|
|
|
$this->printDeleteItemButtonJs();
|
|
|
|
$this->printUpdateItemButtonJs();
|
2020-05-13 12:51:52 +00:00
|
|
|
if($onepage)
|
|
|
|
$this->printClickDocumentJs();
|
2016-08-22 04:28:29 +00:00
|
|
|
?>
|
2021-06-01 05:05:59 +00:00
|
|
|
function runValidation() {
|
|
|
|
$("#form1").validate({
|
|
|
|
rules: {
|
|
|
|
name: {
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
},
|
|
|
|
messages: {
|
|
|
|
name: "<?php printMLText("js_no_name");?>",
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2016-08-22 04:28:29 +00:00
|
|
|
$(document).ready( function() {
|
|
|
|
$('body').on('click', '.selecttransmittal', function(ev){
|
|
|
|
ev.preventDefault();
|
|
|
|
$('div.ajax').trigger('update', {transmittalid: $(ev.currentTarget).data('transmittalid')});
|
2020-05-13 12:51:52 +00:00
|
|
|
window.history.pushState({"html":"","pageTitle":""},"", '../out/out.TransmittalMgr.php?transmittalid=' + $(ev.currentTarget).data('transmittalid'));
|
2016-08-22 04:28:29 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
<?php
|
2015-05-13 15:35:36 +00:00
|
|
|
} /* }}} */
|
|
|
|
|
2024-04-25 16:33:05 +00:00
|
|
|
/**
|
|
|
|
* Returns the html needed for the transmittals in the menu
|
|
|
|
*
|
|
|
|
* This function renders the transmittals in a way suitable to be
|
|
|
|
* used as a menu
|
|
|
|
*
|
|
|
|
* @return string html code
|
|
|
|
*/
|
|
|
|
function menuTransmittals() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
|
|
|
$accessobject = $this->params['accessobject'];
|
|
|
|
$settings = $this->params['settings'];
|
|
|
|
|
|
|
|
if(!$transmittals = $dms->getAllTransmittals($user)) {;
|
|
|
|
echo '';
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$menuitems = [];
|
|
|
|
$menuitems['transmittals'] = array('label'=>getMLText('transmittals')." (".count($transmittals).")");
|
|
|
|
$menuitems['transmittals']['children'] = [];
|
|
|
|
|
|
|
|
foreach($transmittals as $transmittal) {
|
|
|
|
$subitems = [];
|
|
|
|
$items = $transmittal->getItems();
|
|
|
|
if($items) {
|
|
|
|
foreach($items as $item) {
|
|
|
|
if($content = $item->getContent()) {
|
|
|
|
$document = $content->getDocument();
|
|
|
|
$subitems[] = array('label'=>$document->getName(), 'link'=>$this->params['settings']->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID()."¤ttab=docinfo", 'class'=>"table-row-document", 'rel'=>"document_".$document->getID());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$menuitems['transmittals']['children'][$transmittal->getId()] = array('label'=>$transmittal->getName(), 'children'=>$subitems);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($accessobject->check_view_access('TransmittalMgr')) {
|
|
|
|
$menuitems['transmittals']['children']['divider'] = array('divider'=>true);
|
|
|
|
$menuitems['transmittals']['children']['mytransmittals'] = array('label'=>getMLText('my_transmittals'), 'link'=>$this->params['settings']->_httpRoot.'out/out.TransmittalMgr.php');
|
|
|
|
}
|
|
|
|
self::showNavigationBar($menuitems, array('right'=>true));
|
|
|
|
} /* }}} */
|
|
|
|
|
2016-08-22 04:28:29 +00:00
|
|
|
protected function showTransmittalForm($transmittal) { /* {{{ */
|
2015-04-30 05:09:21 +00:00
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
2016-08-22 04:28:29 +00:00
|
|
|
$accessop = $this->params['accessobject'];
|
2015-04-30 05:09:21 +00:00
|
|
|
?>
|
2021-06-01 05:05:59 +00:00
|
|
|
<form action="../op/op.TransmittalMgr.php" method="post" enctype="multipart/form-data" name="form<?php print $transmittal ? $transmittal->getID() : '0';?>" id="form1">
|
2015-04-30 05:09:21 +00:00
|
|
|
<?php
|
|
|
|
if($transmittal) {
|
|
|
|
echo createHiddenFieldWithKey('edittransmittal');
|
|
|
|
?>
|
|
|
|
<input type="hidden" name="transmittalid" value="<?php print $transmittal->getID();?>">
|
|
|
|
<input type="hidden" name="action" value="edittransmittal">
|
|
|
|
<?php
|
|
|
|
} else {
|
|
|
|
echo createHiddenFieldWithKey('addtransmittal');
|
|
|
|
?>
|
|
|
|
<input type="hidden" name="action" value="addtransmittal">
|
|
|
|
<?php
|
|
|
|
}
|
2021-06-01 05:05:59 +00:00
|
|
|
$this->contentContainerStart();
|
2021-04-19 17:45:40 +00:00
|
|
|
$this->formField(
|
|
|
|
getMLText("name"),
|
|
|
|
array(
|
|
|
|
'element'=>'input',
|
|
|
|
'type'=>'text',
|
|
|
|
'id'=>'name',
|
|
|
|
'name'=>'name',
|
|
|
|
'value'=>($transmittal ? htmlspecialchars($transmittal->getName()) : '')
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$this->formField(
|
|
|
|
getMLText("comment"),
|
|
|
|
array(
|
|
|
|
'element'=>'textarea',
|
|
|
|
'id'=>'comment',
|
|
|
|
'name'=>'comment',
|
|
|
|
'rows'=>4,
|
|
|
|
'value'=>($transmittal ? htmlspecialchars($transmittal->getComment()) : '')
|
|
|
|
)
|
|
|
|
);
|
2021-06-01 05:05:59 +00:00
|
|
|
$this->contentContainerEnd();
|
2016-11-03 20:44:49 +00:00
|
|
|
if($transmittal && $accessop->check_controller_access('TransmittalMgr', array('action'=>'edittransmittal')) || !$transmittal && $accessop->check_controller_access('TransmittalMgr', array('action'=>'addtransmittal'))) {
|
2021-04-19 17:45:40 +00:00
|
|
|
$this->formSubmit("<i class=\"fa fa-save\"></i> ".($transmittal ? getMLText('save') : getMLText('add_transmittal')));
|
2016-08-22 04:28:29 +00:00
|
|
|
}
|
|
|
|
?>
|
2015-04-30 05:09:21 +00:00
|
|
|
</form>
|
|
|
|
<?php
|
|
|
|
} /* }}} */
|
|
|
|
|
2016-08-22 04:28:29 +00:00
|
|
|
function form() { /* {{{ */
|
|
|
|
$seltransmittal = $this->params['seltransmittal'];
|
|
|
|
|
|
|
|
$this->showTransmittalForm($seltransmittal);
|
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
protected function showTransmittalItems($seltransmittal) { /* {{{ */
|
2015-04-30 05:09:21 +00:00
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
2016-08-22 04:28:29 +00:00
|
|
|
$accessop = $this->params['accessobject'];
|
2015-04-30 05:09:21 +00:00
|
|
|
$cachedir = $this->params['cachedir'];
|
2016-08-22 15:02:56 +00:00
|
|
|
$timeout = $this->params['timeout'];
|
2015-04-30 05:09:21 +00:00
|
|
|
$previewwidth = $this->params['previewWidthList'];
|
2020-07-21 07:26:17 +00:00
|
|
|
$previewconverters = $this->params['previewConverters'];
|
2015-04-30 05:09:21 +00:00
|
|
|
|
2016-04-15 11:20:56 +00:00
|
|
|
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout);
|
2015-06-25 17:52:02 +00:00
|
|
|
$previewer->setConverters($previewconverters);
|
2015-04-30 05:09:21 +00:00
|
|
|
|
2016-08-22 04:28:29 +00:00
|
|
|
if($seltransmittal) {
|
|
|
|
$items = $seltransmittal->getItems();
|
|
|
|
if($items) {
|
2021-04-19 17:45:40 +00:00
|
|
|
print "<table class=\"table table-condensed table-sm\">";
|
2016-08-22 04:28:29 +00:00
|
|
|
print "<thead>\n<tr>\n";
|
|
|
|
print "<th></th>\n";
|
|
|
|
print "<th>".getMLText("name")."</th>\n";
|
|
|
|
print "<th>".getMLText("status")."</th>\n";
|
|
|
|
print "<th>".getMLText("document")."</th>\n";
|
|
|
|
print "<th>".getMLText("action")."</th>\n";
|
|
|
|
print "</tr>\n</thead>\n<tbody>\n";
|
|
|
|
foreach($items as $item) {
|
|
|
|
if($content = $item->getContent()) {
|
|
|
|
$document = $content->getDocument();
|
|
|
|
$latestcontent = $document->getLatestContent();
|
|
|
|
if ($document->getAccessMode($user) >= M_READ) {
|
2020-05-13 12:51:52 +00:00
|
|
|
// echo "<tr id=\"table-row-transmittalitem-".$item->getID()."\">";
|
|
|
|
echo $this->documentListRowStart($document);
|
2016-08-22 04:28:29 +00:00
|
|
|
echo $this->documentListRow($document, $previewer, true, $content->getVersion());
|
|
|
|
echo "<td><div class=\"list-action\">";
|
|
|
|
$this->printDeleteItemButton($item, getMLText('transmittalitem_removed'));
|
|
|
|
if($latestcontent->getVersion() != $content->getVersion())
|
|
|
|
$this->printUpdateItemButton($item, getMLText('transmittalitem_updated', array('prevversion'=>$content->getVersion(), 'newversion'=>$latestcontent->getVersion())));
|
|
|
|
echo "</div></td>";
|
2020-05-13 12:51:52 +00:00
|
|
|
echo $this->documentListRowEnd($document);
|
2016-08-22 04:28:29 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
echo "<tr id=\"table-row-transmittalitem-".$item->getID()."\">";
|
|
|
|
echo "<td colspan=\"5\">content ist weg</td>";
|
|
|
|
echo "</tr>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print "</tbody>\n</table>\n";
|
2019-11-20 18:39:47 +00:00
|
|
|
print "<a class=\"btn btn-primary\" href=\"../op/op.TransmittalDownload.php?transmittalid=".$seltransmittal->getID()."\">".getMLText('download')."</a>";
|
2016-08-22 04:28:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
function items() { /* {{{ */
|
|
|
|
$seltransmittal = $this->params['seltransmittal'];
|
|
|
|
|
|
|
|
$this->showTransmittalItems($seltransmittal);
|
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
function show() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
|
|
|
$accessop = $this->params['accessobject'];
|
|
|
|
$seltransmittal = $this->params['seltransmittal'];
|
|
|
|
|
2021-06-01 05:05:59 +00:00
|
|
|
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/jquery-validation/jquery.validate.js"></script>'."\n", 'js');
|
|
|
|
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/styles/validation-default.js"></script>'."\n", 'js');
|
|
|
|
|
2015-04-30 05:09:21 +00:00
|
|
|
$this->htmlStartPage(getMLText("my_transmittals"));
|
|
|
|
$this->globalNavigation();
|
|
|
|
$this->contentStart();
|
|
|
|
$this->pageNavigation(getMLText("my_transmittals"), "my_documents");
|
|
|
|
$this->contentHeading(getMLText("my_transmittals"));
|
2021-04-19 17:45:40 +00:00
|
|
|
$this->rowStart();
|
|
|
|
$this->columnStart(4);
|
2015-04-30 05:09:21 +00:00
|
|
|
|
|
|
|
$transmittals = $dms->getAllTransmittals($user);
|
|
|
|
|
|
|
|
if ($transmittals){
|
2021-04-19 17:45:40 +00:00
|
|
|
print "<table class=\"table table-condensed table-sm\">";
|
2015-04-30 05:09:21 +00:00
|
|
|
print "<thead>\n<tr>\n";
|
|
|
|
print "<th>".getMLText("name")."</th>\n";
|
2015-05-16 17:42:07 +00:00
|
|
|
print "<th>".getMLText("transmittal_size")."</th>\n";
|
2015-04-30 05:09:21 +00:00
|
|
|
print "<th></th>\n";
|
|
|
|
print "</tr>\n</thead>\n<tbody>\n";
|
|
|
|
foreach($transmittals as $transmittal) {
|
|
|
|
print "<tr>\n";
|
2024-04-25 16:33:05 +00:00
|
|
|
print "<td style=\"cursor: pointer;\" class=\"selecttransmittal\" data-transmittalid=\"".$transmittal->getID()."\">".htmlspecialchars($transmittal->getName());
|
|
|
|
if($comment = $transmittal->getComment())
|
|
|
|
print "<br /><span style=\"font-size: 85%;\">".htmlspecialchars($comment)."</span>";
|
|
|
|
print "</td>";
|
2015-05-13 15:35:36 +00:00
|
|
|
$items = $transmittal->getItems();
|
2024-04-25 16:33:05 +00:00
|
|
|
print "<td style=\"cursor: pointer;\" class=\"selecttransmittal\" data-transmittalid=\"".$transmittal->getID()."\">".count($items)." <em>(".SeedDMS_Core_File::format_filesize($transmittal->getSize()).")</em></td>";
|
2015-04-30 05:09:21 +00:00
|
|
|
print "<td>";
|
|
|
|
print "<div class=\"list-action\">";
|
2024-04-25 16:33:05 +00:00
|
|
|
// print "<a class=\"selecttransmittal\" data-transmittalid=\"".$transmittal->getID()."\" href=\"../out/out.TransmittalMgr.php?transmittalid=".$transmittal->getID()."\" title=\"".getMLText("edit_transmittal_props")."\"><i class=\"fa fa-edit\"></i></a>";
|
2021-04-19 17:45:40 +00:00
|
|
|
if($transmittal && $accessop->check_controller_access('TransmittalMgr', array('action'=>'removetransmittal'))) {
|
|
|
|
print "<a data-transmittalid=\"".$transmittal->getID()."\" href=\"../out/out.RemoveTransmittal.php?transmittalid=".$transmittal->getID()."\" title=\"".getMLText("rm_transmittal")."\"><i class=\"fa fa-remove\"></i></a>";
|
|
|
|
}
|
2015-04-30 05:09:21 +00:00
|
|
|
print "</div>";
|
|
|
|
print "</td>";
|
|
|
|
print "</tr>\n";
|
|
|
|
}
|
|
|
|
print "</tbody>\n</table>\n";
|
|
|
|
}
|
|
|
|
|
2021-04-19 17:45:40 +00:00
|
|
|
$this->columnEnd();
|
|
|
|
$this->columnStart(8);
|
2016-08-22 04:28:29 +00:00
|
|
|
if($accessop->check_view_access($this, array('action'=>'form'))) {
|
|
|
|
?>
|
2021-06-01 05:05:59 +00:00
|
|
|
<div class="ajax" data-view="TransmittalMgr" data-action="form" data-afterload="()=>{runValidation();}" <?php echo ($seltransmittal ? "data-query=\"transmittalid=".$seltransmittal->getID()."\"" : "") ?>></div>
|
2016-08-22 04:28:29 +00:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
if($accessop->check_view_access($this, array('action'=>'items'))) {
|
|
|
|
?>
|
2024-04-25 16:33:05 +00:00
|
|
|
<div style="margin-top: 10px;" class="ajax" data-view="TransmittalMgr" data-action="items" <?php echo ($seltransmittal ? "data-query=\"transmittalid=".$seltransmittal->getID()."\"" : "") ?>></div>
|
2016-08-22 04:28:29 +00:00
|
|
|
<?php
|
2015-04-30 05:09:21 +00:00
|
|
|
}
|
2021-04-19 17:45:40 +00:00
|
|
|
$this->columnEnd();
|
|
|
|
$this->rowEnd();
|
2016-03-21 05:22:01 +00:00
|
|
|
$this->contentEnd();
|
2015-04-30 05:09:21 +00:00
|
|
|
$this->htmlEndPage();
|
|
|
|
} /* }}} */
|
|
|
|
}
|
|
|
|
?>
|