edit album permissions

astralbaby

Joined: 2003-12-13
Posts: 35
Posted: Sun, 2005-04-17 21:17

Ok.. I see the permission edit item covers single item editing and album editing...

In my specific use.. i cannot allow the user to edit the album info.. BUT they can edit the single item..

ok.. i was going to delve into the core module tpl files to see if I could use a method i learned already doing somethin else...

first off.. I added this to the page so i could discover the users logged in ID

{$layout.user.id}

but i get a error.. is the layout info brought into the array that is used to build this

Notice: Undefined index: layout in /home/httpd/vhosts/carmelsilver.com/httpdocs/catalog/g2data/smarty/templates_c/%%1949190877/%%54^542^542DC2EF%%ItemEdit.tpl.php on line 4

gallery parses the page correctly but gives an error that states that it doesnt know what $layout is?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-04-17 21:34
Quote:
Ok.. I see the permission edit item covers single item editing and album editing...

In my specific use.. i cannot allow the user to edit the album info.. BUT they can edit the single item..

you understand that you can apply permissions not only to albums, but also to each item in the album, do you? if you don't set special permissions for an item in an album, it just receives the same permissions as its parent albums.

does this solve your issue?
and if not, could you be more descriptive what exactly you want to accomplish?

@ {$layout.user.id}: does http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&p=129399 answer your questions?

 
astralbaby

Joined: 2003-12-13
Posts: 35
Posted: Sun, 2005-04-17 21:45

ok.. this will be better hopefully...

I have debugging turned on to see which templates are being parsed and what variables will be used to workwith..

included templates & config files (load time in seconds): 
gallery:templates/global.tpl (0.04746) (total) 
   gallery:modules/core/templates/ItemAdmin.tpl (0.04239) 
      gallery:modules/core/templates/ItemEdit.tpl (0.00905) 
         gallery:modules/core/templates/ItemEditLayout.tpl (0.00262) 

in the assigned template variables.. the variable

$layout

is not present.. I am looking for a way to bring in that variable so i may do things like this..

{if $layout.user.id==2926} 

    

            <p class="giDescription"> 
              for my eyes only
            </p>      


{/if} 

I am looking to have only certain features seen by only certain users

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-04-17 22:18

see modules/core/classes/GalleryLayout.class
function loadLayoutTemplate
to see how to populate the $layout variable and how to assign the variable to the layout ($template->setVariable('layout', $layout);).

 
astralbaby

Joined: 2003-12-13
Posts: 35
Posted: Mon, 2005-04-18 21:52

well.. i am having some troiuble doing this... i am trying to bring the var $layout into the function but that var has npt been set yet... you said to populate it.. so would i just do a db query by itself then set the output to the var $layout?

or

is there a global var that has $layout inside?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-04-18 22:05

just take a look at how it is populated in loadLayoutTemplate. there's no global var, you have to query for the values you want in $layout (you could name the variable differently) and then assign them.

 
astralbaby

Joined: 2003-12-13
Posts: 35
Posted: Mon, 2005-04-18 22:34

what i am trying to do is just get the current users ID that is logged in..

is this info in the global $gallery?

if so.. how may i access it..

thanks Valient.. :)

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-04-18 22:45

global $gallery;
$activeUserId = $gallery->getActiveUserId();

 
astralbaby

Joined: 2003-12-13
Posts: 35
Posted: Mon, 2005-04-18 22:58

ok.. this is what I did...


$activeUserId = $gallery->getActiveUserId();


$template->setVariable('activeUserId', $activeUserId);

and this works.. in the smarty debug console... the var

$activeUserId shows up and is set with the user id (me).. but when I goto edit an album.. it is not in the console box so i am assuming that template will not have the info that I need...

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2005-04-18 23:01

where did you put the above code?

 
astralbaby

Joined: 2003-12-13
Posts: 35
Posted: Mon, 2005-04-18 23:10
   

    function loadLayoutTemplate(&$template, $item, $dataToLoad, $childIds=array()) {
	global $gallery;


        
# get current users ID then bring this to use in templates

        $activeUId = $gallery->getActiveUserId();


        $template->setVariable('activeUId', $activeUId);

# end hack




	$urlGenerator =& $gallery->getUrlGenerator();

 
astralbaby

Joined: 2003-12-13
Posts: 35
Posted: Tue, 2005-04-19 00:17

the above code snippit was inserted into GalleryLayout.class

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Tue, 2005-04-19 03:40

ok, so you should see that value in the smarty template variables on any view that calls loadLayoutTemplate.. which is layout pages (viewing albums/items)..

 
astralbaby

Joined: 2003-12-13
Posts: 35
Posted: Wed, 2005-04-20 02:24

well.. I went ahead and worked on gallerytemplate.class and brought the var in from there.. it works..

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Wed, 2005-04-20 03:48

update to tomorrow's nightly snapshot or update from cvs and you can remove this.. look at $user that is now available for any view..