From a3d9819404c2ea6aa04b2ce280b19beade74af98 Mon Sep 17 00:00:00 2001 From: Alex <40072887+alexdcrane@users.noreply.github.com> Date: Wed, 4 Mar 2026 12:56:43 -0700 Subject: [PATCH] Add drag and drop to dialplan details (#7771) * Add drag and drop to dialplan details * Update dialplan_edit.php --- app/dialplans/dialplan_edit.php | 90 ++++++++++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 2 deletions(-) diff --git a/app/dialplans/dialplan_edit.php b/app/dialplans/dialplan_edit.php index e9f37cdcd5..d4bb4d171f 100644 --- a/app/dialplans/dialplan_edit.php +++ b/app/dialplans/dialplan_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2025 + Portions created by the Initial Developer are Copyright (C) 2008-2026 the Initial Developer. All Rights Reserved. Contributor(s): @@ -298,6 +298,24 @@ } } + //update dialplan detail order if drag and drop was used + if (!empty($_POST['dialplan_details_order'])) { + $dialplan_details_order = explode(",", $_POST["dialplan_details_order"]); + + foreach ($dialplan_details_order as $dialplan) { + list($uuid, $order, $group_id) = explode("|", $dialplan); + + foreach ($array['dialplans'][0]['dialplan_details'] as &$key) { + if ($key['dialplan_detail_uuid'] == $uuid) { + $key['dialplan_detail_order'] = $order; + $key['dialplan_detail_group'] = $group_id; + break; + } + } + unset($key); + } + } + //update the dialplan_xml by using the array $dialplans = new dialplan; $dialplans->source = "details"; @@ -808,6 +826,8 @@ echo "

"; } + echo "\n"; + echo "\n"; echo "".$text['label-tag']."\n"; echo "".$text['label-type']."\n"; @@ -843,7 +863,7 @@ $no_border = ($index == 999) ? "border: none;" : null; //begin the row - echo "\n"; + echo "\n"; //determine whether to hide the element if (empty($dialplan_detail_tag)) { $element['hidden'] = false; @@ -1054,12 +1074,18 @@ } echo " \n"; } + if (is_uuid($dialplan_detail_uuid)) { + echo " \n"; + echo " \n"; + echo " \n"; + } //end the row echo "\n"; //increment the value $x++; } } + echo "\n"; $x++; } //end foreach unset($details); @@ -1073,6 +1099,66 @@ echo "

\n"; + //include sortablejs + echo ""; + + //dialplan details drag and drop + echo "\n"; + ?> + + + \n"; if ($action == "update") { echo " \n";