[vhffs-dev] [1507] Added changing URL to allow bookmarking

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1507
Author:   beuss
Date:     2009-08-03 23:29:57 +0200 (Mon, 03 Aug 2009)

Log Message:
-----------
Added changing URL to allow bookmarking

Modified Paths:
--------------
    trunk/vhffs-panel/js/dojo/back.js
    trunk/vhffs-panel/js/public.js
    trunk/vhffs-panel/js/vhffs/Common.js
    trunk/vhffs-public/templates/content/all-groups.tt


Modified: trunk/vhffs-panel/js/dojo/back.js
===================================================================
--- trunk/vhffs-panel/js/dojo/back.js	2009-08-03 00:14:30 UTC (rev 1506)
+++ trunk/vhffs-panel/js/dojo/back.js	2009-08-03 21:29:57 UTC (rev 1507)
@@ -158,7 +158,11 @@
 		}
 		//console.debug("done checking");
 	};
-	
+
+// 1.3 ugly backport
+	back.getHash = getHash;
+// -- 
+
 	back.init = function(){
 		//summary: Initializes the undo stack. This must be called from a <script> 
 		//         block that lives inside the <body> tag to prevent bugs on IE.

Modified: trunk/vhffs-panel/js/public.js
===================================================================
--- trunk/vhffs-panel/js/public.js	2009-08-03 00:14:30 UTC (rev 1506)
+++ trunk/vhffs-panel/js/public.js	2009-08-03 21:29:57 UTC (rev 1507)
@@ -38,6 +38,7 @@
 dojo.require('vhffs.Common');
 
 dojo.addOnLoad(function() {
+	vhffs.Common.handleHash();
 	new vhffs.Menu(dojo.byId('left-menu'));
 	vhffs.Common.ajaxizeLinks(dojo.byId('public-content'));
 });

Modified: trunk/vhffs-panel/js/vhffs/Common.js
===================================================================
--- trunk/vhffs-panel/js/vhffs/Common.js	2009-08-03 00:14:30 UTC (rev 1506)
+++ trunk/vhffs-panel/js/vhffs/Common.js	2009-08-03 21:29:57 UTC (rev 1507)
@@ -37,6 +37,13 @@
 dojo.declare('vhffs.Common', null, {});
 
 dojo.mixin(vhffs.Common, {
+	handleHash: function() {
+		var hash = dojo.back.getHash();
+		if(hash.length) {
+			document.location.href = hash;
+		}
+	},
+
 	ajaxizeLinks: function(contentTarget, rootNode) {
 		dojo.forEach(dojo.query('a.ajax', rootNode), function(link) {
 			dojo.connect(link, 'onclick', function(e) {
@@ -127,6 +134,7 @@
 // Back and forward handling with Ajax
 
 dojo.declare('vhffs.Common.pageState', null, {
+	changeUrl: true, 
 	/**
 	 * Creates a new pageState.
 	 * url is the URL to load when this page is to
@@ -136,9 +144,12 @@
 	 * it evaluates to false).
 	 */
 	constructor: function(url, target, postObject) {
+		var prefix = new RegExp('^' + window.location.protocol + '//' + window.location.host);
+		url = url.replace(prefix, '');
 		this.url = url;
 		this.target = target;
 		this.postObject = postObject;
+		this.changeUrl = url;
 	},
 
 	back: function() {

Modified: trunk/vhffs-public/templates/content/all-groups.tt
===================================================================
--- trunk/vhffs-public/templates/content/all-groups.tt	2009-08-03 00:14:30 UTC (rev 1506)
+++ trunk/vhffs-public/templates/content/all-groups.tt	2009-08-03 21:29:57 UTC (rev 1507)
@@ -6,7 +6,7 @@
 [<a href="/allgroups.pl?letter=all">[% 'All' | i18n%]</a>]
 [% title_str = '%s (%d groups)' | i18n %]
 [% FOREACH l = letters %]
-[<a href="/allgroups.pl?letter=[% l.letter %]" title="[% title_str | pretty_print(l.letter, l.count) %]">[% l.letter %]</a>]&nbsp;
+[<a class="ajax" href="/allgroups.pl?letter=[% l.letter %]" title="[% title_str | pretty_print(l.letter, l.count) %]">[% l.letter %]</a>]&nbsp;
 [% END %]
 </div>
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/