Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Search

 
Advanced search

8043 Posts in 1856 Topics- by 2099 Members - Latest Member: roi
Calendar Script CommunityCustomizationHacks and Mods (Moderators: scott, DanO, Marty)restricting fields in template preferences
Pages: [1]   Go Down
Print
Author Topic: restricting fields in template preferences  (Read 437 times)
0 Members and 1 Guest are viewing this topic.
tw1000
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« on: November 22, 2005, 09:49:00 PM »

I am running metacal. All calendars are public. I would like to restrict the admins from each of the sub-calendars to only be able to alter the header information in template preferences. In other words, I would like their template preferences page to only show the header textarea. The site admin should be able to see all the options in the template preferences page. Anyone have any thoughts on how to do this?

Thanks

Tony W  

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #1 on: November 22, 2005, 10:09:00 PM »

** Anyone have any thoughts on how to do this? **

Find the template responsible and make a conditional skipping the printing of any fields except if the Administrator account is the one logged in. Something like the following might work for the conditional.

<% if ($user->{username} ne "Administrator") { %>

code to be skipped here

<% } %>

 This code is untested so use at your own risk.

Dan O.

------------------

Logged
tw1000
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #2 on: November 23, 2005, 01:32:00 PM »

Thanks for the fast reply Dan O. I am having difficulty finding a spot to insert the code you suggested. It appeats to me that the form field information intemplate_preferences.html is provided by preferences.txt
I can partially obtain the deired results by deleting (in preferences.txt) the the areas that I don't want to be visible. But then of course they are no longer visible to the Administrator either.

I see two possible routes to take.
1, create some code (in template preferences) that would use preferences1.txt if the Administrator was logged on and use prefernces2.txt if anyone else logged on.

or
2. create a a seperate calendar template for all but the Administrator using the altered preferences.txt  The problem with this solution is that no one would have access to a full template_preferences screen in the non Administrator template.

The first solution seems to be better to me but there may very well be a much better solution. At any rate the first solution is beyond my very limited coding abilities. Any suggestions on how to proceed?

thanks

Tony W


Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #3 on: November 24, 2005, 12:07:00 PM »

** insert the code you suggested. **

I did not supply exact code to use, just an example of code that might be able to be used depending on how you decided to go about performing the task.

** I am having difficulty finding a spot **

Here's another way it might be able to be done.

Right after the line:

foreach $field (@$fields) {

try adding:

next if ( $field->{'name'} ne "Header" && $user->{username} ne "Administrator" ) ;

     This code is untested so use at your own risk.

If that doesn't work maybe soneone else can tell you the exact code needed? If not, my services are available for hire.


Dan O.

------------------

Logged
tw1000
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #4 on: November 27, 2005, 09:26:00 PM »

thanks for the offer Dan O, I may take you up on it.For now, the altered preferences idea is working pretty well.

------------------

Logged
Pages: [1]   Go Up
Print
Jump to: