/** * Generate url to Expend/Collapse a part of a page * @see my_hide_url */ function hide_url($svc, $db_item_id, $defaultHide = false, $hide = null) { $pref_name = 'hide_' . $svc . $db_item_id; if (empty($hide)) { $hide = $_REQUEST['hide_' . $svc]; } $noPref = false; $old_hide = user_get_preference($pref_name); // Make sure they are both 0 if never set before if ($old_hide == false) { $noPref = true; $old_hide = 0; } // If no given value for hide, keep the old one if (!isset($hide)) { $hide = $old_hide; } // Update pref value if needed if ($old_hide != $hide) { user_set_preference($pref_name, $hide); } if ($hide == 2 || $noPref && $defaultHide) { $hide_url = 'hide_' . $svc . '=1&hide_item_id=' . $db_item_id; $hide_img = '<img src="' . util_get_image_theme("pointer_right.png") . '" align="middle" border="0" alt="Expand">'; $hide_now = true; } else { $hide_url = 'hide_' . $svc . '=2&hide_item_id=' . $db_item_id; $hide_img = '<img src="' . util_get_image_theme("pointer_down.png") . '" align="middle" border="0" alt="Collapse">'; $hide_now = false; } return array($hide_now, $hide_url, $hide_img); }
function __construct() { parent::__construct(self::ID); $this->artifact_show = user_get_preference(self::PREF_SHOW); if ($this->artifact_show === false) { $this->artifact_show = 'AS'; user_set_preference(self::PREF_SHOW, $this->artifact_show); } }
function Widget_MyArtifacts() { $this->Widget('myartifacts'); $this->_artifact_show = user_get_preference('my_artifacts_show'); if ($this->_artifact_show === false) { $this->_artifact_show = 'AS'; user_set_preference('my_artifacts_show', $this->_artifact_show); } }
/** * Constructor of the class * * @param String $pluginPath Path of plugin git * * @return Void */ public function __construct($pluginPath) { $this->pluginPath = $pluginPath; $this->Widget('plugin_git_user_pushes'); $this->offset = user_get_preference('plugin_git_user_pushes_offset'); if (empty($this->offset)) { $this->offset = 5; } $this->pastDays = user_get_preference('plugin_git_user_pushes_past_days'); if (empty($this->pastDays)) { $this->pastDays = 30; } }
/** * Constructor * * @param Int $group_id The owner id * @param hudsonPlugin $plugin The plugin * @param HudsonJobFactory $factory The HudsonJob factory * * @return void */ function __construct($group_id, hudsonPlugin $plugin, HudsonJobFactory $factory) { parent::__construct('plugin_hudson_project_jobsoverview', $factory); $this->setOwner($group_id, WidgetLayoutManager::OWNER_TYPE_GROUP); $this->plugin = $plugin; $request =& HTTPRequest::instance(); $this->group_id = $request->get('group_id'); $this->_use_global_status = user_get_preference('plugin_hudson_use_global_status' . $this->group_id); if ($this->_use_global_status === false) { $this->_use_global_status = "false"; user_set_preference('plugin_hudson_use_global_status' . $this->group_id, $this->_use_global_status); } if ($this->_use_global_status == "true") { $this->_all_status = array('grey' => 0, 'blue' => 0, 'yellow' => 0, 'red' => 0); } }
function my_hide($svc, $db_item_id, $item_id, $hide) { $pref_name = 'my_hide_' . $svc . $db_item_id; $old_pref_value = user_get_preference($pref_name); list($old_hide, $old_count) = explode('|', $old_pref_value); // Make sure they are both 0 if never set before if ($old_hide == false) { $old_hide = 0; } if ($item_id == $db_item_id) { if (!isset($hide)) { $hide = $old_hide; } } else { $hide = $old_hide; } return $hide; }
/** * function to set user preferences * * @return null */ function fetchPrefs() { $prefs = array(); $advsrch = 0; $morder = ""; $report_id = 100; //if (user_isloggedin()) { $custom_pref = user_get_preference('artifact_brow_cust' . $this->atid); if ($custom_pref) { $pref_arr = explode('&', substr($custom_pref, 1)); while (list(, $expr) = each($pref_arr)) { // Extract left and right parts of the assignment // and remove the '[]' array symbol from the left part list($field, $value_id) = explode('=', $expr); $field = str_replace('[]', '', $field); if ($field == 'advsrch') { $advsrch = $value_id ? 1 : 0; } else { if ($field == 'msort') { $msort = $value_id ? 1 : 0; } else { if ($field == 'chunksz') { $chunksz = $value_id; } else { if ($field == 'report_id') { $report_id = $value_id; } else { $prefs[$field][] = urldecode($value_id); } } } } //echo '<br>DBG restoring prefs : $prefs['.$field.'] []='.$value_id; } } $morder = user_get_preference('artifact_browse_order' . $this->atid); //} $this->prefs = $prefs; $this->advsrch = $advsrch; $this->morder = $morder; $this->report_id = $report_id; }
/** * Constructor * * @param Int $user_id The owner id * @param hudsonPlugin $plugin The plugin * @param HudsonJobFactory $factory The HudsonJob factory * * @return void */ function __construct($user_id, hudsonPlugin $plugin, HudsonJobFactory $factory) { parent::__construct('plugin_hudson_my_jobs', $factory); $this->setOwner($user_id, WidgetLayoutManager::OWNER_TYPE_USER); $this->plugin = $plugin; $this->_not_monitored_jobs = user_get_preference('plugin_hudson_my_not_monitored_jobs'); if ($this->_not_monitored_jobs === false) { $this->_not_monitored_jobs = array(); } else { $this->_not_monitored_jobs = explode(",", $this->_not_monitored_jobs); } $this->_use_global_status = user_get_preference('plugin_hudson_use_global_status'); if ($this->_use_global_status === false) { $this->_use_global_status = "false"; user_set_preference('plugin_hudson_use_global_status', $this->_use_global_status); } if ($this->_use_global_status == "true") { $this->_all_status = array('grey' => 0, 'blue' => 0, 'yellow' => 0, 'red' => 0); } }
/** * Get the CSV separator defined in the Account Maintenance preferences * * @return string the CSV separator defined by the user or "," by default if the user didn't defined it */ function get_csv_separator() { if ($u_separator = user_get_preference("user_csv_separator")) { } else { $u_separator = PFUser::DEFAULT_CSV_SEPARATOR; } $separator = ''; switch ($u_separator) { case 'comma': $separator = ","; break; case 'semicolon': $separator = ";"; break; case 'tab': $separator = "\t"; break; default: $separator = PFUser::DEFAULT_CSV_SEPARATOR; break; } return $separator; }
<?php require_once 'pre.php'; $valid = new Valid_UInt('tracker_id'); $valid->required(); if ($request->valid($valid)) { if (user_get_preference('tracker_comment_invertorder_' . $request->get('tracker_id'))) { user_del_preference('tracker_comment_invertorder_' . $request->get('tracker_id')); } else { user_set_preference('tracker_comment_invertorder_' . $request->get('tracker_id'), '1'); } }
$set = 'open'; } } if ($set == 'my') { /* My requests - backwards compat can be removed 9/10 */ $_status = 1; $_assigned_to = user_getid(); } else { if ($set == 'custom') { /* if this custom set is different than the stored one, reset preference */ $pref_ = $_assigned_to . '|' . $_status . '|' . $_category; if ($pref_ != user_get_preference('sup_brow_cust' . $group_id)) { //echo 'setting pref'; user_set_preference('sup_brow_cust' . $group_id, $pref_); } } else { if ($set == 'closed') { /* Closed requests - backwards compat can be removed 9/10 */ $_assigned_to = 0; $_status = '2'; } else { /* Open requests - backwards compat can be removed 9/10 */ $_assigned_to = 0;
function getPreferences() { $prefs = ''; $prefs .= $GLOBALS['Language']->getText('my_index', 'my_latest_svn_commit_nb_prefs'); $prefs .= ' <input name="nb_svn_commits" type="text" size="2" maxlenght="3" value="' . user_get_preference('my_latests_svn_commits_nb_display') . '">'; return $prefs; }
/** * Hook to set all user preferences . * * @param params:hook parameters */ function tracker_user_pref($params) { if ($this->isAllowed()) { $this->group_id = $params['group_id']; $this->atid = $params['atid']; $this->report_id = $params['report_id']; $this->prefs = $params['prefs']; $this->morder = $params['morder']; $this->chunksz = $params['chunksz']; $this->advsrch = $params['advsrch']; $this->msort = $params['msort']; $this->offset = $params['offset']; $this->set = $params['set']; $request =& HTTPRequest::instance(); $func = $request->get('func'); $set = $request->get('set'); if ($request->get('report_graphic_id') !== false && $request->valid(new Valid_UInt('report_graphic_id'))) { $this->report_graphic_id = $request->get('report_graphic_id'); $trackerGraphsPrefs = "&report_graphic_id=" . $this->report_graphic_id; if ($trackerGraphsPrefs != user_get_preference('tracker_graph_brow_cust' . $request->get('atid'))) { user_set_preference('tracker_graph_brow_cust' . $request->get('atid'), $trackerGraphsPrefs); } } else { if (user_isloggedin()) { $custom_pref = user_get_preference('tracker_graph_brow_cust' . $this->atid); if ($custom_pref) { $pref_arr = explode('&', substr($custom_pref, 1)); while (list(, $expr) = each($pref_arr)) { list($field, $value_id) = explode('=', $expr); $field = str_replace('[]', '', $field); if ($field == 'report_graphic_id') { $this->report_graphic_id = $value_id; } } } } } } }
$sql .= " AND user_group.group_id = " . db_ei($in_project) . " "; } if ($search || $begin) { $sql .= ' AND ( '; if ($search) { $sql .= " user.realname LIKE '%" . db_es($search) . "%' OR user.user_name LIKE '%" . db_es($search) . "%' OR user.email LIKE '%" . db_es($search) . "%' "; if ($begin) { $sql .= " OR "; } } if ($begin) { $sql .= " user.realname LIKE '" . db_es($begin) . "%' OR user.user_name LIKE '" . db_es($begin) . "%' OR user.email LIKE '" . db_es($begin) . "%' "; } $sql .= " ) "; } $sql .= "ORDER BY " . (user_get_preference("username_display") > 1 ? 'realname' : 'user_name') . "\n LIMIT " . db_ei($offset) . ", " . db_ei($number_per_page); //echo $sql; $res = db_query($sql); $res2 = db_query('SELECT FOUND_ROWS() as nb'); $num_total_rows = db_result($res2, 0, 'nb'); display_user_result_table($res); //Jump to page $nb_of_pages = ceil($num_total_rows / $number_per_page); $current_page = round($offset / $number_per_page); echo '<div style="font-family:Verdana">Page: '; $width = 10; for ($i = 0; $i < $nb_of_pages; ++$i) { if ($i == 0 || $i == $nb_of_pages - 1 || $current_page - $width / 2 <= $i && $i <= $width / 2 + $current_page) { echo '<a href="?' . 'group_id=' . (int) $group_id . '&ugroup_id=' . (int) $ugroup_id . '&offset=' . (int) ($i * $number_per_page) . '&number_per_page=' . (int) $number_per_page . '&search=' . urlencode($search) . '&begin=' . urlencode($begin) . '&in_project=' . (int) $in_project . '">'; if ($i == $current_page) { echo '<b>' . ($i + 1) . '</b>';
/** * Return the string to display the follow ups comments * * @param Integer group_id: the group id * @param Integer output By default set to OUTPUT_BROWSER, the output is displayed on browser * set to OUTPUT_MAIL_TEXT, the followups will be sent in mail * else is an export csv/DB * @return string the follow-up comments to display in HTML or in ascii mode */ function showFollowUpComments($group_id, $pv, $output = self::OUTPUT_BROWSER) { $hp = $this->getHTMLPurifier(); $uh = UserHelper::instance(); // // Format the comment rows from artifact_history // global $Language; //$group = $this->ArtifactType->getGroup(); $group_artifact_id = $this->ArtifactType->getID(); //$group_id = $group->getGroupId(); $result = $this->getFollowups(); $rows = db_numrows($result); // No followup comment -> return now if ($rows <= 0) { if ($output == self::OUTPUT_EXPORT || $output == self::OUTPUT_MAIL_TEXT) { $out = $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . " " . $Language->getText('tracker_import_utils', 'no_followups') . $GLOBALS['sys_lf']; } else { $out = '<H4>' . $Language->getText('tracker_import_utils', 'no_followups') . '</H4>'; } return $out; } $out = ''; // Header first if ($output == self::OUTPUT_EXPORT || $output == self::OUTPUT_MAIL_TEXT) { $out .= $Language->getText('tracker_include_artifact', 'follow_ups') . $GLOBALS['sys_lf'] . str_repeat("*", strlen($Language->getText('tracker_include_artifact', 'follow_ups'))); } else { if ($rows > 0) { $out .= '<div style="text-align:right">'; $out .= '<script type="text/javascript"> function tracker_expand_all_comments() { $H(tracker_comment_togglers).values().each(function (value) { (value)(null, true, true); }); } function tracker_collapse_all_comments() { $H(tracker_comment_togglers).values().each(function (value) { (value)(null, true, false); }); } var matches = location.hash.match(/#comment_(\\d*)/); var linked_comment_id = matches ? matches[1] : null; </script>'; $out .= '<a href="#expand_all" onclick="tracker_expand_all_comments(); return false;">' . $Language->getText('tracker_include_artifact', 'expand_all') . '</a> | <a href="#expand_all" onclick="tracker_collapse_all_comments(); return false;">' . $Language->getText('tracker_include_artifact', 'collapse_all') . '</a></div>'; } } // Loop throuh the follow-up comments and format them $last_visit_date = user_get_preference('tracker_' . $this->ArtifactType->getId() . '_artifact_' . $this->getId() . '_last_visit'); for ($i = 0; $i < $rows; $i++) { $comment_type = db_result($result, $i, 'comment_type'); $comment_type_id = db_result($result, $i, 'comment_type_id'); $comment_id = db_result($result, $i, 'artifact_history_id'); $field_name = db_result($result, $i, 'field_name'); $orig_subm = $this->getOriginalCommentSubmitter($comment_id); $orig_date = $this->getOriginalCommentDate($comment_id); $value = db_result($result, $i, 'new_value'); $isHtml = db_result($result, $i, 'format'); if ($comment_type_id == 100 || $comment_type == "") { $comment_type = ''; } else { $comment_type = '[' . SimpleSanitizer::unsanitize($comment_type) . ']'; } if ($output == self::OUTPUT_EXPORT || $output == self::OUTPUT_MAIL_TEXT) { $fmt = $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . "------------------------------------------------------------------" . $GLOBALS['sys_lf'] . $Language->getText('tracker_import_utils', 'date') . ": %-30s" . $Language->getText('global', 'by') . ": %s" . $GLOBALS['sys_lf'] . "%s"; //The mail body $comment_txt = $this->formatFollowUp($group_id, $isHtml, $value, $output); $out .= sprintf($fmt, format_date(util_get_user_preferences_export_datefmt(), db_result($orig_date, 0, 'date')), db_result($orig_subm, 0, 'mod_by') == 100 ? db_result($orig_subm, 0, 'email') : user_getname(db_result($orig_subm, 0, 'mod_by')), ($comment_type != '' ? $comment_type . $GLOBALS['sys_lf'] : '') . $comment_txt); } else { $style = ''; $toggle = 'ic/toggle_minus.png'; if ($last_visit_date > db_result($orig_date, 0, 'date') && $i > 0) { $style = 'style="display:none;"'; $toggle = 'ic/toggle_plus.png'; } $out .= "\n" . ' <div class="followup_comment" id="comment_' . $comment_id . '"> <div class="' . util_get_alt_row_color($i) . ' followup_comment_header"> <div class="followup_comment_title">'; $out .= '<script type="text/javascript">document.write(\'<span>'; $out .= $GLOBALS['HTML']->getImage($toggle, array('id' => 'comment_' . (int) $comment_id . '_toggle', 'style' => 'vertical-align:middle; cursor:hand; cursor:pointer;', 'title' => addslashes($GLOBALS['Language']->getText('tracker_include_artifact', 'toggle')))); $out .= '</span>\');</script>'; $out .= '<script type="text/javascript">'; $out .= "tracker_comment_togglers[" . (int) $comment_id . "] = function (evt, force, expand) {\n var toggle = \$('comment_" . (int) $comment_id . "_toggle');\n var element = \$('comment_" . (int) $comment_id . "_content');\n if (element) {\n if (!force || (expand && !element.visible()) || (!expand && element.visible())) {\n Element.toggle(element);\n \n //replace image\n var src_search = 'toggle_minus';\n var src_replace = 'toggle_plus';\n if (toggle.src.match('toggle_plus')) {\n src_search = 'toggle_plus';\n src_replace = 'toggle_minus';\n }\n toggle.src = toggle.src.replace(src_search, src_replace);\n }\n }\n if (evt) {\n Event.stop(evt);\n }\n return false;\n };\n Event.observe(\$('comment_" . (int) $comment_id . "_toggle'), 'click', tracker_comment_togglers[" . (int) $comment_id . "]);"; $out .= '</script>'; $out .= '<span><a href="#comment_' . (int) $comment_id . '" title="Link to this comment - #' . (int) $comment_id . '" onclick="tracker_comment_togglers[' . (int) $comment_id . '](null, true, true);">'; $out .= $GLOBALS['HTML']->getImage('ic/comment.png', array('border' => 0, 'style' => 'vertical-align:middle', 'title' => 'Link to this comment - #' . (int) $comment_id)); $out .= '</a> </span>'; $out .= '<span class="followup_comment_title_user">'; if (db_result($orig_subm, 0, 'mod_by') == 100) { $out .= db_result($orig_subm, 0, 'email'); } else { $out .= '<a href="/users/' . urlencode(user_getname(db_result($orig_subm, 0, 'mod_by'))) . '">' . $hp->purify($uh->getDisplayNameFromUserId(db_result($orig_subm, 0, 'mod_by')), CODENDI_PURIFIER_CONVERT_HTML) . '</a>'; } $out .= ' </span>'; $out .= '<span class="followup_comment_title_date">'; $out .= html_time_ago(db_result($orig_date, 0, 'date')); $out .= '</span>'; if ($field_name != "comment") { $out .= " (" . $GLOBALS['Language']->getText('tracker_include_artifact', 'last_edited') . " "; $out .= '<span class="followup_comment_title_edited_user">'; if (db_result($result, $i, 'mod_by') == 100) { $out .= db_result($result, $i, 'email'); } else { $out .= '<a href="/users/' . urlencode(user_getname(db_result($result, $i, 'mod_by'))) . '">' . $hp->purify(user_getname(db_result($result, $i, 'mod_by')), CODENDI_PURIFIER_CONVERT_HTML) . '</a>'; } $out .= ' </span>'; $out .= '<span class="followup_comment_title_date">'; $out .= html_time_ago(db_result($result, $i, 'date')); $out .= '</span>' . ")"; } $out .= "\n</div><!-- followup_comment_title -->\n"; $out .= '<div class="followup_comment_title_toolbar">'; if (db_result($orig_subm, 0, 'mod_by') == 100) { $user_quoted = db_result($orig_subm, 0, 'email'); } else { $user_quoted = $uh->getDisplayNameFromUserId(db_result($orig_subm, 0, 'mod_by')); } $user_quoted = addslashes(addslashes($user_quoted)); if ($pv == 0) { $out .= '<script type="text/javascript">document.write(\'<a href="#quote" onclick="tracker_quote_comment(\\\'' . $user_quoted . '\\\', \\\'' . (int) $comment_id . '\\\'); return false;" title="quote">'; $out .= $GLOBALS['HTML']->getImage('ic/quote.png', array('border' => 0, 'alt' => 'quote')); $out .= '</a>\');</script>'; } if ($this->userCanEditFollowupComment($comment_id) && !$pv) { $out .= '<a href="/tracker/?func=editcomment&group_id=' . (int) $group_id . '&aid=' . (int) $this->getID() . '&atid=' . (int) $group_artifact_id . '&artifact_history_id=' . (int) $comment_id . '" title="' . $GLOBALS['Language']->getText('tracker_fieldeditor', 'edit') . '">'; $out .= $GLOBALS['HTML']->getImage('ic/edit.png', array('border' => 0, 'alt' => $GLOBALS['Language']->getText('tracker_fieldeditor', 'edit'))); $out .= '</a>'; $out .= '<a href="/tracker/?func=delete_comment&group_id=' . (int) $group_id . '&aid=' . (int) $this->getID() . '&atid=' . (int) $group_artifact_id . '&artifact_history_id=' . (int) $comment_id . '" '; $out .= ' onClick="return confirm(\'' . $GLOBALS['Language']->getText('tracker_include_artifact', 'delete_comment') . '\')" title="' . $GLOBALS['Language']->getText('tracker_include_artifact', 'del') . '">'; $out .= $GLOBALS['HTML']->getImage('ic/close.png', array('border' => 0, 'alt' => $GLOBALS['Language']->getText('tracker_include_artifact', 'del'))); $out .= '</a>'; } $out .= "\n</div><!-- followup_comment_title_toolbar -->\n"; $out .= '<div style="clear:both;"></div>'; $out .= "\n</div><!-- followup_comment_header -->\n"; $out .= '<div class="followup_comment_content" ' . $style . ' id="comment_' . (int) $comment_id . '_content">'; if ($comment_type != "") { $out .= '<div class="followup_comment_content_type"><b>' . $hp->purify($comment_type, CODENDI_PURIFIER_CONVERT_HTML) . '</b></div>'; } $out .= $this->formatFollowUp($group_id, $isHtml, $value, $output); $out .= '</div>'; $out .= '</div>'; $out .= '<script type="text/javascript"> if (linked_comment_id == ' . (int) $comment_id . ') { tracker_comment_togglers[' . (int) $comment_id . '](null, true, true); } </script>'; } } if ($output == self::OUTPUT_BROWSER) { if ($rows > 0) { $out .= '<div style="text-align:right">'; $out .= '<a href="#expand_all" onclick="tracker_expand_all_comments(); return false;">' . $Language->getText('tracker_include_artifact', 'expand_all') . '</a> | <a href="#expand_all" onclick="tracker_collapse_all_comments(); return false;">' . $Language->getText('tracker_include_artifact', 'collapse_all') . '</a></div>'; } } // final touch... $out .= $output != self::OUTPUT_BROWSER ? $GLOBALS['sys_lf'] : ""; return $out; }
/** * Search users to add to ugroup * * @param Integer $ugroupId Id of the uGroup * @param Array $filters List of filters * * @return Array */ public function searchUsersToAdd($ugroupId, $filters) { $ugroup_id = $this->da->escapeInt($ugroupId); $offset = $this->da->escapeInt($filters['offset']); $number_per_page = $this->da->escapeInt($filters['number_per_page']); $order_by = user_get_preference("username_display") > 1 ? 'realname' : 'user_name'; $join_user_group = $this->getJoinUserGroup($filters); $and_username_filter = $this->getUsernameFilter($filters); $sql = "SELECT SQL_CALC_FOUND_ROWS user.user_id, user_name, realname, email, IF(R.user_id = user.user_id, 1, 0) AS is_on\n FROM user\n NATURAL LEFT JOIN (SELECT user_id FROM ugroup_user WHERE ugroup_id = {$ugroup_id} ) AS R\n {$join_user_group}\n WHERE status in ('A', 'R')\n {$and_username_filter}\n ORDER BY {$order_by}\n LIMIT {$offset}, {$number_per_page}"; $res = $this->retrieve($sql); $res2 = $this->retrieve('SELECT FOUND_ROWS() as nb'); $numTotalRows = $res2->getRow(); return array('result' => $res, 'num_total_rows' => $numTotalRows['nb']); }
} } if ($set == 'my') { /* My commits - backwards compat can be removed 9/10 */ $_tag = 100; $_commiter = user_getname(); $_branch = 100; } else { if ($set == 'custom') { /* if this custom set is different than the stored one, reset preference */ $pref_ = $_commit_id . '|' . $_commiter . '|' . $_tag . '|' . $_branch . '|' . $_srch . '|' . $chunksz; if ($pref_ != user_get_preference('commits_browcust' . $group_id)) { //echo 'setting pref'; user_set_preference('commits_browcust' . $group_id, $pref_); } } else { if ($set == 'any') { /* Closed commits - backwards compat can be removed 9/10 */ $tag = $branch = $_commiter = 100; } } } /* Display commits based on the form post - by user or status or both */
$plugins_prefs = array(); $em->processEvent('user_preferences_appearance', array('preferences' => &$plugins_prefs)); $all_csv_separator = array(); foreach (PFUser::$csv_separators as $separator) { $all_csv_separator[] = array('separator_name' => $separator, 'separator_label' => $Language->getText('account_options', $separator), 'is_selected' => $separator === user_get_preference("user_csv_separator")); } $all_csv_dateformat = array(); foreach (PFUser::$csv_dateformats as $dateformat) { $all_csv_dateformat[] = array('dateformat_name' => $dateformat, 'dateformat_label' => $Language->getText('account_preferences', $dateformat), 'is_selected' => $dateformat === user_get_preference("user_csv_dateformat")); } $user_access_info = $um->getUserAccessInfo($user); if (!$user_access_info) { $user_access_info = array('last_auth_success' => false, 'last_auth_failure' => false, 'nb_auth_failure' => false, 'prev_auth_success' => false); } $svn_token_handler = new SVN_TokenHandler(new SVN_TokenDao(), new RandomNumberGenerator(), PasswordHandlerFactory::getPasswordHandler()); $svn_token_presenters = array(); foreach ($svn_token_handler->getSVNTokensForUser($user) as $user_svn_token) { $svn_token_presenters[] = new SVN_TokenPresenter($user_svn_token); } $last_svn_token = ''; if (isset($_SESSION['last_svn_token'])) { $last_svn_token = $_SESSION['last_svn_token']; unset($_SESSION['last_svn_token']); } $user_default_format = user_get_preference('user_edition_default_format'); $default_formats = array(array('label' => $Language->getText('account_preferences', 'html_format'), 'value' => 'html', 'selected' => $user_default_format === false || $user_default_format === 'html'), array('label' => $Language->getText('account_preferences', 'text_format'), 'value' => 'text', 'selected' => $user_default_format === 'text')); $presenter = new User_PreferencesPresenter($user, $can_change_realname, $can_change_email, $can_change_password, $extra_user_info, $user_access_info, $ssh_keys_extra_html, $svn_token_presenters, $third_paty_html, $csrf->fetchHTMLInput(), $tracker_formats, $all_themes, $languages_html, $user_helper_preferences, $plugins_prefs, $all_csv_separator, $all_csv_dateformat, $last_svn_token, $default_formats); $HTML->header(array('title' => $Language->getText('account_options', 'title'), 'body_class' => array('account-maintenance'))); $renderer = TemplateRendererFactory::build()->getRenderer(dirname(__FILE__) . '/../../templates/user'); $renderer->renderToPage('account-maintenance', $presenter); $HTML->footer(array());
<?php /** * Copyright (c) STMicroelectronics 2012. All rights reserved * * Tuleap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Tuleap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Tuleap. If not, see <http://www.gnu.org/licenses/>. */ require_once 'pre.php'; $valid = new Valid_UInt('tracker'); $valid->required(); if ($request->valid($valid)) { echo user_get_preference('tracker_comment_invertorder_' . $request->get('tracker')); }
function getCopyPreference($user) { if (!isset($this->copiedItem[$user->getId()])) { $this->copiedItem[$user->getId()] = user_get_preference(PLUGIN_DOCMAN_PREF . '_item_copy'); } return $this->copiedItem[$user->getId()]; }
function _displayItem(&$item, $params) { $li_displayed = false; if ($this->stripFirstNode && !$this->firstNodeStripped) { $this->firstNodeStripped = true; if (isset($this->params['display_description']) && $this->params['display_description']) { $this->html .= '<p>' . $item->getDescription() . '</p>'; } } else { if ($item !== null && $this->_canDisplayItem($item)) { $this->html .= '<li id="item_' . $item->getId() . '" class="' . Docman_View_Browse::getItemClasses($params) . '">'; $params['expanded'] = true; $open = '_open'; if (!isset($this->params['item_to_move']) && user_get_preference(PLUGIN_DOCMAN_EXPAND_FOLDER_PREF . '_' . $item->getGroupId() . '_' . $item->getId()) === false) { $params['expanded'] = false; $open = ''; } $icon_src = $this->params['docman_icons']->getIconForItem($item, $params); $icon = '<img src="' . $icon_src . '" class="docman_item_icon" />'; $this->html .= '<div>'; $action = isset($this->params['item_to_move']) ? false : $item->accept($this->get_action_on_icon, array('view' => &$this->view)); if ($action) { $class = $item->accept($this->get_class_for_link, array('view' => &$this->view)); if ($class) { $class .= $open; } $url = Docman_View_View::buildUrl($this->params['default_url'], array('action' => $action, 'id' => $item->getId())); $this->html .= '<a href="' . $url . '" class="' . $class . '">'; } $this->html .= $icon; if ($action) { $this->html .= '</a>'; } $this->html .= '<span class="docman_item_title">'; if ($action) { $url = Docman_View_View::buildActionUrl($this->params, array('action' => 'show', 'id' => $item->getId()), false, isset($params['popup_doc']) ? true : false); $this->html .= '<a href="' . $url . '" id="docman_item_title_link_' . $item->getId() . '">'; } $this->html .= $this->hp->purify($item->getTitle(), CODENDI_PURIFIER_CONVERT_HTML); if ($action) { $this->html .= '</a>'; } $this->html .= '</span>'; $this->html .= $this->view->getItemMenu($item, $this->params); $this->js .= $this->view->getActionForItem($item); $this->html .= '</div>'; if (trim($item->getDescription()) != '') { $this->html .= '<div class="docman_item_description">' . $this->hp->purify($item->getDescription(), CODENDI_PURIFIER_BASIC, $item->getGroupId()) . '</div>'; } $li_displayed = true; } } return $li_displayed; }
} } else { $pref_stg .= '&' . $field . '[]=' . $value_id; } } // build part of the HTML title of this page for more friendly bookmarking // Do not add the criteria in the header if value is "Any" if ($value_id != 0) { $hdr .= $Language->getText('global', 'by') . $field->getLabel() . ': ' . $field->getValue($group_id, $value_id); } } $pref_stg .= '&advsrch=' . ($advsrch ? 1 : 0); $pref_stg .= '&msort=' . ($msort ? 1 : 0); $pref_stg .= '&chunksz=' . (int) $chunksz; $pref_stg .= '&report_id=' . (int) $report_id; if ($pref_stg != user_get_preference('artifact_brow_cust' . $atid)) { //echo "<br> DBG setting pref = $pref_stg"; user_set_preference('artifact_brow_cust' . $atid, $pref_stg); } } else { if ($set == 'all') { // Any value for very field $prefs['status_id'][] = 0; $prefs['assigned_to'][] = 0; $prefs['multi_assigned_to'][] = 0; } else { // Open artifacts - backwards compat can be removed 9/10 $prefs['status_id'][] = 1; // Any value for assigned to $prefs['assigned_to'][] = 0; $prefs['multi_assigned_to'][] = 0;
function _getReviews($reviewer = true) { $hp = Codendi_HTMLPurifier::instance(); require_once 'www/my/my_utils.php'; $html = ''; $content_html_id = 'plugin_docman_approval_' . ($reviewer ? 'reviewer' : 'requester'); $html .= '<div style="font-weight:bold;">'; $html .= $GLOBALS['HTML']->getImage('pointer_down.png', array('id' => $content_html_id . '_icon', 'onclick' => "plugin_docman_approval_toggle('{$content_html_id}', true)")) . ' '; if ($reviewer) { $html .= $GLOBALS['Language']->getText('plugin_docman', 'my_reviews_reviewer'); } else { $html .= $GLOBALS['Language']->getText('plugin_docman', 'my_reviews_requester'); } $html .= '</div>'; $html .= '<div id="' . $content_html_id . '" style="padding-left:20px;">'; $um =& UserManager::instance(); $user =& $um->getCurrentUser(); if ($reviewer) { $reviewsArray = Docman_ApprovalTableReviewerFactory::getAllPendingReviewsForUser($user->getId()); } else { $reviewsArray = Docman_ApprovalTableReviewerFactory::getAllApprovalTableForUser($user->getId()); } if (count($reviewsArray) > 0) { $request =& HTTPRequest::instance(); // Get hide arguments $hideItemId = (int) $request->get('hide_item_id'); $hideApproval = null; if ($request->exist('hide_plugin_docman_approval')) { $hideApproval = (int) $request->get('hide_plugin_docman_approval'); } $prevGroupId = -1; $hideNow = false; $i = 0; $html .= '<table style="width:100%">'; //$html .= '<TR><TD colspan="2">Reviewer - Requester</TD></TR>'; foreach ($reviewsArray as $review) { if ($review['group_id'] != $prevGroupId) { list($hideNow, $count_diff, $hideUrl) = my_hide_url('plugin_docman_approval', $review['group_id'], $hideItemId, 1, $hideApproval); $docmanUrl = $this->pluginPath . '/?group_id=' . $review['group_id']; $docmanHref = '<a href="' . $docmanUrl . '">' . $review['group'] . '</a>'; if ($prevGroupId != -1) { if ($reviewer) { $colspan = 2; } else { $colspan = 3; } $html .= '<tr class="boxitem"><td colspan="' . $colspan . '">'; } $html .= '<strong>' . $hideUrl . $docmanHref . '</strong></td></tr>'; $i = 0; } if (!$hideNow) { $html .= '<tr class="' . util_get_alt_row_color($i++) . '">'; // Document $html .= '<td align="left">'; $html .= '<a href="' . $review['url'] . '">' . $hp->purify($review['title'], CODENDI_PURIFIER_CONVERT_HTML) . '</a>'; $html .= '</td>'; // For requester, precise the status if (!$reviewer) { $html .= '<td align="right">'; $html .= $review['status']; $html .= '</td>'; } // Date $html .= '<td align="right">'; $html .= util_timestamp_to_userdateformat($review['date'], true); $html .= '</td>'; $html .= '</tr>'; } $prevGroupId = $review['group_id']; } $html .= '</table>'; } else { if ($reviewer) { $html .= $GLOBALS['Language']->getText('plugin_docman', 'my_no_review'); } else { $html .= $GLOBALS['Language']->getText('plugin_docman', 'my_no_request'); } } $html .= '</div>'; if (user_get_preference('hide_plugin_docman_approval_' . ($reviewer ? 'reviewer' : 'requester'))) { $html .= '<script type="text/javascript">'; $html .= "document.observe('dom:loaded', function() \n {\n plugin_docman_approval_toggle('{$content_html_id}', false);\n }\n );\n </script>"; } return $html; }
function util_xlsdatefmt_explode($date) { if ($u_pref = user_get_preference("user_csv_dateformat")) { } else { $u_pref = PFUser::DEFAULT_CSV_DATEFORMAT; } $res = preg_match("/\\s*(\\d+)\\/(\\d+)\\/(\\d+) (\\d+):(\\d+)/", $date, $match); if ($res == 0) { //if it doesn't work try (n/j/Y) only $res = preg_match("/\\s*(\\d+)\\/(\\d+)\\/(\\d+)/", $date, $match); if ($res == 0) { // nothing is valid return Epoch time $year = '1970'; $month = '1'; $day = '1'; $hour = '0'; $minute = '0'; } else { if ($u_pref == "day_month_year") { list(, $day, $month, $year) = $match; $hour = '0'; $minute = '0'; } else { list(, $month, $day, $year) = $match; $hour = '0'; $minute = '0'; } } } else { if ($u_pref == "day_month_year") { list(, $day, $month, $year, $hour, $minute) = $match; } else { list(, $month, $day, $year, $hour, $minute) = $match; } } return array($year, $month, $day, $hour, $minute); }
$is_default = $theme === $GLOBALS['sys_themedefault']; $is_selected = $is_default; if ($user->getTheme()) { $is_selected = $theme === $user->getTheme(); } $all_themes[] = array('theme_name' => $theme, 'is_selected' => $is_selected, 'is_default' => $is_default); } $languages_html = array(); foreach ($GLOBALS['Language']->getLanguages() as $code => $lang) { $languages_html[] = array('lang' => $lang, 'code' => $code, 'is_selected' => $user->getLocale() === $code); } $user_helper_preferences = array(array('preference_name' => UserHelper::PREFERENCES_NAME_AND_LOGIN, 'preference_label' => $Language->getText('account_options', 'tuleap_name_and_login'), 'is_selected' => (int) user_get_preference("username_display") === UserHelper::PREFERENCES_NAME_AND_LOGIN), array('preference_name' => UserHelper::PREFERENCES_LOGIN_AND_NAME, 'preference_label' => $Language->getText('account_options', 'tuleap_login_and_name'), 'is_selected' => (int) user_get_preference("username_display") === UserHelper::PREFERENCES_LOGIN_AND_NAME), array('preference_name' => UserHelper::PREFERENCES_LOGIN, 'preference_label' => $Language->getText('account_options', 'tuleap_login'), 'is_selected' => (int) user_get_preference("username_display") === UserHelper::PREFERENCES_LOGIN), array('preference_name' => UserHelper::PREFERENCES_REAL_NAME, 'preference_label' => $Language->getText('account_options', 'real_name'), 'is_selected' => (int) user_get_preference("username_display") === UserHelper::PREFERENCES_REAL_NAME)); $plugins_prefs = array(); $em->processEvent('user_preferences_appearance', array('preferences' => &$plugins_prefs)); $all_csv_separator = array(); foreach (PFUser::$csv_separators as $separator) { $all_csv_separator[] = array('separator_name' => $separator, 'separator_label' => $Language->getText('account_options', $separator), 'is_selected' => $separator === user_get_preference("user_csv_separator")); } $all_csv_dateformat = array(); foreach (PFUser::$csv_dateformats as $dateformat) { $all_csv_dateformat[] = array('dateformat_name' => $dateformat, 'dateformat_label' => $Language->getText('account_preferences', $dateformat), 'is_selected' => $dateformat === user_get_preference("user_csv_dateformat")); } $user_access_info = $um->getUserAccessInfo($user); if (!$user_access_info) { $user_access_info = array('last_auth_success' => false, 'last_auth_failure' => false, 'nb_auth_failure' => false, 'prev_auth_success' => false); } $presenter = new User_PreferencesPresenter($user, $can_change_realname, $can_change_email, $can_change_password, $extra_user_info, $user_access_info, $ssh_keys_extra_html, $third_paty_html, $csrf->fetchHTMLInput(), $tracker_formats, $all_themes, $languages_html, $user_helper_preferences, $plugins_prefs, $all_csv_separator, $all_csv_dateformat); $HTML->header(array('title' => $Language->getText('account_options', 'title'), 'body_class' => array('account-maintenance'))); $renderer = TemplateRendererFactory::build()->getRenderer(dirname(__FILE__) . '/../../templates/user'); $renderer->renderToPage('account-maintenance', $presenter); $HTML->footer(array());
function _adminPageUpdate_Service($_REQUEST) { global $Language, $feedback; $group_id = (int) $_REQUEST['group_id']; switch ($_REQUEST['func']) { case 'pl_config_update': if (isset($_REQUEST['EnableProjectLink'])) { user_set_preference("pl_GroupId_master", $group_id); } else { user_del_preference("pl_GroupId_master"); } $feedback .= ' ' . $Language->getText('plugin_plinks', 'update_ok'); break; case 'pl_link_delete': // delete project link $link_id = (int) $_REQUEST['link_id']; // NB: use group_id to defend against malicious use if (db_query("DELETE FROM plugin_projectlinks_relationship\n WHERE (master_group_id=" . db_ei($group_id) . ")\n AND (link_id=" . db_ei($link_id) . ");")) { $feedback .= ' ' . $Language->getText('plugin_plinks', 'project_link_deleted_OK'); } else { $feedback .= ' ' . $Language->getText('plugin_plinks', 'update_failed', db_error()); } break; case 'pl_type_delete': // delete project link type and all links using the type $link_type_id = (int) $_REQUEST['link_type_id']; // delete project relationship instances // NB: use group_id to defend against malicious use if (!db_query("DELETE FROM plugin_projectlinks_relationship\n WHERE (master_group_id=" . db_ei($group_id) . ")\n AND (link_type_id=" . db_ei($link_type_id) . ");")) { $feedback .= ' ' . $Language->getText('plugin_plinks', 'update_failed', db_error()); } else { //delete the relationship type if no error deleting instances if (!db_query("DELETE FROM plugin_projectlinks_link_type\n WHERE (group_id=" . db_ei($group_id) . ")\n AND (link_type_id=" . db_ei($link_type_id) . ");")) { $feedback .= ' ' . $Language->getText('plugin_plinks', 'update_failed', db_error()); } else { $feedback .= ' ' . $Language->getText('plugin_plinks', 'project_link_deleted_OK'); } if (user_get_preference("pl_GroupId_master") == $group_id) { // switch off linking to this project - it would be better // to check if no types left, but this works well user_del_preference("pl_GroupId_master"); } } break; case 'pl_type_update': $q_name = "'" . db_es($_REQUEST['name']) . "'"; $q_reverse_name = "'" . db_es(nz($_REQUEST['reverse_name'], $_REQUEST['name'])) . "'"; $q_description = "'" . db_es($_REQUEST['description']) . "'"; /** **1 commented out for now - until we can decide how to deal with project links functionality $q_uri_plus = db_es($_REQUEST['uri_plus']); **/ $q_uri_plus = "'" . db_es('/projects/$projname/') . "'"; // $link_type_id is not set when submitting a new link if (isset($_REQUEST['link_type_id'])) { $link_type_id = (int) $_REQUEST['link_type_id']; } else { $link_type_id = NULL; } // check the change would not create a duplicate $pfcheck = db_query("SELECT name\n FROM plugin_projectlinks_link_type\n WHERE (((name=" . $q_name . ")\n OR (reverse_name=" . $q_reverse_name . "))\n AND ((group_id=" . db_ei($group_id) . ")" . (is_null($link_type_id) ? "" : " AND (link_type_id<>" . db_ei($link_type_id) . ")") . ")\n );"); if (db_numrows($pfcheck) > 0) { $feedback .= ' ' . $Language->getText('plugin_plinks', 'project_link_type_change_makes_duplicate'); } elseif (update_database("plugin_projectlinks_link_type", array("name" => $q_name, "reverse_name" => $q_reverse_name, "description" => $q_description, "uri_plus" => $q_uri_plus, "group_id" => $group_id), is_null($link_type_id) ? NULL : "link_type_id={$link_type_id}")) { $this->addWidgetOnSummaryPage($group_id); $feedback .= ' ' . $Language->getText('plugin_plinks', 'update_ok') . ' '; } else { $feedback .= ' ' . $Language->getText('plugin_plinks', 'update_failed', db_error()); } break; case 'pl_link_update': $link_type_id = (int) $_REQUEST['link_type_id']; if (isset($_REQUEST['target_group_id'])) { $target_group_id = (int) $_REQUEST['target_group_id']; } else { $prjManager = ProjectManager::instance(); $trgProject = $prjManager->getProjectFromAutocompleter($_REQUEST['target_group']); if ($trgProject !== false) { $target_group_id = $trgProject->getId(); } else { return; } } $group_id = (int) $_REQUEST['group_id']; // NB: $link_id is not set when submitting a new link if (isset($_REQUEST['link_id'])) { $link_id = (int) $_REQUEST['link_id']; } else { $link_id = NULL; // if this is a new link to a template: // add links to all projects already created from the template $db_res = db_query("SELECT group_id\n FROM groups\n WHERE (built_from_template = " . db_ei($target_group_id) . ");"); while ($row = db_fetch_array($db_res)) { $feedback .= ' ' . $this->_link_unique_update($group_id, $row['group_id'], $link_type_id); } } $feedback .= ' ' . $this->_link_unique_update($group_id, $target_group_id, $link_type_id, $link_id); break; case 'template_sync_type_add': $template_type_id = (int) $_REQUEST['template_type_id']; $db_res = db_query("SELECT * FROM plugin_projectlinks_link_type\n WHERE (link_type_id = " . db_ei($template_type_id) . ");"); if (db_numrows($db_res) == 1) { $row = db_fetch_array($db_res); if (db_query("INSERT INTO plugin_projectlinks_link_type (\n group_id,\n name,\n reverse_name,\n description,\n uri_plus\n ) VALUES (\n {$group_id},\n '" . db_es($row['name']) . "',\n '" . db_es($row['reverse_name']) . "',\n '" . db_es($row['description']) . "',\n '" . db_es($row['uri_plus']) . "'\n );")) { $feedback .= ' ' . $Language->getText('plugin_plinks', 'update_ok'); } } break; default: $feedback .= " not implemented: '{$_REQUEST['func']}'"; break; } }
/** * Display screen accepting the CSV file to be parsed * * */ function displayCSVInput($atid, $user_id) { global $Language, $sys_max_size_upload; $this->ath->header(array('title' => $Language->getText('tracker_import', 'art_import') . ' ' . $this->ath->getID() . ' - ' . $this->ath->getName(), 'pagename' => 'tracker', 'atid' => $this->ath->getID(), 'sectionvals' => array($this->group->getPublicName()), 'help' => 'tracker-v3.html#tracker-artifact-import')); echo '<div id="tracker_toolbar_clear"></div>' . PHP_EOL; echo '<h3>' . $Language->getText('tracker_import', 'import_new_hdr', array(help_button('tracker-v3.html#tracker-artifact-import'))) . '</h3>'; echo '<p>' . $Language->getText('tracker_import', 'import_new_msg', array('/tracker/index.php?group_id=' . (int) $this->group->group_id . '&atid=' . (int) $atid . '&user_id=' . (int) $user_id . '&mode=showformat&func=import')) . '</p>'; $_pref_notify = user_get_preference('tracker_import_notify_' . $atid); $notifychecked = ''; if ($_pref_notify === '1') { $notifychecked = 'checked="checked"'; } echo ' <FORM NAME="importdata" id="tracker-import-data" action="" method="POST" enctype="multipart/form-data"> <INPUT TYPE="hidden" name="group_id" value="' . (int) $this->group->group_id . '"> <INPUT TYPE="hidden" name="atid" value="' . (int) $atid . '"> <INPUT TYPE="hidden" name="func" value="import"> <INPUT TYPE="hidden" name="mode" value="parse"> <table border="0"> <tr> <th> '; //<input type="checkbox" name="file_upload" value="1"> echo '<B>' . $Language->getText('tracker_import', 'upload_file') . '</B></th> <td> <input type="file" name="csv_filename" size="50"> </td> <td> <span class="help"><i>' . $Language->getText('tracker_import', 'max_upload_size', formatByteToMb($sys_max_size_upload)) . '</i></span> </td> </tr> <tr> <th> ' . $Language->getText('tracker_import', 'send_notifications') . ' </th> <td colspan="2"> <input type="checkbox" name="notify" value="ok" "' . $notifychecked . '"/> </td> </tr>'; //<tr> //<th>OR Paste Artifact Data (in CSV format):</th> //<td><textarea cols="60" rows="10" name="data"></textarea></td> //</tr> echo ' </table> <br> <input class="btn btn-primary" type="submit" value="' . $Language->getText('tracker_import', 'submit_info') . '"> </FORM> '; $this->ath->footer(array()); }
print '>' . $Language->getText('account_options', $separator) . '</option>\\n'; } print "</select>\n"; ?> </td> </tr> <tr> <td> <?php echo $Language->getText('account_preferences', 'csv_dateformat') . ' ' . help_button('AccountMaintenance'); ?> : </td> <td> <?php if ($u_dateformat = user_get_preference("user_csv_dateformat")) { } else { $u_dateformat = DEFAULT_CSV_DATEFORMAT; } // build the CSV date format select box print '<select name="user_csv_dateformat">' . "\n"; // $csv_dateformats is defined in /www/include/utils.php foreach ($csv_dateformats as $dateformat) { print '<option value="' . $dateformat . '"'; if ($u_dateformat == $dateformat) { print ' selected="selected"'; } print '>' . $Language->getText('account_preferences', $dateformat) . '</option>\\n'; } print "</select>\n"; ?>
/** * Display the artifact * * @param ro: read only parameter - Display mode or update mode * @param pv: printer version * * @return void */ function display($ro, $pv, $user_id) { global $art_field_fact, $art_fieldset_fact, $sys_max_size_attachment, $Language; $hp = Codendi_HTMLPurifier::instance(); $fields_per_line = 2; // the column number is the number of field per line * 2 (label + value) // + the number of field per line -1 (a blank column between each pair "label-value" to give more space) $columns_number = $fields_per_line * 2 + ($fields_per_line - 1); $max_size = 40; $group = $this->ArtifactType->getGroup(); $group_artifact_id = $this->ArtifactType->getID(); $group_id = $group->getGroupId(); $result_fields = $art_field_fact->getAllUsedFields(); $result_fieldsets = $art_fieldset_fact->getAllFieldSetsContainingUsedFields(); $summary = $this->getValue('summary'); echo '<div id="tracker_toolbar_specific">'; if ($this->ArtifactType->allowsCopy()) { echo "<A HREF='?func=copy&aid=" . (int) $this->getID() . "&group_id=" . (int) $group_id . "&atid=" . (int) $group_artifact_id . "'><img src=\"" . util_get_image_theme("ic/copy.png") . "\" /> " . $Language->getText('tracker_include_artifact', 'copy_art') . "</A>"; } echo " <A HREF='?func=detail&aid=" . (int) $this->getID() . "&group_id=" . (int) $group_id . "&atid=" . (int) $group_artifact_id . "&pv=1' target='_blank'><img src='" . util_get_image_theme("ic/printer.png") . "' border='0'> " . $Language->getText('global', 'printer_version') . "</A>"; echo '</div>' . PHP_EOL; echo '<div id="tracker_toolbar_clear"></div>' . PHP_EOL; $artTitle = '[ ' . $hp->purify($this->ArtifactType->getItemName(), CODENDI_PURIFIER_CONVERT_HTML); $field_artifact_id = $result_fields['artifact_id']; if ($field_artifact_id->userCanRead($group_id, $group_artifact_id, $user_id)) { $artTitle .= " #" . $hp->purify($this->getID(), CODENDI_PURIFIER_CONVERT_HTML); } $artTitle .= ' ] ' . $hp->purify(util_unconvert_htmlspecialchars($summary), CODENDI_PURIFIER_CONVERT_HTML); // First display some internal fields echo ' <FORM ACTION="" METHOD="POST" enctype="multipart/form-data" NAME="artifact_form"> <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="' . $sys_max_size_attachment . '">'; if ($ro) { echo '<INPUT TYPE="HIDDEN" NAME="func" VALUE="postaddcomment">'; } else { echo '<INPUT TYPE="HIDDEN" NAME="func" VALUE="postmod">'; } echo ' <INPUT TYPE="HIDDEN" NAME="artifact_timestamp" VALUE="' . time() . '"> <INPUT TYPE="HIDDEN" NAME="group_id" VALUE="' . (int) $group_id . '"> <INPUT TYPE="HIDDEN" NAME="group_artifact_id" VALUE="' . (int) $group_artifact_id . '"> <INPUT TYPE="HIDDEN" NAME="atid" VALUE="' . (int) $group_artifact_id . '"> <INPUT TYPE="HIDDEN" NAME="artifact_id" VALUE="' . (int) $this->getID() . '"> <INPUT TYPE="HIDDEN" NAME="aid" VALUE="' . (int) $this->getID() . '">'; echo '<TABLE><TR><TD class="artifact">'; $html = ''; $html .= '<TABLE width="100%"><TR>'; $pm = ProjectManager::instance(); // Now display the variable part of the field list (depend on the project) foreach ($result_fieldsets as $fieldset_id => $result_fieldset) { // this variable will tell us if we have to display the fieldset or not (if there is at least one field to display or not) $display_fieldset = false; $fieldset_html = ''; $i = 0; $fields_in_fieldset = $result_fieldset->getAllUsedFields(); while (list($key, $field) = each($fields_in_fieldset)) { if ($field->getName() != 'comment_type_id' && $field->getName() != 'artifact_id') { $field_html = $this->_getFieldLabelAndValueForUser($group_id, $group_artifact_id, $field, $user_id, $pv); if ($field_html) { // if the user can read at least one field, we can display the fieldset this field is within $display_fieldset = true; list($sz, ) = explode("/", $field->getDisplaySize()); // Details field must be on one row if ($sz > $max_size || $field->getName() == 'details') { $fieldset_html .= "\n<TR>" . '<TD align="left" valign="top" width="10%" nowrap="nowrap">' . $field_html['label'] . '</td>' . '<TD valign="top" width="90%" colspan="' . ($columns_number - 1) . '">' . $field_html['value'] . '</TD>' . "\n</TR>"; $i = 0; } else { $fieldset_html .= $i % $fields_per_line ? '' : "\n<TR>"; $fieldset_html .= '<TD align="left" valign="top" width="10%" nowrap="nowrap">' . $field_html['label'] . '</td>' . '<TD width="38%" valign="top">' . $field_html['value'] . '</TD>'; $i++; // if the line is not full, we add a additional column to give more space $fieldset_html .= $i % $fields_per_line ? '<td class="artifact_spacer" width="4%"> </td>' : "\n</TR>"; } } } } // while // We display the fieldset only if there is at least one field inside that we can display if ($display_fieldset) { //$html .= '<TR><TD COLSPAN="'.(int)$columns_number.'"> </TD></TR>'; $html .= '<TR class="boxtitle artifact_fieldset"><TD class="left" COLSPAN="' . (int) $columns_number . '"> <span title="' . $hp->purify(SimpleSanitizer::unsanitize($result_fieldset->getDescriptionText()), CODENDI_PURIFIER_CONVERT_HTML) . '">' . $hp->purify(SimpleSanitizer::unsanitize($result_fieldset->getLabel()), CODENDI_PURIFIER_CONVERT_HTML) . '</span></TD></TR>'; $html .= $fieldset_html; } } $html .= '<tr><td><font color="red">*</font>: ' . $Language->getText('tracker_include_type', 'fields_requ') . '</td></tr></TABLE>'; echo $this->_getSection('artifact_section_details', $artTitle, $html, true); if (!$ro) { echo '<div style="text-align:center"><INPUT CLASS="btn btn-primary" TYPE="SUBMIT" NAME="SUBMIT" VALUE="' . $Language->getText('tracker_include_artifact', 'submit') . '"></div>'; } // // Followups comments // $html = ''; $html .= '<script type="text/javascript">'; $html .= "var tracker_comment_togglers = {};\n function tracker_reorder_followups() {\n var element = \$('artifact_section_followups');\n if (element) {\n element.cleanWhitespace();\n var elements = [];\n var len = element.childNodes.length;\n for(var i = len - 1 ; i >= 0 ; --i) {\n elements.push(Element.remove(element.childNodes[i]));\n }\n for(var i = 0 ; i < len ; ++i) {\n element.appendChild(elements[i]);\n }\n }\n }"; $html .= '</script>'; $html .= '<div>'; if (!$ro) { if (db_numrows($this->ArtifactType->getCannedResponses())) { $html .= '<p><b>' . $Language->getText('tracker_include_artifact', 'use_canned') . '</b> '; $html .= $this->ArtifactType->cannedResponseBox(); $html .= '</p>'; } $field = $art_field_fact->getFieldFromName('comment_type_id'); if ($field && $field->isUsed() && db_numrows($field->getFieldPredefinedValues($group_artifact_id)) > 1) { $field_html = new ArtifactFieldHtml($field); $html .= '<P><B>' . $Language->getText('tracker_include_artifact', 'comment_type') . '</B>' . $field_html->fieldBox('', $group_artifact_id, $field->getDefaultValue(), true, $Language->getText('global', 'none')) . '<BR>'; } $html .= '<b>' . $Language->getText('tracker_include_artifact', 'add_comment') . '</b>'; $html .= '<DIV ID="tracker_artifact_comment_label"></DIV>'; $html .= '<TEXTAREA NAME="comment" id="tracker_artifact_comment" ROWS="10" style="width:700px;" WRAP="SOFT"></TEXTAREA>'; } else { if ($pv == 0) { $html .= '<b>' . $Language->getText('tracker_include_artifact', 'add_comment') . '</b>'; // Non authenticated user can submit only in text format //$html .= '<DIV ID="tracker_artifact_comment_label"></DIV>'; $html .= '<TEXTAREA NAME="comment" id="tracker_artifact_comment" ROWS="10" style="width:700px" WRAP="SOFT"></TEXTAREA>'; } } if (!user_isloggedin() && $pv == 0) { $html .= $Language->getText('tracker_include_artifact', 'not_logged_in', '/account/login.php?return_to=' . urlencode($_SERVER['REQUEST_URI'])); $html .= '<br><input type="text" name="email" maxsize="100" size="50"/><p>'; } $html .= '</div>'; $html .= $this->showFollowUpComments($group_id, $pv); $title = $Language->getText('tracker_include_artifact', 'follow_ups') . ' '; $title .= '<script type="text/javascript">'; $title .= 'document.write(\'<a href="#reorder" onclick="tracker_reorder_followups();new Ajax.Request(\\\'invert_comments_order.php\\\'); return false;" title="Invert order of the follow-ups">[↓↑]</a>\');'; $title .= '</script>'; $title .= ' <a href="/tracker/?func=rss&aid=' . (int) $this->getId() . '&atid=' . (int) $this->ArtifactType->getID() . '&group_id=' . (int) $this->ArtifactType->getGroupId() . '" '; $hp =& Codendi_HTMLPurifier::instance(); $title .= ' title="' . $hp->purify(util_unconvert_htmlspecialchars($group->getPublicName()) . ' ' . SimpleSanitizer::unsanitize($this->ArtifactType->getName()) . ' #' . $this->getId() . ' - ' . util_unconvert_htmlspecialchars($this->getValue('summary')), CODENDI_PURIFIER_CONVERT_HTML) . ' - ' . $Language->getText('tracker_include_artifact', 'follow_ups') . '">'; $title .= '[xml]</a> '; if ($pv == 0) { $title .= help_button('tracker-v3.html#comments') . ' '; } echo $this->_getSection('artifact_section_followups', $title, $html, true); if (user_get_preference('tracker_comment_invertorder')) { echo '<script type="text/javascript">tracker_reorder_followups();</script>'; } // // CC List // $html = ''; if ($pv == 0) { $html .= $Language->getText('tracker_include_artifact', 'fill_cc_list_msg'); $html .= $Language->getText('tracker_include_artifact', 'fill_cc_list_lbl'); $html .= '<textarea type="text" name="add_cc" id="tracker_cc" rows="2" cols="60" wrap="soft"></textarea>'; $html .= '<B> ' . $Language->getText('tracker_include_artifact', 'fill_cc_list_cmt') . ": </b>"; $html .= '<input type="text" name="cc_comment" size="40" maxlength="255">'; } $html .= $this->showCCList($group_id, $group_artifact_id, false, $pv); echo $this->_getSection('artifact_section_cc', $Language->getText('tracker_include_artifact', 'cc_list') . ' ' . ($pv == 0 ? help_button('tracker-v3.html#cc-list') : ''), $html, db_numrows($this->getCCList()), db_numrows($this->getCCList()) ? '' : '<div>' . $GLOBALS['Language']->getText('tracker_include_artifact', 'cc_empty') . '</div>'); // // File attachments // $html = ''; if ($pv == 0) { $html .= '<input type="file" name="input_file" size="40">'; $html .= $Language->getText('tracker_include_artifact', 'upload_file_msg', formatByteToMb($sys_max_size_attachment)); $html .= $Language->getText('tracker_include_artifact', 'upload_file_desc'); $html .= '<input type="text" name="file_description" size="60" maxlength="255">'; } $html .= $this->showAttachedFiles($group_id, $group_artifact_id, false, $pv); echo $this->_getSection('artifact_section_attachments', $Language->getText('tracker_include_artifact', 'attachment') . ' ' . ($pv == 0 ? help_button('tracker-v3.html#artifact-attachments') : ''), $html, db_numrows($this->getAttachedFiles()), db_numrows($this->getAttachedFiles()) ? '' : '<div>' . $GLOBALS['Language']->getText('tracker_include_artifact', 'no_file_attached') . '</div>'); // // Artifact dependencies // $html = '<B>' . $Language->getText('tracker_include_artifact', 'depend_on') . '</B><BR><P>'; if (!$ro) { $html .= ' <B>' . $Language->getText('tracker_include_artifact', 'aids') . '</B> <input type="text" name="artifact_id_dependent" size="20" maxlength="255"> <span style="color:#666">' . $Language->getText('tracker_include_artifact', 'fill') . '</span><p>'; } $html .= $this->showDependencies($group_id, $group_artifact_id, false, $pv); $html .= ' <P><B>' . $Language->getText('tracker_include_artifact', 'dependent_on') . '</B><BR> <P>'; $html .= $this->showInverseDependencies($group_id, $group_artifact_id); echo $this->_getSection('artifact_section_dependencies', $Language->getText('tracker_include_artifact', 'dependencies') . ' ' . ($pv == 0 ? help_button('tracker-v3.html#artifact-dependencies') : ''), $html, db_numrows($this->getDependencies()) || db_numrows($this->getInverseDependencies()), db_numrows($this->getDependencies()) || db_numrows($this->getInverseDependencies()) ? '' : '<div>' . $Language->getText('tracker_include_artifact', 'dep_list_empty') . '</div>'); // // Artifact Cross References // $html = ''; $crossref_fact = new CrossReferenceFactory($this->getID(), ReferenceManager::REFERENCE_NATURE_ARTIFACT, $group_id); $crossref_fact->fetchDatas(); $html .= $crossref_fact->getHTMLDisplayCrossRefs(); echo $this->_getSection('artifact_section_references', $Language->getText('cross_ref_fact_include', 'references') . ' ' . ($pv == 0 ? help_button('tracker-v3.html#artifact-cross-referencing') : ''), $html, $crossref_fact->getNbReferences(), $crossref_fact->getNbReferences() ? '' : '<div>' . $Language->getText('tracker_include_artifact', 'ref_list_empty') . '</div>'); // // Artifact permissions // if ($this->ArtifactType->userIsAdmin()) { $checked = ''; if ($this->useArtifactPermissions()) { $checked = 'checked="checked"'; } $html = ''; $html .= '<p>'; $html .= '<label class="checkbox" for="use_artifact_permissions"><input type="hidden" name="use_artifact_permissions_name" value="0" />'; $html .= '<input type="checkbox" name="use_artifact_permissions_name" id="use_artifact_permissions" value="1" ' . $checked . ' />'; $html .= $GLOBALS['Language']->getText('tracker_include_artifact', 'permissions_label') . '</label>'; $html .= '</p>'; $html .= permission_fetch_selection_field('TRACKER_ARTIFACT_ACCESS', $this->getId(), $group_id); $html .= '<script type="text/javascript">'; $html .= "\n document.observe('dom:loaded', function() {\n if ( ! \$('use_artifact_permissions').checked) {\n \$('ugroups').disable();\n }\n \$('use_artifact_permissions').observe('click', function(evt) {\n if (this.checked) {\n \$('ugroups').enable();\n } else {\n \$('ugroups').disable();\n }\n });\n });\n </script>"; echo $this->_getSection('artifact_section_permissions', $Language->getText('tracker_include_artifact', 'permissions') . ' ' . ($pv == 0 ? help_button('tracker-v3.html#permissions-on-artifacts') : ''), $html, $checked, $checked ? '' : $GLOBALS['Language']->getText('tracker_include_artifact', 'permissions_not_restricted')); } // // History // $is_there_history = db_numrows($this->getHistory()); echo $this->_getSection('artifact_section_history', $Language->getText('tracker_include_artifact', 'change_history') . ' ' . ($pv == 0 ? help_button('tracker-v3.html#artifact-history') : ''), $this->showHistory($group_id, $group_artifact_id), !$is_there_history); // // Final submit button // if ($pv == 0) { echo '<div style="text-align:center"><INPUT CLASS="btn btn-primary" TYPE="SUBMIT" NAME="SUBMIT" VALUE="' . $Language->getText('tracker_include_artifact', 'submit') . '"></div>'; } echo '</td></tr>'; echo '</table>'; echo '</form>'; user_set_preference('tracker_' . $this->ArtifactType->getId() . '_artifact_' . $this->getId() . '_last_visit', time()); }
if (isset($set) && $set == 'custom') { if (user_get_preference('forum_style')) { $_pref = $style . '|' . $max_rows; if ($_pref == user_get_preference('forum_style')) { //do nothing - pref already stored } else { //set the pref user_set_preference('forum_style', $_pref); } } else { //set the pref user_set_preference('forum_style', $_pref); } } else { if (user_get_preference('forum_style')) { $_pref_arr = explode('|', user_get_preference('forum_style')); $style = $_pref_arr[0]; $max_rows = $_pref_arr[1]; } else { //no saved pref and we're not setting //one because this is all default settings } } } /* Set up navigation vars */ $result = db_query("SELECT group_id,forum_name,is_public FROM forum_group_list WHERE group_forum_id=" . db_ei($forum_id)); $group_id = db_result($result, 0, 'group_id'); $forum_name = db_result($result, 0, 'forum_name'); $is_a_news = false;