# Path: config/config.py



import os
import time
import zipfile
from BaseHTTPServer import BaseHTTPRequestHandler
from StringIO import StringIO
from config.config import MaildbRoot, reportRoot
from HTMLParser import HTMLParser, HTMLParseError
	f.close()
	print filename
	return filename	

def exportFile(msg_id, inFile):
	expFile = os.path.join(MaildbRoot, "web", "static", "downloads", "Export.zip")
	filePath = os.path.join(reportRoot, msg_id, "Case_Files", inFile)
	with zipfile.ZipFile(expFile, 'w') as myzip:
		myzip.write(filePath, inFile, zipfile.ZIP_DEFLATED)
	
def exportDir(msg_id, webID):
	
	if webID:
		msgDir = os.path.join(MaildbRoot, "store", msg_id, "sites", webID)
	else:
		msgDir = os.path.join(MaildbRoot, "store", msg_id)
	exp_file = os.path.join(MaildbRoot, "web", "static", "downloads", "Export.zip")
	zip = zipfile.ZipFile(exp_file, 'w', compression=zipfile.ZIP_DEFLATED)
	root_len = len(os.path.abspath(msgDir))
	for root, dirs, files in os.walk(msgDir):
		archive_root = os.path.abspath(root)[root_len:]
		for f in files:
			fullpath = os.path.join(root, f)
			archive_name = os.path.join(archive_root, f)
			zip.write(fullpath, archive_name, zipfile.ZIP_DEFLATED)
	zip.close()
	return exp_file


def listCaseFiles(msg_id):

# Path: config/config.py



# Path: core/common.py
import os
import time
import zipfile
from BaseHTTPServer import BaseHTTPRequestHandler
from StringIO import StringIO
from config.config import MaildbRoot, reportRoot
from HTMLParser import HTMLParser, HTMLParseError

	f.close()
	print filename
	return filename	

def exportFile(msg_id, inFile):
	expFile = os.path.join(MaildbRoot, "web", "static", "downloads", "Export.zip")
	filePath = os.path.join(reportRoot, msg_id, "Case_Files", inFile)
	with zipfile.ZipFile(expFile, 'w') as myzip:
		myzip.write(filePath, inFile, zipfile.ZIP_DEFLATED)
	
def exportDir(msg_id, webID):
	
	if webID:
		msgDir = os.path.join(MaildbRoot, "store", msg_id, "sites", webID)
	else:
		msgDir = os.path.join(MaildbRoot, "store", msg_id)
	exp_file = os.path.join(MaildbRoot, "web", "static", "downloads", "Export.zip")
	zip = zipfile.ZipFile(exp_file, 'w', compression=zipfile.ZIP_DEFLATED)
	root_len = len(os.path.abspath(msgDir))
	for root, dirs, files in os.walk(msgDir):
		archive_root = os.path.abspath(root)[root_len:]
		for f in files:
			fullpath = os.path.join(root, f)
			archive_name = os.path.join(archive_root, f)
			zip.write(fullpath, archive_name, zipfile.ZIP_DEFLATED)
	zip.close()
	return exp_file


def listCaseFiles(msg_id):

	casefileDir = os.path.join(reportRoot, msg_id, "Case_Files")