Beispiel #1
0
/**
* Edit a comment 
*
* @ingroup pages
*/
function commentEdit($comment = NULL)
{
    global $PH;
    global $auth;
    ### edit existing object or get from database ? ###
    if (!$comment) {
        $id = getOnePassedId('comment', 'comments*');
        # WARNS if multiple; ABORTS if no id found
        $comment = Comment::getVisibleById($id);
        if (!$comment) {
            $PH->abortWarning("could not get Comment", ERROR_FATAL);
            return;
        }
    }
    ### check user-rights ###
    if (!($project = Project::getVisibleById($comment->project))) {
        $PH->abortWarning("comment without project?", ERROR_BUG);
    }
    $project->validateEditItem($comment);
    # aborts if not enough rights to edit
    $task = Task::getVisibleById($comment->task);
    $page = new Page(array('use_jscalendar' => true, 'autofocus_field' => 'comment_name'));
    initPageForComment($page, $comment, $project);
    if ($comment->id) {
        $page->title = __("Edit Comment", "Page title");
    } else {
        $page->title = __("New Comment", "Page title");
    }
    echo new PageHeader();
    echo new PageContentOpen();
    global $COMMENTTYPE_VALUES;
    global $PUB_LEVEL_VALUES;
    require_once confGet('DIR_STREBER') . 'render/render_form.inc.php';
    $block = new PageBlock(array('id' => 'edit'));
    $block->render_blockStart();
    $form = new PageForm();
    $form->button_cancel = true;
    $form->add($comment->fields['name']->getFormElement($comment));
    $e = $comment->fields['description']->getFormElement($comment);
    $e->rows = 22;
    $form->add($e);
    $form->add(new Form_HiddenField('comment_project', '', $comment->project));
    $form->add(new Form_HiddenField('comment_task', '', $comment->task));
    $form->add(new Form_HiddenField('comment_comment', '', $comment->comment));
    ### public-level ###
    if (($pub_levels = $comment->getValidUserSetPublicLevels()) && count($pub_levels) > 1) {
        $form->add(new Form_Dropdown('comment_pub_level', __('Publish to', 'form label'), $pub_levels, $comment->pub_level));
    }
    if ($auth->cur_user->id == confGet('ANONYMOUS_USER')) {
        $form->addCaptcha();
    }
    echo $form;
    $block->render_blockEnd();
    $PH->go_submit = 'commentEditSubmit';
    echo "<input type=hidden name='comment' value='{$comment->id}'>";
    echo new PageContentClose();
    echo new PageHtmlEnd();
}
 protected function _render_commentField()
 {
     global $PH;
     echo "<div class=footer_form>";
     require_once confGet('DIR_STREBER') . "render/render_form.inc.php";
     $project = new Project($this->item_with_comments->project);
     $form = new PageForm();
     $form->button_cancel = false;
     $form->add(new Form_CustomHTML('<h3>' . __("Add Comment") . "</h3>"));
     ### Comment ###
     $comment_name = '';
     $comment = new Comment(array('id' => 0, 'name' => $comment_name));
     $e = $comment->fields['description']->getFormElement($comment, __('Comment'));
     $e->rows = 8;
     $form->add($e);
     $form->add($comment->fields['name']->getFormElement($comment, __('Summary')));
     ### request feedback
     $form->add(buildRequestFeedbackInput($project));
     /**
      * to reduce spam, enforce captcha test for guests
      */
     global $auth;
     if ($auth->cur_user->id == confGet('ANONYMOUS_USER')) {
         $form->addCaptcha();
     }
     ### some required hidden fields for correct data passing ###
     $form->add(new Form_HiddenField('comment_task', '', $this->item_with_comments->id));
     $form->add(new Form_HiddenField('comment', '', 0));
     if ($return = get('return')) {
         $form->add(new Form_HiddenField('return', '', asHtml($return)));
     }
     $PH->go_submit = 'commentEditSubmit';
     echo $form;
     echo "</div>";
 }
/**
* Register a new Person @ingroup pages
*
*/
function personRegister($person = NULL)
{
    global $PH;
    global $auth;
    if (!confGet('REGISTER_NEW_USERS')) {
        $PH->abortWarning(__("Registering is not enabled"));
    }
    $person = new Person(array('id' => 0, 'description' => __('Because we are afraid of spam bots, please provide some information about you and why you want to register.') . __('The staff will then review your request and approve your account as soon as possible.')));
    $page = new Page(array('use_jscalendar' => true, 'autofocus_field' => 'person_name'));
    $page->cur_tab = 'people';
    $page->type = __('Edit Person', 'Page type');
    $page->title = __("Register as a new user");
    $page->title_minor = '';
    $page->crumbs = build_person_crumbs($person);
    $page->options = array(new NaviOption(array('target_id' => 'personEdit')));
    echo new PageHeader();
    echo new PageContentOpen();
    require_once confGet('DIR_STREBER') . 'render/render_form.inc.php';
    global $g_pcategory_names;
    $form = new PageForm();
    $form->button_cancel = true;
    $form->add($person->fields['name']->getFormElement($person));
    $f = $person->fields['office_email']->getFormElement($person);
    $f->required = true;
    $form->add($f);
    $fnick = $person->fields['nickname']->getFormElement($person);
    $fnick->required = true;
    $form->add($fnick);
    ### show password-fields if can_login ###
    /**
     * since the password as stored as md5-hash, we can initiate current password,
     * but have have to make sure the it is not changed on submit
     */
    $fpw1 = new Form_password('person_password1', __('Password', 'form label'), "", $person->fields['password']->tooltip);
    $fpw1->required = true;
    $form->add($fpw1);
    $fpw2 = new Form_password('person_password2', __('confirm Password', 'form label'), "", $person->fields['password']->tooltip);
    $fpw2->required = true;
    $form->add($fpw2);
    ### dropdown menu for person category ###
    if ($p = get('perscat')) {
        $perscat = $p;
    } else {
        $perscat = $person->category;
    }
    $form->add(new Form_Dropdown('pcategory', __('Category', 'form label'), array_flip($g_pcategory_names), $perscat));
    $a = array(sprintf(__('daily'), 1) => 1, sprintf(__('each 3 days'), 3) => 3, sprintf(__('each 7 days'), 7) => 7, sprintf(__('each 14 days'), 14) => 14, sprintf(__('each 30 days'), 30) => 30, __('Never') => 0);
    $p = $person->notification_period;
    if (!$person->settings & USER_SETTING_NOTIFICATIONS) {
        $p = 0;
    }
    $form->add(new Form_Dropdown('person_notification_period', __("Send notifications", "form label"), $a, $p));
    #$form->add(new Form_checkbox("person_html_mail",__('Send mail as html','form label'),$person->settings & USER_SETTING_HTML_MAIL));
    global $g_theme_names;
    if (count($g_theme_names) > 1) {
        $form->add(new Form_Dropdown('person_theme', __("Theme", "form label"), array_flip($g_theme_names), $person->theme));
    }
    global $g_languages;
    $form->add(new Form_Dropdown('person_language', __("Language", "form label"), array_flip($g_languages), $person->language));
    global $g_time_zones;
    $form->add(new Form_Dropdown('person_time_zone', __("Time zone", "form label"), $g_time_zones, $person->time_zone));
    $form->add($person->fields['description']->getFormElement($person));
    $form->addCaptcha();
    echo $form;
    $PH->go_submit = 'personRegisterSubmit';
    ### pass company-id? ###
    if ($c = get('company')) {
        echo "<input type=hidden name='company' value='{$c}'>";
    }
    echo new PageContentClose();
    echo new PageHtmlEnd();
}
Beispiel #4
0
/**
* Edit a task
*
* @ingroup pages
*/
function taskEdit($task = NULL)
{
    global $PH;
    ### object or from database? ###
    if (!$task) {
        $ids = getPassedIds('tsk', 'tasks_*');
        if (!$ids) {
            $PH->abortWarning(__("Select some task(s) to edit"), ERROR_NOTE);
            return;
        } else {
            if (count($ids) > 1) {
                $PH->show('taskEditMultiple');
                exit;
            } else {
                if (!($task = Task::getEditableById($ids[0]))) {
                    $PH->abortWarning(__("You do not have enough rights to edit this task"), ERROR_RIGHTS);
                }
            }
        }
    }
    ### get parent project ####
    if (!($project = Project::getVisibleById($task->project))) {
        $PH->abortWarning("FATAL error! parent project not found");
    }
    ### abort, if not enough rights ###
    $project->validateEditItem($task);
    $page = new Page(array('use_jscalendar' => true, 'autofocus_field' => 'task_name'));
    initPageForTask($page, $task, $project);
    if ($task->id) {
        $page->title = $task->name;
        $page->title_minor = $task->short;
    } else {
        if ($task->category == TCATEGORY_MILESTONE) {
            $page->title = __("New milestone");
        } else {
            if ($task->category == TCATEGORY_VERSION) {
                $page->title = __("New version");
            } else {
                if ($task->category == TCATEGORY_DOCU) {
                    $page->title = __("New topic");
                } else {
                    if ($task->category == TCATEGORY_FOLDER) {
                        $page->title = __("New folder");
                    } else {
                        $page->title = __("New task");
                        if ($task->parent_task && ($parent_task = Task::getVisibleById($task->parent_task))) {
                            $page->title_minor = sprintf(__('for %s', 'e.g. new task for something'), $parent_task->name);
                        } else {
                            $page->title_minor = sprintf(__('for %s', 'e.g. new task for something'), $project->name);
                        }
                    }
                }
            }
        }
    }
    echo new PageHeader();
    echo new PageContentOpen();
    require_once confGet('DIR_STREBER') . 'render/render_form.inc.php';
    global $auth;
    global $REPRODUCIBILITY_VALUES;
    global $g_prio_names;
    global $g_status_names;
    $block = new PageBlock(array('id' => 'functions'));
    $block->render_blockStart();
    $form = new PageForm();
    $form->button_cancel = true;
    $form->add($task->fields['name']->getFormElement($task));
    $list = array();
    if ($task->category == TCATEGORY_MILESTONE || $task->category == TCATEGORY_VERSION) {
        $list = array(TCATEGORY_MILESTONE, TCATEGORY_VERSION);
        ### make sure it's valid
        if ($task->category != TCATEGORY_MILESTONE || $task->category != TCATEGORY_VERSION) {
            if ($task->is_released > RELEASED_UPCOMMING) {
                $task->category = TCATEGORY_VERSION;
            } else {
                $task->category = TCATEGORY_MILESTONE;
            }
        }
    } else {
        $list = array();
        if ($project->settings & PROJECT_SETTING_ENABLE_TASKS) {
            $list[] = TCATEGORY_TASK;
        }
        if ($project->settings & PROJECT_SETTING_ENABLE_BUGS) {
            $list[] = TCATEGORY_BUG;
        }
        $list[] = TCATEGORY_DOCU;
        $list[] = TCATEGORY_FOLDER;
    }
    global $g_tcategory_names;
    $cats = array();
    foreach ($list as $c) {
        $cats[$c] = $g_tcategory_names[$c];
    }
    $form->add(new Form_Dropdown('task_category', __("Display as"), array_flip($cats), $task->category));
    ### warning if folder with subtasks ###
    if ($task->id && $task->category == TCATEGORY_FOLDER && ($num_subtasks = count($task->getSubtasks()))) {
        $form->add(new Form_CustomHtml('<p><label></label>' . sprintf(__("This folder has %s subtasks. Changing category will ungroup them."), $num_subtasks) . '</p>'));
    }
    $form->add($tab_group = new Page_TabGroup());
    $tab_group->add($tab = new Page_Tab('task', __("Task")));
    ### normaltasks and folders ##
    if (!$task->isMilestoneOrVersion()) {
        if ($project->settings & PROJECT_SETTING_ENABLE_MILESTONES) {
            $tab->add(new Form_DropdownGrouped('task_for_milestone', __('For Milestone'), $project->buildPlannedForMilestoneList(), $task->for_milestone));
        }
        ### prio ###
        if ($task->category != TCATEGORY_MILESTONE && $task->category != TCATEGORY_VERSION) {
            $tab->add(new Form_Dropdown('task_prio', __("Prio", "Form label"), array_flip($g_prio_names), $task->prio));
        }
    }
    ### for existing tasks, get already assigned
    if ($task->id) {
        $assigned_people = $task->getAssignedPeople();
        #$task_assignments = $task->getAssignments();
    } else {
        ### check new assigments ###
        $count = 0;
        while ($id_new = get('task_assign_to_' . $count)) {
            $count++;
            ### check if already assigned ###
            if ($p = Person::getVisibleById($id_new)) {
                $assigned_people[] = $p;
            }
        }
        if (!$count) {
            $parents = $task->getFolder();
            if ($parents) {
                $parents = array_reverse($parents);
                foreach ($parents as $p) {
                    if ($ap = $p->getAssignedPeople()) {
                        $assigned_people = $ap;
                        break;
                    }
                }
            }
        }
    }
    $team = array(__('- select person -') => 0);
    ### create team-list ###
    foreach ($project->getPeople() as $p) {
        $team[$p->name] = $p->id;
    }
    ### create drop-down-lists ###
    $count_new = 0;
    $count_all = 0;
    if (isset($assigned_people)) {
        foreach ($assigned_people as $ap) {
            if (!($p = Person::getVisibleById($ap->id))) {
                continue;
                # skip if invalid person
            }
            if ($task->id) {
                $tab->add(new Form_Dropdown('task_assigned_to_' . $ap->id, __("Assigned to"), $team, $ap->id));
            } else {
                $tab->add(new Form_Dropdown('task_assign_to_' . $count_new, __("Assign to"), $team, $ap->id));
                $count_new++;
            }
            $count_all++;
            unset($team[$ap->name]);
        }
    }
    ### add empty drop-downlist for new assignments ###
    $str_label = $count_all == 0 ? __("Assign to", "Form label") : __("Also assign to", "Form label");
    $tab->add(new Form_Dropdown("task_assign_to_{$count_new}", $str_label, $team, 0));
    ### completion ###
    if (!$task->is_released > RELEASED_UPCOMMING) {
        #$form->add($task->fields['estimated'    ]->getFormElement($task));
        $ar = array(__('undefined') => -1, '0%' => 0, '10%' => 10, '20%' => 20, '30%' => 30, '40%' => 40, '50%' => 50, '60%' => 60, '70%' => 70, '80%' => 80, '90%' => 90, '95%' => 95, '98%' => 98, '99%' => 99, '100%' => 100);
        $tab->add(new Form_Dropdown('task_completion', __("Completed"), $ar, $task->completion));
    }
    $st = array();
    foreach ($g_status_names as $s => $n) {
        if ($s >= STATUS_NEW) {
            $st[$s] = $n;
        }
    }
    if ($task->isMilestoneOrVersion()) {
        unset($st[STATUS_NEW]);
    }
    $field_status = new Form_Dropdown('task_status', "Status", array_flip($st), $task->status);
    if ($task->fields['status']->invalid) {
        $field_status->invalid = true;
    }
    $tab->add($field_status);
    if (!$task->isMilestoneOrVersion()) {
        if ($project->settings & PROJECT_SETTING_ENABLE_MILESTONES) {
            ### resolved version ###
            $tab->add(new Form_DropdownGrouped('task_resolved_version', __('Resolved in'), $project->buildResolvedInList(), $task->resolved_version));
        }
        ### resolved reason ###
        global $g_resolve_reason_names;
        $tab->add(new Form_Dropdown('task_resolve_reason', __('Resolve reason'), array_flip($g_resolve_reason_names), $task->resolve_reason));
    }
    $tab_group->add($tab = new Page_Tab("bug", __("Bug Report")));
    ### use issue-report ###
    global $g_severity_names;
    global $g_reproducibility_names;
    ### create new one ###
    if ($task->issue_report <= 0) {
        $issue = new Issue(array('id' => 0));
        ### get recent issue-reports ###
        if ($recent_ir = Issue::getCreatedRecently()) {
            $default_version = '';
            $default_plattform = '';
            $default_production_build = '';
            $default_os = '';
            foreach ($recent_ir as $ir) {
                if ($ir->project == $project->id) {
                    if (!$issue->version && $ir->version) {
                        $issue->version = $ir->version;
                    }
                    if (!$issue->plattform && $ir->plattform) {
                        $issue->plattform = $ir->plattform;
                    }
                    if (!$issue->os && $ir->os) {
                        $issue->os = $ir->os;
                    }
                    if (!$issue->production_build && $ir->production_build) {
                        $issue->production_build = $ir->production_build;
                    }
                }
            }
        }
    } else {
        /**
         * note: if task is visible ignore visibility of issue report
         */
        $issue = Issue::getById($task->issue_report);
    }
    if ($issue) {
        $tab->add(new Form_Dropdown('issue_severity', __("Severity", "Form label, attribute of issue-reports"), array_flip($g_severity_names), $issue->severity));
        $tab->add(new Form_Dropdown('issue_reproducibility', __("Reproducibility", "Form label, attribute of issue-reports"), array_flip($g_reproducibility_names), $issue->reproducibility));
        foreach ($issue->fields as $field) {
            $tab->add($field->getFormElement($issue));
        }
        $tab->add(new Form_HiddenField('task_issue_report', '', $task->issue_report));
    } else {
        trigger_error("could not get Issue with id ({$task->issue}-report)", E_USER_NOTICE);
    }
    $tab_group->add($tab = new Page_Tab("timing", __("Timing")));
    ### estimated ###
    if (!$task->isMilestoneOrVersion()) {
        #$tab->add($task->fields['estimated'    ]->getFormElement($task));
        $ar = array(__('undefined') => 0, __('30 min') => 30 * 60, __('1 h') => 60 * 60, __('2 h') => 2 * 60 * 60, __('4 h') => 4 * 60 * 60, __('1 Day') => 1 * confGet('WORKHOURS_PER_DAY') * 60 * 60, __('2 Days') => 2 * confGet('WORKHOURS_PER_DAY') * 60 * 60, __('3 Days') => 3 * confGet('WORKHOURS_PER_DAY') * 60 * 60, __('4 Days') => 4 * confGet('WORKHOURS_PER_DAY') * 60 * 60, __('1 Week') => 1 * confGet('WORKDAYS_PER_WEEK') * confGet('WORKHOURS_PER_DAY') * 60 * 60, __('2 Weeks') => 2 * confGet('WORKDAYS_PER_WEEK') * confGet('WORKHOURS_PER_DAY') * 60 * 60, __('3 Weeks') => 3 * confGet('WORKDAYS_PER_WEEK') * confGet('WORKHOURS_PER_DAY') * 60 * 60);
        $tab->add(new Form_Dropdown('task_estimated', __("Estimated time"), $ar, $task->estimated));
        $tab->add(new Form_Dropdown('task_estimated_max', __("Estimated worst case"), $ar, $task->estimated_max));
    }
    ### planned time ###
    if (!$task->isMilestoneOrVersion()) {
        $tab->add($task->fields['planned_start']->getFormElement($task));
    }
    $tab->add($task->fields['planned_end']->getFormElement($task));
    if ($task->isMilestoneOrVersion()) {
        global $g_released_names;
        $tab->add(new Form_Dropdown('task_is_released', __("Release as version", "Form label, attribute of issue-reports"), array_flip($g_released_names), $task->is_released));
        $tab->add($task->fields['time_released']->getFormElement($task));
    }
    $tab_group->add($tab = new Page_Tab('description', __("Description")));
    $e = $task->fields['description']->getFormElement($task);
    $e->rows = 20;
    $tab->add($e);
    $tab_group->add($tab = new Page_Tab('display', __("Display")));
    ### short ###
    $tab->add($task->fields['short']->getFormElement($task));
    ### order id ###
    $tab->add($task->fields['order_id']->getFormElement($task));
    ### Shows as news ###
    $tab->add($task->fields['is_news']->getFormElement($task));
    ### Shows Folder as documentation ###
    $tab->add($task->fields['show_folder_as_documentation']->getFormElement($task));
    ### public-level ###
    if (($pub_levels = $task->getValidUserSetPublicLevels()) && count($pub_levels) > 1) {
        $tab->add(new Form_Dropdown('task_pub_level', __("Publish to"), $pub_levels, $task->pub_level));
    }
    ### label ###
    if (!$task->isOfCategory(TCATEGORY_VERSION, TCATEGORY_MILESTONE, TCATEGORY_FOLDER)) {
        $labels = array(__('undefined') => 0);
        $counter = 1;
        foreach (explode(",", $project->labels) as $l) {
            $labels[$l] = $counter++;
        }
        $tab->add(new Form_Dropdown('task_label', __("Label"), $labels, $task->label));
    }
    if (confGet('INTERNAL_COST_FEATURE') && $auth->cur_user->user_rights & RIGHT_VIEWALL && $auth->cur_user->user_rights & RIGHT_EDITALL) {
        $tab_group->add($tab = new Page_Tab("internal", __("Internal")));
        $tab->add($task->fields['calculation']->getFormElement($task));
    }
    /**
     * to reduce spam, enforce captcha test for guests
     */
    global $auth;
    if ($auth->cur_user->id == confGet('ANONYMOUS_USER')) {
        $form->addCaptcha();
    }
    $form->add($task->fields['parent_task']->getFormElement($task));
    #echo "<input type=hidden name='tsk' value='$task->id'>";
    $form->add(new Form_HiddenField('tsk', '', $task->id));
    #echo "<input type=hidden name='task_project' value='$project->id'>";
    $form->add(new Form_HiddenField('task_project', '', $project->id));
    ### create another task ###
    if ($task->id == 0) {
        $checked = get('create_another') ? 'checked' : '';
        $form->form_options[] = "<input id='create_another' name='create_another' type=checkbox {$checked}><label for='create_another'>" . __("Create another task after submit") . "</label>";
    }
    echo $form;
    $PH->go_submit = 'taskEditSubmit';
    if ($return = get('return')) {
        echo "<input type=hidden name='return' value='{$return}'>";
    }
    $block->render_blockEnd();
    #@@@ passing project-id is an security-issue, because it might allow to add tasks to unverified projects.
    # Double-checking project-rights in taskEditSubmit() required
    echo new PageContentClose();
    echo new PageHtmlEnd();
}
Beispiel #5
0
 public function render_quickedit($task)
 {
     global $PH;
     $editable = false;
     ### make sure it's editable ###
     if (Task::getEditableById($task->id)) {
         $editable = true;
     } else {
         if (!Task::getVisibleById($task->id)) {
             return false;
         }
     }
     ### get parent project ####
     if (!($project = Project::getVisibleById($task->project))) {
         return;
     }
     $this->render_blockStart();
     require_once confGet('DIR_STREBER') . 'render/render_form.inc.php';
     global $REPRODUCIBILITY_VALUES;
     global $g_prio_names;
     global $g_status_names;
     $form = new PageForm();
     $form->button_cancel = false;
     $form->add($tab_group = new Page_TabGroup());
     $tab_group->add($tab = new Page_Tab("comment", __("Add comment")));
     ### Comment ###
     $comment_name = '';
     $comment = new Comment(array('id' => 0, 'name' => $comment_name));
     $tab->add($comment->fields['name']->getFormElement($comment, __('Comment')));
     $e = $comment->fields['description']->getFormElement($comment);
     $e->rows = 8;
     $tab->add($e);
     ### request feedback
     $tab->add(buildRequestFeedbackInput($project));
     ### update ###
     if ($editable && $task->isOfCategory(array(TCATEGORY_TASK, TCATEGORY_BUG))) {
         $tab_group->add($tab = new Page_Tab("update", __("Update")));
         #$tab->add(new Form_Dropdown('task_for_milestone', __('For Milestone'), $project->buildPlannedForMilestoneList(), $task->for_milestone));
         $tab->add(new Form_DropdownGrouped('task_for_milestone', __('For Milestone'), $project->buildPlannedForMilestoneList(), $task->for_milestone));
         $tab->add(new Form_DropdownGrouped('task_resolved_version', __('Resolved in'), $project->buildResolvedInList(), $task->resolved_version));
         global $g_resolve_reason_names;
         $tab->add(new Form_Dropdown('task_resolve_reason', __('Resolve reason'), array_flip($g_resolve_reason_names), $task->resolve_reason));
         ### for existing tasks, get already assigned
         if ($task->id) {
             $assigned_people = $task->getAssignedPeople();
         } else {
             trigger_error("view a task with zero id?");
         }
         $team = array(__('- select person -') => 0);
         ### create team-list ###
         foreach ($project->getPeople() as $p) {
             $team[$p->name] = $p->id;
         }
         ### create drop-down-lists ###
         $count_new = 0;
         $count_all = 0;
         if (isset($assigned_people)) {
             foreach ($assigned_people as $ap) {
                 if (!($p = Person::getVisibleById($ap->id))) {
                     continue;
                     # skip if invalid person
                 }
                 if ($task->id) {
                     $tab->add(new Form_Dropdown('task_assigned_to_' . $ap->id, __("Assigned to"), $team, $ap->id));
                 } else {
                     $tab->add(new Form_Dropdown('task_assign_to_' . $count_new, __("Assign to"), $team, $ap->id));
                     $count_new++;
                 }
                 $count_all++;
                 unset($team[$ap->name]);
             }
         }
         ### add empty drop-downlist for new assignments ###
         $str_label = $count_all == 0 ? __("Assign to", "Form label") : __("Also assign to", "Form label");
         $tab->add(new Form_Dropdown("task_assign_to_{$count_new}", $str_label, $team, 0));
         if (!$task->isMilestoneOrVersion()) {
             $tab->add(new Form_Dropdown('task_prio', __("Prio", "Form label"), array_flip($g_prio_names), $task->prio));
         }
         $ar = array(__('undefined') => 0, __('30 min') => 30 * 60, __('1 h') => 60 * 60, __('2 h') => 2 * 60 * 60, __('4 h') => 4 * 60 * 60, __('1 Day') => 1 * confGet('WORKHOURS_PER_DAY') * 60 * 60, __('2 Days') => 2 * confGet('WORKHOURS_PER_DAY') * 60 * 60, __('3 Days') => 3 * confGet('WORKHOURS_PER_DAY') * 60 * 60, __('4 Days') => 4 * confGet('WORKHOURS_PER_DAY') * 60 * 60, __('1 Week') => 1 * confGet('WORKDAYS_PER_WEEK') * confGet('WORKHOURS_PER_DAY') * 60 * 60, __('2 Weeks') => 2 * confGet('WORKDAYS_PER_WEEK') * confGet('WORKHOURS_PER_DAY') * 60 * 60, __('3 Weeks') => 3 * confGet('WORKDAYS_PER_WEEK') * confGet('WORKHOURS_PER_DAY') * 60 * 60);
         $tab->add(new Form_Dropdown('task_estimated', __("Estimated time"), $ar, $task->estimated));
         $tab->add(new Form_Dropdown('task_estimated_max', __("Estimated worst case"), $ar, $task->estimated_max));
         $ar = array(__('undefined') => -1, '0%' => 0, '10%' => 10, '20%' => 20, '30%' => 30, '40%' => 40, '50%' => 50, '60%' => 60, '70%' => 70, '80%' => 80, '90%' => 90, '95%' => 95, '98%' => 98, '99%' => 99, '100%' => 100);
         $tab->add(new Form_Dropdown('task_completion', __("Completed"), $ar, $task->completion));
         $tab->add($task->fields['parent_task']->getFormElement($task));
         $st = array();
         foreach ($g_status_names as $s => $n) {
             if ($s >= STATUS_NEW) {
                 $st[$s] = $n;
             }
         }
         if ($task->isMilestoneOrVersion()) {
             unset($st[STATUS_NEW]);
         }
         $tab->add(new Form_Dropdown('task_status', "Status", array_flip($st), $task->status));
     }
     /**
      * to reduce spam, enforce captcha test for guests
      */
     global $auth;
     if ($auth->cur_user->id == confGet('ANONYMOUS_USER')) {
         $form->addCaptcha();
     }
     ### some required hidden fields for correct data passing ###
     $form->add(new Form_HiddenField('tsk', '', $task->id));
     $form->add(new Form_HiddenField('comment', '', $comment->id));
     if ($return = get('return')) {
         $form->add(new Form_HiddenField('return', '', asHtml($return)));
     }
     echo $form;
     $PH->go_submit = 'taskEditSubmit';
     $this->render_blockEnd();
 }