def showFolder(path, fullPath): libView.doHeader("Documents: " + path) folderHeader() if(not os.path.exists(fullPath)): print "<p>Invalid path</p>" else: files = os.listdir(fullPath) for f in files: ff = os.path.join(fullPath, f) if(os.path.isdir(ff)): libView.printf( "<p>Subdir: <a href=\"docs.py?path=%s%s/\">%s</a></p>", (toUrl(path), toUrl(f),toHtml(f),)) for f in files: if(f != "meta.json"): ff = os.path.join(fullPath, f) if(not os.path.isdir(ff)): libView.printf( "<p>File: <a href=\"docs.py?path=%s%s\">%s</a></p>", (toUrl(path), toUrl(f),toHtml(f),)) meta = getMeta(path) meta["count"] = meta.get("count",0) + 1 storeMeta(path, meta) libView.printf("<p>Folder has %d views</p>", meta["count"]) if(1): print "<h2>Upload</h2>" print "<form action=\"docs.py\" enctype=\"multipart/form-data\" method=\"post\">" libView.printf("<input type=\"file\" name=\"uploaded_file\" max_size=\"%s\">", (80 * 1024*1024,)) print "<input type=\"hidden\" name=\"action\" value=\"upload\">" libView.printf("<input type=\"hidden\" name=\"path\" value=\"%s\">", (toHtml(path),)) if(0): # option to require mime-type declaration on upload (otherwise just ask user-agent) filetypes = ("text/plain", "image/jpeg", "image/png", "application/pdf") print "<select>" for filetype in filetypes: libView.printf("<option name=\"%s\">%s</option>", (toHtml(filetype), toHtml(filetype),)) print "</select> " print "<input type=\"submit\" value=\"Upload\">" print "</form>" libView.doFooter();
#!/usr/bin/env python import libView; libView.doHeader(); print "<p><a href='admin_defcon.py'>Defcon levels</a></p>"; print "<p><a href='admin_encryption.py'>Encryption</a></p>"; print "<p><a href='admin_backups.py'>Backups</a></p>"; print "<p><a href='admin_login.py'>Passwords</a></p>"; print "<p><a href='admin_logging.py'>Logging</a></p>"; libView.doFooter();