##############################################################################
#
# Copyright (c) 2002 Ingeniweb SARL
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################

"""AttachmentField product"""
import os
import sys
import string

# Volatile or not volatile ?
_AF_VOLATILE_ = 1

# Check if we have to be in debug mode
if os.path.isfile(os.path.abspath(os.path.dirname(__file__)) + '/debug.txt'):
    DEBUG_MODE = 1
else:
    DEBUG_MODE = 0

# Get version
__version_file_ = open(os.path.abspath(os.path.dirname(__file__)) + '/version.txt', 'r', )
ATTACHMENTFIELD_VERSION = string.strip(__version_file_.read())
__version_file_.close()

# Text programs
if sys.platform == "win32":
    raw_conv = "type"
else:
    raw_conv = "cat"


# Set log options correctly
import Log
if DEBUG_MODE:
    Log.LOG_LEVEL = Log.LOG_DEBUG
else:
    Log.LOG_LEVEL = Log.LOG_NOTICE

from Log import *
Log = Log
Log(LOG_NOTICE, "Starting %s at %d debug level" % (os.path.dirname(__file__), LOG_LEVEL, ))



MAX_PREVIEW_SIZE = 1024 * 5                 # If preview is larger than that, doesn't return it in the getSmallPreview() method


# Configlets
from Products.CMFCore import CMFCorePermissions
attachmentfield_prefs_configlet = {
    'id': 'attachmentfield_prefs',
    'appId': "AttachmentField",
    'name': 'AttachmentField Preferences',
    'action': 'string:$portal_url/attachmentfield_prefs_form',
    'category': 'Products',
    'permission': (CMFCorePermissions.ManagePortal,),
    'imageUrl': 'AttachmentField.png',
    }
