/pages/web-form-edit.php
PHP | 378 lines | 335 code | 29 blank | 14 comment | 71 complexity | cf9c12adcbe604e615b85b103f969271 MD5 | raw file
- <?php
- $f_id = $sql->secure_Esc($_GET['id']);
- $dup_id = $sql->secure_Esc($_GET['dup']);
-
- if ($f_id=='new' || $f_id=='') {
- echo '<h1>New Form';
- $f_id='new';
- $f_notify_to = 'regan.campbell@softkeinc.com';
-
- if ($dup_id>0) {
-
- $row = $sql->fetch("SELECT * FROM site_forms WHERE id = $dup_id;");
- if ($row != NULL) {
-
- $f_code = $row['code'].'_'.$datim->nowish();
- $f_dsc = $row['dsc'];
- $f_cat = $row['cat'];
- $f_status = $row['status'];
- $f_stamp = $row['stamp'];
-
- $f_disp = $row['disp'];
- $f_css_class = $row['css_class'];
- $f_act = $row['act'];
- $f_fyle = $row['fyle'];
- $f_msg_email = $row['msg_email'];
- $f_msg_confirm = $row['msg_confirm'];
- $f_redir = $row['redir'];
- $f_notify_to = $row['notify_to'];
- $f_notify_bcc = $row['notify_bcc'];
-
- $f_title_text = $row['title_text'];
- $f_title_bg = $row['title_bg'];
- $f_title_color = $row['title_color'];
- $f_subtitle = $row['subtitle'];
- $f_directions = $row['directions'];
- $f_fine_print = $row['fine_print'];
- $f_submit_typ = $row['submit_typ'];
- $f_submit_dsc = $row['submit_dsc'];
- $f_submit_img = $row['submit_img'];
-
- $directory = $softek->product_Name('Softek', $f_cat);
-
- echo ' based on <em>'.$row['code'].'</em>';
- }
-
- }
-
- echo '</h1>';
- if ($row != NULL) { echo '<p class="error">All questions and options will be copied exactly, except what you change here. You will have a chance to edit them next.</p>'; }
-
- } else {
-
- $row = $sql->fetch("SELECT * FROM site_forms WHERE id = $f_id;");
- if ($row != NULL) {
-
- $f_code = $row['code'];
- $f_dsc = $row['dsc'];
- $f_cat = $row['cat'];
- $f_status = $row['status'];
- $f_stamp = $row['stamp'];
-
- $f_disp = $row['disp'];
- $f_css_class = $row['css_class'];
- $f_act = $row['act'];
- $f_fyle = $row['fyle'];
- $f_msg_email = $row['msg_email'];
- $f_msg_confirm = $row['msg_confirm'];
- $f_redir = $row['redir'];
- $f_notify_to = $row['notify_to'];
- $f_notify_bcc = $row['notify_bcc'];
-
- $f_title_text = $row['title_text'];
- $f_title_bg = $row['title_bg'];
- $f_title_color = $row['title_color'];
- $f_subtitle = $row['subtitle'];
- $f_directions = $row['directions'];
- $f_fine_print = $row['fine_print'];
- $f_submit_typ = $row['submit_typ'];
- $f_submit_dsc = $row['submit_dsc'];
- $f_submit_img = $row['submit_img'];
-
- $directory = $softek->product_Name('Softek', $f_cat);
-
- echo '<h1>Edit Web Form</h1>';
- } else {
- echo '<p class="error">There was a problem accessing your form.</p>';
- }
- } ?>
- <form id="form-edit-web-form" enctype="multipart/form-data" method="post">
- <input type="hidden" id="form_id" name="form_id" value="<?php echo $f_id; ?>" />
- <input type="hidden" id="form_dup" name="form_dup" value="<?php echo $dup_id; ?>" />
- <ul class="form">
- <li><label>Color Scheme</label>
- <select name="form_cat">
- <option value="SSI" <?php if (empty($f_cat) || $f_cat == 'SSI') echo 'selected = "selected"'; ?>>Softek</option>
- <option value="ILM" <?php if ($f_cat == 'ILM') echo 'selected = "selected"'; ?>>Illuminate</option>
- <option value="OTK" <?php if ($f_cat == 'OTK') echo 'selected = "selected"'; ?>>OnTrack</option>
- </select>
- </li>
- <li><label>Code</label><input type="text" id="form_code" name="form_code" value="<?php echo $f_code; ?>" /></li>
- <li><h6 class="helper">This <span class="error">unique</span> code will be filtered for a-Z_0-9.</h6></li>
- <li><label>Form Display</label>
- <select name="form_disp">
- <option value="page" <?php if (empty($f_disp) || $f_disp == 'page') echo 'selected = "selected"'; ?>>On page only</option>
- <option value="dialog" <?php if ($f_disp == 'dialog') echo 'selected = "selected"'; ?>>By dialog only</option>
- <option value="either" <?php if ($f_disp == 'either') echo 'selected = "selected"'; ?>>Either is allowed</option>
- </select>
- </li>
- <li><label>CSS Class</label><input type="text" id="form_css_class" name="form_css_class" value="<?php echo $f_css_class; ?>" /></li>
- <li><h6 class="helper error">If the scheme and code match a live web page URL (and the Form Display <br />is not set to “By dialog only”), the form will display on the page automatically <br />(in a <<!--BREAK-->div> with the appropriate CSS Class).</h6></li>
- <li><label>Internal Description</label><input type="text" id="form_dsc" name="form_dsc" value="<?php echo $f_dsc; ?>" /></li>
- <li><label>Form Action</label>
- <select name="form_act">
- <option value="contact" <?php if (empty($f_act) || $f_act == 'contact') echo 'selected = "selected"'; ?>>Just notify Softek</option>
- <option value="download" <?php if ($f_act == 'download') echo 'selected = "selected"'; ?>>User downloads a file</option>
- <option value="email" <?php if ($f_act == 'email') echo 'selected = "selected"'; ?>>Email user</option>
- <option value="choose" <?php if ($f_act == 'choose') echo 'selected = "selected"'; ?>>The user decides to download or receive a link by email</option>
- <option value="redirect" <?php if ($f_act == 'redirect') echo 'selected = "selected"'; ?>>Redirect user to another page</option>
- </select>
- <li><h6 class="helper">All form submissions will send a notification of some sort to a Softek employee.</h6></li>
- </li>
- <li><label>Notification Email</label><input type="text" id="form_notify_to" name="form_notify_to" value="<?php echo $f_notify_to; ?>" /></li>
- <li><h6 class="helper">
- When someone fills out the form, this person will be notified.<br />
- This address also serves as the “From” address for any emails to the user.<br />
- <b>Only one</b> address both allowed and required.
- </h6></li>
- <li><label>Notification BCCs</label><input type="text" id="form_notify_bcc" name="form_notify_bcc" value="<?php echo $f_notify_bcc; ?>" /></li>
- <li><h6 class="helper">Emails should be separated by a comma with no spaces, if necessary</h6></li>
- <li><label>File Download</label>
- <select name="form_fyle"><?php
- echo '<option value="none"'; if (empty($f_fyle) || $f_fyle == 'none') echo 'selected = "selected"'; echo '>[ none ]</option>';
-
- $fyle = glob($root.'/resources/downloads/*.{doc,pdf,txt,rtf,jpg,png,xls,ppt}', GLOB_BRACE);
- foreach ($fyle as $key) {
- $actual_file = substr($key, 46);
- echo '<option value="'.$actual_file.'">'.$actual_file.'</option>';
- } ?>
- </select>
- </li>
- <li><label>Confirmation</label>
- <textarea name="form_msg_confirm" cols="75" rows="3"><?php echo $f_msg_confirm; ?></textarea>
- </li>
- <li><h6 class="helper">The message the user receives on the page after filling out the form</h6></li>
- <li><label>Email Message</label>
- <textarea name="form_msg_email" cols="75" rows="3"><?php echo $f_msg_email; ?></textarea>
- </li>
- <li><h6 class="helper">The message the user should receive via email, if applicable</h6></li>
- <li><label>Redirect Address</label><input type="text" id="form_redir" name="form_redir" value="<?php echo $f_redir; ?>" /></li>
- <li><h6 class="helper">Must set Form Action to redirect.</h6></li>
- <li><label>Form Status</label>
- <select name="form_status">
- <option value="live" <?php if (empty($f_status) || $f_status == 'live') echo 'selected = "selected"'; ?>>Live</option>
- <option value="draft" <?php if ($f_status == 'draft') echo 'selected = "selected"'; ?>>Draft</option>
- <option value="archive" <?php if ($f_status == 'archive') echo 'selected = "selected"'; ?>>Archive</option>
- </select>
- </li>
- </ul>
- <hr />
-
- <ul class="form">
- <li><label>Title Bar Text</label><input type="text" name="form_title_text" value="<?php echo $f_title_text; ?>" /></li>
- <li><label>Title Background</label><input type="radio" name="form_title_bg" value="default" <?php if (empty($f_title_bg) || $f_title_bg == 'default') echo 'checked="checked"'; ?> /> Default</li>
- </ul>
- <ul class="icon-list"><?php
- $images = array();
-
- $icons = glob($root.'/resources/images/head*.{jpg,gif,png}', GLOB_BRACE);
- foreach ($icons as $key) {
- $tag = strstr($key, 'head', false);
- array_push($images, $tag);
- }
-
- $mob = glob($root.'/resources/images/mob-header*.{jpg,gif,png}', GLOB_BRACE);
- foreach ($mob as $key) {
- $tag = strstr($key, 'mob-header', false);
- array_push($images, $tag);
- }
-
- $bg = glob($root.'/resources/images/bg*.{jpg,gif,png}', GLOB_BRACE);
- foreach ($bg as $key) {
- $tag = strstr($key, 'bg', false);
- array_push($images, $tag);
- }
-
- foreach ($images as $image) {
- echo '<li><input type="radio" name="form_title_bg" value="'.$image.'"';
- if ($f_title_bg == $image) echo ' checked="checked"';
- echo '> <img src="/resources/images/'.$image.'" title="'.$image.'" /></li>';
- }
- ?>
- </ul>
- <ul class="form" style="clear: left;">
- <li><h6 class="helper">Images from /resources/images/ folder beginning with “head” or “bg”<br />It will not look stretched, will repeat, and be centered in the title area.</h6></li>
- <li><label>Title Text Color</label><input type="text" name="form_title_color" value="<?php echo $f_title_color; ?>" /></li>
- <li><h6 class="helper">Acceptable: color (red, blue, etc.) or hex (#C300000)</h6></li>
- <li><label>Subtitle</label><input type="text" name="form_subtitle" value="<?php echo $f_subtitle; ?>" /></li>
- <li><label>Directions<br />(just text)</label>
- <textarea name="form_directions" cols="75" rows="3"><?php echo $f_directions; ?></textarea>
- </li>
- <li><label>Fine Print<br />(just text)</label>
- <textarea name="form_fine_print" cols="75" rows="5"><?php echo $f_fine_print; ?></textarea>
- <br /><?php include($root.'/manage/common/html-basics.php'); ?>
- </li>
- <li><h6 class="helper">The end of the fine print will always read, “<span class="error">*</span>All starred fields required.”</h6></li>
- <li><label>Submit Button Type</label>
- <select name="form_submit_typ">
- <option value="link" <?php if (empty($f_submit_typ) || $f_submit_typ == 'link') echo 'selected = "selected"'; ?>>Stylized Button</option>
- <option value="image" <?php if ($f_submit_typ == 'image') echo 'selected = "selected"'; ?>>Image</option>
- <option value="button" <?php if ($f_submit_typ == 'button') echo 'selected = "selected"'; ?>>Regular, inconspicuous button</option>
- </select>
- </li>
- <li><label>Button Image</label><input type="radio" name="form_submit_img" value="none" <?php if (empty($n_submit_img) || $n_submit_img == 'none') echo 'checked="checked"'; ?> /> None</li>
- </ul>
- <ul class="icon-list"><?php
- $images = array();
-
- $icons = glob($root.'/resources/images/btn*.{jpg,gif,png}', GLOB_BRACE);
- foreach ($icons as $key) {
- $tag = strstr($key, 'btn', false);
- array_push($images, $tag);
- }
-
- foreach ($images as $image) {
- echo '<li><input type="radio" name="form_submit_img" value="'.$image.'"';
- if ($f_submit_img == $image) echo ' checked="checked"';
- echo '> <img src="/resources/images/'.$image.'" title="'.$image.'" /></li>';
- }
- ?>
- </ul>
- <ul class="form" style="clear: left;">
- <li><label>Submit Button Text</label><input type="text" name="form_submit_dsc" value="<?php echo $f_submit_dsc; ?>" /></li>
- <li><h6 class="helper">You need Submit Text even if you use an image.</h6></li>
- <?php if ($f_id!='new') { ?>
- <li><label>Last updated</label><?php echo $datim->date_Mdyt($f_stamp).' <a href="#see-update-log" class="dialog-view-log" rel="'.$f_id.'" name="site_forms">Log</a>'; ?></li>
- <?php } ?>
- <li><a name="previews"></a><a id="button-save-main-form" class="notice auto-save" href="#save" name="web-form" title="form">Save Form Details</a></li>
- </ul>
- <input type="hidden" id="req1" value="code" alt="a code" />
- <input type="hidden" id="req2" value="form_notify_to" alt="a notification address" />
- </form>
-
- <?php
- if ($f_id!='new') {
- echo '<br class="clearLeft" /><br /><hr />'.
- '<h3>Preview <a href="/manage/edit-web-form/'.$f_id.'#previews" class="notice">reload</a> Save first!</h3>'.
- '<p>Preview colors, fonts and spacing are not exact. Do a page test.</p>'.
- '<div class="floatLeft" style="padding-right:10px;">';
- $format->pretend_Dialog($f_submit_dsc, 375, 2, 'beg');
- echo $mail->build_Form($f_cat, $f_code, 'dialog-test', 'no-class');
- $format->pretend_Dialog($f_submit_dsc, 375, 2, 'end');
- echo '</div><div class="floatLeft">';
- $mail->build_Form($f_cat, $f_code, 'page-test', 'no-class');
- echo '</div><br class="clearLeft" /><br /><hr />';
- } ?>
- <style>
- .ui-widget button,
- .ui-widget .ui-button,
- .ui-button,
- button.ui-state-default,
- a.noticeMe,
- input.noticeMe,
- .notice-button,
- .notice-button:link,
- .notice-button:visited,
- .notice-button:hover,
- .notice-button:active {
- background: url(/resources/images/carrat_40.png) center -6px no-repeat;
- cursor: pointer;
- padding: 4px 8px;
- border: 2px solid #0066CC;
- -moz-border-radius: 4px;
- -webkit-border-radius: 4px;
- -khtml-border-radius: 4px;
- border-radius: 4px;
- font-size: 12px !important;
- line-height: 15px;
- font-weight: normal;
- color: #FFCC33;
- text-decoration: none;
- }
- .notice-button.go,
- .notice-button.go:link,
- .notice-button.go:visited,
- .notice-button.go:hover,
- .notice-button.go:active {
- padding: 5px 35px 5px 8px;
- border: none;
- display: inline-block;
- margin: 5px 0;
- text-align: left;
- }
- input.notice-button.go,
- input.notice-button.go:hover {
- padding: 0px 35px 0 8px;
- height: 25px;
- }
- #sftk .notice-button { background-position: center -6px; color: #FFCC33; border-color: #0066CC; }
- #sftk .notice-button:hover { background-position: center -46px; color: #FFFFFF; }
- #sftk .notice-button.go { background-position: right -0px; }
- #sftk .notice-button.go:hover { background-position: right -40px; }
-
- #lmnt .notice-button { background-position: center -86px; color: #FFCC33; border-color: #063D9A; }
- #lmnt .notice-button:hover { background-position: center -126px; color: #FFFFFF; }
- #lmnt .notice-button.go { background-position: right -80px; }
- #lmnt .notice-button.go:hover { background-position: right -120px; }
-
- #ntrk .notice-button { background-position: center -166px; color: #FFCC33; border-color: #990000; }
- #ntrk .notice-button:hover { background-position: center -206px; color: #FFFFFF; border-color: #FF6600; }
- #ntrk .notice-button.go { background-position: right -160px; }
- #ntrk .notice-button.go:hover { background-position: right -200px; }
- /* vv JQUERY UI OVERRRIDE vv */
- .ui-state-highlight,
- .ui-widget-header .ui-state-highlight,
- .ui-widget-content .ui-state-highlight { background: url(/resources/images/content-highlight_act.jpg) center center repeat-x; }
- .ui-widget-header .ui-icon.ui-icon-circle-triangle-e { background: url(/resources/images/16-next.png) no-repeat scroll -2px -22px transparent; }
- .ui-widget-header .ui-icon.ui-icon-circle-triangle-w { background: url(/resources/images/16-prev.png) no-repeat scroll -2px -22px transparent; }
- .ui-widget-header .ui-icon.ui-icon-closethick { background: url(/resources/images/16-close.png) no-repeat scroll -2px -22px transparent; }
- .ui-widget-header .ui-icon.ui-icon-closethick:hover { background-position: -2px -2px; }
- .ui-widget-content .ui-icon.ui-icon-alert { background: url(/resources/images/16-alert.png) no-repeat scroll 0px -60px transparent; }
- .ui-datepicker table { font-size: 1em; }
- .ui-dialog-titlebar,
- .ui-datepicker-header {
- background: none;
- border: none;
- height: 10px;
- margin: 0;
- position: relative;
- }
- .ui-dialog .ui-dialog-titlebar { padding: .2em 0 0 0; }
- .ui-dialog-title,
- .ui-datepicker-title {
- font-family: Verdana, sans-serif;
- font-weight: bold;
- font-size: 1.5em;
- line-height: 16px;
- }
- .ui-dialog-title { display: none; }
- .ui-button-text-only,
- .ui-button-text {
- padding: 0px;
- }
- .ui-widget #button-send-contact { display: none; }
- .ui-widget p { margin: 0; }
- .ui-dialog .ui-dialog-content { padding: 0 10px; }
- /* ^^ JQUERY UI OVERRRIDE ^^ */
- ul.icon-list {
- margin: 0;
- padding: 0;
- margin-left: 125px;
- width: 40%;
- }
- ul.icon-list li {
- background-color: #CCC;
- float: left;
- width: 260px;
- margin: 3px;
- padding: 2px;
- list-style: none;
- }
- ul.icon-list li img {
- width: 220px;
- height: 40px;
- }
- </style>
-
- <?php if ($f_id!='new'){ ?>
- <div id="holder-notes-rows"></div>
- <div id="holder-web-form-questions-rows"></div>
- <div id="dialog-edit-web-form-question"></div>
- <div id="dialog-edit-web-form-option"></div>
- <?php } ?>
- <script>
- $(function() {
- $.resetDefaults('notes-rows', 'form');
- $.resetDefaults('web-form-questions-rows', 'form');
- });
- </script>