* @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"); /** * Include class to preview documents */ require_once("SeedDMS/Preview.php"); /** * Class which outputs the html page for ManageNotify view * * @category DMS * @package SeedDMS * @author Markus Westphal, Malcolm Cowe, Uwe Steinmann * @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_ManageNotify extends SeedDMS_Bootstrap_Style { // 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. $notifications = array(); if ($as_group){ if(!($groups = $this->user->getGroups())) return array(); foreach ($groups as $group) { $tmp = $group->getNotifications($folders ? T_FOLDER : T_DOCUMENT); if($tmp) { $notifications = array_merge($notifications, $tmp); } } } else { $notifications = $this->user->getNotifications($folders ? T_FOLDER : T_DOCUMENT); } return $notifications; } /* }}} */ function printFolderNotificationList($notifications, $deleteaction=true) { /* {{{ */ if (count($notifications)==0) { printMLText("empty_notify_list"); } else { print ""; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n\n"; foreach($notifications as $notification) { $fld = $this->dms->getFolder($notification->getTarget()); if (is_object($fld)) { $owner = $fld->getOwner(); print ""; print ""; print "\n"; print ""; print ""; } } print "
".getMLText("name")."".getMLText("owner")."".getMLText("actions")."
getID()."\">" . htmlspecialchars($fld->getName()) . "".htmlspecialchars($owner->getFullName()).""; if ($deleteaction) print " ".getMLText("delete").""; else print "".getMLText("edit").""; print "
"; } } /* }}} */ function printDocumentNotificationList($notifications,$deleteaction=true) { /* {{{ */ if (count($notifications)==0) { printMLText("empty_notify_list"); } else { $previewer = new SeedDMS_Preview_Previewer($this->cachedir, $this->previewwidth, $this->timeout, $this->xsendfile); print ""; print "\n\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n\n"; foreach ($notifications as $notification) { $doc = $this->dms->getDocument($notification->getTarget()); if (is_object($doc)) { $owner = $doc->getOwner(); $latest = $doc->getLatestContent(); $status = $latest->getStatus(); $previewer->createPreview($latest); print "\n"; print ""; print "\n"; print ""; print "\n"; } } print "
".getMLText("name")."".getMLText("status")."".getMLText("action")."
"; if($previewer->hasPreview($latest)) { print "previewwidth."\" src=\"../op/op.Preview.php?documentid=".$doc->getID()."&version=".$latest->getVersion()."&width=".$this->previewwidth."\" title=\"".htmlspecialchars($latest->getMimeType())."\">"; } else { print "previewwidth."\" src=\"".$this->getMimeIcon($latest->getFileType())."\" title=\"".htmlspecialchars($latest->getMimeType())."\">"; } print "getID()."\">" . htmlspecialchars($doc->getName()) . ""; print "
".getMLText('owner').": ".htmlspecialchars($owner->getFullName()).", ".getMLText('creation_date').": ".date('Y-m-d', $doc->getDate()).", ".getMLText('version')." ".$latest->getVersion()." - ".date('Y-m-d', $latest->getDate()).""; $comment = $latest->getComment(); if($comment) { print "
".htmlspecialchars($comment).""; } print "
".getOverallStatusText($status["status"]).""; if ($deleteaction) print " ".getMLText("delete").""; else print "".getMLText("edit").""; print "
"; } } /* }}} */ function js() { /* {{{ */ header('Content-Type: application/javascript'); $this->printFolderChooserJs("form1"); $this->printDocumentChooserJs("form2"); } /* }}} */ function show() { /* {{{ */ $this->dms = $this->params['dms']; $this->user = $this->params['user']; $this->cachedir = $this->params['cachedir']; $this->previewwidth = $this->params['previewWidthList']; $this->db = $this->dms->getDB(); $this->timeout = $this->params['timeout']; $this->xsendfile = $this->params['xsendfile']; $this->htmlStartPage(getMLText("my_account")); $this->globalNavigation(); $this->contentStart(); $this->pageNavigation(getMLText("my_account"), "my_account"); echo "
"; echo "
"; $this->contentHeading(getMLText("edit_folder_notify")); $this->contentContainerStart(); print "
"; $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 ) ); $this->formSubmit(" ".getMLText('add')); print "
"; $this->contentContainerEnd(); echo "
"; echo "
"; $this->contentHeading(getMLText("edit_document_notify")); $this->contentContainerStart(); print "
"; /* 'form1' must be passed to printDocumentChooser() because the typeahead * function is currently hardcoded on this value */ $this->formField(getMLText("choose_target_document"), $this->getDocumentChooserHtml("form2")); $this->formSubmit(" ".getMLText('add')); print "
"; $this->contentContainerEnd(); echo "
"; echo "
"; // // Display the results. // echo "
"; echo "
"; $this->contentHeading(getMLText("user")); $this->contentContainerStart(); $ret=$this->getNotificationList(false,true); $this->printFolderNotificationList($ret); $this->contentContainerEnd(); $this->contentHeading(getMLText("group")); $this->contentContainerStart(); $ret=$this->getNotificationList(true,true); $this->printFolderNotificationList($ret,false); $this->contentContainerEnd(); echo "
"; echo "
"; $this->contentHeading(getMLText("user")); $this->contentContainerStart(); $ret=$this->getNotificationList(false,false); $this->printDocumentNotificationList($ret); $this->contentContainerEnd(); $this->contentHeading(getMLText("group")); $this->contentContainerStart(); $ret=$this->getNotificationList(true,false); $this->printDocumentNotificationList($ret,false); $this->contentContainerEnd(); echo "
"; echo "
"; $this->contentEnd(); $this->htmlEndPage(); } /* }}} */ } ?>