1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-04-27 19:05:16 +00:00

Inital commit of seahub

This commit is contained in:
plt 2011-03-19 13:15:02 +08:00
commit b3913eb0f5
18 changed files with 350 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
*.pyc
*~
seahub.db
local_settings.py
startserver.sh

0
__init__.py Normal file
View File

0
basic/__init__.py Normal file
View File

3
basic/models.py Normal file
View File

@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

23
basic/tests.py Normal file
View File

@ -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
"""}

1
basic/views.py Normal file
View File

@ -0,0 +1 @@
# Create your views here.

11
manage.py Executable file
View File

@ -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)

73
media/css/seahub.css Normal file
View File

@ -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 */

BIN
media/img/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 633 B

BIN
media/img/li.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 B

BIN
media/img/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

109
settings.py Normal file
View File

@ -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)

9
templates/404.html Normal file
View File

@ -0,0 +1,9 @@
{% extends "base.html" %}
{% block title %}Page not found{% endblock %}
{% block content %}
<h1>Page not found</h1>
<p>Sorry, but the requested page could not be found.</p>
{% endblock %}

15
templates/500.html Normal file
View File

@ -0,0 +1,15 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Page unavailable</title>
</head>
<body>
<h1>Page unavailable</h1>
<p>Sorry, but the requested page is unavailable due to a
server hiccup.</p>
<p>Our engineers have been notified, so check back later.</p>
</body>
</html>

61
templates/base.html Normal file
View File

@ -0,0 +1,61 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{% block title %}{% endblock %} - SeaHub</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="keywords" content="文件 共享" />
<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/seahub.css" />
<link rel="icon" type="image/png" href="{{ MEDIA_URL }}img/favicon.png" />
{% block extra_style %}{% endblock %}
{% block extra_script %}{% endblock %}
</head>
<body>
<div id="wrapper">
<div id="header">
<img id="logo" src="{{ MEDIA_URL }}img/logo.png" title="Seafile" />
<div class="navs">
<ul class="nav">
<li>
<a href="/home/">Home</a>
</li>
<li>
<a href="/msgs/">Messages</a>
</li>
<li>
<a href="/files/">Files</a>
</li>
<li>
<a href="/peers/">Peers</a>
</li>
<li>
<a href="/groups/">Groups</a>
</li>
<li>
<a href="/settings/">Settings</a>
</li>
</ul>
</div>
<div class="nav-separator"></div>
</div>
<div id="main">
<div id="left-panel">
</div>
<div id="right-panel">
</div>
<div id="main-panel">
</div>
<div class="clear"></div>
</div>
<div id="footer">
<p class="fleft">Copyright © 2011 GongGeng. All rights reserved.</p>
<p class="fright">Contact | About</p>
<div class="clear"></div>
</div>
</div><!-- wrapper -->
</body>
</html>

1
templates/home.html Normal file
View File

@ -0,0 +1 @@
{% extends "base.html" %}

28
urls.py Normal file
View File

@ -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<path>.*)$' % (media_url), 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
)

11
views.py Normal file
View File

@ -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))