Destinations - Edit/Import: Action bar and button updates, token integration.
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2018 - 2019
|
||||
Portions created by the Initial Developer are Copyright (C) 2018-2019
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
//includes
|
||||
include "root.php";
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
|
||||
@@ -147,8 +147,13 @@
|
||||
//upload the destination csv
|
||||
if (file_exists($_SESSION['file']) && $action == 'add') {
|
||||
|
||||
//form to match the fields to the column names
|
||||
//require_once "resources/header.php";
|
||||
//validate the token
|
||||
$token = new token;
|
||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||
message::add($text['message-invalid_token'],'negative');
|
||||
header('Location: destination_imports.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
//user selected fields
|
||||
$fields = $_POST['fields'];
|
||||
@@ -444,68 +449,24 @@
|
||||
$message = $database->message;
|
||||
}
|
||||
|
||||
//send the redirect header
|
||||
header("Location: destinations.php?type=".$destination_type);
|
||||
return;
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "resources/header.php";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['header-destinations_import']."</b></td>\n";
|
||||
echo "<td width='70%' align='right'>\n";
|
||||
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='/app/destinations/destinations.php'\" value='".$text['button-back']."'>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' colspan='2'>\n";
|
||||
echo " ".$text['message-results']."<br /><br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
//show the results
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0' width='100%'>\n";
|
||||
echo "<tr>\n";
|
||||
echo " <th>".$text['label-destination_name']."</th>\n";
|
||||
echo " <th>".$text['label-destination_organization']."</th>\n";
|
||||
//echo " <th>".$text['label-destination_email']."</th>\n";
|
||||
echo " <th>".$text['label-destination_url']."</th>\n";
|
||||
echo "</tr>\n";
|
||||
if ($results) {
|
||||
foreach($results as $row) {
|
||||
echo "<tr>\n";
|
||||
echo " <td class='vncell' valign='top' align='left'>\n";
|
||||
echo escape($row['FirstName'])." ".escape($row['LastName']);
|
||||
echo " </td>\n";
|
||||
echo " <td class='vncell' valign='top' align='left'>\n";
|
||||
echo escape($row['Company'])." \n";
|
||||
echo " </td>\n";
|
||||
echo " <td class='vncell' valign='top' align='left'>\n";
|
||||
echo escape($row['EmailAddress'])." \n";
|
||||
echo " </td>\n";
|
||||
echo " <td class='vncell' valign='top' align='left'>\n";
|
||||
echo escape($row['Web Page'])." \n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
}
|
||||
echo "</table>\n";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
//end the script
|
||||
//send the redirect header
|
||||
header("Location: destinations.php?type=".$destination_type);
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//upload the destination csv
|
||||
if (file_exists($_SESSION['file']) && $action == 'delete') {
|
||||
|
||||
//form to match the fields to the column names
|
||||
//require_once "resources/header.php";
|
||||
//validate the token
|
||||
$token = new token;
|
||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||
message::add($text['message-invalid_token'],'negative');
|
||||
header('Location: destination_imports.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
//user selected fields
|
||||
$fields = $_POST['fields'];
|
||||
@@ -686,34 +647,31 @@
|
||||
//match the column names to the field names
|
||||
if (strlen($delimiter) > 0 && file_exists($_SESSION['file']) && ($action !== 'add' or $action !== 'delete')) {
|
||||
|
||||
//form to match the fields to the column names
|
||||
//create token
|
||||
$object = new token;
|
||||
$token = $object->create($_SERVER['PHP_SELF']);
|
||||
|
||||
//include the header
|
||||
$document['title'] = $text['title-destination_import'];
|
||||
require_once "resources/header.php";
|
||||
|
||||
echo "<form action='' method='POST' enctype='multipart/form-data' name='frmUpload' onSubmit=''>\n";
|
||||
//form to match the fields to the column names
|
||||
echo "<form name='frmUpload' method='post' enctype='multipart/form-data'>\n";
|
||||
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['header-destination_import']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'destination_imports.php']);
|
||||
echo button::create(['type'=>'submit','label'=>$text['button-import'],'icon'=>$_SESSION['theme']['button_icon_import']]);
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
echo $text['description-destination_import']."\n";
|
||||
echo "<br /><br />\n";
|
||||
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <td valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " <b>".$text['header-destination_import']."</b><br />\n";
|
||||
echo " </td>\n";
|
||||
echo " <td valign='top' align='right'>\n";
|
||||
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='/app/destinations/destinations.php'\" value='".$text['button-back']."'>\n";
|
||||
echo " <input name='submit' type='submit' class='btn' id='import' value=\"".$text['button-import']."\">\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='left'>\n";
|
||||
echo " ".$text['description-destination_import']."\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
|
||||
//echo "<tr>\n";
|
||||
//echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['header-destinations_import']."</b></td>\n";
|
||||
//echo "<td width='70%' align='right'>\n";
|
||||
//echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='/app/destinations/destinations.php'\" value='".$text['button-back']."'>\n";
|
||||
//echo "</td>\n";
|
||||
//echo "</tr>\n";
|
||||
|
||||
//loop through user columns
|
||||
$x = 0;
|
||||
foreach ($line_fields as $line_field) {
|
||||
@@ -748,10 +706,10 @@
|
||||
}
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-destination_type']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo "<td width='70%' class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='destination_type' id='destination_type' onchange='type_control(this.options[this.selectedIndex].value);'>\n";
|
||||
switch ($destination_type) {
|
||||
case "inbound" : $selected[1] = "selected='selected'"; break;
|
||||
@@ -865,17 +823,15 @@
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' valign='top' align='right' nowrap='nowrap'>\n";
|
||||
echo " <input name='from_row' type='hidden' value='".$from_row."'>\n";
|
||||
echo " <input name='data_delimiter' type='hidden' value='".$delimiter."'>\n";
|
||||
echo " <input name='data_enclosure' type='hidden' value='".$enclosure."'>\n";
|
||||
echo " <input type='submit' class='btn' id='import' value=\"".$text['button-import']."\">\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
echo "<input name='from_row' type='hidden' value='".$from_row."'>\n";
|
||||
echo "<input name='data_delimiter' type='hidden' value='".$delimiter."'>\n";
|
||||
echo "<input name='data_enclosure' type='hidden' value='".$enclosure."'>\n";
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
|
||||
echo " </table>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
require_once "resources/footer.php";
|
||||
|
||||
//normalize the column names
|
||||
@@ -891,33 +847,36 @@
|
||||
exit;
|
||||
}
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
$token = $object->create($_SERVER['PHP_SELF']);
|
||||
|
||||
//include the header
|
||||
$document['title'] = $text['title-destination_import'];
|
||||
require_once "resources/header.php";
|
||||
|
||||
//begin the content
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td valign='top' align='left' width='30%' nowrap='nowrap'>\n";
|
||||
echo " <b>".$text['header-destination_import']."</b><br />\n";
|
||||
echo " ".$text['description-destination_import']."\n";
|
||||
echo " </td>\n";
|
||||
echo " <td valign='top' width='70%' align='right'>\n";
|
||||
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='/app/destinations/destinations.php'\" value='".$text['button-back']."'>\n";
|
||||
//echo " <input name='submit' type='submit' class='btn' id='import' value=\"".$text['button-import']."\">\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>";
|
||||
//show the content
|
||||
echo "<form name='frmUpload' method='post' enctype='multipart/form-data'>\n";
|
||||
|
||||
echo "<br />\n";
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['header-destination_import']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'destinations.php']);
|
||||
echo button::create(['type'=>'submit','label'=>$text['button-continue'],'icon'=>$_SESSION['theme']['button_icon_upload']]);
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
echo "<form action='' method='POST' enctype='multipart/form-data' name='frmUpload' onSubmit=''>\n";
|
||||
echo " <table border='0' cellpadding='0' cellspacing='0' width='100%'>\n";
|
||||
echo $text['description-destination_import']."\n";
|
||||
echo "<br /><br />\n";
|
||||
|
||||
echo "<table border='0' cellpadding='0' cellspacing='0' width='100%'>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-import_data']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo "<td width='70%' class='vtable' align='left'>\n";
|
||||
echo " <textarea name='data' id='data' rows='7' class='formfld' style='width: 100%;' wrap='off'>$data</textarea>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-import_data']."\n";
|
||||
@@ -983,20 +942,15 @@
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <td valign='bottom'>\n";
|
||||
echo " </td>\n";
|
||||
echo " <td valign='bottom' align='right' nowrap>\n";
|
||||
echo " <input name='type' type='hidden' value='csv'>\n";
|
||||
echo " <br />\n";
|
||||
echo " <input name='submit' type='submit' class='btn' id='import' value=\"".$text['button-import']."\">\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</table>\n";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "<input name='type' type='hidden' value='csv'>\n";
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
|
||||
echo "</form>";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
Reference in New Issue
Block a user