Problem with anchors (Canvas API) generating bad links

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with anchors (Canvas API) generating bad links

Rick Flower
Hi all.. Every time I think I'm taking one step forward, I get stuck.
The other day I found that my web links
are no longer working for some reason after I had to regenerate my
image.. For some reason, when the
HTML is generated, they refer to links such as
"http://localhost:8008/seaside/go/nil" which cause browser
not found errors such as "Error: "/seaside/go/nil" not found...
Unfortunately, when they were working, I
didn't bother paying any attention to what they did point to -- I'm
assuming some sort of internal link that
Seaside generated.. For these links, they don't really need to point to
any pages per-se, but are only used
for their callbacks mechanism.

Below is my current code -- keep in mind that my "self parent home" is a
place holder until I plug in the functionality
I want to those items.  I suspect I'm doing something wrong and perhaps
another set of eyes can show me what
goof up I did this time..   Many thanks in advance as usual!

MSMenuArea>>renderContentOn: html
        html unorderedList with: [
            html listItem with: [ html anchor text: 'Home';            
        callback: [ self parent home ] ].
            self session loggedIn ifFalse: [
                html listItem with: [ html anchor text: 'About';        
callback: [ self parent home ] ].
                html listItem with: [ html anchor text: 'Enroll';    
            callback: [ self parent home ] ].
                html listItem with: [ html anchor text: 'Contact Us';
            callback: [ self parent home ] ].
            ]
            ifTrue: [
                html listItem with: [ html anchor text: 'Update Contact
Info';     callback: [ self parent home ] ].
                html listItem with: [ html anchor text: 'My Orders';    
        callback: [ self parent home ] ].
                html listItem with: [ html anchor text: 'My Reports';
            callback: [ self parent home ] ].
                html listItem with: [ html anchor text: 'Logout';    
            callback: [ self parent home ] ].
            ]
        ].

The above code is called in turn by the first line in the "ifFalse"
block where "menuArea" is rendered :

MyWebApp>>renderContentOn: html
   html div id: 'container'; with: [
      html div id: 'header'.
        self session loggedIn
                ifFalse: [
                        html div id:'mainnav'; with: [html render:
menuArea].
                        html div style: 'height: 300px'; with: [
                            html div id: 'loginLeftBox'; with: [html
render: loginArea].
                            html div id: 'loginRightBox';  with: [html
render: MOTDarea].
                       ]
                ]
                ifTrue: [
                        html div id: 'mainnav'; with: [html render:
menuArea].
                        html div style: 'margin-bottom: 10px;
background-color: #eee'; id: 'contents'; with: [html render: mainPage].
                ].
        ].
.
.
.


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: Problem with anchors (Canvas API) generating bad links

Ramon Leon
with: and text: need to always be the last tags, they cause rendering,
so all your anchors are ignoring their callbacks, set the callback:
before the text.

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf
> Of Rick Flower
> Sent: Monday, March 13, 2006 1:43 PM
> To: The Squeak Enterprise Aubergines Server - general discussion.
> Subject: [Seaside] Problem with anchors (Canvas API)
> generating bad links
>
> Hi all.. Every time I think I'm taking one step forward, I get stuck.
> The other day I found that my web links
> are no longer working for some reason after I had to
> regenerate my image.. For some reason, when the HTML is
> generated, they refer to links such as
> "http://localhost:8008/seaside/go/nil" which cause browser
> not found errors such as "Error: "/seaside/go/nil" not found...
> Unfortunately, when they were working, I didn't bother paying
> any attention to what they did point to -- I'm assuming some
> sort of internal link that Seaside generated.. For these
> links, they don't really need to point to any pages per-se,
> but are only used for their callbacks mechanism.
>
> Below is my current code -- keep in mind that my "self parent
> home" is a place holder until I plug in the functionality I
> want to those items.  I suspect I'm doing something wrong and
> perhaps another set of eyes can show me what
> goof up I did this time..   Many thanks in advance as usual!
>
> MSMenuArea>>renderContentOn: html
>         html unorderedList with: [
>             html listItem with: [ html anchor text: 'Home';  
>          
>         callback: [ self parent home ] ].
>             self session loggedIn ifFalse: [
>                 html listItem with: [ html anchor text:
> 'About';        
> callback: [ self parent home ] ].
>                 html listItem with: [ html anchor text: 'Enroll';    
>             callback: [ self parent home ] ].
>                 html listItem with: [ html anchor text: 'Contact Us';
>             callback: [ self parent home ] ].
>             ]
>             ifTrue: [
>                 html listItem with: [ html anchor text:
> 'Update Contact
> Info';     callback: [ self parent home ] ].
>                 html listItem with: [ html anchor text: 'My
> Orders';    
>         callback: [ self parent home ] ].
>                 html listItem with: [ html anchor text: 'My Reports';
>             callback: [ self parent home ] ].
>                 html listItem with: [ html anchor text: 'Logout';    
>             callback: [ self parent home ] ].
>             ]
>         ].
>
> The above code is called in turn by the first line in the "ifFalse"
> block where "menuArea" is rendered :
>
> MyWebApp>>renderContentOn: html
>    html div id: 'container'; with: [
>       html div id: 'header'.
>         self session loggedIn
>                 ifFalse: [
>                         html div id:'mainnav'; with: [html render:
> menuArea].
>                         html div style: 'height: 300px'; with: [
>                             html div id: 'loginLeftBox'; with: [html
> render: loginArea].
>                             html div id: 'loginRightBox';  with: [html
> render: MOTDarea].
>                        ]
>                 ]
>                 ifTrue: [
>                         html div id: 'mainnav'; with: [html render:
> menuArea].
>                         html div style: 'margin-bottom: 10px;
> background-color: #eee'; id: 'contents'; with: [html render:
> mainPage].
>                 ].
>         ].
> .
> .
> .
>
>
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Problem with anchors (Canvas API) generating bad links

wilkesj
In reply to this post by Rick Flower
You just need to reverse sending callback: and text:.  Using the
Canvas API, text: and with: need to come last.  There was a post
earlier today the same sort of thing.

Change:
html anchor text: 'About'; callback: [ self parent home ]

To:
html anchor callback: [ self parent home ]; text: 'About'

- Wilkes

On 3/13/06, Rick Flower <[hidden email]> wrote:

> Hi all.. Every time I think I'm taking one step forward, I get stuck.
> The other day I found that my web links
> are no longer working for some reason after I had to regenerate my
> image.. For some reason, when the
> HTML is generated, they refer to links such as
> "http://localhost:8008/seaside/go/nil" which cause browser
> not found errors such as "Error: "/seaside/go/nil" not found...
> Unfortunately, when they were working, I
> didn't bother paying any attention to what they did point to -- I'm
> assuming some sort of internal link that
> Seaside generated.. For these links, they don't really need to point to
> any pages per-se, but are only used
> for their callbacks mechanism.
>
> Below is my current code -- keep in mind that my "self parent home" is a
> place holder until I plug in the functionality
> I want to those items.  I suspect I'm doing something wrong and perhaps
> another set of eyes can show me what
> goof up I did this time..   Many thanks in advance as usual!
>
> MSMenuArea>>renderContentOn: html
>         html unorderedList with: [
>             html listItem with: [ html anchor text: 'Home';
>         callback: [ self parent home ] ].
>             self session loggedIn ifFalse: [
>                 html listItem with: [ html anchor text: 'About';
> callback: [ self parent home ] ].
>                 html listItem with: [ html anchor text: 'Enroll';
>             callback: [ self parent home ] ].
>                 html listItem with: [ html anchor text: 'Contact Us';
>             callback: [ self parent home ] ].
>             ]
>             ifTrue: [
>                 html listItem with: [ html anchor text: 'Update Contact
> Info';     callback: [ self parent home ] ].
>                 html listItem with: [ html anchor text: 'My Orders';
>         callback: [ self parent home ] ].
>                 html listItem with: [ html anchor text: 'My Reports';
>             callback: [ self parent home ] ].
>                 html listItem with: [ html anchor text: 'Logout';
>             callback: [ self parent home ] ].
>             ]
>         ].
>
> The above code is called in turn by the first line in the "ifFalse"
> block where "menuArea" is rendered :
>
> MyWebApp>>renderContentOn: html
>    html div id: 'container'; with: [
>       html div id: 'header'.
>         self session loggedIn
>                 ifFalse: [
>                         html div id:'mainnav'; with: [html render:
> menuArea].
>                         html div style: 'height: 300px'; with: [
>                             html div id: 'loginLeftBox'; with: [html
> render: loginArea].
>                             html div id: 'loginRightBox';  with: [html
> render: MOTDarea].
>                        ]
>                 ]
>                 ifTrue: [
>                         html div id: 'mainnav'; with: [html render:
> menuArea].
>                         html div style: 'margin-bottom: 10px;
> background-color: #eee'; id: 'contents'; with: [html render: mainPage].
>                 ].
>         ].
> .
> .
> .
>
>
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Problem with anchors (Canvas API) generating bad links

Rick Flower
Wilkes Joiner wrote:

> You just need to reverse sending callback: and text:.  Using the
> Canvas API, text: and with: need to come last.  There was a post
> earlier today the same sort of thing.
>
> Change:
> html anchor text: 'About'; callback: [ self parent home ]
>
> To:
> html anchor callback: [ self parent home ]; text: 'About'
>  
Thanks Ramon & Wilkes.. Problem solved!  I did see a comment the other
day about
the ordering if with: with respect to callbacks but didn't bother trying
to see if that was also
an issue with text:

Thanks again!


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Problem with anchors (Canvas API) generating bad links

Richard Huxton
Rick Flower wrote:
> Wilkes Joiner wrote:
>> You just need to reverse sending callback: and text:.  Using the
>> Canvas API, text: and with: need to come last.  There was a post
>> earlier today the same sort of thing.
[snip]
> Thanks Ramon & Wilkes.. Problem solved!  I did see a comment the other
> day about
> the ordering if with: with respect to callbacks but didn't bother trying
> to see if that was also
> an issue with text:

Might there be some way to raise a suitable error if someone does this?
It sounds like the sort of thing that'll catch everyone out at least once.

--
   Richard Huxton
   Archonet Ltd
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside