[JavaScript] DLComments

Auxilary class for DL Suite: Comments.

Summary
[JavaScript] DLCommentsAuxilary class for DL Suite: Comments.
AuthorDuc Tri Le <cmsmadesimple---at---email.tiger-inc.com>
LicenseThis class is released under the GNU General Public License.
Functions
copyDataCopy the inner HTML of the original element to a textarea (creating it if it doesn’t already exist.
restoreDataCopy the value of the field back to the original element while keeping the field in the document.
serverResponseProcess the server response.
showHideToggle the display of the given data and update the given link to reflect the new action.
submitFormSubmit a form to the server.

Author

Duc Tri Le <cmsmadesimple---at---email.tiger-inc.com>

License

This class is released under the GNU General Public License.

Functions

copyData

copyData: function(field,
original,
type,
name,
id)

Copy the inner HTML of the original element to a textarea (creating it if it doesn’t already exist.  This will hide the original element and restore it when the textarea loses focus.

Parameters

field(string) The type of field to create.
original(object) The DOM element in which the inner HTML will be retrieved from.
type(string) The type of settings: approval|modify.
name(string) The name of the input field.
id(string) The ID.

restoreData

restoreData: function(original,
field_span,
field)

Copy the value of the field back to the original element while keeping the field in the document.

Parameters

original(object) The original DOM element.
field_span(object) The span that contains the field.
field(object) The field from which the value is to be retrieved.

serverResponse

serverResponse: function(form,
message_area,
html_area,
transport)

Process the server response.

Parameters

form(object) The form that began the request.
message_area(object) The DOM element that will hold the message returned by the request.
html_area(object) The DOM element that will hold the HTML returned by the request.
transport(object) The AJAX transport.

showHide

showHide: function(link,
data)

Toggle the display of the given data and update the given link to reflect the new action.

Parameters

link(object) The link that will toggle the display of the data.
data(object) An object containing various information about what to toggle.  It includes the id of the element to hide or show, and the text of the link when that element is hidden and when it is visible.

submitForm

submitForm: function(form,
type)

Submit a form to the server.

Parameters

form(object) The form to submit.
type(string) The type of request.
copyData: function(field,
original,
type,
name,
id)
Copy the inner HTML of the original element to a textarea (creating it if it doesn’t already exist.
restoreData: function(original,
field_span,
field)
Copy the value of the field back to the original element while keeping the field in the document.
serverResponse: function(form,
message_area,
html_area,
transport)
Process the server response.
showHide: function(link,
data)
Toggle the display of the given data and update the given link to reflect the new action.
submitForm: function(form,
type)
Submit a form to the server.