Allow User to Change SORT ORDER of the Album

pumaka

Joined: 2007-05-14
Posts: 46
Posted: Sat, 2010-06-05 13:27

I would like the users to be able to change the sort order, specifically by rating. It would be convenient after they're done grading pictures.

TIA

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sat, 2010-06-05 17:15

You as the admin can change the sort order. Then once the user has rated the items and refresh thy should chnage the order.
Allowing users to change sort order would be a bit of code change to bypass permissions.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
pumaka

Joined: 2007-05-14
Posts: 46
Posted: Sat, 2010-06-05 21:06

I tested something. I added this code to the Album template file:

Quote:
<h2> {g->text text="Sort order"} </h2>

<p class="giDescription">
{g->text text="This sets the sort order for the album. This applies to all current items, and any newly added items."}
</p>

<select name="{g->formVar var="form[orderBy]"}" onchange="pickOrder()">
{html_options options=$ItemEditAlbum.orderByList selected=$form.orderBy}
</select>
<select name="{g->formVar var="form[orderDirection]"}">
{html_options options=$ItemEditAlbum.orderDirectionList selected=$form.orderDirection}
</select>
{g->text text="with"}
<select name="{g->formVar var="form[presort]"}" type="hidden">
{html_options options=$ItemEditAlbum.presortList selected=$form.presort}
</select><br/>
{g->changeInDescendents module="sort" text="Apply to all subalbums"}
<script type="text/javascript">
// <![CDATA[
function pickOrder() {ldelim}
var list = '{g->formVar var="form[orderBy]"}';
var frm = document.getElementById('itemAdminForm');
var index = frm.elements

    .selectedIndex;
    list = '{g->formVar var="form[orderDirection]"}';
    frm.elements
      .disabled = (index <= 1) ?1:0;
      list = '{g->formVar var="form[presort]"}';
      frm.elements
        .disabled = (index <= 1) ?1:0;
        {rdelim}
        pickOrder();
        // ]]>
        </script>

It shows the form, but since the user doesn't have the "Edit item" permission for the album, the drop down fields are just empty.

And yes, I understand I can change the sort order later, but I want them to do it on their own.

Is the permissions bypass complicated?