Esempio n. 1
0
def htmlSetups():
    selectedSetup = "<strong>%s</strong>" % credentials.getSelectedSetup()
    availableSetups = [
        (setupName, diracURL(controller="web/userdata", action="changeSetup", id=setupName))
        for setupName in gWebConfig.getSetups()
    ]
    return yuiWidgets.dropDownMenu("UserSetupPos", selectedSetup, availableSetups)
Esempio n. 2
0
def htmlUserInfo():
  username = credentials.getUsername()
  if not username or username == "anonymous":
    htmlData = "Anonymous"
  else:
    selectedGroup = credentials.getSelectedGroup()
    availableGroups = [ ( groupName, diracURL( controller = 'web/userdata', action = 'changeGroup', id = groupName ) ) for groupName in credentials.getAvailableGroups() ]
    htmlData = "%[email protected]%s" % ( username, yuiWidgets.dropDownMenu( "UserGroupPos", selectedGroup, availableGroups ) )
  dn = credentials.getUserDN()
  if dn:
    htmlData += " (%s)" % dn
  else:
    if 'REQUEST_URI' in request.environ:
      uri = str( request.environ[ 'REQUEST_URI' ] )
    else:
      uri = ""
    htmlData += " (<a href='https://%s%s'>certificate login</a>)" % ( str( request.environ[ 'HTTP_HOST' ] ), uri )
  return htmlData