Update: Support Ajax and Form Post for All HNWAR

This commit is contained in:
Gary Sharp committed 2013-04-02 14:03:23 +11:00
1 parent 8657d4ec32
commit e7ff62afc7
19 files changed
+879 -879

No files matched your search

@@ -1,198 +1,327 @@
///#source 1 1 /ClientSource/Scripts/Modules/Disco-PropertyChangeHelpers/disco.propertychangehelpers.js
if (!document.DiscoFunctions) {
document.DiscoFunctions = {};
document.DiscoFunctions = {};
}
if (!document.DiscoFunctions.PropertyChangeHelper) {
document.DiscoFunctions.PropertyValue = function (PropertyField) {
if (PropertyField[0].nodeName.toLowerCase() == 'input' && PropertyField.attr('type') == 'checkbox') {
return PropertyField.is(':checked');
}
return PropertyField.val();
};
document.DiscoFunctions.PropertyChangeHelper = function (PropertyField, FieldWatermark, UpdateUrl, UpdatePropertyName) {
var fieldValue = document.DiscoFunctions.PropertyValue(PropertyField);
var fieldChangeToken = null;
var $ajaxSave = PropertyField.nextAll('.ajaxSave').first();
var $ajaxLoading = PropertyField.nextAll('.ajaxLoading').first();
var fieldChangeFunction = function () {
$ajaxSave.hide();
var changedValue = document.DiscoFunctions.PropertyValue(PropertyField);
if (fieldValue != changedValue) {
fieldValue = changedValue;
if (fieldChangeToken)
window.clearTimeout(fieldChangeToken);
fieldChangeToken = window.setTimeout(function () {
$ajaxLoading.show();
var data = {};
data[UpdatePropertyName] = fieldValue;
$.getJSON(UpdateUrl, data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change property "' + UpdatePropertyName + '":\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
fieldChangeToken = null;
}, 500);
};
}
if (PropertyField[0].nodeName.toLowerCase() == 'input' && PropertyField.attr('type') == 'checkbox') {
PropertyField.click(fieldChangeFunction);
} else {
PropertyField.change(fieldChangeFunction);
}
// For Input Text Boxes
if (PropertyField[0].nodeName.toLowerCase() == 'input' && PropertyField.attr('type') == 'text') {
PropertyField.keydown(function (e) {
$ajaxSave.show();
if (e.which == 13) {
$(this).blur();
}
})
.watermark(FieldWatermark)
.blur(function () {
$ajaxSave.hide();
}).focus(function () {
$(this).select();
});
}
// For TextAreas
if (PropertyField[0].nodeName.toLowerCase() == 'textarea') {
PropertyField.keydown(function () {
$ajaxSave.show();
})
}
}
if (!document.DiscoFunctions.PropertyChangeHelper){
document.DiscoFunctions.PropertyValue = function(PropertyField){
if (PropertyField[0].nodeName.toLowerCase()=='input' && PropertyField.attr('type')=='checkbox'){
return PropertyField.is(':checked');
}
return PropertyField.val();
};
document.DiscoFunctions.PropertyChangeHelper = function (PropertyField, FieldWatermark, UpdateUrl, UpdatePropertyName) {
var fieldValue = document.DiscoFunctions.PropertyValue(PropertyField);
var fieldChangeToken = null;
var $ajaxSave = PropertyField.nextAll('.ajaxSave').first();
var $ajaxLoading = PropertyField.nextAll('.ajaxLoading').first();
var fieldChangeFunction = function(){
$ajaxSave.hide();
var changedValue = document.DiscoFunctions.PropertyValue(PropertyField);
if (fieldValue != changedValue){
fieldValue = changedValue;
if (fieldChangeToken)
window.clearTimeout(fieldChangeToken);
fieldChangeToken = window.setTimeout(function(){
$ajaxLoading.show();
var data = {};
data[UpdatePropertyName] = fieldValue;
$.getJSON(UpdateUrl, data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change property "' + UpdatePropertyName + '":\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
fieldChangeToken = null;
}, 500);
};
}
if (PropertyField[0].nodeName.toLowerCase()=='input' && PropertyField.attr('type')=='checkbox'){
PropertyField.click(fieldChangeFunction);
}else{
PropertyField.change(fieldChangeFunction);
}
// For Input Text Boxes
if (PropertyField[0].nodeName.toLowerCase()=='input' && PropertyField.attr('type')=='text'){
PropertyField.keydown(function(e){
$ajaxSave.show();
if (e.which == 13) {
$(this).blur();
}
})
.watermark(FieldWatermark)
.blur(function () {
$ajaxSave.hide();
}).focus(function(){
$(this).select();
});
}
// For TextAreas
if (PropertyField[0].nodeName.toLowerCase()=='textarea'){
PropertyField.keydown(function(){
$ajaxSave.show();
})
}
}
};
if (!document.DiscoFunctions.DateChangeUserHelper){
document.DiscoFunctions.DateChangeUserHelper = function (DateField, UserField, DateFieldWatermark, UpdateUrl, UpdatePropertyName, minDate, dateOnly) {
var dateFieldValue = DateField.val();
var dateFieldChangeToken = null;
var $ajaxLoading = UserField.next('.ajaxLoading');
DateField
.watermark(DateFieldWatermark)
.change(function(){
var dateText = DateField.val();
if (dateFieldValue.toLowerCase() != dateText.toLowerCase()){
dateFieldValue = dateText;
if (dateFieldChangeToken)
window.clearTimeout(dateFieldChangeToken);
dateFieldChangeToken = window.setTimeout(function(){
$ajaxLoading.show();
var data = {};
data[UpdatePropertyName] = dateFieldValue;
$.getJSON(UpdateUrl, data, function (response, result) {
if (result != 'success' || response.Result != 'OK') {
alert('Unable to change Date:\n' + response);
$ajaxLoading.hide();
} else {
UserField.text('by ' + response.UserDescription);
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
dateFieldChangeToken = null;
}, 500);
}
}).focus(function(){
$(this).select();
});
if (dateOnly){
DateField.datepicker({
defaultDate: new Date(),
minDate: minDate,
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd',
beforeShow: function(input, inst){
$input = $(input);
if (!$input.val()){
$input.datepicker('setDate', new Date());
}
}
});
}else{
DateField.datetimepicker({
defaultDate: new Date(),
ampm: true,
minDate: minDate,
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd',
beforeShow: function(input, inst){
$input = $(input);
if (!$input.val()){
$input.datetimepicker('setDate', new Date());
}
}
});
}
}
};
if (!document.DiscoFunctions.DateChangeHelper){
document.DiscoFunctions.DateChangeHelper = function (DateField, DateFieldWatermark, UpdateUrl, UpdatePropertyName, minDate, dateOnly) {
var dateFieldValue = DateField.val();
var dateFieldChangeToken = null;
var $ajaxLoading = DateField.next('.ajaxLoading');
DateField
.watermark(DateFieldWatermark)
.change(function(){
};
if (!document.DiscoFunctions.DateChangeUserHelper) {
document.DiscoFunctions.DateChangeUserHelper = function (DateField, UserField, DateFieldWatermark, UpdateUrl, UpdatePropertyName, minDate, dateOnly) {
var dateFieldValue = DateField.val();
var dateFieldChangeToken = null;
var $ajaxLoading = UserField.next('.ajaxLoading');
DateField
.watermark(DateFieldWatermark)
.change(function () {
var dateText = DateField.val();
if (dateFieldValue.toLowerCase() != dateText.toLowerCase()){
dateFieldValue = dateText;
if (dateFieldChangeToken)
window.clearTimeout(dateFieldChangeToken);
dateFieldChangeToken = window.setTimeout(function(){
$ajaxLoading.show();
var data = {};
data[UpdatePropertyName] = dateFieldValue;
$.getJSON(UpdateUrl, data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Date:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
dateFieldChangeToken = null;
}, 500);
}
}).focus(function(){
$(this).select();
});
if (dateOnly){
DateField.datepicker({
defaultDate: new Date(),
minDate: minDate,
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd',
beforeShow: function(input, inst){
$input = $(input);
if (!$input.val()){
$input.datepicker('setDate', new Date());
if (dateFieldValue.toLowerCase() != dateText.toLowerCase()) {
dateFieldValue = dateText;
if (dateFieldChangeToken)
window.clearTimeout(dateFieldChangeToken);
dateFieldChangeToken = window.setTimeout(function () {
$ajaxLoading.show();
var data = {};
data[UpdatePropertyName] = dateFieldValue;
$.getJSON(UpdateUrl, data, function (response, result) {
if (result != 'success' || response.Result != 'OK') {
alert('Unable to change Date:\n' + response);
$ajaxLoading.hide();
} else {
UserField.text('by ' + response.UserDescription);
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
}
});
}else{
DateField.datetimepicker({
defaultDate: new Date(),
ampm: true,
minDate: minDate,
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd',
beforeShow: function(input, inst){
$input = $(input);
if (!$input.val()){
$input.datetimepicker('setDate', new Date());
}
}
});
})
dateFieldChangeToken = null;
}, 500);
}
}).focus(function () {
$(this).select();
});
if (dateOnly) {
DateField.datepicker({
defaultDate: new Date(),
minDate: minDate,
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd',
beforeShow: function (input, inst) {
$input = $(input);
if (!$input.val()) {
$input.datepicker('setDate', new Date());
}
}
});
} else {
DateField.datetimepicker({
defaultDate: new Date(),
ampm: true,
minDate: minDate,
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd',
beforeShow: function (input, inst) {
$input = $(input);
if (!$input.val()) {
$input.datetimepicker('setDate', new Date());
}
}
});
}
};
}
};
if (!document.DiscoFunctions.DateChangeHelper) {
document.DiscoFunctions.DateChangeHelper = function (DateField, DateFieldWatermark, UpdateUrl, UpdatePropertyName, minDate, dateOnly) {
var dateFieldValue = DateField.val();
var dateFieldChangeToken = null;
var $ajaxLoading = DateField.next('.ajaxLoading');
DateField
.watermark(DateFieldWatermark)
.change(function () {
var dateText = DateField.val();
if (dateFieldValue.toLowerCase() != dateText.toLowerCase()) {
dateFieldValue = dateText;
if (dateFieldChangeToken)
window.clearTimeout(dateFieldChangeToken);
dateFieldChangeToken = window.setTimeout(function () {
$ajaxLoading.show();
var data = {};
data[UpdatePropertyName] = dateFieldValue;
$.getJSON(UpdateUrl, data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Date:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
dateFieldChangeToken = null;
}, 500);
}
}).focus(function () {
$(this).select();
});
if (dateOnly) {
DateField.datepicker({
defaultDate: new Date(),
minDate: minDate,
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd',
beforeShow: function (input, inst) {
$input = $(input);
if (!$input.val()) {
$input.datepicker('setDate', new Date());
}
}
});
} else {
DateField.datetimepicker({
defaultDate: new Date(),
ampm: true,
minDate: minDate,
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd',
beforeShow: function (input, inst) {
$input = $(input);
if (!$input.val()) {
$input.datetimepicker('setDate', new Date());
}
}
});
}
};
}
if (!document.DiscoFunctions.DateDialogCreateUpdater)
{
var dialog, dialogForm, dialogHeader, dialogDateBox, dialogDatePropertyNameBox;
var updateUrl, friendlyName, dateField, userField, updatePropertyName, notSetDisplay, minDate, useAjax;
function dateDialogGet() {
if (!dialog) {
dialog = $('<div>').attr({ 'class': 'dialog' })
dialogForm = $('<form>').attr({ 'action': '/', 'method': 'post' }).appendTo(dialog);
var dialogBody = $('<p>').appendTo(dialogForm);
dialogHeader = $('<h3>').attr('autofocus', 'autofocus').appendTo(dialogBody);
dialogDatePropertyNameBox = $('<input>').attr({ 'type': 'hidden', 'name': 'key' }).appendTo(dialogBody);
dialogDateBox = $('<input>').attr({ 'type': 'datetime', 'name': 'value' }).css({ 'display': 'block', 'margin-top': 15, 'margin-left': 'auto', 'margin-right': 'auto' }).appendTo(dialogBody);
$('<input>').attr({ 'type': 'hidden', 'name': 'redirect' }).val('true').appendTo(dialogBody);
dialog.dialog({
resizable: false,
modal: true,
autoOpen: false,
buttons: {
"Update": dateDialogUpdate,
Cancel: function () {
$(this).dialog("close");
}
},
open: function () {
dialog.dialog('widget').find('.ui-dialog-buttonpane :tabbable:first').focus();
}
});
dialogDateBox.datetimepicker({
defaultDate: new Date(),
ampm: true,
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd',
});
}
return dialog;
}
function dateDialogUpdate() {
var dateValue = dialogDateBox.val();
if (useAjax) {
// Use Ajax
var $dateField, $userField;
$dateField = $('#' + dateField);
if (userField)
$userField = $('#' + userField);
dialog.dialog("close");
var $ajaxLoading = ($userField ? $userField.next('.ajaxLoading') : $dateField.next('.ajaxLoading')).show();
var data = {
key: updatePropertyName,
value: dateValue
};
$.getJSON(updateUrl, data, function (response, result) {
if (result != 'success' || response.Result != 'OK') {
alert('Unable to change ' + friendlyName + ' Date:\n' + response);
$ajaxLoading.hide();
} else {
if (response.DateTimeFull) {
$dateField.attr('data-datetimeformatted', response.DateTimeJavascript)
.attr('data-discodatetime', response.DateTimeSortable)
.attr('title', response.DateTimeFull)
.text(response.DateTimeFriendly);
} else {
$dateField.attr('data-datetimeformatted', '')
.attr('data-discodatetime', '-1')
.attr('title', notSetDisplay)
.text(notSetDisplay);
}
if ($userField)
$userField.text('by ' + response.UserDescription);
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
} else {
// Post Form & Redirect
dialog.dialog("disable");
dialog.dialog("option", "buttons", null);
dialogDatePropertyNameBox.val(updatePropertyName);
dialogForm.attr('action', updateUrl);
dialogForm.submit();
}
}
function dateDialogOpen(UpdateUrl, FriendlyName, DateField, UserField, UpdatePropertyName, NotSetDisplay, MinDate, UseAjax) {
updateUrl = UpdateUrl;
friendlyName = FriendlyName;
dateField = DateField;
userField = UserField;
updatePropertyName = UpdatePropertyName;
notSetDisplay = NotSetDisplay;
minDate = MinDate;
useAjax = UseAjax;
var d = dateDialogGet();
d.dialog('option', 'title', friendlyName);
dialogHeader.text(friendlyName + ' Date');
var dfVal = $('#' + DateField).attr('data-datetimeformatted');
if (dfVal)
dialogDateBox.datetimepicker('setDate', new Date(dfVal));
else
dialogDateBox.datetimepicker('setDate', new Date());
if (MinDate)
dialogDateBox.datetimepicker('option', 'minDate', MinDate);
else
dialogDateBox.datetimepicker('option', 'minDate', null);
d.dialog('open');
}
function dateDialogCreateUpdater(UpdateUrl, FriendlyName, DateField, UserField, UpdatePropertyName, NotSetDisplay, MinDate, UseAjax) {
$('<a>').attr({ href: '#', 'class': 'button small', style: 'margin-right: 5px;' }).text('Update').click(function (event) {
event.preventDefault();
dateDialogOpen(UpdateUrl, FriendlyName, DateField, UserField, UpdatePropertyName, NotSetDisplay, MinDate, UseAjax);
}).insertBefore('#' + DateField);
}
document.DiscoFunctions.DateDialogCreateUpdater = dateDialogCreateUpdater;
}
@@ -1,2 +1,2 @@
document.DiscoFunctions||(document.DiscoFunctions={}),document.DiscoFunctions.PropertyChangeHelper||(document.DiscoFunctions.PropertyValue=function(n){return n[0].nodeName.toLowerCase()=="input"&&n.attr("type")=="checkbox"?n.is(":checked"):n.val()},document.DiscoFunctions.PropertyChangeHelper=function(n,t,i,r){var e=document.DiscoFunctions.PropertyValue(n),u=null,f=n.nextAll(".ajaxSave").first(),o=n.nextAll(".ajaxLoading").first(),s=function(){f.hide();var t=document.DiscoFunctions.PropertyValue(n);e!=t&&(e=t,u&&window.clearTimeout(u),u=window.setTimeout(function(){o.show();var n={};n[r]=e,$.getJSON(i,n,function(n,t){t!="success"||n!="OK"?(alert('Unable to change property "'+r+'":\n'+n),o.hide()):o.hide().next(".ajaxOk").show().delay("fast").fadeOut("slow")}),u=null},500))};n[0].nodeName.toLowerCase()=="input"&&n.attr("type")=="checkbox"?n.click(s):n.change(s),n[0].nodeName.toLowerCase()=="input"&&n.attr("type")=="text"&&n.keydown(function(n){f.show(),n.which==13&&$(this).blur()}).watermark(t).blur(function(){f.hide()}).focus(function(){$(this).select()}),n[0].nodeName.toLowerCase()=="textarea"&&n.keydown(function(){f.show()})}),document.DiscoFunctions.DateChangeUserHelper||(document.DiscoFunctions.DateChangeUserHelper=function(n,t,i,r,u,f,e){var s=n.val(),o=null,h=t.next(".ajaxLoading");n.watermark(i).change(function(){var i=n.val();s.toLowerCase()!=i.toLowerCase()&&(s=i,o&&window.clearTimeout(o),o=window.setTimeout(function(){h.show();var n={};n[u]=s,$.getJSON(r,n,function(n,i){i!="success"||n.Result!="OK"?(alert("Unable to change Date:\n"+n),h.hide()):(t.text("by "+n.UserDescription),h.hide().next(".ajaxOk").show().delay("fast").fadeOut("slow"))}),o=null},500))}).focus(function(){$(this).select()}),e?n.datepicker({defaultDate:new Date,minDate:f,changeYear:!0,changeMonth:!0,dateFormat:"yy/mm/dd",beforeShow:function(n){$input=$(n),$input.val()||$input.datepicker("setDate",new Date)}}):n.datetimepicker({defaultDate:new Date,ampm:!0,minDate:f,changeYear:!0,changeMonth:!0,dateFormat:"yy/mm/dd",beforeShow:function(n){$input=$(n),$input.val()||$input.datetimepicker("setDate",new Date)}})}),document.DiscoFunctions.DateChangeHelper||(document.DiscoFunctions.DateChangeHelper=function(n,t,i,r,u,f){var o=n.val(),e=null,s=n.next(".ajaxLoading");n.watermark(t).change(function(){var t=n.val();o.toLowerCase()!=t.toLowerCase()&&(o=t,e&&window.clearTimeout(e),e=window.setTimeout(function(){s.show();var n={};n[r]=o,$.getJSON(i,n,function(n,t){t!="success"||n!="OK"?(alert("Unable to change Date:\n"+n),s.hide()):s.hide().next(".ajaxOk").show().delay("fast").fadeOut("slow")}),e=null},500))}).focus(function(){$(this).select()}),f?n.datepicker({defaultDate:new Date,minDate:u,changeYear:!0,changeMonth:!0,dateFormat:"yy/mm/dd",beforeShow:function(n){$input=$(n),$input.val()||$input.datepicker("setDate",new Date)}}):n.datetimepicker({defaultDate:new Date,ampm:!0,minDate:u,changeYear:!0,changeMonth:!0,dateFormat:"yy/mm/dd",beforeShow:function(n){$input=$(n),$input.val()||$input.datetimepicker("setDate",new Date)}})});
if(document.DiscoFunctions||(document.DiscoFunctions={}),document.DiscoFunctions.PropertyChangeHelper||(document.DiscoFunctions.PropertyValue=function(n){return n[0].nodeName.toLowerCase()=="input"&&n.attr("type")=="checkbox"?n.is(":checked"):n.val()},document.DiscoFunctions.PropertyChangeHelper=function(n,t,i,r){var e=document.DiscoFunctions.PropertyValue(n),u=null,f=n.nextAll(".ajaxSave").first(),o=n.nextAll(".ajaxLoading").first(),s=function(){f.hide();var t=document.DiscoFunctions.PropertyValue(n);e!=t&&(e=t,u&&window.clearTimeout(u),u=window.setTimeout(function(){o.show();var n={};n[r]=e,$.getJSON(i,n,function(n,t){t!="success"||n!="OK"?(alert('Unable to change property "'+r+'":\n'+n),o.hide()):o.hide().next(".ajaxOk").show().delay("fast").fadeOut("slow")}),u=null},500))};n[0].nodeName.toLowerCase()=="input"&&n.attr("type")=="checkbox"?n.click(s):n.change(s),n[0].nodeName.toLowerCase()=="input"&&n.attr("type")=="text"&&n.keydown(function(n){f.show(),n.which==13&&$(this).blur()}).watermark(t).blur(function(){f.hide()}).focus(function(){$(this).select()}),n[0].nodeName.toLowerCase()=="textarea"&&n.keydown(function(){f.show()})}),document.DiscoFunctions.DateChangeUserHelper||(document.DiscoFunctions.DateChangeUserHelper=function(n,t,i,r,u,f,e){var s=n.val(),o=null,h=t.next(".ajaxLoading");n.watermark(i).change(function(){var i=n.val();s.toLowerCase()!=i.toLowerCase()&&(s=i,o&&window.clearTimeout(o),o=window.setTimeout(function(){h.show();var n={};n[u]=s,$.getJSON(r,n,function(n,i){i!="success"||n.Result!="OK"?(alert("Unable to change Date:\n"+n),h.hide()):(t.text("by "+n.UserDescription),h.hide().next(".ajaxOk").show().delay("fast").fadeOut("slow"))}),o=null},500))}).focus(function(){$(this).select()}),e?n.datepicker({defaultDate:new Date,minDate:f,changeYear:!0,changeMonth:!0,dateFormat:"yy/mm/dd",beforeShow:function(n){$input=$(n),$input.val()||$input.datepicker("setDate",new Date)}}):n.datetimepicker({defaultDate:new Date,ampm:!0,minDate:f,changeYear:!0,changeMonth:!0,dateFormat:"yy/mm/dd",beforeShow:function(n){$input=$(n),$input.val()||$input.datetimepicker("setDate",new Date)}})}),document.DiscoFunctions.DateChangeHelper||(document.DiscoFunctions.DateChangeHelper=function(n,t,i,r,u,f){var o=n.val(),e=null,s=n.next(".ajaxLoading");n.watermark(t).change(function(){var t=n.val();o.toLowerCase()!=t.toLowerCase()&&(o=t,e&&window.clearTimeout(e),e=window.setTimeout(function(){s.show();var n={};n[r]=o,$.getJSON(i,n,function(n,t){t!="success"||n!="OK"?(alert("Unable to change Date:\n"+n),s.hide()):s.hide().next(".ajaxOk").show().delay("fast").fadeOut("slow")}),e=null},500))}).focus(function(){$(this).select()}),f?n.datepicker({defaultDate:new Date,minDate:u,changeYear:!0,changeMonth:!0,dateFormat:"yy/mm/dd",beforeShow:function(n){$input=$(n),$input.val()||$input.datepicker("setDate",new Date)}}):n.datetimepicker({defaultDate:new Date,ampm:!0,minDate:u,changeYear:!0,changeMonth:!0,dateFormat:"yy/mm/dd",beforeShow:function(n){$input=$(n),$input.val()||$input.datetimepicker("setDate",new Date)}})}),!document.DiscoFunctions.DateDialogCreateUpdater){var dialog,dialogForm,dialogHeader,dialogDateBox,dialogDatePropertyNameBox,updateUrl,friendlyName,dateField,userField,updatePropertyName,notSetDisplay,minDate,useAjax;function dateDialogGet(){if(!dialog){dialog=$("<div>").attr({"class":"dialog"}),dialogForm=$("<form>").attr({action:"/",method:"post"}).appendTo(dialog);var n=$("<p>").appendTo(dialogForm);dialogHeader=$("<h3>").attr("autofocus","autofocus").appendTo(n),dialogDatePropertyNameBox=$("<input>").attr({type:"hidden",name:"key"}).appendTo(n),dialogDateBox=$("<input>").attr({type:"datetime",name:"value"}).css({display:"block","margin-top":15,"margin-left":"auto","margin-right":"auto"}).appendTo(n),$("<input>").attr({type:"hidden",name:"redirect"}).val("true").appendTo(n),dialog.dialog({resizable:!1,modal:!0,autoOpen:!1,buttons:{Update:dateDialogUpdate,Cancel:function(){$(this).dialog("close")}},open:function(){dialog.dialog("widget").find(".ui-dialog-buttonpane :tabbable:first").focus()}}),dialogDateBox.datetimepicker({defaultDate:new Date,ampm:!0,changeYear:!0,changeMonth:!0,dateFormat:"yy/mm/dd"})}return dialog}function dateDialogUpdate(){var u=dialogDateBox.val(),t,n,i,r;useAjax?(t=$("#"+dateField),userField&&(n=$("#"+userField)),dialog.dialog("close"),i=(n?n.next(".ajaxLoading"):t.next(".ajaxLoading")).show(),r={key:updatePropertyName,value:u},$.getJSON(updateUrl,r,function(r,u){u!="success"||r.Result!="OK"?(alert("Unable to change "+friendlyName+" Date:\n"+r),i.hide()):(r.DateTimeFull?t.attr("data-datetimeformatted",r.DateTimeJavascript).attr("data-discodatetime",r.DateTimeSortable).attr("title",r.DateTimeFull).text(r.DateTimeFriendly):t.attr("data-datetimeformatted","").attr("data-discodatetime","-1").attr("title",notSetDisplay).text(notSetDisplay),n&&n.text("by "+r.UserDescription),i.hide().next(".ajaxOk").show().delay("fast").fadeOut("slow"))})):(dialog.dialog("disable"),dialog.dialog("option","butLine truncated
//@ sourceMappingURL=Disco-PropertyChangeHelpers.min.js.map
@@ -2,7 +2,7 @@
"version":3,
"file":"Disco-PropertyChangeHelpers.min.js",
"lineCount":1,
"mappings":"AAAKA,QAAQC,e,GACLD,QAAQC,eAAgB,CAAE,CAAA,EAAE,CAE3BD,QAAQC,eAAeC,qB,GACxBF,QAAQC,eAAeE,cAAe,CAAEC,QAAQ,CAACC,CAAD,CAAe,CAI3D,OAHIA,CAAc,CAAA,CAAA,CAAEC,SAASC,YAAY,CAAA,CAAE,EAAE,OAAQ,EAAGF,CAAaG,KAAK,CAAC,MAAD,CAAQ,EAAE,U,CACzEH,CAAaI,GAAG,CAAC,UAAD,C,CAEpBJ,CAAaK,IAAI,CAAA,CAJmC,CAK9D,CACDV,QAAQC,eAAeC,qBAAsB,CAAES,QAAS,CAACN,CAAa,CAAEO,CAAc,CAAEC,CAAS,CAAEC,CAA3C,CAA+D,CACnH,IAAIC,EAAaf,QAAQC,eAAeE,cAAc,CAACE,CAAD,EAClDW,EAAmB,KACnBC,EAAYZ,CAAaa,QAAQ,CAAC,WAAD,CAAaC,MAAM,CAAA,EACpDC,EAAef,CAAaa,QAAQ,CAAC,cAAD,CAAgBC,MAAM,CAAA,EAC1DE,EAAsBA,QAAQ,CAAA,CAAE,CAC5BJ,CAASK,KAAK,CAAA,CAAE,CAChB,IAAIC,EAAevB,QAAQC,eAAeE,cAAc,CAACE,CAAD,CAAe,CACnEU,CAAW,EAAGQ,C,GACdR,CAAW,CAAEQ,CAAY,CACrBP,C,EACAQ,MAAMC,aAAa,CAACT,CAAD,CAAkB,CACzCA,CAAiB,CAAEQ,MAAME,WAAW,CAAC,QAAQ,CAAA,CAAE,CAC3CN,CAAYO,KAAK,CAAA,CAAE,CACnB,IA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CAAe,CAAEE,CAAQ,CACrBD,C,EACA9B,MAAMC,aAAa,CAAC6B,CAAD,CAAsB,CAC7CA,CAAqB,CAAE9B,MAAME,WAAW,CAAC,QAAS,CAAA,CAAG,CACjDN,CAAYO,KAAK,CAAA,CAAE,CACnB,IAAIC,EAAO,CAAA,CAAE,CACbA,CAAK,CAAAd,CAAA,CAAoB,CAAEuC,CAAc,CACzCxB,CAACC,QAAQ,CAACjB,CAAS,CAAEe,CAAI,CAAE,QAAS,CAACG,CAAQ,CAAEC,CAAX,CAAmB,CAC/CA,CAAO,EAAG,SAAU,EAAGD,CAAS,EAAG,IAAvC,EACIE,KAAK,CAAC,0BAA2B,CAAEF,CAA9B,CAAuC,CAC5CX,CAAYE,KAAK,CAAA,EAFrB,CAIIF,CAAYE,KAAK,CAAA,CAAEY,KAAK,CAAC,SAAD,CAAWP,KAAK,CAAA,CAAEQ,MAAM,CAAC,MAAD,CAAQC,QAAQ,CAAC,MAAD,CALjB,CAA9C,C,CAQTkB,CAAqB,CAAE,IAZ0B,CAapD,CAAE,GAbqC,EAN5B,CAAb,CAqBLV,MAAM,CAAC,QAAS,CAAA,CAAG,CACjBf,CAAC,CAAC,IAAD,CAAMgB,OAAO,CAAA,CADG,CAAb,CAEN,CAEFO,CAAJ,CACIJ,CAASW,WAAW,CAAC,CACjB,WAAW,CAAE,IAAIC,IAAM,CACvB,OAAO,CAAET,CAAO,CAChB,UAAU,CAAE,CAAA,CAAI,CAChB,WAAW,CAAE,CAAA,CAAI,CACjB,UAAULine truncated
"sources":["/ClientSource/Scripts/Modules/Disco-PropertyChangeHelpers/disco.propertychangehelpers.js"],
"names":["document","DiscoFunctions","PropertyChangeHelper","PropertyValue","document.DiscoFunctions.PropertyValue","PropertyField","nodeName","toLowerCase","attr","is","val","document.DiscoFunctions.PropertyChangeHelper","FieldWatermark","UpdateUrl","UpdatePropertyName","fieldValue","fieldChangeToken","$ajaxSave","nextAll","first","$ajaxLoading","fieldChangeFunction","hide","changedValue","window","clearTimeout","setTimeout","show","data","$","getJSON","response","result","alert","next","delay","fadeOut","click","change","keydown","e","which","blur","watermark","focus","select","DateChangeUserHelper","document.DiscoFunctions.DateChangeUserHelper","DateField","UserField","DateFieldWatermark","minDate","dateOnly","dateFieldValue","dateFieldChangeToken","dateText","Result","text","UserDescription","datepicker","Date","beforeShow","input","$input","datetimepicker","DateChangeHelper","document.DiscoFunctions.DateChangeHelper"]
"names":["document","DiscoFunctions","PropertyChangeHelper","PropertyValue","document.DiscoFunctions.PropertyValue","PropertyField","nodeName","toLowerCase","attr","is","val","document.DiscoFunctions.PropertyChangeHelper","FieldWatermark","UpdateUrl","UpdatePropertyName","fieldValue","fieldChangeToken","$ajaxSave","nextAll","first","$ajaxLoading","fieldChangeFunction","hide","changedValue","window","clearTimeout","setTimeout","show","data","$","getJSON","response","result","alert","next","delay","fadeOut","click","change","keydown","e","which","blur","watermark","focus","select","DateChangeUserHelper","document.DiscoFunctions.DateChangeUserHelper","DateField","UserField","DateFieldWatermark","minDate","dateOnly","dateFieldValue","dateFieldChangeToken","dateText","Result","text","UserDescription","datepicker","Date","beforeShow","input","$input","datetimepicker","DateChangeHelper","document.DiscoFunctions.DateChangeHelper","DateDialogCreateUpdater","dialog","dialogForm","dialogHeader","dialogDateBox","dialogDatePropertyNameBox","updateUrl","friendlyName","dateField","userField","updatePropertyName","notSetDisplay","useAjax","dateDialogGet","appendTo","dialogBody","css","dateDialogUpdate","Cancel","open","find","dateValue","$dateField","$userField","DateTimeFull","DateTimeJavascript","DateTimeSortable","DateTimeFriendly","submit","dateDialogOpen","FriendlyName","NotSetDisplay","MinDate","UseAjax","d","dfVal","dateDialogCreateUpdater","event","preventDefault","insertBefore"]
}
@@ -1,197 +1,326 @@
if (!document.DiscoFunctions) {
document.DiscoFunctions = {};
document.DiscoFunctions = {};
}
if (!document.DiscoFunctions.PropertyChangeHelper) {
document.DiscoFunctions.PropertyValue = function (PropertyField) {
if (PropertyField[0].nodeName.toLowerCase() == 'input' && PropertyField.attr('type') == 'checkbox') {
return PropertyField.is(':checked');
}
return PropertyField.val();
};
document.DiscoFunctions.PropertyChangeHelper = function (PropertyField, FieldWatermark, UpdateUrl, UpdatePropertyName) {
var fieldValue = document.DiscoFunctions.PropertyValue(PropertyField);
var fieldChangeToken = null;
var $ajaxSave = PropertyField.nextAll('.ajaxSave').first();
var $ajaxLoading = PropertyField.nextAll('.ajaxLoading').first();
var fieldChangeFunction = function () {
$ajaxSave.hide();
var changedValue = document.DiscoFunctions.PropertyValue(PropertyField);
if (fieldValue != changedValue) {
fieldValue = changedValue;
if (fieldChangeToken)
window.clearTimeout(fieldChangeToken);
fieldChangeToken = window.setTimeout(function () {
$ajaxLoading.show();
var data = {};
data[UpdatePropertyName] = fieldValue;
$.getJSON(UpdateUrl, data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change property "' + UpdatePropertyName + '":\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
fieldChangeToken = null;
}, 500);
};
}
if (PropertyField[0].nodeName.toLowerCase() == 'input' && PropertyField.attr('type') == 'checkbox') {
PropertyField.click(fieldChangeFunction);
} else {
PropertyField.change(fieldChangeFunction);
}
// For Input Text Boxes
if (PropertyField[0].nodeName.toLowerCase() == 'input' && PropertyField.attr('type') == 'text') {
PropertyField.keydown(function (e) {
$ajaxSave.show();
if (e.which == 13) {
$(this).blur();
}
})
.watermark(FieldWatermark)
.blur(function () {
$ajaxSave.hide();
}).focus(function () {
$(this).select();
});
}
// For TextAreas
if (PropertyField[0].nodeName.toLowerCase() == 'textarea') {
PropertyField.keydown(function () {
$ajaxSave.show();
})
}
}
if (!document.DiscoFunctions.PropertyChangeHelper){
document.DiscoFunctions.PropertyValue = function(PropertyField){
if (PropertyField[0].nodeName.toLowerCase()=='input' && PropertyField.attr('type')=='checkbox'){
return PropertyField.is(':checked');
}
return PropertyField.val();
};
document.DiscoFunctions.PropertyChangeHelper = function (PropertyField, FieldWatermark, UpdateUrl, UpdatePropertyName) {
var fieldValue = document.DiscoFunctions.PropertyValue(PropertyField);
var fieldChangeToken = null;
var $ajaxSave = PropertyField.nextAll('.ajaxSave').first();
var $ajaxLoading = PropertyField.nextAll('.ajaxLoading').first();
var fieldChangeFunction = function(){
$ajaxSave.hide();
var changedValue = document.DiscoFunctions.PropertyValue(PropertyField);
if (fieldValue != changedValue){
fieldValue = changedValue;
if (fieldChangeToken)
window.clearTimeout(fieldChangeToken);
fieldChangeToken = window.setTimeout(function(){
$ajaxLoading.show();
var data = {};
data[UpdatePropertyName] = fieldValue;
$.getJSON(UpdateUrl, data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change property "' + UpdatePropertyName + '":\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
fieldChangeToken = null;
}, 500);
};
}
if (PropertyField[0].nodeName.toLowerCase()=='input' && PropertyField.attr('type')=='checkbox'){
PropertyField.click(fieldChangeFunction);
}else{
PropertyField.change(fieldChangeFunction);
}
// For Input Text Boxes
if (PropertyField[0].nodeName.toLowerCase()=='input' && PropertyField.attr('type')=='text'){
PropertyField.keydown(function(e){
$ajaxSave.show();
if (e.which == 13) {
$(this).blur();
}
})
.watermark(FieldWatermark)
.blur(function () {
$ajaxSave.hide();
}).focus(function(){
$(this).select();
});
}
// For TextAreas
if (PropertyField[0].nodeName.toLowerCase()=='textarea'){
PropertyField.keydown(function(){
$ajaxSave.show();
})
}
}
};
if (!document.DiscoFunctions.DateChangeUserHelper){
document.DiscoFunctions.DateChangeUserHelper = function (DateField, UserField, DateFieldWatermark, UpdateUrl, UpdatePropertyName, minDate, dateOnly) {
var dateFieldValue = DateField.val();
var dateFieldChangeToken = null;
var $ajaxLoading = UserField.next('.ajaxLoading');
DateField
.watermark(DateFieldWatermark)
.change(function(){
var dateText = DateField.val();
if (dateFieldValue.toLowerCase() != dateText.toLowerCase()){
dateFieldValue = dateText;
if (dateFieldChangeToken)
window.clearTimeout(dateFieldChangeToken);
dateFieldChangeToken = window.setTimeout(function(){
$ajaxLoading.show();
var data = {};
data[UpdatePropertyName] = dateFieldValue;
$.getJSON(UpdateUrl, data, function (response, result) {
if (result != 'success' || response.Result != 'OK') {
alert('Unable to change Date:\n' + response);
$ajaxLoading.hide();
} else {
UserField.text('by ' + response.UserDescription);
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
dateFieldChangeToken = null;
}, 500);
}
}).focus(function(){
$(this).select();
});
if (dateOnly){
DateField.datepicker({
defaultDate: new Date(),
minDate: minDate,
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd',
beforeShow: function(input, inst){
$input = $(input);
if (!$input.val()){
$input.datepicker('setDate', new Date());
}
}
});
}else{
DateField.datetimepicker({
defaultDate: new Date(),
ampm: true,
minDate: minDate,
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd',
beforeShow: function(input, inst){
$input = $(input);
if (!$input.val()){
$input.datetimepicker('setDate', new Date());
}
}
});
}
}
};
if (!document.DiscoFunctions.DateChangeHelper){
document.DiscoFunctions.DateChangeHelper = function (DateField, DateFieldWatermark, UpdateUrl, UpdatePropertyName, minDate, dateOnly) {
var dateFieldValue = DateField.val();
var dateFieldChangeToken = null;
var $ajaxLoading = DateField.next('.ajaxLoading');
DateField
.watermark(DateFieldWatermark)
.change(function(){
};
if (!document.DiscoFunctions.DateChangeUserHelper) {
document.DiscoFunctions.DateChangeUserHelper = function (DateField, UserField, DateFieldWatermark, UpdateUrl, UpdatePropertyName, minDate, dateOnly) {
var dateFieldValue = DateField.val();
var dateFieldChangeToken = null;
var $ajaxLoading = UserField.next('.ajaxLoading');
DateField
.watermark(DateFieldWatermark)
.change(function () {
var dateText = DateField.val();
if (dateFieldValue.toLowerCase() != dateText.toLowerCase()){
dateFieldValue = dateText;
if (dateFieldChangeToken)
window.clearTimeout(dateFieldChangeToken);
dateFieldChangeToken = window.setTimeout(function(){
$ajaxLoading.show();
var data = {};
data[UpdatePropertyName] = dateFieldValue;
$.getJSON(UpdateUrl, data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Date:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
dateFieldChangeToken = null;
}, 500);
}
}).focus(function(){
$(this).select();
});
if (dateOnly){
DateField.datepicker({
defaultDate: new Date(),
minDate: minDate,
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd',
beforeShow: function(input, inst){
$input = $(input);
if (!$input.val()){
$input.datepicker('setDate', new Date());
if (dateFieldValue.toLowerCase() != dateText.toLowerCase()) {
dateFieldValue = dateText;
if (dateFieldChangeToken)
window.clearTimeout(dateFieldChangeToken);
dateFieldChangeToken = window.setTimeout(function () {
$ajaxLoading.show();
var data = {};
data[UpdatePropertyName] = dateFieldValue;
$.getJSON(UpdateUrl, data, function (response, result) {
if (result != 'success' || response.Result != 'OK') {
alert('Unable to change Date:\n' + response);
$ajaxLoading.hide();
} else {
UserField.text('by ' + response.UserDescription);
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
}
});
}else{
DateField.datetimepicker({
defaultDate: new Date(),
ampm: true,
minDate: minDate,
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd',
beforeShow: function(input, inst){
$input = $(input);
if (!$input.val()){
$input.datetimepicker('setDate', new Date());
}
}
});
})
dateFieldChangeToken = null;
}, 500);
}
}).focus(function () {
$(this).select();
});
};
}
if (dateOnly) {
DateField.datepicker({
defaultDate: new Date(),
minDate: minDate,
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd',
beforeShow: function (input, inst) {
$input = $(input);
if (!$input.val()) {
$input.datepicker('setDate', new Date());
}
}
});
} else {
DateField.datetimepicker({
defaultDate: new Date(),
ampm: true,
minDate: minDate,
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd',
beforeShow: function (input, inst) {
$input = $(input);
if (!$input.val()) {
$input.datetimepicker('setDate', new Date());
}
}
});
}
}
};
if (!document.DiscoFunctions.DateChangeHelper) {
document.DiscoFunctions.DateChangeHelper = function (DateField, DateFieldWatermark, UpdateUrl, UpdatePropertyName, minDate, dateOnly) {
var dateFieldValue = DateField.val();
var dateFieldChangeToken = null;
var $ajaxLoading = DateField.next('.ajaxLoading');
DateField
.watermark(DateFieldWatermark)
.change(function () {
var dateText = DateField.val();
if (dateFieldValue.toLowerCase() != dateText.toLowerCase()) {
dateFieldValue = dateText;
if (dateFieldChangeToken)
window.clearTimeout(dateFieldChangeToken);
dateFieldChangeToken = window.setTimeout(function () {
$ajaxLoading.show();
var data = {};
data[UpdatePropertyName] = dateFieldValue;
$.getJSON(UpdateUrl, data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Date:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
dateFieldChangeToken = null;
}, 500);
}
}).focus(function () {
$(this).select();
});
if (dateOnly) {
DateField.datepicker({
defaultDate: new Date(),
minDate: minDate,
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd',
beforeShow: function (input, inst) {
$input = $(input);
if (!$input.val()) {
$input.datepicker('setDate', new Date());
}
}
});
} else {
DateField.datetimepicker({
defaultDate: new Date(),
ampm: true,
minDate: minDate,
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd',
beforeShow: function (input, inst) {
$input = $(input);
if (!$input.val()) {
$input.datetimepicker('setDate', new Date());
}
}
});
}
};
}
if (!document.DiscoFunctions.DateDialogCreateUpdater)
{
var dialog, dialogForm, dialogHeader, dialogDateBox, dialogDatePropertyNameBox;
var updateUrl, friendlyName, dateField, userField, updatePropertyName, notSetDisplay, minDate, useAjax;
function dateDialogGet() {
if (!dialog) {
dialog = $('<div>').attr({ 'class': 'dialog' })
dialogForm = $('<form>').attr({ 'action': '/', 'method': 'post' }).appendTo(dialog);
var dialogBody = $('<p>').appendTo(dialogForm);
dialogHeader = $('<h3>').attr('autofocus', 'autofocus').appendTo(dialogBody);
dialogDatePropertyNameBox = $('<input>').attr({ 'type': 'hidden', 'name': 'key' }).appendTo(dialogBody);
dialogDateBox = $('<input>').attr({ 'type': 'datetime', 'name': 'value' }).css({ 'display': 'block', 'margin-top': 15, 'margin-left': 'auto', 'margin-right': 'auto' }).appendTo(dialogBody);
$('<input>').attr({ 'type': 'hidden', 'name': 'redirect' }).val('true').appendTo(dialogBody);
dialog.dialog({
resizable: false,
modal: true,
autoOpen: false,
buttons: {
"Update": dateDialogUpdate,
Cancel: function () {
$(this).dialog("close");
}
},
open: function () {
dialog.dialog('widget').find('.ui-dialog-buttonpane :tabbable:first').focus();
}
});
dialogDateBox.datetimepicker({
defaultDate: new Date(),
ampm: true,
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd',
});
}
return dialog;
}
function dateDialogUpdate() {
var dateValue = dialogDateBox.val();
if (useAjax) {
// Use Ajax
var $dateField, $userField;
$dateField = $('#' + dateField);
if (userField)
$userField = $('#' + userField);
dialog.dialog("close");
var $ajaxLoading = ($userField ? $userField.next('.ajaxLoading') : $dateField.next('.ajaxLoading')).show();
var data = {
key: updatePropertyName,
value: dateValue
};
$.getJSON(updateUrl, data, function (response, result) {
if (result != 'success' || response.Result != 'OK') {
alert('Unable to change ' + friendlyName + ' Date:\n' + response);
$ajaxLoading.hide();
} else {
if (response.DateTimeFull) {
$dateField.attr('data-datetimeformatted', response.DateTimeJavascript)
.attr('data-discodatetime', response.DateTimeSortable)
.attr('title', response.DateTimeFull)
.text(response.DateTimeFriendly);
} else {
$dateField.attr('data-datetimeformatted', '')
.attr('data-discodatetime', '-1')
.attr('title', notSetDisplay)
.text(notSetDisplay);
}
if ($userField)
$userField.text('by ' + response.UserDescription);
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
} else {
// Post Form & Redirect
dialog.dialog("disable");
dialog.dialog("option", "buttons", null);
dialogDatePropertyNameBox.val(updatePropertyName);
dialogForm.attr('action', updateUrl);
dialogForm.submit();
}
}
function dateDialogOpen(UpdateUrl, FriendlyName, DateField, UserField, UpdatePropertyName, NotSetDisplay, MinDate, UseAjax) {
updateUrl = UpdateUrl;
friendlyName = FriendlyName;
dateField = DateField;
userField = UserField;
updatePropertyName = UpdatePropertyName;
notSetDisplay = NotSetDisplay;
minDate = MinDate;
useAjax = UseAjax;
var d = dateDialogGet();
d.dialog('option', 'title', friendlyName);
dialogHeader.text(friendlyName + ' Date');
var dfVal = $('#' + DateField).attr('data-datetimeformatted');
if (dfVal)
dialogDateBox.datetimepicker('setDate', new Date(dfVal));
else
dialogDateBox.datetimepicker('setDate', new Date());
if (MinDate)
dialogDateBox.datetimepicker('option', 'minDate', MinDate);
else
dialogDateBox.datetimepicker('option', 'minDate', null);
d.dialog('open');
}
function dateDialogCreateUpdater(UpdateUrl, FriendlyName, DateField, UserField, UpdatePropertyName, NotSetDisplay, MinDate, UseAjax) {
$('<a>').attr({ href: '#', 'class': 'button small', style: 'margin-right: 5px;' }).text('Update').click(function (event) {
event.preventDefault();
dateDialogOpen(UpdateUrl, FriendlyName, DateField, UserField, UpdatePropertyName, NotSetDisplay, MinDate, UseAjax);
}).insertBefore('#' + DateField);
}
document.DiscoFunctions.DateDialogCreateUpdater = dateDialogCreateUpdater;
}