commit b3913eb0f528e320c95f663e57443138c69d0fdb Author: plt Date: Sat Mar 19 13:15:02 2011 +0800 Inital commit of seahub diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..b59c02a167 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*.pyc +*~ +seahub.db +local_settings.py +startserver.sh diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/basic/__init__.py b/basic/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/basic/models.py b/basic/models.py new file mode 100644 index 0000000000..71a8362390 --- /dev/null +++ b/basic/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/basic/tests.py b/basic/tests.py new file mode 100644 index 0000000000..2247054b35 --- /dev/null +++ b/basic/tests.py @@ -0,0 +1,23 @@ +""" +This file demonstrates two different styles of tests (one doctest and one +unittest). These will both pass when you run "manage.py test". + +Replace these with more appropriate tests for your application. +""" + +from django.test import TestCase + +class SimpleTest(TestCase): + def test_basic_addition(self): + """ + Tests that 1 + 1 always equals 2. + """ + self.failUnlessEqual(1 + 1, 2) + +__test__ = {"doctest": """ +Another way to test that 1 + 1 is equal to 2. + +>>> 1 + 1 == 2 +True +"""} + diff --git a/basic/views.py b/basic/views.py new file mode 100644 index 0000000000..60f00ef0ef --- /dev/null +++ b/basic/views.py @@ -0,0 +1 @@ +# Create your views here. diff --git a/manage.py b/manage.py new file mode 100755 index 0000000000..bcdd55e27b --- /dev/null +++ b/manage.py @@ -0,0 +1,11 @@ +#!/usr/bin/python +from django.core.management import execute_manager +try: + import settings # Assumed to be in the same directory. +except ImportError: + import sys + sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) + sys.exit(1) + +if __name__ == "__main__": + execute_manager(settings) diff --git a/media/css/seahub.css b/media/css/seahub.css new file mode 100644 index 0000000000..eb2da09670 --- /dev/null +++ b/media/css/seahub.css @@ -0,0 +1,73 @@ +body,div,h1,h2,h3,h4,h5,h6,p,ul,li,blockquote,form,input,img { margin:0; padding:0; } +ul > li { list-style:none; } +.error { color:red; } +.float_left { float:left; } +.hidden { display:none } +.clear { clear:both;line-height:0;font-size:0 } +.fleft { float:left } +.fright { float:right } +.cleft { clear:left } +.show { display:block } +.hide { display:none } +.errorlist { color: red; } +.label { color:#333; font-size:12px; font-style:normal; } +a { color:#ee8833; text-decoration:none; font-weight:bold; } +a:hover { color: #ff9933; text-decoration: underline; } +/* table */ +table.default { border: 1px solid; cellspacing: 0; border-collapse: collapse; } +table.default td, table.default th { padding: 3px; border: 1px solid #000; } +table.default th { color:#808; } +table.default tr.even { background-color: #FAFAFA; } +table.default tr.odd { background-color: #E0E0E0; } +table.default tr.first { background-color: #00FF00; } +/* container */ +#wrapper { margin:0 auto; width:950px; + font-family: 宋体, Arial, Helvetica, sans-serif; font-size:13px; } +#header { font-size: 14px;font-weight: bold;min-height: 60px;} +#main { padding-top:10px; } +#left-panel { float:left; width:120px; } +#right-panel { float:right; width:800px; } +#footer { color:#999; padding-top:2px; margin:25px 0; border-top:1px solid #DDD; } +/* #header */ +#logo { margin-top: 4px; } +#header #ident { margin-top: 8px; float: right; font-size: 12px; } +#header #ident p { color: #808; } +#header #ident label { color: #888; } +#header .navs { clear: both; position: relative; margin-top: 10px; } +#header ul.nav { padding: 0; } +#header .nav li { float: left; height: 18px; padding: 0px 25px 4px 0; background: none; } +#header .nav a, #header .nav a:visited { color:#8A948F; font-weight:bold; text-decoration:none; } +#header .nav a:hover { color: #ff9933; text-decoration: underline; } +div.nav-separator { clear: both; border-top: #FF8C00 1px solid; border-bottom: none; border-left: none; border-right: none; margin: 0px 0px 21px 0px; padding: 0px; } +/* footer */ +#footer a { color:#333; text-decoration:none; } +/* main */ +h2 { font-size:16px; color:#292; padding:4px 0 2px 0px; border-bottom: 2px solid #2B2; background-position:left 22px; margin:10px 0; } +h3 { font-size: 14px; color: #808; margin: 10px 0px 4px 0; } +p { line-height: 22px; } +ol { margin:0; padding:0px 0 0 2em; list-style-position:inside; } +ul { padding:4px 0 0 0; } +ul > li { background:white url('/media/img/li.gif') no-repeat scroll; background-position:left 8px; padding-left:10px; } +/* #main ul.ui-tabs-nav > li { background: none; } */ +#main ol > li { } +#main li { line-height:20px; } +#main img.click { margin-left:2px; cursor:pointer; } + +/* profile */ +.avatar_op .pic { float:left; margin-right:15px; } +.avatar_op .text { float:left; } +#main .avatar_op ul { padding:0; } +#main .avatar_op ul label { display:none; } +#main .avatar_op ul ul label { display:block; } +#main .avatar_op li { padding:0; background:none; } +#main .avatar_op ul ul li { float:left; margin-right:5px; } +.avatar { float:left; width:120px; } +.ele_info { float:right; width:450px; } +/* input button */ +textarea { border: 1px solid #80B0B0; } +input { border: 1px solid #80B0B0; } +input[type=submit] { border: 1px solid #80B0B0; background: #EEE; color: #080; padding:0 2px; border-radius: 3px; -moz-border-radius:3px; } +input[type=submit]:hover { border: 1px solid #80B0B0; background: #FFF; } +#main form label { display: inline-block; margin:2px 0px; } +/* form */ +/* forms */ diff --git a/media/img/favicon.png b/media/img/favicon.png new file mode 100644 index 0000000000..3a14f6c5fd Binary files /dev/null and b/media/img/favicon.png differ diff --git a/media/img/li.gif b/media/img/li.gif new file mode 100644 index 0000000000..d991e8db2d Binary files /dev/null and b/media/img/li.gif differ diff --git a/media/img/logo.png b/media/img/logo.png new file mode 100644 index 0000000000..62b9500e13 Binary files /dev/null and b/media/img/logo.png differ diff --git a/settings.py b/settings.py new file mode 100644 index 0000000000..3b533107c0 --- /dev/null +++ b/settings.py @@ -0,0 +1,109 @@ +# Django settings for seahub project. +import os + +DEBUG = True +TEMPLATE_DEBUG = DEBUG + +ADMINS = ( + # ('Your Name', 'your_email@domain.com'), +) + +MANAGERS = ADMINS + +DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. +DATABASE_NAME = os.path.join(os.path.dirname(__file__), 'seahub.db') # Or path to database file if using sqlite3. +DATABASE_USER = '' # Not used with sqlite3. +DATABASE_PASSWORD = '' # Not used with sqlite3. +DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. +DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. + +# Local time zone for this installation. Choices can be found here: +# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name +# although not all choices may be available on all operating systems. +# If running in a Windows environment this must be set to the same as your +# system time zone. +TIME_ZONE = 'America/Chicago' + +# Language code for this installation. All choices can be found here: +# http://www.i18nguy.com/unicode/language-identifiers.html +LANGUAGE_CODE = 'zh-CN' + +SITE_ID = 1 + +# If you set this to False, Django will make some optimizations so as not +# to load the internationalization machinery. +USE_I18N = True + +# Absolute path to the directory that holds media. +# Example: "/home/media/media.lawrence.com/" +MEDIA_ROOT = os.path.join(os.path.dirname(__file__), "media") + +# URL that handles the media served from MEDIA_ROOT. Make sure to use a +# trailing slash if there is a path component (optional in other cases). +# Examples: "http://media.lawrence.com", "http://example.com/media/" +MEDIA_URL = '/media/' + +# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a +# trailing slash. +# Examples: "http://foo.com/media/", "/media/". +ADMIN_MEDIA_PREFIX = '/media/' + +ADMIN_MEDIA_PREFIX = '%sadmin/' %(MEDIA_URL) + +# Make this unique, and don't share it with anybody. +SECRET_KEY = 'n*v0=jz-1rz@(4gx^tf%6^e7c&um@2)g-l=3_)t@19a69n1nv6' + +# List of callables that know how to import templates from various sources. +TEMPLATE_LOADERS = ( + 'django.template.loaders.filesystem.load_template_source', + 'django.template.loaders.app_directories.load_template_source', +# 'django.template.loaders.eggs.load_template_source', +) + +MIDDLEWARE_CLASSES = ( + 'django.middleware.common.CommonMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', +) + +SITE_ROOT_URLCONF = 'seahub.urls' +ROOT_URLCONF = 'djblets.util.rooturl' + +SITE_ROOT = '/' + + +TEMPLATE_DIRS = ( + # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". + # Always use forward slashes, even on Windows. + # Don't forget to use absolute paths, not relative paths. + os.path.join(os.path.dirname(__file__), "templates"), +) + +INSTALLED_APPS = ( + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.sites', + 'seahub.basic', +) + +try: + import local_settings +except ImportError: + pass +else: + # Import any symbols that begin with A-Z. Append to lists any symbols that + # begin with "EXTRA_". + import re + for attr in dir(local_settings): + match = re.search('^EXTRA_(\w+)', attr) + if match: + name = match.group(1) + value = getattr(local_settings, attr) + try: + globals()[name] += value + except KeyError: + globals()[name] = value + elif re.search('^[A-Z]', attr): + globals()[attr] = getattr(local_settings, attr) + diff --git a/templates/404.html b/templates/404.html new file mode 100644 index 0000000000..a3e4254cab --- /dev/null +++ b/templates/404.html @@ -0,0 +1,9 @@ +{% extends "base.html" %} + +{% block title %}Page not found{% endblock %} + +{% block content %} +

Page not found

+ +

Sorry, but the requested page could not be found.

+{% endblock %} diff --git a/templates/500.html b/templates/500.html new file mode 100644 index 0000000000..a7beaded10 --- /dev/null +++ b/templates/500.html @@ -0,0 +1,15 @@ + + + + Page unavailable + + +

Page unavailable

+ +

Sorry, but the requested page is unavailable due to a + server hiccup.

+ +

Our engineers have been notified, so check back later.

+ + diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000000..2f1ac123bc --- /dev/null +++ b/templates/base.html @@ -0,0 +1,61 @@ + + + +{% block title %}{% endblock %} - SeaHub + + + + + +{% block extra_style %}{% endblock %} +{% block extra_script %}{% endblock %} + + + + +
+ +
+
+
+
+
+
+
+ +
+
+ + +
+ + diff --git a/templates/home.html b/templates/home.html new file mode 100644 index 0000000000..94d9808cc7 --- /dev/null +++ b/templates/home.html @@ -0,0 +1 @@ +{% extends "base.html" %} diff --git a/urls.py b/urls.py new file mode 100644 index 0000000000..c88cc3b6b8 --- /dev/null +++ b/urls.py @@ -0,0 +1,28 @@ +from django.conf.urls.defaults import * +from django.conf import settings +from seahub.views import root, home + +# Uncomment the next two lines to enable the admin: +# from django.contrib import admin +# admin.autodiscover() + +urlpatterns = patterns('', + # Example: + # (r'^seahub/', include('seahub.foo.urls')), + + # Uncomment the admin/doc line below and add 'django.contrib.admindocs' + # to INSTALLED_APPS to enable admin documentation: + # (r'^admin/doc/', include('django.contrib.admindocs.urls')), + + # Uncomment the next line to enable the admin: + # (r'^admin/', include(admin.site.urls)), + + (r'^$', root), + (r'^home/$', home), +) + +if settings.DEBUG: + media_url = settings.MEDIA_URL.strip('/') + urlpatterns += patterns('', + (r'^%s/(?P.*)$' % (media_url), 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), + ) diff --git a/views.py b/views.py new file mode 100644 index 0000000000..96f3edf7dc --- /dev/null +++ b/views.py @@ -0,0 +1,11 @@ +from django.http import HttpResponse, HttpResponseRedirect +from django.shortcuts import render_to_response +from django.core.urlresolvers import reverse +from django.template import RequestContext + +def root(request): + return HttpResponseRedirect(reverse(home)) + +def home(request): + return render_to_response('home.html', { + }, context_instance=RequestContext(request))