Commit 1ce2d8d0 authored by Michael Murtaugh's avatar Michael Murtaugh
Browse files

preview mode

parent 7e852f1e
......@@ -41,7 +41,7 @@ td.filecontrols.active {
{% if item.is_dir %}
<tr class="{{item.classes}}"><td class="filecontrols" valign="top"><a class="filecontrols" href="{{item.link}}"><img src="/__makeserver__/icons/directory.symbolic.png" alt="[DIR]"></a></td><td class="filename"><a href="{{item.link}}">{{item.label}}</a></td><td align="right">{% if item.lasmod %}{{item.lastmod | strftime("%Y-%m-%d %H:%M")}}{%else%}&mdash;{%endif%}</td><td align="right"> - </td><td>&nbsp;</td></tr>
{% else %}
<tr class="{{item.classes}}"><td class="filecontrols" valign="top"><a class="filecontrols" href="{{item.link}}?edit"><img src="/__makeserver__/icons/{% if item.is_text %}text{%else%}generic{%endif%}.symbolic.png" alt="[ ]" border="0"></a></td><td class="filename"><a href="{{item.link}}{% if False %}?edit{% endif %}">{{item.label}}</a></td><td align="right">{% if item.lastmod %}{{item.lastmod | strftime("%Y-%m-%d %H:%M")}}{%else%}&mdash;{%endif%} </td><td align="right">{{item.size|humanize_bytes}}</td><td>&nbsp;</td></tr>
<tr class="{{item.classes}}"><td class="filecontrols" valign="top"><a class="filecontrols" href="{{item.link}}?edit"><img src="/__makeserver__/icons/{% if item.is_text %}text{%else%}generic{%endif%}.symbolic.png" alt="[ ]" border="0"></a></td><td class="filename"><a href="{{item.link}}{% if item.remake %}?preview{% endif %}">{{item.label}}</a></td><td align="right">{% if item.lastmod %}{{item.lastmod | strftime("%Y-%m-%d %H:%M")}}{%else%}&mdash;{%endif%} </td><td align="right">{{item.size|humanize_bytes}}</td><td>&nbsp;</td></tr>
{% endif %}
{% endfor %}
</table>
......
......@@ -178,6 +178,28 @@ class FileSaver (Resource):
# self.makeRequestsQueue.put({'path': self.path, 'request': request, 'makefile': self.makefile, 'cwd': self.docroot})
# return NOT_DONE_YET
class PreFileMaker (Resource):
def __init__(self, path, force=False):
self.path = path
self.isLeaf = True
self.force = force
def render_GET(self, request):
# print ("FileSaver.POST", self.path, request)
redurl = self.path
if self.force:
redurl += "?force"
return """<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0; url={0}">
</head>
<body>
<img src="/__makeserver__/icons/underconstruction.gif" /> Making {1}...
</body>
</html>
""".format(redurl, self.path.lstrip("/"))
class FileMaker (Resource):
def __init__(self, path, makeRequestsQueue, docroot, index="index.html", makefile=None, force=False, target=False):
# print ("FileMaker", path, docroot, makefile)
......@@ -227,6 +249,9 @@ class FileMaker (Resource):
r = make_question_simple(fpath, self.makefile, self.docroot)
force = 'remake' in query
if r == 1 or force:
if 'preview' in query:
# Give a WAIT PAGE
return PreFileMaker(request.path, force in query)
ret = FileMaker(fpath, self.makeRequestsQueue, self.docroot, self.index, self.makefile, force=force)
ret.isLeaf = True
return ret
......
......@@ -197,6 +197,9 @@ class MakeDirectoryListing (object):
items.append({
'is_dir': is_dir,
'is_text': is_text,
'remake': remake,
'missing': missing,
'makeable': makeable,
'link': link,
'label': label.decode("utf-8"),
'lastmod': lastmod,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment