Sidebar Block for Admins

kiz_0987

Joined: 2005-02-27
Posts: 189
Posted: Tue, 2005-10-04 16:22

I am using G2 embedded in Drupal, with a modified gallery.module which turns off the sidebar (the HTML is then sent to Drupal for inclusion in a block there). This uses GalleryCapabilities::set('showSidebarBlocks', false); and it works perfectly for normal pages.

For admin pages though the "Item Links" are kept in the G2 sidebar, while the rest of the block info is still displayed in the Drupal block. How can I get Gallery to really turn off the sidebar for admin pages, and output the Item Links block in the same way as the others? I've looked through the API docs and cannot find where the sidebar block generated -- any pointers appreciated.

Thanks.

 
mathoc

Joined: 2005-11-01
Posts: 2
Posted: Mon, 2005-11-14 14:15

I have to deal with the same problem. Any ideas? Nobody can help us?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-11-14 14:36

not yet. but actually, this is a customization or themeing question. of course you see it from the embedding perspective, but it's a themeing question so better discussed in the theme development forum. i'll move the topic there if you agree.

right now, there are 5 different kinds of views:
1. admin views, rendered with showAdminPage -> admin template
- 'useradminview'
- 'siteadminview'
- 'itemadminview'

2. item / photo view:
- 'showitemview': non-album -> showPhotoPage -> photo tpl

3. album view:
- 'showitemview': album -> showAlbumPage -> album tpl

4. progressbar view:
- 'progressbarview': -> progressbar tpl

5. module views:
- all other views, e.g. 'addCommentView', etc.: -> module tpl

this is all hardcoded and defined in G2.
What you do in your theme is all up to you.
you don't have to do it like matrix.

e.g. in module.tpl you could replace:

    <td id="gsSidebarCol">
      {g->theme include="sidebar.tpl"}
    </td>

with

    {if !empty($theme.params.sidebarBlocks)}
    <td id="gsSidebarCol">
      {g->theme include="sidebar.tpl"}
    </td>
    {/if}

(not sure if this is the right if condition). but i what i actually want to say is that you're free to display what you want.
you'll run into some difficulties since you remove the navigation that way, but you can add it another way back in.
you can also customize the templates of modules/core/templates/blocks/ to make the admin navigation a lot more compact, e.g. using DHTML.

 
mathoc

Joined: 2005-11-01
Posts: 2
Posted: Mon, 2005-11-14 15:25

I dont think that this is a theming problem, or maybe i did not understand you right.
The point is to display all gallery navigation links in a CMS-block (here using drupal-cms). Below is a peace of code taken from the module providing this block. It shows how the gallery-navigation is extracted with GalleryEmbed. This works for normal sidebar-navigation, but not for admin-navigation, like user-album permission settings or the admin backend. Why?

GalleryCapabilities::set('showSidebarBlocks', false);
$result = GalleryEmbed::handleRequest();
if (isset($result['sidebarBlocksHtml']) 
    && !empty($result['sidebarBlocksHtml'])) {
    $block['subject'] = t('Gallery Navigation');
    $block['content'] = '<div id="gsSidebar" class="gcBorder1">' 
      . join('', $result['sidebarBlocksHtml']) . '</div>';
}			
 
henmue

Joined: 2005-10-23
Posts: 4
Posted: Mon, 2005-11-14 15:39

@ valiant

kiz_0987 wants to transfer the gallery sidebar into a drupal block in embedded mode. the advantage is, that such a g2 sidebar-drupal-block can coexist with other drupal blocks in the drupal sidebar sidebar.

this works - as kiz_0987 said - fine for the normal pages but not for admin pages. when you surf to an admin page, you get a double sidebar: the normal drupal sidebar (now not containing the g2 sidebar) and the g2 sidebar inside the drupal content area.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-11-14 16:32

it is a themeing problem.

but you're right. the above code won't help.
the problem is that all ItemAdmin views (e.g. ItemEdit) are 100% themes by theme.tpl + ItemAdmin.tpl plus the subview.
But modules/core/templates/ItemAdmin.tpl defines the look and what to show where.

      <div class="gbBlock">
	<h2> {g->text text="Options"} </h2>
	<ul>
	  {foreach from=$ItemAdmin.subViewChoices key=choiceName item=choiceParams}
	    <li class="gbAdminLink {g->linkId urlParams=$choiceParams}">
	    {if isset($choiceParams.active)}
	      {$choiceName}
	    {else}
	      <a href="{g->url params=$choiceParams}"> {$choiceName} </a>
	    {/if}
	    </li>
	  {/foreach}
	</ul>
      </div>

shows the admin links. that is: it's not a block! maybe we could make it the whole thing a block... but not right now.
right now you'll have to customize this ItemAdmin.tpl if you want so.

you can file a feature request on http://sf.net/projects/gallery/ -> RFE to make this thing e.g. a block or find another solution to make it more themable, especially for embedded g2.