Author: marcus
Date: Sat Jan 10 15:21:18 2015
New Revision: 1650751

URL: http://svn.apache.org/r1650751
Log:
Added function to check the document referrer and maybe do a website redirect

Modified:
    openoffice/ooo-site/trunk/content/scripts/ooo.js

Modified: openoffice/ooo-site/trunk/content/scripts/ooo.js
URL: 
http://svn.apache.org/viewvc/openoffice/ooo-site/trunk/content/scripts/ooo.js?rev=1650751&r1=1650750&r2=1650751&view=diff
==============================================================================
--- openoffice/ooo-site/trunk/content/scripts/ooo.js (original)
+++ openoffice/ooo-site/trunk/content/scripts/ooo.js Sat Jan 10 15:21:18 2015
@@ -1,6 +1,7 @@
 /*
  * Overview of all methods (functions) of the global object "INDEX"
  * ----------------------------------------------------------------
+ * function INDEX.checkReferrer ()
  * function INDEX.createIndexOf        ()
  * function INDEX.getURLQuery  ()
  * function INDEX.follow       ( platform )
@@ -111,6 +112,42 @@ INDEX.follow = function( platform ) {
        }
 
        return;
+}
+
+/*
+ * Show a dialog box helping text and set the document referrer to another 
webpage to do a redirect.
+ * @param:  None
+ * @return: None
+ */
+INDEX.checkReferrer = function() {
+       // Check the origin of the website visit (document referrer) and decide 
if there is a need to notify the user and
+       // do a website redirect.
+
+       // Example from 2014-12-03:
+       // Send the support link of the "Quickoffice - Pro" app to a special 
webpage with explaination.
+       // 
http://mail-archives.apache.org/mod_mbox/openoffice-dev/201412.mbox/%3C547E3D52.5070309%40apache.org%3E
+
+       // TODO: Finished the work and test if it is working.
+       
+       // Backup the original document referrer.
+       var ref_backup = document.referrer;
+
+       // Check if the user comes from a problematic webpage (document 
referrer).
+       if ( document.referrer.indexOf( 
"itunes.apple.com/gb/app/quickoffice-pro/id889011512" ) != -1 ) {
+               // Set a new website to do the redirect.
+//             location.href = 
"http://www.openoffice.org/new-special-page.html";;
+
+               // Notify the user about the reason for the redirect.
+               alert( ""
+                       + "Dear Quickoffice - Pro user"
+                       + "\n\n That app claims to come from Apache OpenOffice, 
but this is not true. "
+                       + "It is totally unrelated to the Apache OpenOffice 
project \"http://www.openoffice.org\"; and "
+                       + "therefore we cannot help you in any way. Please 
report the app back to the App Store. "
+                       + "\n\n Thank you very much for your understanding."
+               + "");
+       }
+
+       return;
 }
 
 /*


Reply via email to