### Eclipse Workspace Patch 1.0
#P fluid-engage-core
Index: tests/component-tests/codeEntry/js/CodeEntryTests.js
===================================================================
--- tests/component-tests/codeEntry/js/CodeEntryTests.js	(revision 9309)
+++ tests/component-tests/codeEntry/js/CodeEntryTests.js	(working copy)
@@ -18,27 +18,27 @@
     var tests = {};
     var component;
 
+
+    /**
+     * For test purposes - only even numbers are valid codes.
+     */
+    var simulateCheck = function () {
+        if (component.code[1] % 2 === 0) {
+            return "#";
+        }
+    };
+    
     var setup = function () {
         tests.fetchTemplate(
                 "../../../../components/codeEntry/html/codeEntry.html",
                 ".flc-codeEntry");
         
-        component = fluid.engage.codeEntry(".flc-codeEntry", {testMode: true});
+        component = fluid.engage.codeEntry(".flc-codeEntry",
+            {getArtifactUrlFn: simulateCheck});
     };
     
     tests = jqUnit.testCase("Code Entry Tests", setup);
     
-    // Code taken from www.sean.co.uk
-    var pausecomp = function (millis)
-    {
-    	var date = new Date();
-    	var curDate = null;
-
-    	do {
-    		curDate = new Date();
-    	} while(curDate-date < millis);
-    }
-    
     var codeEntryTests = function () {
         tests.test("Component construction test", function () {
             expect(2);
@@ -48,57 +48,56 @@
         });
         
         tests.test("Buttons test", function () {
-        	expect(11);
-        	
-        	var firstDigitField = component.locate("firstDigitField");
-        	
-        	var buttons = component.locate("entryButtons");
-        	var del = $(buttons[10]);
-        	
-        	$(buttons[0]).click();
-        	del.click();
-        	
-        	jqUnit.assertEquals("Delete button working.", "", firstDigitField.text());
-        	
-        	for (var i = 0; i < buttons.length - 1; i++) {
-        		var buttonNumber = (i + 1) % 10;
-        		$(buttons[i]).click();
-        		jqUnit.assertEquals("Button number " + buttonNumber + " working.", buttonNumber + "", firstDigitField.text());
-        		// Delete
-        		del.click();
-        	}
+            expect(11);
+            
+            var firstDigitField = component.locate("firstDigitField");
+            
+            var buttons = component.locate("numButtons");
+            var del = component.locate("delButton");
+            
+            $(buttons[0]).click();
+            del.click();
+            
+            jqUnit.assertEquals("Delete button working.", "", firstDigitField.text());
+            
+            for (var i = 0; i < buttons.length; i++) {
+                var buttonNumber = (i + 1) % 10;
+                $(buttons[i]).click();
+                jqUnit.assertEquals("Button number " + buttonNumber + " working.", buttonNumber + "", firstDigitField.text());
+                // Delete
+                del.click();
+            }
         });
         
         tests.test("Code entry test", function () {
-        	expect(15);
-        	
-        	var firstDigitField = component.locate("firstDigitField");
-        	var secondDigitField = component.locate("secondDigitField");
+            expect(15);
+            
+            var firstDigitField = component.locate("firstDigitField");
+            var secondDigitField = component.locate("secondDigitField");
             var headBlock = component.locate("headMessage");
             
             // First the two code fields are blank
-        	jqUnit.assertEquals("First Digit blank.", "", firstDigitField.text());
-        	jqUnit.assertEquals("Second digit blank.", "", secondDigitField.text());
-        	
-        	// We enter a digit
-        	component.enterDigit(3);
-        	jqUnit.assertEquals("First digit is 3.", "3", firstDigitField.text());
-        	jqUnit.assertEquals("Second digit blank.", "", secondDigitField.text());
-        	
-        	// Then delete it
-        	component.deleteLastDigit();
-        	jqUnit.assertEquals("First Digit blank.", "", firstDigitField.text());
-        	jqUnit.assertEquals("Second digit blank.", "", secondDigitField.text());
-        	
-        	// Enter two digits to make a invalid code - the code fields should
-        	// be blanked and an error message shown
-        	component.enterDigit(3);
-        	component.enterDigit(7);
+            jqUnit.assertEquals("First Digit blank.", "", firstDigitField.text());
+            jqUnit.assertEquals("Second digit blank.", "", secondDigitField.text());
+            
+            // We enter a digit
+            component.enterDigit(3);
+            jqUnit.assertEquals("First digit is 3.", "3", firstDigitField.text());
+            jqUnit.assertEquals("Second digit blank.", "", secondDigitField.text());
+            
+            // Then delete it
+            component.deleteLastDigit();
+            jqUnit.assertEquals("First Digit blank.", "", firstDigitField.text());
+            jqUnit.assertEquals("Second digit blank.", "", secondDigitField.text());
+            
+            // Enter two digits to make a invalid code - the code fields should
+            // be blanked and an error message shown
+            component.enterDigit(3);
+            component.enterDigit(7);
             jqUnit.assertEquals("First digit blank.", "", firstDigitField.text());
             jqUnit.assertEquals("Second digit blank.", "", secondDigitField.text());
             jqUnit.assertEquals("Invalid code message shown.",
-            		"<img src=\"../../../../fluid-engage-core/components/codeEntry/images/invalid-code.png\" alt=\"Invalid code.\">",
-            		headBlock.html());
+                    component.options.strings.invalidCode, headBlock.text());
             
 
             // Enter one digit - the error message persists
@@ -106,8 +105,7 @@
             jqUnit.assertEquals("First digit is 2.", "2", firstDigitField.text());
             jqUnit.assertEquals("Second digit blank.", "", secondDigitField.text());
             jqUnit.assertEquals("Invalid code message shown.",
-            		"<img src=\"../../../../fluid-engage-core/components/codeEntry/images/invalid-code.png\" alt=\"Invalid code.\">",
-            		headBlock.html());
+                    component.options.strings.invalidCode, headBlock.text());
             
             // Enter second digit - the code fields are shown until redirection
             // happens
Index: components/codeEntry/js/CodeEntryView.js
===================================================================
--- components/codeEntry/js/CodeEntryView.js	(revision 9374)
+++ components/codeEntry/js/CodeEntryView.js	(working copy)
@@ -70,9 +70,10 @@
      */
     var wrongCodeSequence = function (that) {
         var msg = that.locate("headMessage");
+        var opts = that.options;
         
-        msg.text(that.options.strings.invalidCode);
-        msg.addClass(that.options.styles.invalidCode);
+        msg.text(opts.strings.invalidCode);
+        msg.addClass(opts.styles.invalidCode);
         
         msg.show(250, function () {
             reset(that);
@@ -86,34 +87,24 @@
      * 
      * @param {Object} that, the component.
      */
-    var checkCode = function (that) {
+    var getArtifactUrl = function (that) {
         var url = fluid.stringTemplate(
             decodeURIComponent(that.options.codeCheckUrlTemplate), {
             objectCode : that.code
         });
         
-        var error = function (XHR, textStatus, errorThrown) {
-            fluid.log("XHR: " + XHR);
-            fluid.log("Status: " + textStatus);
-            fluid.log("Error: " + errorThrown);
-        };
-        
-        var success = function (returnedData) {
-        
-            var data = JSON.parse(returnedData);
-            
-            if (data.artifactFound) {
-                redirectSequence(that, data.artifactLink);
-            } else {
-                wrongCodeSequence(that);
-            }
+        var artifactLink;
+        var success = function (data) {
+            artifactLink = data;
         };
         
         $.ajax({
             url : url,
-            error : error,
-            success : success
+            success : success,
+            async: false
         });
+        
+        return artifactLink;
     };
 
     /**
@@ -128,6 +119,13 @@
         button.attr("alt", that.options.strings.deleteLabel);
         button.click(that.deleteLastDigit);
     };
+    
+    var setupDeleteImage = function  (that, deleteButton, deleteImage) {
+        deleteImage.attr("src", that.options.deleteImage);
+        deleteImage.click(function () {
+            deleteButton.click();
+        });
+    };
 
     /**
      * Initializes the component view.
@@ -158,6 +156,9 @@
         
         //Initialize delete button
         setupDelete(that, that.locate("delButton"));
+        
+        //Initialize delete image
+        setupDeleteImage(that, that.locate("delButton"), that.locate("delImage"));
     };
 
     /**
@@ -179,7 +180,12 @@
             } else {
                 that.code += digit;
                 that.deleteEnabled = false;
-                checkCode(that);
+                var artifactLink = that.options.getArtifactUrlFn(that);
+                if (artifactLink) {
+                    redirectSequence(that, artifactLink);
+                } else {
+                    wrongCodeSequence(that);
+                }                        
             }
         };
         
@@ -210,7 +216,8 @@
             firstDigitField : ".flc-codeEntry-firstDigit",
             secondDigitField : ".flc-codeEntry-secondDigit",
             numButtons: ".flc-codeEntry-numButton",
-            delButton: ".flc-codeEntry-delButton"
+            delButton: ".flc-codeEntry-delButton",
+            delImage: ".flc-codeEntry-delImage"
         },
         styles : {
             invalidCode : "fl-codeEntry-invalidCode"
@@ -224,6 +231,7 @@
             deleteLabel: "Delete"
         },
         codeCheckUrlTemplate: "",
-        redirectDelay : 1000
+        redirectDelay : 1000,
+        getArtifactUrlFn: getArtifactUrl
     });
 })(jQuery);
Index: tests/component-tests/codeEntry/html/CodeEntryView-test.html
===================================================================
--- tests/component-tests/codeEntry/html/CodeEntryView-test.html	(revision 9309)
+++ tests/component-tests/codeEntry/html/CodeEntryView-test.html	(working copy)
@@ -14,6 +14,7 @@
         <script type="text/javascript" src="../../../../../fluid-infusion/src/webapp/tests/lib/qunit/js/testrunner.js"></script>
         <script type="text/javascript" src="../../../../../fluid-infusion/src/webapp/tests/test-core/jqUnit/js/jqUnit.js"></script>
 
+        <script type="text/javascript" src="../../../../../fluid-engage-core/components/navigationBar/js/NavigationBar.js"></script>
 		<script type="text/javascript" src="../../../../../fluid-engage-core/components/codeEntry/js/CodeEntryView.js"></script>
 
 		<script type="text/javascript" src="../../../../../fluid-engage-core/tests/component-tests/codeEntry/js/CodeEntryTests.js"></script>
Index: components/codeEntry/html/codeEntry.html
===================================================================
--- components/codeEntry/html/codeEntry.html	(revision 9374)
+++ components/codeEntry/html/codeEntry.html	(working copy)
@@ -41,26 +41,27 @@
 	            <span class="flc-codeEntry-secondDigit fl-codeEntry-digitField"></span>
 			</div>
 			
-			<div class="flc-codeEntry-numpad fl-codeEntry-numpad  fl-table">
+			<div class="flc-codeEntry-numpad fl-codeEntry-numpad fl-table">
 				<div class="fl-table-row">
 					<img class="flc-codeEntry-numButton" role="button" src="../../../../fluid-engage-core/components/codeEntry/images/1.png" alt="1"/>
-					<img class="flc-codeEntry-numButton" role="button" src="../../../../fluid-engage-core/components/codeEntry/images/2.png" alt="2"/>
+					<img class="flc-codeEntry-numButton fl-codeEntry-middleButton" role="button" src="../../../../fluid-engage-core/components/codeEntry/images/2.png" alt="2"/>
 					<img class="flc-codeEntry-numButton" role="button" src="../../../../fluid-engage-core/components/codeEntry/images/3.png" alt="3"/>
 				</div>
 				<div class="fl-table-row">
 					<img class="flc-codeEntry-numButton" role="button" src="../../../../fluid-engage-core/components/codeEntry/images/4.png" alt="4"/>
-					<img class="flc-codeEntry-numButton" role="button" src="../../../../fluid-engage-core/components/codeEntry/images/5.png" alt="5"/>
+					<img class="flc-codeEntry-numButton fl-codeEntry-middleButton" role="button" src="../../../../fluid-engage-core/components/codeEntry/images/5.png" alt="5"/>
 					<img class="flc-codeEntry-numButton" role="button" src="../../../../fluid-engage-core/components/codeEntry/images/6.png" alt="6"/>
 				</div>
 				<div class="fl-table-row">
 					<img class="flc-codeEntry-numButton" role="button" src="../../../../fluid-engage-core/components/codeEntry/images/7.png" alt="7"/>
-					<img class="flc-codeEntry-numButton" role="button" src="../../../../fluid-engage-core/components/codeEntry/images/8.png" alt="8"/>
+					<img class="flc-codeEntry-numButton fl-codeEntry-middleButton" role="button" src="../../../../fluid-engage-core/components/codeEntry/images/8.png" alt="8"/>
 					<img class="flc-codeEntry-numButton" role="button" src="../../../../fluid-engage-core/components/codeEntry/images/9.png" alt="9"/>
 				</div>
 				<div class="fl-table-row">
-					<img src="../../../../fluid-engage-core/components/codeEntry/images/blank.png" alt=""/>
-					<img class="flc-codeEntry-numButton" role="button" src="../../../../fluid-engage-core/components/codeEntry/images/0.png" alt="0"/>
-					<img class="flc-codeEntry-delButton" role="button" src="../../../../fluid-engage-core/components/codeEntry/images/del.png" alt="Delete"/>
+					<img src="../../../../fluid-engage-core/components/codeEntry/images/backgroundlight.png" alt=""/>
+					<img class="flc-codeEntry-numButton fl-codeEntry-middleButton" role="button" src="../../../../fluid-engage-core/components/codeEntry/images/0.png" alt="0"/>
+					<img class="flc-codeEntry-delButton" role="button" src="../../../../fluid-engage-core/components/codeEntry/images/backgroundlight.png" alt="Delete"/>
+					<img class="flc-codeEntry-delImage fl-codeEntry-delImage" src="../../../../fluid-engage-core/components/codeEntry/images/del.png"/>
 				</div>
 			</div>
 		</div>
Index: components/codeEntry/css/codeEntry.css
===================================================================
--- components/codeEntry/css/codeEntry.css	(revision 9374)
+++ components/codeEntry/css/codeEntry.css	(working copy)
@@ -37,7 +37,24 @@
 }
 
 .fl-codeEntry-numpad img {
-    margin: -10px;
-    outline: none;
+	position: relative;
+    margin: 0px;
+    margin-bottom: 1px;
+    outline: 0 none;
     cursor: pointer;
+    border: 0px none;
+    padding: 0px;
+    float: left;
+}
+
+.fl-codeEntry-middleButton {
+    margin-left: 1px;
+    margin-right: 1px;
+}
+
+.fl-codeEntry-delImage {
+	position: absolute;
+	left: 236px;
+	top: -40px;
+	cursor: default;
 }
\ No newline at end of file
#P fluid-engage-kettle
Index: src/main/webapp/services/codeEntry/js/codeEntryService.js
===================================================================
--- src/main/webapp/services/codeEntry/js/codeEntryService.js	(revision 9374)
+++ src/main/webapp/services/codeEntry/js/codeEntryService.js	(working copy)
@@ -75,12 +75,7 @@
             var mappedArtifact =  fluid.engage.mapModel(artifact.rows[0],
                     params.db);
             
-            return {
-                artifactFound: true,
-                artifactLink: compileTargetUrl(mappedArtifact, params.db, params.lang)
-            };
-        } else {
-            return {artifactFound: false};
+            return compileTargetUrl(mappedArtifact, params.db, params.lang);
         }
     };
     
@@ -92,7 +87,12 @@
      */
     fluid.codeEntry.initCodeEntryDataFeed = function (config, app) {
         var dataHandler = function (env) {
-            return ["200", {"Content-Type": "text/plain"}, JSON.stringify(getArtifactLink(config, env.urlState.params))];
+            var artifactLink = getArtifactLink(config, env.urlState.params);
+            if (artifactLink) {
+                return ["200", {"Content-Type": "text/plain"}, artifactLink];
+            } else {
+                return ["404", {"Content-Type": "text/plain"}, "NOT FOUND"];
+            }
         };
         
         var acceptor = fluid.engage.makeAcceptorForResource("codeEntry", "json", dataHandler);
@@ -131,7 +131,10 @@
                     db: params.db,
                     lang: params.lang,
                     code: "%objectCode"
-                })
+                }),
+                deleteImage: params.lang === "en" ?
+                        "../../../../fluid-engage-core/components/codeEntry/images/del.png" :
+                        "../../../../fluid-engage-core/components/codeEntry/images/delinternational.png"
             };
             
             if (strings) {
