1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
| if ($canupdate || !$ID) {
$opt = array('value' => $this->fields["type"]);
/// Auto submit to load template
if (!$ID) {
$opt['on_change'] = 'this.form.submit()';
}
$rand = self::dropdownType('type', $opt);
if ($ID) {
$params = array('type' => '__VALUE__',
'entity_restrict' => $this->fields['entities_id'],
'value' => $this->fields['itilcategories_id'],
'currenttype' => $this->fields['type']);
Ajax::updateItemOnSelectEvent("dropdown_type$rand", "show_category_by_type",
$CFG_GLPI["root_doc"]."/ajax/dropdownTicketCategories.php",
$params);
}
} else {
echo self::getTicketTypeName($this->fields["type"]);
}
echo "</td>";
echo "<th width='$colsize3%'>".sprintf(__('%1$s%2$s'), __('Category'),
$tt->getMandatoryMark('itilcategories_id'))."</th>";
echo "<td width='$colsize4%'>";
// Permit to set category when creating ticket without update right
if ($canupdate
|| !$ID
|| $canupdate_descr) {
$opt = array('value' => $this->fields["itilcategories_id"],
'entity' => $this->fields["entities_id"]);
if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") {
$opt['condition'] = "`is_helpdeskvisible`='1' AND ";
} else {
$opt['condition'] = '';
}
/// Auto submit to load template
if (!$ID) {
$opt['on_change'] = 'this.form.submit()';
}
/// if category mandatory, no empty choice
/// no empty choice is default value set on ticket creation, else yes
if (($ID || $values['itilcategories_id'])
&& $tt->isMandatoryField("itilcategories_id")
&& ($this->fields["itilcategories_id"] > 0)) {
$opt['display_emptychoice'] = false;
}
switch ($this->fields["type"]) {
case self::INCIDENT_TYPE :
$opt['condition'] .= "`is_incident`='1'";
break;
case self::DEMAND_TYPE :
$opt['condition'] .= "`is_request`='1'";
break;
default :
break;
}
echo "<span id='show_category_by_type'>";
ITILCategory::dropdown($opt);
echo "</span>";
} else {
echo Dropdown::getDropdownName("glpi_itilcategories", $this->fields["itilcategories_id"]);
}
echo "</td>";
echo "</tr>";
echo "<th width='$colsize1%'>".$tt->getBeginHiddenFieldText('content');
printf(__('%1$s%2$s'), __('Description'), $tt->getMandatoryMark('content'));
if (!$ID
|| $canupdate_descr) {
$content = Toolbox::unclean_cross_side_scripting_deep(Html::entity_decode_deep($this->fields['content']));
Html::showTooltip(nl2br(Html::Clean($content)));
}
echo $tt->getEndHiddenFieldText('content')."</th>";
echo "<td width='".(100-$colsize1)."%' colspan='3'>";
if (!$ID
|| $canupdate_descr) { // Admin =oui on autorise la modification de la description
echo $tt->getBeginHiddenFieldValue('content');
$rand = mt_rand();
$rand_text = mt_rand();
/* $cols = 90;
$rows = 6; */
$cols = 120;
$rows = 15;
$content_id = "content$rand";
if ($CFG_GLPI["use_rich_text"]) {
$this->fields["content"] = $this->setRichTextContent($content_id,
$this->fields["content"],
$rand);
$cols = 100;
$rows = 10;
} else {
$this->fields["content"] = $this->setSimpleTextContent($this->fields["content"]);
}
echo "<div id='content$rand_text'>";
echo "<textarea id='$content_id' name='content' cols='$cols' rows='$rows'>".
$this->fields["content"]."</textarea></div>";
echo $tt->getEndHiddenFieldValue('content', $this);
} else {
$content = Toolbox::unclean_cross_side_scripting_deep(Html::entity_decode_deep($this->fields['content']));
echo nl2br(Html::Clean($content));
}
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>"; |
Partager