Exemple #1
0
  def send_content(self, request):
    '''Shows the user login page'''
    # get the view
    view = request.getvalue('view', 'meetingchooser').lower()
    if view == 'login' or view == 'logout':
      view = 'meetingchooser'
    
    # see if the user wants to be logged out
    if request.getvalue('action', '') == 'logout' and request.session != None:
      Directory.logout(request.session)
    
    # write the page
    request.writeln(HTML_HEAD_NO_CLOSE + '''
      <script language='JavaScript' type='text/javascript'>
      <!--
        // ensure we are the top-most window (so a hidden frame doesn't go 
        // to a login window that the user can't see)
        // this happens when 
        // 1. the events try to refresh and the session has timed out
        // 2. an error occurs somewhere, the url is broken, and the app resets itself 
        if (top != window) {
          alert("Please login again.\\n\\nYour session has likely timed out.");
          top.location.replace("''' + request.cgi_href(gm_action="logout") + '''");
        }
      -->
      </script>      
      </head>
      
    ''' + HTML_BODY)
    
    request.writeln('''<script src="''' + join(WEB_PROGRAM_URL, 'jquery-1.4.2.min.js') + '''"></script>''')
    request.writeln('''<script src="''' + join(WEB_PROGRAM_URL, 'jquery-ui-1.8.2.custom.min.js') + '''"></script>''')
    request.writeln('''<link href="''' + join(WEB_PROGRAM_URL, 'jquery-ui-1.8.2.custom.css') + '''" rel="stylesheet" type="text/css"/>''')
    
    request.writeln('''
    
      <script type="text/javascript">
	$(function() {
		$("input:submit").button();
	});
      </script>
      
      <div id="login">
        <div id="bigPoetLogo">POET</div>
        <div id="login-input"> 
          ''' + request.cgi_form(view=view, username=None, password=None, global_view='meetingchooser') + '''
            Username:<br/><input type="text" name="username" size="50"><br/><br/>
            Password:<br/><input type="password" name="password" size="50"><br/><br/>
            <input class="submit" type='submit' value="Login">
          </form>
        </div>
        
        <div id="login-info">
          <p>
          Note: This application makes heavy use of <a target="_blank" href="http://www.w3schools.com/dhtml/">DHTML</a> 
          for its dynamic interfaces.  It requires
          a current browser that includes extensive <a target="_blank" href="http://www.w3.org/DOM/">W3C DOM</a> support.  
          It has been tested with the following browser versions:
          </p>
          <ul>
            <li><a target="_blank" href="http://www.microsoft.com/windows/ie/default.asp">Microsoft Internet Explorer</a> Version 6+.</li>
            <li><a target="_blank" href="http://www.mozilla.org/">Mozilla</a> or one of its <a target="_blank" href="http://www.mozilla.org/projects/distros.html">derivatives</a>:
              <ul>
                <li><a target="_blank" href="http://www.mozilla.org/">Firefox</a>: It's a whole new web.</li>
                <li><a target="_blank" href="http://channels.netscape.com/ns/browsers/default.jsp">Netscape Navigator</a> Version 6+.</i>
                <li><a target="_blank" href="http://www.mozilla.org/projects/camino/">Camino</a>: The primary Mozilla-based Mac OS X browser.</li>
                <li><a target="_blank" href="http://galeon.sourceforge.net/">Galeon</a>: A Linux GTK+ Mozilla-based browser.</li>
                <li>Many <a target="_blank" href="http://www.mozilla.org/projects/distros.html">others</a> exist...
              </ul>
            </li>
          </ul>
          <p>
           As of 2004, Safari, Opera, and others are not yet compliant enough to run GroupMind.
           The browser requirement is not a whim of the programmers, but rather a consequence of the
           use of Javascript, CSS, and the DOM.  The functions required
           by the application are simply not available in most other browsers.  We expect this list to grow
           as new versions of other browsers become more DHTML-compliant. 
           </p>
          <p>
          Groupmind is written and maintained by <a href="mailto:[email protected]">Dr. Conan C. Albrecht</a>. 
          It is distributed without warranty.
          </p>
          <div align="right"><i>GroupMind v''' + VERSION + '''</i></div>
        </div>
      
      </body>
      </html>    
    ''')
Exemple #2
0
 def clearall_action(self, request):
   for session in Directory.sessions.values():
     if session != request.session:
       Directory.logout(session)
       
Exemple #3
0
    def handle_cgi_request(self):
        """Handles a cgi request.  This is the main entry point for client requests,
       whether POST or GET, that are cgi-bin requests.  They all share the
       same memory space (i.e. this singleton object)."""

        # parse the form parameters to the form object
        # if a post request, encode everything (post requests can't encode on the client side because they come from forms)
        # get requests should encode on the client side (to handle special characters in the URL)
        if self.method.lower() == "get":
            for item in self.form.list:
                item.value = Constants.decode(item.value)

        # set the window id
        self.windowid = self.getvalue("global_windowid")

        # send the headers
        self.send_headers()

        try:

            # get the view
            viewst = self.getvalue("global_view", "meetingchooser").lower()

            # get the session, if there is one
            self.session = Directory.get_session(self.form.getvalue("z", ""))

            # if session is none, try logging the user in based upon their username and password parameters
            if self.session == None:
                self.session = Directory.login(self.form.getvalue("username", ""), self.form.getvalue("password", ""))

            # if the view is login, log the session out
            if (viewst == "login" or viewst == "logout") and self.session != None:
                Directory.logout(self.session)
                self.session = None

            # if session is still None, send them to the login page
            if self.session == None:
                viewst = "login"

            # process actions
            if self.session:
                Events.process_actions(self)

            # send events xml or send to view processing
            if self.getvalue("gm_internal_action") == "send_events_xml":
                Events.send_events_xml(self)

            else:
                # get the view
                if not BaseView.views.has_key(viewst):
                    self.writeln("<html><body>Error!  No view named " + viewst + " found.</body></html>")
                    return
                view = BaseView.views[viewst]
                self.view = view

                # send processing to the view
                Constants.log.debug("Sending processing to view: " + viewst)
                view.handle_request(self, viewst)

        except:
            self.writeln("<html><body>")
            self.writeln("<hr>")
            self.writeln("<b>The following error has occurred in the GroupMind application:</b>")
            self.writeln("<pre><tt>")
            traceback.print_exc(file=self.out)
            traceback.print_exc()
            self.writeln("</pre></tt>")
            self.writeln("</body></html>")
Exemple #4
0
 def clearsession_action(self, request):
   session = Directory.get_session(request.getvalue('sessionid'))
   Directory.logout(session)