Source

HackersEdge / templates / base.html

Full commit
{% load url from future %}
{% load cache %}
{% load hackers_edge %}
{% load dajaxice_templatetags %}
<html>
 <head>
  <title>Hacker's Edge | {% block title %}Untitled{% endblock %}</title>
  <script src="{{STATIC_URL|default:'/static/'}}js/jquery-1.7.1.min.js" type="text/javascript"></script>
  <script src="{{STATIC_URL|default:'/static/'}}js/jquery-ui-1.8.18.custom.min.js" type="text/javascript"></script>
  {{addrbar_form.media.js}}
  {% dajaxice_js_import %}
  <script src="{{STATIC_URL|default:'/static/'}}dajax/jquery.dajax.core.js" type="text/javascript"></script>
  <link type="text/css" href="{{STATIC_URL|default:'/static/'}}css/bootstrap.min.css" rel="stylesheet" />
  <link type="text/css" href="{{STATIC_URL|default:'/static/'}}css/trontastic/jquery-ui-1.8.18.custom.css" rel="stylesheet" />
  {{addrbar_form.media.css}}
  <style>
   body { background-color: #000000; font-size: 10pt; }
   #accordion { height: 600px; }
   #accordion h3 { font-size: 10pt; }
   #accordion div { font-size: 10pt; }
   #content { height: 600px; padding: 5px; }
   #navbar { font-size: 8pt; }
   #brand { font-size: 14pt; color: #00ff00; font-family: courier; }
   .copyright { color: #ff0000; display: block; text-align: center; }
   .copyright a { color: #00ff00; }
   {% block css %}{% endblock %}
  </style>
  <script type="text/javascript">
  var messages = [
  {% if messages %}
   {% for message in messages %}
    {'tag':'{{message.tags}}', 'message':'{{message}}'}{% if not forloop.last %},{% endif %}
   {% endfor %}
  {% endif %}
{% if not user.is_authenticated %}
    {'tag':'info', 'message':'Welcome!'}
{% endif %}
  ];
  display_message = function() {
    if (messages.length == 0){ $("#message").fadeOut(); return; }
    $("#message").html('<span class="ui-icon ui-icon-'+messages[0].tag+'" style="float: left;"></span>'+messages[0].message);
    messages.splice(0,1);
  }
  append_message = function(message) {
    if (messages.length == 0){ $("#message").fadeIn(); }
    messages.push(message);
    display_message();
  }
  {% block javascript %}{% endblock %}
$(function(){
  $("#message").hide();
  $("#navbar a").button();
{% block jquery %}
  $("#accordion").accordion({fillSpace:true});
  $("button").button({icons:{primary:"ui-icon-trash"}});
  $("#dialog-connect").dialog({autoOpen:false,modal:true,buttons:
    {"Connect": function(){
     $("#content").html($("#server").val());
     $("#server").val("");
     $(this).dialog("close");
    }, Cancel: function() {
     $(this).dialog("close");
    }}});
  $("[id=id_addrbar]").bind("autocompleteselect", function(event, ui){
    location.href = '/he_one/'+ui.item.value;
  });
{% endblock %}
  if (messages.length > 0){
    display_message();
    $("#message").fadeIn();
  }
  $("#message").click(display_message);
});
  </script>
{% include "analytics.html" %}
 </head>
 <body>
 <div class="container">
  <div id="navbar" class="row">
   {% block navbar %}
   <div class="span3" id="brand">Hacker's Edge</div>
   <div class="span1"><a href="/">Home</a></div>
   <div class="span1"><a href="{% url 'forum-index' %}">Forums</a></div>
   <div class="span1"><a href="{% url 'overview' %}">Play</a></div>
   <div id="message" class="span5 ui-state-highlight ui-corner-all"></div>
   {% endblock %}
  </div>
  <div class="row">
   {% block body %}
   <div class="span3">
    <div id="accordion">
     {% block accordion %}
     <h3><a href="#">Tools</a></h3>
     <div>
      {% block tools %}
      <a href="{% url 'overview' %}">{% showicon "home" %}Overview</a><br/>
      <a href="{% url 'running-tasks' %}">{% showicon "clock" %}Running Tasks</a><br/>
      {% endblock %}
     </div>
     <h3><a href="#">Resources</a></h3>
     <div>
     {% cache 3600 hosts user.pk %}
      {% for host in user.hosts.all %}
      {% if host.is_booted %}<a href="{{host.get_absolute_url}}">{% showicon "disk" %}{{host}}</a><br/>{% endif %}
      {% endfor %}
     {% endcache %}
     {% cache 3600 mailboxes user.pk %}
      {% for mbx in user.mailbox_set.all %}
       {% for host in mbx.host_set.all %}
       {% if host.is_booted and host.supports_mail %}<a href="{% url 'mailbox-detail' host.ip mbx.pk %}">{% showicon "mail-closed" %}{{host}}</a><br/>{% endif %}
       {% endfor %}
      {% endfor %}
     {% endcache %}
     </div>
     <h3><a href="#">Help</a></h3>
     <div>
      <a href="{% url 'help-index' %}">{% showicon "help" %}Game Guide</a><br/>
      <a href="{% url 'help-topic' 'tutorials' %}">{% showicon "lightbulb" %}Tutorials</a><br/>
      <a href="{% url 'forum-topic' 'help' %}">{% showicon "comment" %}Forums</a><br/>
     </div>
     <h3><a href="#">My Account</a></h3>
     <div>
{% if user.is_staff %}
      <a href="{% url 'admin:index' %}">{% showicon "person" %}Site Administration</a><br/>
{% endif %}
      <a href="{% url 'auth_password_change' %}"><span class="ui-icon ui-icon-key" style="float:left;"></span>Change Password</a><br/>
      <a href="{% url 'auth_logout' %}"><span class="ui-icon ui-icon-power" style="float:left;"></span>Logout</a><br/>
     </div>
     {% endblock %}
    </div>
   </div>
   <div class="span9">
    <div id="content" class="ui-widget-content ui-corner-all">
     <div class="ui-widget">
      <form action="" method="post">
       <label for="id_addrbar">Address Bar:</label>
       <input name="addrbar" data-selectable-type="text" data-selectable-allow-new="false" data-selectable-url="/selectable/he_one-hostlookup/" type="text" id="id_addrbar" class="text ui-corner-all" style="width: 100%;" />
      </form>
     </div>
     {% block content %}
     {% endblock %}
    </div>
   </div>
   {% endblock %}
  </div>
 </div>
 {% block footer %}
 <div id="dialog-connect" title="Connect to...">
  <form><fieldset>
    <label for="server">Server</label>
    <input type="text" name="server" id="server" class="text ui-widget-content ui-corner-all" />
  </fieldset></form>
 </div>
 {% endblock %}
 <div class="copyright">Python Powered | &copy; 2012 Hacker's Edge | <a href="http://www.pythondiary.com/">Blog</a> | <a href="{% url 'contact_us' %}">Contact us</a></div>
 </body>
</html>