Explorar o código

Ticket #2688
1. Fixes.
2. New alerts.
3. Integration with Notifications.

AntonLV %!s(int64=6) %!d(string=hai) anos
pai
achega
7763c3453d

+ 8 - 6
modules/boonex/tasks/classes/BxTasksConfig.php

@@ -28,7 +28,8 @@ class BxTasksConfig extends BxBaseModTextConfig
 
             // database tables
             'TABLE_ENTRIES' => $aModule['db_prefix'] . 'tasks',
-		    'TABLE_LISTS' => $aModule['db_prefix'] . 'lists',
+            'TABLE_LISTS' => $aModule['db_prefix'] . 'lists',
+            'TABLE_POLLS' => '',
             'TABLE_ENTRIES_FULLTEXT' => 'title_text',
 
             // database fields
@@ -54,9 +55,10 @@ class BxTasksConfig extends BxBaseModTextConfig
             'FIELD_STATUS' => 'status',
             'FIELD_STATUS_ADMIN' => 'status_admin',
             'FIELD_LABELS' => 'labels',
-			'FIELD_TASKLIST' => 'tasks_list',
-			'FIELD_DUEDATE' => 'due_date',
-			'FIELD_COMPLETED' => 'completed',
+            'FIELD_TASKLIST' => 'tasks_list',
+            'FIELD_DUEDATE' => 'due_date',
+            'FIELD_EXPIRED' => 'expired',
+            'FIELD_COMPLETED' => 'completed',
             'FIELD_ANONYMOUS' => 'anonymous',
             'FIELD_DISABLE_COMMENTS' => 'disable_comments',
             'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
@@ -65,8 +67,8 @@ class BxTasksConfig extends BxBaseModTextConfig
              // some params
             'PARAM_MULTICAT_ENABLED' => true,
             'PARAM_MULTICAT_AUTO_ACTIVATION_FOR_CATEGORIES' => 'bx_tasks_auto_activation_for_categories',
-			'PARAM_POLL_ENABLED' => false,
-            
+            'PARAM_POLL_ENABLED' => false,
+
             // page URIs
             'URI_VIEW_ENTRY' => 'view-task',
             'URI_AUTHOR_ENTRIES' => 'tasks-author',

+ 11 - 0
modules/boonex/tasks/classes/BxTasksDb.php

@@ -112,6 +112,17 @@ class BxTasksDb extends BxBaseModTextDb
 
         return $aEntries;
     }
+
+    public function expireEntries()
+    {
+        $CNF = $this->_oConfig->CNF;
+
+        $aResult = $this->getColumn("SELECT `id` FROM `" . $CNF['TABLE_ENTRIES'] . "` WHERE `" . $CNF['FIELD_DUEDATE'] . "` < UNIX_TIMESTAMP()  AND `" . $CNF['FIELD_EXPIRED'] . "` = '0'");
+        if(empty($aResult) || !is_array($aResult))
+            return false;
+
+        return count($aResult) == (int)$this->query("UPDATE `" . $CNF['TABLE_ENTRIES'] . "` SET `" . $CNF['FIELD_EXPIRED'] . "` = '1' WHERE `id` IN (" . $this->implode_escape($aResult) . ")") ? $aResult : false;
+    }
 }
 
 /** @} */

+ 29 - 17
modules/boonex/tasks/classes/BxTasksFormEntry.php

@@ -203,24 +203,36 @@ class BxTasksFormEntry extends BxBaseModTextFormEntry
     	);
     }
 	
-	protected function _setAssignments($iContentId, $aMembers)
+    protected function _setAssignments($iContentId, $aMembers)
     {
-		$CNF = &$this->_oModule->_oConfig->CNF;
-		$oConn = BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTION']);
-		
-		$aMembers2 = $oConn->getConnectedContent($iContentId);
-		
-		$aToAdd = array_diff($aMembers, $aMembers2);
-		$aToRemove = array_diff($aMembers2, $aMembers);
-		
-		foreach($aToAdd as $iProfileId){
-			$oConn->actionAdd($iProfileId, $iContentId);
-		}
-		
-		foreach($aToRemove as $iProfileId){
-			$oConn->actionRemove($iProfileId, $iContentId);
-		}
-	}
+        $CNF = &$this->_oModule->_oConfig->CNF;
+        $oConn = BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTION']);
+
+        $aMembers2 = $oConn->getConnectedContent($iContentId);
+
+        $aToAdd = array_diff($aMembers, $aMembers2);
+        $aToRemove = array_diff($aMembers2, $aMembers);
+
+        $aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId);
+
+        foreach($aToAdd as $iProfileId){
+            $oConn->actionAdd($iProfileId, $iContentId);
+
+            bx_alert($this->MODULE, 'assigned', $iContentId, false, array(
+                'object_author_id' => $iProfileId,
+                'privacy_view' => $aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]
+            ));
+        }
+
+        foreach($aToRemove as $iProfileId){
+            $oConn->actionRemove($iProfileId, $iContentId);
+
+            bx_alert($this->MODULE, 'unassigned', $iContentId, false, array(
+                'object_author_id' => $iProfileId,
+                'privacy_view' => $aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]
+            ));
+        }
+    }
 	
 	protected function genCustomInputInitialMembers ($aInput)
     {

+ 14 - 0
modules/boonex/tasks/classes/BxTasksFormsEntryHelper.php

@@ -17,6 +17,20 @@ class BxTasksFormsEntryHelper extends BxBaseModTextFormsEntryHelper
     {
         parent::__construct($oModule);
     }
+
+    protected function redirectAfterDelete($aContentInfo)
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
+
+        $sUrl = BX_DOL_URL_ROOT;
+        if((int)$aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']] < 0)
+            $sUrl = 'page.php?i=' . $CNF['URI_ENTRIES_BY_CONTEXT'] . '&profile_id=' . abs($aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]);
+
+        $this->_redirectAndExit($sUrl, true, array(
+            'account_id' => getLoggedId(),
+            'profile_id' => bx_get_logged_profile_id(),
+        ));
+    }
 }
 
 /** @} */

+ 140 - 17
modules/boonex/tasks/classes/BxTasksModule.php

@@ -24,7 +24,7 @@ class BxTasksModule extends BxBaseModTextModule implements iBxDolCalendarService
         ));
     }
 	
-	/**
+    /**
     * Action methods
     */
 	
@@ -44,18 +44,39 @@ class BxTasksModule extends BxBaseModTextModule implements iBxDolCalendarService
           
     public function actionSetCompleted($iContentId, $iValue)
     {
-		$CNF = &$this->_oConfig->CNF;
-		$this->_oDb->updateEntriesBy(array($CNF['FIELD_COMPLETED'] => $iValue), array($CNF['FIELD_ID'] => (int)$iContentId));
-		$sActionName = 'completed';
-		if ($iValue == '0')
-			$sActionName = 'reopened';
-		
-		$aContentInfo = $this->_oDb->getContentInfoById($iContentId);
-        $aParams = $this->_alertParams($aContentInfo);
-		
-		bx_alert($this->getName(), $sActionName, $iContentId, $aContentInfo[$CNF['FIELD_AUTHOR']], $aParams);
-		echo 'ok';
-	}
+        $CNF = &$this->_oConfig->CNF;
+
+        $this->_oDb->updateEntriesBy(array($CNF['FIELD_COMPLETED'] => $iValue), array($CNF['FIELD_ID'] => (int)$iContentId));
+
+        $sActionName = 'completed';
+        if($iValue == '0')
+            $sActionName = 'reopened';
+
+        $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
+
+        $iContentAuthor = (int)$aContentInfo[$CNF['FIELD_AUTHOR']];
+        bx_alert($this->getName(), $sActionName, $iContentId, false, array(
+            'object_author_id' => $iContentAuthor,
+            'privacy_view' => $aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]
+        ));
+
+        $oConnection = BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTION']);
+        if($oConnection) {
+            $aProfileIds = $oConnection->getConnectedContent($iContentId);
+            if(!empty($aProfileIds) && is_array($aProfileIds))
+                foreach($aProfileIds as $iProfileId) {
+                    if($iProfileId == $iContentAuthor)
+                        continue;
+
+                    bx_alert($this->getName(), $sActionName, $iContentId, false, array(
+                        'object_author_id' => $iProfileId,
+                        'privacy_view' => $aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]
+                    ));
+                }
+        }
+
+        echo 'ok';
+    }
 	
 	public function actionSetFilterValue($iListId, $sValue)
 	{
@@ -246,10 +267,89 @@ class BxTasksModule extends BxBaseModTextModule implements iBxDolCalendarService
         return $aResult;
     }
 
-	public function serviceIsCompleted($iContentId)
-	{
-		$CNF = &$this->_oConfig->CNF;
-		$aContentInfo = $this->_oDb->getContentInfoById($iContentId);
+    public function serviceGetNotificationsData()
+    {
+        $sModule = $this->_aModule['name'];
+
+        $sEventPrivacy = $sModule . '_allow_view_event_to';
+        if(BxDolPrivacy::getObjectInstance($sEventPrivacy) === false)
+                $sEventPrivacy = '';
+
+        $aResult = parent::serviceGetNotificationsData();
+        $aResult['handlers'] = array_merge($aResult['handlers'], array(
+            array('group' => $sModule . '_completed', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'completed', 'module_name' => $sModule, 'module_method' => 'get_notifications_completed', 'module_class' => 'Module', 'module_event_privacy' => $sEventPrivacy),
+            array('group' => $sModule . '_reopened', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'reopened', 'module_name' => $sModule, 'module_method' => 'get_notifications_reopened', 'module_class' => 'Module', 'module_event_privacy' => $sEventPrivacy),
+            array('group' => $sModule . '_expired', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'expired', 'module_name' => $sModule, 'module_method' => 'get_notifications_expired', 'module_class' => 'Module', 'module_event_privacy' => $sEventPrivacy),
+
+            array('group' => $sModule . '_assign', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'assigned', 'module_name' => $sModule, 'module_method' => 'get_notifications_assigned', 'module_class' => 'Module', 'module_event_privacy' => $sEventPrivacy),
+            array('group' => $sModule . '_assign', 'type' => 'delete', 'alert_unit' => $sModule, 'alert_action' => 'unassigned'),
+        ));
+
+        $aResult['settings'] = array_merge($aResult['settings'], array(
+            array('group' => 'content', 'unit' => $sModule, 'action' => 'completed', 'types' => array('personal', 'follow_member', 'follow_context')),
+            array('group' => 'content', 'unit' => $sModule, 'action' => 'reopened', 'types' => array('personal', 'follow_member', 'follow_context')),
+            array('group' => 'content', 'unit' => $sModule, 'action' => 'expired', 'types' => array('personal')),
+            array('group' => 'content', 'unit' => $sModule, 'action' => 'assigned', 'types' => array('personal')),
+        ));
+
+        $aResult['alerts'] = array_merge($aResult['alerts'], array(
+            array('unit' => $sModule, 'action' => 'completed'),
+            array('unit' => $sModule, 'action' => 'reopened'),
+            array('unit' => $sModule, 'action' => 'expired'),
+
+            array('unit' => $sModule, 'action' => 'assigned'),
+            array('unit' => $sModule, 'action' => 'unassigned'),
+        ));
+
+        return $aResult; 
+    }
+
+    public function serviceGetNotificationsCompleted($aEvent)
+    {
+        return $this->_serviceGetNotificationsByAction($aEvent, 'completed');
+    }
+
+    public function serviceGetNotificationsReopened($aEvent)
+    {
+        return $this->_serviceGetNotificationsByAction($aEvent, 'reopened');
+    }
+
+    public function serviceGetNotificationsExpired($aEvent)
+    {
+        return $this->_serviceGetNotificationsByAction($aEvent, 'expired');
+    }
+
+    public function serviceGetNotificationsAssigned($aEvent)
+    {
+        return $this->_serviceGetNotificationsByAction($aEvent, 'assigned');
+    }
+
+    protected function _serviceGetNotificationsByAction($aEvent, $sAction)
+    {
+        $CNF = &$this->_oConfig->CNF;
+
+        $aResult = parent::serviceGetNotificationsPost($aEvent);
+        if(empty($aResult) || !is_array($aResult))
+            return $aResult;
+
+        $aResult['entry_author'] = $aEvent['object_owner_id'];
+        $aResult['entry_author_name'] = '';
+        if(($oAuthor = BxDolProfile::getInstance($aResult['entry_author'])) !== false)
+            $aResult['entry_author_name'] = $oAuthor->getDisplayName();
+
+        $sLangKey = '_bx_tasks_txt_notification_' . $sAction;
+        if((int)$aEvent['object_privacy_view'] < 0)
+            $sLangKey .= '_in_context';
+
+        $aResult['lang_key'] = _t($sLangKey);
+        return $aResult;
+    }
+
+    public function serviceIsCompleted($iContentId)
+    {
+        $CNF = &$this->_oConfig->CNF;
+
+        $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
         return $aContentInfo[$CNF['FIELD_COMPLETED']] ? false: true;
     }
 	
@@ -441,6 +541,29 @@ class BxTasksModule extends BxBaseModTextModule implements iBxDolCalendarService
     	));
 		return $this->_oTemplate->getJsCode('tasks') . $this->_oTemplate->parseHtmlByName('browse_tasks.html', $aVars);
     }
+
+    /**
+    * Common methods
+    */
+    public function onExpired($iContentId)
+    {
+        $CNF = &$this->_oConfig->CNF;
+
+        $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
+        if(!$aContentInfo)
+            return;
+
+        $oConnection = BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTION']);
+        if($oConnection) {
+            $aProfileIds = $oConnection->getConnectedContent($iContentId);
+            if(!empty($aProfileIds) && is_array($aProfileIds))
+                foreach($aProfileIds as $iProfileId)
+                    bx_alert($this->getName(), 'expired', $iContentId, false, array(
+                        'object_author_id' => $iProfileId,
+                        'privacy_view' => $aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]
+                    ));
+        }
+    }
 }
 
 /** @} */

+ 28 - 7
modules/boonex/tasks/install/langs/en.xml

@@ -23,6 +23,8 @@
     <string name="_bx_tasks_form_entry_input_do_submit"><![CDATA[Submit]]></string>
     <string name="_bx_tasks_form_entry_input_sys_do_publish"><![CDATA[Publish]]></string>
     <string name="_bx_tasks_form_entry_input_do_publish"><![CDATA[Publish]]></string>
+    <string name="_bx_tasks_form_entry_input_sys_do_cancel"><![CDATA[Cancel]]></string>
+    <string name="_bx_tasks_form_entry_input_do_cancel"><![CDATA[Cancel]]></string>
     <string name="_bx_tasks_form_entry_input_sys_title"><![CDATA[Title]]></string>
     <string name="_bx_tasks_form_entry_input_title"><![CDATA[Title]]></string>
     <string name="_bx_tasks_form_entry_input_title_err"><![CDATA[Title is essential. Please, fill in this field]]></string>
@@ -307,8 +309,8 @@
     <string name="_bx_tasks_txt_all_entries_by"><![CDATA[{0} tasks]]></string>
     <string name="_bx_tasks_txt_sample_single"><![CDATA[task]]></string>
     <string name="_bx_tasks_txt_sample_single_with_article"><![CDATA[a task]]></string>
-	<string name="_bx_tasks_txt_action_completed"><![CDATA[completed]]></string>
-	<string name="_bx_tasks_txt_action_reopened"><![CDATA[reopened]]></string>
+    <string name="_bx_tasks_txt_action_completed"><![CDATA[completed]]></string>
+    <string name="_bx_tasks_txt_action_reopened"><![CDATA[reopened]]></string>
     <string name="_bx_tasks_txt_sample_comment_single"><![CDATA[comment to task]]></string>
     <string name="_bx_tasks_txt_sample_vote_single"><![CDATA[vote to task]]></string>
     <string name="_bx_tasks_txt_sample_reaction_single"><![CDATA['{0}' reaction to task]]></string>
@@ -318,10 +320,29 @@
     <string name="_bx_tasks_txt_processing_failed"><![CDATA[Task isn't published because video conversion failed, edit video to fix the issue.]]></string>
     <string name="_bx_tasks_txt_scheduled_awaiting"><![CDATA[Task publishing date is {date_publish_uf}]]></string>
 	
-	<string name="_bx_tasks_txt_new_task_list"><![CDATA[New TaskList]]></string>
-	<string name="_bx_tasks_txt_new_task"><![CDATA[New Task]]></string>
-	<string name="_bx_tasks_txt_filter_all"><![CDATA[All Tasks]]></string>
-	<string name="_bx_tasks_txt_filter_completed"><![CDATA[Completed Tasks]]></string>
-	<string name="_bx_tasks_txt_filter_uncompleted"><![CDATA[Uncompleted Tasks]]></string>
+    <string name="_bx_tasks_txt_new_task_list"><![CDATA[New TaskList]]></string>
+    <string name="_bx_tasks_txt_new_task"><![CDATA[New Task]]></string>
+    <string name="_bx_tasks_txt_filter_all"><![CDATA[All Tasks]]></string>
+    <string name="_bx_tasks_txt_filter_completed"><![CDATA[Completed Tasks]]></string>
+    <string name="_bx_tasks_txt_filter_uncompleted"><![CDATA[Uncompleted Tasks]]></string>
     <string name="_bx_tasks_txt_err_cannot_perform_action"><![CDATA[Cannot perform action. Please report.]]></string>
+
+    <!-- Notifications -->
+    <string name="_bx_tasks_alert_action_completed_personal"><![CDATA[Complete task]]></string>
+    <string name="_bx_tasks_alert_action_completed_follow_member"><![CDATA[Complete task]]></string>
+    <string name="_bx_tasks_alert_action_completed_follow_context"><![CDATA[Complete task]]></string>
+    <string name="_bx_tasks_alert_action_reopened_personal"><![CDATA[Reopen task]]></string>
+    <string name="_bx_tasks_alert_action_reopened_follow_member"><![CDATA[Reopen task]]></string>
+    <string name="_bx_tasks_alert_action_reopened_follow_context"><![CDATA[Reopen task]]></string>
+    <string name="_bx_tasks_alert_action_expired_personal"><![CDATA[Expire task]]></string>
+    <string name="_bx_tasks_alert_action_assigned_personal"><![CDATA[Assign task]]></string>
+
+    <string name="_bx_tasks_txt_notification_completed"><![CDATA[<b class="bx-ntfs-content-entry">{entry_caption}</b> {entry_sample} was completed]]></string>
+    <string name="_bx_tasks_txt_notification_completed_in_context"><![CDATA[<b class="bx-ntfs-content-profile">{owner_name}</b>'s {entry_sample} <b class="bx-ntfs-content-entry">{entry_caption}</b> was completed]]></string>
+    <string name="_bx_tasks_txt_notification_reopened"><![CDATA[<b class="bx-ntfs-content-entry">{entry_caption}</b> {entry_sample} was reopened]]></string>
+    <string name="_bx_tasks_txt_notification_reopened_in_context"><![CDATA[<b class="bx-ntfs-content-profile">{owner_name}</b>'s {entry_sample} <b class="bx-ntfs-content-entry">{entry_caption}</b> was reopened]]></string>
+    <string name="_bx_tasks_txt_notification_expired"><![CDATA[<b class="bx-ntfs-content-entry">{entry_caption}</b> {entry_sample} expired]]></string>
+    <string name="_bx_tasks_txt_notification_expired_in_context"><![CDATA[<b class="bx-ntfs-content-profile">{owner_name}</b>'s {entry_sample} <b class="bx-ntfs-content-entry">{entry_caption}</b> expired]]></string>
+    <string name="_bx_tasks_txt_notification_assigned"><![CDATA[<b class="bx-ntfs-content-entry">{entry_caption}</b> {entry_sample} was assigned to <b class="bx-ntfs-content-profile">{entry_author_name}</b>]]></string>
+    <string name="_bx_tasks_txt_notification_assigned_in_context"><![CDATA[<b class="bx-ntfs-content-profile">{owner_name}</b>'s {entry_sample} <b class="bx-ntfs-content-entry">{entry_caption}</b> was assigned to <b class="bx-ntfs-content-profile">{entry_author_name}</b>]]></string>
 </resources>

+ 2 - 1
modules/boonex/tasks/install/sql/enable.sql

@@ -318,4 +318,5 @@ INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
 
 -- CRON
 INSERT INTO `sys_cron_jobs` (`name`, `time`, `class`, `file`, `service_call`) VALUES
-('bx_tasks_publishing', '* * * * *', 'BxTasksCronPublishing', 'modules/boonex/tasks/classes/BxTasksCronPublishing.php', '');
+('bx_tasks_publishing', '* * * * *', 'BxTasksCronPublishing', 'modules/boonex/tasks/classes/BxTasksCronPublishing.php', ''),
+('bx_tasks_expiring', '* * * * *', 'BxTasksCronExpiring', 'modules/boonex/tasks/classes/BxTasksCronExpiring.php', '');

+ 6 - 3
modules/boonex/tasks/install/sql/install.sql

@@ -26,6 +26,7 @@ CREATE TABLE IF NOT EXISTS `bx_tasks_tasks` (
   `due_date` int(11) NOT NULL,
   `tasks_list` int(11) NOT NULL,	
   `completed` tinyint(4) NOT NULL DEFAULT '0', 
+  `expired` tinyint(4) NOT NULL DEFAULT '0', 
   `allow_view_to` varchar(16) NOT NULL DEFAULT '3',
   `disable_comments` tinyint(4) NOT NULL DEFAULT '0',
   `status` enum('active','awaiting','failed','hidden') NOT NULL DEFAULT 'active',
@@ -360,6 +361,8 @@ INSERT INTO `sys_form_inputs`(`object`, `module`, `name`, `value`, `values`, `ch
 ('bx_tasks', 'bx_tasks', 'delete_confirm', 1, '', 0, 'checkbox', '_bx_tasks_form_entry_input_sys_delete_confirm', '_bx_tasks_form_entry_input_delete_confirm', '_bx_tasks_form_entry_input_delete_confirm_info', 1, 0, 0, '', '', '', 'Avail', '', '_bx_tasks_form_entry_input_delete_confirm_error', '', '', 1, 0),
 ('bx_tasks', 'bx_tasks', 'do_publish', '_bx_tasks_form_entry_input_do_publish', '', 0, 'submit', '_bx_tasks_form_entry_input_sys_do_publish', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
 ('bx_tasks', 'bx_tasks', 'do_submit', '_bx_tasks_form_entry_input_do_submit', '', 0, 'submit', '_bx_tasks_form_entry_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
+('bx_tasks', 'bx_tasks', 'do_cancel', '_bx_tasks_form_entry_input_do_cancel', '', 0, 'button', '_bx_tasks_form_entry_input_sys_do_cancel', '', '', 0, 0, 0, 'a:2:{s:7:"onclick";s:45:"$(''.bx-popup-applied:visible'').dolPopupHide()";s:5:"class";s:22:"bx-def-margin-sec-left";}', '', '', '', '', '', '', '', 1, 0),
+('bx_tasks', 'bx_tasks', 'controls', '', 'do_publish,do_cancel', 0, 'input_set', '', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
 ('bx_tasks', 'bx_tasks', 'covers', 'a:1:{i:0;s:14:"bx_tasks_html5";}', 'a:2:{s:15:"bx_tasks_simple";s:26:"_sys_uploader_simple_title";s:14:"bx_tasks_html5";s:25:"_sys_uploader_html5_title";}', 0, 'files', '_bx_tasks_form_entry_input_sys_covers', '_bx_tasks_form_entry_input_covers', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
 ('bx_tasks', 'bx_tasks', 'pictures', 'a:1:{i:0;s:21:"bx_tasks_photos_html5";}', 'a:2:{s:22:"bx_tasks_photos_simple";s:26:"_sys_uploader_simple_title";s:21:"bx_tasks_photos_html5";s:25:"_sys_uploader_html5_title";}', 0, 'files', '_bx_tasks_form_entry_input_sys_pictures', '_bx_tasks_form_entry_input_pictures', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
 ('bx_tasks', 'bx_tasks', 'videos', 'a:1:{i:0;s:21:"bx_tasks_videos_html5";}', 'a:2:{s:22:"bx_tasks_videos_simple";s:26:"_sys_uploader_simple_title";s:21:"bx_tasks_videos_html5";s:25:"_sys_uploader_html5_title";}', 0, 'files', '_bx_tasks_form_entry_input_sys_videos', '_bx_tasks_form_entry_input_videos', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
@@ -378,15 +381,15 @@ INSERT INTO `sys_form_inputs`(`object`, `module`, `name`, `value`, `values`, `ch
 ('bx_tasks', 'bx_tasks', 'anonymous', '', '', 0, 'switcher', '_sys_form_input_sys_anonymous', '_sys_form_input_anonymous', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
 ('bx_tasks', 'bx_tasks', 'disable_comments', '1', '', 0, 'switcher', '_bx_tasks_form_entry_input_sys_disable_comments', '_bx_tasks_form_entry_input_disable_comments', '', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0);
 
-
-
 INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES 
 ('bx_tasks_entry_add', 'delete_confirm', 2147483647, 0, 1),
 ('bx_tasks_entry_add', 'title', 2147483647, 1, 2),
 ('bx_tasks_entry_add', 'text', 2147483647, 1, 3),
 ('bx_tasks_entry_add', 'initial_members', 192, 1, 4),
 ('bx_tasks_entry_add', 'due_date', 192, 1, 5),
-('bx_tasks_entry_add', 'do_publish', 2147483647, 1, 6),
+('bx_tasks_entry_add', 'controls', 2147483647, 1, 6),
+('bx_tasks_entry_add', 'do_publish', 2147483647, 1, 7),
+('bx_tasks_entry_add', 'do_cancel', 2147483647, 1, 8),
 
 ('bx_tasks_entry_delete', 'delete_confirm', 2147483647, 1, 1),
 ('bx_tasks_entry_delete', 'do_submit', 2147483647, 1, 2),

+ 2 - 1
modules/boonex/tasks/js/tasks.js

@@ -48,7 +48,8 @@ BxTasksView.prototype.processTask = function (iContextId, iListId) {
     var $this = this;
 	$(window).dolPopupAjax({
         url: $this._sActionsUri + 'process_task_form/' + iContextId + '/' + iListId + '/' ,
-        closeOnOuterClick: false
+        closeOnOuterClick: false,
+        removeOnClose: true
     });   
 }