PREFIX
This commit is contained in:
parent
61ca7fabc1
commit
5379b45b53
6 changed files with 24 additions and 18 deletions
|
@ -11,6 +11,7 @@ from django.db import models
|
|||
from django.core.files.base import ContentFile
|
||||
from django.db.models.signals import pre_delete
|
||||
from django.contrib.auth.models import User, Group
|
||||
from django.conf import settings
|
||||
|
||||
import ox
|
||||
from ox.django import fields
|
||||
|
@ -51,13 +52,13 @@ class Item(models.Model):
|
|||
return ox.format_bytes(size)
|
||||
|
||||
def get_absolute_url(self):
|
||||
return '/%s' % self.slug
|
||||
return '%s/%s' % (settings.PREFIX, self.slug)
|
||||
|
||||
def get_absolute_pdf_url(self):
|
||||
filename = self.filename
|
||||
if not filename.endswith('.pdf'):
|
||||
filename += '.pdf'
|
||||
return '/%s/%s' % (self.slug, quote(filename))
|
||||
return '%s/%s' % (self.get_absolute_url(), quote(filename))
|
||||
|
||||
def path(self, filename):
|
||||
if len(filename) > 1024:
|
||||
|
|
|
@ -11,6 +11,7 @@ from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
|
|||
from django.views.decorators.http import condition
|
||||
from django import forms
|
||||
from django.db.models import F
|
||||
from django.conf import settings
|
||||
|
||||
from ox.django.http import HttpFileResponse
|
||||
from ox.django.shortcuts import render_to_json_response, json_response
|
||||
|
@ -85,7 +86,8 @@ def add(request):
|
|||
|
||||
def index(request):
|
||||
context = RequestContext(request, {
|
||||
'anonymous': request.user.is_anonymous()
|
||||
'PREFIX': settings.PREFIX,
|
||||
'anonymous': request.user.is_anonymous(),
|
||||
})
|
||||
return render_to_response('index.html', context)
|
||||
|
||||
|
@ -93,6 +95,7 @@ def item(request, slug):
|
|||
item = get_object_or_404(models.Item, slug=slug)
|
||||
editable = item.editable(request.user)
|
||||
context = RequestContext(request, {
|
||||
'PREFIX': settings.PREFIX,
|
||||
'item': item,
|
||||
'editable': json.dumps(editable)
|
||||
})
|
||||
|
|
|
@ -27,7 +27,7 @@ var SCROLLBAR_PADDING = 40;
|
|||
var VERTICAL_PADDING = 5;
|
||||
var MIN_SCALE = 0.25;
|
||||
var MAX_SCALE = 4.0;
|
||||
var IMAGE_DIR = '/static/images/';
|
||||
var IMAGE_DIR = PREFIX + '/static/images/';
|
||||
var SETTINGS_MEMORY = 20;
|
||||
var ANNOT_MIN_SIZE = 10;
|
||||
var RenderingStates = {
|
||||
|
@ -43,7 +43,7 @@ var FindStates = {
|
|||
FIND_PENDING: 3
|
||||
};
|
||||
|
||||
PDFJS.workerSrc = '/static/pdf.js';
|
||||
PDFJS.workerSrc = PREFIX + '/static/pdf.js';
|
||||
|
||||
var mozL10n = document.mozL10n || document.webL10n;
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>videopdf</title>
|
||||
<script src="/static/js/jquery.js" type="text/javascript"></script>
|
||||
<script src="/static/js/chunkupload.js" type="text/javascript"></script>
|
||||
<script src="/static/js/upload.js?1" type="text/javascript"></script>
|
||||
<script src="{{PREFIX}}/static/js/jquery.js" type="text/javascript"></script>
|
||||
<script src="{{PREFIX}}/static/js/chunkupload.js" type="text/javascript"></script>
|
||||
<script src="{{PREFIX}}/static/js/upload.js?1" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>videopdf</h1>
|
||||
|
|
|
@ -21,24 +21,25 @@ limitations under the License.
|
|||
<title>{{item.filename}}</title>
|
||||
|
||||
|
||||
<link rel="stylesheet" href="/static/viewer.css"/>
|
||||
<link rel="stylesheet" href="{{PREFIX}}/static/viewer.css"/>
|
||||
|
||||
<script type="text/javascript" src="/static/oxjs/Ox.js"></script>
|
||||
<script type="text/javascript" src="/static/compatibility.js"></script>
|
||||
<script type="text/javascript" src="{{PREFIX}}/static/oxjs/Ox.js"></script>
|
||||
<script type="text/javascript" src="{{PREFIX}}/static/compatibility.js"></script>
|
||||
|
||||
<!-- This snippet is used in production, see Makefile -->
|
||||
<link rel="resource" type="application/l10n" href="/static/locale/locale.properties"/>
|
||||
<script type="text/javascript" src="/static/l10n.js"></script>
|
||||
<script type="text/javascript" src="/static/pdf.js"></script>
|
||||
<script type="text/javascript" src="/static/debugger.js"></script>
|
||||
<link rel="resource" type="application/l10n" href="{{PREFIX}}/static/locale/locale.properties"/>
|
||||
<script type="text/javascript" src="{{PREFIX}}/static/l10n.js"></script>
|
||||
<script type="text/javascript" src="{{PREFIX}}/static/pdf.js"></script>
|
||||
<script type="text/javascript" src="{{PREFIX}}/static/debugger.js"></script>
|
||||
<script type="text/javascript">
|
||||
var PREFIX = '{{PREFIX}}';
|
||||
var DEFAULT_URL = '{{item.get_absolute_pdf_url}}';
|
||||
var videoOverlay = {{item.get_overlay|safe}};
|
||||
var editable = {{editable}};
|
||||
</script>
|
||||
<script type="text/javascript" src="/static/videoOverlay.js"></script>
|
||||
<script type="text/javascript" src="/static/viewer.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/videopdf.css"/>
|
||||
<script type="text/javascript" src="{{PREFIX}}/static/videoOverlay.js"></script>
|
||||
<script type="text/javascript" src="{{PREFIX}}/static/viewer.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="{{PREFIX}}/static/css/videopdf.css"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
|
@ -69,6 +69,7 @@ STATIC_ROOT = join(PROJECT_ROOT, 'static')
|
|||
# Example: "http://media.lawrence.com/static/"
|
||||
STATIC_URL = '/static/'
|
||||
|
||||
PREFIX=''
|
||||
# Additional locations of static files
|
||||
STATICFILES_DIRS = (
|
||||
# Put strings here, like "/home/html/static" or "C:/www/django/static".
|
||||
|
|
Loading…
Reference in a new issue