TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,019
  • Total Topics: 21,332
  • Online today: 1,658
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 631
  • Total: 631

Block Shrink/Edit display

Started by Rumbaar, December 04, 2007, 09:29:29 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Rumbaar

I haven't used TinyPortal much, but have installed it to test theme modifications.  When I was testing display formats for various blocks and the theme I'm working on, I found a 'bug'.

Now on a fresh SMF 1.1.4 and TP 0.9.8 the block functions don't seem to function correctly for all configurations and I'm wondering if it is by design or fault.

A block set with Frame, no title and set to allow shrink doesn't display the shrink/unshrink section and/or the edit button if allowed to edit.

Also the Block set to No frame, no title and set to allow shrink only displays the shrink/unshrink button, but no edit button if allowed to edit that black.

I've changed some of the code in my template, but not sure of the full ramifications of such action or have done it correctly.

Any additional help or testing of this would be helpful.
-Rumbaar

IchBin

We are aware of this. But I'm not sure what has been done about it. I will try to test it this weekend, as I'll be busy the rest of the week with stuff.

Rumbaar

Ah so it's not intentional, that was one of my concerns.

I think I've made the required changes to the code, at home, I'll post it here when I get a chance so can look over.  I think it had to do with a && or || entry.

Thx IchBin.

Rumbaar

Ok here is the changes to code I've done to get the edit button to work in block option Do not use title/frame and to have the edit and collapse button (when applied) for Use frame, but not title .
TPortalBlocks.template.php
From
if($use)
{
echo
'<div', (($theme || $block['frame']=='frame') ? ' class="tborder"' : ''), ' style="margin-bottom: 2px;">';

if ($theme || $block['frame'] == 'title'){
echo '
<div class="titlebg" style="padding: 4px; font-weight: bold;">';
if($block['visible']=='' || $block['visible']=='1')
echo '<a href="javascript: void(0); return false" onclick="toggle(\''.$block['id'].'\'); return false"><img id="blockcollapse'.$block['id'].'" style="margin: 0;" align="right" src="'.$settings['images_url'].'/' , ((isset($context['TPortal']['upshrinkblocks'][$block['id']]) && $context['TPortal']['upshrinkblocks'][$block['id']]==1) || !isset($context['TPortal']['upshrinkblocks'][$block['id']])) ? 'collapse' : 'expand' , '.gif" border="0" alt="" /></a>';

// can you edit the block?
if($block['can_edit'] && !$context['TPortal']['blocks_edithide'])
echo '<a href="',$scripturl,'?action=tpmod;sa=editblock'.$block['id'].';sesc='.$context['session_id'].'"><img style="margin-right: 4px;" border="0" align="right" src="'.$settings['images_url'].'/tp-edit.gif" alt="" /></a>';
elseif($block['can_manage'] && !$context['TPortal']['blocks_edithide'])
echo '<a href="',$scripturl,'?action=tpadmin;blockedit'.substr($side,0,1).'='.$block['id'].';sesc='.$context['session_id'].'"><img border="0" style="margin-right: 4px;" align="right" src="'.$settings['images_url'].'/tp-edit.gif" alt="" /></a>';

echo $block['title'],'
</div>';
}
else
{
if(($block['visible']=='' || $block['visible']=='1') && $block['frame']!='frame'){
echo '
<div style="padding: 4px;">';
if($block['visible']=='' || $block['visible']=='1')
echo '<a href="javascript: void(0); return false" onclick="toggle(\''.$block['id'].'\'); return false"><img id="blockcollapse'.$block['id'].'" style="margin: 0;" align="right" src="'.$settings['images_url'].'/' , ((isset($context['TPortal']['upshrinkblocks'][$block['id']]) && $context['TPortal']['upshrinkblocks'][$block['id']]==1) || !isset($context['TPortal']['upshrinkblocks'][$block['id']])) ? 'collapse' : 'expand' , '.gif" border="0" alt="" /></a>';
echo '&nbsp;
</div>';
}
}

To
if($use)
{
echo
'<div', (($theme || $block['frame']=='frame') ? ' class="tborder"' : ''), ' style="margin-bottom: 2px;">';

if ($theme || $block['frame'] == 'title'){
echo '
<div class="titlebg" style="padding: 4px; font-weight: bold;">';
if($block['visible']=='' || $block['visible']=='1')
echo '<a href="javascript: void(0); return false" onclick="toggle(\''.$block['id'].'\'); return false"><img id="blockcollapse'.$block['id'].'" style="margin: 0;" align="right" src="'.$settings['images_url'].'/' , ((isset($context['TPortal']['upshrinkblocks'][$block['id']]) && $context['TPortal']['upshrinkblocks'][$block['id']]==1) || !isset($context['TPortal']['upshrinkblocks'][$block['id']])) ? 'collapse' : 'expand' , '.gif" border="0" alt="" /></a>';

// can you edit the block?
if($block['can_edit'] && !$context['TPortal']['blocks_edithide'])
echo '<a href="',$scripturl,'?action=tpmod;sa=editblock'.$block['id'].';sesc='.$context['session_id'].'"><img style="margin-right: 4px;" border="0" align="right" src="'.$settings['images_url'].'/tp-edit.gif" alt="" /></a>';
elseif($block['can_manage'] && !$context['TPortal']['blocks_edithide'])
echo '<a href="',$scripturl,'?action=tpadmin;blockedit'.substr($side,0,1).'='.$block['id'].';sesc='.$context['session_id'].'"><img border="0" style="margin-right: 4px;" align="right" src="'.$settings['images_url'].'/tp-edit.gif" alt="" /></a>';

echo $block['title'],'
</div>';
}
else
{
if(($block['visible']=='' || $block['visible']=='1') || $block['frame']!='frame'){
echo '
<div style="padding: 4px;">';
if($block['visible']=='' || $block['visible']=='1')
echo '<a href="javascript: void(0); return false" onclick="toggle(\''.$block['id'].'\'); return false"><img id="blockcollapse'.$block['id'].'" style="margin: 0;" align="right" src="'.$settings['images_url'].'/' , ((isset($context['TPortal']['upshrinkblocks'][$block['id']]) && $context['TPortal']['upshrinkblocks'][$block['id']]==1) || !isset($context['TPortal']['upshrinkblocks'][$block['id']])) ? 'collapse' : 'expand' , '.gif" border="0" alt="" /></a>';

// can you edit the block?
if($block['can_edit'] && !$context['TPortal']['blocks_edithide'])
echo '<a href="',$scripturl,'?action=tpmod;sa=editblock'.$block['id'].';sesc='.$context['session_id'].'"><img style="margin-right: 4px;" border="0" align="right" src="'.$settings['images_url'].'/tp-edit.gif" alt="" /></a>';
elseif($block['can_manage'] && !$context['TPortal']['blocks_edithide'])
echo '<a href="',$scripturl,'?action=tpadmin;blockedit'.substr($side,0,1).'='.$block['id'].';sesc='.$context['session_id'].'"><img border="0" style="margin-right: 4px;" align="right" src="'.$settings['images_url'].'/tp-edit.gif" alt="" /></a>';

echo '&nbsp;
</div>';
}
}


Added the edit button to the else statement and changed the trigger $block['visible']=='1') && $block['frame']!='frame') to $block['visible']=='1') || $block['frame']!='frame').

It appears to work, but I think the trigger is incorrect.

Zetan

This was added to the Roadmap for TP 1.0

Quote7.| Move Edit Link Back To Bottom: if you use display block options "Use frame, but not title", or "Do not use title/frame", you will not have a quick edit link.

I'm not sure if it's been implemented yet as I've not been involved with Alpha testing.

Rumbaar

Ah where would I find the 'Roadmap for TP 1.0'?  I tried a search by couldn't find it.

Also when they say 'move' I hope they mean copy, as if you move it from it's current location it will no longer display in the area's it currently displays.  Like "Use frame from theme" & "Use just the title".

Zetan

The Roadmap is in the Alpha members boards, not public.

Rumbaar

Ah, so that explains why I couldn't find it :)

Zetan

It does  ;)
But I think I prefer the idea of moving it depending on state. Most of my blocks are with frame, and a few don't use them. I like the edit buton where it is with frame, without frame, moving the edit would be good.

Rumbaar

Well with the code I posted the EDIT & Shrink buttons are displayed the same across all possible states a block can have.  But it depends on what and where they move the current 'edit' button code in that whole block generation code with their Alpha testing.

Zetan

It used to be at the bottom of the block and would display regardless of state.
With the title enabled, I like where the edit button is.. with no title you have to edit via the admin panel as it is right now.. The Alpha team are well aware of it and will make the change  :)

Rumbaar

Ah I see what you mean now, so bottom is the body of the block.  I understand the benefit of having it in the body, but what about the shrink/unshrink button.  That still added an empty 'title' field above those without title or with no frame no title.

I think it would be best to put the edit button up with the shrink/unshrink button (if set) and if not set then have it in the body of the block.

The shrink/unshrink button is still missing from the no title, but frame block, even if you just move the edit button.  In it's currently coded state for 0.9.8.

T-Cat

You may be well aware, but I thought I would mention this... When I have edited a block which was set to Title and allow shrink, to no title and do not allow collapse, IF a user had last collapsed that block, when viewed with new settings, it remains in its collapsed state and no way for user to show the block. It simply does not show. Hopefully the new version will take care of this too.

This website is proudly hosted on Crocweb Cloud Website Hosting.