meeting-room-booking-system / mrbs-code

MRBS application code
Other
121 stars 59 forks source link

Custom theme (again) #2104

Open jberanek opened 6 years ago

jberanek commented 6 years ago

Hi all,

I've created once a theme for mrbs to be in line with our university corporate design. Most stuff I could handle in custom.css.php and the theme files, but I also slightly changed functions_session.inc and sessions_php.inc in order to have a login button which fits to the rest. Now I upgraded from 1.6.2 to 1.7.0 and stuff changed significantly in the session files. I could restore the rest of my theme, but I don't know how to apply a styling to the login button itself. In the old version I had an ID for submit2 in my custom.css.php. In the new version there are attributes for style, but if I try to add a class (I hope this relates to the css file) to the attributes

function print_logon_button($target_url)
{
  $form = new Form();
  $form->setAttributes(array('class' => 'submit2',
                                                       'method' => 'post',

then I get an error 500.

I've attached the theme, the custom css file, and the session files of both versions. Live version of the system is here http://sbs.physik.uni-konstanz.de

Is it possible to move all components regarding appearance from the session files to the theme folder, i.e., appearance of print_report_link($user) or make it optional to display print_userlist_link();?

Thx and cheers, Eugen

Reported by: *anonymous

Original Ticket: mrbs/support-requests/1393

Attachments: https://sourceforge.net/p/mrbs/support-requests/1393/attachment/1.6.2_functions_session.inc https://sourceforge.net/p/mrbs/support-requests/1393/attachment/1.6.2_session_php.inc https://sourceforge.net/p/mrbs/support-requests/1393/attachment/1.7.0_functions_session.inc https://sourceforge.net/p/mrbs/support-requests/1393/attachment/1.7.0_session_php.inc https://sourceforge.net/p/mrbs/support-requests/1393/attachment/custom.css.php https://sourceforge.net/p/mrbs/support-requests/1393/attachment/footer.inc https://sourceforge.net/p/mrbs/support-requests/1393/attachment/header.inc https://sourceforge.net/p/mrbs/support-requests/1393/attachment/styling.inc

jberanek commented 6 years ago

Yes, you can add a class (and/or an id) like that and then use that for styling. What's the error you are getting? You'll find the error message in your PHP error log. If you can't find that then add, temporarily, the following lines to the bottom of internalconfig.inc.php in order to display the error messages in the browser:

error_reporting(-1);
ini_set('display_errors', '1');

I don't think there's any styling information in functions_session.inc: it's just markup. And won't you need the userlist link so that admins can create new users and ordinary users can change their passwords? If you don't want ordinary users to be able to see other users then there's a config setting for that.

Original comment by: campbell-m

jberanek commented 6 years ago

I checked the logs and it just repeats

The variable $dateformat is no longer used and has been replaced by ...

all the time. I guess I have to check my config due to the upgrade.

But I played around with the attributes and I think, I just missed a comma in the setAttributes line :(. Now it recognizes the class and everything looks nice again.

Most of the settings for styling are in header.inc, but I can not decide there how I want to display the userlist link. It doesn't fit to our style, that there are several items above each other, like the login box and the userlist. I deactivated the userlist in the session_php.inc at the end of print_logon_box() and placed it directly in header.inc. Also, I don't like the "You are" in the report link for upcoming events, which I have to delete in functions_session.inc.

Actually, I think I just found a bug with this report link. After following the link in "You are xxx" (reproducible in your demo installation on sourceforge) I'm always logged out and the website shows "Your session has expired.".

Thanks for the help and the great work on this project.

Cheers, Eugen

Original comment by: *anonymous

jberanek commented 6 years ago

Yes, thanks for spotting that. The "You are xxx" problem is indeed a bug. I'll investigate later.

Original comment by: campbell-m

jberanek commented 6 years ago

I have now fixed the "You are xxx" bug and committed the change to the default branch in 9c9546.

I also agree with you about the "You are" text and have removed it in a8b22c.

Original comment by: campbell-m

jberanek commented 6 years ago

PS One way of getting rid of the "you are" without having to edit functions_session.inc is to use a $vocab_override config setting:

$vocab_override['en']['you_are'] = '';

Original comment by: campbell-m

jberanek commented 6 years ago

Thank you, works like a charm now. I adjusted my files, so from now on I just have to set the css style of the buttons in the funcitons_session. And the session_php is now also a bit smaller. I disabled print_report_link() and print_userlist_link() and added them directly to the header in the Themes folder.

session_php.inc

// Print the logon entry on the top banner.
function print_logon_box()
{
  global $QUERY_STRING;

  $target_url = this_page();

  if (isset($QUERY_STRING))
  {
    $target_url = $target_url . "?" . $QUERY_STRING;
  }

  $user=getUserName();

  if (isset($user))
  {
    //print_report_link($user);
    print_logoff_button($target_url);
  }
  else
  {
    //print_unknown_user();
    print_logon_button($target_url);
  } 

  //print_userlist_link();
}

header.inc

// For session protocols that define their own logon box...
    if (function_exists(__NAMESPACE__ . "\\print_logon_box"))
    {
        echo "<li>\n";
        print_userlist_link();
        echo "</li>\n";

        $user=getUserName();
        if (isset($user))
        {
            echo "<li>\n";
            print_report_link($user);
            echo "</li>\n";
        }

        print_logon_box();
    }

Original comment by: *anonymous