Bonjour,
Voici 2 patches permettant de corriger l'affichage des URLs sur les
différents formulaires de gabarits.
Le premier patch (0.85_fix_form_urls_in_templates_setup.patch) utilise
la fonction getFormURL de la classe associé à l'itemtype directement
dans le formulaire des gabarits.
Le deuxième patch
(0.85_handle_existing_params_in_listTemplates_targets.patch) modifie
la construction des URLs de la fonction CommonDBTM::listTemplates() en
tenant compte des paramètres existants dans le lien d'accès au
formulaire de l'itemtype.
Cordialement,
--
Kevin Roy
Index: inc/commondbtm.class.php
===================================================================
--- inc/commondbtm.class.php (revision 23167)
+++ inc/commondbtm.class.php (working copy)
@@ -4175,10 +4175,14 @@
if ($result = $DB->query($query)) {
echo "<div class='center'><table class='tab_cadre'>";
if ($add) {
+ $blank_params =
+ (strpos($target, '?') ? '&' : '?')
+ . "id=-1&withtemplate=2";
+ $target_blank = $target . $blank_params;
echo "<tr><th>" . $item->getTypeName(1)."</th>";
echo "<th>".__('Choose a template')."</th></tr>";
echo "<tr><td class='tab_bg_1 center' colspan='2'>";
- echo "<a href=\"$target?id=-1&withtemplate=2\">".__('Blank Template')."</a></td>";
+ echo "<a href=\"$target_blank\">".__('Blank Template')."</a></td>";
echo "</tr>";
} else {
echo "<tr><th>".$item->getTypeName(1)."</th><th>".__('Templates')."</th></tr>";
@@ -4190,8 +4194,14 @@
$templname = sprintf(__('%1$s (%2$s)'), $templname, $data["id"]);
}
if ($item->canCreate() && !$add) {
+ $modify_params =
+ (strpos($target, '?') ? '&' : '?')
+ . "id=".$data['id']
+ . "&withtemplate=1";
+ $target_modify = $target . $modify_params;
+
echo "<tr><td class='tab_bg_1 center'>";
- echo "<a href=\"$target?id=" . $data["id"] . "&withtemplate=1\">";
+ echo "<a href=\"$target_modify\">";
echo " $templname </a></td>";
echo "<td class='tab_bg_2 center b'>";
Html::showSimpleForm($target, 'purge', _x('button', 'Delete permanently'),
@@ -4199,8 +4209,14 @@
'id' => $data['id']));
echo "</td>";
} else {
+ $add_params =
+ (strpos($target, '?') ? '&' : '?')
+ . "id=".$data['id']
+ . "&withtemplate=2";
+ $target_add = $target . $add_params;
+
echo "<tr><td class='tab_bg_1 center' colspan='2'>";
- echo "<a href=\"$target?id=" . $data["id"] . "&withtemplate=2\">";
+ echo "<a href=\"$target_add\">";
echo " $templname </a></td>";
}
echo "</tr>";
@@ -4207,8 +4223,12 @@
}
if ($item->canCreate() && !$add) {
+ $create_params =
+ (strpos($target, '?') ? '&' : '?')
+ . "withtemplate=1";
+ $target_create = $target . $create_params;
echo "<tr><td class='tab_bg_2 center b' colspan='2'>";
- echo "<a href=\"$target?withtemplate=1\">" . __('Add a template...') . "</a>";
+ echo "<a href=\"$target_create\">" . __('Add a template...') . "</a>";
echo "</td></tr>";
}
echo "</table></div>\n";
Index: front/setup.templates.php
===================================================================
--- front/setup.templates.php (revision 23167)
+++ front/setup.templates.php (working copy)
@@ -40,7 +40,7 @@
if (isset($_GET["itemtype"])) {
- $link = Toolbox::getItemTypeFormURL($_GET["itemtype"]);
+ $link = $_GET["itemtype"]::getFormURL();
$item = str_replace(".form.php","",$link);
$item = str_replace("front/","",$item);
@@ -61,4 +61,4 @@
Html::footer();
}
-?>
\ No newline at end of file
+?>
_______________________________________________
Glpi-dev mailing list
[email protected]
https://mail.gna.org/listinfo/glpi-dev