>From d1dfefe73d259b0f7e05538e05551d0ef3c14b29 Mon Sep 17 00:00:00 2001
From: Christina Fu <cfu@redhat.com>
Date: Wed, 22 Apr 2015 15:16:33 -0700
Subject: [PATCH] Parameterized TKS

---
 base/tks/shared/webapps/tks/404.html               | 38 +++++++++++++++-------
 base/tks/shared/webapps/tks/500.html               | 38 +++++++++++++++-------
 base/tks/shared/webapps/tks/agent/header.template  | 25 ++++++++++++--
 base/tks/shared/webapps/tks/agent/index.template   | 24 ++++++++++++--
 base/tks/shared/webapps/tks/agent/ports.template   |  2 +-
 dogtag/common-ui/shared/tks/500.properties         |  2 ++
 .../common-ui/shared/tks/agent/header.properties   |  2 ++
 dogtag/common-ui/shared/tks/agent/index.properties |  2 ++
 .../common-ui/shared/tks/agent/tks/top.properties  |  1 +
 9 files changed, 107 insertions(+), 27 deletions(-)
 create mode 100644 dogtag/common-ui/shared/tks/500.properties
 create mode 100644 dogtag/common-ui/shared/tks/agent/header.properties
 create mode 100644 dogtag/common-ui/shared/tks/agent/index.properties
 create mode 100644 dogtag/common-ui/shared/tks/agent/tks/top.properties

diff --git a/base/tks/shared/webapps/tks/404.html b/base/tks/shared/webapps/tks/404.html
index 5122cc2e207dae89c4fd101a0f0b5f27674fbc40..a9cdd41a469637c7f41af395830d905c16158e45 100755
--- a/base/tks/shared/webapps/tks/404.html
+++ b/base/tks/shared/webapps/tks/404.html
@@ -25,6 +25,27 @@ var port = location.port;
 </script>
 
 <head>
+<script type="text/javascript" language="JavaScript" src="/pki/js/jquery.js"></script>
+<script type="text/javascript" language="JavaScript" src="/pki/js/jquery.i18n.properties.js"></script>
+
+<script type="text/javascript" language="JavaScript">
+$(function() {
+    $.i18n.properties({
+        name: '404',
+        language: ' ', // suppress potential 404's due to .i18n.browserLang()
+        path: '/pki/tks/',
+        mode: 'map',
+        callback: function() {
+            var key;
+            for (key in $.i18n.map) {
+                var message = $.i18n.prop(key);
+                $('span.message[name='+key+']').html(message);
+            }
+        }
+    });
+});
+</script>
+
 <title>TKS 404 Error!</title>
 <!-- always expand ALL relative paths -->
 <script language=javascript>
@@ -50,18 +71,13 @@ document.write('<META http-equiv=Content-Type content="text/html; charset=UTF-8"
 <body bgcolor="#FFFFFF" link="#666699" vlink="#666699" alink="#333366">
 <div id="header">
 <!-- always expand ALL relative paths -->
-<script language=javascript>
-document.write('<a href="http://pki.fedoraproject.org/" title="Visit pki.fedoraproject.org for more information about Dogtag products and services"><img src="');
-document.write(protocol);
-document.write('//');
-document.write(hostname);
-document.write(':');
-document.write(port);
-document.write('/pki/images/logo_header.gif');
-document.write('" alt="Dogtag" id="myLogo" /></a>');
-</script>
+<span class="message" name="logo">
+<a href="http://pki.fedoraproject.org/" title="Visit pki.fedoraproject.org for more information about Certificate System products and services"><img src="/pki/images/logo_header.gif" alt="Certificate System" id="myLogo" /></a>
+</span>
     <div id="headertitle">
-    <a href="/" title="Dogtag Network homepage">Dogtag<sup><font size="-2">&reg;</font></sup> Certificate System</a>
+    <span class="message" name="title">
+    <a href="/" title=Certificate System">Certificate System</a>
+    </span>
     </div>
     <div id="account">
           <dl><dt><span></span></dt><dd></dd></dl>
diff --git a/base/tks/shared/webapps/tks/500.html b/base/tks/shared/webapps/tks/500.html
index 7547fa864b9ac9c652d3b460119c1b20b16563d6..cf5e6687629fe88a881d78ed3feb01aff7669886 100755
--- a/base/tks/shared/webapps/tks/500.html
+++ b/base/tks/shared/webapps/tks/500.html
@@ -25,6 +25,27 @@ var port = location.port;
 </script>
 
 <head>
++<script type="text/javascript" language="JavaScript" src="/pki/js/jquery.js"></script>
++<script type="text/javascript" language="JavaScript" src="/pki/js/jquery.i18n.properties.js"></script>
+
+<script type="text/javascript" language="JavaScript">
+$(function() {
+    $.i18n.properties({
+        name: '500',
+        language: ' ', // suppress potential 404's due to .i18n.browserLang()
+        path: '/pki/tks/',
+        mode: 'map',
+        callback: function() {
+            var key;
+            for (key in $.i18n.map) {
+                var message = $.i18n.prop(key);
+                $('span.message[name='+key+']').html(message);
+            }
+        }
+    });
+});
+</script>
+
 <title>TKS 500 Error!</title>
 <!-- always expand ALL relative paths -->
 <script language=javascript>
@@ -50,18 +71,13 @@ document.write('<META http-equiv=Content-Type content="text/html; charset=UTF-8"
 <body bgcolor="#FFFFFF" link="#666699" vlink="#666699" alink="#333366">
 <div id="header">
 <!-- always expand ALL relative paths -->
-<script language=javascript>
-document.write('<a href="http://pki.fedoraproject.org/" title="Visit pki.fedoraproject.org for more information about Dogtag products and services"><img src="');
-document.write(protocol);
-document.write('//');
-document.write(hostname);
-document.write(':');
-document.write(port);
-document.write('/pki/images/logo_header.gif');
-document.write('" alt="Dogtag" id="myLogo" /></a>');
-</script>
+<span class="message" name="logo">
+<a href="http://pki.fedoraproject.org/" title="Visit pki.fedoraproject.org for more information about Certificate System products and services"><img src="/pki/images/logo_header.gif" alt="Certificate System" id="myLogo" /></a>
+</span>
     <div id="headertitle">
-    <a href="/" title="Dogtag Network homepage">Dogtag<sup><font size="-2">&reg;</font></sup> Certificate System</a>
+    <span class="message" name="title">
+    <a href="/" title=Certificate System">Certificate System</a>
+    </span>
     </div>
     <div id="account">
           <dl><dt><span></span></dt><dd></dd></dl>
diff --git a/base/tks/shared/webapps/tks/agent/header.template b/base/tks/shared/webapps/tks/agent/header.template
index d1221b14ba59565c0bcdf59901e87d94fd325459..cecbcc2a0c292674c2fc765f72e965d58203b41e 100644
--- a/base/tks/shared/webapps/tks/agent/header.template
+++ b/base/tks/shared/webapps/tks/agent/header.template
@@ -18,6 +18,27 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <html>
 <head>
+<script type="text/javascript" language="JavaScript" src="/pki/js/jquery.js"></script>
+<script type="text/javascript" language="JavaScript" src="/pki/js/jquery.i18n.properties.js"></script>
+
+<script type="text/javascript" language="JavaScript">
+$(function() {
+    $.i18n.properties({
+        name: 'header',
+        language: ' ', // suppress potential 404's due to .i18n.browserLang()
+        path: '/pki/tks/agent/',
+        mode: 'map',
+        callback: function() {
+            var key;
+            for (key in $.i18n.map) {
+                var message = $.i18n.prop(key);
+                $('span.message[name='+key+']').html(message);
+            }
+        }
+    });
+});
+</script>
+
 <CMS_TEMPLATE>
 <title>Header</title>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
@@ -29,9 +50,9 @@
     <td> 
       <table border="0" cellspacing="12" cellpadding="0">
         <tr>
-          <td><img src="/pki/images/logo_header.gif"></td>
+          <td><span class="message" name="logo"><img src="/pki/images/logo_header.gif"></span></td>
           <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
-          <td><font size="+1" face="PrimaSans BT, Verdana, sans-serif" color="white"><b>Dogtag<sup><font color="#999999" size="-2">&reg;</font></sup> Agent Services</b></font></td>
+          <td><span class="message" name="title"><font size="+1" face="PrimaSans BT, Verdana, sans-serif" color="white">Agent Services</b></font></span></td>
         </tr>
       </table>
       <table border="0" cellspacing="0" cellpadding="0">
diff --git a/base/tks/shared/webapps/tks/agent/index.template b/base/tks/shared/webapps/tks/agent/index.template
index 534ad257b173225b8fddc432f9b5ab0fa0c240e7..09b601ce6ce6292c22a29422e2b14ca99b961e56 100644
--- a/base/tks/shared/webapps/tks/agent/index.template
+++ b/base/tks/shared/webapps/tks/agent/index.template
@@ -18,6 +18,26 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <html>
 <head>
+<script type="text/javascript" language="JavaScript" src="/pki/js/jquery.i18n.properties.js"></script>
+
+<script type="text/javascript" language="JavaScript">
+$(function() {
+    $.i18n.properties({
+        name: 'index',
+        language: ' ', // suppress potential 404's due to .i18n.browserLang()
+        path: '/pki/tks/agent/',
+        mode: 'map',
+        callback: function() {
+            var key;
+            for (key in $.i18n.map) {
+                var message = $.i18n.prop(key);
+                $('span.message[name='+key+']').html(message);
+            }
+        }
+    });
+});
+</script>
+
 <CMS_TEMPLATE>
 <title>TKS Agent</title>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
@@ -29,9 +49,9 @@
     <td> 
       <table border="0" cellspacing="12" cellpadding="0">
         <tr> 
-          <td><img src="/pki/images/logo_header.gif"></td>
+          <td><span class="message" name="logo"><img src="/pki/images/logo_header.gif"></span></td>
           <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
-          <td><font size="+1" face="PrimaSans BT, Verdana, sans-serif" color="white"><b>Dogtag<sup><font color="#999999" size="-2">&reg;</font></sup> Agent Services</b></font></td>
+          <td><span class="message" name="title"><font size="+1" face="PrimaSans BT, Verdana, sans-serif" color="white">Agent Services</b></font></span></td>
         </tr>
       </table>
     </td>
diff --git a/base/tks/shared/webapps/tks/agent/ports.template b/base/tks/shared/webapps/tks/agent/ports.template
index 4d33dd3f02180dcc91a8d40be78b0a5ffc69e40f..047be8a51d112c9f887b0185a4112640fcaa33e4 100644
--- a/base/tks/shared/webapps/tks/agent/ports.template
+++ b/base/tks/shared/webapps/tks/agent/ports.template
@@ -31,7 +31,7 @@
         <tr> 
           <td><img src="/pki/images/logo_header.gif"></td>
           <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
-          <td><font size="+1" face="PrimaSans BT, Verdana, sans-serif" color="white"><b>Dogtag<sup><font color="#999999" size="-2">&reg;</font></sup> Services Summary</b></font></td>
+          <td><span class="message" name="title"><font size="+1" face="PrimaSans BT, Verdana, sans-serif" color="white">Services Summary</b></font></span></td>
         </tr>
       </table>
     </td>
diff --git a/dogtag/common-ui/shared/tks/500.properties b/dogtag/common-ui/shared/tks/500.properties
new file mode 100644
index 0000000000000000000000000000000000000000..f42b22ac38b14b1141137543a4a6d59d31befef8
--- /dev/null
+++ b/dogtag/common-ui/shared/tks/500.properties
@@ -0,0 +1,2 @@
+logo = <a href="http://pki.fedoraproject.org/" title="Visit pki.fedoraproject.org for more information about Dogtag products and services"><img src="/pki/images/logo_header.gif" alt="Dogtag" id="myLogo" /></a>
++title = <a href="/" title="Dogtag Network homepage">Dogtag<sup><font size="-2">&reg;</font></sup> Certificate System</a>
diff --git a/dogtag/common-ui/shared/tks/agent/header.properties b/dogtag/common-ui/shared/tks/agent/header.properties
new file mode 100644
index 0000000000000000000000000000000000000000..17e5ce96bb29cb0126eff0d4bf80be3721a79798
--- /dev/null
+++ b/dogtag/common-ui/shared/tks/agent/header.properties
@@ -0,0 +1,2 @@
+logo = <img src="/pki/images/logo_header.gif">
+title = <font size="+1" face="PrimaSans BT, Verdana, sans-serif" color="white"><b>Dogtag<sup><font color="#999999" size="-2">&reg;</font></sup> Agent Services</b></font>
diff --git a/dogtag/common-ui/shared/tks/agent/index.properties b/dogtag/common-ui/shared/tks/agent/index.properties
new file mode 100644
index 0000000000000000000000000000000000000000..17e5ce96bb29cb0126eff0d4bf80be3721a79798
--- /dev/null
+++ b/dogtag/common-ui/shared/tks/agent/index.properties
@@ -0,0 +1,2 @@
+logo = <img src="/pki/images/logo_header.gif">
+title = <font size="+1" face="PrimaSans BT, Verdana, sans-serif" color="white"><b>Dogtag<sup><font color="#999999" size="-2">&reg;</font></sup> Agent Services</b></font>
diff --git a/dogtag/common-ui/shared/tks/agent/tks/top.properties b/dogtag/common-ui/shared/tks/agent/tks/top.properties
new file mode 100644
index 0000000000000000000000000000000000000000..5218d1aed7ae87d87061df1e33de0cda7a59a6c5
--- /dev/null
+++ b/dogtag/common-ui/shared/tks/agent/tks/top.properties
@@ -0,0 +1 @@
+title = <font size="+1" face="PrimaSans BT, Verdana, sans-serif" color="white"><b>Dogtag<sup><font color="#999999" size="-2">&reg;</font></sup> Certificate System</b></font>
-- 
1.8.4.2

