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
|
|
|
|
*/
|
|
|
|
require_once("class.Bootstrap.php");
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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@
|
|
|
|
*/
|
|
|
|
class SeedDMS_View_TransmittalMgr extends SeedDMS_Bootstrap_Style {
|
|
|
|
|
2016-03-21 05:22:01 +00:00
|
|
|
function js() { /* {{{ */
|
|
|
|
header('Content-Type: application/javascript; charset=UTF-8');
|
|
|
|
$this->printDeleteDocumentButtonJs();
|
|
|
|
$this->printDeleteItemButtonJs();
|
|
|
|
$this->printUpdateItemButtonJs();
|
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')});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
<?php
|
2015-05-13 15:35:36 +00:00
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Print button for updating the transmittal item to the newest version
|
|
|
|
*
|
|
|
|
* @param object $item
|
|
|
|
* @param string $msg message shown in case of successful update
|
|
|
|
*/
|
2016-08-22 04:28:29 +00:00
|
|
|
protected function printUpdateItemButton($item, $msg, $return=false){ /* {{{ */
|
2015-05-13 15:35:36 +00:00
|
|
|
$itemid = $item->getID();
|
|
|
|
$content = '';
|
2016-08-22 04:28:29 +00:00
|
|
|
$content .= '<a class="update-transmittalitem-btn" transmittal="'.$item->getTransmittal()->getID().'" rel="'.$itemid.'" msg="'.htmlspecialchars($msg, ENT_QUOTES).'" confirmmsg="'.htmlspecialchars(getMLText("confirm_update_transmittalitem"), ENT_QUOTES).'"><i class="icon-refresh"></i></a>';
|
2015-05-13 15:35:36 +00:00
|
|
|
if($return)
|
|
|
|
return $content;
|
|
|
|
else
|
|
|
|
echo $content;
|
|
|
|
return '';
|
|
|
|
} /* }}} */
|
|
|
|
|
2016-08-22 04:28:29 +00:00
|
|
|
protected function printUpdateItemButtonJs(){ /* {{{ */
|
2016-03-21 05:22:01 +00:00
|
|
|
echo "
|
|
|
|
$(document).ready(function () {
|
|
|
|
$('body').on('click', 'a.update-transmittalitem-btn', function(ev){
|
|
|
|
id = $(ev.currentTarget).attr('rel');
|
2016-08-22 04:28:29 +00:00
|
|
|
transmittalid = $(ev.currentTarget).attr('transmittal');
|
2016-03-21 05:22:01 +00:00
|
|
|
confirmmsg = $(ev.currentTarget).attr('confirmmsg');
|
|
|
|
msg = $(ev.currentTarget).attr('msg');
|
|
|
|
formtoken = '".createFormKey('updatetransmittalitem')."';
|
|
|
|
bootbox.dialog(confirmmsg, [{
|
|
|
|
\"label\" : \"<i class='icon-refresh'></i> ".getMLText("update_transmittalitem")."\",
|
|
|
|
\"class\" : \"btn-danger\",
|
|
|
|
\"callback\": function() {
|
2016-08-22 04:28:29 +00:00
|
|
|
$.ajax('../op/op.TransmittalMgr.php', {
|
|
|
|
type:'POST',
|
|
|
|
async:true,
|
|
|
|
dataType:'json',
|
|
|
|
data: {
|
|
|
|
action: 'updatetransmittalitem',
|
|
|
|
id: id,
|
|
|
|
formtoken: formtoken
|
|
|
|
},
|
|
|
|
success: function(data) {
|
2016-03-21 05:22:01 +00:00
|
|
|
if(data.success) {
|
|
|
|
noty({
|
|
|
|
text: msg,
|
|
|
|
type: 'success',
|
|
|
|
dismissQueue: true,
|
|
|
|
layout: 'topRight',
|
|
|
|
theme: 'defaultTheme',
|
|
|
|
timeout: 1500,
|
|
|
|
});
|
2016-08-22 04:28:29 +00:00
|
|
|
$('div.ajax').trigger('update', {transmittalid: transmittalid});
|
2016-03-21 05:22:01 +00:00
|
|
|
} else {
|
|
|
|
noty({
|
|
|
|
text: data.message,
|
|
|
|
type: 'error',
|
|
|
|
dismissQueue: true,
|
|
|
|
layout: 'topRight',
|
|
|
|
theme: 'defaultTheme',
|
|
|
|
timeout: 3500,
|
|
|
|
});
|
|
|
|
}
|
2016-08-22 04:28:29 +00:00
|
|
|
}
|
|
|
|
});
|
2016-03-21 05:22:01 +00:00
|
|
|
}
|
|
|
|
}, {
|
|
|
|
\"label\" : \"".getMLText("cancel")."\",
|
|
|
|
\"class\" : \"btn-cancel\",
|
|
|
|
\"callback\": function() {
|
|
|
|
}
|
|
|
|
}]);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
";
|
|
|
|
} /* }}} */
|
|
|
|
|
2015-05-13 15:35:36 +00:00
|
|
|
/**
|
|
|
|
* Print button with link for deleting a transmittal item
|
|
|
|
*
|
|
|
|
* This button works just like the printDeleteDocumentButton()
|
|
|
|
*
|
|
|
|
* @param object $item transmittal item to be deleted
|
|
|
|
* @param string $msg message shown in case of successful deletion
|
|
|
|
* @param boolean $return return html instead of printing it
|
|
|
|
* @return string html content if $return is true, otherwise an empty string
|
|
|
|
*/
|
2016-08-22 04:28:29 +00:00
|
|
|
protected function printDeleteItemButton($item, $msg, $return=false){ /* {{{ */
|
2015-05-13 15:35:36 +00:00
|
|
|
$itemid = $item->getID();
|
|
|
|
$content = '';
|
2016-03-21 05:22:01 +00:00
|
|
|
$content .= '<a class="delete-transmittalitem-btn" rel="'.$itemid.'" msg="'.htmlspecialchars($msg, ENT_QUOTES).'" confirmmsg="'.htmlspecialchars(getMLText("confirm_rm_transmittalitem"), ENT_QUOTES).'"><i class="icon-remove"></i></a>';
|
2015-05-13 15:35:36 +00:00
|
|
|
if($return)
|
|
|
|
return $content;
|
|
|
|
else
|
|
|
|
echo $content;
|
|
|
|
return '';
|
|
|
|
} /* }}} */
|
|
|
|
|
2016-08-22 04:28:29 +00:00
|
|
|
protected function printDeleteItemButtonJs(){ /* {{{ */
|
2016-03-21 05:22:01 +00:00
|
|
|
echo "
|
|
|
|
$(document).ready(function () {
|
|
|
|
$('body').on('click', 'a.delete-transmittalitem-btn', function(ev){
|
|
|
|
id = $(ev.currentTarget).attr('rel');
|
|
|
|
confirmmsg = $(ev.currentTarget).attr('confirmmsg');
|
|
|
|
msg = $(ev.currentTarget).attr('msg');
|
|
|
|
formtoken = '".createFormKey('removetransmittalitem')."';
|
|
|
|
bootbox.dialog(confirmmsg, [{
|
|
|
|
\"label\" : \"<i class='icon-remove'></i> ".getMLText("rm_transmittalitem")."\",
|
|
|
|
\"class\" : \"btn-danger\",
|
|
|
|
\"callback\": function() {
|
2016-08-22 04:28:29 +00:00
|
|
|
$.ajax('../op/op.TransmittalMgr.php', {
|
|
|
|
type:'POST',
|
|
|
|
async:true,
|
|
|
|
dataType:'json',
|
|
|
|
data: {
|
|
|
|
action: 'removetransmittalitem',
|
|
|
|
id: id,
|
|
|
|
formtoken: formtoken
|
|
|
|
},
|
|
|
|
success: function(data) {
|
2016-03-21 05:22:01 +00:00
|
|
|
if(data.success) {
|
2016-08-22 04:28:29 +00:00
|
|
|
$('#table-row-transmittalitem-'+id).hide('slow');
|
2016-03-21 05:22:01 +00:00
|
|
|
noty({
|
|
|
|
text: msg,
|
|
|
|
type: 'success',
|
|
|
|
dismissQueue: true,
|
|
|
|
layout: 'topRight',
|
|
|
|
theme: 'defaultTheme',
|
|
|
|
timeout: 1500,
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
noty({
|
|
|
|
text: data.message,
|
|
|
|
type: 'error',
|
|
|
|
dismissQueue: true,
|
|
|
|
layout: 'topRight',
|
|
|
|
theme: 'defaultTheme',
|
|
|
|
timeout: 3500,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
2016-08-22 04:28:29 +00:00
|
|
|
});
|
2016-03-21 05:22:01 +00:00
|
|
|
}
|
|
|
|
}, {
|
|
|
|
\"label\" : \"".getMLText("cancel")."\",
|
|
|
|
\"class\" : \"btn-cancel\",
|
|
|
|
\"callback\": function() {
|
|
|
|
}
|
|
|
|
}]);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
";
|
|
|
|
} /* }}} */
|
|
|
|
|
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
|
|
|
?>
|
2016-03-21 05:22:01 +00:00
|
|
|
<form action="../op/op.TransmittalMgr.php" method="post" enctype="multipart/form-data" name="form<?php print $transmittal ? $transmittal->getID() : '0';?>">
|
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
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<table class="table-condensed">
|
|
|
|
<?php
|
2016-08-22 04:28:29 +00:00
|
|
|
if($transmittal && $accessop->check_controller_access('TransmittalMgr', array('action'=>'removetransmittal'))) {
|
2015-04-30 05:09:21 +00:00
|
|
|
?>
|
|
|
|
<tr>
|
|
|
|
<td></td>
|
|
|
|
<td><a class="standardText btn" href="../out/out.RemoveTransmittal.php?transmittalid=<?php print $transmittal->getID();?>"><i class="icon-remove"></i> <?php printMLText("rm_transmittal");?></a></td>
|
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<tr>
|
|
|
|
<td><?php printMLText("transmittal_name");?>:</td>
|
|
|
|
<td><input type="text" name="name" value="<?php print $transmittal ? htmlspecialchars($transmittal->getName()) : "";?>"></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><?php printMLText("transmittal_comment");?>:</td>
|
|
|
|
<td><input type="text" name="comment" value="<?php print $transmittal ? htmlspecialchars($transmittal->getComment()) : "";?>"></td>
|
|
|
|
</tr>
|
2016-08-22 04:28:29 +00:00
|
|
|
<?php
|
|
|
|
if($currRole && $accessop->check_controller_access('TransmittalMgr', array('action'=>'edittransmittal')) || !$currRole && $accessop->check_controller_access('TransmittalMgr', array('action'=>'addtransmittal'))) {
|
|
|
|
?>
|
2015-04-30 05:09:21 +00:00
|
|
|
<tr>
|
|
|
|
<td></td>
|
|
|
|
<td><button type="submit" class="btn"><i class="icon-save"></i> <?php printMLText($transmittal ? "save" : "add_transmittal")?></button></td>
|
|
|
|
</tr>
|
2016-08-22 04:28:29 +00:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
2015-04-30 05:09:21 +00:00
|
|
|
</table>
|
|
|
|
</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'];
|
2015-06-25 17:52:02 +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) {
|
|
|
|
print "<table class=\"table table-condensed\">";
|
|
|
|
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) {
|
|
|
|
echo "<tr id=\"table-row-transmittalitem-".$item->getID()."\">";
|
|
|
|
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>";
|
|
|
|
echo "</tr>";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
echo "<tr id=\"table-row-transmittalitem-".$item->getID()."\">";
|
|
|
|
echo "<td colspan=\"5\">content ist weg</td>";
|
|
|
|
echo "</tr>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print "</tbody>\n</table>\n";
|
|
|
|
print "<a class=\"btn btn-default\" href=\"../op/op.TransmittalDownload.php?transmittalid=".$seltransmittal->getID()."\">".getMLText('download')."</a>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
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'];
|
|
|
|
|
2016-03-21 05:22:01 +00:00
|
|
|
$this->htmlAddHeader('<script type="text/javascript" src="../styles/'.$this->theme.'/bootbox/bootbox.min.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"));
|
|
|
|
?>
|
|
|
|
<div class="row-fluid">
|
|
|
|
<div class="span4">
|
|
|
|
<?php
|
|
|
|
$this->contentContainerStart();
|
|
|
|
|
|
|
|
$transmittals = $dms->getAllTransmittals($user);
|
|
|
|
|
|
|
|
if ($transmittals){
|
|
|
|
print "<table class=\"table table-condensed\">";
|
|
|
|
print "<thead>\n<tr>\n";
|
|
|
|
print "<th>".getMLText("name")."</th>\n";
|
|
|
|
print "<th>".getMLText("comment")."</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";
|
|
|
|
print "<td>".$transmittal->getName()."</td>";
|
|
|
|
print "<td>".$transmittal->getComment()."</td>";
|
2015-05-13 15:35:36 +00:00
|
|
|
$items = $transmittal->getItems();
|
|
|
|
print "<td>".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\">";
|
2016-08-22 04:28:29 +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=\"icon-edit\"></i></a>";
|
2015-04-30 05:09:21 +00:00
|
|
|
print "</div>";
|
|
|
|
print "</td>";
|
|
|
|
print "</tr>\n";
|
|
|
|
}
|
|
|
|
print "</tbody>\n</table>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->contentContainerEnd();
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
<div class="span8">
|
|
|
|
<?php
|
2016-08-22 04:28:29 +00:00
|
|
|
if($accessop->check_view_access($this, array('action'=>'form'))) {
|
2015-04-30 05:09:21 +00:00
|
|
|
$this->contentContainerStart();
|
2016-08-22 04:28:29 +00:00
|
|
|
?>
|
|
|
|
<div class="ajax" data-view="TransmittalMgr" data-action="form" <?php echo ($seltransmittal ? "data-query=\"transmittalid=".$seltransmittal->getID()."\"" : "") ?>></div>
|
|
|
|
<?php
|
2015-04-30 05:09:21 +00:00
|
|
|
$this->contentContainerEnd();
|
2016-08-22 04:28:29 +00:00
|
|
|
}
|
|
|
|
if($accessop->check_view_access($this, array('action'=>'items'))) {
|
|
|
|
?>
|
|
|
|
<div class="ajax" data-view="TransmittalMgr" data-action="items" <?php echo ($seltransmittal ? "data-query=\"transmittalid=".$seltransmittal->getID()."\"" : "") ?>></div>
|
|
|
|
<?php
|
2015-04-30 05:09:21 +00:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php
|
2016-03-21 05:22:01 +00:00
|
|
|
$this->contentEnd();
|
2015-04-30 05:09:21 +00:00
|
|
|
$this->htmlEndPage();
|
|
|
|
} /* }}} */
|
|
|
|
}
|
|
|
|
?>
|