Re: [Radiant] Alias Page Extension

2007-03-13 Thread Brian Gernhardt

On Mar 12, 2007, at 7:26 PM, Daniel Sheppard wrote:

 I've taken the approach of having a separate table mapping urls to  
 page numbers and a file not found behaviour that performs
 redirects for old mappings (I also trawl through my server logs for  
 404s and correct any repeated spelling mistakes / truncations) -
 I've left it as a separate table that I maintain by hand so as not  
 to confuse the page tree.

 http://soxbox.no-ip.org/radiant/svn/extensions/x_groggy/app/models/ 
 groggy_file_not_found_page.rb

That rocks.  It would be great if you could make that a separate  
extension with an interface to manage the redirect table.  (Hint,  
hint. ~_^)


 (Note that I also had to have a custom index page so that it could  
 look at my custom file not found type).

Wouldn't something like this in core be better? (COMPLETELY UNTESTED)

- 8 -
Index: page.rb
===
--- page.rb (revision 352)
+++ page.rb (working copy)
@@ -135,7 +135,8 @@
return found if found
  end
end
-  children.find(:first, :conditions = class_name =  
'FileNotFoundPage')
+  not_found = Object.subclasses_of( FileNotFoundPage ) +  
['FileNotFoundPage']
+  children.find(:first, :conditions = [class_name IN (?),  
not_found])
  end
end

@@ -251,4 +252,4 @@

end
- 8 -

~~ Brian
___
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


Re: [Radiant] Alias Page Extension

2007-03-13 Thread Daniel Sheppard
  (Note that I also had to have a custom index page so that it could  
  look at my custom file not found type).
 
 Wouldn't something like this in core be better? (COMPLETELY UNTESTED)
 
 - 8 -
 Index: page.rb
 ===
 --- page.rb (revision 352)
 +++ page.rb (working copy)

Yeah, I was thinking of putting pretty much that into the core, but was going 
to mull over it for a week to see if I could think of
something better. Something about using IN bothers me a little, but I don't 
think that feeling is justified (just a voice in the
back of my mind saying OMG!! what if you have like a bajillion different not 
found page types? That would suck - I try not to
listen to that voice though, he's a bit of a doofus).

Dan.
___
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


Re: [Radiant] Alias Page Extension

2007-03-13 Thread Daniel Sheppard
 
  I've taken the approach of having a separate table mapping urls to  
  page numbers and a file not found behaviour that performs
  redirects for old mappings (I also trawl through my server 
 logs for  
  404s and correct any repeated spelling mistakes / truncations) -
  I've left it as a separate table that I maintain by hand so as not  
  to confuse the page tree.
 
  http://soxbox.no-ip.org/radiant/svn/extensions/x_groggy/app/models/ 
  groggy_file_not_found_page.rb
 
 That rocks.  It would be great if you could make that a separate  
 extension with an interface to manage the redirect table.  (Hint,  
 hint. ~_^)

Well, you're free to take my code and clean it up (Hint, hint). 

The extension works great for regular pages but not so well for pages that can 
be referenced by multiple urls - ie, my gigs page is
a single page that filters gigs based on the last part of the url - since my 
mapping is from url to page id and not url to url, that
means I can't redirect to those individual state filters. My comics page 
(AlphabetPage) is a similar beast.

The reasoning behind this is that these old urls are likely to be referenced 
well into the future and I wanted it to be robust in
the face of reparenting.

I had a brief discussion a week or two ago about having a page url table that 
would map urls to pages for fast lookup and would also
remain persistant so that if a page moves, there would still be a reference in 
the lookup table for that page so that it's old url
would also work. There's a few problems with that approach, but it's something 
that I'd like to try fleshing out to see if those
problems are surmountable - I think that might be the way to go for providing 
page aliases.

Dan.
___
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


Re: [Radiant] Alias Page Extension

2007-03-13 Thread Daniel Sheppard
 
  Are you sure that's what subclasses_of does? I know that 
  there's definitely a method on ActiveRecord::Base that 
 keeps track of
  subclasses as their created - maybe it's called something 
  else - descendants maybe? - I can't remember, but I'm pretty sure it
  exists.
 
 lounge groggy # ruby script/console
 Loading development environment.
  Page.descendants

Well, that's just an alias for subclasses_of. I found the code that I 
remembered seeing - it was for tracking of subclasses by
observers - where for some reason the list of subclasses is stored by each 
observer rather than by the observee. 

Dan.
___
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


Re: [Radiant] Alias Page Extension

2007-03-12 Thread Erik van Oosten
Thanks Brian,

That is unfortunate for me, I was looking for the reverse :(

I hoped to find an extension that would re-direct to another page so I can
maintain some URLs when I migrate to Radiant.

Regards,
Erik.


 On Mar 11, 2007, at 3:41 PM, Erik van Oosten wrote:

 What does the extension do exactly?
 Is there a bit of documentation?

 Sorry about the terseness.

 Mark a page as an Alias Page, and add a source part.  The source part
 is a path (not a URL) to another page in the system.  Whenever the
 system asks for that page, it will return the source page.  It will,
 however, search for it's
 own children before the source's.

 I plan to use this in conjunction with the virtual domain extension
 to have the same page under multiple domains.

 There is something resembling documentation in the code.

 ~~ Brian



___
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


Re: [Radiant] Alias Page Extension

2007-03-11 Thread Brian Gernhardt

On Mar 11, 2007, at 3:41 PM, Erik van Oosten wrote:

 What does the extension do exactly?
 Is there a bit of documentation?

Sorry about the terseness.

Mark a page as an Alias Page, and add a source part.  The source part  
is a path (not a URL) to another page in the system.  Whenever the  
system asks for that page, it will return the source page.  It will,  
however, search for it's
own children before the source's.

I plan to use this in conjunction with the virtual domain extension  
to have the same page under multiple domains.

There is something resembling documentation in the code.

~~ Brian


___
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant