]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/default/templates/signin.tmpl
Minor code optimization: Only generate signout button when necessary.
[SourceForge/phpwiki.git] / themes / default / templates / signin.tmpl
1 <?php // -*-html-*-
2      rcs_id('$Id: signin.tmpl,v 1.23 2003-11-30 19:52:03 carstenklapp Exp $');
3
4      if (empty($FORMNAME))
5          $FORMNAME = 'signin';
6      else
7          $NOFORM = true;
8 ?>
9 <?php if (empty($NOFORM)) { ?>
10   <form method="post" action="<?= $request->getPostURL() ?>" accept-charset="<?=CHARSET?>" name="<?=$FORMNAME?>">
11   <?= HiddenInputs($request->getArgs(), false, array('auth')) ?>
12 <?php } ?>
13 <?php if ($user->isSignedIn()) {
14   $Sep = $Theme->getButtonSeparator();
15   $SignOutB = $Theme->makeButton(_("Sign Out"), "javascript:SignOut();", 'wikiaction');
16 ?>
17 <span>
18   <?= fmt("You are signed in as %s", WikiLink($user->getId(), 'auto')) ?>
19   <?=$Sep?>
20 </span>
21   <script language="JavaScript" type="text/javascript"><!--
22     document.write('<input type="hidden" name="auth[logout]" value="0" />');
23     function SignOut(form) { 
24       var form = document.forms["<?=$FORMNAME?>"];
25       form.elements["auth[logout]"].value = 1;
26       form.submit();
27     }
28     document.write('<?=$SignOutB?>'); // -->
29   </script>
30   <noscript>
31     <?= Button("submit:auth[logout]", _("Sign Out"), 'wikiaction') ?>
32   </noscript>
33 <?php } else {
34   $SignInInput = HTML::input(array('type' => 'text',
35                                    'name' => "auth[userid]",
36                                    'size' => 12,
37                                    'maxlength' => 256,
38                                    'onchange' => "SignIn(this.form);"));
39   $SignInInput->addTooltip(_("Enter your UserId to sign in")) 
40 ?>
41   <script type="text/javascript"> <!--
42     function SignIn(form) {
43       <?php /* (comment out:)
44       if (window.focus) {
45         window.open('/EditingPolicy.html',<!-- url -->
46                     'PleaseReadThisFirst',<!-- window name -->
47                     'width=600,height=430,scrollbars=yes,resizable=yes,toolbar=yes');
48       }
49       */ ?>
50       form.submit();
51     }
52     //-->
53     document.write('&nbsp;<?=
54     _("Sign in:")
55     ?>');
56   </script>
57   <?= $SignInInput ?>
58   <noscript>
59     <?= Button("submit:auth[login]", _("Sign In"), 'wikiaction')?>
60   </noscript>
61
62 <?php } ?>
63
64 <?php if (empty($NOFORM)) { ?>
65   </form>
66 <?php } ?>