コード例 #1
0
 /**
  * Notify member about file/folder sharing
  */
 public static function notifyFileShare($args)
 {
     try {
         if (strcasecmp($args['itemType'], 'file') == 0 || strcasecmp($args['itemType'], 'folder') == 0) {
             $content = 'A ' . $args['itemType'] . ' has been shared with you at location /Shared' . $args['fileTarget'];
             OC_Collaboration_Post::createPost('File Shared', $content, $args['uidOwner'], NULL, 'File Share', array($args['shareWith']));
             OC_Log::write('collaboration', 'File share notification posted.', OCP\Util::INFO);
         }
     } catch (\Exception $e) {
         OC_Log::write('collaboration', __METHOD__ . ', Exception: ' . $e->getMessage(), OCP\Util::DEBUG);
         return false;
     }
 }
コード例 #2
0
 /**
  * @brief Delete a member from a role of a project
  * @param Project ID from which the role has to be removed
  * @param Member whose role has to be removed
  * @param Role to be removed
  * @param Member who removed the other member from his/her role
  * @param Whether the calling method has already initiated the (database) transaction
  * @return int|boolean (ID of the post intimating the role removal|false)
  */
 public static function deleteMemberRole($pid, $member, $role, $user, $inTransaction = false)
 {
     try {
         if (!$inTransaction) {
             \OCP\DB::beginTransaction();
         }
         // Remove from all roles
         if (is_null($pid) && is_null($role)) {
             $query = \OCP\DB::prepare('DELETE FROM `*PREFIX*collaboration_works_on` WHERE `member`=?');
             $result = $query->execute(array($member));
         } else {
             $query = \OCP\DB::prepare('DELETE FROM `*PREFIX*collaboration_works_on` WHERE `pid`=? AND `member`=? AND `role`=?');
             $result = $query->execute(array($pid, $member, $role));
         }
         // Member removed from owncloud
         if (is_null($pid)) {
             OC_Collaboration_Task::removeMembersTasks($member, $user, true);
         } else {
             if (!self::isMemberWorkingOnProject($member, $pid)) {
                 OC_Collaboration_Task::unassignMembersTasks($member, $pid, $user, true);
             }
         }
         $post_id = OC_Collaboration_Post::createPost('Removed from role', 'You are removed from \'' . $role . '\' role from project \'' . self::getProjectTitle($pid) . '\'.', $user, $pid, 'Role Deletion', array($member), true);
         if (!$inTransaction) {
             \OCP\DB::commit();
         }
         return $post_id;
     } catch (\Exception $e) {
         OC_Log::write('collaboration', __METHOD__ . ', Exception: ' . $e->getMessage(), OCP\Util::DEBUG);
         return false;
     }
 }
コード例 #3
0
 /**
  * @brief Changes the status of the task
  * @param Title ID
  * @param Title of the task
  * @param Task modified status
  * @param Member who created the task
  * @param Member who modified the task status
  * @param Reason for status change
  * @param Whether the calling method has already initiated the (database) transaction
  * @return boolean (true|false)
  */
 public static function changeStatus($tid, $title, $status, $creator, $member = NULL, $reason = NULL, $inTransaction = false)
 {
     try {
         if (!$inTransaction) {
             \OCP\DB::beginTransaction();
         }
         if (strcmp($status, 'Unassigned') == 0) {
             $member = NULL;
         } else {
             $member = self::getWorkingMember($tid);
         }
         $query = OCP\DB::prepare('INSERT INTO `*PREFIX*collaboration_task_status`(`tid`, `status`, `member`, `reason`, `last_updated_time`) VALUES(?, ?, ?, ?, CURRENT_TIMESTAMP)');
         $result = $query->execute(array($tid, $status, $member, $reason));
         $post_to = array();
         if (is_null($member)) {
             $post_to = array(self::getTaskCreator($tid));
         } else {
             $post_to = array(self::getTaskCreator($tid), $member);
         }
         OC_Collaboration_Post::createPost('Task Status Changed', 'The status of the task \'' . $title . '\' has been changed. Current status: ' . self::getStatusInFormat($status, $member, self::getTaskCreator($tid)) . '.', $creator, self::getProjectId($tid), 'Task Status Updation', $post_to, true, $tid);
         if (!$inTransaction) {
             \OCP\DB::commit();
         }
     } catch (\Exception $e) {
         OC_Log::write('collaboration', __METHOD__ . ', Exception: ' . $e->getMessage(), OCP\Util::DEBUG);
         return false;
     }
     return true;
 }
コード例 #4
0
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
\OCP\User::checkLoggedIn();
\OCP\App::checkAppEnabled('collaboration');
OCP\App::setActiveNavigationEntry('collaboration');
OCP\Util::addScript('collaboration', 'display_message');
OCP\Util::addStyle('collaboration', 'tabs');
OCP\Util::addStyle('collaboration', 'content_header');
OCP\Util::addStyle('collaboration', 'display_message');
$l = OC_L10N::get('collaboration');
$tpl = new OCP\Template('collaboration', 'display_message', 'user');
$tpl->assign('title', $l->t('Loading...'));
$tpl->assign('msg', $l->t('Creating notification \'%s\'. Please be patient.', array($_POST['title'])));
$tpl->printPage();
if (!isset($_POST['post_to_all'])) {
    $members = is_array($_POST['notify_to']) ? $_POST['notify_to'] : array($_POST['notify_to']);
    $status = OC_Collaboration_Post::createPost($_POST['title'], $_POST['content'], OC_User::getUser(), $_POST['pid'], 'Custom Post', $members);
} else {
    $status = OC_Collaboration_Post::createPost($_POST['title'], $_POST['content'], OC_User::getUser(), $_POST['pid'], 'Custom Post');
}
print_unescaped('<META HTTP-EQUIV="Refresh" Content="0; URL=' . \OCP\Util::linkToRoute('collaboration_route', array('rel_path' => 'submit_new_notification')) . '?title=' . $_POST['title'] . '">');