template_user_admin_menu not properly displaying template_user_admin_menu not properly displaying
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

template_user_admin_menu not properly displaying

Started by LoganSix, July 24, 2007, 09:40:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LoganSix

I am working on a custom theme based on a WordPress theme. (my site http://www.dean-logan.com/photo )
In the theme the menu items are bullet lists which have classes and styles assigned to them to give them icons and proper layout.

I have been using the Sample theme and others to try and get my theme working. So far, I have all of the menu lists working except the User Admin Menu.  I did searches on the forum to see if I could figure it out, but the search results didn't return any threads that solved my problem.

The Issue Breakdown
When the Admin Menu is displayed while logged as a Admin, the formatting style is correctly used and the menu is displayed correctly.
When logged as a Admin and selecting User Mode, the menu is not displayed at all.
When the User Admin Menu is displayed while logged as a User, the formatting style sheet is ignored.  It should look similar to the admin

In the theme.php file I have added the parameter $template_user_admin_menu
// HTML template for user admin menu
$template_user_admin_menu = <<<EOT
<h2 style="font-size: 14px; color: #333000;">User Controls</h2>
<ul id="adminnav">
<li class="album"><a href="albmgr.php" title="{ALBMGR_TITLE}">{ALBMGR_LNK}</a></li>
<li class="config"><a href="modifyalb.php" title="{MODIFYALB_TITLE}">{MODIFYALB_LNK}</a></li>
<li class="profile"><a href="profile.php?op=edit_profile" title="{MY_PROF_TITLE}">{MY_PROF_LNK}</a></li>
<li class="picmanage"><a href="picmgr.php" title="{PICTURES_TITLE}">{PICTURES_LNK}</a></li>
</ul>
EOT;


I have attached my theme.php, template.html, and a combined screen shot.
I am sure it is just something simple that I am missing.  Any ideas as to what it is?

Joachim Müller

Maybe you're encountering the same issues that are being discussed in "$template_user_admin_menu variable, from theme.php, is ignored". Please do as I suggested there:
Quote from: GauGau on July 25, 2007, 07:37:47 AMplease zip your custom theme and attach it to your posting (using "additional options" when composing your message).

LoganSix

Yes, it seems to be the same issue.
But, it wasn't resolved on that thread and considered a non-issue.

I have attached both the WordPress version of theme and the Coppermine version of theme.
I am not sure how the actual css would cause the code not to show up, which is why I only posted the template.html and theme.php file before.  I did not include all of the icons for the WordPress theme since those do not affect the HTML layout of the list.

Joachim Müller

#3
This has been harder than I expected. Nice theme btw - we'd appreciate if you would share it once you are done with it.

Here's a list of things I did:

<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/ie-gif.css" type="text/css" />won't work, as PHP code is not being parsed within template.html





rating2.gif and rating3.gif have been missing. I added them.




Double definition of {GAL_DESCRIPTION} both in pageheader() as well as pagefooter. I removed one of the definitions.




The line'{USER_ADMIN_MENU}' => theme_user_admin_mode_menu(),is made up and does not correspond to a token in curly brackets in template.html. Removed.




The function theme_user_admin_mode_menu() is never being called. Removed




The header data that contains  Coppermine version: 1.4.11
  $Source$
  $Revision: 3338 $
  $Author: gaugau $
  $Date: 2006-11-09 06:12:18 +0100 (Do, 09 Nov 2006) $
is SVN output. Don't abuse it for your own purposes. Removed.




Using the full, absolute path (seen from your webroot) is bad for portability. Changed /photo/themes/life-is-a-byte/images/tothemes/life-is-a-byte/images/





Cleaned up some functions that were defined in your custom theme for no apparent reason, as they didn't differ from the orginal function definition in include/themes.inc.php that is being used as default if no custom function overrides it.




The string{ADMIN_MENU}in// HTML template for the album list
$template_album_list = <<<EOT
<!-- BEGIN stat_row -->
        {STATISTICS}
<!-- END stat_row -->
<!-- BEGIN header -->
        {ADMIN_MENU}
<!-- END header -->
doesn't do anything except shining through. Removed






Please find my edited copy of your theme attached to this thread. Back up your version first before overwritting it with my copy in case I over-edited something.

Joachim

LoganSix

Sorry for the mess, it's a work in process.
I made the updates you suggested.  I have the images for rating already, just didn't include them.  Also, I fixed the URL to the css pages and the images.

I see from BlackRock's thread that he has discovered that the problem is related to Stramm's Mod pack, which I have installed.
So, I guess you can close this thread or combine it with his, since we are having the same issue.

Now the question is, what needs to be fixed in Stramm's Mod pack to fix this issue.

Joachim Müller

Moving both your thread as well as the thread by BlackRock from "cpg1.4 themes/skins/templates" to the support board that deals with Stramm's modpack, as this definitely is a modpack issue. In the future, please post a link to your gallery in the first place when you start a new thread. It might be a good idea to clarify in your postings as well that you're using the modpack when you start a new thread.

blackRock

I had exactly the same problem. Sami's suggestions worked fine for me.

Please, see this topic: http://forum.coppermine-gallery.net/index.php?topic=45463.0

LoganSix

Adding the "{ }" worked for me too.
Except for that the Admin menu does not display when in User Mode and signed in as Admin.
I am assuming that "User Mode" means that what the user sees who is not signed in to the application.  If that is the case, then it's not a problem.

Sami

‍I don't answer to PM with support question
Please post your issue to related board

LoganSix

Thanks.
This is solved then.


But, I will remark that it seems to me that developers should use
if () {
}
instead of just
if ()

statements throughout the code.  If this practice was done, then the bug probably would not have happened.
Usually the "{}" are only left out when an "if" statement is only one line.

Joachim Müller

Quote from: LoganSix on July 26, 2007, 03:08:31 PM
But, I will remark that it seems to me that developers should use
if () {
}
instead of just
if ()

statements throughout the code.  If this practice was done, then the bug probably would not have happened.
Usually the "{}" are only left out when an "if" statement is only one line.
We're aware of this and have been doing exactly what you suggest for ages. That's why the missing curly brackets in this particular file has been labelled as a bug - it was an omission that caused a malfunction. That's the meaning of the word bug.

Quote from: LoganSix on July 26, 2007, 03:08:31 PMThis is solved then.
Marking thread accordingly.

LoganSix

Quote from: GauGau on July 26, 2007, 04:12:37 PM
We're aware of this and have been doing exactly what you suggest for ages. That's why the missing curly brackets in this particular file has been labelled as a bug - it was an omission that caused a malfunction. That's the meaning of the word bug.

You should have the developer look at the rest of the file, because the "if" statement that was fixed for this issue was not the only one without the "{}" brackets.  Unless you are saying that all the missing brackets in the file is being labeled as one bug.  To have that many missing and not noticed would be part of a review issue.  Since I just started looking at Coppermine, I don't know what your review process is for development of mods, but I assume you have people who review code that is submitted.  If that is the case, the code should have been rejected due to poor formatting.  But, I understand if you don't have the resources to do such checks, since this is an free application.

Joachim Müller

Coppermine is a community effort - we rely on user contributions. Subsequently, you're welcome to review the code and submit your suggestions for code changes (each one in a separate thread).

Joachim Müller

Reviewing include/themes.inc.php I discovered that you're absolutely right: there have been a lot of curly brackets missing. I added them to the cpg1.4.x trunk of the SVN, so they will be in the next maintenance release (cpg1.4.13). If you want to review my changes, checkout out using web SVN: http://coppermine.svn.sourceforge.net/viewvc/coppermine/trunk/cpg1.4.x/include/themes.inc.php?view=log

LoganSix

Thanks for the update.

Hopefully I will have time to help review changes and give more feedback.
But for now, I still need to clean up the mess with my theme.  One page and menu done, a bunch more pages to tweak.