Exemple #1
0
 /**
  * getMyProjects : returns the array of SOAPGroup the current user is member of
  *
  * @param string $sessionKey the session hash associated with the session opened by the person who calls the service
  * @return array the array of SOAPGroup th ecurrent user ismember of
  */
 function getMyProjects($sessionKey)
 {
     if (session_continue($sessionKey)) {
         $gf = new GroupFactory();
         $my_groups = $gf->getMyGroups();
         return groups_to_soap($my_groups);
     } else {
         return new SoapFault(invalid_session_fault, 'Invalid Session ', 'getMyProjects');
     }
 }
 function _initGroupHash()
 {
     if (!isset($this->groupIdByName)) {
         $gf = new GroupFactory();
         $p = array();
         $pl = array();
         $results = $gf->getAllGroups();
         while ($groups_array = db_fetch_array($results)) {
             $p[$groups_array["unix_group_name"]] = $groups_array["group_id"];
             $pl[strtolower($groups_array["unix_group_name"])] = $groups_array["group_id"];
         }
         $this->groupIdByName = $p;
         $this->groupIdByNameLower =& $pl;
     }
 }
 /**
  *
  *
  */
 function displayCreateTrackerFromTemplate($requested_create_mode, Project $project, Tracker $tracker_template = null)
 {
     $hp = Codendi_HTMLPurifier::instance();
     $GLOBALS['Response']->includeFooterJavascriptFile(TRACKER_BASE_URL . '/scripts/TrackerTemplateSelector.js');
     $GLOBALS['Response']->includeFooterJavascriptFile(TRACKER_BASE_URL . '/scripts/TrackerCheckUgroupConsistency.js');
     $js = '';
     $trackers = $this->getTrackerFactory()->getTrackersByGroupId(100);
     foreach ($trackers as $tracker) {
         $js .= '<option value="' . $tracker->getId() . '">' . $hp->purify($tracker->getName()) . '</option>';
     }
     $js = "codendi.tracker.defaultTemplates = '" . $hp->purify($js, CODENDI_PURIFIER_JS_QUOTE) . "';";
     $GLOBALS['Response']->includeFooterJavascriptSnippet($js);
     $gf = new GroupFactory();
     $radio = $this->getCreateTrackerRadio('gallery', $requested_create_mode);
     echo '<h3><label>' . $radio . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'from_tmpl') . '</label></h3>';
     //
     echo '<div class="tracker_create_mode">';
     echo '<noscript>Project Id: <input type="text" name="group_id_template" value=""><br/>Tracker Id: <input type="text" name="atid_template" value=""></noscript>';
     echo '<table>';
     echo '<tr>';
     echo '<th align="left">' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'tmpl_src_prj') . '</th>';
     echo '<th align="left">' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'tmpl_src_trk') . '</th>';
     echo '</tr>';
     echo '<tr>';
     echo '<td valign="top">';
     $group_id_template = 100;
     $atid_template = -1;
     if ($tracker_template) {
         $group_id_template = $tracker_template->getProject()->getID();
         $atid_template = $tracker_template->getId();
     }
     $selectedHtml = 'selected="selected"';
     echo '<select name="group_id_template" size="15" id="tracker_new_project_list" autocomplete="off">';
     echo '<option value="100" ' . ($group_id_template == 100 ? $selectedHtml : '') . '>' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'tmpl_src_prj_default') . '</option>';
     echo '<optgroup label="' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'tmpl_src_prj_my') . '">';
     $project_selected = false;
     $results = $gf->getMemberGroups();
     while ($row = db_fetch_array($results)) {
         $selected = '';
         if ($group_id_template == $row['group_id']) {
             $selected = $selectedHtml;
             $project_selected = true;
         }
         echo '<option value="' . $hp->purify($row['group_id']) . '" ' . ($group_id_template == $row['group_id'] ? $selectedHtml : '') . '>' . $hp->purify(util_unconvert_htmlspecialchars($row['group_name'])) . '</option>';
     }
     echo '</optgroup>';
     $hide = 'style="display:none;"';
     $other = '';
     if ($tracker_template && !$project_selected) {
         $hide = '';
         $other .= '<option value="' . (int) $tracker_template->getProject()->getID() . '" ' . $selectedHtml . '>';
         $other .= $hp->purify(util_unconvert_htmlspecialchars($tracker_template->getProject()->getPublicName()), CODENDI_PURIFIER_CONVERT_HTML);
         $other .= '</option>';
     }
     echo '<optgroup id="tracker_new_other" ' . $hide . ' label="' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'tmpl_src_prj_other') . '">';
     echo $other;
     echo '</optgroup>';
     echo '</select>';
     echo '<br/>' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'tmpl_src_autocomplete_desc') . '<br /><input type="text" name="tracker_new_prjname" id="tracker_new_prjname" placeholder="' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'tmpl_src_autocomplete_hint') . '" />';
     echo '</td>';
     echo '<td valign="top">';
     echo '<select name="atid_template" size="15" id="tracker_list_trackers_from_project">';
     $trackers = $this->getTrackerFactory()->getTrackersByGroupId($group_id_template);
     if (count($trackers) > 0) {
         foreach ($trackers as $tracker) {
             echo '<option value="' . $tracker->getId() . '" ' . ($atid_template == $tracker->getId() ? $selectedHtml : '') . '>' . $hp->purify($tracker->getName()) . '</option>';
         }
     } else {
         echo '<option>' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'tmpl_src_no_trk') . '</option>';
     }
     echo '</select>';
     echo '</td>';
     echo '</tr>';
     echo '</table>';
     echo '</div>';
 }
                 echo application_getMessage(msg_failed);
             }
         }
     } else {
         echo application_getMessage(msg_failed);
     }
 }
 //msg_remgrppois
 if ($action == msg_remgrppois) {
     if (isset($poilist)) {
         $lst1 = $js2->decode(str_replace("\\\"", "\"", $poilist));
         if ($lst1 != null) {
             $ok = true;
             $poiid = "";
             $poi1 = null;
             $gf = new GroupFactory();
             for ($i = 0; $i < count($lst1); $i++) {
                 $poiid = $lst1[$i];
                 $poi1 = $pof->getPoiById($usr->getUid(), $poiid);
                 if ($poi1 != null) {
                     if (!$gf->remGroupItem($groupid, $usr->getUid(), $poi1->getPoiId(), "Poi")) {
                         $ok = false;
                     }
                 }
             }
             if ($ok) {
                 $grp = $gf->getGroup($usr->getUid(), $groupid);
                 if ($grp != null) {
                     echo application_getMessage($grp);
                 } else {
                     echo application_getMessage(msg_failed);
<?php

//
// Copyright (c) Enalean, 2015. All Rights Reserved.
// Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
//
//
//
//
//
//  Written for Codendi by Stephane Bouhet
//
require_once 'pre.php';
require_once 'common/include/GroupFactory.class.php';
$gf = new GroupFactory();
?>
<html>
<head>
<title><?php 
echo $Language->getText('tracker_group_selection', 'project_sel');
?>
</title>
<link rel="stylesheet" type="text/css" href="<?php 
echo util_get_css_theme();
?>
">
<script language="JavaScript">

function doSelection(form) {
	if ( form.group_id.value != "" ) {
		window.opener.document.<?php