>From db53f256bbf467c3383879b5c0d300cd29d982fe Mon Sep 17 00:00:00 2001
From: Matthew Harmsen <mharmsen@pki.usersys.redhat.com>
Date: Wed, 22 Apr 2015 15:45:05 -0600
Subject: [PATCH] Parameterized KRA

- PKI TRAC Ticket #1296 - RHCS 9.0 theme
---
 base/kra/shared/webapps/kra/404.html               | 38 +++++++++++++++-------
 base/kra/shared/webapps/kra/500.html               | 38 +++++++++++++++-------
 base/kra/shared/webapps/kra/agent/header.template  | 25 ++++++++++++--
 base/kra/shared/webapps/kra/agent/index.template   | 25 ++++++++++++--
 base/kra/shared/webapps/kra/agent/kra/top.html     | 24 ++++++++++++--
 dogtag/common-ui/shared/kra/404.properties         |  2 ++
 dogtag/common-ui/shared/kra/500.properties         |  2 ++
 .../common-ui/shared/kra/agent/header.properties   |  2 ++
 dogtag/common-ui/shared/kra/agent/index.properties |  2 ++
 .../common-ui/shared/kra/agent/kra/top.properties  |  1 +
 10 files changed, 131 insertions(+), 28 deletions(-)
 create mode 100644 dogtag/common-ui/shared/kra/404.properties
 create mode 100644 dogtag/common-ui/shared/kra/500.properties
 create mode 100644 dogtag/common-ui/shared/kra/agent/header.properties
 create mode 100644 dogtag/common-ui/shared/kra/agent/index.properties
 create mode 100644 dogtag/common-ui/shared/kra/agent/kra/top.properties

diff --git a/base/kra/shared/webapps/kra/404.html b/base/kra/shared/webapps/kra/404.html
index 8ccd406..0f54294 100755
--- a/base/kra/shared/webapps/kra/404.html
+++ b/base/kra/shared/webapps/kra/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/kra/',
+        mode: 'map',
+        callback: function() {
+            var key;
+            for (key in $.i18n.map) {
+                var message = $.i18n.prop(key);
+                $('span.message[name='+key+']').html(message);
+            }
+        }
+    });
+});
+</script>
+
 <title>DRM 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/kra/shared/webapps/kra/500.html b/base/kra/shared/webapps/kra/500.html
index 1dc79ac..2044a38 100755
--- a/base/kra/shared/webapps/kra/500.html
+++ b/base/kra/shared/webapps/kra/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/kra/',
+        mode: 'map',
+        callback: function() {
+            var key;
+            for (key in $.i18n.map) {
+                var message = $.i18n.prop(key);
+                $('span.message[name='+key+']').html(message);
+            }
+        }
+    });
+});
+</script>
+
 <title>DRM 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/kra/shared/webapps/kra/agent/header.template b/base/kra/shared/webapps/kra/agent/header.template
index d1221b1..61eaa3c 100644
--- a/base/kra/shared/webapps/kra/agent/header.template
+++ b/base/kra/shared/webapps/kra/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/kra/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"><b>Agent Services</b></font></span></td>
         </tr>
       </table>
       <table border="0" cellspacing="0" cellpadding="0">
diff --git a/base/kra/shared/webapps/kra/agent/index.template b/base/kra/shared/webapps/kra/agent/index.template
index c3200bb..1ac5f52 100644
--- a/base/kra/shared/webapps/kra/agent/index.template
+++ b/base/kra/shared/webapps/kra/agent/index.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: 'index',
+        language: ' ', // suppress potential 404's due to .i18n.browserLang()
+        path: '/pki/kra/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>DRM Agent</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"><b>Agent Services</b></font></span></td>
         </tr>
       </table>
     </td>
diff --git a/base/kra/shared/webapps/kra/agent/kra/top.html b/base/kra/shared/webapps/kra/agent/kra/top.html
index f90ad1a..3018e99 100644
--- a/base/kra/shared/webapps/kra/agent/kra/top.html
+++ b/base/kra/shared/webapps/kra/agent/kra/top.html
@@ -1,6 +1,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: 'top',
+        language: ' ', // suppress potential 404's due to .i18n.browserLang()
+        path: '/pki/kra/agent/kra/',
+        mode: 'map',
+        callback: function() {
+            var key;
+            for (key in $.i18n.map) {
+                var message = $.i18n.prop(key);
+                $('span.message[name='+key+']').html(message);
+            }
+        }
+    });
+});
+</script>
+
 <title>Untitled Document</title>
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 </head>
@@ -14,8 +35,7 @@
           <td>
             <table border="0" cellspacing="12" cellpadding="0" width="100%">
               <tr> 
-                <td><font size="-1" face="PrimaSans BT, Verdana, sans-serif" color="white">Dogtag<font color="#999999" size="-2">&reg;</font><b><br>
-                  Certificate System</b></font><font size="+1" face="PrimaSans BT, Verdana, sans-serif" color="white"><b></b></font></td>
+                <td><span class="message" name="title"><font size="+1" face="PrimaSans BT, Verdana, sans-serif" color="white"><b>Certificate System</b></font></span></td>
                 <td></td>
                 <td><font size="+1" face="PrimaSans BT, Verdana, sans-serif" color="white">Privileged User Services</font> </td>
               </tr>
diff --git a/dogtag/common-ui/shared/kra/404.properties b/dogtag/common-ui/shared/kra/404.properties
new file mode 100644
index 0000000..e9a1b34
--- /dev/null
+++ b/dogtag/common-ui/shared/kra/404.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/kra/500.properties b/dogtag/common-ui/shared/kra/500.properties
new file mode 100644
index 0000000..e9a1b34
--- /dev/null
+++ b/dogtag/common-ui/shared/kra/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/kra/agent/header.properties b/dogtag/common-ui/shared/kra/agent/header.properties
new file mode 100644
index 0000000..17e5ce9
--- /dev/null
+++ b/dogtag/common-ui/shared/kra/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/kra/agent/index.properties b/dogtag/common-ui/shared/kra/agent/index.properties
new file mode 100644
index 0000000..17e5ce9
--- /dev/null
+++ b/dogtag/common-ui/shared/kra/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/kra/agent/kra/top.properties b/dogtag/common-ui/shared/kra/agent/kra/top.properties
new file mode 100644
index 0000000..5218d1a
--- /dev/null
+++ b/dogtag/common-ui/shared/kra/agent/kra/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>
-- 
2.1.0

