| 
		
	
	
	
		
	Posts: 11 
	Threads: 6 
	Joined: Oct 2010
	
 Reputation: 
0 
	
	
		In an old post I saw that notification list inheritance was introduced in version 1.9. I'm running version 3.01, but it seems it doesn't work?
 What am I missing?
 
 Thank you very much.
 
 Franco
 
	
	
	
		
	Posts: 431 
	Threads: 15 
	Joined: Oct 2010
	
 Reputation: 
0 
	
	
		 (10-21-2011, 08:33 PM)f_lombardo Wrote:  In an old post I saw that notification list inheritance was introduced in version 1.9. I'm running version 3.01, but it seems it doesn't work?
 What am I missing?
 
That was before I entered the project. From looking at the source files I can't see any inheritance. 
But that would really be a nice feature.
 
  Uwe
	 
	
	
	
		
	Posts: 11 
	Threads: 6 
	Joined: Oct 2010
	
 Reputation: 
0 
	
	
		 (10-22-2011, 01:02 AM)steinm Wrote:  But that would really be a nice feature. 
I tried to do it this way.
 
In inc.ClassFolder.php I created this method
 Code:     function propagateNotifier($newElement) {$this->getNotifyList();
 foreach ($this->_notifyList["groups"] as $grp) {
 $newElement->addNotify($grp->getID(), false);
 }
 foreach ($this->_notifyList["users"] as $usr) {
 $newElement->addNotify($usr->getID(), true);
 }
 }
Then I changed these methods 
 Code:     function addSubFolder($name, $comment, $owner, $sequence) { /* {{{ */$db = $this->_dms->getDB();
 
 //inheritAccess = true, defaultAccess = M_READ
 $queryStr = "INSERT INTO tblFolders (name, parent, comment, date, owner, inheritAccess, defaultAccess, sequence) ".
 "VALUES ('".$name."', ".$this->_id.", '".$comment."', ".mktime().", ".$owner->getID().", 1, ".M_READ.", ".$sequence.")";
 if (!$db->getResult($queryStr))
 return false;
 $newFolder = $this->_dms->getFolder($db->getInsertID());
 //MY CHANGHE HERE
 $this->propagateNotifier($newFolder);
 unset($this->_subFolders);
 
 return $newFolder;
 } /* }}} */
 
 function addDocument($name, $comment, $expires, $owner, $keywords, $tmpFile, $orgFileName, $fileType, $mimeType, $sequence, $reviewers=array(), $approvers=array(),$reqversion,$version_comment="") { /* {{{ */
 $db = $this->_dms->getDB();
 
 $expires = (!$expires) ? 0 : $expires;
 
 // Must also ensure that the document has a valid folderList.
 $pathPrefix="";
 $path = $this->getPath();
 foreach ($path as $f) {
 $pathPrefix .= ":".$f->getID();
 }
 if (strlen($pathPrefix)>1) {
 $pathPrefix .= ":";
 }
 
 $queryStr = "INSERT INTO tblDocuments (name, comment, date, expires, owner, folder, folderList, inheritAccess, defaultAccess, locked, keywords, sequence) VALUES ".
 "('".$name."', '".$comment."', " . mktime().", ".$expires.", ".$owner->getID().", ".$this->_id.",'".$pathPrefix."', 1, ".M_READ.", -1, '".$keywords."', " . $sequence . ")";
 if (!$db->getResult($queryStr))
 return false;
 
 $document = $this->_dms->getDocument($db->getInsertID());
 
 if ($version_comment!="")
 $res = $document->addContent($version_comment, $owner, $tmpFile, $orgFileName, $fileType, $mimeType, $reviewers, $approvers,$reqversion);
 else $res = $document->addContent($comment, $owner, $tmpFile, $orgFileName, $fileType, $mimeType, $reviewers, $approvers,$reqversion);
 
 if (is_bool($res) && !$res) {
 $queryStr = "DELETE FROM tblDocuments WHERE id = " . $document->getID();
 $db->getResult($queryStr);
 return false;
 }
 //MY CHANGE HERE
 $this->propagateNotifier($document);
 
 return array($document, $res);
 } /* }}} */
In op.FolderNotify.php I created this function
 Code: function add_folder_notify($folder, $userid, $isUser) {global $dms;
 
 $folder->addNotify($userid, $isUser);
 
 
 // include all folder's document
 
 $documents = $folder->getDocuments();
 $documents = LetoDMS_Core_DMS::filterAccess($documents, $dms->getUser($userid), M_READ);
 
 foreach($documents as $document)
 $document->addNotify($userid, $isUser);
 
 // recurse all folder's folders
 
 $subFolders = $folder->getSubFolders();
 $subFolders = LetoDMS_Core_DMS::filterAccess($subFolders, $dms->getUser($userid), M_READ);
 
 foreach($subFolders as $subFolder)
 add_folder_notify($subFolder,$userid,$isUser);
 }
Then I called it ...
 Code: else if ($action == "addnotify") {if ($userid != -1) {
 //...
 case 0:
 add_folder_notify($folder, $userid, true);
 //....
 if ($groupid != -1) {
 //...
 case 0:
 add_folder_notify($folder, $groupid, false);
By the way, is the file op.ManageNotify.php still used anywhere?
 
Thanks.
 
Bye
 
Franco
	 
	
	
	
		
	Posts: 431 
	Threads: 15 
	Joined: Oct 2010
	
 Reputation: 
0 
	
	
		 (10-24-2011, 05:02 PM)f_lombardo Wrote:  By the way, is the file op.ManageNotify.php still used anywhere? 
Thanks for your implementation. I'll see if I can integrate it.
 
op.ManageNotify.php isn't used for some time.
 
  Uwe
	 |