The code is pretty extense, but I think that there is no need to set
conditional css and script tags. I'd put template syntax sentences in
views for alternating A with P tags (or wathever tag suits the style
needs for the site) and changing the class attribute for each page
item. That grants you that the user will never have the oportunity to
fire an http request with a link (unless you bind javascript code to
the tag click of course) if he isn't able to do so.

In code, this is what i mean:

some view:
<script ... >
// here all the javascript
</script>

<css>
/* wathever you want the page to look like */
a {
/* for links */
}
p {
/* for no links */
}
</css>

{{ for item in mypage: }}
  {{ if thismustbealink: }}
    {{ =A("Aye, ye can click o' this", _class="clickable",
_href=URL(...)) }}
  {{ elif thismusntbealink: }}
    {{ =P("Avast!, thy cannot clickest this paragraph",
_class="unclickable") }}
  {{ pass }}
{{ pass }}

On 20 feb, 02:24, Annet <[email protected]> wrote:
> Hi Alan,
>
> I am still struggling getting your solution mapped to my problem, I'll
> post the entire view, hoping you will provide me with some more clues
> to help me get this to work.
>
> {{extend 'initLayout.html'}}
>
> <style type="text/css">
>   .content {margin: 24px auto 24px; width: 600px;}
>   .admin a, .admin a:visited {color: #424242;}
>   .admin a:hover {text-decoration: none;}
>   .fs12 {font-size: 12px; padding: 6px 12px 6px 12px;}
> </style>
>
> {{if not auth.is_logged_in():}}
>   <script type="text/javascript">
>     $(document).ready(function(){
>       $('#root a').click(function(e) {e.preventDefault();});
>       $('#hub a').click(function(e) {e.preventDefault();});
>       $('#vcardsite a').click(function(e) {e.preventDefault();});
>       $('#calendar a').click(function(e) {e.preventDefault();});
>     });
>   </script>
>
>   <style type="text/css">
>     #root, #hub, #vcardsite, #calendar {opacity: 0.5;
> filter:Alpha(opacity=50);}
>   </style>
>
> {{else:}}
>   <script type="text/javascript">
>     $(document).ready(function(){
>       $('#root a').click(function(e) {e.preventDefault();});
>       $('#hub a').click(function(e) {e.preventDefault();});
>       $('#vcardsite a').click(function(e) {e.preventDefault();});
>       $('#calendar a').click(function(e) {e.preventDefault();});
>     });
>     {{if rows:}}
>       {{for row in rows:}}
>         {{i=row.accountID}}
>         {{if i==1:}}
>           $('#root a').unbind('click',function(e));
>         {{elif i==2:}}
>           $('#hub a').unbind('click',function(e));
>         {{elif i==3:}}
>           $('#vcardsite a').unbind('click',function(e));
>         {{elif i==4:}}
>           $('#calendar a').unbind('click',function(e));
>         {{pass}}
>       {{pass}}
>     {{pass}}
>   </script>
>
>   <style type="text/css">
>     #root, #hub, #vcardsite, #calendar {opacity: 0.5;
> filter:Alpha(opacity=50);}
>     {{if rows:}}
>       {{for row in rows:}}
>         {{i=row.accountID}}
>         {{if i==1:}}
>           #root {opacity: 1.0; filter:Alpha(opacity=100);}
>         {{elif i==2:}}
>           #hub {opacity: 1.0; filter:Alpha(opacity=100);}
>         {{elif i==3:}}
>           #vcardsite {opacity: 1.0; filter:Alpha(opacity=100);}
>         {{elif i==4:}}
>           #calendar {opacity: 1.0; filter:Alpha(opacity=100);}
>         {{pass}}
>       {{pass}}
>     {{pass}}
>   </style>
>
> {{pass}}
>
> <!-- Module 1A -->
> <div class="ez-wr content" style="text-align: right; margin-bottom:
> 6px; padding: 0px">
>   <div class="ez-box">
>     {{if auth.is_logged_in():}}
>       <h5>Ingelogd als {{=auth.user.first_name}}
> {{=auth.user.last_name}} |
>       <a href="{{=URL('default','user',args='logout')}}">Logout</a></
> h5>
>     {{else:}}
>       <h5>U bent niet ingelogd |
>       <a href="{{=URL('default','user',args='login')}}">Login</a></h5>
>     {{pass}}
>   </div> <!-- ez-box -->
> </div> <!-- ez-wr -->
>
> <!-- Layout 1 -->
> <div class="ez-wr wr content border radius" style="margin-top: 6px;
> padding-bottom: 6px;">
>
>   <div class="ez-box">
>     <h2 style="padding-top: 9px;">Welkom bij Leonexus admin</h2>
>     <p></p>
>   </div> <!-- ez-box -->
>
>   <div class="ez-wr">
>
>     <div class="ez-wr" style="margin: 12px auto 12px; width: 552px">
>       <div class="ez-fl  ez-negmx ez-33">
>         <div id="hub" class="ez-box admin">
>           <a href="{{=URL('hubadmin','index')}}">
>             <img src="{{=URL('static','init/images/icons/
> ABIcon.png')}}" alt="some_text" width="78px" height="78px"/>
>             <h4>Hub</h4>
>             <p class="fs12">Uw hub beheren.</p>
>           </a>
>         </div> <!-- ez-box -->
>       </div> <!-- ez-fl -->
>
>       <div class="ez-fl ez-negmr ez-33">
>         <div id="vcardsite" class="ez-box admin">
>           <a href="{{=URL('addressbook','admin')}}">
>             <img src="{{=URL('static','init/images/icons/
> ABIcon.png')}}" alt="some_text" width="78px" height="78px"/>
>             <h4>vCard site</h4>
>             <p class="fs12">Uw vCard site beheren.</p>
>           </a>
>         </div> <!-- ez-box -->
>       </div> <!-- ez-fl -->
>
>       <div class="ez-last ez-oh">
>         <div id="calendar" class="ez-box admin">
>           <a href="{{=URL('calendar','admin')}}">
>             <img src="{{=URL('static','init/images/icons/
> ABIcon.png')}}" alt="some_text" width="78px" height="78px"/>
>             <h4>Calendar</h4>
>             <p class="fs12"></p>
>           </a>
>         </div> <!-- ez-box -->
>       </div> <!-- ez-last -->
>
>     </div> <!-- ez-wr -->
>
>   </div> <!-- ez-wr -->
>
>   <div class="ez-wr">
>
>     <div class="ez-wr" style="margin: 12px auto 12px; width: 552px">
>       <div class="ez-fl  ez-negmx ez-33">
>         <div id="root" class="ez-box admin">
>           <a href="{{=URL('root','admin')}}">
>             <img src="{{=URL('static','init/images/icons/
> ABIcon.png')}}" alt="some_text" width="78px" height="78px"/>
>             <h4>Root</h4>
>             <p class="fs12">Uw nodes beheren.</p>
>           </a>
>         </div> <!-- ez-box -->
>       </div> <!-- ez-fl -->
>
>       <div class="ez-fl ez-negmr ez-33">
>
>       </div> <!-- ez-fl -->
>
>       <div class="ez-last ez-oh">
>
>       </div> <!-- ez-last -->
>
>     </div> <!-- ez-wr -->
>
>   </div> <!-- ez-wr -->
>
>   <div class="ez-box">
>     <p>Let op: Voor een correcte werking van de admin applicatie moet
> uw browser cookies van deze webvoorziening accepteren.</p>
>   </div> <!-- ez-box -->
>
>   <div class="ez-box fs12" style="margin-top: 12px;">
>     {{if response.auth_menu:}}
>       <p>
>         {{for _name,_active,_link in response.auth_menu:}}
>           <a {{if _active:}} class="active" {{pass}} href="{{=_link}}"
> style="padding-right: 6px;">{{=_name}}</a>
>         {{pass}}
>       </p>
>     {{pass}}
>   </div> <!-- ez-box -->
>
> </div> <!-- ez-wr -->
>
> Kind regards,
>
> Annet

Reply via email to