Exemple #1
0
def FileApp(environ, start_response, struct=settings['serve_dir']):
    req = Request(environ)
    #===========================================================================
    # if struct:
    #    filename = 'C:%s' % req.path.replace('/file','').replace('/',os.path.sep)
    #    if os.path.isdir(filename):
    #        res = make_folder_response(filename, req)
    #        return res(environ, start_response)
    #    else:
    #        res = make_file_response(filename)
    #        return res(environ, start_response)
    # else:
    #===========================================================================
    filekey = req.path.replace('/file/','').split('/')[0]
    conn = sqlite3.connect(settings['db_name'])
    filename = db.query_filekey(filekey, conn)
    if filename:
        if os.path.isdir(filename):
            res = make_folder_response_zip(filename)
        elif os.path.isfile(filename):
            res = make_file_response(filename)
    else:
        res = Response(status='404')
        res.headers.add('Server', render('__server_info__'))
    return res(environ, start_response)
 def single(self):
     if not (cherrypy.session.get('login') == True) and not (cherrypy.session.get('ip') == cherrypy.request.remote.ip):
         raise cherrypy.HTTPRedirect(["/login/"], 302)
     return render(title="Upload",content="""
         <h2>Upload a file</h2>
         <form action="do" method="post" enctype="multipart/form-data">
         filename: <input type="file" name="myFile" /><br />
         <input type="submit" />
         </form>
     """)
Exemple #3
0
 def single(self):
     if not (cherrypy.session.get('login') == True) and not (
             cherrypy.session.get('ip') == cherrypy.request.remote.ip):
         raise cherrypy.HTTPRedirect(["/login/"], 302)
     return render(title="Upload",
                   content="""
         <h2>Upload a file</h2>
         <form action="do" method="post" enctype="multipart/form-data">
         filename: <input type="file" name="myFile" /><br />
         <input type="submit" />
         </form>
     """)
Exemple #4
0
 def index(self):
     if cherrypy.request.scheme == 'https' or not (settings.has_key('ssl_certificate') and settings.has_key('ssl_private_key')):
         return render(title='Login',content="""
         <form action="do" method="POST" style="padding-top:30px">
         <table width="300" align="center">
         <tr><td width="200px">Username: </td><td><input name="user" type="text" class="textfield"></td></tr>
         <tr><td width="200px">Password: </td><td><input name="passw" type="password" class="textfield"></td></tr>
         <tr><td></td><td align="right"><input name="submit" type="submit" class="button" value="Login"></td></tr>
         </table>
         </form>""")
     else:
         raise cherrypy.HTTPRedirect(["https://%s:%s/login/" % (settings['hostname'],settings['ssl_port'])], 302)
Exemple #5
0
 def index(self):
     if not (cherrypy.session.get('login') == True) and not (cherrypy.session.get('ip') == cherrypy.request.remote.ip):
         raise cherrypy.HTTPRedirect(["/login/"], 302)
     conn = sqlite3.connect(settings['db_name'])
     batches = db.query_batch_keys_for_user(cherrypy.session.get('user'), conn)
     conn.close()
     if batches:
         batchtmpl = """<table id="batches" align="center"><tr id="%s">
         <td width="200"><span>%s</span></td>
         <td>
         <div class="row fileupload-buttonbar">
                     <div class="span7">
                         <span class="btn btn-success fileinput-button" onclick="window.location = 'http://%s:%s/upload/?batch=%s'">
                             <i class="icon-plus icon-white"></i>
                             <span>Edit</span>
                         </span>
                         <span class="btn btn-primary start" onclick="window.location = 'http://%s:%s/file/%s'">
                             <i class="icon-upload icon-white"></i>
                             <span>Download</span>
                         </span>
                         <span class="btn btn-danger delete" title="Delete from batch and server" onclick="delete_key('%s')">
                             <i class="icon-trash icon-white"></i>
                             <span>Delete</span>
                         </span>
                     </div>
                 </div>
         </td>
         </tr>
         </table>"""
         batchhtml = ""
         for batch in batches:
             batchhtml += batchtmpl % (batch[0], batch[1], settings['hostname'],settings['port'],batch[0], settings['hostname'],settings['port'],batch[0], batch[0])
         return render(title=render('__server_info__'),content=batchhtml,login=True)
     else:
         return render(title=render('__server_info__'),content="""
         <div class="row" style="text-align:center;font-size:25px;padding-bottom:30px;color:grey;">Oops! You don't have any batches yet.</div>
         <div class="row" style="text-align:center;font-size:25px;padding-bottom:30px;color:grey;"><a href="/upload">Upload something here</a></div>""", login=True);
Exemple #6
0
def make_folder_response(foldername, req):
    if req.path_url.endswith('/'):
        fold_url = req.path_url[:-1]
    else:
        fold_url = req.path_url
    folderlist = [ '<html>' + #foldername +
                '<br>'.join( [('<a href="%s/%s">%s</a>' % (fold_url, filename, filename))
                                for filename in os.listdir(foldername)])
                                 + '</html>'   ]
    res = Response(content_type="text/html",
                   conditional_response=True)
    res.body = folderlist[0]
    res.headers.add('Server', render('__server_info__'))
    res.content_length = len(res.body)
    res.last_modified = os.path.getmtime(foldername)
    res.etag = '%s-%s-%s' % (os.path.getmtime(foldername),
                             os.path.getsize(foldername), hash(foldername))
    return res
Exemple #7
0
    def dosingle(self, myFile):
        if not (cherrypy.session.get('login') == True) and not (
                cherrypy.session.get('ip') == cherrypy.request.remote.ip):
            raise cherrypy.HTTPRedirect(["/login/"], 302)
        fpath = get_upload_path() + myFile.filename
        while os.path.exists(fpath):
            pathparts = fpath.split('.')
            pathparts[-2] += '_'
            fpath = ''
            for part in pathparts:
                fpath += part + '.'
            fpath = fpath[:-1]

        f = open(fpath, 'wb')
        size = 0
        while True:
            data = myFile.file.read(8192)
            if not data:
                break
            f.write(data)
            size += len(data)
        f.close()
        conn = sqlite3.connect(settings['db_name'])
        key = db.insert_file(fpath, cherrypy.session.get('user'), conn)

        hostaddr = cherrypy.request.local.ip
        hostport = cherrypy.request.local.port

        if hostaddr == '':
            hostaddr = 'localhost'
        print hostaddr
        if hostport != 80:
            absfilepath = '%s://%s:%s/file/%s/%s' % (cherrypy.request.scheme,
                                                     hostaddr, hostport, key,
                                                     myFile.filename)
        else:
            absfilepath = 'http://%s/file/%s/%s' % (hostaddr, key,
                                                    myFile.filename)

        return render(title="Upload complete",
                      content="""<h2>Upload Complete!</h2><br>
                                                        <div style="padding-left:15px;">The url for your file is:<br> %s</div>"""
                      % absfilepath)
Exemple #8
0
def make_file_response(filename):
    res = Response(content_type=get_mimetype(filename),
                   conditional_response=True)
    res.headers.add('Accept-Ranges','bytes')
    res.headers.add('Server', render('__server_info__'))
    res.headers.add('Content-Disposition',str('attachment; filename=%s'%(filename.split(os.path.sep)[-1])))
    res.app_iter = FileIterable(filename)
    #try:
    res.content_length = os.path.getsize(filename)
    res.last_modified = os.path.getmtime(filename)
    res.etag = '%s-%s-%s' % (os.path.getmtime(filename),
                             os.path.getsize(filename), hash(filename))
    #===========================================================================
    # except WindowsError, e:
    #    if e.errno == 2:
    #        del res
    #        res = Response(status='404')
    #        res.headers.add('Server', render('__server_info__'))
    #===========================================================================
    return res
    def dosingle(self, myFile):
        if not (cherrypy.session.get('login') == True) and not (cherrypy.session.get('ip') == cherrypy.request.remote.ip):
            raise cherrypy.HTTPRedirect(["/login/"], 302)
        fpath = get_upload_path()+myFile.filename
        while os.path.exists(fpath):
            pathparts = fpath.split('.')
            pathparts[-2]+='_'
            fpath = ''
            for part in pathparts:
                fpath += part + '.'
            fpath = fpath[:-1]
            
        f = open(fpath,'wb')
        size = 0
        while True:
            data = myFile.file.read(8192)
            if not data:
                break
            f.write(data)
            size += len(data)
        f.close()
        conn = sqlite3.connect(settings['db_name'])
        key = db.insert_file(fpath, cherrypy.session.get('user'), conn)   
             
        hostaddr = cherrypy.request.local.ip
        hostport = cherrypy.request.local.port

        if hostaddr == '': 
            hostaddr = 'localhost'
        print hostaddr 
        if hostport != 80:
            absfilepath = '%s://%s:%s/file/%s/%s' % (cherrypy.request.scheme, hostaddr, hostport, key, myFile.filename)
        else:
            absfilepath = 'http://%s/file/%s/%s' % (hostaddr, key, myFile.filename)
        
        return render(title="Upload complete",content="""<h2>Upload Complete!</h2><br>
                                                        <div style="padding-left:15px;">The url for your file is:<br> %s</div>""" % absfilepath)
Exemple #10
0
 def index(self, batch=None):
     if not (cherrypy.session.get('login') == True) and not (
             cherrypy.session.get('ip') == cherrypy.request.remote.ip):
         raise cherrypy.HTTPRedirect(["/login/"], 302)
     if cherrypy.request.scheme == 'https':
         raise cherrypy.HTTPRedirect(
             ["http://files.tech-keys.com:446/upload/"], 302)
     if batch:
         mkey = batch
     else:
         mkey = rand_alpha_numeric(15)
     return render(
         title="Upload",
         content="""
     <div class="container">
         <!-- The file upload form used as target for the file upload widget -->
         <form id="fileupload" action="http://""" + settings['hostname'] +
         ':' + str(settings['port']) +
         """/upload/do" method="post" enctype="multipart/form-data">
             <div class="row" style="text-align:center;font-size:30px;padding-bottom:15px;line-height:33px;">Download entire batch (zip): <a href="http://"""
         + settings['hostname'] + ':' + str(settings['port']) +
         """/file/""" + mkey + """">http://""" + settings['hostname'] +
         ':' + str(settings['port']) + """/file/""" + mkey + """</a></div>
             <div class="row" style="text-align:center;font-size:20px;padding-bottom:20px;"><a href="javascript:delete_key('"""
         + mkey + """')">Delete the entire batch</a></div>
             <div class="row" style="text-align:center;font-size:20px;padding-bottom:20px;">Friendly name: <input id="batchname" type="text" class="textfield"></div>
             <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
             <div class="row fileupload-buttonbar centered">
                 <div class="span7">
                     <!-- The fileinput-button span is used to style the file input field as button -->
                     <span class="btn btn-success fileinput-button">
                         <i class="icon-plus icon-white"></i>
                         <span>Add files...</span>
                         <input type="file" name="myFile" multiple="">
                     </span>
                     <span class="btn btn-success fileinput-button">
                         <i class="icon-plus icon-white"></i>
                         <span>Add folder...</span>
                         <input type="file" name="myFile" multiple="" webkitdirectory="true" directory="" title="Only works with Google Chrome 11+">
                     </span>
                     <button type="submit" class="btn btn-primary start">
                         <i class="icon-upload icon-white"></i>
                         <span>Start upload</span>
                     </button>
                     <button type="reset" class="btn btn-warning cancel">
                         <i class="icon-ban-circle icon-white"></i>
                         <span>Cancel upload</span>
                     </button>
                     <button type="button" class="btn btn-danger delete" title="Delete from batch and server">
                         <i class="icon-trash icon-white"></i>
                         <span>Delete</span>
                     </button>
                     <input type="checkbox" class="toggle" title="Select all">
                     <input type="hidden" id="key" name="key" value=\"""" +
         mkey + """\">
                 </div>
             </div>
            <br>
             <!-- The loading indicator is shown during image processing -->
             <div class="row" style="text-align:center;font-size:25px;padding-bottom:30px;color:grey;" title="Folders not yet supported by browers. IE not supported.">Drag and drop files below</div>
             
              <div class="row fileupload-buttonbar centered">
                 <div class="span5" style="width:100%; text-align:center; margin:0px;">
                     <!-- The global progress bar -->
                     <div class="progress progress-success progress-striped active fade">
                         <div class="bar" style="width:0%;"></div>
                     </div>
                 </div>
             </div>
             <div class="fileupload-loading"></div>
             <br>
             <!-- The table listing the files available for upload/download -->
             <table class="table table-striped"><tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody></table>
         </form>
         
         
     </div>
     <!-- modal-gallery is the modal dialog used for the image gallery -->
     <div id="modal-gallery" class="modal modal-gallery hide fade" data-filter=":odd">
         <div class="modal-header">
             <a class="close" data-dismiss="modal"></a>
             <h3 class="modal-title"></h3>
         </div>
         <div class="modal-body"><div class="modal-image"></div></div>
         <div class="modal-footer">
             <a class="btn modal-download" target="_blank">
                 <i class="icon-download"></i>
                 <span>Download</span>
             </a>
             <a class="btn btn-success modal-play modal-slideshow" data-slideshow="5000">
                 <i class="icon-play icon-white"></i>
                 <span>Slideshow</span>
             </a>
             <a class="btn btn-info modal-prev">
                 <i class="icon-arrow-left icon-white"></i>
                 <span>Previous</span>
             </a>
             <a class="btn btn-primary modal-next">
                 <span>Next</span>
                 <i class="icon-arrow-right icon-white"></i>
             </a>
         </div>
     </div>
          <!-- The template to display files available for upload -->
     <script id="template-upload" type="text/x-tmpl">
     {% for (var i=0, file; file=o.files[i]; i++) { %}
         <tr class="template-upload fade">
             <td class="preview"><span class="fade"></span></td>
             <td class="name"><span>{%=file.name%}</span></td>
             <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
             {% if (file.error) { %}
                 <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
             {% } else if (o.files.valid && !i) { %}
                 <td>
                     <div class="progress progress-success progress-striped active"><div class="bar" style="width:0%;"></div></div>
                 </td>
                 <td class="start">{% if (!o.options.autoUpload) { %}
                     <button class="btn btn-primary">
                         <i class="icon-upload icon-white"></i>
                         <span>{%=locale.fileupload.start%}</span>
                     </button>
                 {% } %}</td>
             {% } else { %}
                 <td colspan="2"></td>
             {% } %}
             <td class="cancel">{% if (!i) { %}
                 <button class="btn btn-warning">
                     <i class="icon-ban-circle icon-white"></i>
                     <span>{%=locale.fileupload.cancel%}</span>
                 </button>
             {% } %}</td>
         </tr>
     {% } %}
     </script>
     <!-- The template to display files available for download -->
     <script id="template-download" type="text/x-tmpl">
     {% for (var i=0, file; file=o.files[i]; i++) { %}
         <tr class="template-download fade">
             {% if (file.error) { %}
                 <td></td>
                 <td class="name"><span>{%=file.name%}</span></td>
                 <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
                 <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
             {% } else { %}
                 <td class="preview">{% if (file.thumbnail_url) { %}
                     <a href="{%=file.url%}" title="{%=file.name%}" rel="gallery" download="{%=file.name%}"><img src="{%=file.thumbnail_url%}"></a>
                 {% } %}</td>
                 <td class="name">
                     <a href="{%=file.url%}" title="{%=file.name%}" rel="{%=file.thumbnail_url&&'gallery'%}" download="{%=file.name%}">{%=file.name%}</a>
                 </td>
                 <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
                 <td colspan="2"></td>
             {% } %}
             <td class="delete">
                 <button class="btn btn-danger" data-type="{%=file.delete_type%}" data-url="{%=file.delete_url%}">
                     <i class="icon-trash icon-white"></i>
                     <span>{%=locale.fileupload.destroy%}</span>
                 </button>
                 <input type="checkbox" name="delete" value="1">
             </td>
         </tr>
     {% } %}
     </script>
     
     <!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included -->
     <script src="/static/js/vendor/jquery.ui.widget.js"></script>
     <!-- The Templates plugin is included to render the upload/download listings -->
     <script src="/static/js/tmpl.min.js"></script>
     <!-- The Load Image plugin is included for the preview images and image resizing functionality -->
     <script src="/static/js/load-image.min.js"></script>
     <!-- The Canvas to Blob plugin is included for image resizing functionality -->
     <script src="/static/js/canvas-to-blob.min.js"></script>
     <!-- Bootstrap JS and Bootstrap Image Gallery are not required, but included for the demo -->
     <script src="/static/js/bootstrap.min.js"></script>
     <script src="/static/js/bootstrap-image-gallery.min.js"></script>
     <!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
     <script src="/static/js/jquery.iframe-transport.js"></script>
     <!-- The basic File Upload plugin -->
     <script src="/static/js/jquery.fileupload.js"></script>
     <!-- The File Upload image processing plugin -->
     <script src="/static/js/jquery.fileupload-ip.js"></script>
     <!-- The File Upload user interface plugin -->
     <script src="/static/js/jquery.fileupload-ui.js"></script>
     <!-- The localization script -->
     <script src="/static/js/locale.js"></script>
     <!-- The main application script -->
     <script src="/static/js/main.js"></script>
     <!-- The XDomainRequest Transport is included for cross-domain file deletion for IE8+ -->
     <!--[if gte IE 8]><script src="/static/js/cors/jquery.xdr-transport.js"></script><![endif]-->
     """,
         login=True)
Exemple #11
0
 def err_404(status, message, traceback, version):
     return render(title='404 Not Found', content="Oops! The page you are looking for doesn't exist<br>%s" % status)
Exemple #12
0
 def index(self, batch=None):
     if not (cherrypy.session.get('login') == True) and not (cherrypy.session.get('ip') == cherrypy.request.remote.ip):
         raise cherrypy.HTTPRedirect(["/login/"], 302)
     if cherrypy.request.scheme == 'https':
         raise cherrypy.HTTPRedirect(["http://files.tech-keys.com:446/upload/"], 302)
     if batch:
         mkey = batch
     else:
         mkey = rand_alpha_numeric(15)
     return render(title="Upload", content="""
     <div class="container">
         <!-- The file upload form used as target for the file upload widget -->
         <form id="fileupload" action="http://"""+settings['hostname']+':'+str(settings['port'])+"""/upload/do" method="post" enctype="multipart/form-data">
             <div class="row" style="text-align:center;font-size:30px;padding-bottom:15px;line-height:33px;">Download entire batch (zip): <a href="http://"""+settings['hostname']+':'+str(settings['port'])+"""/file/"""+mkey+"""">http://"""+settings['hostname']+':'+str(settings['port'])+"""/file/"""+mkey+"""</a></div>
             <div class="row" style="text-align:center;font-size:20px;padding-bottom:20px;"><a href="javascript:delete_key('"""+mkey+"""')">Delete the entire batch</a></div>
             <div class="row" style="text-align:center;font-size:20px;padding-bottom:20px;">Friendly name: <input id="batchname" type="text" class="textfield"></div>
             <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
             <div class="row fileupload-buttonbar centered">
                 <div class="span7">
                     <!-- The fileinput-button span is used to style the file input field as button -->
                     <span class="btn btn-success fileinput-button">
                         <i class="icon-plus icon-white"></i>
                         <span>Add files...</span>
                         <input type="file" name="myFile" multiple="">
                     </span>
                     <span class="btn btn-success fileinput-button">
                         <i class="icon-plus icon-white"></i>
                         <span>Add folder...</span>
                         <input type="file" name="myFile" multiple="" webkitdirectory="true" directory="" title="Only works with Google Chrome 11+">
                     </span>
                     <button type="submit" class="btn btn-primary start">
                         <i class="icon-upload icon-white"></i>
                         <span>Start upload</span>
                     </button>
                     <button type="reset" class="btn btn-warning cancel">
                         <i class="icon-ban-circle icon-white"></i>
                         <span>Cancel upload</span>
                     </button>
                     <button type="button" class="btn btn-danger delete" title="Delete from batch and server">
                         <i class="icon-trash icon-white"></i>
                         <span>Delete</span>
                     </button>
                     <input type="checkbox" class="toggle" title="Select all">
                     <input type="hidden" id="key" name="key" value=\""""+mkey+"""\">
                 </div>
             </div>
            <br>
             <!-- The loading indicator is shown during image processing -->
             <div class="row" style="text-align:center;font-size:25px;padding-bottom:30px;color:grey;" title="Folders not yet supported by browers. IE not supported.">Drag and drop files below</div>
             
              <div class="row fileupload-buttonbar centered">
                 <div class="span5" style="width:100%; text-align:center; margin:0px;">
                     <!-- The global progress bar -->
                     <div class="progress progress-success progress-striped active fade">
                         <div class="bar" style="width:0%;"></div>
                     </div>
                 </div>
             </div>
             <div class="fileupload-loading"></div>
             <br>
             <!-- The table listing the files available for upload/download -->
             <table class="table table-striped"><tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody></table>
         </form>
         
         
     </div>
     <!-- modal-gallery is the modal dialog used for the image gallery -->
     <div id="modal-gallery" class="modal modal-gallery hide fade" data-filter=":odd">
         <div class="modal-header">
             <a class="close" data-dismiss="modal"></a>
             <h3 class="modal-title"></h3>
         </div>
         <div class="modal-body"><div class="modal-image"></div></div>
         <div class="modal-footer">
             <a class="btn modal-download" target="_blank">
                 <i class="icon-download"></i>
                 <span>Download</span>
             </a>
             <a class="btn btn-success modal-play modal-slideshow" data-slideshow="5000">
                 <i class="icon-play icon-white"></i>
                 <span>Slideshow</span>
             </a>
             <a class="btn btn-info modal-prev">
                 <i class="icon-arrow-left icon-white"></i>
                 <span>Previous</span>
             </a>
             <a class="btn btn-primary modal-next">
                 <span>Next</span>
                 <i class="icon-arrow-right icon-white"></i>
             </a>
         </div>
     </div>
          <!-- The template to display files available for upload -->
     <script id="template-upload" type="text/x-tmpl">
     {% for (var i=0, file; file=o.files[i]; i++) { %}
         <tr class="template-upload fade">
             <td class="preview"><span class="fade"></span></td>
             <td class="name"><span>{%=file.name%}</span></td>
             <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
             {% if (file.error) { %}
                 <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
             {% } else if (o.files.valid && !i) { %}
                 <td>
                     <div class="progress progress-success progress-striped active"><div class="bar" style="width:0%;"></div></div>
                 </td>
                 <td class="start">{% if (!o.options.autoUpload) { %}
                     <button class="btn btn-primary">
                         <i class="icon-upload icon-white"></i>
                         <span>{%=locale.fileupload.start%}</span>
                     </button>
                 {% } %}</td>
             {% } else { %}
                 <td colspan="2"></td>
             {% } %}
             <td class="cancel">{% if (!i) { %}
                 <button class="btn btn-warning">
                     <i class="icon-ban-circle icon-white"></i>
                     <span>{%=locale.fileupload.cancel%}</span>
                 </button>
             {% } %}</td>
         </tr>
     {% } %}
     </script>
     <!-- The template to display files available for download -->
     <script id="template-download" type="text/x-tmpl">
     {% for (var i=0, file; file=o.files[i]; i++) { %}
         <tr class="template-download fade">
             {% if (file.error) { %}
                 <td></td>
                 <td class="name"><span>{%=file.name%}</span></td>
                 <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
                 <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
             {% } else { %}
                 <td class="preview">{% if (file.thumbnail_url) { %}
                     <a href="{%=file.url%}" title="{%=file.name%}" rel="gallery" download="{%=file.name%}"><img src="{%=file.thumbnail_url%}"></a>
                 {% } %}</td>
                 <td class="name">
                     <a href="{%=file.url%}" title="{%=file.name%}" rel="{%=file.thumbnail_url&&'gallery'%}" download="{%=file.name%}">{%=file.name%}</a>
                 </td>
                 <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
                 <td colspan="2"></td>
             {% } %}
             <td class="delete">
                 <button class="btn btn-danger" data-type="{%=file.delete_type%}" data-url="{%=file.delete_url%}">
                     <i class="icon-trash icon-white"></i>
                     <span>{%=locale.fileupload.destroy%}</span>
                 </button>
                 <input type="checkbox" name="delete" value="1">
             </td>
         </tr>
     {% } %}
     </script>
     
     <!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included -->
     <script src="/static/js/vendor/jquery.ui.widget.js"></script>
     <!-- The Templates plugin is included to render the upload/download listings -->
     <script src="/static/js/tmpl.min.js"></script>
     <!-- The Load Image plugin is included for the preview images and image resizing functionality -->
     <script src="/static/js/load-image.min.js"></script>
     <!-- The Canvas to Blob plugin is included for image resizing functionality -->
     <script src="/static/js/canvas-to-blob.min.js"></script>
     <!-- Bootstrap JS and Bootstrap Image Gallery are not required, but included for the demo -->
     <script src="/static/js/bootstrap.min.js"></script>
     <script src="/static/js/bootstrap-image-gallery.min.js"></script>
     <!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
     <script src="/static/js/jquery.iframe-transport.js"></script>
     <!-- The basic File Upload plugin -->
     <script src="/static/js/jquery.fileupload.js"></script>
     <!-- The File Upload image processing plugin -->
     <script src="/static/js/jquery.fileupload-ip.js"></script>
     <!-- The File Upload user interface plugin -->
     <script src="/static/js/jquery.fileupload-ui.js"></script>
     <!-- The localization script -->
     <script src="/static/js/locale.js"></script>
     <!-- The main application script -->
     <script src="/static/js/main.js"></script>
     <!-- The XDomainRequest Transport is included for cross-domain file deletion for IE8+ -->
     <!--[if gte IE 8]><script src="/static/js/cors/jquery.xdr-transport.js"></script><![endif]-->
     """, login=True)
Exemple #13
0
 def index(self):
     return render(title='Register',content='<form action="do" method="POST"><input type="hidden" name="create" style="visibilty: hidden">Username: <input name="name" type="text" class="textfield"><br>Email: <input name="email" type="text" class="textfield"><br>Password: <input name="pass" type="text" class="textfield"><br><input name="" type="submit" class="button" value="Register"></form>')