THis patch usese the protocol part of the URL to decide whether or not to use sample data. Thus,

file:  -> use sample data

http:, https: -> Don't.

This will prevent the use of sample data in the lite-server.
It also reduces by one the number of page requests back to the server upon page load.
>From 15369fd838696d5b71f9bed50895c5588eb254ec Mon Sep 17 00:00:00 2001
From: Adam Young <ayo...@redhat.com>
Date: Sun, 29 Aug 2010 20:17:06 -0400
Subject: [PATCH] calculate useSampledata by protocol.

---
 install/static/index.xhtml           |    9 ---------
 install/static/ipa.js                |    2 ++
 install/static/sampledata/develop.js |    3 ---
 3 files changed, 2 insertions(+), 12 deletions(-)
 delete mode 100644 install/static/sampledata/develop.js

diff --git a/install/static/index.xhtml b/install/static/index.xhtml
index 489f192..8e231f4 100644
--- a/install/static/index.xhtml
+++ b/install/static/index.xhtml
@@ -7,17 +7,8 @@
 
     <script type="text/javascript" src="jquery.js"></script>
     <script type="text/javascript" src="jquery.cookie.js"></script>
-
-    <script type="text/javascript">
-        /* the develop.js file that follows will set this to true.
-           that file should only exist in the source file system
-           and should not get deployed to the web server */
-        var useSampleData = false;
-    </script>
-
     <script type="text/javascript" src="ipa.js"></script>
     <script type="text/javascript" src="navigation.js"></script>
-    <script type="text/javascript" src="sampledata/develop.js"></script>
     <script type="text/javascript" src="search.js"></script>
     <script type="text/javascript" src="details.js"></script>
     <script type="text/javascript" src="add.js"></script>
diff --git a/install/static/ipa.js b/install/static/ipa.js
index fd93c1a..63101a7 100644
--- a/install/static/ipa.js
+++ b/install/static/ipa.js
@@ -35,6 +35,8 @@ var _ipa_init_on_win_callback = null;
 var qs;
 
 
+var useSampleData = (window.location.protocol == "file:");
+
 
 function ipa_init(url, on_win)
 {
diff --git a/install/static/sampledata/develop.js b/install/static/sampledata/develop.js
deleted file mode 100644
index 5c5275b..0000000
--- a/install/static/sampledata/develop.js
+++ /dev/null
@@ -1,3 +0,0 @@
-//This should not be packaged up, and so we should only get a true value when working inside the file system
-useSampleData = true;
-
-- 
1.7.1

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to