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