2012-12-14 07:53:13 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Implementation of ManageNotify view
|
|
|
|
*
|
|
|
|
* @category DMS
|
2013-02-14 11:10:53 +00:00
|
|
|
* @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
|
|
|
|
*/
|
2021-04-18 05:08:00 +00:00
|
|
|
//require_once("class.Bootstrap.php");
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class which outputs the html page for ManageNotify view
|
|
|
|
*
|
|
|
|
* @category DMS
|
2013-02-14 11:10:53 +00:00
|
|
|
* @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@
|
|
|
|
*/
|
2021-04-18 05:08:00 +00:00
|
|
|
class SeedDMS_View_ManageNotify extends SeedDMS_Theme_Style {
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
// Get list of subscriptions for documents or folders for user or groups
|
|
|
|
function getNotificationList($as_group, $folders) { /* {{{ */
|
|
|
|
|
|
|
|
// First, get the list of groups of which the user is a member.
|
2016-02-05 15:49:27 +00:00
|
|
|
$notifications = array();
|
2012-12-14 07:53:13 +00:00
|
|
|
if ($as_group){
|
2016-02-05 15:49:27 +00:00
|
|
|
if(!($groups = $this->user->getGroups()))
|
2019-06-24 10:37:25 +00:00
|
|
|
return array();
|
2016-02-05 15:49:27 +00:00
|
|
|
|
2012-12-14 07:53:13 +00:00
|
|
|
foreach ($groups as $group) {
|
2016-02-05 15:49:27 +00:00
|
|
|
$tmp = $group->getNotifications($folders ? T_FOLDER : T_DOCUMENT);
|
|
|
|
if($tmp) {
|
|
|
|
$notifications = array_merge($notifications, $tmp);
|
|
|
|
}
|
2012-12-14 07:53:13 +00:00
|
|
|
}
|
|
|
|
} else {
|
2016-02-05 15:49:27 +00:00
|
|
|
$notifications = $this->user->getNotifications($folders ? T_FOLDER : T_DOCUMENT);
|
2012-12-14 07:53:13 +00:00
|
|
|
}
|
2016-02-05 15:49:27 +00:00
|
|
|
|
|
|
|
return $notifications;
|
2012-12-14 07:53:13 +00:00
|
|
|
} /* }}} */
|
|
|
|
|
2016-02-05 15:49:27 +00:00
|
|
|
function printFolderNotificationList($notifications, $deleteaction=true) { /* {{{ */
|
|
|
|
if (count($notifications)==0) {
|
2012-12-14 07:53:13 +00:00
|
|
|
printMLText("empty_notify_list");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
|
2020-03-05 08:12:45 +00:00
|
|
|
print "<table class=\"table table-condensed\">";
|
2012-12-14 07:53:13 +00:00
|
|
|
print "<thead><tr>\n";
|
|
|
|
print "<th></th>\n";
|
|
|
|
print "<th>".getMLText("name")."</th>\n";
|
|
|
|
print "<th>".getMLText("owner")."</th>\n";
|
|
|
|
print "<th>".getMLText("actions")."</th>\n";
|
|
|
|
print "</tr></thead>\n<tbody>\n";
|
2016-02-05 15:49:27 +00:00
|
|
|
foreach($notifications as $notification) {
|
|
|
|
$fld = $this->dms->getFolder($notification->getTarget());
|
2012-12-14 07:53:13 +00:00
|
|
|
if (is_object($fld)) {
|
2020-03-05 08:12:45 +00:00
|
|
|
echo $this->folderListRowStart($fld);
|
|
|
|
$txt = $this->callHook('folderListItem', $fld, true, 'viewfolder');
|
|
|
|
if(is_string($txt))
|
|
|
|
echo $txt;
|
|
|
|
else {
|
|
|
|
echo $this->folderListRow($fld, true);
|
|
|
|
}
|
2012-12-14 07:53:13 +00:00
|
|
|
print "<td>";
|
2021-04-18 05:08:00 +00:00
|
|
|
if ($deleteaction) print "<a href='../op/op.ManageNotify.php?id=".$fld->getID()."&type=folder&action=del' class=\"btn btn-danger btn-mini btn-sm\"><i class=\"fa fa-remove\"></i> ".getMLText("delete")."</a>";
|
|
|
|
else print "<a href='../out/out.FolderNotify.php?folderid=".$fld->getID()."' class=\"btn btn-danger btn-mini btn-sm\">".getMLText("edit")."</a>";
|
2020-03-05 08:12:45 +00:00
|
|
|
print "</td>";
|
|
|
|
echo $this->folderListRowEnd($fld);
|
2012-12-14 07:53:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
print "</tbody></table>";
|
|
|
|
}
|
|
|
|
} /* }}} */
|
|
|
|
|
2016-02-05 15:49:27 +00:00
|
|
|
function printDocumentNotificationList($notifications,$deleteaction=true) { /* {{{ */
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2016-02-05 15:49:27 +00:00
|
|
|
if (count($notifications)==0) {
|
2012-12-14 07:53:13 +00:00
|
|
|
printMLText("empty_notify_list");
|
|
|
|
}
|
|
|
|
else {
|
2019-01-18 12:07:39 +00:00
|
|
|
$previewer = new SeedDMS_Preview_Previewer($this->cachedir, $this->previewwidth, $this->timeout, $this->xsendfile);
|
2015-06-25 17:52:02 +00:00
|
|
|
$previewer->setConverters($this->previewconverters);
|
2014-05-22 05:33:48 +00:00
|
|
|
|
2020-03-05 08:12:45 +00:00
|
|
|
print "<table class=\"table table-condensed\">";
|
2012-12-14 07:53:13 +00:00
|
|
|
print "<thead>\n<tr>\n";
|
|
|
|
print "<th></th>\n";
|
|
|
|
print "<th>".getMLText("name")."</th>\n";
|
|
|
|
print "<th>".getMLText("status")."</th>\n";
|
2014-05-22 05:33:48 +00:00
|
|
|
print "<th>".getMLText("action")."</th>\n";
|
2020-03-05 08:12:45 +00:00
|
|
|
print "<th></th>\n";
|
2012-12-14 07:53:13 +00:00
|
|
|
print "</tr></thead>\n<tbody>\n";
|
2016-02-05 15:49:27 +00:00
|
|
|
foreach ($notifications as $notification) {
|
|
|
|
$doc = $this->dms->getDocument($notification->getTarget());
|
2012-12-14 07:53:13 +00:00
|
|
|
if (is_object($doc)) {
|
2020-03-05 08:12:45 +00:00
|
|
|
$doc->verifyLastestContentExpriry();
|
|
|
|
echo $this->documentListRowStart($doc);
|
|
|
|
$txt = $this->callHook('documentListItem', $doc, $previewer, true, 'managenotify');
|
|
|
|
if(is_string($txt))
|
|
|
|
echo $txt;
|
|
|
|
else {
|
|
|
|
echo $this->documentListRow($doc, $previewer, true);
|
2014-05-22 05:33:48 +00:00
|
|
|
}
|
2012-12-14 07:53:13 +00:00
|
|
|
print "<td>";
|
2021-04-18 05:08:00 +00:00
|
|
|
if ($deleteaction) print "<a href='../op/op.ManageNotify.php?id=".$doc->getID()."&type=document&action=del' class=\"btn btn-danger btn-mini btn-sm\"><i class=\"fa fa-remove\"></i> ".getMLText("delete")."</a>";
|
|
|
|
else print "<a href='../out/out.DocumentNotify.php?documentid=".$doc->getID()."' class=\"btn btn-danger btn-mini btn-sm\">".getMLText("edit")."</a>";
|
2020-03-05 08:12:45 +00:00
|
|
|
print "</td>\n";
|
|
|
|
echo $this->documentListRowEnd($doc);
|
2012-12-14 07:53:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
print "</tbody></table>";
|
|
|
|
}
|
|
|
|
} /* }}} */
|
|
|
|
|
2016-01-28 14:04:14 +00:00
|
|
|
function js() { /* {{{ */
|
2021-03-10 14:58:22 +00:00
|
|
|
header('Content-Type: application/javascript; charset=UTF-8');
|
2021-05-27 19:57:12 +00:00
|
|
|
parent::jsTranslations(array('js_form_error', 'js_form_errors'));
|
|
|
|
?>
|
|
|
|
$(document).ready( function() {
|
|
|
|
$("#form1").validate({
|
|
|
|
ignore: [],
|
|
|
|
rules: {
|
|
|
|
targetid: {
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
},
|
|
|
|
messages: {
|
|
|
|
targetid: "<?php printMLText("js_no_folder");?>",
|
|
|
|
},
|
|
|
|
});
|
|
|
|
$("#form2").validate({
|
|
|
|
ignore: [],
|
|
|
|
rules: {
|
|
|
|
docid: {
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
},
|
|
|
|
messages: {
|
|
|
|
docid: "<?php printMLText("js_no_document");?>",
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
<?php
|
2020-03-05 08:12:45 +00:00
|
|
|
$this->printClickDocumentJs();
|
|
|
|
$this->printClickFolderJs();
|
2016-01-28 14:04:14 +00:00
|
|
|
} /* }}} */
|
|
|
|
|
2012-12-14 07:53:13 +00:00
|
|
|
function show() { /* {{{ */
|
|
|
|
$this->dms = $this->params['dms'];
|
|
|
|
$this->user = $this->params['user'];
|
2014-05-22 05:33:48 +00:00
|
|
|
$this->cachedir = $this->params['cachedir'];
|
|
|
|
$this->previewwidth = $this->params['previewWidthList'];
|
2020-07-21 07:26:17 +00:00
|
|
|
$this->previewconverters = $this->params['previewConverters'];
|
2012-12-14 07:53:13 +00:00
|
|
|
$this->db = $this->dms->getDB();
|
2016-02-15 09:57:37 +00:00
|
|
|
$this->timeout = $this->params['timeout'];
|
2019-01-18 12:07:39 +00:00
|
|
|
$this->xsendfile = $this->params['xsendfile'];
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2021-05-27 19:57:12 +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');
|
|
|
|
|
2012-12-14 07:53:13 +00:00
|
|
|
$this->htmlStartPage(getMLText("my_account"));
|
|
|
|
$this->globalNavigation();
|
|
|
|
$this->contentStart();
|
|
|
|
$this->pageNavigation(getMLText("my_account"), "my_account");
|
|
|
|
|
2020-10-08 05:57:23 +00:00
|
|
|
$this->rowStart();
|
|
|
|
$this->columnStart(6);
|
2014-05-22 05:33:48 +00:00
|
|
|
$this->contentHeading(getMLText("edit_folder_notify"));
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2021-05-27 19:57:12 +00:00
|
|
|
print "<form class=\"form-horizontal\" method=\"post\" action=\"../op/op.ManageNotify.php?type=folder&action=add\" id=\"form1\" name=\"form1\">";
|
2021-04-18 05:08:00 +00:00
|
|
|
$this->contentContainerStart();
|
2018-06-21 09:30:58 +00:00
|
|
|
$this->formField(getMLText("choose_target_folder"), $this->getFolderChooserHtml("form1", M_READ));
|
|
|
|
$this->formField(
|
|
|
|
getMLText("include_subdirectories"),
|
|
|
|
array(
|
|
|
|
'element'=>'input',
|
|
|
|
'type'=>'checkbox',
|
|
|
|
'name'=>'recursefolder',
|
|
|
|
'value'=>1
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$this->formField(
|
|
|
|
getMLText("include_documents"),
|
|
|
|
array(
|
|
|
|
'element'=>'input',
|
|
|
|
'type'=>'checkbox',
|
|
|
|
'name'=>'recursedoc',
|
|
|
|
'value'=>1
|
|
|
|
)
|
|
|
|
);
|
2021-04-18 05:08:00 +00:00
|
|
|
$this->contentContainerEnd();
|
2020-08-27 05:52:52 +00:00
|
|
|
$this->formSubmit("<i class=\"fa fa-plus\"></i> ".getMLText('add'));
|
2012-12-14 07:53:13 +00:00
|
|
|
print "</form>";
|
2020-10-08 05:57:23 +00:00
|
|
|
$this->columnEnd();
|
|
|
|
$this->columnStart(6);
|
2014-05-22 05:33:48 +00:00
|
|
|
$this->contentHeading(getMLText("edit_document_notify"));
|
2021-05-27 19:57:12 +00:00
|
|
|
print "<form method=\"post\" action=\"../op/op.ManageNotify.php?type=document&action=add\" id=\"form2\" name=\"form2\">";
|
2013-03-06 10:14:15 +00:00
|
|
|
/* 'form1' must be passed to printDocumentChooser() because the typeahead
|
|
|
|
* function is currently hardcoded on this value */
|
2021-04-18 05:08:00 +00:00
|
|
|
$this->contentContainerStart();
|
2018-06-21 09:56:05 +00:00
|
|
|
$this->formField(getMLText("choose_target_document"), $this->getDocumentChooserHtml("form2"));
|
2021-04-18 05:08:00 +00:00
|
|
|
$this->contentContainerEnd();
|
2020-08-27 05:52:52 +00:00
|
|
|
$this->formSubmit("<i class=\"fa fa-plus\"></i> ".getMLText('add'));
|
2012-12-14 07:53:13 +00:00
|
|
|
print "</form>";
|
|
|
|
|
2020-10-08 05:57:23 +00:00
|
|
|
$this->columnEnd();
|
|
|
|
$this->rowEnd();
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Display the results.
|
|
|
|
//
|
2020-10-08 05:57:23 +00:00
|
|
|
$this->rowStart();
|
|
|
|
$this->columnStart(6);
|
2014-05-22 05:33:48 +00:00
|
|
|
$this->contentHeading(getMLText("user"));
|
2012-12-14 07:53:13 +00:00
|
|
|
$ret=$this->getNotificationList(false,true);
|
|
|
|
$this->printFolderNotificationList($ret);
|
2014-05-22 05:33:48 +00:00
|
|
|
$this->contentHeading(getMLText("group"));
|
2012-12-14 07:53:13 +00:00
|
|
|
$ret=$this->getNotificationList(true,true);
|
|
|
|
$this->printFolderNotificationList($ret,false);
|
2020-10-08 05:57:23 +00:00
|
|
|
$this->columnEnd();
|
|
|
|
$this->columnStart(6);
|
2014-05-22 05:33:48 +00:00
|
|
|
$this->contentHeading(getMLText("user"));
|
2012-12-14 07:53:13 +00:00
|
|
|
$ret=$this->getNotificationList(false,false);
|
|
|
|
$this->printDocumentNotificationList($ret);
|
2014-05-22 05:33:48 +00:00
|
|
|
$this->contentHeading(getMLText("group"));
|
2012-12-14 07:53:13 +00:00
|
|
|
$ret=$this->getNotificationList(true,false);
|
|
|
|
$this->printDocumentNotificationList($ret,false);
|
2020-10-08 05:57:23 +00:00
|
|
|
$this->columnEnd();
|
|
|
|
$this->rowEnd();
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2016-03-15 07:30:53 +00:00
|
|
|
$this->contentEnd();
|
2012-12-14 07:53:13 +00:00
|
|
|
$this->htmlEndPage();
|
|
|
|
} /* }}} */
|
|
|
|
}
|