PK a7 META-INF/ PK a7uj j META-INF/MANIFEST.MFManifest-Version: 1.0 Ant-Version: Apache Ant 1.7.0 Created-By: 1.6.0_03-b05 (Sun Microsystems Inc.) PK a7 ErrorTypeEditor/PK a7 WEB-INF/PK a7 WEB-INF/classes/PK a7 abc/PK a7 resources2/PK a79F ErrorTypeEditor/component.css/*---------------------------------------------------------- STYLE DECLARATION FOR ErrorTypeEditor WIDGET LAYOUT, COLOR AND TYPOGRAPHY -----------------------------------------------------------*/ /*----- main container ------*/ div.errorTypeEditorPopup { position: absolute; border: solid 1px #888; width: 290px; background-color: #ECE9EB; } /*------ header -------------*/ div.errorTypeEditorPopup h4 { font-size: 0.88em; font-weight: bold; border-bottom: 1px solid #999; } /*---------- fieldset ---------*/ div.errorTypeEditorPopup fieldset.inputFieldset { margin-top: 10px; } div.errorTypeEditorPopup fieldset.buttonFieldset { text-align: center; margin:10px 20px 7px; border-top:1px solid #999999; padding-top:7px; } div.errorTypeEditorPopup fieldset.inputFieldset input { border: solid 1px #888; width: 230px; padding: 1px; display: block; margin-bottom: 8px; margin-left: 20px; margin-right: 20px; } div.errorTypeEditorPopup fieldset.inputFieldset input:focus { background-color:#F0F0F0; } /*---------- labels -----------*/ div.errorTypeEditorPopup form label { font-weight: bold; font-size: 0.81em; display: block; padding-bottom: 4px; margin-left: 20px; margin-right: 20px; } /*---------- error message -----------*/ div.errorTypeEditorPopup fieldset.inputFieldset ul.errormsg { border: 1px dotted #900; background-color: #ffc; margin-left: 10px; margin-right: 20px; } div.errorTypeEditorPopup fieldset.inputFieldset ul.errormsg li h3 { margin: 0; padding: 0.3em 0.8em; font-size: 0.85em; color: #900; }PK a7j0o ErrorTypeEditor/component.htm
PK a7 ^ ^ ErrorTypeEditor/component.jswow.log("ErrorTypeEditor/component.js --start"); /* * Define the namespace (object) for this widget. * * Note: The "jmaki.widgets" prefix is hardwired into /resources/jmaki.js. */ jmaki.namespace("jmaki.widgets.WowWidgets.ErrorTypeEditor"); jmaki.widgets.WowWidgets.ErrorTypeEditor.Widget = Class.create(); jmaki.widgets.WowWidgets.ErrorTypeEditor.Widget.prototype = { /** * */ initialize : function(wargs) { // Store the parameters as instance vars this.uuid = wargs.uuid; // Bind handlers var self = this; $(this.uuid + "_ok").onclick = function(){ self.onOk(); } $(this.uuid + "_cancel").onclick = function(){ self.hide(); } $(this.uuid + "_remove").onclick = function(){ self.onRemove(); } // Setup event handler on http status code field. var httpStatusCode = $(this.uuid + "_httpStatusCode"); httpStatusCode.isValid = true; Event.observe(httpStatusCode, "blur", function() { self.validate(httpStatusCode); }); }, /** * Brings up the editor and fills it with data of given parameter. * * @param param */ edit : function(param, element) { // Create model for received parameter and fill it with data this.errorType = new wow.ErrorType(); // If an exisitng error type is to be edited, an object is passed in if (typeof(param) == "object") { this.errorType.errorCode = param.errorCode; this.errorType.description = param.description; this.errorType.httpStatusCode = param.httpStatusCode; this.isEditing = true; } // If new error type is to be edited, only error code is passed in else { this.errorType.errorCode = param; this.errorType.description = ""; this.errorType.httpStatusCode = ""; this.isEditing = false; } this.updateView(); this.show(element); }, /** * Updates the DOM view components with current model data. */ updateView : function() { // var headerContent = "Edit error type '" + this.errorType.errorCode + "'"; // $(this.uuid + "_errorCode").update(headerContent); $(this.uuid + "_errorCode").value = this.errorType.errorCode; $(this.uuid + "_description").value = this.errorType.description; $(this.uuid + "_httpStatusCode").value = this.errorType.httpStatusCode; if (this.errorType.errorCode != "") { $(this.uuid + "_errorCode").disabled = true; } else { $(this.uuid + "_errorCode").disabled = false; } $(this.uuid + "_remove").disabled = !(this.isEditing); var errorNode = $(this.uuid + "_httpStatusCode").parentNode.getElementsByClassName("errormsg")[0]; if(errorNode) { $(this.uuid + "_httpStatusCode").parentNode.removeChild(errorNode); } }, /** * Updates the model with the values in the view */ updateModel : function() { this.errorType.description = $(this.uuid + "_description").value; var statusCode = $(this.uuid + "_httpStatusCode").value; if (statusCode == "") { statusCode = null; } this.errorType.httpStatusCode = statusCode; this.errorType.errorCode = $(this.uuid + "_errorCode").value; }, /* * Brings up the widget in a popup. */ show : function(element) { Popup.showPopup($(this.uuid), element); }, /* * Hides the popup. */ hide : function() { Popup.hidePopup($(this.uuid)); }, /** * Event handler raised on Ok button click. */ onOk : function() { var httpStatusCode = $(this.uuid + "_httpStatusCode"); if (httpStatusCode.isValid == false) { return; } // Update the model this.updateModel(); // Send back a change object if (this.isEditing) { jmaki.publish("/ItemPage/modifyData", { property: "errorTypes", edit: this.errorType }); } else { jmaki.publish("/ItemPage/modifyData", { property: "errorTypes", add: this.errorType }); } // Hide the dialog this.hide(); }, /** * Event handler raised on Remove button click. */ onRemove : function() { // Send back a change object jmaki.publish("/ItemPage/modifyData", { property: "errorTypes", remove: this.errorType }); // Hide the dialog this.hide(); }, /** * This method validates the http status code field. * Only numbers is allowed. */ validate : function(field) { var pattern = /^\d+$/; if (field.value.empty() || pattern.test(field.value)) { field.isValid = true; this.removeErrorMsg(field); } else { field.isValid = false; this.showErrorMsg(field); } }, /** * Remove the error message underneath the invalid field. */ removeErrorMsg : function(node) { var errorNode = node.parentNode.getElementsByClassName("errormsg")[0]; if(errorNode) { node.parentNode.removeChild(errorNode); } }, /** * Show the error message underneath the invalid field. */ showErrorMsg : function(node) { var errorNode = node.parentNode.getElementsByClassName("errormsg")[0]; if(!errorNode) { var error = "HTTP status code must be a number."; var container = document.createElement("ul"); container.className = "errormsg"; var msgNode = document.createElement("li"); var msgText = document.createElement("h3"); msgText.appendChild(document.createTextNode(error)); msgNode.appendChild(msgText); container.appendChild(msgNode); node.parentNode.appendChild(container); } } } wow.log("ErrorTypeEditor/component.js --end");PK a74U WEB-INF/sun-web.xml