Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560 [2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85 [3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50 [4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13 [5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
| Server IP : 94.177.8.99 / Your IP : 216.73.217.165 Web Server : Apache/2.4.58 (Ubuntu) System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/patientapps_www/modules/formEdit/static/ |
Upload File : |
var $ = jQuery.noConflict();
formwizard_url = '';
function retrieveCurrentFieldOrder() {
output = '';
var jt = $('#formwizard_target').find('div.formwizard_item').each( function() {
if (output != '') output += ';';
output += this.dataset.name;
});
return output;
}
function getState() {
let $form = $('#formwizard_preview').closest('form');
let $title = $form.find('input[name="title"]');
let $fields = $form.find('input[name="fields"]');
return {
url : $form.attr('action'),
present_general : $title.length > 0 ? 1 : 0,
present_fields : $fields.length > 0 ? 1 : 0,
title : $title.val(),
fields : retrieveCurrentFieldOrder(),
auth : $form.find('input[name="auth"]').val(),
}
}
function update_live_preview() {
let param = getState();
let href = param.url;
delete param.url;
param.action = 'get-default',
$.ajax({
type : 'POST',
dataType : 'html',
data : param,
url : href,
}).done(function(response) {
$('#formwizard_preview').html(response);
});
}
// return the name of the div this item should be added after
function getInsertAfter(droptarget, y, abs_y, ht) {
output = '*';
droptarget.find('div').each( function() {
var e = $(this);
var q = Math.floor(e.offset().top - abs_y); // this is the top of the current div
if (y + ht < q + ht / 2) {
output = e.attr('id');
return false;
}
});
return output; // no divs added, add to end
}
// pick up the list of selected fields
function formwizard_preparesubmit() {
var fieldlist = retrieveCurrentFieldOrder();
$('input[name="fields"]').val(fieldlist);
return true;
}
// move item back to available column
function formwizard_remove(menuitem) {
var item = $(`.formwizard_item[data-name="${menuitem}"`);
var home = $('#formwizard_available');
item.detach().appendTo(home);
}
function SetDefaults(frm, md_id) {
var items = frm.find('.formwiz_fielditem').serializeArray();
items = JSON.stringify(items);
$.ajax({
type : 'post',
dataType : 'html',
data : {items:items, formid:md_id},
url : formwizard_url,
success: function(response) {
$("#response").html(response).show().delay(4000).fadeOut();
}
})
}
function confirmDelete(isfield, name) {
if (isfield) {
return confirm('Are you sure you wish to completely delete the field "' + name + '" ?');
} else {
return confirm('Are you sure you wish to completely delete the form "' + name + '" ? This action cannot be undone!');
}
}
$(document).on('loaded.template', function(e, data, $container) {
$('.formwizard_item').each(function() {
if (typeof this.x_draggable == 'undefined') {
this.x_draggable = $(this).draggable(
{containment: $('.formwizpage-fields'), helper: 'clone'}
);
}
});
$('#formwizard_target').droppable({
drop: function( event, ui ) {
var target = $(this);
var offset0 = target.offset();
var newPosY = Math.floor(ui.offset.top - offset0.top);
var insertbefore = getInsertAfter(target, newPosY, offset0.top, ui.draggable.height());
var draggable = ui.draggable;
if (insertbefore == draggable.attr('id')) return; // nothing to do
draggable.detach().css({top: 0,left: 0});
if (insertbefore == '*') {
draggable.appendTo(this);
} else {
$('#' + insertbefore).before(draggable);
}
}
});
$('.component-tabs', $container).each(function() {
$(this).on('tabactive', function(e, data, newPanel, fragment) {
if (fragment == 'preview') update_live_preview();
});
});
});