Author Topic: Multiple task selection extended  (Read 2181 times)

ras2000

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • Proremus
Multiple task selection extended
« on: May 07, 2009, 08:34:29 am »
I am trying to add a few possibilities in the task view. So far I've managed to make it possible to 'un'complete selected tasks by

In public/assets/javascript/og/tasks/taskstoptoolbar.js add
      uncomplete: new Ext.Action({
         text: lang('do uncomplete'),
            tooltip: lang('uncomplete selected tasks'),
            iconCls: 'ico-uncomplete',
         disabled: true,
         handler: function() {
            ogTasks.executeAction('uncomplete');
         },
         scope: this
      })
around line 130
and add
   this.add(actions.uncomplete);
around line 390
and change the function updateCheckedStatus() to
   updateCheckedStatus : function(){
      var checked = false;
      var allIncomplete = true;
      var allComplete = true;
      for (var i = 0; i < ogTasks.Tasks.length; i++)
         if (ogTasks.Tasks.isChecked){
            checked = true;
            if (ogTasks.Tasks.status == 1)
               allIncomplete = false;
            if (ogTasks.Tasks.status == 0)
               allComplete = false;
         }
      
      if (!checked){
         this.actions.del.disable();
         this.actions.complete.disable();
         this.actions.tag.disable();
      } else {
         this.actions.del.enable();
         this.actions.tag.enable();
         if (allIncomplete)
            this.actions.complete.enable();
         else
            this.actions.complete.disable();
         if (allComplete)
            this.actions.uncomplete.enable();
         else
            this.actions.uncomplete.disable();
            
      }
in TaskController.class.php, add the function
   function uncomplete_task() {
      ajx_current("empty");
      $task = ProjectTasks::findById(get_id());
      if(!($task instanceof ProjectTask)) {
         flash_error(lang('task dnx'));
         return;
      } // if

      if(!$task->canChangeStatus(logged_user())) {
         flash_error(lang('no access permissions'));
         return;
      } // if

      try {
         DB::beginWork();
         $task->uncompleteTask();
         DB::commit();
         flash_success(lang('success uncomplete task'));
         
         $redirect_to = array_var($_GET, 'redirect_to', false);
         if (array_var($_GET, 'quick', false)) {
            ajx_current("empty");
            ajx_extra_data(array("task" => $task->getArrayInfo()));
         } else {
            ajx_current("reload");
         }
      } catch(Exception $e) {
         DB::rollback();
         flash_error($e->getMessage());
      } // try
   } // uncomplete_task
ie around line 1130
and in ProjectTask.class.php add the function
   function uncompleteTask() {
      $this->setCompletedOn(null);
      $this->setCompletedById(0);
      $this->save();
      ApplicationLogs::createLog($this, $this->getWorkspaces(), ApplicationLogs::ACTION_OPEN);
   } // uncompleteTask
ie around line 433
If you are what you eat, then I'm fast, cheap and easy.

ras2000

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • Proremus
Re: Multiple task selection extended
« Reply #1 on: May 07, 2009, 08:37:48 am »
I would really like to be able to assign multiple tasks to one user, but when I try to replicate what I did to uncomplete tasks, I keep getting an error, og.taskstoptoolbar is not a constructor.

Anybody know what I'm doing wrong?
If you are what you eat, then I'm fast, cheap and easy.

Pet

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 638
  • Always mining for solutions!
    • View Profile
    • The Bet!
Re: Multiple task selection extended
« Reply #2 on: May 07, 2009, 06:44:49 pm »
ras, I don't have a solution for your latest question, but I was wondering in relation to your original post, how is making a task "un-complete" different from reopening a task?

cheers
Support OpenGoo - Sponsor a Feature! | Follow me on Twitter | OG Support Chat | Did you turn debugging on?