Simon Hunter | 1 Nov 2008 09:01
Picon

Re: Redirect if admin

Hi All
 
thanks for the advice, and you'll be pleased to know that I took the second option as suggested by Campbell and endorsed by Glenn. I used the following (in case future MRBS users search for a solution), first defining admin as
<?php
$admin = (!getAuthorised(2));
?>
 
and an example of the 'if ordinary user, then "", else if admin, then unaltered view.
<?php
if ($admin)
{echo "";
}
else

echo get_vocab("rep_for_nweekly");
}
?>
 
It worked well for each element that I wanted to alter, however my non-existent php skills have let me down while trying to alter the following line (about 20 lines from the end of edit_entry.php).
        <TD CLASS=CL><INPUT TYPE=TEXT NAME="rep_num_weeks" VALUE=" <?php echo $rep_num_weeks?>"></TD>
 
Does anyone know how I can enclose the 'Value' statement? It's nearly akin to enclosing the preceding HTML, then 'undoing' it to include the '<?php echo $rep_num_weeks?>"></'. It has me stumped. I've tried all combinations of backslashes before the quotation marks etc, but no joy.
 
 
 
Any help much appreciated
 
Simon
-----Original Message-----
From: Glenn Pillsbury [mailto:gpillsbury <at> PACIFIC.EDU]
Sent: 21 October 2008 20:31
To: Campbell Morrison; General purpose list (support/developers/users)
Subject: Re: [MRBS-general] Redirect if admin

I would second Campbell's last suggestion.  Instead of having two separate pages (which would both need to be touched for updates, etc), having a single page with specific elements restricted to admin would solve both the problem you're having with the redirect and make the system easier for you to maintain.
 
Just my $.02.
 
Glenn
 

From: Campbell Morrison [mailto:mail <at> campbellmorrison.co.uk]
Sent: Tuesday, October 21, 2008 10:04 AM
To: General purpose list (support/developers/users)
Subject: Re: [MRBS-general] Redirect if admin

When you press Save you go to edit_entry_handler.php, and then when that has finished it sends you back to $returl, which is the HTTP_REFERER for edit_entry.
 
So my guess as to what is happening is that when a member goes to edit_entry, he is then redirected to edit_entry_member and so edit_entry becomes the $returl, rather than day.php or whatever.
 
If this is the case I suspect you'll see that the booking has in fact been made, but you've just come back to where you started.     Check the value of $returl by looking at the source of the edit_entry_member page:  it's a hidden parameter in the form.
 
To get it to work, you'll have to get $returl right.    Or else just have a single page with some of the sections of the form enclosed by if ($admin) {...} sections  (where $admin is a boolean set at entry when you do your getAuthorised test.
 
Campbell
 
----- Original Message -----
Sent: Tuesday, October 21, 2008 5:13 PM
Subject: [MRBS-general] Redirect if admin

Hi
I have a small problem. I'm trying to create two types of 'edit_entry.php' forms, one for ordinary users (edit_entry_member.php) and one for administrators (edit_entry_.php). The administrator version  is the full blown form, with repeat days, etc. The ordinary one is stripped out, ie it lacks a lot of functionality of the admin version (don't want to give the user too many booking options).

I used the following code:

if(!getAuthorised(2))
{
header("Location:edit_entry_member.php?&day=$day&month=$month&year=$year");
exit;
}

ie I setup a redirect if not admin, then go to 'edit_entry_member.php'

The redirect works fine. The problem is that when the ordinary member (edit_entry_member.php) clicks the 'save' button, nothing happens.  Is it a javascript error? Or php error?

Any help much appreciated

Simon


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

_______________________________________________
mrbs-general mailing list
mrbs-general <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mrbs-general
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
mrbs-general mailing list
mrbs-general <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mrbs-general
Campbell Morrison | 1 Nov 2008 11:17
Picon

Re: Redirect if admin

I think you're looking for something like this:

<TD CLASS=CL><INPUT TYPE=TEXT NAME="rep_num_weeks" <?php echo
"VALUE=\"" .  $rep_num_weeks . "\"" ?>></TD>

The other thing you may find useful is leaving a field visible, but
disabling it for non-admin users by using disabled="disabled".     For
example:

<input type="text" name="rep_num_weeks" <?php if (!$admin) echo
"disabled=\"disabled\"" ?>>

By the way, it's maybe a bit confusing the way you've set up $admin
below.    If $admin is true then that that means you are an ordinary
user.    In the example above I've used your definition, but I think
it would be more intuitive to do it the other way round.

Campbell

2008/11/1 Simon Hunter <simon <at> huntersbelfast.co.uk>:
> Hi All
>
> thanks for the advice, and you'll be pleased to know that I took the second
> option as suggested by Campbell and endorsed by Glenn. I used the following
> (in case future MRBS users search for a solution), first defining admin as
> <?php
> $admin = (!getAuthorised(2));
> ?>
>
> and an example of the 'if ordinary user, then "", else if admin, then
> unaltered view.
> <?php
> if ($admin)
> {echo "";
> }
> else
> {
> echo get_vocab("rep_for_nweekly");
> }
> ?>
>
> It worked well for each element that I wanted to alter, however my
> non-existent php skills have let me down while trying to alter the following
> line (about 20 lines from the end of edit_entry.php).
>         <TD CLASS=CL><INPUT TYPE=TEXT NAME="rep_num_weeks" VALUE=" <?php
> echo $rep_num_weeks?>"></TD>
>
> Does anyone know how I can enclose the 'Value' statement? It's nearly akin
> to enclosing the preceding HTML, then 'undoing' it to include the '<?php
> echo $rep_num_weeks?>"></'. It has me stumped. I've tried all combinations
> of backslashes before the quotation marks etc, but no joy.
>
>
>
> Any help much appreciated
>
> Simon
>
> -----Original Message-----
> From: Glenn Pillsbury [mailto:gpillsbury <at> PACIFIC.EDU]
> Sent: 21 October 2008 20:31
> To: Campbell Morrison; General purpose list (support/developers/users)
> Subject: Re: [MRBS-general] Redirect if admin
>
> I would second Campbell's last suggestion.  Instead of having two separate
> pages (which would both need to be touched for updates, etc), having a
> single page with specific elements restricted to admin would solve both the
> problem you're having with the redirect and make the system easier for you
> to maintain.
>
> Just my $.02.
>
> Glenn
>
> ________________________________
> From: Campbell Morrison [mailto:mail <at> campbellmorrison.co.uk]
> Sent: Tuesday, October 21, 2008 10:04 AM
> To: General purpose list (support/developers/users)
> Subject: Re: [MRBS-general] Redirect if admin
>
> When you press Save you go to edit_entry_handler.php, and then when that has
> finished it sends you back to $returl, which is the HTTP_REFERER for
> edit_entry.
>
> So my guess as to what is happening is that when a member goes to
> edit_entry, he is then redirected to edit_entry_member and so edit_entry
> becomes the $returl, rather than day.php or whatever.
>
> If this is the case I suspect you'll see that the booking has in fact been
> made, but you've just come back to where you started.     Check the value of
> $returl by looking at the source of the edit_entry_member page:  it's a
> hidden parameter in the form.
>
> To get it to work, you'll have to get $returl right.    Or else just have a
> single page with some of the sections of the form enclosed by if ($admin)
> {...} sections  (where $admin is a boolean set at entry when you do your
> getAuthorised test.
>
> Campbell
>
>
> ----- Original Message -----
> From: Simon Hunter
> To: mrbs-general <at> lists.sourceforge.net
> Sent: Tuesday, October 21, 2008 5:13 PM
> Subject: [MRBS-general] Redirect if admin
>
> Hi
> I have a small problem. I'm trying to create two types of 'edit_entry.php'
> forms, one for ordinary users (edit_entry_member.php) and one for
> administrators (edit_entry_.php). The administrator version  is the full
> blown form, with repeat days, etc. The ordinary one is stripped out, ie it
> lacks a lot of functionality of the admin version (don't want to give the
> user too many booking options).
>
> I used the following code:
>
> if(!getAuthorised(2))
> {
> header("Location:edit_entry_member.php?&day=$day&month=$month&year=$year");
> exit;
> }
>
> ie I setup a redirect if not admin, then go to 'edit_entry_member.php'
>
> The redirect works fine. The problem is that when the ordinary member
> (edit_entry_member.php) clicks the 'save' button, nothing happens.  Is it a
> javascript error? Or php error?
>
> Any help much appreciated
>
> Simon
>
> ________________________________
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>
> ________________________________
>
> _______________________________________________
> mrbs-general mailing list
> mrbs-general <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mrbs-general
>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
michael worth | 3 Nov 2008 12:32

Re: bug [ 1949482 ] Problems with daylight savingtime

I'm sure I've seen php time/date functions that always use GMT regardless of timezone presumably using these consistantly throughout MRBS would solve this issue?

Mike

----- Original Message ----
From: Jennifer Pollard <jp337 <at> cam.ac.uk>
To: General purpose list (support/developers/users) <mrbs-general <at> lists.sourceforge.net>
Sent: Monday, 27 October, 2008 10:29:02 AM
Subject: Re: [MRBS-general] bug [ 1949482 ] Problems with daylight savingtime

John Beranek - MRBS Developer wrote:
> Chris Snow wrote:
>> Thanks Mike.
>
> However, if your server is correctly configured for DST, no action
> should be necessary.

This doesn't seem to be true for me... We use GMT/BST and every time the
time changes, I have to run a bit of SQL on our BST entries to bring
them back in line to the correct time.  PHP and the server are both set
to use Europe/London.

-Jen

--
Jennifer Pollard
Computer Officer
Faculty of English
University of Cambridge


This e-mail (and any files transmitted with it) is strictly confidential
and intended only for the use of the individual or organisation to whom
it is addressed. It may contain information which is privileged. If you
are not the intended recipient, you are notified that any dissemination,
distribution or copying of this e-mail is strictly prohibited. If you
have received this e-mail in error, please notify the sender and destroy
the original message. Thank you.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
mrbs-general mailing list
mrbs-general <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mrbs-general
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
mrbs-general mailing list
mrbs-general <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mrbs-general
Picon

Re: bug [ 1949482 ] Problems with daylight savingtime

michael worth wrote:
> I'm sure I've seen php time/date functions that always use GMT
> regardless of timezone presumably using these consistantly throughout
> MRBS would solve this issue?

No, it wouldn't. MRBS stores time in the manner it does in order to 
handle DST changes _correctly_.

John.

--

-- 
John Beranek - MRBS Developer <http://mrbs.sourceforge.net/>

To generalise is to be an idiot.
   -- William Blake

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
michael worth | 4 Nov 2008 17:25

Javascript on ie very slow

I'm running a slightly modified MRBS in a college which is generally working well. One issue is page load speed, loading day.php in ie takes a long time (10s maybe) when javascript is turned on. FF safari and opera all do it no problem with JS and IE works fine without.

Has anyone encountered this before? Anyone got any ideas of how to sort it?

Thanks,
Mike
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
mrbs-general mailing list
mrbs-general <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mrbs-general
Picon

Re: Javascript on ie very slow

michael worth wrote:
> I'm running a slightly modified MRBS in a college which is generally
> working well. One issue is page load speed, loading day.php in ie takes
> a long time (10s maybe) when javascript is turned on. FF safari and
> opera all do it no problem with JS and IE works fine without.

MRBS 1.4 has changes in it to improve performance in IE, mainly by using
CSS rather than JavaScript for slot highlighting.

John.

--

-- 
John Beranek - MRBS Developer <http://mrbs.sourceforge.net/>

To generalise is to be an idiot.
  -- William Blake

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Victor Gomez | 5 Nov 2008 01:21
Picon

Maximun entries per week

I everyone,

I'm a happy (very happy) user of MRBS, i've installed in many labs,  
but i have a little cuestion, its possible to apply a limit of  
entries? per example 4 entries in a week/month etc etc

Regards,

***Mensaje sin acentos
------------
L.I.Victor Gomez
Administrador de Sistemas
Instituto de Investigaciones en Materiales
Universidad Nacional Autonoma de Mexico
Ciudad Universitaria

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Anselm Martin Hoffmeister | 5 Nov 2008 02:43
Picon

Re: Maximun entries per week

Am Dienstag, den 04.11.2008, 18:21 -0600 schrieb Victor Gomez:
> I everyone,
> 
> I'm a happy (very happy) user of MRBS, i've installed in many labs,  
> but i have a little cuestion, its possible to apply a limit of  
> entries? per example 4 entries in a week/month etc etc

Hi Victor,

you can apply arbitrary limits by editing the code at appropriate
places. If your limit applies to entries created by the same person
within the calendar month, you could use some additional SQL query to
find out. If you use the mktime() family of functions to create a month
start and month end, think along
SELECT COUNT(id) FROM mrbs_entry WHERE create_by="$user" AND end_time >=
$month_start AND start_time <= $month_end
Get that number and see it is too large.

If you want to restrict within any running time frame that is
algorithmically more complicated. Nevertheless if you can create a clear
real language requirement you can probably also make a matching
statement.

If you put an if clause around it and abort the booking entry in case it
is not allowed you should be find. You will have to find out which PHP
files are interesting here, my guess is for edit_*.php

Best regards

Anselm
[130:34 - cannot switch TV off now]
Attachment (smime.p7s): application/x-pkcs7-signature, 3949 bytes
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
mrbs-general mailing list
mrbs-general <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mrbs-general
White, Andrew | 5 Nov 2008 03:16
Picon
Picon
Favicon

Re: Maximun entries per week

Hola Victor

You should be able to adapt the following code, which I have added to the function mrbsCheckFree section of
mrbs_sql.inc (after the declaration of globals) to restrict non-administrators to 1 booking per day and
only 3 in total:

# Prevent more than 1 booking per user per day, and more than 3 in the future - added by Andrew White

if (!getAuthorised(2))
{
    $create_by = getUserName();
    $booking = date("Ymd", $starttime);
    $totalCount = 0;
    $todayCount = 0;

    $res = mysql_query("SELECT start_time FROM mrbs_entry WHERE (create_by = '$create_by' AND id <> $ignore)");
    if(! $res)
           return sql_error();

    while ($row = mysql_fetch_assoc($res))
    {
           $RowDate = date("Ymd", $row['start_time']);
           if(time() < $row['start_time']) $totalCount++;
           if($RowDate == $booking) $todayCount++;         
    }

    if ($todayCount > 0)
    {
    	  $err = "<B>You are not allowed to have more than one booking in one day.</B>";
          return $err ;
    }
    if ($totalCount > 2)
    {
          $err = "<B>You are not allowed to have more than 3 future bookings in total.</B>";
          return $err ;
    }
    else
    {
    sql_free($res);
    }

}

_________________________________________________________
Andrew White
Information Technology Librarian
Lincoln University Library         
PO Box 64, Lincoln University, Lincoln 7647, New Zealand.
tel: +64-3-3218542        fax: +64-3-3252944
email: Andrew.White <at> lincoln.ac.nz

-----Original Message-----
From: Victor Gomez [mailto:victor <at> iim.unam.mx] 
Sent: Wednesday, 5 November 2008 1:22 PM
To: mrbs-general <at> lists.sourceforge.net
Subject: [MRBS-general] Maximun entries per week

I everyone,

I'm a happy (very happy) user of MRBS, i've installed in many labs,  
but i have a little cuestion, its possible to apply a limit of  
entries? per example 4 entries in a week/month etc etc

Regards,

***Mensaje sin acentos
------------
L.I.Victor Gomez
Administrador de Sistemas
Instituto de Investigaciones en Materiales
Universidad Nacional Autonoma de Mexico
Ciudad Universitaria

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
mrbs-general mailing list
mrbs-general <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mrbs-general

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Campbell Morrison | 5 Nov 2008 11:20
Picon

Re: Javascript on ie very slow

Although the CSS highlighting was implemented in order to solve the problem 
of poor cursor tracking performance in IE, I have been doing some tests and 
found that it does also improve page load performance, so the 1.4 release 
should indeed solve your problem as John says.    The Beta 2 release 
contains the CSS highlighting if you want to try it out (though note that 
you still get JavaScript highlighting if you're using IE6 or earlier).   Let 
me know if you have any problems.

Campbell

----- Original Message ----- 
From: "John Beranek - MRBS Developer" <jberanek <at> users.sourceforge.net>
To: "General purpose list (support/developers/users)" 
<mrbs-general <at> lists.sourceforge.net>
Sent: Tuesday, November 04, 2008 8:32 PM
Subject: Re: [MRBS-general] Javascript on ie very slow

> michael worth wrote:
>> I'm running a slightly modified MRBS in a college which is generally
>> working well. One issue is page load speed, loading day.php in ie takes
>> a long time (10s maybe) when javascript is turned on. FF safari and
>> opera all do it no problem with JS and IE works fine without.
>
> MRBS 1.4 has changes in it to improve performance in IE, mainly by using
> CSS rather than JavaScript for slot highlighting.
>
> John.
>
> -- 
> John Beranek - MRBS Developer <http://mrbs.sourceforge.net/>
>
> To generalise is to be an idiot.
>  -- William Blake
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's 
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great 
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the 
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> mrbs-general mailing list
> mrbs-general <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mrbs-general
> 

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

Gmane