Browse Source

Ticket #5425 - Tasks: Functionality improvements. Stage 2.

AntonLV 3 months ago
parent
commit
5fd862d195

+ 9 - 1
inc/classes/BxDolReport.php

@@ -342,7 +342,15 @@ class BxDolReport extends BxDolObject
 
     protected function _getFormObject()
     {
-        return BxDolForm::getObjectInstance($this->_sFormObject, $this->_sFormDisplayPost);
+        $oForm = BxDolForm::getObjectInstance($this->_sFormObject, $this->_sFormDisplayPost);
+        $oForm->setId($this->_aHtmlIds['do_form']);
+        $oForm->setName($this->_aHtmlIds['do_form']);
+        $oForm->aParams['db']['table'] = $this->_aSystem['table_track'];
+        $oForm->aInputs['sys']['value'] = $this->_sSystem;
+        $oForm->aInputs['object_id']['value'] = $this->_iId;
+        $oForm->aInputs['action']['value'] = 'Report';
+
+        return $oForm;
     }
 }
 

+ 19 - 16
inc/js/classes/BxDolReport.js

@@ -20,6 +20,7 @@ function BxDolReport(options)
     this._iAnimationSpeed = 'slow';
     this._sSP = options.sStylePrefix == undefined ? 'bx-report' : options.sStylePrefix;
     this._aHtmlIds = options.aHtmlIds;
+    this._oRequestParams = options.oRequestParams == undefined ? {} : options.oRequestParams;
     this._sUnreportConfirm = options.sUnreportConfirm == undefined ? _t('_Are_you_sure') : options.sUnreportConfirm;
 
     this._oParent = null;
@@ -139,33 +140,35 @@ BxDolReport.prototype.processJson = function(oData, oElement) {
 };
 
 BxDolReport.prototype._getButtons = function(oElement) {
-	if($(oElement).hasClass(this._sSP))
-		return $(oElement).find('.' + this._sSP + '-button');
-	else
-		return $(oElement).parents('.' + this._sSP + ':first').find('.' + this._sSP + '-button');
+    if($(oElement).hasClass(this._sSP))
+        return $(oElement).find('.' + this._sSP + '-button');
+    else
+        return $(oElement).parents('.' + this._sSP + ':first').find('.' + this._sSP + '-button');
 };
 
 BxDolReport.prototype._getCounter = function(oElement) {
-	if($(oElement).hasClass(this._sSP))
-		return $(oElement).find('.' + this._sSP + '-counter');
-	else 
-		return $(oElement).parents('.' + this._sSP + ':first').find('.' + this._sSP + '-counter');
+    if($(oElement).hasClass(this._sSP))
+        return $(oElement).find('.' + this._sSP + '-counter');
+    else 
+        return $(oElement).parents('.' + this._sSP + ':first').find('.' + this._sSP + '-counter');
 };
 
 BxDolReport.prototype._loadingInButton = function(e, bShow) {
-	if($(e).length)
-		bx_loading_btn($(e), bShow);
-	else
-		bx_loading($('body'), bShow);	
+    if($(e).length)
+        bx_loading_btn($(e), bShow);
+    else
+        bx_loading($('body'), bShow);	
 };
 
 BxDolReport.prototype._getDefaultParams = function() {
-	var oDate = new Date();
-    return {
+    var oDate = new Date();
+
+    return jQuery.extend({
         sys: this._sSystem,
-        object_id: this._iObjId,
+        object_id: this._iObjId
+    }, this._oRequestParams, {
         _t: oDate.getTime()
-    };
+    });
 };
 
 /** @} */

+ 15 - 1
modules/boonex/tasks/classes/BxTasksCmts.php

@@ -68,6 +68,20 @@ class BxTasksCmts extends BxTemplCmts
         return parent::getComment($aCmt, $aBp, $aDp);
     }
 
+    public function getDataAPI($aData, $aParams = [])
+    {
+        $aResult = parent::getDataAPI($aData, $aParams);
+
+        if($this->_isAutoComment($aData)) {
+            if(isset($aResult['cmt_text']))
+                $aResult['cmt_text'] = $this->_getAutoCommentText($aResult['cmt_text'], $aData['cmt_time']);
+
+            unset($aResult['menu_actions'], $aResult['menu_manage']);
+        }
+
+        return $aResult;
+    }
+
     protected function _getHeaderBox(&$aCmt, $aBp = [], $aDp = [])
     {
         return !$this->_isAutoComment($aCmt) ? parent::_getHeaderBox($aCmt, $aBp, $aDp) : '';
@@ -132,7 +146,7 @@ class BxTasksCmts extends BxTemplCmts
         }
 
         if($iDate !== false)
-            $sText = _t('_bx_tasks_txt_msg_format', $sText, bx_time_js((int)$iDate, BX_FORMAT_DATE, true));
+            $sText = _t('_bx_tasks_txt_msg_format', $sText, $this->_bIsApi ? bx_process_output((int)$iDate, BX_DATA_DATE_TS) : bx_time_js((int)$iDate, BX_FORMAT_DATE, true));
 
         return $sText;
     }

+ 4 - 5
modules/boonex/tasks/classes/BxTasksMenuBrowse.php

@@ -16,8 +16,6 @@ class BxTasksMenuBrowse extends BxTemplMenu
     protected $_iProfileId;
 
     protected $_oPermalink;
-    protected $_sPageLink;
-    protected $_aPageParams;
 
     protected $_sParamName;
     protected $_iParamValue;
@@ -34,7 +32,6 @@ class BxTasksMenuBrowse extends BxTemplMenu
         $this->_iProfileId = 0;
 
         $this->_oPermalink = BxDolPermalinks::getInstance();
-        list($this->_sPageLink, $this->_aPageParams) = bx_get_base_url_inline();
 
         $this->_sParamName = 'context_pid';
         if(($iParamValue = bx_get($this->_sParamName)) !== false)
@@ -73,6 +70,8 @@ class BxTasksMenuBrowse extends BxTemplMenu
 
     protected function _getMenuSubitems($iProfile, $sContextModule)
     {
+        $CNF = $this->_oModule->_oConfig->CNF;
+
         $aIds = $this->_oModule->_oDb->getContextsIdsByType($sContextModule, $iProfile);
 
         $aSubmenu = [];
@@ -81,9 +80,9 @@ class BxTasksMenuBrowse extends BxTemplMenu
             if(!$oContext)
                 continue;
 
-            $sUrl = $this->_oPermalink->permalink(bx_append_url_params($this->_sPageLink, array_merge($this->_aPageParams, [
+            $sUrl = $this->_oPermalink->permalink($CNF['URL_HOME'], [
                 $this->_sParamName => $iId
-            ])));
+            ]);
 
             $aSubmenu[] = [
                 'id' => 'context-' . $iId, 

+ 13 - 1
modules/boonex/tasks/classes/BxTasksMenuTimer.php

@@ -54,13 +54,16 @@ class BxTasksMenuTimer extends BxTemplMenuCustom
         if($aTimer && is_array($aTimer)) {
             if((int)$aTimer['started'] > 0)
                 $aItems = [
-                    ['name' => 'stop', 'class' => '', 'link' => 'javascript:void(0)', 'onclick' => 'javascript:' . $sJsObject . '.stop(this, ' . $this->_iContentId . ', ' . $this->_iProfileId . ')', 'target' => '_self', 'title' => _t('_bx_tasks_txt_timer_stop')],
+                    ['name' => 'pause', 'class' => '', 'link' => 'javascript:void(0)', 'onclick' => 'javascript:' . $sJsObject . '.pause(this, ' . $this->_iContentId . ', ' . $this->_iProfileId . ')', 'target' => '_self', 'title' => _t('_bx_tasks_txt_timer_pause')],
+                    ['name' => 'log', 'class' => '', 'link' => '', 'onclick' => '', 'target' => '', 'title' => ''],
+                    ['name' => 'edit-and-log', 'class' => '', 'link' => '', 'onclick' => '', 'target' => '', 'title' => ''],
                 ];
             else
                 $aItems = [
                     ['name' => 'resume', 'class' => '', 'link' => 'javascript:void(0)', 'onclick' => 'javascript:' . $sJsObject . '.resume(this, ' . $this->_iContentId . ', ' . $this->_iProfileId . ')', 'target' => '_self', 'title' => _t('_bx_tasks_txt_timer_resume')],
                     ['name' => 'clear', 'class' => '', 'link' => 'javascript:void(0)', 'onclick' => 'javascript:' . $sJsObject . '.clear(this, ' . $this->_iContentId . ', ' . $this->_iProfileId . ')', 'target' => '_self', 'title' => _t('_bx_tasks_txt_timer_clear')],
                     ['name' => 'log', 'class' => '', 'link' => '', 'onclick' => '', 'target' => '', 'title' => ''],
+                    ['name' => 'edit-and-log', 'class' => '', 'link' => '', 'onclick' => '', 'target' => '', 'title' => ''],
                 ];
         }
         else {
@@ -108,10 +111,19 @@ class BxTasksMenuTimer extends BxTemplMenuCustom
     protected function _getMenuItemLog($aItem)
     {
         return $this->_getMenuItemTime($aItem, [
+            'uniq_id' => genRndPwd(3, false),
+            'show_do_report_form' => false,
             'do_report_label' => '_bx_tasks_txt_timer_log'
         ]);
     }
 
+    protected function _getMenuItemEditAndLog($aItem)
+    {
+        return $this->_getMenuItemTime($aItem, [
+            'do_report_label' => '_bx_tasks_txt_timer_edit_and_log'
+        ]);
+    }
+
     protected function _getMenuItemDefault($aItem)
     {
         if($this->_bIsApi)

+ 34 - 14
modules/boonex/tasks/classes/BxTasksModule.php

@@ -432,7 +432,7 @@ class BxTasksModule extends BxBaseModTextModule implements iBxDolCalendarService
         $iNow = time();
         switch($sAction) {
             case 'start':
-                $this->stopTimerByAuthor($iProfileId);
+                $this->pauseTimerByAuthor($iProfileId);
 
                 $iTimer = false;
                 $aTimer = $this->getTimer($iContentId, $iProfileId);
@@ -447,13 +447,13 @@ class BxTasksModule extends BxBaseModTextModule implements iBxDolCalendarService
                     $aResult = ['code' => 0, 'id' => $iTimer];
                 break;
 
-            case 'stop':
-                if($this->stopTimerByAuthor($iProfileId))
+            case 'pause':
+                if($this->pauseTimerByAuthor($iProfileId))
                     $aResult = ['code' => 0];
                 break;
 
             case 'resume':
-                $this->stopTimerByAuthor($iProfileId);
+                $this->pauseTimerByAuthor($iProfileId);
 
                 $aTimer = $this->getTimer($iContentId, $iProfileId);
                 if($aTimer && is_array($aTimer) && $this->updateTimerById($aTimer['id'], ['started' => $iNow]))
@@ -514,15 +514,17 @@ class BxTasksModule extends BxBaseModTextModule implements iBxDolCalendarService
 
     public function serviceManageTools($sType = 'common')
     {
-        $CNF = &$this->_oConfig->CNF;
+        $mixedResults = parent::serviceManageTools($sType);
+        if(!$mixedResults)
+            return $mixedResults;
 
-        $mixedResults = '';
-        if(!($mixedResults = parent::serviceManageTools($sType)))
+        if($this->_bIsApi)
             return $mixedResults;
 
-        return array_merge(parent::serviceManageTools($sType), [
-            'menu' => BxDolMenu::getObjectInstance($CNF['OBJECT_MENU_MANAGE_TOOLS_SUBMENU'])
-        ]);
+        if(isset($mixedResults['menu']))
+            unset($mixedResults['menu']);
+
+        return $mixedResults;
     }
 
     public function serviceGetBlockMenuBrowse()
@@ -883,6 +885,24 @@ class BxTasksModule extends BxBaseModTextModule implements iBxDolCalendarService
         return true; 
     }
 
+    public function serviceEntityTextBlock ($iContentId = 0)
+    {
+        if(!$iContentId)
+            $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
+        if(!$iContentId)
+            return false;
+        
+        $CNF = &$this->_oConfig->CNF;
+
+        $sResult = '';
+        if(!$this->isAllowEdit($iContentId))
+            $sResult = parent::serviceEntityTextBlock($iContentId);
+        else 
+            $sResult = $this->serviceEntityEdit($iContentId, $CNF['OBJECT_FORM_ENTRY_DISPLAY_EDIT_BODY']);
+
+        return $sResult;
+    }
+
     public function serviceEntityAssignments($iContentId = 0, $bAsArray = false)
     {
         if(!$iContentId)
@@ -899,7 +919,7 @@ class BxTasksModule extends BxBaseModTextModule implements iBxDolCalendarService
         $mixedResult = $this->_oTemplate->entryAssignments($aProfiles);
 
         return $this->_bIsApi ? [
-            bx_api_get_block('task_assignments', $mixedResult)
+            bx_api_get_block('profiles_list', ['data' => $mixedResult])
         ] : $mixedResult;
     }
 
@@ -1050,7 +1070,7 @@ class BxTasksModule extends BxBaseModTextModule implements iBxDolCalendarService
 
         if(($_sTitle = '_' . $sName) && ($sTitle = _t($_sTitle)) && strcmp($_sTitle, $sTitle) != 0)
             $sResult = $sTitle;
-        else if(($aModule = $this->_oModule->_oDb->getModuleByName($sName)) && is_array($aModule))
+        else if(($aModule = $this->_oDb->getModuleByName($sName)) && is_array($aModule))
             $sResult = $aModule['title'] ?? _t('_undefined');
 
         return $sResult;
@@ -1132,10 +1152,10 @@ class BxTasksModule extends BxBaseModTextModule implements iBxDolCalendarService
         return $this->_oDb->getTimers(['sample' => 'profile_id', 'profile_id' => $iProfileId, 'active' => $bActive]);
     }
 
-    public function stopTimerByAuthor($iProfileId)
+    public function pauseTimerByAuthor($iProfileId)
     {
         $aTimer = $this->getTimersByAuthor($iProfileId, true);
-        if(!$aTimer || !is_array($aTimer)) 
+        if(!$aTimer || !is_array($aTimer) || empty($aTimer['started']))
             return false;
 
         return $this->updateTimerById($aTimer['id'], [

+ 5 - 19
modules/boonex/tasks/classes/BxTasksTemplate.php

@@ -97,24 +97,6 @@ class BxTasksTemplate extends BxBaseModTextTemplate
 
         return array($sPhotoGallery, $sPhotoGallery);
     }
-    
-    public function entryText ($aData, $sTemplateName = 'entry-text.html')
-    {
-        $CNF = &$this->_oConfig->CNF;
-
-        $iContentId = (int)$aData[$CNF['FIELD_ID']];
-
-        $sResult = '';
-        if(!$this->_oModule->isAllowEdit($iContentId)) {
-            $aVars = $this->getTmplVarsText($aData);
-
-            $sResult = $this->parseHtmlByName($sTemplateName, $aVars);
-        }
-        else 
-            $sResult = $this->getModule()->serviceEntityEdit($iContentId, $CNF['OBJECT_FORM_ENTRY_DISPLAY_EDIT_BODY']);
-
-        return $sResult;
-    }
 
     public function entryAssignments ($aProfiles)
     {
@@ -145,9 +127,13 @@ class BxTasksTemplate extends BxBaseModTextTemplate
 
     public function entryTimer ($iContentId, $iProfileId)
     {
+        $mixedResult = $this->getTimer($iContentId, $iProfileId);
+        if($this->_bIsApi)
+            return $mixedResult;
+
         $this->addCss(['timer.css']);
         $this->addJs(['timer.js']);
-        return $this->getTimer($iContentId, $iProfileId) . $this->getJsCodeTimer('timer', [], [
+        return $mixedResult . $this->getJsCodeTimer('timer', [], [
             'content_id' => $iContentId,
             'profile_id' => $iProfileId,
             'started' => $this->_oDb->isTimerStarted($iContentId, $iProfileId),

+ 81 - 5
modules/boonex/tasks/classes/BxTasksTime.php

@@ -15,6 +15,8 @@ class BxTasksTime extends BxTemplReport
     protected $_sModule;
     protected $_oModule;
 
+    protected $_sUniqId;
+
     public function __construct($sSystem, $iId, $iInit = true, $oTemplate = false)
     {
         parent::__construct($sSystem, $iId, $iInit, $oTemplate);
@@ -22,6 +24,8 @@ class BxTasksTime extends BxTemplReport
         $this->_sModule = 'bx_tasks';
     	$this->_oModule = BxDolModule::getInstance($this->_sModule);
 
+        $this->_sUniqId = '';
+
         $CNF = &$this->_oModule->_oConfig->CNF;
 
         $this->_oQuery = new BxTasksTimeQuery($this);
@@ -37,8 +41,65 @@ class BxTasksTime extends BxTemplReport
         });
     }
 
+    public function getJsObjectName()
+    {
+        return parent::getJsObjectName() . $this->_sUniqId;
+    }
+
+    public function getJsScript($bDynamicMode = false, $aParams = [])
+    {
+        if($this->_iDoAuto($aParams)) {
+            $aParams['js_params'] ??= [];
+            $aParams['js_params']['oRequestParams'] ??= [];
+            $aParams['js_params']['oRequestParams']['show_do_report_form'] = 0;
+        }
+
+        return parent::getJsScript($bDynamicMode, $aParams);
+    }
+
+    public function getElement($aParams = [])
+    {
+        $this->_sUniqId = $aParams['uniq_id'] ?? '';
+
+        return parent::getElement($aParams);
+    }
+
     public function report($aParams = [])
     {
+        $iObjectId = $this->_iId;
+        $iAuthorId = $this->_getAuthorId();
+        $bPerformed = $this->isPerformed($iObjectId, $iAuthorId);
+
+        $this->_oModule->serviceProcessTimer('pause', $iObjectId, $iAuthorId);
+
+        if(($sK = 'show_do_report_form') && ($iShowDoReportForm = bx_get($sK)) !== false && !$iShowDoReportForm) {
+            if(!$this->isEnabled())
+                return ['code' => 1, 'message' => _t('_report_err_not_enabled')];
+
+            if(!$this->isAllowedReport())
+                return ['code' => 2, 'message' => $this->msgErrAllowedReport()];
+   
+            $aTimer = $this->_oModule->_oDb->getTimers([
+                'sample' => 'content_profile_ids', 
+                'content_id' => $this->_iId, 
+                'profile_id' => $iAuthorId
+            ]);
+
+            if(!$aTimer || !is_array($aTimer) || !($iDuration = (int)$aTimer['duration']))
+                return ['code' => 3, 'message' => _t('_bx_tasks_txt_err_timer_not_found')];
+
+            list($iHours, $iMinutes) = $this->_oModule->_oConfig->timeI2A($iDuration, true);
+
+            $oForm = $this->_getFormObject();
+            return $this->_report($bPerformed, array_merge($aParams, [
+                'object_id' => $iObjectId,
+                'value_h' => $iHours,
+                'value_m' => $iMinutes,
+                'text' => '',
+                'timer_id' => $aTimer['id']
+            ]), $oForm);
+        }
+
         $mixedResult = parent::report($aParams);
         if(!empty($mixedResult) && is_array($mixedResult) && isset($mixedResult['popup'], $mixedResult['popup_id']))
             $mixedResult['popup'] = [
@@ -122,21 +183,31 @@ class BxTasksTime extends BxTemplReport
         return true;
     }
 
+    protected function _getDoReport($aParams = [])
+    {
+        $mixedResult = parent::_getDoReport($aParams);
+
+        if($this->_bApi)
+            $mixedResult['is_do_auto'] = $this->_iDoAuto($aParams);
+
+        return $mixedResult;
+    }
+
     protected function _report($bPerformed, $aParams, &$oForm)
     {
         $iAuthorId = $this->_getAuthorId();
         $iAuthorNip = bx_get_ip_hash($this->_getAuthorIp());
 
-        $iObjectId = $this->_bApi ? $this->_iId : $oForm->getCleanValue('object_id');
+        $iObjectId = ($sKey = 'object_id') && $this->_bApi ? $this->_iId : ($aParams[$sKey] ?? $oForm->getCleanValue($sKey));
 
         if(!$this->isAllowedReport(true))
             return ['code' => 2, 'message' => $this->msgErrAllowedReport()];
 
-        $iVh = ($sKey = 'value_h') && $this->_bApi ? $aParams[$sKey] : $oForm->getCleanValue($sKey);
-        $iVm = ($sKey = 'value_m') && $this->_bApi ? $aParams[$sKey] : $oForm->getCleanValue($sKey);
+        $iVh = ($sKey = 'value_h') && $this->_bApi ? $aParams[$sKey] : ($aParams[$sKey] ?? $oForm->getCleanValue($sKey));
+        $iVm = ($sKey = 'value_m') && $this->_bApi ? $aParams[$sKey] : ($aParams[$sKey] ?? $oForm->getCleanValue($sKey));
         $iValue = $this->_oModule->_oConfig->timeA2I([$iVh, $iVm]);
 
-        $sText = $this->_bApi ? $aParams['text'] : $oForm->getCleanValue('text');
+        $sText = ($sKey = 'text') && $this->_bApi ? $aParams[$sKey] : ($aParams[$sKey] ?? $oForm->getCleanValue($sKey));
         $sText = bx_process_input($sText);
 
         $iId = (int)$oForm->insert(['object_id' => $iObjectId, 'author_id' => $iAuthorId, 'author_nip' => $iAuthorNip, 'value' => $iValue,  'text' => $sText,  'date' => time()]);
@@ -150,7 +221,7 @@ class BxTasksTime extends BxTemplReport
             /*
              * If timer is attached, clear it and initiate reloading.
              */
-            if(($iTimerId = (int)$oForm->getCleanValue('timer_id'))) {
+            if(($sKey = 'timer_id') && ($iTimerId = (int)($aParams[$sKey] ?? $oForm->getCleanValue($sKey)))) {
                 $aTimer = $this->_oModule->_oDb->getTimers([
                     'sample' => 'id', 
                     'id' => $iTimerId
@@ -222,6 +293,11 @@ class BxTasksTime extends BxTemplReport
 
         return ['_bx_tasks_report_time_do_' . ($bPerformed && $this->isUndo() ? 'un' : '') . 'report'];
     }
+
+    protected function _iDoAuto($aParams)
+    {
+        return ($sK = 'show_do_report_form') && isset($aParams[$sK]) && $aParams[$sK] != true;
+    }    
 }
 
 /** @} */

+ 3 - 1
modules/boonex/tasks/install/langs/en.xml

@@ -569,13 +569,15 @@
     <string name="_bx_tasks_txt_flt_user_current"><![CDATA[Current user]]></string>
 
     <string name="_bx_tasks_txt_timer_start"><![CDATA[Start]]></string>
-    <string name="_bx_tasks_txt_timer_stop"><![CDATA[Stop]]></string>
+    <string name="_bx_tasks_txt_timer_pause"><![CDATA[Pause]]></string>
     <string name="_bx_tasks_txt_timer_resume"><![CDATA[Resume]]></string>
     <string name="_bx_tasks_txt_timer_clear"><![CDATA[Clear]]></string>
     <string name="_bx_tasks_txt_timer_log"><![CDATA[Log]]></string>
+    <string name="_bx_tasks_txt_timer_edit_and_log"><![CDATA[Edit & Log]]></string>
 
     <string name="_bx_tasks_txt_err_cannot_perform_action"><![CDATA[Cannot perform action. Please report.]]></string>
     <string name="_bx_tasks_txt_err_empty_pre_list"><![CDATA[Please select a list to add items to.]]></string>
+    <string name="_bx_tasks_txt_err_timer_not_found"><![CDATA[Timer wasn't found or empty.]]></string>
     <string name="_bx_tasks_txt_msg_perform_action"><![CDATA[The action was performed.]]></string>
     <string name="_bx_tasks_txt_msg_status_hidden"><![CDATA[This task was hidden.]]></string>
     <string name="_bx_tasks_txt_msg_status_pending"><![CDATA[This task is pending approval.]]></string>

+ 11 - 7
modules/boonex/tasks/install/sql/enable.sql

@@ -130,28 +130,32 @@ INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `lay
 ('bx_tasks_manage', '_bx_tasks_page_title_sys_manage', '_bx_tasks_page_title_manage', 'bx_tasks', 5, 2147483647, 1, 'tasks-manage', 'page.php?i=tasks-manage', '', '', '', 0, 1, 0, 'BxTasksPageBrowse', 'modules/boonex/tasks/classes/BxTasksPageBrowse.php');
 
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
-('bx_tasks_manage', 1, 'bx_tasks', '_bx_tasks_page_block_title_system_manage', '_bx_tasks_page_block_title_manage', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:8:"bx_tasks";s:6:"method";s:12:"manage_tools";}', 0, 1, 0);
+('bx_tasks_manage', 2, 'bx_tasks', '_bx_tasks_page_block_title_system_menu_browse', '_bx_tasks_page_block_title_menu_browse', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:8:"bx_tasks";s:6:"method";s:21:"get_block_menu_browse";}', 0, 1, 0),
+('bx_tasks_manage', 3, 'bx_tasks', '_bx_tasks_page_block_title_system_manage', '_bx_tasks_page_block_title_manage', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:8:"bx_tasks";s:6:"method";s:12:"manage_tools";}', 0, 1, 0);
 
 -- PAGE: manage all entries
 INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
-('bx_tasks_administration', '_bx_tasks_page_title_sys_manage_administration', '_bx_tasks_page_title_manage', 'bx_tasks', 5, 192, 1, 'tasks-administration', 'page.php?i=tasks-administration', '', '', '', 0, 1, 0, 'BxTasksPageBrowse', 'modules/boonex/tasks/classes/BxTasksPageBrowse.php');
+('bx_tasks_administration', '_bx_tasks_page_title_sys_manage_administration', '_bx_tasks_page_title_manage', 'bx_tasks', 13, 192, 1, 'tasks-administration', 'page.php?i=tasks-administration', '', '', '', 0, 1, 0, 'BxTasksPageBrowse', 'modules/boonex/tasks/classes/BxTasksPageBrowse.php');
 
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
-('bx_tasks_administration', 1, 'bx_tasks', '_bx_tasks_page_block_title_system_manage_administration', '_bx_tasks_page_block_title_manage', 11, 192, 'service', 'a:3:{s:6:"module";s:8:"bx_tasks";s:6:"method";s:12:"manage_tools";s:6:"params";a:1:{i:0;s:14:"administration";}}', 0, 1, 0);
+('bx_tasks_administration', 2, 'bx_tasks', '_bx_tasks_page_block_title_system_menu_browse', '_bx_tasks_page_block_title_menu_browse', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:8:"bx_tasks";s:6:"method";s:21:"get_block_menu_browse";}', 0, 1, 0),
+('bx_tasks_administration', 3, 'bx_tasks', '_bx_tasks_page_block_title_system_manage_administration', '_bx_tasks_page_block_title_manage', 11, 192, 'service', 'a:3:{s:6:"module";s:8:"bx_tasks";s:6:"method";s:12:"manage_tools";s:6:"params";a:1:{i:0;s:14:"administration";}}', 0, 1, 0);
 
 -- PAGE: manage own time
 INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
-('bx_tasks_time_manage', '_bx_tasks_page_title_sys_time_manage', '_bx_tasks_page_title_time_manage', 'bx_tasks', 5, 2147483647, 1, 'tasks-time-manage', 'page.php?i=tasks-time-manage', '', '', '', 0, 1, 0, 'BxTasksPageBrowse', 'modules/boonex/tasks/classes/BxTasksPageBrowse.php');
+('bx_tasks_time_manage', '_bx_tasks_page_title_sys_time_manage', '_bx_tasks_page_title_time_manage', 'bx_tasks', 13, 2147483647, 1, 'tasks-time-manage', 'page.php?i=tasks-time-manage', '', '', '', 0, 1, 0, 'BxTasksPageBrowse', 'modules/boonex/tasks/classes/BxTasksPageBrowse.php');
 
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
-('bx_tasks_time_manage', 1, 'bx_tasks', '_bx_tasks_page_block_title_system_time_manage', '_bx_tasks_page_block_title_time_manage', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:8:"bx_tasks";s:6:"method";s:21:"get_block_manage_time";s:6:"params";a:1:{i:0;s:6:"common";}}', 0, 1, 0);
+('bx_tasks_time_manage', 2, 'bx_tasks', '_bx_tasks_page_block_title_system_menu_browse', '_bx_tasks_page_block_title_menu_browse', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:8:"bx_tasks";s:6:"method";s:21:"get_block_menu_browse";}', 0, 1, 0),
+('bx_tasks_time_manage', 3, 'bx_tasks', '_bx_tasks_page_block_title_system_time_manage', '_bx_tasks_page_block_title_time_manage', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:8:"bx_tasks";s:6:"method";s:21:"get_block_manage_time";s:6:"params";a:1:{i:0;s:6:"common";}}', 0, 1, 0);
 
 -- PAGE: manage all time
 INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
-('bx_tasks_time_administration', '_bx_tasks_page_title_sys_time_manage_administration', '_bx_tasks_page_title_time_manage', 'bx_tasks', 5, 192, 1, 'tasks-time-administration', 'page.php?i=tasks-time-administration', '', '', '', 0, 1, 0, 'BxTasksPageBrowse', 'modules/boonex/tasks/classes/BxTasksPageBrowse.php');
+('bx_tasks_time_administration', '_bx_tasks_page_title_sys_time_manage_administration', '_bx_tasks_page_title_time_manage', 'bx_tasks', 13, 192, 1, 'tasks-time-administration', 'page.php?i=tasks-time-administration', '', '', '', 0, 1, 0, 'BxTasksPageBrowse', 'modules/boonex/tasks/classes/BxTasksPageBrowse.php');
 
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
-('bx_tasks_time_administration', 1, 'bx_tasks', '_bx_tasks_page_block_title_system_time_manage_administration', '_bx_tasks_page_block_title_time_manage', 11, 192, 'service', 'a:3:{s:6:"module";s:8:"bx_tasks";s:6:"method";s:21:"get_block_manage_time";s:6:"params";a:1:{i:0;s:14:"administration";}}', 0, 1, 0);
+('bx_tasks_time_administration', 2, 'bx_tasks', '_bx_tasks_page_block_title_system_menu_browse', '_bx_tasks_page_block_title_menu_browse', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:8:"bx_tasks";s:6:"method";s:21:"get_block_menu_browse";}', 0, 1, 0),
+('bx_tasks_time_administration', 3, 'bx_tasks', '_bx_tasks_page_block_title_system_time_manage_administration', '_bx_tasks_page_block_title_time_manage', 11, 192, 'service', 'a:3:{s:6:"module";s:8:"bx_tasks";s:6:"method";s:21:"get_block_manage_time";s:6:"params";a:1:{i:0;s:14:"administration";}}', 0, 1, 0);
 
 -- PAGE: timers
 INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 

+ 7 - 7
modules/boonex/tasks/js/timer.js

@@ -33,18 +33,18 @@ BxTasksTimer.prototype.init = function (iContentId, iProfileId, bStarted) {
 
 BxTasksTimer.prototype.start = function (oSource, iContentId, iProfileId) {
     if(this._bMulti)
-        this.stopAll();
+        this.pauseAll();
 
     this._performAction(oSource, 'start', iContentId, iProfileId);
 };
 
-BxTasksTimer.prototype.stop = function (oSource, iContentId, iProfileId) {
+BxTasksTimer.prototype.pause = function (oSource, iContentId, iProfileId) {
     this._clearTimer(iContentId, iProfileId);
 
-    this._performAction(oSource, 'stop', iContentId, iProfileId);
+    this._performAction(oSource, 'pause', iContentId, iProfileId);
 };
 
-BxTasksTimer.prototype.stopAll = function () {
+BxTasksTimer.prototype.pauseAll = function () {
     if(!this._aTimers)
         return;
 
@@ -57,13 +57,13 @@ BxTasksTimer.prototype.stopAll = function () {
         if(!oTimer || !oTimer.length)
             continue;
 
-        this.stop(oTimer.get(0), aKey[0],aKey[1]);
+        this.pause(oTimer.get(0), aKey[0],aKey[1]);
     }
 };
 
 BxTasksTimer.prototype.resume = function (oSource, iContentId, iProfileId) {
     if(this._bMulti)
-        this.stopAll();
+        this.pauseAll();
 
     this._performAction(oSource, 'resume', iContentId, iProfileId);
 };
@@ -94,7 +94,7 @@ BxTasksTimer.prototype.onPerformActionStart = function(oData) {
     this._onPerformActionAndSet(oData);
 };
 
-BxTasksTimer.prototype.onPerformActionStop = function(oData) {
+BxTasksTimer.prototype.onPerformActionPause = function(oData) {
     this._onPerformAction(oData);
 };
 

+ 10 - 13
template/scripts/BxBaseReport.php

@@ -118,13 +118,6 @@ class BxBaseReport extends BxDolReport
         }
 
         $oForm = $this->_getFormObject();
-        $oForm->setId($this->_aHtmlIds['do_form']);
-        $oForm->setName($this->_aHtmlIds['do_form']);
-        $oForm->aParams['db']['table'] = $this->_aSystem['table_track'];
-        $oForm->aInputs['sys']['value'] = $this->_sSystem;
-        $oForm->aInputs['object_id']['value'] = $this->_iId;
-        $oForm->aInputs['action']['value'] = 'Report';
-
         $oForm->initChecker();
         if($oForm->isSubmittedAndValid() || ($this->_bApi && !empty($aParams) && is_array($aParams)))
             return $this->_report($bPerformed, $aParams, $oForm);
@@ -145,10 +138,11 @@ class BxBaseReport extends BxDolReport
         return $this->_sJsObjName;
     }
 
-    public function getJsScript($bDynamicMode = false)
+    public function getJsScript($bDynamicMode = false, $aParams = [])
     {
-        $aParams = array(
-            'sObjName' => $this->_sJsObjName,
+        $sJsObjName = $this->getJsObjectName();
+        $aJsObjParams = [
+            'sObjName' => $sJsObjName,
             'sSystem' => $this->getSystemName(),
             'iAuthorId' => $this->_getAuthorId(),
             'iObjId' => $this->getId(),
@@ -157,8 +151,11 @@ class BxBaseReport extends BxDolReport
             'sStylePrefix' => $this->_sStylePrefix,
             'aHtmlIds' => $this->_aHtmlIds,
             'sUnreportConfirm' => bx_js_string(_t('_report_do_unreport_confirm'))
-        );
-        $sCode = "var " . $this->_sJsObjName . " = new " . $this->_sJsObjClass . "(" . json_encode($aParams) . ");";
+        ];
+        if(($sK = 'js_params') && isset($aParams[$sK]) && is_array($aParams[$sK]))
+            $aJsObjParams = array_merge($aJsObjParams, $aParams[$sK]);
+
+        $sCode = "var " . $sJsObjName . " = new " . $this->_sJsObjClass . "(" . json_encode($aJsObjParams) . ");";
 
         return $this->_oTemplate->_wrapInTagJsCode($sCode);
     }
@@ -254,7 +251,7 @@ class BxBaseReport extends BxDolReport
                     ]))
                 )
             ),
-            'script' => $this->getJsScript($bDynamicMode)
+            'script' => $this->getJsScript($bDynamicMode, $aParams)
         ));
     }