/** * version edit @ingroup pages */ function versionEdit($version = NULL) { global $PH; if (!$version) { $id = getOnePassedId('version', 'versions_*'); # WARNS if multiple; ABORTS if no id found if (!($version = Version::getEditableById($id))) { $PH->abortWarning("ERROR: could not get Version"); return; } } if (!($project = Project::getVisibleById($version->project))) { $PH->abortWarning("ERROR: could not get Project", ERROR_BUG); } $page = new Page(array('use_jscalendar' => true, 'autofocus_field' => 'version_name')); $page->cur_tab = 'projects'; $page->type = __('Edit Version', 'page type'); $page->title = $version->name; $page->crumbs = build_project_crumbs($project); $page->crumbs[] = new NaviCrumb(array('target_id' => 'versionEdit')); if ($version->id) { $page->title = __('Edit Version', 'page title'); } else { $page->title = __('New Version', 'page title'); } $page->title_minor = sprintf(__('On project %s', 'page title add on'), $project->name); echo new PageHeader(); echo new PageContentOpen(); require_once "render/render_form.inc.php"; $form = new PageForm(); $form->button_cancel = true; $form->add($version->fields['name']->getFormElement($version)); $form->add($version->fields['time_released']->getFormElement($version)); $form->add($version->fields['description']->getFormElement($version)); ### released ### ### public-level ### if (($pub_levels = $version->getValidUserSetPublicLevels()) && count($pub_levels) > 1) { $form->add(new Form_Dropdown('version_pub_level', __("Publish to"), $pub_levels, $version->pub_level)); } echo $form; $PH->go_submit = 'versionEditSubmit'; echo "<input type=hidden name='version' value='{$version->id}'>"; echo "<input type=hidden name='version_project' value='{$version->project}'>"; echo new PageContentClose(); echo new PageHtmlEnd(); }
/** * Remove items of certain type and autho * * This method can be used to remove spam comments or attachments * * person - id of person who did the changes * data - date to with revert changes * delete_history (Default off) - Reverting can't be undone! The person's modification are lost forever! * This can be useful on massive changes to avoid sending huge * notification mails. */ function itemsRemoveMany() { global $PH; global $auth; $PH->go_submit = 'itemsRemoveManyPreview'; $page = new Page(); $page->cur_tab = 'home'; $page->title = __('Remove many items'); $page->title_minor = ''; echo new PageHeader(); echo new PageContentOpen(); require_once confGet('DIR_STREBER') . "render/render_form.inc.php"; $form = new PageForm(); $form->button_cancel = true; ### author $people = array(0 => 'anybody'); foreach (Person::getPeople() as $p) { $people[$p->id] = $p->nickname; } $form->add(new Form_Dropdown('person', __("Created by"), array_flip($people), 0)); $form->add(new Form_Checkbox('type_comment', __("Comments"), true)); $form->add(new Form_Checkbox('only_spam_comments', __("Only comments that look like spam"), true)); $form->add(new Form_Checkbox('type_task', __("Tasks"), false)); $form->add(new Form_Checkbox('type_topic', __("Topic"), false)); $form->add(new Form_DateTime('time_start', __('starting at', 'label for time filter'), getGMTString(time() - 7 * 24 * 60 * 60))); $form->add(new Form_DateTime('time_end', __('ending at', 'label for time filter'), getGMTString(time() + 60 * 60))); echo $form; echo new PageContentClose(); echo new PageHtmlEnd(); }
function render_blockFooter() { global $PH; global $g_valid_login_params; $form = new PageForm(); $form->add(new Form_Input('login_name', __('Nickname', 'label in login form'), '')); $form->add(new Form_Password('login_password', __('Password', 'label in login form'), '')); #$form->form_options[]="<span class=option><input name='login_forgot_password' class='checker' type=checkbox>".__("I forgot my password")."</span>"; $form->form_options[] = $PH->getLink('loginForgotPassword'); if (confGet('ANONYMOUS_USER')) { $form->form_options[] = $PH->getLink('home', __("Continue anonymously")); } ### add probably go-values as hidden fields ### $go_after = NULL; if (confGet('USE_MOD_REWRITE') && get('go') == 'globalView') { $go_after = get('id'); if ($go_after == 'login') { $go_after = ''; } } else { $go_after = get('go'); } if ($go_after != "" && $go_after != 'logout' && $go_after != 'loginForm' && $go_after != 'loginFormSubmit') { $form->add(new Form_Hiddenfield('go_after', '', $go_after)); foreach ($g_valid_login_params as $var) { if ($value = get($var)) { $form->add(new Form_Hiddenfield($var, '', $value)); } } } ### guess user's local time with javascript ### echo "<input type=hidden id=user_timeoffset name=user_timeoffset>"; echo '<script type="text/javascript"> var now = new Date();document.getElementById("user_timeoffset").value= (now.getHours() + ":" + now.getMinutes() +":"+ now.getSeconds()); </script>'; echo $form; #$this->render_blockEnd(); $PH->go_submit = 'loginFormSubmit'; }
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>"; }
/** * edit user rights of a person * * @ingroup pages * * the user-rights-validation is checked by pageHandler (requires RIGHT_PERSON_EDIT_RIGHTS) */ function personEditRights($person = NULL) { global $PH; global $auth; global $g_user_right_names; ### get person #### if (!$person) { $ids = getPassedIds('person', 'people_*'); if (!$ids) { $PH->abortWarning(__("Select some people to edit")); return; } if (!($person = Person::getEditableById($ids[0]))) { $PH->abortWarning(__("Could not get Person")); } } $page = new Page(array('autofocus_field' => 'person_nickname')); $page->cur_tab = 'people'; $page->crumbs = build_person_crumbs($person); $page->options = array(new NaviOption(array('target_id' => 'personEditRights'))); $page->type = __('Edit Person', 'page type'); $page->title = $person->name; $page->title_minor = __('Adjust user-rights'); echo new PageHeader(); echo new PageContentOpen(); require_once confGet('DIR_STREBER') . 'render/render_form.inc.php'; echo "<div>"; echo __("Please consider that activating login-accounts might trigger security-issues."); echo "</div>"; $form = new PageForm(); $form->button_cancel = true; $form->add(new Form_checkbox("person_can_login", __('Person can login', 'form label'), $person->can_login)); foreach ($g_user_right_names as $value => $key) { $form->add(new Form_checkbox("right_" . $value, $key, $person->user_rights & $value)); } echo $form; $PH->go_submit = $PH->getValidPageId('personEditRightsSubmit'); echo "<input type=hidden name='person' value='{$person->id}'>"; echo new PageContentClose(); echo new PageHtmlEnd(); }
/** * Edit note on person * * @ingroup pages */ function taskNoteOnPersonEdit($task = NULL, $person = NULL) { global $PH; global $auth; global $g_pub_level_names; global $g_prio_names; if (!$task) { $id = getOnePassedId('tsk'); if (!($task = Task::getEditableById($id))) { $PH->abortWarning(__("Select a note to edit"), ERROR_NOTE); return; } } ## get person ## if (!$person) { $pid = getOnePassedId('person'); if (!($person = Person::getById($pid))) { $PH->abortWarning(__("ERROR: could not get Person"), ERROR_NOTE); return; } } $page = new Page(array('use_jscalendar' => false, 'autofocus_field' => 'task_name')); $page->cur_tab = 'people'; if ($person->id) { $page->crumbs = build_person_crumbs($person); } $page->crumbs[] = new NaviCrumb(array('target_id' => 'taskNoteOnPersonEdit')); $page->type = __("Note"); if (!$task->id) { $page->title = __('Create new note'); $page->title_minor = __('Edit'); ## default title ## $date = gmdate("Y-m-d", time()); $time = getGMTString(); $dt = $date . " " . renderTime($time); $task->name = sprintf(__("New Note on %s, %s"), $person->name, $dt); } ## eventually needed later when note is a subcategory of task /*else { $page->title=$task->name; $page->title_minor=$task->short; }*/ echo new PageHeader(); echo new PageContentOpen(); require_once confGet('DIR_STREBER') . 'render/render_form.inc.php'; $form = new PageForm(); $form->button_cancel = true; ## name field ## $form->add($task->fields['name']->getFormElement($task)); ## description field ## $e = $task->fields['description']->getFormElement($task); $e->rows = 22; $form->add($e); ### public-level drop down menu ### $form->add(new Form_Dropdown('task_pub_level', __("Publish to", "Form label"), array_flip($g_pub_level_names), $task->pub_level)); ## priority drop down menu## $form->add(new Form_Dropdown('task_prio', __("Prio", "Form label"), array_flip($g_prio_names), $task->prio)); if ($task->id == 0) { $proj_select = 0; } $p_list = array(); $count = 1; $p_projects = $person->getProjects(); $num = count($p_projects); if ($num > 0) { $p_list[0] = __('Assigned Projects'); foreach ($p_projects as $pp) { $p_list[$pp->id] = "- " . $pp->name; $count++; } } $p_companies = $person->getCompanies(); $num = count($p_companies); if ($num > 0) { $p_list['-1'] = __('Company Projects'); foreach ($p_companies as $pcs) { $c_id = $pcs->id; $c_projects = Project::getAll(array('company' => $c_id)); $count2 = 0; foreach ($c_projects as $cp) { $p_list[$cp->id] = "- " . $cp->name; } } } if (!($projects = Project::getAll(array('order_by' => 'name ASC')))) { } else { $p_list['-2'] = __('All other Projects'); foreach ($projects as $pj) { $p_list[$pj->id] = "- " . $pj->name; } } $form->add(new Form_Dropdown('project', __('For Project', 'form label'), array_flip($p_list), $proj_select, "id='proj_list'")); ## new project ## if ($task->id == 0) { $form->add(new Form_checkbox('new_project', __('New project', 'form label'), false, "id='proj_new_checkbox'")); $form->add(new Form_Input('new_project_name', __('Project name', 'form label'), false, NULL, false, "id='proj_new_input'", "style='display:none'")); } $checked1 = ""; $checked2 = ""; if ($task->id == 0) { $checked1 = "checked"; $checked2 = "checked"; $person_select = -1; } ## eventually needed later when note is a subcategory of task /*else { if(!$pperson = $task->getAssignedPeople()){ $PH->abortWarning(__("ERROR: could not get assigned people"), ERROR_NOTE); } else{ foreach($pperson as $pp){ if($pp->id == $person->id){ $checked1= "checked"; } elseif($pp->id == $auth->cur_user->id){ $checked2= "checked"; } else{ $person_select = $pp->id; } } } }*/ $form->add(new Form_customHTML('<p><label>' . __('Assign to') . '</lable></p>', 'assigne_note')); if ($person->id != $auth->cur_user->id) { $form->add(new Form_customHTML('<span class="checker"><input value="' . $person->id . '" name="task_assignement1" type="checkbox" ' . $checked1 . '><label for="task_assignement1">' . $person->name . '</label></span>', 'assigned_person1')); $form->add(new Form_customHTML('<span class="checker"><input value="' . $auth->cur_user->id . '" name="task_assignement2" type="checkbox" ' . $checked2 . '><label for="task_assignement2">' . $auth->cur_user->name . '</label></span>', 'assigned_person2')); } else { $form->add(new Form_customHTML('<span class="checker"><input value="' . $auth->cur_user->id . '" name="task_assignement2" type="checkbox" ' . $checked2 . '><label for="task_assignement2">' . $auth->cur_user->name . '</label></span>', 'assigned_person')); } $pers_list = array(); $pers_list[-1] = __('undefined'); if ($people = Person::getPeople(array('can_login' => 1))) { foreach ($people as $pers) { if ($auth->cur_user->name != $pers->name) { $pers_list[$pers->id] = $pers->name; } } } $form->add(new Form_Dropdown('task_also_assign', __('Also assign to'), array_flip($pers_list), $person_select)); ## Book effort after submit ## $form->form_options[] = "<span class=option><input id='book_effort' name='book_effort' class='checker' type=checkbox>" . __("Book effort after submit") . "</span>"; $form->add(new Form_HiddenField('tsk', '', $task->id)); $form->add(new Form_HiddenField('person_id', '', $person->id)); $form->add(new Form_HiddenField('creation_time', '', $time)); echo $form; $PH->go_submit = 'taskNoteOnPersonEditSubmit'; echo new PageContentClose(); echo new PageHtmlEnd(); }
/** * 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(); }
/** * Display forgot password page @ingroup pages */ function loginForgotPassword() { global $PH; global $auth; global $g_valid_login_params; if (isset($auth->cur_user)) { $auth->cur_user = NULL; } $page = new Page(array('autofocus_field' => 'login_name')); global $g_tabs_login; $page->tabs = $g_tabs_login; $page->cur_tab = 'login'; $page->type = ""; $page->title = __('Password reminder', 'Page title'); echo new PageHeader(); echo new PageContentOpen(); require_once confGet('DIR_STREBER') . 'render/render_form.inc.php'; $block = new PageBlock(array('title' => __('Please enter your nickname'), 'id' => 'functions')); $block->render_blockStart(); $form = new PageForm(); $form->button_cancel = true; $msg = __("We will then sent you an E-mail with a link to adjust your password.") . " "; if ($mail = confGet('EMAIL_ADMINISTRATOR')) { $msg .= sprintf(__("If you do not know your nickname, please contact your administrator: %s."), "<a href='mailto:{$mail}'>{$mail}</a>"); } $form->add(new Form_Text($msg)); $form->add(new Form_Input('login_name', __('Nickname', 'label in login form'), '')); #$form->form_options[]="<span class=option><input name='login_forgot_password' class='checker' type=checkbox>".__("I forgot my password")."</span>"; echo $form; $block->render_blockEnd(); $PH->go_submit = 'loginForgotPasswordSubmit'; echo new PageContentClose(); echo new PageHtmlEnd(); }
/** * Edit a team member @ingroup pages */ function projectPersonEdit($pp = NULL) { global $PH; global $auth; if (!$pp) { $id = getOnePassedId('projectperson', 'projectpeople_*', true, 'No team member selected?'); # WARNS if multiple; ABORTS if no id found if (!($pp = ProjectPerson::getEditableById($id))) { $PH->abortWarning("ERROR: could not get Project Person"); return; } } ### get project ### if (!($project = Project::getVisibleById($pp->project))) { $PH->abortWarning("ERROR: could not get project"); } ### get person ### if (!($person = Person::getVisibleById($pp->person))) { $PH->abortWarning("ERROR: could not get person"); } $page = new Page(array('use_jscalendar' => true, 'autofocus_field' => 'projectperson_name')); $page->cur_tab = 'projects'; $page->type = __("Edit Team Member"); $page->title = sprintf(__("role of %s in %s", "edit team-member title"), $person->name, $project->name); $page->crumbs = build_project_crumbs($project); $page->options[] = new NaviOption(array('target_id' => 'projectPersonEdit')); echo new PageHeader(); echo new PageContentOpen(); require_once confGet('DIR_STREBER') . "render/render_form.inc.php"; $form = new PageForm(); $form->button_cancel = true; $form->add($tab_group = new Page_TabGroup()); $tab_group->add($tab = new Page_Tab("details", __("Details"))); global $g_theme_names; global $g_user_profile_names; global $g_user_profiles; ### display "undefined" profile if rights changed ### $profile_num = 0; # will be skipped when submitting $reset = ""; $check = array_keys($g_user_profile_names); $number = count($g_user_profile_names); $count = 0; for ($i = 0; $i < $number; $i++) { if ($pp->role == $check[intval($i)]) { $profile_num = $count; break; } $count++; } /*$profile_settings= $g_user_profiles[intval($profile_num)]; $count=0; echo "LevelV: " . $pp->level_view . "<br>"; echo "SetV: " . $profile_settings['level_view'] . "<br>"; echo "LevelC: " . $pp->level_create . "<br>"; echo "SetC: " . $profile_settings['level_create'] . "<br>"; echo "LevelE: " . $pp->level_edit . "<br>"; echo "SetE: " . $profile_settings['level_edit'] . "<br>"; echo "LevelD: " . $pp->level_delete . "<br>"; echo "SetV: " . $profile_settings['level_delete'] . "<br>"; foreach($g_user_profiles as $profile_id => $profile_settings) { if($pp->level_view == $profile_settings['level_view'] && $pp->level_create == $profile_settings['level_create'] && $pp->level_edit == $profile_settings['level_edit'] && $pp->level_delete == $profile_settings['level_delete'] ){ $profile_num=$count; break; } $count++; }*/ /*$form->add(new Form_Dropdown('person_profile', __("Role in this project"), array_flip($g_user_profile_names), $profile_num ));*/ $tab->add(new Form_Dropdown('person_profile', __("Role in this project"), array_flip($g_user_profile_names), $profile_num)); //$form->add($pp->fields['name']->getFormElement($pp)); $tab->add($pp->fields['name']->getFormElement($pp)); ### public-level ### if (($pub_levels = $pp->getValidUserSetPublicLevels()) && count($pub_levels) > 1) { //$form->add(new Form_Dropdown('projectperson_pub_level', __("Publish to"),$pub_levels,$pp->pub_level)); $tab->add(new Form_Dropdown('projectperson_pub_level', __("Publish to"), $pub_levels, $pp->pub_level)); } ### effort-style ### $effort_styles = array(__("start times and end times") => 1, __("duration") => 2); //$form->add(new Form_Dropdown('projectperson_effort_style', __("Log Efforts as"), $effort_styles, $pp->adjust_effort_style)); $tab->add(new Form_Dropdown('projectperson_effort_style', __("Log Efforts as"), $effort_styles, $pp->adjust_effort_style)); 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($pp->fields['salary_per_hour']->getFormElement($pp)); } echo $form; $PH->go_submit = 'projectPersonEditSubmit'; echo "<input type=hidden name='projectperson' value='{$pp->id}'>"; echo "<input type=hidden name='projectperson_project' value='{$pp->project}'>"; echo new PageContentClose(); }
/** * edit several bookmarks @ingroup pages */ function itemBookmarkEditMultiple($thebookmarks = NULL) { global $PH; global $auth; global $g_notitychange_period; $is_already_bookmark = array(); $bookmarks = array(); $items = array(); $edit_fields = array('notify_if_unchanged', 'notify_on_change'); $different_fields = array(); # hash containing fieldnames which are different in bookmarks if (!$thebookmarks) { $item_ids = getPassedIds('bookmark', 'bookmarks_*'); foreach ($item_ids as $is) { if ($bookmark = ItemPerson::getAll(array('item' => $is, 'person' => $auth->cur_user->id))) { if ($item = DbProjectItem::getById($bookmark[0]->item)) { $bookmarks[] = $bookmark[0]; $items[] = $item; $is_already_bookmark[$bookmark[0]->id] = true; } } } } else { $item_ids = $thebookmarks; foreach ($item_ids as $is) { if ($bookmark = ItemPerson::getAll(array('item' => $is, 'person' => $auth->cur_user->id, 'is_bookmark' => 0))) { if ($item = DbProjectItem::getById($bookmark[0]->item)) { $bookmarks[] = $bookmark[0]; $items[] = $item; $is_already_bookmark[$bookmark[0]->id] = false; } } elseif ($bookmark = ItemPerson::getAll(array('item' => $is, 'person' => $auth->cur_user->id, 'is_bookmark' => 1))) { if ($item = DbProjectItem::getById($bookmark[0]->item)) { $bookmarks[] = $bookmark[0]; $items[] = $item; $is_already_bookmark[$bookmark[0]->id] = true; } } else { $date = getGMTString(); $bookmark = new ItemPerson(array('id' => 0, 'item' => $is, 'person' => $auth->cur_user->id, 'is_bookmark' => 1, 'notify_if_unchanged' => 0, 'notify_on_change' => 0, 'created' => $date)); if ($item = DbProjectItem::getById($is)) { $bookmarks[] = $bookmark; $items[] = $item; $is_already_bookmark[$bookmark->id] = false; } } } } if (!$items) { $PH->abortWarning(__("Please select some items")); } $page = new Page(); $page->cur_tab = 'home'; $page->options = array(new NaviOption(array('target_id' => 'itemBookmarkEdit', 'name' => __('Edit bookmarks')))); $page->type = __('Edit multiple bookmarks', 'page title'); $page->title = sprintf(__('Edit %s bookmark(s)'), count($items)); $page->title_minor = __('Edit'); echo new PageHeader(); echo new PageContentOpen(); echo "<ol>"; foreach ($items as $item) { ## get item name ## $str_link = ''; if ($type = $item->type) { switch ($type) { case ITEM_TASK: require_once "db/class_task.inc.php"; if ($task = Task::getVisibleById($item->id)) { $str_link = $task->getLink(false); } break; case ITEM_COMMENT: require_once "db/class_comment.inc.php"; if ($comment = Comment::getVisibleById($item->id)) { $str_link = $comment->getLink(false); } break; case ITEM_PERSON: require_once "db/class_person.inc.php"; if ($person = Person::getVisibleById($item->id)) { $str_link = $person->getLink(false); } break; case ITEM_EFFORT: require_once "db/class_effort.inc.php"; if ($e = Effort::getVisibleById($item->id)) { $str_link = $e->getLink(false); } break; case ITEM_FILE: require_once "db/class_file.inc.php"; if ($f = File::getVisibleById($item->id)) { $str_link = $f->getLink(false); } break; case ITEM_PROJECT: require_once "db/class_project.inc.php"; if ($prj = Project::getVisibleById($item->id)) { $str_link = $prj->getLink(false); } break; case ITEM_COMPANY: require_once "db/class_company.inc.php"; if ($c = Company::getVisibleById($item->id)) { $str_link = $c->getLink(false); } break; case ITEM_VERSION: require_once "db/class_task.inc.php"; if ($tsk = Task::getVisibleById($item->id)) { $str_link = $tsk->getLink(false); } break; default: break; } } echo "<li>" . $str_link . "</li>"; } echo "</ol>"; foreach ($bookmarks as $bookmark) { foreach ($edit_fields as $field_name) { if ($bookmark->{$field_name} != $bookmarks[0]->{$field_name}) { $different_fields[$field_name] = true; } } } $block = new PageBlock(array('id' => 'functions')); $block->render_blockStart(); $form = new PageForm(); $form->button_cancel = true; $b = array(); $b[0] = __('no'); $b[1] = __('yes'); if (isset($different_fields['notify_on_change'])) { $b[-1] = '-- ' . __('keep different') . ' --'; $form->add(new Form_Dropdown('notify_on_change', __("Notify on change"), array_flip($b), -1)); } else { $form->add(new Form_Dropdown('notify_on_change', __("Notify on change"), array_flip($b), $bookmarks[0]->notify_on_change)); } $a = array(); foreach ($g_notitychange_period as $key => $value) { $a[$key] = $value; } if (isset($different_fields['notify_if_unchanged'])) { $a[-1] = '-- ' . __('keep different') . ' --'; $form->add(new Form_Dropdown('notify_if_unchanged', __("Notify if unchanged in"), array_flip($a), -1)); } else { $form->add(new Form_Dropdown('notify_if_unchanged', __("Notify if unchanged in"), array_flip($a), $bookmarks[0]->notify_if_unchanged)); } $number = 0; foreach ($bookmarks as $bm) { $form->add(new Form_HiddenField("bookmark_id_{$number}", '', $bm->id)); $form->add(new Form_HiddenField("bookmark_item_{$number}", '', $bm->item)); $form->add(new Form_HiddenField("is_already_bookmark_{$number}", '', $is_already_bookmark[$bm->id])); $number++; } $form->add(new Form_HiddenField("number", '', $number)); echo $form; $block->render_blockEnd(); $PH->go_submit = 'itemBookmarkEditMultipleSubmit'; echo new PageContentClose(); echo new PageHtmlEnd(); }
/** * Edit a project @ingroup pages */ function projEdit($project = NULL) { global $PH; global $auth; require_once confGet('DIR_STREBER') . "db/class_company.inc.php"; if (!$project) { $prj = getOnePassedId('prj', 'projects_*'); ### get project #### if (!($project = Project::getEditableById($prj))) { $PH->abortWarning("could not get Project"); return; } } $page = new Page(array('use_jscalendar' => true, 'autofocus_field' => 'project_name')); $page->cur_tab = 'projects'; $page->type = __("Edit Project"); $page->title = $project->name; $page->title_minor = $project->short; $page->crumbs = build_project_crumbs($project); $page->options[] = new NaviOption(array('target_id' => 'projEdit')); echo new PageHeader(); echo new PageContentOpen(); global $g_status_names; global $g_prio_names; require_once confGet('DIR_STREBER') . "render/render_form.inc.php"; ### form background ### $block = new PageBlock(array('id' => 'project_edit')); $block->render_blockStart(); $form = new PageForm(); $form->button_cancel = true; $form->add($project->fields['name']->getFormElement($project)); $form->add($tab_group = new Page_TabGroup()); $tab_group->add($tab = new Page_Tab("project", __("Project"))); $tab->add(new Form_Dropdown('project_status', "Status", array_flip($g_status_names), $project->status)); ### build company-list ### $companies = Company::getAll(); $cl_options = array('undefined' => 0); foreach ($companies as $c) { $cl_options[$c->name] = $c->id; } $tab->add(new Form_Dropdown('project_company', __('Company', 'form label'), $cl_options, $project->company)); $tab->add(new Form_Dropdown('project_prio', "Prio", array_flip($g_prio_names), $project->prio)); $tab->add($project->fields['projectpage']->getFormElement($project)); $tab->add($project->fields['date_start']->getFormElement($project)); $tab->add($project->fields['date_closed']->getFormElement($project)); $tab_group->add($tab = new Page_Tab("description", __("Description"))); $e = $project->fields['description']->getFormElement($project); $e->rows = 20; $tab->add($e); global $g_project_setting_names; $tab_group->add($tab = new Page_Tab("tab3", __("Display"))); $tab->add($project->fields['short']->getFormElement($project)); $tab->add($project->fields['status_summary']->getFormElement($project)); $tab->add($project->fields['color']->getFormElement($project)); $tab->add(new Form_checkbox('PROJECT_SETTING_ENABLE_TASKS', $g_project_setting_names[PROJECT_SETTING_ENABLE_TASKS], $project->settings & PROJECT_SETTING_ENABLE_TASKS)); $tab->add(new Form_checkbox('PROJECT_SETTING_ENABLE_FILES', $g_project_setting_names[PROJECT_SETTING_ENABLE_FILES], $project->settings & PROJECT_SETTING_ENABLE_FILES)); $tab->add(new Form_checkbox('PROJECT_SETTING_ENABLE_BUGS', $g_project_setting_names[PROJECT_SETTING_ENABLE_BUGS], $project->settings & PROJECT_SETTING_ENABLE_BUGS)); $tab->add(new Form_checkbox('PROJECT_SETTING_ENABLE_EFFORTS', $g_project_setting_names[PROJECT_SETTING_ENABLE_EFFORTS], $project->settings & PROJECT_SETTING_ENABLE_EFFORTS)); $tab->add(new Form_checkbox('PROJECT_SETTING_ENABLE_MILESTONES', $g_project_setting_names[PROJECT_SETTING_ENABLE_MILESTONES], $project->settings & PROJECT_SETTING_ENABLE_MILESTONES)); $tab->add(new Form_checkbox('PROJECT_SETTING_ENABLE_VERSIONS', $g_project_setting_names[PROJECT_SETTING_ENABLE_VERSIONS], $project->settings & PROJECT_SETTING_ENABLE_VERSIONS)); $tab->add(new Form_checkbox('PROJECT_SETTING_ENABLE_NEWS', $g_project_setting_names[PROJECT_SETTING_ENABLE_NEWS], $project->settings & PROJECT_SETTING_ENABLE_NEWS)); ### create another one ### if ($auth->cur_user->user_rights & RIGHT_PROJECT_CREATE && $project->id == 0) { $checked = get('create_another') ? 'checked' : ''; $form->form_options[] = "<span class=option><input name='create_another' class='checker' type=checkbox {$checked}>" . __("Create another project after submit") . "</span>"; } #echo "<input type=hidden name='prj' value='$project->id'>"; $form->add(new Form_Hiddenfield('prj', '', $project->id)); echo $form; $block->render_blockEnd(); $PH->go_submit = 'projEditSubmit'; if ($return = get('return')) { echo "<input type=hidden name='return' value='{$return}'>"; } echo new PageContentClose(); echo new PageHtmlEnd(); }
/** * Edit several efforts @ingroup pages */ function effortEditMultiple() { global $PH; global $g_effort_status_names; $effort_ids = getPassedIds('effort', 'efforts_*'); if (!$effort_ids) { $PH->abortWarning(__("Select some efforts(s) to edit")); exit; } $efforts = array(); $different_fields = array(); $edit_fields = array('status', 'pub_level', 'task'); foreach ($effort_ids as $id) { if ($effort = Effort::getEditableById($id)) { $efforts[] = $effort; ### check project for first task if (count($efforts) == 1) { ### make sure all are of same project ### if (!($project = Project::getVisibleById($effort->project))) { $PH->abortWarning('could not get project'); } } else { if ($effort->project != $efforts[0]->project) { $PH->abortWarning(__("For editing all efforts must be of same project.")); } foreach ($edit_fields as $field_name) { if ($effort->{$field_name} != $efforts[0]->{$field_name}) { $different_fields[$field_name] = true; } } } } } $page = new Page(array('use_jscalendar' => true, 'autofocus_field' => 'effort_name')); $page->cur_tab = 'projects'; $page->options[] = new naviOption(array('target_id' => 'effortEdit')); $page->type = __("Edit multiple efforts", "Page title"); $page->title = sprintf(__("Edit %s efforts", "Page title"), count($efforts)); echo new PageHeader(); echo new PageContentOpen(); echo "<ol>"; foreach ($efforts as $e) { echo "<li>" . $e->getLink(false) . "</li>"; } echo "</ol>"; $block = new PageBlock(array('id' => 'functions', 'reduced_header' => true)); $block->render_blockStart(); $form = new PageForm(); $form->button_cancel = true; $st = array(); foreach ($g_effort_status_names as $key => $value) { $st[$key] = $value; } if (isset($different_fields['status'])) { $st[-1] = '-- ' . __('keep different') . ' --'; $form->add(new Form_Dropdown('effort_status', __("Status"), array_flip($st), -1)); } else { $form->add(new Form_Dropdown('effort_status', __("Status"), array_flip($st), $efforts[0]->status)); } ### get meta-tasks / folders ### $folders = Task::getAll(array('sort_hierarchical' => true, 'parent_task' => 0, 'show_folders' => true, 'folders_only' => false, 'status_min' => STATUS_UPCOMING, 'status_max' => STATUS_CLOSED, 'project' => $project->id)); if ($folders) { $folder_list = array("undefined" => "0"); if ($effort->task) { if ($task = Task::getVisibleById($effort->task)) { ### add, if normal task (folders will added below) ### if (!$task->category == TCATEGORY_FOLDER) { $folder_list[$task->name] = $task->id; } } } foreach ($folders as $f) { $str = ''; foreach ($f->getFolder() as $pf) { $str .= $pf->getShort() . " > "; } $str .= $f->name; $folder_list[$str] = $f->id; } if (isset($different_fields['task'])) { $folder_list['-- ' . __('keep different') . ' --'] = -1; $form->add(new Form_Dropdown('effort_task', __("For task"), $folder_list, -1)); } else { $form->add(new Form_Dropdown('effort_task', __("For task"), $folder_list, $efforts[0]->task)); } } if (($pub_levels = $effort->getValidUserSetPublicLevels()) && count($pub_levels) > 1) { if (isset($different_fields['pub_level'])) { $pub_levels['-- ' . __('keep different') . ' --'] = -1; $form->add(new Form_Dropdown('effort_pub_level', __("Publish to"), $pub_levels, -1)); } else { $form->add(new Form_Dropdown('effort_pub_level', __("Publish to"), $pub_levels, $efforts[0]->pub_level)); } } $number = 0; foreach ($efforts as $e) { $form->add(new Form_HiddenField("effort_id_{$number}", '', $e->id)); $number++; } $form->add(new Form_HiddenField("number", '', $number)); echo $form; $block->render_blockEnd(); $PH->go_submit = 'effortEditMultipleSubmit'; if ($return = get('return')) { echo "<input type=hidden name='return' value='{$return}'>"; } echo new PageContentClose(); echo new PageHtmlEnd(); exit; }
/** * Edit a company * @ingroup pages */ function companyEdit($company = NULL) { global $PH; global $auth; ### use object or get from database ### if (!$company) { $id = getOnePassedId('company', 'companies_*'); # WARNS if multiple; ABORTS if no id found $company = Company::getEditableById($id); if (!$company) { $PH->abortWarning("ERROR: could not get Company"); return; } } $page = new Page(array('use_jscalendar' => true, 'autofocus_field' => 'company_name')); $page->cur_tab = 'companies'; $page->type = __("Edit Company"); $page->title = $company->name; $page->crumbs = build_company_crumbs($company); $page->options[] = new NaviOption(array('target_id' => 'companyEdit')); echo new PageHeader(); echo new PageContentOpen(); $block = new PageBlock(array('id' => 'edit')); $block->render_blockStart(); global $g_ccategory_names; require_once confGet('DIR_STREBER') . 'render/render_form.inc.php'; $form = new PageForm(); $form->button_cancel = true; foreach ($company->fields as $field) { $form->add($field->getFormElement($company)); } ### dropdown menu for company category ### if (get('comcat')) { $comcat = get('comcat'); } else { if ($company->id) { $comcat = $company->category; } else { $comcat = CCATEGORY_CLIENT; } } $form->add(new Form_Dropdown('ccategory', __('Category', 'form label'), array_flip($g_ccategory_names), $comcat)); ### create another ### if ($auth->cur_user->user_rights & RIGHT_COMPANY_CREATE && $company->id == 0) { $checked = get('create_another') ? 'checked' : ''; $form->form_options[] = "<span class=option><input id='create_another' name='create_another' class='checker' type=checkbox {$checked}><label for='create_another'>" . __("Create another company after submit") . "</label></span>"; } echo $form; $PH->go_submit = 'companyEditSubmit'; ### pass person-id? ### if ($p = get('person')) { echo "<input type='hidden' name='person' value='{$p}'>"; } echo "<input type=hidden name='company' value='{$company->id}'>"; $block->render_blockEnd(); echo new PageContentClose(); echo new PageHtmlEnd(); }
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(); }
/** * 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(); }
/** * 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(); }
/** * Edit meta information of a file * * read more at http://www.streber-pm.org/3658 */ function fileEdit($file = NULL) { global $PH; if (!$file) { $id = getOnePassedId('file', 'files_*'); # WARNS if multiple; ABORTS if no id found if (!($file = File::getEditableById($id))) { $PH->abortWarning("ERROR: could not get File"); return; } } if (!($project = Project::getVisibleById($file->project))) { $PH->abortWarning("ERROR: could not get Project", ERROR_BUG); } $page = new Page(array('use_jscalendar' => true, 'autofocus_field' => 'file_name')); initPageForFile($page, $file, $project); if ($file->id) { $page->title = __('Edit File', 'page title'); } else { $page->title = __('New file', 'page title'); } #$page->title_minor= sprintf(__('On project %s','page title add on'),$project->name); echo new PageHeader(); echo new PageContentOpen(); $block = new PageBlock(array('id' => 'edit')); $block->render_blockStart(); require_once confGet('DIR_STREBER') . 'render/render_form.inc.php'; $form = new PageForm(); $form->button_cancel = true; $form->add($file->fields['name']->getFormElement($file)); $form->add($file->fields['description']->getFormElement($file)); /** * until new file is added to database keep details in hiddenfields */ if ($file->id == 0) { $form->add(new Form_HiddenField('file_mimetype', '', urlencode($file->mimetype))); $form->add(new Form_HiddenField('file_filesize', '', intval($file->filesize))); $form->add(new Form_HiddenField('file_org_filename', '', urlencode($file->org_filename))); $form->add(new Form_HiddenField('file_tmp_filename', '', urlencode($file->tmp_filename))); $form->add(new Form_HiddenField('file_tmp_dir', '', $file->tmp_dir)); $form->add(new Form_HiddenField('file_is_image', '', $file->is_image)); $form->add(new Form_HiddenField('file_version', '', $file->version)); $form->add(new Form_HiddenField('file_parent_item', '', $file->parent_item)); $form->add(new Form_HiddenField('file_org_file', '', $file->org_file)); } $form->add(new Form_HiddenField('file', '', $file->id)); $form->add(new Form_HiddenField('file_project', '', $file->project)); $st = array(); global $g_status_names; foreach ($g_status_names as $s => $n) { if ($s >= STATUS_NEW) { $st[$s] = $n; } } $form->add(new Form_Dropdown('file_status', "Status", array_flip($st), $file->status)); ### public-level ### if (($pub_levels = $file->getValidUserSetPublicLevels()) && count($pub_levels) > 1) { $form->add(new Form_Dropdown('file_pub_level', __("Publish to"), $pub_levels, $file->pub_level)); } echo $form; $PH->go_submit = 'fileEditSubmit'; $block->render_blockEnd(); echo new PageContentClose(); echo new PageHtmlEnd(); }