appy.gen: first Ploneless version.
|
@ -1,5 +1,5 @@
|
|||
'''This file contains the main Generator class used for generating a
|
||||
Plone 2.5-compliant product.'''
|
||||
'''This file contains the main Generator class used for generating a Zope
|
||||
product.'''
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
import os, os.path, re, sys
|
||||
|
@ -13,20 +13,6 @@ from descriptors import ClassDescriptor, ToolClassDescriptor, \
|
|||
UserClassDescriptor, TranslationClassDescriptor
|
||||
from model import ModelClass, User, Tool, Translation
|
||||
|
||||
# Common methods that need to be defined on every Archetype class --------------
|
||||
COMMON_METHODS = '''
|
||||
def getTool(self): return self.%s
|
||||
def getProductConfig(self): return Products.%s.config
|
||||
def skynView(self):
|
||||
"""Redirects to skyn/view. Transfers the status message if any."""
|
||||
rq = self.REQUEST
|
||||
msg = rq.get('portal_status_message', '')
|
||||
if msg:
|
||||
url = self.getUrl(portal_status_message=msg)
|
||||
else:
|
||||
url = self.getUrl()
|
||||
return rq.RESPONSE.redirect(url)
|
||||
'''
|
||||
# ------------------------------------------------------------------------------
|
||||
class Generator(AbstractGenerator):
|
||||
'''This generator generates a Plone 2.5-compliant product from a given
|
||||
|
@ -45,15 +31,10 @@ class Generator(AbstractGenerator):
|
|||
# i18n labels to generate
|
||||
self.labels = [] # i18n labels
|
||||
self.toolInstanceName = 'portal_%s' % self.applicationName.lower()
|
||||
self.skinsFolder = 'skins/%s' % self.applicationName
|
||||
# The following dict, pre-filled in the abstract generator, contains a
|
||||
# series of replacements that need to be applied to file templates to
|
||||
# generate files.
|
||||
commonMethods = COMMON_METHODS % \
|
||||
(self.toolInstanceName, self.applicationName)
|
||||
self.repls.update(
|
||||
{'toolInstanceName': self.toolInstanceName,
|
||||
'commonMethods': commonMethods})
|
||||
self.repls.update({'toolInstanceName': self.toolInstanceName})
|
||||
self.referers = {}
|
||||
|
||||
versionRex = re.compile('(.*?\s+build)\s+(\d+)')
|
||||
|
@ -160,14 +141,12 @@ class Generator(AbstractGenerator):
|
|||
self.generateTool()
|
||||
self.generateInit()
|
||||
self.generateTests()
|
||||
if self.config.frontPage: self.generateFrontPage()
|
||||
self.copyFile('Install.py', self.repls, destFolder='Extensions')
|
||||
self.generateConfigureZcml()
|
||||
self.copyFile('import_steps.xml', self.repls,
|
||||
destFolder='profiles/default')
|
||||
self.copyFile('ProfileInit.py', self.repls, destFolder='profiles',
|
||||
destName='__init__.py')
|
||||
self.copyFile('tool.gif', {})
|
||||
# Create version.txt
|
||||
f = open(os.path.join(self.outputFolder, 'version.txt'), 'w')
|
||||
f.write(self.version)
|
||||
|
@ -334,7 +313,7 @@ class Generator(AbstractGenerator):
|
|||
['"%s"' % r for r in self.config.defaultCreators])
|
||||
# Compute list of add permissions
|
||||
addPermissions = ''
|
||||
for classDescr in classesButTool:
|
||||
for classDescr in classesAll:
|
||||
addPermissions += ' "%s":"%s: Add %s",\n' % (classDescr.name,
|
||||
self.applicationName, classDescr.name)
|
||||
repls['addPermissions'] = addPermissions
|
||||
|
@ -492,30 +471,6 @@ class Generator(AbstractGenerator):
|
|||
repls['modulesWithTests'] = ','.join(modules)
|
||||
self.copyFile('testAll.py', repls, destFolder='tests')
|
||||
|
||||
def generateFrontPage(self):
|
||||
fp = self.config.frontPage
|
||||
repls = self.repls.copy()
|
||||
template = 'frontPage.pt'
|
||||
if self.config.frontPageTemplate== 'appy': template = 'frontPageAppy.pt'
|
||||
if fp == True:
|
||||
# We need a front page, but no specific one has been given.
|
||||
# So we will create a basic one that will simply display
|
||||
# some translated text.
|
||||
self.labels.append(PoMessage('front_page_text', '',
|
||||
PoMessage.FRONT_PAGE_TEXT))
|
||||
repls['pageContent'] = '<span tal:replace="structure python: ' \
|
||||
'tool.translateWithMapping(\'front_page_text\')"/>'
|
||||
else:
|
||||
# The user has specified a macro to show. So in the generated front
|
||||
# page, we will call this macro. The user will need to add itself
|
||||
# a .pt file containing this macro in the skins folder of the
|
||||
# generated Plone product.
|
||||
page, macro = fp.split('/')
|
||||
repls['pageContent'] = '<metal:call use-macro=' \
|
||||
'"context/%s/macros/%s"/>' % (page, macro)
|
||||
self.copyFile(template, repls, destFolder=self.skinsFolder,
|
||||
destName='%sFrontPage.pt' % self.applicationName)
|
||||
|
||||
def generateTool(self):
|
||||
'''Generates the Plone tool that corresponds to this application.'''
|
||||
Msg = PoMessage
|
||||
|
@ -536,13 +491,9 @@ class Generator(AbstractGenerator):
|
|||
Msg('%s_plural' % klass.name,'', klass.name+'s')]
|
||||
repls = self.repls.copy()
|
||||
repls.update({'methods': klass.methods, 'genClassName': klass.name,
|
||||
'imports': '','baseMixin':'BaseMixin', 'baseSchema': 'BaseSchema',
|
||||
'global_allow': 1, 'parents': 'BaseMixin, BaseContent',
|
||||
'static': '',
|
||||
'baseMixin':'BaseMixin', 'parents': 'BaseMixin, SimpleItem',
|
||||
'classDoc': 'User class for %s' % self.applicationName,
|
||||
'implements': "(getattr(BaseContent,'__implements__',()),)",
|
||||
'register': "registerType(%s, '%s')" % (klass.name,
|
||||
self.applicationName)})
|
||||
'icon':'object.gif'})
|
||||
self.copyFile('Class.py', repls, destName='%s.py' % klass.name)
|
||||
|
||||
# Before generating the Tool class, finalize it with query result
|
||||
|
@ -567,18 +518,9 @@ class Generator(AbstractGenerator):
|
|||
# Generate the Tool class
|
||||
repls = self.repls.copy()
|
||||
repls.update({'methods': self.tool.methods,
|
||||
'genClassName': self.tool.name, 'imports':'', 'baseMixin':'ToolMixin',
|
||||
'baseSchema': 'OrderedBaseFolderSchema', 'global_allow': 0,
|
||||
'parents': 'ToolMixin, UniqueObject, OrderedBaseFolder',
|
||||
'classDoc': 'Tool class for %s' % self.applicationName,
|
||||
'implements': "(getattr(UniqueObject,'__implements__',()),) + " \
|
||||
"(getattr(OrderedBaseFolder,'__implements__',()),)",
|
||||
'register': "registerType(%s, '%s')" % (self.tool.name,
|
||||
self.applicationName),
|
||||
'static': "def __init__(self, id=None):\n " \
|
||||
" OrderedBaseFolder.__init__(self, '%s')\n " \
|
||||
" self.setTitle('%s')\n" % (self.toolInstanceName,
|
||||
self.applicationName)})
|
||||
'genClassName': self.tool.name, 'baseMixin':'ToolMixin',
|
||||
'parents': 'ToolMixin, Folder', 'icon': 'folder.gif',
|
||||
'classDoc': 'Tool class for %s' % self.applicationName})
|
||||
self.copyFile('Class.py', repls, destName='%s.py' % self.tool.name)
|
||||
|
||||
def generateClass(self, classDescr):
|
||||
|
@ -588,45 +530,19 @@ class Generator(AbstractGenerator):
|
|||
print 'Generating %s.%s (gen-class)...' % (k.__module__, k.__name__)
|
||||
if not classDescr.isAbstract():
|
||||
self.tool.addWorkflowFields(classDescr)
|
||||
# Determine base archetypes schema and class
|
||||
baseClass = 'BaseContent'
|
||||
baseSchema = 'BaseSchema'
|
||||
if classDescr.isFolder():
|
||||
baseClass = 'OrderedBaseFolder'
|
||||
baseSchema = 'OrderedBaseFolderSchema'
|
||||
parents = ['BaseMixin', baseClass]
|
||||
imports = []
|
||||
implements = [baseClass]
|
||||
for baseClass in classDescr.klass.__bases__:
|
||||
if self.determineAppyType(baseClass) == 'class':
|
||||
bcName = getClassName(baseClass)
|
||||
parents.remove('BaseMixin')
|
||||
parents.insert(0, bcName)
|
||||
implements.append(bcName)
|
||||
imports.append('from %s import %s' % (bcName, bcName))
|
||||
baseSchema = '%s.schema' % bcName
|
||||
break
|
||||
parents = ','.join(parents)
|
||||
implements = '+'.join(['(getattr(%s,"__implements__",()),)' % i \
|
||||
for i in implements])
|
||||
classDoc = classDescr.klass.__doc__
|
||||
if not classDoc:
|
||||
classDoc = 'Class generated with appy.gen.'
|
||||
# If the class is abstract I will not register it
|
||||
register = "registerType(%s, '%s')" % (classDescr.name,
|
||||
self.applicationName)
|
||||
if classDescr.isAbstract():
|
||||
register = ''
|
||||
# Determine base Zope class
|
||||
isFolder = classDescr.isFolder()
|
||||
baseClass = isFolder and 'Folder' or 'SimpleItem'
|
||||
icon = isFolder and 'folder.gif' or 'object.gif'
|
||||
parents = 'BaseMixin, %s' % baseClass
|
||||
classDoc = classDescr.klass.__doc__ or 'Appy class.'
|
||||
repls = self.repls.copy()
|
||||
classDescr.generateSchema()
|
||||
repls.update({
|
||||
'imports': '\n'.join(imports), 'parents': parents,
|
||||
'className': classDescr.klass.__name__, 'global_allow': 1,
|
||||
'parents': parents, 'className': classDescr.klass.__name__,
|
||||
'genClassName': classDescr.name, 'baseMixin':'BaseMixin',
|
||||
'classDoc': classDoc, 'applicationName': self.applicationName,
|
||||
'methods': classDescr.methods, 'implements': implements,
|
||||
'baseSchema': baseSchema, 'static': '', 'register': register,
|
||||
'toolInstanceName': self.toolInstanceName})
|
||||
'methods': classDescr.methods, 'icon':icon})
|
||||
fileName = '%s.py' % classDescr.name
|
||||
# Create i18n labels (class name and plural form)
|
||||
poMsg = PoMessage(classDescr.name, '', classDescr.klass.__name__)
|
||||
|
|
|
@ -7,18 +7,38 @@ from StringIO import StringIO
|
|||
from sets import Set
|
||||
import appy
|
||||
import appy.version
|
||||
from appy.gen import Type, Ref, String
|
||||
from appy.gen import Type, Ref, String, File
|
||||
from appy.gen.po import PoParser
|
||||
from appy.gen.utils import produceNiceMessage, updateRolesForPermission
|
||||
from appy.gen.utils import produceNiceMessage, updateRolesForPermission, \
|
||||
createObject
|
||||
from appy.shared.data import languages
|
||||
from migrator import Migrator
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
class ZCTextIndexInfo:
|
||||
'''Silly class used for storing information about a ZCTextIndex.'''
|
||||
lexicon_id = "plone_lexicon"
|
||||
index_type = 'Okapi BM25 Rank'
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
homePage = '''
|
||||
<tal:main define="tool python: context.config">
|
||||
<html metal:use-macro="context/ui/template/macros/main">
|
||||
<div metal:fill-slot="content">
|
||||
<span tal:replace="structure python: tool.translate('front_page_text')"/>
|
||||
</div>
|
||||
</html>
|
||||
</tal:main>
|
||||
'''
|
||||
errorPage = '''
|
||||
<tal:main define="tool python: context.config">
|
||||
<html metal:use-macro="context/ui/template/macros/main">
|
||||
<div metal:fill-slot="content" tal:define="o python:options">
|
||||
<p tal:condition="o/error_message"
|
||||
tal:content="structure o/error_message"></p>
|
||||
<p>Error type: <b><span tal:replace="o/error_type"/></b></p>
|
||||
<p>Error value: <b><span tal:replace="o/error_value"/></b></p>
|
||||
<p tal:content="structure o/error_tb"></p>
|
||||
</div>
|
||||
</html>
|
||||
</tal:main>
|
||||
'''
|
||||
# ------------------------------------------------------------------------------
|
||||
class PloneInstaller:
|
||||
'''This Plone installer runs every time the generated Plone product is
|
||||
installed or uninstalled (in the Plone configuration interface).'''
|
||||
|
@ -40,78 +60,11 @@ class PloneInstaller:
|
|||
self.attributes = cfg.attributes
|
||||
# A buffer for logging purposes
|
||||
self.toLog = StringIO()
|
||||
self.typeAliases = {'sharing': '', 'gethtml': '',
|
||||
'(Default)': 'skynView', 'edit': 'skyn/edit',
|
||||
'index.html': '', 'properties': '', 'view': ''}
|
||||
self.tool = None # The Plone version of the application tool
|
||||
self.appyTool = None # The Appy version of the application tool
|
||||
self.toolName = '%sTool' % self.productName
|
||||
self.toolInstanceName = 'portal_%s' % self.productName.lower()
|
||||
|
||||
@staticmethod
|
||||
def updateIndexes(ploneSite, indexInfo, logger):
|
||||
'''This method creates or updates, in a p_ploneSite, definitions of
|
||||
indexes in its portal_catalog, based on index-related information
|
||||
given in p_indexInfo. p_indexInfo is a dictionary of the form
|
||||
{s_indexName:s_indexType}. Here are some examples of index types:
|
||||
"FieldIndex", "ZCTextIndex", "DateIndex".'''
|
||||
catalog = ploneSite.portal_catalog
|
||||
zopeCatalog = catalog._catalog
|
||||
for indexName, indexType in indexInfo.iteritems():
|
||||
# If this index already exists but with a different type, remove it.
|
||||
if (indexName in zopeCatalog.indexes):
|
||||
oldType = zopeCatalog.indexes[indexName].__class__.__name__
|
||||
if oldType != indexType:
|
||||
catalog.delIndex(indexName)
|
||||
logger.info('Existing index "%s" of type "%s" was removed:'\
|
||||
' we need to recreate it with type "%s".' % \
|
||||
(indexName, oldType, indexType))
|
||||
if indexName not in zopeCatalog.indexes:
|
||||
# We need to create this index
|
||||
if indexType != 'ZCTextIndex':
|
||||
catalog.addIndex(indexName, indexType)
|
||||
else:
|
||||
catalog.addIndex(indexName,indexType,extra=ZCTextIndexInfo)
|
||||
# Indexing database content based on this index.
|
||||
catalog.reindexIndex(indexName, ploneSite.REQUEST)
|
||||
logger.info('Created index "%s" of type "%s"...' % \
|
||||
(indexName, indexType))
|
||||
|
||||
appyFolderType = 'AppyFolder'
|
||||
def registerAppyFolderType(self):
|
||||
'''We need a specific content type for the folder that will hold all
|
||||
objects created from this application, in order to remove it from
|
||||
Plone navigation settings. We will create a new content type based
|
||||
on Large Plone Folder.'''
|
||||
if not hasattr(self.ploneSite.portal_types, self.appyFolderType):
|
||||
portal_types = self.ploneSite.portal_types
|
||||
lpf = 'Large Plone Folder'
|
||||
largePloneFolder = getattr(portal_types, lpf)
|
||||
typeInfoName = 'ATContentTypes: ATBTreeFolder (ATBTreeFolder)'
|
||||
portal_types.manage_addTypeInformation(
|
||||
largePloneFolder.meta_type, id=self.appyFolderType,
|
||||
typeinfo_name=typeInfoName)
|
||||
appyFolder = getattr(portal_types, self.appyFolderType)
|
||||
appyFolder.title = 'Appy folder'
|
||||
#appyFolder.factory = largePloneFolder.factory
|
||||
#appyFolder.product = largePloneFolder.product
|
||||
# Copy actions and aliases
|
||||
appyFolder._actions = tuple(largePloneFolder._cloneActions())
|
||||
# Copy aliases from the base portal type
|
||||
appyFolder.setMethodAliases(largePloneFolder.getMethodAliases())
|
||||
# Prevent Appy folders to be visible in standard Plone navigation
|
||||
nv = self.ploneSite.portal_properties.navtree_properties
|
||||
metaTypesNotToList = list(nv.getProperty('metaTypesNotToList'))
|
||||
if self.appyFolderType not in metaTypesNotToList:
|
||||
metaTypesNotToList.append(self.appyFolderType)
|
||||
nv.manage_changeProperties(
|
||||
metaTypesNotToList=tuple(metaTypesNotToList))
|
||||
|
||||
def getAddPermission(self, className):
|
||||
'''What is the name of the permission allowing to create instances of
|
||||
class whose name is p_className?'''
|
||||
return self.productName + ': Add ' + className
|
||||
|
||||
def installRootFolder(self):
|
||||
'''Creates and/or configures, at the root of the Plone site and if
|
||||
needed, the folder where the application will store instances of
|
||||
|
@ -158,128 +111,6 @@ class PloneInstaller:
|
|||
# have the main permission "Add portal content".
|
||||
permission = 'Add portal content'
|
||||
updateRolesForPermission(permission, tuple(allCreators), appFolder)
|
||||
# Creates the "appy" Directory view
|
||||
if hasattr(site.aq_base, 'skyn'):
|
||||
site.manage_delObjects(['skyn'])
|
||||
# This way, if Appy has moved from one place to the other, the
|
||||
# directory view will always refer to the correct place.
|
||||
addDirView = self.config.manage_addDirectoryView
|
||||
addDirView(site, appy.getPath() + '/gen/plone25/skin', id='skyn')
|
||||
|
||||
def installTypes(self):
|
||||
'''Registers and configures the Plone content types that correspond to
|
||||
gen-classes.'''
|
||||
site = self.ploneSite
|
||||
# Do Plone-based type registration
|
||||
classes = self.config.listTypes(self.productName)
|
||||
self.config.installTypes(site, self.toLog, classes, self.productName)
|
||||
self.config.install_subskin(site, self.toLog, self.config.__dict__)
|
||||
# Set appy view/edit pages for every created type
|
||||
for className in self.allClassNames + ['%sTool' % self.productName]:
|
||||
# I did not put the app tool in self.allClassNames because it
|
||||
# must not be registered in portal_factory
|
||||
if hasattr(site.portal_types, className):
|
||||
# className may correspond to an abstract class that has no
|
||||
# corresponding Plone content type
|
||||
typeInfo = getattr(site.portal_types, className)
|
||||
typeInfo.setMethodAliases(self.typeAliases)
|
||||
# Update edit and view actions
|
||||
typeActions = typeInfo.listActions()
|
||||
for action in typeActions:
|
||||
if action.id == 'view':
|
||||
page = 'skynView'
|
||||
action.edit(action='string:${object_url}/%s' % page)
|
||||
elif action.id == 'edit':
|
||||
page = 'skyn/edit'
|
||||
action.edit(action='string:${object_url}/%s' % page)
|
||||
|
||||
# Configure types for instance creation through portal_factory
|
||||
factoryTool = site.portal_factory
|
||||
factoryTypes = self.allClassNames + factoryTool.getFactoryTypes().keys()
|
||||
factoryTool.manage_setPortalFactoryTypes(listOfTypeIds=factoryTypes)
|
||||
|
||||
# Whitelist tool in Archetypes, because now UID is in portal_catalog
|
||||
atTool = getattr(site, self.config.ARCHETYPETOOLNAME)
|
||||
atTool.setCatalogsByType(self.toolName, ['portal_catalog'])
|
||||
|
||||
def updatePodTemplates(self):
|
||||
'''Creates or updates the POD templates in the tool according to pod
|
||||
declarations in the application classes.'''
|
||||
# Creates the templates for Pod fields if they do not exist.
|
||||
for contentType in self.attributes.iterkeys():
|
||||
appyClass = self.tool.getAppyClass(contentType)
|
||||
if not appyClass: continue # May be an abstract class
|
||||
wrapperClass = self.tool.getAppyClass(contentType, wrapper=True)
|
||||
for appyType in wrapperClass.__fields__:
|
||||
if appyType.type != 'Pod': continue
|
||||
# Find the attribute that stores the template, and store on
|
||||
# it the default one specified in the appyType if no
|
||||
# template is stored yet.
|
||||
attrName = self.appyTool.getAttributeName(
|
||||
'podTemplate', appyClass, appyType.name)
|
||||
fileObject = getattr(self.appyTool, attrName)
|
||||
if not fileObject or (fileObject.size == 0):
|
||||
# There is no file. Put the one specified in the appyType.
|
||||
fileName = os.path.join(self.appyTool.getDiskFolder(),
|
||||
appyType.template)
|
||||
if os.path.exists(fileName):
|
||||
setattr(self.appyTool, attrName, fileName)
|
||||
self.appyTool.log('Imported "%s" in the tool in ' \
|
||||
'attribute "%s"'% (fileName,attrName))
|
||||
else:
|
||||
self.appyTool.log('Template "%s" was not found!' % \
|
||||
fileName, type='error')
|
||||
|
||||
def installTool(self):
|
||||
'''Configures the application tool.'''
|
||||
# Register the tool in Plone
|
||||
try:
|
||||
self.ploneSite.manage_addProduct[
|
||||
self.productName].manage_addTool(self.toolName)
|
||||
except self.config.BadRequest:
|
||||
# If an instance with the same name already exists, this error will
|
||||
# be unelegantly raised by Zope.
|
||||
pass
|
||||
|
||||
self.tool = getattr(self.ploneSite, self.toolInstanceName)
|
||||
self.tool.refreshSecurity()
|
||||
self.appyTool = self.tool.appy()
|
||||
if self.reinstall:
|
||||
self.tool.createOrUpdate(False, None)
|
||||
else:
|
||||
self.tool.createOrUpdate(True, None)
|
||||
|
||||
def installTranslations(self):
|
||||
'''Creates or updates the translation objects within the tool.'''
|
||||
translations = [t.o.id for t in self.appyTool.translations]
|
||||
# We browse the languages supported by this application and check
|
||||
# whether we need to create the corresponding Translation objects.
|
||||
for language in self.languages:
|
||||
if language in translations: continue
|
||||
# We will create, in the tool, the translation object for this
|
||||
# language. Determine first its title.
|
||||
langId, langEn, langNat = languages.get(language)
|
||||
if langEn != langNat:
|
||||
title = '%s (%s)' % (langEn, langNat)
|
||||
else:
|
||||
title = langEn
|
||||
self.appyTool.create('translations', id=language, title=title)
|
||||
self.appyTool.log('Translation object created for "%s".' % language)
|
||||
# Now, we synchronise every Translation object with the corresponding
|
||||
# "po" file on disk.
|
||||
appFolder = self.config.diskFolder
|
||||
appName = self.config.PROJECTNAME
|
||||
dn = os.path.dirname
|
||||
jn = os.path.join
|
||||
i18nFolder = jn(jn(jn(dn(dn(dn(appFolder))),'Products'),appName),'i18n')
|
||||
for translation in self.appyTool.translations:
|
||||
# Get the "po" file
|
||||
poName = '%s-%s.po' % (appName, translation.id)
|
||||
poFile = PoParser(jn(i18nFolder, poName)).parse()
|
||||
for message in poFile.messages:
|
||||
setattr(translation, message.id, message.getMessage())
|
||||
self.appyTool.log('Translation "%s" updated from "%s".' % \
|
||||
(translation.id, poName))
|
||||
|
||||
def installRolesAndGroups(self):
|
||||
'''Registers roles used by workflows and classes defined in this
|
||||
|
@ -305,33 +136,6 @@ class PloneInstaller:
|
|||
site.portal_groups.setRolesForGroup(group, [role])
|
||||
site.__ac_roles__ = tuple(data)
|
||||
|
||||
def manageIndexes(self):
|
||||
'''For every indexed field, this method installs and updates the
|
||||
corresponding index if it does not exist yet.'''
|
||||
# Create a special index for object state, that does not correspond to
|
||||
# a field.
|
||||
indexInfo = {'getState': 'FieldIndex', 'UID': 'FieldIndex'}
|
||||
for className in self.attributes.iterkeys():
|
||||
wrapperClass = self.tool.getAppyClass(className, wrapper=True)
|
||||
for appyType in wrapperClass.__fields__:
|
||||
if not appyType.indexed or (appyType.name == 'title'): continue
|
||||
n = appyType.name
|
||||
indexName = 'get%s%s' % (n[0].upper(), n[1:])
|
||||
indexInfo[indexName] = appyType.getIndexType()
|
||||
if indexInfo:
|
||||
PloneInstaller.updateIndexes(self.ploneSite, indexInfo, self)
|
||||
|
||||
def manageLanguages(self):
|
||||
'''Manages the languages supported by the application.'''
|
||||
languageTool = self.ploneSite.portal_languages
|
||||
defLanguage = self.languages[0]
|
||||
languageTool.manage_setLanguageSettings(defaultLanguage=defLanguage,
|
||||
supportedLanguages=self.languages, setContentN=None,
|
||||
setCookieN=True, setRequestN=True, setPathN=True,
|
||||
setForcelanguageUrls=True, setAllowContentLanguageFallback=None,
|
||||
setUseCombinedLanguageCodes=None, displayFlags=False,
|
||||
startNeutral=False)
|
||||
|
||||
def finalizeInstallation(self):
|
||||
'''Performs some final installation steps.'''
|
||||
site = self.ploneSite
|
||||
|
@ -345,26 +149,6 @@ class PloneInstaller:
|
|||
self.appyTool.appyVersion = appy.version.short
|
||||
self.info('Appy version is %s.' % self.appyTool.appyVersion)
|
||||
# Call custom installer if any
|
||||
if hasattr(self.appyTool, 'install'):
|
||||
self.tool.executeAppyAction('install', reindex=False)
|
||||
|
||||
def info(self, msg): return self.appyTool.log(msg)
|
||||
|
||||
def install(self):
|
||||
# Begin with a migration if required.
|
||||
self.installTool()
|
||||
if self.reinstall: Migrator(self).run()
|
||||
self.installRootFolder()
|
||||
self.installTypes()
|
||||
self.manageLanguages()
|
||||
self.manageIndexes()
|
||||
self.updatePodTemplates()
|
||||
self.installTranslations()
|
||||
self.installRolesAndGroups()
|
||||
self.finalizeInstallation()
|
||||
self.appyTool.log("Installation done.")
|
||||
|
||||
def uninstall(self): return 'Done.'
|
||||
|
||||
# Stuff for tracking user activity ---------------------------------------------
|
||||
loggedUsers = {}
|
||||
|
@ -400,18 +184,226 @@ def onDelSession(sessionObject, container):
|
|||
class ZopeInstaller:
|
||||
'''This Zope installer runs every time Zope starts and encounters this
|
||||
generated Zope product.'''
|
||||
def __init__(self, zopeContext, toolClass, config, classes):
|
||||
def __init__(self, zopeContext, config, classes):
|
||||
self.zopeContext = zopeContext
|
||||
self.toolClass = toolClass
|
||||
self.config = cfg = config
|
||||
self.app = zopeContext._ProductContext__app # The root of the Zope tree
|
||||
self.config = config
|
||||
self.classes = classes
|
||||
# Unwrap some useful config variables
|
||||
self.productName = cfg.PROJECTNAME
|
||||
self.logger = cfg.logger
|
||||
self.defaultAddContentPermission = cfg.DEFAULT_ADD_CONTENT_PERMISSION
|
||||
self.addContentPermissions = cfg.ADD_CONTENT_PERMISSIONS
|
||||
self.productName = config.PROJECTNAME
|
||||
self.languages = config.languages
|
||||
self.logger = config.logger
|
||||
self.addContentPermissions = config.ADD_CONTENT_PERMISSIONS
|
||||
|
||||
def completeAppyTypes(self):
|
||||
def installUi(self):
|
||||
'''Installs the user interface.'''
|
||||
# Delete the existing folder if it existed.
|
||||
zopeContent = self.app.objectIds()
|
||||
if 'ui' in zopeContent: self.app.manage_delObjects(['ui'])
|
||||
self.app.manage_addFolder('ui')
|
||||
# Some useful imports
|
||||
from Products.PythonScripts.PythonScript import PythonScript
|
||||
from Products.PageTemplates.ZopePageTemplate import \
|
||||
manage_addPageTemplate
|
||||
# Browse the physical folder and re-create it in the Zope folder
|
||||
j = os.path.join
|
||||
ui = j(j(appy.getPath(), 'gen'), 'ui')
|
||||
for root, dirs, files in os.walk(ui):
|
||||
folderName = root[len(ui):]
|
||||
# Get the Zope folder that corresponds to this name
|
||||
zopeFolder = self.app.ui
|
||||
if folderName:
|
||||
for name in folderName.strip(os.sep).split(os.sep):
|
||||
zopeFolder = zopeFolder._getOb(name)
|
||||
# Create sub-folders at this level
|
||||
for name in dirs: zopeFolder.manage_addFolder(name)
|
||||
# Create files at this level
|
||||
for name in files:
|
||||
baseName, ext = os.path.splitext(name)
|
||||
f = file(j(root, name))
|
||||
if ext in File.imageExts:
|
||||
zopeFolder.manage_addImage(name, f)
|
||||
elif ext == '.pt':
|
||||
manage_addPageTemplate(zopeFolder, baseName, '', f.read())
|
||||
elif ext == '.py':
|
||||
obj = PythonScript(baseName)
|
||||
zopeFolder._setObject(baseName, obj)
|
||||
zopeFolder._getOb(baseName).write(f.read())
|
||||
else:
|
||||
zopeFolder.manage_addFile(name, f)
|
||||
f.close()
|
||||
# Update the home page
|
||||
if 'index_html' in zopeContent:
|
||||
self.app.manage_delObjects(['index_html'])
|
||||
manage_addPageTemplate(self.app, 'index_html', '', homePage)
|
||||
# Update the error page
|
||||
if 'standard_error_message' in zopeContent:
|
||||
self.app.manage_delObjects(['standard_error_message'])
|
||||
manage_addPageTemplate(self.app, 'standard_error_message', '',errorPage)
|
||||
|
||||
def installIndexes(self, indexInfo):
|
||||
'''Updates indexes in the catalog.'''
|
||||
catalog = self.app.catalog
|
||||
logger = self.logger
|
||||
for indexName, indexType in indexInfo.iteritems():
|
||||
# If this index already exists but with a different type, remove it.
|
||||
if indexName in catalog.indexes():
|
||||
oldType = catalog.Indexes[indexName].__class__.__name__
|
||||
if oldType != indexType:
|
||||
catalog.delIndex(indexName)
|
||||
logger.info('Existing index "%s" of type "%s" was removed:'\
|
||||
' we need to recreate it with type "%s".' % \
|
||||
(indexName, oldType, indexType))
|
||||
if indexName not in catalog.indexes():
|
||||
# We need to create this index
|
||||
type = indexType
|
||||
if type == 'ZCTextIndex': type = 'TextIndex'
|
||||
catalog.addIndex(indexName, type)
|
||||
logger.info('Created index "%s" of type "%s"...' % \
|
||||
(indexName, type))
|
||||
|
||||
def installCatalog(self):
|
||||
'''Create the catalog at the root of Zope if id does not exist.'''
|
||||
if 'catalog' not in self.app.objectIds():
|
||||
# Create the catalog
|
||||
from Products.ZCatalog.ZCatalog import manage_addZCatalog
|
||||
manage_addZCatalog(self.app, 'catalog', '')
|
||||
self.logger.info('Appy catalog created.')
|
||||
# Create or update Appy-wide indexes and field-related indexes
|
||||
indexInfo = {'State': 'FieldIndex', 'UID': 'FieldIndex',
|
||||
'Title': 'TextIndex', 'SortableTitle': 'FieldIndex',
|
||||
'SearchableText': 'FieldIndex', 'Creator': 'FieldIndex',
|
||||
'Created': 'DateIndex', 'ClassName': 'FieldIndex'}
|
||||
tool = self.app.config
|
||||
for className in self.config.attributes.iterkeys():
|
||||
wrapperClass = tool.getAppyClass(className, wrapper=True)
|
||||
for appyType in wrapperClass.__fields__:
|
||||
if not appyType.indexed or (appyType.name == 'title'): continue
|
||||
n = appyType.name
|
||||
indexName = 'get%s%s' % (n[0].upper(), n[1:])
|
||||
indexInfo[indexName] = appyType.getIndexType()
|
||||
self.installIndexes(indexInfo)
|
||||
|
||||
def installBaseObjects(self):
|
||||
'''Creates the tool and the root data folder if they do not exist.'''
|
||||
# Create or update the base folder for storing data
|
||||
zopeContent = self.app.objectIds()
|
||||
if 'data' not in zopeContent: self.app.manage_addFolder('data')
|
||||
if 'config' not in zopeContent:
|
||||
toolName = '%sTool' % self.productName
|
||||
createObject(self.app, 'config', toolName,self.productName,wf=False)
|
||||
# Remove some default objects created by Zope but not useful
|
||||
for name in ('standard_html_footer', 'standard_html_header',\
|
||||
'standard_template.pt'):
|
||||
if name in zopeContent: self.app.manage_delObjects([name])
|
||||
|
||||
def installTool(self):
|
||||
'''Updates the tool (now that the catalog is created) and updates its
|
||||
inner objects (translations, documents).'''
|
||||
tool = self.app.config
|
||||
tool.createOrUpdate(True, None)
|
||||
tool.refreshSecurity()
|
||||
appyTool = tool.appy()
|
||||
|
||||
# Create the admin user if no user exists.
|
||||
if not self.app.acl_users.getUsers():
|
||||
appyTool.create('users', name='min', firstName='ad',
|
||||
login='admin', password1='admin',
|
||||
password2='admin', roles=['Manager'])
|
||||
appyTool.log('Admin user "admin" created.')
|
||||
# Create POD templates within the tool if required
|
||||
for contentType in self.config.attributes.iterkeys():
|
||||
appyClass = tool.getAppyClass(contentType)
|
||||
if not appyClass: continue # May be an abstract class
|
||||
wrapperClass = tool.getAppyClass(contentType, wrapper=True)
|
||||
for appyType in wrapperClass.__fields__:
|
||||
if appyType.type != 'Pod': continue
|
||||
# Find the attribute that stores the template, and store on
|
||||
# it the default one specified in the appyType if no
|
||||
# template is stored yet.
|
||||
attrName = appyTool.getAttributeName('podTemplate', appyClass,
|
||||
appyType.name)
|
||||
fileObject = getattr(appyTool, attrName)
|
||||
if not fileObject or (fileObject.size == 0):
|
||||
# There is no file. Put the one specified in the appyType.
|
||||
fileName = os.path.join(appyTool.getDiskFolder(),
|
||||
appyType.template)
|
||||
if os.path.exists(fileName):
|
||||
setattr(appyTool, attrName, fileName)
|
||||
appyTool.log('Imported "%s" in the tool in ' \
|
||||
'attribute "%s"'% (fileName, attrName))
|
||||
else:
|
||||
appyTool.log('Template "%s" was not found!' % \
|
||||
fileName, type='error')
|
||||
|
||||
# Create or update Translation objects
|
||||
translations = [t.o.id for t in appyTool.translations]
|
||||
# We browse the languages supported by this application and check
|
||||
# whether we need to create the corresponding Translation objects.
|
||||
for language in self.languages:
|
||||
if language in translations: continue
|
||||
# We will create, in the tool, the translation object for this
|
||||
# language. Determine first its title.
|
||||
langId, langEn, langNat = languages.get(language)
|
||||
if langEn != langNat:
|
||||
title = '%s (%s)' % (langEn, langNat)
|
||||
else:
|
||||
title = langEn
|
||||
appyTool.create('translations', id=language, title=title)
|
||||
appyTool.log('Translation object created for "%s".' % language)
|
||||
# Now, we synchronise every Translation object with the corresponding
|
||||
# "po" file on disk.
|
||||
appFolder = self.config.diskFolder
|
||||
appName = self.config.PROJECTNAME
|
||||
dn = os.path.dirname
|
||||
jn = os.path.join
|
||||
i18nFolder = jn(jn(jn(dn(dn(dn(appFolder))),'Products'),appName),'i18n')
|
||||
for translation in appyTool.translations:
|
||||
# Get the "po" file
|
||||
poName = '%s-%s.po' % (appName, translation.id)
|
||||
poFile = PoParser(jn(i18nFolder, poName)).parse()
|
||||
for message in poFile.messages:
|
||||
setattr(translation, message.id, message.getMessage())
|
||||
appyTool.log('Translation "%s" updated from "%s".' % \
|
||||
(translation.id, poName))
|
||||
|
||||
# Execute custom installation code if any
|
||||
if hasattr(appyTool, 'install'):
|
||||
tool.executeAppyAction('install', reindex=False)
|
||||
|
||||
def configureSessions(self):
|
||||
'''Configure the session machinery.'''
|
||||
# Register a function warning us when a session object is deleted. When
|
||||
# launching Zope, the temp folder does not exist.
|
||||
if not hasattr(self.app, 'temp_folder'): return
|
||||
self.app.temp_folder.session_data.setDelNotificationTarget(onDelSession)
|
||||
|
||||
def enableUserTracking(self):
|
||||
'''Enables the machinery allowing to know who is currently logged in.
|
||||
Information about logged users will be stored in RAM, in the variable
|
||||
named loggedUsers defined above.'''
|
||||
global originalTraverse
|
||||
if not originalTraverse:
|
||||
# User tracking is not enabled yet. Do it now.
|
||||
BaseRequest = self.config.BaseRequest
|
||||
originalTraverse = BaseRequest.traverse
|
||||
BaseRequest.traverse = traverseWrapper
|
||||
|
||||
def installZopeClasses(self):
|
||||
'''Zope-level class registration.'''
|
||||
for klass in self.classes:
|
||||
name = klass.__name__
|
||||
module = klass.__module__
|
||||
wrapper = klass.wrapperClass
|
||||
exec 'from %s import manage_add%s as ctor' % (module, name)
|
||||
self.zopeContext.registerClass(meta_type=name,
|
||||
constructors = (ctor,),
|
||||
permission = self.addContentPermissions[name])
|
||||
# Create workflow prototypical instances in __instance__ attributes
|
||||
wf = getattr(klass.wrapperClass, 'workflow', None)
|
||||
if wf and not hasattr(wf, '__instance__'): wf.__instance__ = wf()
|
||||
|
||||
def installAppyTypes(self):
|
||||
'''We complete here the initialisation process of every Appy type of
|
||||
every gen-class of the application.'''
|
||||
appName = self.productName
|
||||
|
@ -434,74 +426,15 @@ class ZopeInstaller:
|
|||
continue # Back refs are initialised within fw refs
|
||||
appyType.init(name, baseClass, appName)
|
||||
|
||||
def installApplication(self):
|
||||
'''Performs some application-wide installation steps.'''
|
||||
register = self.config.DirectoryView.registerDirectory
|
||||
register('skins', self.config.__dict__)
|
||||
# Register the appy skin folder among DirectoryView'able folders
|
||||
register('skin', appy.getPath() + '/gen/plone25')
|
||||
|
||||
def installTool(self):
|
||||
'''Installs the tool.'''
|
||||
self.config.ToolInit(self.productName + ' Tools',
|
||||
tools = [self.toolClass], icon='tool.gif').initialize(
|
||||
self.zopeContext)
|
||||
|
||||
def installTypes(self):
|
||||
'''Installs and configures the types defined in the application.'''
|
||||
self.config.listTypes(self.productName)
|
||||
contentTypes, constructors, ftis = self.config.process_types(
|
||||
self.config.listTypes(self.productName), self.productName)
|
||||
self.config.cmfutils.ContentInit(self.productName + ' Content',
|
||||
content_types = contentTypes,
|
||||
permission = self.defaultAddContentPermission,
|
||||
extra_constructors = constructors, fti = ftis).initialize(
|
||||
self.zopeContext)
|
||||
# Define content-specific "add" permissions
|
||||
for i in range(0, len(contentTypes)):
|
||||
className = contentTypes[i].__name__
|
||||
if not className in self.addContentPermissions: continue
|
||||
self.zopeContext.registerClass(meta_type = ftis[i]['meta_type'],
|
||||
constructors = (constructors[i],),
|
||||
permission = self.addContentPermissions[className])
|
||||
# Create workflow prototypical instances in __instance__ attributes
|
||||
for contentType in contentTypes:
|
||||
wf = getattr(contentType.wrapperClass, 'workflow', None)
|
||||
if wf and not hasattr(wf, '__instance__'):
|
||||
wf.__instance__ = wf()
|
||||
|
||||
def enableUserTracking(self):
|
||||
'''Enables the machinery allowing to know who is currently logged in.
|
||||
Information about logged users will be stored in RAM, in the variable
|
||||
named loggedUsers defined above.'''
|
||||
global originalTraverse
|
||||
if not originalTraverse:
|
||||
# User tracking is not enabled yet. Do it now.
|
||||
BaseRequest = self.config.BaseRequest
|
||||
originalTraverse = BaseRequest.traverse
|
||||
BaseRequest.traverse = traverseWrapper
|
||||
|
||||
def finalizeInstallation(self):
|
||||
'''Performs some final installation steps.'''
|
||||
cfg = self.config
|
||||
# Apply customization policy if any
|
||||
cp = cfg.CustomizationPolicy
|
||||
if cp and hasattr(cp, 'register'): cp.register(context)
|
||||
# Install the default profile
|
||||
cfg.profile_registry.registerProfile(self.productName, self.productName,
|
||||
'Installation of %s' % self.productName, 'profiles/default',
|
||||
self.productName, cfg.EXTENSION, for_=cfg.IPloneSiteRoot)
|
||||
# Register a function warning us when a session object is deleted.
|
||||
app = self.zopeContext._ProductContext__app
|
||||
if hasattr(app, 'temp_folder'): # This is not the case in test mode
|
||||
app.temp_folder.session_data.setDelNotificationTarget(onDelSession)
|
||||
|
||||
def install(self):
|
||||
self.logger.info('is being installed...')
|
||||
self.completeAppyTypes()
|
||||
self.installApplication()
|
||||
self.installTool()
|
||||
self.installTypes()
|
||||
# Create the "admin" user if no user is present in the database
|
||||
self.installAppyTypes()
|
||||
self.installZopeClasses()
|
||||
self.enableUserTracking()
|
||||
self.finalizeInstallation()
|
||||
self.configureSessions()
|
||||
self.installBaseObjects()
|
||||
self.installCatalog()
|
||||
self.installTool()
|
||||
self.installUi()
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
|
@ -6,8 +6,7 @@ class TestMixin:
|
|||
'''This class is mixed in with any PloneTestCase.'''
|
||||
def createUser(self, userId, roles):
|
||||
'''Creates a user with id p_userId with some p_roles.'''
|
||||
pms = self.portal.portal_membership
|
||||
pms.addMember(userId, 'password', [], [])
|
||||
self.acl_users.addMember(userId, 'password', [], [])
|
||||
self.setRoles(roles, name=userId)
|
||||
|
||||
def changeUser(self, userId):
|
||||
|
|
|
@ -1,13 +1,18 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
import re, os, os.path, time, types
|
||||
import re, os, os.path, time, random, types, base64, urllib
|
||||
from appy.shared import mimeTypes
|
||||
from appy.shared.utils import getOsTempFolder
|
||||
from appy.shared.data import languages
|
||||
import appy.gen
|
||||
from appy.gen import Type, Search, Selection
|
||||
from appy.gen.utils import SomeObjects, sequenceTypes, getClassName
|
||||
from appy.gen.plone25.mixins import BaseMixin
|
||||
from appy.gen.plone25.wrappers import AbstractWrapper
|
||||
from appy.gen.plone25.descriptors import ClassDescriptor
|
||||
try:
|
||||
from AccessControl.ZopeSecurityPolicy import _noroles
|
||||
except ImportError:
|
||||
_noroles = []
|
||||
|
||||
# Errors -----------------------------------------------------------------------
|
||||
jsMessages = ('no_elem_selected', 'delete_confirm')
|
||||
|
@ -27,13 +32,17 @@ class ToolMixin(BaseMixin):
|
|||
res = '%s%s' % (elems[1], elems[4])
|
||||
return res
|
||||
|
||||
def getCatalog(self):
|
||||
'''Returns the catalog object.'''
|
||||
return self.getParentNode().catalog
|
||||
|
||||
def getApp(self):
|
||||
'''Returns the root application object.'''
|
||||
return self.portal_url.getPortalObject()
|
||||
'''Returns the root Zope object.'''
|
||||
return self.getPhysicalRoot()
|
||||
|
||||
def getSiteUrl(self):
|
||||
'''Returns the absolute URL of this site.'''
|
||||
return self.portal_url.getPortalObject().absolute_url()
|
||||
return self.getApp().absolute_url()
|
||||
|
||||
def getPodInfo(self, obj, name):
|
||||
'''Gets the available POD formats for Pod field named p_name on
|
||||
|
@ -61,20 +70,43 @@ class ToolMixin(BaseMixin):
|
|||
return res.content
|
||||
|
||||
def getAttr(self, name):
|
||||
'''Gets attribute named p_attrName. Useful because we can't use getattr
|
||||
directly in Zope Page Templates.'''
|
||||
'''Gets attribute named p_name.'''
|
||||
return getattr(self.appy(), name, None)
|
||||
|
||||
def getAppName(self):
|
||||
'''Returns the name of this application.'''
|
||||
'''Returns the name of the application.'''
|
||||
return self.getProductConfig().PROJECTNAME
|
||||
|
||||
def getAppFolder(self):
|
||||
'''Returns the folder at the root of the Plone site that is dedicated
|
||||
to this application.'''
|
||||
cfg = self.getProductConfig()
|
||||
portal = cfg.getToolByName(self, 'portal_url').getPortalObject()
|
||||
return getattr(portal, self.getAppName())
|
||||
def getPath(self, path):
|
||||
'''Returns the folder or object whose absolute path p_path.'''
|
||||
res = self.getPhysicalRoot()
|
||||
if path == '/': return res
|
||||
path = path[1:]
|
||||
if '/' not in path: return res._getOb(path) # For performance
|
||||
for elem in path.split('/'): res = res._getOb(elem)
|
||||
return res
|
||||
|
||||
def getLanguages(self):
|
||||
'''Returns the supported languages. First one is the default.'''
|
||||
return self.getProductConfig().languages
|
||||
|
||||
def getLanguageName(self, code):
|
||||
'''Gets the language name (in this language) from a 2-chars language
|
||||
p_code.'''
|
||||
return languages.get(code)[2]
|
||||
|
||||
def getMessages(self):
|
||||
'''Returns the list of messages to return to the user.'''
|
||||
if hasattr(self.REQUEST, 'messages'):
|
||||
# Empty the messages and return it
|
||||
res = self.REQUEST.messages
|
||||
del self.REQUEST.messages
|
||||
else:
|
||||
res = []
|
||||
# Add portal_status_message key if present
|
||||
if 'portal_status_message' in self.REQUEST:
|
||||
res.append( ('info', self.REQUEST['portal_status_message']) )
|
||||
return res
|
||||
|
||||
def getRootClasses(self):
|
||||
'''Returns the list of root classes for this application.'''
|
||||
|
@ -124,7 +156,7 @@ class ToolMixin(BaseMixin):
|
|||
return {'fields': fields, 'nbOfColumns': nbOfColumns,
|
||||
'fieldDicts': fieldDicts}
|
||||
|
||||
queryParamNames = ('type_name', 'search', 'sortKey', 'sortOrder',
|
||||
queryParamNames = ('className', 'search', 'sortKey', 'sortOrder',
|
||||
'filterKey', 'filterValue')
|
||||
def getQueryInfo(self):
|
||||
'''If we are showing search results, this method encodes in a string all
|
||||
|
@ -160,8 +192,8 @@ class ToolMixin(BaseMixin):
|
|||
return [importParams['headers'], elems]
|
||||
|
||||
def showPortlet(self, context):
|
||||
if self.portal_membership.isAnonymousUser(): return False
|
||||
if context.id == 'skyn': context = context.getParentNode()
|
||||
if self.userIsAnon(): return False
|
||||
if context.id == 'ui': context = context.getParentNode()
|
||||
res = True
|
||||
if not self.getRootClasses():
|
||||
res = False
|
||||
|
@ -170,24 +202,25 @@ class ToolMixin(BaseMixin):
|
|||
if (self.id in context.absolute_url()): res = True
|
||||
return res
|
||||
|
||||
def getObject(self, uid, appy=False):
|
||||
def getObject(self, uid, appy=False, brain=False):
|
||||
'''Allows to retrieve an object from its p_uid.'''
|
||||
res = self.portal_catalog(UID=uid)
|
||||
if res:
|
||||
res = res[0].getObject()
|
||||
if appy:
|
||||
res = res.appy()
|
||||
return res
|
||||
res = self.getPhysicalRoot().catalog(UID=uid)
|
||||
if not res: return
|
||||
res = res[0]
|
||||
if brain: return res
|
||||
res = res.getObject()
|
||||
if not appy: return res
|
||||
return res.appy()
|
||||
|
||||
def executeQuery(self, contentType, searchName=None, startNumber=0,
|
||||
def executeQuery(self, className, searchName=None, startNumber=0,
|
||||
search=None, remember=False, brainsOnly=False,
|
||||
maxResults=None, noSecurity=False, sortBy=None,
|
||||
sortOrder='asc', filterKey=None, filterValue=None,
|
||||
refObject=None, refField=None):
|
||||
'''Executes a query on a given p_contentType (or several, separated
|
||||
with commas) in portal_catalog. If p_searchName is specified, it
|
||||
corresponds to:
|
||||
1) a search defined on p_contentType: additional search criteria
|
||||
'''Executes a query on instances of a given p_className (or several,
|
||||
separated with commas) in the catalog. If p_searchName is specified,
|
||||
it corresponds to:
|
||||
1) a search defined on p_className: additional search criteria
|
||||
will be added to the query, or;
|
||||
2) "_advanced": in this case, additional search criteria will also
|
||||
be added to the query, but those criteria come from the session
|
||||
|
@ -224,16 +257,16 @@ class ToolMixin(BaseMixin):
|
|||
If p_refObject and p_refField are given, the query is limited to the
|
||||
objects that are referenced from p_refObject through p_refField.'''
|
||||
# Is there one or several content types ?
|
||||
if contentType.find(',') != -1:
|
||||
portalTypes = contentType.split(',')
|
||||
if className.find(',') != -1:
|
||||
classNames = className.split(',')
|
||||
else:
|
||||
portalTypes = contentType
|
||||
params = {'portal_type': portalTypes}
|
||||
classNames = className
|
||||
params = {'ClassName': classNames}
|
||||
if not brainsOnly: params['batch'] = True
|
||||
# Manage additional criteria from a search when relevant
|
||||
if searchName:
|
||||
# In this case, contentType must contain a single content type.
|
||||
appyClass = self.getAppyClass(contentType)
|
||||
# In this case, className must contain a single content type.
|
||||
appyClass = self.getAppyClass(className)
|
||||
if searchName != '_advanced':
|
||||
search = ClassDescriptor.getSearch(appyClass, searchName)
|
||||
else:
|
||||
|
@ -273,7 +306,7 @@ class ToolMixin(BaseMixin):
|
|||
# Determine what method to call on the portal catalog
|
||||
if noSecurity: catalogMethod = 'unrestrictedSearchResults'
|
||||
else: catalogMethod = 'searchResults'
|
||||
exec 'brains = self.portal_catalog.%s(**params)' % catalogMethod
|
||||
exec 'brains = self.getPath("/catalog").%s(**params)' % catalogMethod
|
||||
if brainsOnly:
|
||||
# Return brains only.
|
||||
if not maxResults: return brains
|
||||
|
@ -290,8 +323,8 @@ class ToolMixin(BaseMixin):
|
|||
# time a page for an element is consulted.
|
||||
if remember:
|
||||
if not searchName:
|
||||
# It is the global search for all objects pf p_contentType
|
||||
searchName = contentType
|
||||
# It is the global search for all objects pf p_className
|
||||
searchName = className
|
||||
uids = {}
|
||||
i = -1
|
||||
for obj in res.objects:
|
||||
|
@ -339,15 +372,6 @@ class ToolMixin(BaseMixin):
|
|||
return '<acronym title="%s">%s</acronym>' % \
|
||||
(text, text[:width] + '...')
|
||||
|
||||
translationMapping = {'portal_path': ''}
|
||||
def translateWithMapping(self, label):
|
||||
'''Translates p_label in the application domain, with a default
|
||||
translation mapping.'''
|
||||
if not self.translationMapping['portal_path']:
|
||||
self.translationMapping['portal_path'] = \
|
||||
self.portal_url.getPortalPath()
|
||||
return self.translate(label, mapping=self.translationMapping)
|
||||
|
||||
def getPublishedObject(self):
|
||||
'''Gets the currently published object, if its meta_class is among
|
||||
application classes.'''
|
||||
|
@ -355,24 +379,24 @@ class ToolMixin(BaseMixin):
|
|||
# If we are querying object, there is no published object (the truth is:
|
||||
# the tool is the currently published object but we don't want to
|
||||
# consider it this way).
|
||||
if not req['ACTUAL_URL'].endswith('/skyn/view'): return
|
||||
if not req['ACTUAL_URL'].endswith('/ui/view'): return
|
||||
obj = self.REQUEST['PUBLISHED']
|
||||
parent = obj.getParentNode()
|
||||
if parent.id == 'skyn': obj = parent.getParentNode()
|
||||
if parent.id == 'ui': obj = parent.getParentNode()
|
||||
if obj.meta_type in self.getProductConfig().attributes: return obj
|
||||
|
||||
def getAppyClass(self, contentType, wrapper=False):
|
||||
'''Gets the Appy Python class that is related to p_contentType.'''
|
||||
# Retrieve first the Archetypes class corresponding to p_ContentType
|
||||
portalType = self.portal_types.get(contentType)
|
||||
if not portalType: return
|
||||
atClassName = portalType.getProperty('content_meta_type')
|
||||
appName = self.getProductConfig().PROJECTNAME
|
||||
exec 'from Products.%s.%s import %s as atClass' % \
|
||||
(appName, atClassName, atClassName)
|
||||
# Get then the Appy Python class
|
||||
if wrapper: return atClass.wrapperClass
|
||||
else: return atClass.wrapperClass.__bases__[-1]
|
||||
def getZopeClass(self, name):
|
||||
'''Returns the Zope class whose name is p_name.'''
|
||||
exec 'from Products.%s.%s import %s as C'% (self.getAppName(),name,name)
|
||||
return C
|
||||
|
||||
def getAppyClass(self, zopeName, wrapper=False):
|
||||
'''Gets the Appy class corresponding to the Zope class named p_name.
|
||||
If p_wrapper is True, it returns the Appy wrapper. Else, it returns
|
||||
the user-defined class.'''
|
||||
zopeClass = self.getZopeClass(zopeName)
|
||||
if wrapper: return zopeClass.wrapperClass
|
||||
else: return zopeClass.wrapperClass.__bases__[-1]
|
||||
|
||||
def getCreateMeans(self, contentTypeOrAppyClass):
|
||||
'''Gets the different ways objects of p_contentTypeOrAppyClass (which
|
||||
|
@ -417,9 +441,9 @@ class ToolMixin(BaseMixin):
|
|||
'''This method is called when the user wants to create objects from
|
||||
external data.'''
|
||||
rq = self.REQUEST
|
||||
appyClass = self.getAppyClass(rq.get('type_name'))
|
||||
appyClass = self.getAppyClass(rq.get('className'))
|
||||
importPaths = rq.get('importPath').split('|')
|
||||
appFolder = self.getAppFolder()
|
||||
appFolder = self.getPath('/data')
|
||||
for importPath in importPaths:
|
||||
if not importPath: continue
|
||||
objectId = os.path.basename(importPath)
|
||||
|
@ -428,9 +452,9 @@ class ToolMixin(BaseMixin):
|
|||
return self.goto(rq['HTTP_REFERER'])
|
||||
|
||||
def isAlreadyImported(self, contentType, importPath):
|
||||
appFolder = self.getAppFolder()
|
||||
data = self.getPath('/data')
|
||||
objectId = os.path.basename(importPath)
|
||||
if hasattr(appFolder.aq_base, objectId):
|
||||
if hasattr(data.aq_base, objectId):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
@ -553,8 +577,8 @@ class ToolMixin(BaseMixin):
|
|||
if refInfo: criteria['_ref'] = refInfo
|
||||
rq.SESSION['searchCriteria'] = criteria
|
||||
# Go to the screen that displays search results
|
||||
backUrl = '%s/skyn/query?type_name=%s&&search=_advanced' % \
|
||||
(self.absolute_url(), rq['type_name'])
|
||||
backUrl = '%s/ui/query?className=%s&&search=_advanced' % \
|
||||
(self.absolute_url(), rq['className'])
|
||||
return self.goto(backUrl)
|
||||
|
||||
def getJavascriptMessages(self):
|
||||
|
@ -614,8 +638,8 @@ class ToolMixin(BaseMixin):
|
|||
'''This method creates the URL that allows to perform a (non-Ajax)
|
||||
request for getting queried objects from a search named p_searchName
|
||||
on p_contentType.'''
|
||||
baseUrl = self.absolute_url() + '/skyn'
|
||||
baseParams = 'type_name=%s' % contentType
|
||||
baseUrl = self.absolute_url() + '/ui'
|
||||
baseParams = 'className=%s' % contentType
|
||||
rq = self.REQUEST
|
||||
if rq.get('ref'): baseParams += '&ref=%s' % rq.get('ref')
|
||||
# Manage start number
|
||||
|
@ -663,7 +687,7 @@ class ToolMixin(BaseMixin):
|
|||
res['backText'] = self.translate(label)
|
||||
else:
|
||||
fieldName, pageName = d2.split(':')
|
||||
sourceObj = self.portal_catalog(UID=d1)[0].getObject()
|
||||
sourceObj = self.getObject(d1)
|
||||
label = '%s_%s' % (sourceObj.meta_type, fieldName)
|
||||
res['backText'] = '%s : %s' % (sourceObj.Title(),
|
||||
self.translate(label))
|
||||
|
@ -739,9 +763,9 @@ class ToolMixin(BaseMixin):
|
|||
except KeyError: pass
|
||||
except IndexError: pass
|
||||
if uid:
|
||||
brain = self.portal_catalog(UID=uid)
|
||||
brain = self.getObject(uid, brain=True)
|
||||
if brain:
|
||||
sibling = brain[0].getObject()
|
||||
sibling = brain.getObject()
|
||||
res[urlKey] = sibling.getUrl(nav=newNav % (index + 1),
|
||||
page='main')
|
||||
return res
|
||||
|
@ -777,6 +801,9 @@ class ToolMixin(BaseMixin):
|
|||
'''Gets the translated month name of month numbered p_monthNumber.'''
|
||||
return self.translate(self.monthsIds[int(monthNumber)], domain='plone')
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Authentication-related methods
|
||||
# --------------------------------------------------------------------------
|
||||
def performLogin(self):
|
||||
'''Logs the user in.'''
|
||||
rq = self.REQUEST
|
||||
|
@ -788,11 +815,14 @@ class ToolMixin(BaseMixin):
|
|||
msg = self.translate(u'You must enable cookies before you can ' \
|
||||
'log in.', domain='plone')
|
||||
return self.goto(urlBack, msg.encode('utf-8'))
|
||||
|
||||
# Perform the Zope-level authentication
|
||||
self.acl_users.credentials_cookie_auth.login()
|
||||
login = rq['login_name']
|
||||
if self.portal_membership.isAnonymousUser():
|
||||
login = rq.get('__ac_name', '')
|
||||
password = rq.get('__ac_password', '')
|
||||
cookieValue = base64.encodestring('%s:%s' % (login, password)).rstrip()
|
||||
cookieValue = urllib.quote(cookieValue)
|
||||
rq.RESPONSE.setCookie('__ac', cookieValue, path='/')
|
||||
user = self.acl_users.validate(rq)
|
||||
if self.userIsAnon():
|
||||
rq.RESPONSE.expireCookie('__ac', path='/')
|
||||
msg = self.translate(u'Login failed', domain='plone')
|
||||
logMsg = 'Authentication failed (tried with login "%s")' % login
|
||||
|
@ -803,7 +833,7 @@ class ToolMixin(BaseMixin):
|
|||
msg = msg.encode('utf-8')
|
||||
self.log(logMsg)
|
||||
# Bring Managers to the config, leave others on the main page.
|
||||
user = self.portal_membership.getAuthenticatedMember()
|
||||
user = self.getUser()
|
||||
if user.has_role('Manager'):
|
||||
# Bring the user to the configuration
|
||||
url = self.goto(self.absolute_url(), msg)
|
||||
|
@ -814,28 +844,72 @@ class ToolMixin(BaseMixin):
|
|||
def performLogout(self):
|
||||
'''Logs out the current user when he clicks on "disconnect".'''
|
||||
rq = self.REQUEST
|
||||
userId = self.portal_membership.getAuthenticatedMember().getId()
|
||||
userId = self.getUser().getId()
|
||||
# Perform the logout in acl_users
|
||||
try:
|
||||
self.acl_users.logout(rq)
|
||||
except:
|
||||
pass
|
||||
skinvar = self.portal_skins.getRequestVarname()
|
||||
path = '/' + self.absolute_url(1)
|
||||
if rq.has_key(skinvar) and not self.portal_skins.getCookiePersistence():
|
||||
rq.RESPONSE.expireCookie(skinvar, path=path)
|
||||
# Invalidate existing sessions, but only if they exist.
|
||||
rq.RESPONSE.expireCookie('__ac', path='/')
|
||||
# Invalidate existing sessions.
|
||||
sdm = self.session_data_manager
|
||||
session = sdm.getSessionData(create=0)
|
||||
if session is not None:
|
||||
session.invalidate()
|
||||
from Products.CMFPlone import transaction_note
|
||||
transaction_note('Logged out')
|
||||
self.log('User "%s" has been logged out.' % userId)
|
||||
# Remove user from variable "loggedUsers"
|
||||
from appy.gen.plone25.installer import loggedUsers
|
||||
if loggedUsers.has_key(userId): del loggedUsers[userId]
|
||||
return self.goto(self.getParentNode().absolute_url())
|
||||
return self.goto(self.getApp().absolute_url())
|
||||
|
||||
def validate(self, request, auth='', roles=_noroles):
|
||||
'''This method performs authentication and authorization. It is used as
|
||||
a replacement for Zope's AccessControl.User.BasicUserFolder.validate,
|
||||
that allows to manage cookie-based authentication.'''
|
||||
v = request['PUBLISHED'] # The published object
|
||||
# v is the object (value) we're validating access to
|
||||
# n is the name used to access the object
|
||||
# a is the object the object was accessed through
|
||||
# c is the physical container of the object
|
||||
a, c, n, v = self._getobcontext(v, request)
|
||||
# Try to get user name and password from basic authentication
|
||||
login, password = self.identify(auth)
|
||||
if not login:
|
||||
# Try to get them from a cookie
|
||||
cookie = request.get('__ac', None)
|
||||
login = request.get('__ac_name', None)
|
||||
if login and request.form.has_key('__ac_password'):
|
||||
# The user just entered his credentials. The cookie has not been
|
||||
# set yet (it will come in the upcoming HTTP response when the
|
||||
# current request will be served).
|
||||
login = request.get('__ac_name', '')
|
||||
password = request.get('__ac_password', '')
|
||||
elif cookie and (cookie != 'deleted'):
|
||||
cookieValue = base64.decodestring(urllib.unquote(cookie))
|
||||
login, password = cookieValue.split(':')
|
||||
# Try to authenticate this user
|
||||
user = self.authenticate(login, password, request)
|
||||
emergency = self._emergency_user
|
||||
if emergency and user is emergency:
|
||||
# It is the emergency user.
|
||||
return emergency.__of__(self)
|
||||
elif user is None:
|
||||
# Login and/or password incorrect. Try to authorize and return the
|
||||
# anonymous user.
|
||||
if self.authorize(self._nobody, a, c, n, v, roles):
|
||||
return self._nobody.__of__(self)
|
||||
else:
|
||||
return # Anonymous can't acces this object
|
||||
else:
|
||||
# We found a user and his password was correct. Try to authorize him
|
||||
# against the published object.
|
||||
if self.authorize(user, a, c, n, v, roles):
|
||||
return user.__of__(self)
|
||||
# That didn't work. Try to authorize the anonymous user.
|
||||
elif self.authorize(self._nobody, a, c, n, v, roles):
|
||||
return self._nobody.__of__(self)
|
||||
else:
|
||||
return
|
||||
|
||||
# Patch BasicUserFolder with our version of m_validate above.
|
||||
from AccessControl.User import BasicUserFolder
|
||||
BasicUserFolder.validate = validate
|
||||
|
||||
def tempFile(self):
|
||||
'''A temp file has been created in a temp folder. This method returns
|
||||
|
@ -864,11 +938,16 @@ class ToolMixin(BaseMixin):
|
|||
def getUserLine(self, user):
|
||||
'''Returns a one-line user info as shown on every page.'''
|
||||
res = [user.getId()]
|
||||
name = user.getProperty('fullname')
|
||||
if name: res.insert(0, name)
|
||||
rolesToShow = [r for r in user.getRoles() \
|
||||
if r not in ('Authenticated', 'Member')]
|
||||
if rolesToShow:
|
||||
res.append(', '.join([self.translate(r) for r in rolesToShow]))
|
||||
return ' | '.join(res)
|
||||
|
||||
def generateUid(self, className):
|
||||
'''Generates a UID for an instance of p_className.'''
|
||||
name = className.replace('_', '')
|
||||
randomNumber = str(random.random()).split('.')[1]
|
||||
timestamp = ('%f' % time.time()).replace('.', '')
|
||||
return '%s%s%s' % (name, timestamp, randomNumber)
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
|
@ -15,8 +15,8 @@ from appy.gen.plone25.descriptors import ClassDescriptor
|
|||
|
||||
# ------------------------------------------------------------------------------
|
||||
class BaseMixin:
|
||||
'''Every Archetype class generated by appy.gen inherits from this class or
|
||||
a subclass of it.'''
|
||||
'''Every Zope class generated by appy.gen inherits from this class or a
|
||||
subclass of it.'''
|
||||
_appy_meta_type = 'Class'
|
||||
|
||||
def get_o(self):
|
||||
|
@ -31,31 +31,36 @@ class BaseMixin:
|
|||
initiator=None, initiatorField=None):
|
||||
'''This method creates (if p_created is True) or updates an object.
|
||||
p_values are manipulated versions of those from the HTTP request.
|
||||
In the case of an object creation (p_created is True), p_self is a
|
||||
temporary object created in the request by portal_factory, and this
|
||||
method creates the corresponding final object. In the case of an
|
||||
update, this method simply updates fields of p_self.'''
|
||||
rq = self.REQUEST
|
||||
In the case of an object creation from the web (p_created is True
|
||||
and a REQUEST object is present), p_self is a temporary object
|
||||
created in /temp_folder, and this method moves it at its "final"
|
||||
place. In the case of an update, this method simply updates fields
|
||||
of p_self.'''
|
||||
rq = getattr(self, 'REQUEST', None)
|
||||
obj = self
|
||||
if created:
|
||||
# portal_factory creates the final object from the temp object.
|
||||
obj = self.portal_factory.doCreate(self, self.id)
|
||||
if created and rq:
|
||||
# Create the final object and put it at the right place.
|
||||
tool = self.getTool()
|
||||
id = tool.generateUid(obj.portal_type)
|
||||
if not initiator:
|
||||
folder = tool.getPath('/data')
|
||||
else:
|
||||
if initiator.isPrincipiaFolderish:
|
||||
folder = initiator
|
||||
else:
|
||||
folder = initiator.getParentNode()
|
||||
obj = createObject(folder, id, obj.portal_type, tool.getAppName())
|
||||
previousData = None
|
||||
if not created: previousData = self.rememberPreviousData()
|
||||
# Perform the change on the object, unless self is a tool being created.
|
||||
if (obj._appy_meta_type == 'Tool') and created:
|
||||
# We do not process form data (=real update on the object) if the
|
||||
# tool itself is being created.
|
||||
pass
|
||||
else:
|
||||
if not created: previousData = obj.rememberPreviousData()
|
||||
# Perform the change on the object
|
||||
if rq:
|
||||
# Store in the database the new value coming from the form
|
||||
for appyType in self.getAppyTypes('edit', rq.get('page')):
|
||||
value = getattr(values, appyType.name, None)
|
||||
appyType.store(obj, value)
|
||||
if created: obj.unmarkCreationFlag()
|
||||
if previousData:
|
||||
# Keep in history potential changes on historized fields
|
||||
self.historizeData(previousData)
|
||||
obj.historizeData(previousData)
|
||||
|
||||
# Manage potential link with an initiator object
|
||||
if created and initiator: initiator.appy().link(initiatorField, obj)
|
||||
|
@ -69,7 +74,7 @@ class BaseMixin:
|
|||
appyObject = obj.appy()
|
||||
if hasattr(appyObject, 'onEdit'):
|
||||
msg = appyObject.onEdit(created)
|
||||
obj.reindexObject()
|
||||
obj.reindex()
|
||||
return obj, msg
|
||||
|
||||
def delete(self):
|
||||
|
@ -99,9 +104,11 @@ class BaseMixin:
|
|||
|
||||
def onCreate(self):
|
||||
'''This method is called when a user wants to create a root object in
|
||||
the application folder or an object through a reference field.'''
|
||||
the "data" folder or an object through a reference field. A temporary
|
||||
object is created in /temp_folder and the edit page to it is
|
||||
returned.'''
|
||||
rq = self.REQUEST
|
||||
typeName = rq.get('type_name')
|
||||
className = rq.get('className')
|
||||
# Create the params to add to the URL we will redirect the user to
|
||||
# create the object.
|
||||
urlParams = {'mode':'edit', 'page':'main', 'nav':''}
|
||||
|
@ -112,15 +119,12 @@ class BaseMixin:
|
|||
splitted = rq.get('nav').split('.')
|
||||
splitted[-1] = splitted[-2] = str(int(splitted[-1])+1)
|
||||
urlParams['nav'] = '.'.join(splitted)
|
||||
# Determine base URL
|
||||
baseUrl = self.absolute_url()
|
||||
if (self._appy_meta_type == 'Tool') and not urlParams['nav']:
|
||||
# This is the creation of a root object in the app folder
|
||||
baseUrl = self.getAppFolder().absolute_url()
|
||||
objId = self.generateUniqueId(typeName)
|
||||
editUrl = '%s/portal_factory/%s/%s/skyn/edit' % \
|
||||
(baseUrl, typeName, objId)
|
||||
return self.goto(self.getUrl(editUrl, **urlParams))
|
||||
# Create a temp object in /temp_folder
|
||||
tool = self.getTool()
|
||||
id = tool.generateUid(className)
|
||||
appName = tool.getAppName()
|
||||
obj = createObject(tool.getPath('/temp_folder'), id, className, appName)
|
||||
return self.goto(obj.getUrl(**urlParams))
|
||||
|
||||
def onCreateWithoutForm(self):
|
||||
'''This method is called when a user wants to create a object from a
|
||||
|
@ -175,10 +179,10 @@ class BaseMixin:
|
|||
|
||||
def onUpdate(self):
|
||||
'''This method is executed when a user wants to update an object.
|
||||
The object may be a temporary object created by portal_factory in
|
||||
the request. In this case, the update consists in the creation of
|
||||
the "final" object in the database. If the object is not a temporary
|
||||
one, this method updates its fields in the database.'''
|
||||
The object may be a temporary object created in /temp_folder.
|
||||
In this case, the update consists in moving it to its "final" place.
|
||||
If the object is not a temporary one, this method updates its
|
||||
fields in the database.'''
|
||||
rq = self.REQUEST
|
||||
tool = self.getTool()
|
||||
errorMessage = self.translate(
|
||||
|
@ -244,7 +248,7 @@ class BaseMixin:
|
|||
# object like a one-shot form and has already been deleted in method
|
||||
# onEdit), redirect to the main site page.
|
||||
if not getattr(obj.getParentNode().aq_base, obj.id, None):
|
||||
obj.unindexObject()
|
||||
obj.unindex()
|
||||
return self.goto(tool.getSiteUrl(), msg)
|
||||
# If the user can't access the object anymore, redirect him to the
|
||||
# main site page.
|
||||
|
@ -295,16 +299,42 @@ class BaseMixin:
|
|||
return self.goto(obj.getUrl())
|
||||
return obj.gotoEdit()
|
||||
|
||||
def reindex(self, indexes=None, unindex=False):
|
||||
'''Reindexes this object the catalog. If names of indexes are specified
|
||||
in p_indexes, recataloging is limited to those indexes. If p_unindex
|
||||
is True, instead of cataloguing the object, it uncatalogs it.'''
|
||||
url = self.absolute_url_path()
|
||||
catalog = self.getPhysicalRoot().catalog
|
||||
if unindex:
|
||||
method = catalog.uncatalog_object
|
||||
else:
|
||||
method = catalog.catalog_object
|
||||
if indexes:
|
||||
return method(self, url)
|
||||
else:
|
||||
return method(self, url, idxs=indexes)
|
||||
|
||||
def unindex(self, indexes=None):
|
||||
'''Undatalog this object.'''
|
||||
url = self.absolute_url_path()
|
||||
catalog = self.getPhysicalRoot().catalog
|
||||
if indexes:
|
||||
return catalog.catalog_object(self, url)
|
||||
else:
|
||||
return catalog.catalog_object(self, url, idxs=indexes)
|
||||
|
||||
def say(self, msg, type='info'):
|
||||
'''Prints a p_msg in the user interface. p_logLevel may be "info",
|
||||
"warning" or "error".'''
|
||||
mType = type
|
||||
rq = self.REQUEST
|
||||
if not hasattr(rq, 'messages'):
|
||||
messages = rq.messages = []
|
||||
else:
|
||||
messages = rq.messages
|
||||
if mType == 'warning': mType = 'warn'
|
||||
elif mType == 'error': mType = 'stop'
|
||||
try:
|
||||
self.plone_utils.addPortalMessage(msg, type=mType)
|
||||
except UnicodeDecodeError:
|
||||
self.plone_utils.addPortalMessage(msg.decode('utf-8'), type=mType)
|
||||
messages.append( (mType, msg) )
|
||||
|
||||
def log(self, msg, type='info'):
|
||||
'''Logs a p_msg in the log file. p_logLevel may be "info", "warning"
|
||||
|
@ -315,29 +345,15 @@ class BaseMixin:
|
|||
else: logMethod = logger.info
|
||||
logMethod(msg)
|
||||
|
||||
def getState(self, name=True, initial=False):
|
||||
'''Returns information about the current object state. If p_name is
|
||||
True, the returned info is the state name. Else, it is the State
|
||||
instance. If p_initial is True, instead of returning info about the
|
||||
current state, it returns info about the workflow initial state.'''
|
||||
wf = self.getWorkflow()
|
||||
if initial or not hasattr(self.aq_base, 'workflow_history'):
|
||||
# No workflow information is available (yet) on this object, or
|
||||
# initial state is asked. In both cases, return info about this
|
||||
# initial state.
|
||||
res = 'active'
|
||||
for elem in dir(wf):
|
||||
attr = getattr(wf, elem)
|
||||
if (attr.__class__.__name__ == 'State') and attr.initial:
|
||||
res = elem
|
||||
break
|
||||
def do(self):
|
||||
'''Performs some action from the user interface.'''
|
||||
rq = self.REQUEST
|
||||
action = rq['action']
|
||||
if rq.get('objectUid', None):
|
||||
obj = self.getTool().getObject(rq['objectUid'])
|
||||
else:
|
||||
# Return info about the current object state
|
||||
key = self.workflow_history.keys()[0]
|
||||
res = self.workflow_history[key][-1]['review_state']
|
||||
# Return state name or state definition?
|
||||
if name: return res
|
||||
else: return getattr(wf, res)
|
||||
obj = self
|
||||
return obj.getMethod('on'+action)()
|
||||
|
||||
def rememberPreviousData(self):
|
||||
'''This method is called before updating an object and remembers, for
|
||||
|
@ -351,12 +367,12 @@ class BaseMixin:
|
|||
|
||||
def addHistoryEvent(self, action, **kw):
|
||||
'''Adds an event in the object history.'''
|
||||
userId = self.portal_membership.getAuthenticatedMember().getId()
|
||||
userId = self.getUser().getId()
|
||||
from DateTime import DateTime
|
||||
event = {'action': action, 'actor': userId, 'time': DateTime(),
|
||||
'comments': ''}
|
||||
event.update(kw)
|
||||
if 'review_state' not in event: event['review_state']=self.getState()
|
||||
if 'review_state' not in event: event['review_state'] = self.State()
|
||||
# Add the event to the history
|
||||
histKey = self.workflow_history.keys()[0]
|
||||
self.workflow_history[histKey] += (event,)
|
||||
|
@ -423,7 +439,7 @@ class BaseMixin:
|
|||
for field in self.getAppyTypes('edit', page):
|
||||
if (field.type == 'String') and (field.format == 3):
|
||||
self.REQUEST.set(field.name, '')
|
||||
return self.skyn.edit(self)
|
||||
return self.ui.edit(self)
|
||||
|
||||
def showField(self, name, layoutType='view'):
|
||||
'''Must I show field named p_name on this p_layoutType ?'''
|
||||
|
@ -657,7 +673,7 @@ class BaseMixin:
|
|||
'''Returns information about the states that are related to p_phase.
|
||||
If p_currentOnly is True, we return the current state, even if not
|
||||
related to p_phase.'''
|
||||
currentState = self.getState()
|
||||
currentState = self.State()
|
||||
if currentOnly:
|
||||
return [StateDescr(currentState, 'current').get()]
|
||||
res = []
|
||||
|
@ -690,7 +706,7 @@ class BaseMixin:
|
|||
'''
|
||||
res = []
|
||||
wf = self.getWorkflow()
|
||||
currentState = self.getState(name=False)
|
||||
currentState = self.State(name=False)
|
||||
# Loop on every transition
|
||||
for name in dir(wf):
|
||||
transition = getattr(wf, name)
|
||||
|
@ -855,7 +871,7 @@ class BaseMixin:
|
|||
related data on the object.'''
|
||||
wf = self.getWorkflow()
|
||||
# Get the initial workflow state
|
||||
initialState = self.getState(name=False)
|
||||
initialState = self.State(name=False)
|
||||
# Create a Transition instance representing the initial transition.
|
||||
initialTransition = Transition((initialState, initialState))
|
||||
initialTransition.trigger('_init_', self, wf, '')
|
||||
|
@ -876,7 +892,7 @@ class BaseMixin:
|
|||
'''Gets the i18n label for p_stateName, or for the current object state
|
||||
if p_stateName is not given. Note that if p_stateName is given, it
|
||||
can also represent the name of a transition.'''
|
||||
stateName = stateName or self.getState()
|
||||
stateName = stateName or self.State()
|
||||
return '%s_%s' % (self.getWorkflow(name=True), stateName)
|
||||
|
||||
def refreshSecurity(self):
|
||||
|
@ -885,15 +901,15 @@ class BaseMixin:
|
|||
wf = self.getWorkflow()
|
||||
try:
|
||||
# Get the state definition of the object's current state.
|
||||
state = getattr(wf, self.getState())
|
||||
state = getattr(wf, self.State())
|
||||
except AttributeError:
|
||||
# The workflow information for this object does not correspond to
|
||||
# its current workflow attribution. Add a new fake event
|
||||
# representing passage of this object to the initial state of his
|
||||
# currently attributed workflow.
|
||||
stateName = self.getState(name=True, initial=True)
|
||||
stateName = self.State(name=True, initial=True)
|
||||
self.addHistoryEvent(None, review_state=stateName)
|
||||
state = self.getState(name=False, initial=True)
|
||||
state = self.State(name=False, initial=True)
|
||||
self.log('Wrong workflow info for a "%s"; is not in state "%s".' % \
|
||||
(self.meta_type, stateName))
|
||||
# Update permission attributes on the object if required
|
||||
|
@ -939,9 +955,11 @@ class BaseMixin:
|
|||
'''Executes action with p_fieldName on this object.'''
|
||||
appyType = self.getAppyType(actionName)
|
||||
actionRes = appyType(self.appy())
|
||||
if self.getParentNode().get(self.id):
|
||||
parent = self.getParentNode()
|
||||
parentAq = getattr(parent, 'aq_base', parent)
|
||||
if not hasattr(parentAq, self.id):
|
||||
# Else, it means that the action has led to self's deletion.
|
||||
self.reindexObject()
|
||||
self.reindex()
|
||||
return appyType.result, actionRes
|
||||
|
||||
def onExecuteAppyAction(self):
|
||||
|
@ -982,8 +1000,8 @@ class BaseMixin:
|
|||
# the user.
|
||||
return self.goto(msg)
|
||||
|
||||
def do(self, transitionName, comment='', doAction=True, doNotify=True,
|
||||
doHistory=True, doSay=True):
|
||||
def trigger(self, transitionName, comment='', doAction=True, doNotify=True,
|
||||
doHistory=True, doSay=True):
|
||||
'''Triggers transition named p_transitionName.'''
|
||||
# Check that this transition exists.
|
||||
wf = self.getWorkflow()
|
||||
|
@ -998,12 +1016,12 @@ class BaseMixin:
|
|||
transition.trigger(transitionName, self, wf, comment, doAction=doAction,
|
||||
doNotify=doNotify, doHistory=doHistory, doSay=doSay)
|
||||
|
||||
def onDo(self):
|
||||
def onTrigger(self):
|
||||
'''This method is called whenever a user wants to trigger a workflow
|
||||
transition on an object.'''
|
||||
rq = self.REQUEST
|
||||
self.do(rq['workflow_action'], comment=rq.get('comment', ''))
|
||||
self.reindexObject()
|
||||
self.trigger(rq['workflow_action'], comment=rq.get('comment', ''))
|
||||
self.reindex()
|
||||
return self.goto(self.getUrl(rq['HTTP_REFERER']))
|
||||
|
||||
def fieldValueSelected(self, fieldName, vocabValue, dbValue):
|
||||
|
@ -1079,7 +1097,8 @@ class BaseMixin:
|
|||
'''Returns a wrapper object allowing to manipulate p_self the Appy
|
||||
way.'''
|
||||
# Create the dict for storing Appy wrapper on the REQUEST if needed.
|
||||
rq = self.REQUEST
|
||||
rq = getattr(self, 'REQUEST', None)
|
||||
if not rq: rq = Object()
|
||||
if not hasattr(rq, 'appyWrappers'): rq.appyWrappers = {}
|
||||
# Return the Appy wrapper from rq.appyWrappers if already there
|
||||
uid = self.UID()
|
||||
|
@ -1088,7 +1107,69 @@ class BaseMixin:
|
|||
wrapper = self.wrapperClass(self)
|
||||
rq.appyWrappers[uid] = wrapper
|
||||
return wrapper
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Standard methods for computing values of standard Appy indexes
|
||||
# --------------------------------------------------------------------------
|
||||
def UID(self):
|
||||
'''Returns the unique identifier for this object.'''
|
||||
return self._at_uid
|
||||
|
||||
def Title(self):
|
||||
'''Returns the title for this object.'''
|
||||
title = self.getAppyType('title')
|
||||
if title: return title.getValue(self)
|
||||
return self.id
|
||||
|
||||
def SortableTitle(self):
|
||||
'''Returns the title as must be stored in index "SortableTitle".'''
|
||||
return self.Title()
|
||||
|
||||
def SearchableText(self):
|
||||
'''This method concatenates the content of every field with
|
||||
searchable=True for indexing purposes.'''
|
||||
res = []
|
||||
for field in self.getAllAppyTypes():
|
||||
if not field.searchable: continue
|
||||
res.append(field.getIndexValue(self, forSearch=True))
|
||||
return res
|
||||
|
||||
def Creator(self):
|
||||
'''Who create this object?'''
|
||||
return self.creator
|
||||
|
||||
def Created(self):
|
||||
'''When was this object created ?'''
|
||||
return self.created
|
||||
|
||||
def State(self, name=True, initial=False):
|
||||
'''Returns information about the current object state. If p_name is
|
||||
True, the returned info is the state name. Else, it is the State
|
||||
instance. If p_initial is True, instead of returning info about the
|
||||
current state, it returns info about the workflow initial state.'''
|
||||
wf = self.getWorkflow()
|
||||
if initial or not hasattr(self.aq_base, 'workflow_history'):
|
||||
# No workflow information is available (yet) on this object, or
|
||||
# initial state is asked. In both cases, return info about this
|
||||
# initial state.
|
||||
res = 'active'
|
||||
for elem in dir(wf):
|
||||
attr = getattr(wf, elem)
|
||||
if (attr.__class__.__name__ == 'State') and attr.initial:
|
||||
res = elem
|
||||
break
|
||||
else:
|
||||
# Return info about the current object state
|
||||
key = self.workflow_history.keys()[0]
|
||||
res = self.workflow_history[key][-1]['review_state']
|
||||
# Return state name or state definition?
|
||||
if name: return res
|
||||
else: return getattr(wf, res)
|
||||
|
||||
def ClassName(self):
|
||||
'''Returns the name of the (Zope) class for self.'''
|
||||
return self.portal_type
|
||||
|
||||
def _appy_showState(self, workflow, stateShow):
|
||||
'''Must I show a state whose "show value" is p_stateShow?'''
|
||||
if callable(stateShow):
|
||||
|
@ -1129,11 +1210,6 @@ class BaseMixin:
|
|||
# Update the permissions
|
||||
for permission, creators in allCreators.iteritems():
|
||||
updateRolesForPermission(permission, tuple(creators), folder)
|
||||
# Beyond content-type-specific "add" permissions, creators must also
|
||||
# have the main permission "Add portal content".
|
||||
permission = 'Add portal content'
|
||||
for creators in allCreators.itervalues():
|
||||
updateRolesForPermission(permission, tuple(creators), folder)
|
||||
|
||||
def _appy_getPortalType(self, request):
|
||||
'''Guess the portal_type of p_self from info about p_self and
|
||||
|
@ -1162,7 +1238,7 @@ class BaseMixin:
|
|||
param will not be included in the URL at all).'''
|
||||
# Define the URL suffix
|
||||
suffix = ''
|
||||
if mode != 'raw': suffix = '/skyn/%s' % mode
|
||||
if mode != 'raw': suffix = '/ui/%s' % mode
|
||||
# Define base URL if omitted
|
||||
if not base:
|
||||
base = self.absolute_url() + suffix
|
||||
|
@ -1171,7 +1247,7 @@ class BaseMixin:
|
|||
if '?' in base: base = base[:base.index('?')]
|
||||
base = base.strip('/')
|
||||
for mode in ('view', 'edit'):
|
||||
suffix = 'skyn/%s' % mode
|
||||
suffix = 'ui/%s' % mode
|
||||
if base.endswith(suffix):
|
||||
base = base[:-len(suffix)].strip('/')
|
||||
break
|
||||
|
@ -1195,6 +1271,19 @@ class BaseMixin:
|
|||
params = ''
|
||||
return '%s%s' % (base, params)
|
||||
|
||||
def getUser(self):
|
||||
'''Gets the Zope object representing the authenticated user.'''
|
||||
from AccessControl import getSecurityManager
|
||||
user = getSecurityManager().getUser()
|
||||
if not user:
|
||||
from AccessControl.User import nobody
|
||||
return nobody
|
||||
return user
|
||||
|
||||
def userIsAnon(self):
|
||||
'''Is the currently logged user anonymous ?'''
|
||||
return self.getUser().getUserName() == 'Anonymous User'
|
||||
|
||||
def getUserLanguage(self):
|
||||
'''Gets the language (code) of the current user.'''
|
||||
# Try first the "LANGUAGE" key from the request
|
||||
|
@ -1291,12 +1380,11 @@ class BaseMixin:
|
|||
layout = defaultPageLayouts[layoutType]
|
||||
return layout.get()
|
||||
|
||||
def getPageTemplate(self, skyn, templateName):
|
||||
'''Returns, in the skyn folder, the page template corresponding to
|
||||
def getPageTemplate(self, ui, templateName):
|
||||
'''Returns, in the ui folder, the page template corresponding to
|
||||
p_templateName.'''
|
||||
res = skyn
|
||||
for name in templateName.split('/'):
|
||||
res = res.get(name)
|
||||
res = ui
|
||||
for name in templateName.split('/'): res = getattr(res, name)
|
||||
return res
|
||||
|
||||
def download(self):
|
||||
|
@ -1316,15 +1404,6 @@ class BaseMixin:
|
|||
response.setHeader('Expires', 'Thu, 11 Dec 1975 12:05:05 GMT')
|
||||
return theFile.index_html(self.REQUEST, self.REQUEST.RESPONSE)
|
||||
|
||||
def SearchableText(self):
|
||||
'''This method concatenates the content of every field with
|
||||
searchable=True for indexing purposes.'''
|
||||
res = []
|
||||
for field in self.getAllAppyTypes():
|
||||
if not field.searchable: continue
|
||||
res.append(field.getIndexValue(self, forSearch=True))
|
||||
return res
|
||||
|
||||
def allows(self, permission):
|
||||
'''Has the logged user p_permission on p_self ?'''
|
||||
# Get first the roles that have this permission on p_self.
|
||||
|
@ -1332,8 +1411,10 @@ class BaseMixin:
|
|||
if not hasattr(self.aq_base, zopeAttr): return
|
||||
allowedRoles = getattr(self.aq_base, zopeAttr)
|
||||
# Has the user one of those roles?
|
||||
user = self.portal_membership.getAuthenticatedMember()
|
||||
ids = [user.getId()] + user.getGroups()
|
||||
user = self.getUser()
|
||||
# XXX no groups at present
|
||||
#ids = [user.getId()] + user.getGroups()
|
||||
ids = [user.getId()]
|
||||
userGlobalRoles = user.getRoles()
|
||||
for role in allowedRoles:
|
||||
# Has the user this role ? Check in the local roles first.
|
||||
|
@ -1347,4 +1428,11 @@ class BaseMixin:
|
|||
field p_name.'''
|
||||
return 'tinyMCE.init({\nmode : "textareas",\ntheme : "simple",\n' \
|
||||
'elements : "%s",\neditor_selector : "rich_%s"\n});'% (name,name)
|
||||
|
||||
def isTemporary(self):
|
||||
'''Is this object temporary ?'''
|
||||
parent = self.getParentNode()
|
||||
if not parent: # Is propably being created through code
|
||||
return False
|
||||
return parent.getId() == 'temp_folder'
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
<tal:comment replace="nothing">
|
||||
This page is called by a XmlHttpRequest object. It requires parameters "page" and "macro":
|
||||
they are used to call the macro that will render the HTML chunk to be returned to the browser.
|
||||
It can also have a parameter "action", that refers to a method that will be triggered on
|
||||
contextObj before returning the result of the macro to the browser.
|
||||
</tal:comment>
|
||||
<tal:ajax define="contextObj context/getParentNode;
|
||||
tool contextObj/getTool;
|
||||
req python: request;
|
||||
resp req/RESPONSE;
|
||||
page req/page;
|
||||
macro req/macro;
|
||||
action req/action|nothing;
|
||||
user contextObj/portal_membership/getAuthenticatedMember;
|
||||
app tool/getApp;
|
||||
appUrl app/absolute_url;
|
||||
template python: contextObj.getPageTemplate(app.skyn, page);
|
||||
x python: resp.setHeader('Content-Type','text/html;;charset=utf-8');
|
||||
x python: resp.setHeader('Expires', 'Mon, 11 Dec 1975 12:05:05 GMT');
|
||||
x python: resp.setHeader('Content-Language', req.get('language', 'en'));
|
||||
x python: resp.setHeader('CacheControl', 'no-cache')">
|
||||
<tal:comment replace="nothing">Keys "Expires" and "CacheControl" are used for preventing IE to cache
|
||||
this page. Indeed, this page is retrieved through an asynchronous XMLHttpRequest by the browser, and
|
||||
IE caches this by default.</tal:comment>
|
||||
<tal:executeAction condition="action">
|
||||
<tal:do define="x python: contextObj.getMethod('on'+action)()" omit-tag=""/>
|
||||
</tal:executeAction>
|
||||
<metal:callMacro use-macro="python: template.macros.get(macro)"/>
|
||||
</tal:ajax>
|
|
@ -1,98 +0,0 @@
|
|||
body { font: 70% Lucida,Helvetica,Arial,sans-serif; background-color: #EAEAEA; }
|
||||
h1 { font-size: 11pt; margin:0;}
|
||||
h2 { font-size: 10pt; margin:0; font-style: italic; font-weight: normal;}
|
||||
h3 { font-size: 9pt; margin:0; font-weight: bold;}
|
||||
a { text-decoration: none; color: #503737;}
|
||||
a:visited { color: #503737;}
|
||||
table { font-size: 100%; border-spacing: 0px; border-collapse:collapse;}
|
||||
form { margin: 0; padding: 0;}
|
||||
p { margin: 0;}
|
||||
acronym {cursor: help;}
|
||||
input[type=image] { border: 0; background: none; }
|
||||
input[type=checkbox] { border: 0; background: none; cursor: pointer;}
|
||||
input[type=radio] { border: 0; background: none; cursor: pointer;}
|
||||
input[type=file] { border: 0px solid #cccccc; background-color: #f8f8f8;
|
||||
cursor: pointer;}
|
||||
input[type=button] { border: 1px solid #cccccc; background-color: #f8f8f8;
|
||||
cursor: pointer;}
|
||||
input[type=submit] { border: 1px solid #cccccc; background-color: #f8f8f8;
|
||||
cursor: pointer; }
|
||||
input[type=password] { border: 1px solid #cccccc; background-color: #f8f8f8;}
|
||||
input[type=text] { border: 1px solid #cccccc; background-color: #f8f8f8;
|
||||
font-family: Lucida,Helvetica,Arial,sans-serif;
|
||||
margin-bottom: 1px}
|
||||
select { border: 1px solid #cccccc; background-color: #f8f8f8;}
|
||||
|
||||
textarea { width: 99%; font: 100% Lucida,Helvetica,Arial,sans-serif;
|
||||
border: 1px solid #a79e9e; background-color: #f8f8f8;}
|
||||
label { font-weight: 600; font-style: italic; line-height: 1.4em;}
|
||||
legend { padding-bottom: 2px; padding-right: 3px; color: black;}
|
||||
ul { line-height: 1.2em; margin: 0 0 0.2em 0.6em; padding: 0;
|
||||
list-style: none outside none;}
|
||||
li { margin: 0; background-image: url("skyn/li.gif"); padding-left: 10px;
|
||||
background-repeat: no-repeat; background-position: 0 4px;}
|
||||
img {border: 0;}
|
||||
|
||||
.main { width: 900px; background-color: white; box-shadow: 3px 3px 3px #A9A9A9;
|
||||
border-style: solid; border-width: 1px; border-color: grey; }
|
||||
.top { height: 75px; margin-left: 3em; vertical-align: top;}
|
||||
.lang { margin-right: 3px; }
|
||||
.userStrip { background-color: #a2a2a2; height: 30px;
|
||||
border-top: 3px solid #525252; border-bottom: 2px solid #9b0000; }
|
||||
.login { margin-top: 2px; margin-bottom: 2px; color: white;}
|
||||
.buttons { margin-left: 4px;}
|
||||
.message { color: #9b0000; font-style: italic;
|
||||
position: absolute; top: -15px; right: 5px}
|
||||
.discreet { font-size: 90%; }
|
||||
.portlet { width: 150px; padding: 12px 9px 9px 9px;
|
||||
border-right: 1px solid #9b0000;}
|
||||
.portletTitle { font-weight: bold; font-size: 110%; margin-bottom: 4px;}
|
||||
.portletCurrent { font-weight: bold; }
|
||||
.portletSep { border-top: 1px solid grey; margin-top: 9px; padding-top: 9px;}
|
||||
.portletPage { font-style: italic; }
|
||||
.portletGroup { font-variant: small-caps; font-weight: bold; font-style: normal;
|
||||
margin: 0.4em 0 0.2em 0; }
|
||||
.phase { border-style: dashed; border-width: thin; padding: 0 0.6em 5px 1em;}
|
||||
.phaseSelected { background-color: #EDEDED; }
|
||||
.content { padding: 14px 3px 9px 15px;}
|
||||
.grey { display: none; position: absolute; left: 0px; top: 0px;
|
||||
background:grey; opacity:0.5; -moz-opacity:0.5; -khtml-opacity:0.5;
|
||||
filter:alpha(Opacity=50);}
|
||||
.popup { display: none; position: absolute; top: 30%; left: 35%;
|
||||
width: 350px; z-index : 100; background: white; padding: 8px;
|
||||
border: 1px solid grey; }
|
||||
.list { border: 1px solid grey; margin-bottom: 3px;}
|
||||
.list td, .list th { border: 1px solid grey;
|
||||
padding-left: 5px; padding-right: 5px; padding-top: 3px;}
|
||||
.list th { background-color: #cbcbcb; font-style: italic; font-weight: normal;}
|
||||
.grid th { font-style: italic; font-weight: normal;
|
||||
border-bottom: 2px solid grey; padding: 2px 2px;}
|
||||
.grid td { padding-right: 5px; }
|
||||
.noStyle { border: 0 !important; padding: 0 !important; margin: 0 !important; }
|
||||
.noStyle td { border:0 !important; padding:0 !important; margin:0 !important; }
|
||||
.translationLabel { background-color: #EAEAEA; border-bottom: 1px dashed grey;
|
||||
margin-top: 0.5em; margin-bottom: 0.5em; }
|
||||
.section1 { font-size: 120%; margin: 0.45em 0em 0.1em 0;
|
||||
padding: 0.3em 0em 0.2em 0.1em; background-color: #eef3f5;
|
||||
border-top: 1px solid #8CACBB;border-bottom: 1px solid #8CACBB; }
|
||||
.section2 { font-size: 110%; font-style: italic; margin: 0.45em 0em 0.2em 0;
|
||||
border-bottom: 2px solid grey; }
|
||||
.section3 { font-size: 100%; font-style: italic; margin: 0.45em 0em 0.1em 0;
|
||||
background-color: #efeae8; text-align: center; color: grey; }
|
||||
.odd { background-color: white; }
|
||||
.even { background-color: #ededed; }
|
||||
.summary {margin-bottom: 5px;}
|
||||
.objectTitle { font-size: 11pt; border-bottom: 3px solid grey;
|
||||
font-weight: bold;}
|
||||
.by { padding-top: 5px;}
|
||||
.workflow { text-align: center; border-top: 1px solid grey;
|
||||
background-color: #f8f8f8;}
|
||||
.underTitle { background-color: #ededed;}
|
||||
.objectNavigate { margin-top: 3px;}
|
||||
.underline { border-bottom: 1px dotted grey;}
|
||||
.state { font-weight: bold; border-bottom: 1px dashed grey;}
|
||||
.historyLabel { font-variant: small-caps; font-weight: bold;}
|
||||
.history td { border-top: 1px solid grey;}
|
||||
.history th { font-style: italic; text-align; left;}
|
||||
.topSpace { margin-top: 15px;}
|
||||
.discreet { color: grey}
|
|
@ -1,553 +0,0 @@
|
|||
// Functions related to user authentication
|
||||
function cookiesAreEnabled() {
|
||||
// Test whether cookies are enabled by attempting to set a cookie and then
|
||||
// change its value
|
||||
var c = "areYourCookiesEnabled=0";
|
||||
document.cookie = c;
|
||||
var dc = document.cookie;
|
||||
// Cookie not set? Fail
|
||||
if (dc.indexOf(c) == -1) return 0;
|
||||
// Change test cookie
|
||||
c = "areYourCookiesEnabled=1";
|
||||
document.cookie = c;
|
||||
dc = document.cookie;
|
||||
// Cookie not changed? fail
|
||||
if (dc.indexOf(c) == -1) return 0;
|
||||
// Delete cookie
|
||||
document.cookie = "areYourCookiesEnabled=; expires=Thu, 01-Jan-70 00:00:01 GMT";
|
||||
return 1;
|
||||
}
|
||||
|
||||
function setLoginVars() {
|
||||
// Indicate if JS is enabled
|
||||
document.getElementById('js_enabled').value = 1;
|
||||
// Indicate if cookies are enabled
|
||||
document.getElementById('cookies_enabled').value = cookiesAreEnabled();
|
||||
// Copy login and password length to alternative vars since current vars will
|
||||
// be removed from the request by zope's authentication mechanism.
|
||||
document.getElementById('login_name').value = document.getElementById('__ac_name').value;
|
||||
password = document.getElementById('__ac_password');
|
||||
emptyPassword = document.getElementById('pwd_empty');
|
||||
if (password.value.length==0) emptyPassword.value = '1';
|
||||
else emptyPassword.value = '0';
|
||||
}
|
||||
|
||||
// AJAX machinery
|
||||
var isIe = (navigator.appName == "Microsoft Internet Explorer");
|
||||
// AJAX machinery
|
||||
var xhrObjects = new Array(); // An array of XMLHttpRequest objects
|
||||
function XhrObject() { // Wraps a XmlHttpRequest object
|
||||
this.freed = 1; // Is this xhr object already dealing with a request or not?
|
||||
this.xhr = false;
|
||||
if (window.XMLHttpRequest) this.xhr = new XMLHttpRequest();
|
||||
else this.xhr = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
this.hook = ''; /* The ID of the HTML element in the page that will be
|
||||
replaced by result of executing the Ajax request. */
|
||||
this.onGet = ''; /* The name of a Javascript function to call once we
|
||||
receive the result. */
|
||||
this.info = {}; /* An associative array for putting anything else. */
|
||||
}
|
||||
|
||||
function getAjaxChunk(pos) {
|
||||
// This function is the callback called by the AJAX machinery (see function
|
||||
// askAjaxChunk below) when an Ajax response is available.
|
||||
// First, find back the correct XMLHttpRequest object
|
||||
if ( (typeof(xhrObjects[pos]) != 'undefined') &&
|
||||
(xhrObjects[pos].freed == 0)) {
|
||||
var hook = xhrObjects[pos].hook;
|
||||
if (xhrObjects[pos].xhr.readyState == 1) {
|
||||
// The request has been initialized: display the waiting radar
|
||||
var hookElem = document.getElementById(hook);
|
||||
if (hookElem) hookElem.innerHTML = "<div align=\"center\"><img src=\"skyn/waiting.gif\"/><\/div>";
|
||||
}
|
||||
if (xhrObjects[pos].xhr.readyState == 4) {
|
||||
// We have received the HTML chunk
|
||||
var hookElem = document.getElementById(hook);
|
||||
if (hookElem && (xhrObjects[pos].xhr.status == 200)) {
|
||||
hookElem.innerHTML = xhrObjects[pos].xhr.responseText;
|
||||
// Call a custom Javascript function if required
|
||||
if (xhrObjects[pos].onGet) {
|
||||
xhrObjects[pos].onGet(xhrObjects[pos], hookElem);
|
||||
}
|
||||
// Eval inner scripts if any.
|
||||
var innerScripts = document.getElementsByName("appyHook");
|
||||
for (var i=0; i<innerScripts.length; i++) {
|
||||
eval(innerScripts[i].innerHTML);
|
||||
}
|
||||
xhrObjects[pos].freed = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function askAjaxChunk(hook,mode,url,page,macro,params,beforeSend,onGet) {
|
||||
/* This function will ask to get a chunk of HTML on the server through a
|
||||
XMLHttpRequest. p_mode can be 'GET' or 'POST'. p_url is the URL of a
|
||||
given server object. On this URL we will call the page "ajax.pt" that
|
||||
will call a specific p_macro in a given p_page with some additional
|
||||
p_params (must be an associative array) if required.
|
||||
|
||||
p_hook is the ID of the HTML element that will be filled with the HTML
|
||||
result from the server.
|
||||
|
||||
p_beforeSend is a Javascript function to call before sending the request.
|
||||
This function will get 2 args: the XMLHttpRequest object and the
|
||||
p_params. This method can return, in a string, additional parameters to
|
||||
send, ie: "¶m1=blabla¶m2=blabla".
|
||||
|
||||
p_onGet is a Javascript function to call when we will receive the answer.
|
||||
This function will get 2 args, too: the XMLHttpRequest object and the
|
||||
HTML node element into which the result has been inserted.
|
||||
*/
|
||||
// First, get a non-busy XMLHttpRequest object.
|
||||
var pos = -1;
|
||||
for (var i=0; i < xhrObjects.length; i++) {
|
||||
if (xhrObjects[i].freed == 1) { pos = i; break; }
|
||||
}
|
||||
if (pos == -1) {
|
||||
pos = xhrObjects.length;
|
||||
xhrObjects[pos] = new XhrObject();
|
||||
}
|
||||
xhrObjects[pos].hook = hook;
|
||||
xhrObjects[pos].onGet = onGet;
|
||||
if (xhrObjects[pos].xhr) {
|
||||
var rq = xhrObjects[pos];
|
||||
rq.freed = 0;
|
||||
// Construct parameters
|
||||
var paramsFull = 'page=' + page + '¯o=' + macro;
|
||||
if (params) {
|
||||
for (var paramName in params)
|
||||
paramsFull = paramsFull + '&' + paramName + '=' + params[paramName];
|
||||
}
|
||||
// Call beforeSend if required
|
||||
if (beforeSend) {
|
||||
var res = beforeSend(rq, params);
|
||||
if (res) paramsFull = paramsFull + res;
|
||||
}
|
||||
// Construct the URL to call
|
||||
var urlFull = url + '/skyn/ajax';
|
||||
if (mode == 'GET') {
|
||||
urlFull = urlFull + '?' + paramsFull;
|
||||
}
|
||||
// Perform the asynchronous HTTP GET or POST
|
||||
rq.xhr.open(mode, urlFull, true);
|
||||
if (mode == 'POST') {
|
||||
// Set the correct HTTP headers
|
||||
rq.xhr.setRequestHeader(
|
||||
"Content-Type", "application/x-www-form-urlencoded");
|
||||
rq.xhr.setRequestHeader("Content-length", paramsFull.length);
|
||||
rq.xhr.setRequestHeader("Connection", "close");
|
||||
rq.xhr.onreadystatechange = function(){ getAjaxChunk(pos); }
|
||||
rq.xhr.send(paramsFull);
|
||||
}
|
||||
else if (mode == 'GET') {
|
||||
rq.xhr.onreadystatechange = function() { getAjaxChunk(pos); }
|
||||
if (window.XMLHttpRequest) { rq.xhr.send(null); }
|
||||
else if (window.ActiveXObject) { rq.xhr.send(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* The functions below wrap askAjaxChunk for getting specific content through
|
||||
an Ajax request. */
|
||||
function askQueryResult(hookId, objectUrl, contentType, searchName,
|
||||
startNumber, sortKey, sortOrder, filterKey) {
|
||||
// Sends an Ajax request for getting the result of a query.
|
||||
var params = {'type_name': contentType, 'search': searchName,
|
||||
'startNumber': startNumber};
|
||||
if (sortKey) params['sortKey'] = sortKey;
|
||||
if (sortOrder) params['sortOrder'] = sortOrder;
|
||||
if (filterKey) {
|
||||
var filterWidget = document.getElementById(hookId + '_' + filterKey);
|
||||
if (filterWidget && filterWidget.value) {
|
||||
params['filterKey'] = filterKey;
|
||||
params['filterValue'] = filterWidget.value;
|
||||
}
|
||||
}
|
||||
askAjaxChunk(hookId,'GET',objectUrl, 'result', 'queryResult', params);
|
||||
}
|
||||
|
||||
function askObjectHistory(hookId, objectUrl, maxPerPage, startNumber) {
|
||||
// Sends an Ajax request for getting the history of an object
|
||||
var params = {'maxPerPage': maxPerPage, 'startNumber': startNumber};
|
||||
askAjaxChunk(hookId, 'GET', objectUrl, 'page', 'objectHistory', params);
|
||||
}
|
||||
|
||||
function askRefField(hookId, objectUrl, fieldName, innerRef, startNumber,
|
||||
action, actionParams){
|
||||
// Sends an Ajax request for getting the content of a reference field.
|
||||
var startKey = hookId + '_startNumber';
|
||||
var params = {'fieldName': fieldName, 'innerRef': innerRef };
|
||||
params[startKey] = startNumber;
|
||||
if (action) params['action'] = action;
|
||||
if (actionParams) {
|
||||
for (key in actionParams) { params[key] = actionParams[key]; };
|
||||
}
|
||||
askAjaxChunk(hookId, 'GET', objectUrl, 'widgets/ref', 'viewContent',params);
|
||||
}
|
||||
|
||||
function askComputedField(hookId, objectUrl, fieldName) {
|
||||
// Sends an Ajax request for getting the content of a computed field
|
||||
var params = {'fieldName': fieldName};
|
||||
askAjaxChunk(hookId, 'GET', objectUrl, 'widgets/computed', 'viewContent', params);
|
||||
}
|
||||
|
||||
// Function used by checkbox widgets for having radio-button-like behaviour
|
||||
function toggleCheckbox(visibleCheckbox, hiddenBoolean) {
|
||||
vis = document.getElementById(visibleCheckbox);
|
||||
hidden = document.getElementById(hiddenBoolean);
|
||||
if (vis.checked) hidden.value = 'True';
|
||||
else hidden.value = 'False';
|
||||
}
|
||||
|
||||
// Functions used for master/slave relationships between widgets
|
||||
function getSlaveInfo(slave, infoType) {
|
||||
// Returns the appropriate info about slavery, depending on p_infoType.
|
||||
cssClasses = slave.className.split(' ');
|
||||
// Find the CSS class containing master-related info.
|
||||
for (var j=0; j < cssClasses.length; j++) {
|
||||
if (cssClasses[j].indexOf('slave_') == 0) {
|
||||
// Extract, from this CSS class, master name or master values.
|
||||
masterInfo = cssClasses[j].split('_');
|
||||
if (infoType == 'masterName') return masterInfo[1];
|
||||
else return masterInfo.slice(2); // Master values
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getMasterValues(master) {
|
||||
// Returns the list of values that p_master currently has.
|
||||
if ((master.tagName == 'INPUT') && (master.type != 'checkbox')) {
|
||||
res = master.value;
|
||||
if ((res[0] == '(') || (res[0] == '[')) {
|
||||
// There are multiple values, split it
|
||||
values = res.substring(1, res.length-1).split(',');
|
||||
res = [];
|
||||
for (var i=0; i < values.length; i++){
|
||||
v = values[i].replace(' ', '');
|
||||
res.push(v.substring(1, v.length-1));
|
||||
}
|
||||
}
|
||||
else res = [res]; // A single value
|
||||
}
|
||||
else if (master.type == 'checkbox') {
|
||||
res = master.checked + '';
|
||||
res = res.charAt(0).toUpperCase() + res.substr(1);
|
||||
res = [res];
|
||||
}
|
||||
else { // SELECT widget
|
||||
res = [];
|
||||
for (var i=0; i < master.options.length; i++) {
|
||||
if (master.options[i].selected) res.push(master.options[i].value);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
function getSlaves(master) {
|
||||
// Gets all the slaves of master.
|
||||
allSlaves = document.getElementsByName('slave');
|
||||
res = [];
|
||||
masterName = master.attributes['name'].value;
|
||||
if (master.type == 'checkbox') {
|
||||
masterName = masterName.substr(0, masterName.length-8);
|
||||
}
|
||||
slavePrefix = 'slave_' + masterName + '_';
|
||||
for (var i=0; i < allSlaves.length; i++){
|
||||
cssClasses = allSlaves[i].className.split(' ');
|
||||
for (var j=0; j < cssClasses.length; j++) {
|
||||
if (cssClasses[j].indexOf(slavePrefix) == 0) {
|
||||
res.push(allSlaves[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
function updateSlaves(master, slave) {
|
||||
// Given the value(s) in a master field, we must update slave's visibility.
|
||||
// If p_slave is given, it updates only this slave. Else, it updates all
|
||||
// slaves of p_master.
|
||||
var slaves = null;
|
||||
if (slave) { slaves = [slave]; }
|
||||
else { slaves = getSlaves(master); }
|
||||
masterValues = getMasterValues(master);
|
||||
for (var i=0; i < slaves.length; i++) {
|
||||
showSlave = false;
|
||||
slaveryValues = getSlaveInfo(slaves[i], 'masterValues');
|
||||
for (var j=0; j < slaveryValues.length; j++) {
|
||||
for (var k=0; k< masterValues.length; k++) {
|
||||
if (slaveryValues[j] == masterValues[k]) showSlave = true;
|
||||
}
|
||||
}
|
||||
if (showSlave) slaves[i].style.display = "";
|
||||
else slaves[i].style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
function initSlaves() {
|
||||
// When the current page is loaded, we must set the correct state for all
|
||||
// slave fields.
|
||||
slaves = document.getElementsByName('slave');
|
||||
i = slaves.length -1;
|
||||
while (i >= 0) {
|
||||
masterName = getSlaveInfo(slaves[i], 'masterName');
|
||||
master = document.getElementById(masterName);
|
||||
updateSlaves(master, slaves[i]);
|
||||
i -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Function used for triggering a workflow transition
|
||||
function triggerTransition(transitionId, msg) {
|
||||
var theForm = document.getElementById('triggerTransitionForm');
|
||||
theForm.workflow_action.value = transitionId;
|
||||
if (!msg) {
|
||||
theForm.submit();
|
||||
}
|
||||
else { // Ask the user to confirm.
|
||||
askConfirm('form', 'triggerTransitionForm', msg);
|
||||
}
|
||||
}
|
||||
|
||||
function onDeleteObject(objectUid) {
|
||||
f = document.getElementById('deleteForm');
|
||||
f.objectUid.value = objectUid;
|
||||
askConfirm('form', 'deleteForm', delete_confirm);
|
||||
}
|
||||
|
||||
function createCookie(name, value, days) {
|
||||
if (days) {
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime()+(days*24*60*60*1000));
|
||||
var expires = "; expires="+date.toGMTString();
|
||||
} else expires = "";
|
||||
document.cookie = name+"="+escape(value)+expires+"; path=/;";
|
||||
}
|
||||
|
||||
function readCookie(name) {
|
||||
var nameEQ = name + "=";
|
||||
var ca = document.cookie.split(';');
|
||||
for (var i=0; i < ca.length; i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0)==' ') { c = c.substring(1,c.length); }
|
||||
if (c.indexOf(nameEQ) == 0) {
|
||||
return unescape(c.substring(nameEQ.length,c.length));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function toggleCookie(cookieId) {
|
||||
// What is the state of this boolean (expanded/collapsed) cookie?
|
||||
var state = readCookie(cookieId);
|
||||
if ((state != 'collapsed') && (state != 'expanded')) {
|
||||
// No cookie yet, create it.
|
||||
createCookie(cookieId, 'collapsed');
|
||||
state = 'collapsed';
|
||||
}
|
||||
var hook = document.getElementById(cookieId); // The hook is the part of
|
||||
// the HTML document that needs to be shown or hidden.
|
||||
var displayValue = 'none';
|
||||
var newState = 'collapsed';
|
||||
var imgSrc = 'skyn/expand.gif';
|
||||
if (state == 'collapsed') {
|
||||
// Show the HTML zone
|
||||
displayValue = 'block';
|
||||
imgSrc = 'skyn/collapse.gif';
|
||||
newState = 'expanded';
|
||||
}
|
||||
// Update the corresponding HTML element
|
||||
hook.style.display = displayValue;
|
||||
var img = document.getElementById(cookieId + '_img');
|
||||
img.src = imgSrc;
|
||||
// Inverse the cookie value
|
||||
createCookie(cookieId, newState);
|
||||
}
|
||||
|
||||
// Function that allows to generate a document from a pod template.
|
||||
function generatePodDocument(contextUid, fieldName, podFormat, queryData) {
|
||||
var theForm = document.getElementsByName("podTemplateForm")[0];
|
||||
theForm.objectUid.value = contextUid;
|
||||
theForm.fieldName.value = fieldName;
|
||||
theForm.podFormat.value = podFormat;
|
||||
theForm.askAction.value = "False";
|
||||
theForm.queryData.value = queryData;
|
||||
var askActionWidget = document.getElementById(contextUid + '_' + fieldName);
|
||||
if (askActionWidget && askActionWidget.checked) {
|
||||
theForm.askAction.value = "True";
|
||||
}
|
||||
theForm.submit();
|
||||
}
|
||||
// Functions for opening and closing a popup
|
||||
function openPopup(popupId, msg) {
|
||||
// Put the message into the popup
|
||||
var confirmElem = document.getElementById('appyConfirmText');
|
||||
confirmElem.innerHTML = msg;
|
||||
// Open the popup
|
||||
var popup = document.getElementById(popupId);
|
||||
// Put it at the right place on the screen
|
||||
var scrollTop = document.body.scrollTop || window.pageYOffset || 0;
|
||||
popup.style.top = (scrollTop + 150) + 'px';
|
||||
popup.style.display = "block";
|
||||
// Show the greyed zone
|
||||
var greyed = document.getElementById('grey');
|
||||
greyed.style.top = scrollTop + 'px';
|
||||
greyed.style.display = "block";
|
||||
greyed.style.height = document.body.clientHeight;
|
||||
greyed.style.width = document.body.clientWidth;
|
||||
}
|
||||
|
||||
function closePopup(popupId) {
|
||||
// Close the popup
|
||||
var popup = document.getElementById(popupId);
|
||||
popup.style.display = "none";
|
||||
// Hide the greyed zone
|
||||
var greyed = document.getElementById('grey');
|
||||
greyed.style.display = "none";
|
||||
}
|
||||
|
||||
// Function triggered when an action needs to be confirmed by the user
|
||||
function askConfirm(actionType, action, msg) {
|
||||
/* Store the actionType (send a form, call an URL or call a script) and the
|
||||
related action, and shows the confirm popup. If the user confirms, we
|
||||
will perform the action. */
|
||||
var confirmForm = document.getElementById('confirmActionForm');
|
||||
confirmForm.actionType.value = actionType;
|
||||
confirmForm.action.value = action;
|
||||
openPopup("confirmActionPopup", msg);
|
||||
}
|
||||
|
||||
// Function triggered when an action confirmed by the user must be performed
|
||||
function doConfirm() {
|
||||
// The user confirmed: perform the required action.
|
||||
closePopup('confirmActionPopup');
|
||||
var confirmForm = document.getElementById('confirmActionForm');
|
||||
var actionType = confirmForm.actionType.value;
|
||||
var action = confirmForm.action.value;
|
||||
if (actionType == 'form') {
|
||||
// We must submit the form whose id is in "action"
|
||||
document.getElementById(action).submit();
|
||||
}
|
||||
else if (actionType == 'url') {
|
||||
// We must go to the URL defined in "action"
|
||||
window.location = action;
|
||||
}
|
||||
else if (actionType == 'script') {
|
||||
// We must execute Javascript code in "action"
|
||||
eval(action);
|
||||
}
|
||||
}
|
||||
|
||||
// Function that finally posts the edit form after the user has confirmed that
|
||||
// she really wants to post it.
|
||||
function postConfirmedEditForm() {
|
||||
var theForm = document.getElementById('appyEditForm');
|
||||
theForm.confirmed.value = "True";
|
||||
theForm.submit();
|
||||
}
|
||||
|
||||
// Function that shows or hides a tab. p_action is 'show' or 'hide'.
|
||||
function manageTab(tabId, action) {
|
||||
// Manage the tab content (show it or hide it)
|
||||
var content = document.getElementById('tabcontent_' + tabId);
|
||||
if (action == 'show') { content.style.display = 'table-row'; }
|
||||
else { content.style.display = 'none'; }
|
||||
// Manage the tab itself (show as selected or unselected)
|
||||
var left = document.getElementById('tab_' + tabId + '_left');
|
||||
var tab = document.getElementById('tab_' + tabId);
|
||||
var right = document.getElementById('tab_' + tabId + '_right');
|
||||
if (action == 'show') {
|
||||
left.src = "skyn/tabLeft.png";
|
||||
tab.style.backgroundImage = "url(skyn/tabBg.png)";
|
||||
right.src = "skyn/tabRight.png";
|
||||
}
|
||||
if (action == 'hide') {
|
||||
left.src = "skyn/tabLeftu.png";
|
||||
tab.style.backgroundImage = "url(skyn/tabBgu.png)";
|
||||
right.src = "skyn/tabRightu.png";
|
||||
}
|
||||
}
|
||||
|
||||
// Function used for displaying/hiding content of a tab
|
||||
function showTab(tabId) {
|
||||
// 1st, show the tab to show
|
||||
manageTab(tabId, 'show');
|
||||
// Compute the number of tabs.
|
||||
var idParts = tabId.split('_');
|
||||
var prefix = idParts[0] + '_';
|
||||
// Store the currently selected tab in a cookie.
|
||||
createCookie('tab_' + idParts[0], tabId);
|
||||
var nbOfTabs = idParts[2]*1;
|
||||
// Then, hide the other tabs.
|
||||
for (var i=0; i<nbOfTabs; i++) {
|
||||
var idTab = prefix + (i+1) + '_' + nbOfTabs;
|
||||
if (idTab != tabId) {
|
||||
manageTab(idTab, 'hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Function that initializes the state of a tab
|
||||
function initTab(cookieId, defaultValue) {
|
||||
var toSelect = readCookie(cookieId);
|
||||
if (!toSelect) { showTab(defaultValue) }
|
||||
else { showTab(toSelect); }
|
||||
}
|
||||
|
||||
// List-related Javascript functions
|
||||
function updateRowNumber(row, rowIndex, action) {
|
||||
/* Within p_row, we update every field whose name and id include the row index
|
||||
with new p_rowIndex. If p_action is 'set', p_rowIndex becomes the new
|
||||
index. If p_action is 'add', new index becomes:
|
||||
existing index + p_rowIndex. */
|
||||
tagTypes = ['input', 'select'];
|
||||
currentIndex = -1;
|
||||
for (var i=0; i < tagTypes.length; i++) {
|
||||
widgets = row.getElementsByTagName(tagTypes[i]);
|
||||
for (var j=0; j < widgets.length; j++) {
|
||||
id = widgets[j].id;
|
||||
name = widgets[j].name;
|
||||
idNbIndex = id.lastIndexOf('*') + 1;
|
||||
nameNbIndex = name.lastIndexOf('*') + 1;
|
||||
// Compute the current row index if not already done.
|
||||
if (currentIndex == -1) {
|
||||
currentIndex = parseInt(id.substring(idNbIndex));
|
||||
}
|
||||
// Compute the new values for attributes "id" and "name".
|
||||
newId = id.substring(0, idNbIndex);
|
||||
newName = id.substring(0, nameNbIndex);
|
||||
newIndex = rowIndex;
|
||||
if (action == 'add') newIndex = newIndex + currentIndex;
|
||||
widgets[j].id = newId + String(newIndex);
|
||||
widgets[j].name = newName + String(newIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
function insertRow(tableId) {
|
||||
// This function adds a new row in table with ID p_tableId.
|
||||
table = document.getElementById(tableId);
|
||||
newRow = table.rows[1].cloneNode(true);
|
||||
newRow.style.display = 'table-row';
|
||||
// Within newRow, I must include in field names and ids the row number
|
||||
updateRowNumber(newRow, table.rows.length-3, 'set');
|
||||
table.tBodies[0].appendChild(newRow);
|
||||
}
|
||||
|
||||
function deleteRow(tableId, deleteImg) {
|
||||
row = deleteImg.parentNode.parentNode;
|
||||
table = document.getElementById(tableId);
|
||||
allRows = table.rows;
|
||||
toDeleteIndex = -1; // Will hold the index of the row to delete.
|
||||
for (var i=0; i < allRows.length; i++) {
|
||||
if (toDeleteIndex == -1) {
|
||||
if (row == allRows[i]) toDeleteIndex = i;
|
||||
}
|
||||
else {
|
||||
// Decrement higher row numbers by 1 because of the deletion
|
||||
updateRowNumber(allRows[i], -1, 'add');
|
||||
}
|
||||
}
|
||||
table.deleteRow(toDeleteIndex);
|
||||
}
|
Before Width: | Height: | Size: 899 B |
Before Width: | Height: | Size: 232 B |
Before Width: | Height: | Size: 212 B |
Before Width: | Height: | Size: 218 B |
Before Width: | Height: | Size: 212 B |
Before Width: | Height: | Size: 216 B |
Before Width: | Height: | Size: 232 B |
|
@ -1,252 +0,0 @@
|
|||
/* The main calendar widget. DIV containing a table. */
|
||||
|
||||
.calendar {
|
||||
position: relative;
|
||||
display: none;
|
||||
border: 1px solid;
|
||||
border-color: #fff #000 #000 #fff;
|
||||
font-size: 11px;
|
||||
cursor: default;
|
||||
background: Window;
|
||||
color: WindowText;
|
||||
font-family: tahoma,verdana,sans-serif;
|
||||
}
|
||||
|
||||
.calendar table {
|
||||
border: 1px solid;
|
||||
border-color: #fff #000 #000 #fff;
|
||||
font-size: 11px;
|
||||
cursor: default;
|
||||
background: Window;
|
||||
color: WindowText;
|
||||
font-family: tahoma,verdana,sans-serif;
|
||||
}
|
||||
|
||||
/* Header part -- contains navigation buttons and day names. */
|
||||
|
||||
.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */
|
||||
text-align: center;
|
||||
padding: 1px;
|
||||
border: 1px solid;
|
||||
border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;
|
||||
background: ButtonFace;
|
||||
}
|
||||
|
||||
.calendar .nav {
|
||||
background: ButtonFace url(menuarrow.gif) no-repeat 100% 100%;
|
||||
}
|
||||
|
||||
.calendar thead .title { /* This holds the current "month, year" */
|
||||
font-weight: bold;
|
||||
padding: 1px;
|
||||
border: 1px solid #000;
|
||||
background: ActiveCaption;
|
||||
color: CaptionText;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.calendar thead .headrow { /* Row <TR> containing navigation buttons */
|
||||
}
|
||||
|
||||
.calendar thead .daynames { /* Row <TR> containing the day names */
|
||||
}
|
||||
|
||||
.calendar thead .name { /* Cells <TD> containing the day names */
|
||||
border-bottom: 1px solid ButtonShadow;
|
||||
padding: 2px;
|
||||
text-align: center;
|
||||
background: ButtonFace;
|
||||
color: ButtonText;
|
||||
}
|
||||
|
||||
.calendar thead .weekend { /* How a weekend day name shows in header */
|
||||
color: #f00;
|
||||
}
|
||||
|
||||
.calendar thead .hilite { /* How do the buttons in header appear when hover */
|
||||
border: 2px solid;
|
||||
padding: 0px;
|
||||
border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;
|
||||
}
|
||||
|
||||
.calendar thead .active { /* Active (pressed) buttons in header */
|
||||
border-width: 1px;
|
||||
padding: 2px 0px 0px 2px;
|
||||
border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
|
||||
}
|
||||
|
||||
/* The body part -- contains all the days in month. */
|
||||
|
||||
.calendar tbody .day { /* Cells <TD> containing month days dates */
|
||||
width: 2em;
|
||||
text-align: right;
|
||||
padding: 2px 4px 2px 2px;
|
||||
}
|
||||
.calendar tbody .day.othermonth {
|
||||
font-size: 80%;
|
||||
color: #aaa;
|
||||
}
|
||||
.calendar tbody .day.othermonth.oweekend {
|
||||
color: #faa;
|
||||
}
|
||||
|
||||
.calendar table .wn {
|
||||
padding: 2px 3px 2px 2px;
|
||||
border-right: 1px solid ButtonShadow;
|
||||
background: ButtonFace;
|
||||
color: ButtonText;
|
||||
}
|
||||
|
||||
.calendar tbody .rowhilite td {
|
||||
background: Highlight;
|
||||
color: HighlightText;
|
||||
}
|
||||
|
||||
.calendar tbody td.hilite { /* Hovered cells <TD> */
|
||||
padding: 1px 3px 1px 1px;
|
||||
border-top: 1px solid #fff;
|
||||
border-right: 1px solid #000;
|
||||
border-bottom: 1px solid #000;
|
||||
border-left: 1px solid #fff;
|
||||
}
|
||||
|
||||
.calendar tbody td.active { /* Active (pressed) cells <TD> */
|
||||
padding: 2px 2px 0px 2px;
|
||||
border: 1px solid;
|
||||
border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
|
||||
}
|
||||
|
||||
.calendar tbody td.selected { /* Cell showing selected date */
|
||||
font-weight: bold;
|
||||
border: 1px solid;
|
||||
border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
|
||||
padding: 2px 2px 0px 2px;
|
||||
background: ButtonFace;
|
||||
color: ButtonText;
|
||||
}
|
||||
|
||||
.calendar tbody td.weekend { /* Cells showing weekend days */
|
||||
color: #f00;
|
||||
}
|
||||
|
||||
.calendar tbody td.today { /* Cell showing today date */
|
||||
font-weight: bold;
|
||||
color: #00f;
|
||||
}
|
||||
|
||||
.calendar tbody td.disabled { color: GrayText; }
|
||||
|
||||
.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* The footer part -- status bar and "Close" button */
|
||||
|
||||
.calendar tfoot .footrow { /* The <TR> in footer (only one right now) */
|
||||
}
|
||||
|
||||
.calendar tfoot .ttip { /* Tooltip (status bar) cell <TD> */
|
||||
background: ButtonFace;
|
||||
padding: 1px;
|
||||
border: 1px solid;
|
||||
border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
|
||||
color: ButtonText;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.calendar tfoot .hilite { /* Hover style for buttons in footer */
|
||||
border-top: 1px solid #fff;
|
||||
border-right: 1px solid #000;
|
||||
border-bottom: 1px solid #000;
|
||||
border-left: 1px solid #fff;
|
||||
padding: 1px;
|
||||
background: #e4e0d8;
|
||||
}
|
||||
|
||||
.calendar tfoot .active { /* Active (pressed) style for buttons in footer */
|
||||
padding: 2px 0px 0px 2px;
|
||||
border-top: 1px solid #000;
|
||||
border-right: 1px solid #fff;
|
||||
border-bottom: 1px solid #fff;
|
||||
border-left: 1px solid #000;
|
||||
}
|
||||
|
||||
/* Combo boxes (menus that display months/years for direct selection) */
|
||||
|
||||
.calendar .combo {
|
||||
position: absolute;
|
||||
display: none;
|
||||
width: 4em;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
cursor: default;
|
||||
border: 1px solid;
|
||||
border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;
|
||||
background: Menu;
|
||||
color: MenuText;
|
||||
font-size: 90%;
|
||||
padding: 1px;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.calendar .combo .label,
|
||||
.calendar .combo .label-IEfix {
|
||||
text-align: center;
|
||||
display: block;
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
.calendar .combo .label-IEfix {
|
||||
width: 4em;
|
||||
}
|
||||
|
||||
.calendar .combo .active {
|
||||
padding: 0px;
|
||||
border: 1px solid #000;
|
||||
}
|
||||
|
||||
.calendar .combo .hilite {
|
||||
background: Highlight;
|
||||
color: HighlightText;
|
||||
}
|
||||
|
||||
.calendar td.time {
|
||||
border-top: 1px solid ButtonShadow;
|
||||
padding: 1px 0px;
|
||||
text-align: center;
|
||||
background-color: ButtonFace;
|
||||
}
|
||||
|
||||
.calendar td.time .hour,
|
||||
.calendar td.time .minute,
|
||||
.calendar td.time .ampm {
|
||||
padding: 0px 3px 0px 4px;
|
||||
border: 1px solid #889;
|
||||
font-weight: bold;
|
||||
background-color: Menu;
|
||||
}
|
||||
|
||||
.calendar td.time .ampm {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.calendar td.time .colon {
|
||||
padding: 0px 2px 0px 3px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.calendar td.time span.hilite {
|
||||
border-color: #000;
|
||||
background-color: Highlight;
|
||||
color: HighlightText;
|
||||
}
|
||||
|
||||
.calendar td.time span.active {
|
||||
border-color: #f00;
|
||||
background-color: #000;
|
||||
color: #0f0;
|
||||
}
|
Before Width: | Height: | Size: 953 B |
|
@ -1,12 +0,0 @@
|
|||
<tal:comment replace="nothing">
|
||||
This page allows to call any macro from Python code, for example.
|
||||
</tal:comment>
|
||||
<tal:call tal:define="macroName options/macroName;
|
||||
page python: options['page'];
|
||||
contextObj python: options['contextObj'];
|
||||
tool contextObj/getTool;
|
||||
layoutType python:'view';
|
||||
phaseInfo python: contextObj.getAppyPhases(currentOnly=True, layoutType='view');
|
||||
phase phaseInfo/name;">
|
||||
<metal:callMacro use-macro="python: page.macros[macroName]"/>
|
||||
</tal:call>
|
Before Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 70 B |
Before Width: | Height: | Size: 244 B |
Before Width: | Height: | Size: 239 B |
|
@ -1,15 +0,0 @@
|
|||
## Python Script "do.py"
|
||||
##bind context=context
|
||||
##parameters=action
|
||||
rq = context.REQUEST
|
||||
|
||||
# Get the object impacted by the action.
|
||||
if rq.get('objectUid', None):
|
||||
obj = context.portal_catalog(UID=rq['objectUid'])[0].getObject()
|
||||
else:
|
||||
obj = context.getParentNode() # An appy obj or in some cases the app folder.
|
||||
if obj.portal_type == 'AppyFolder':
|
||||
from Products.CMFCore.utils import getToolByName
|
||||
portal = getToolByName(obj, 'portal_url').getPortalObject()
|
||||
obj = portal.get('portal_%s' % obj.id.lower()) # The tool
|
||||
return obj.getMethod('on'+action)()
|
Before Width: | Height: | Size: 818 B |
Before Width: | Height: | Size: 248 B |
Before Width: | Height: | Size: 475 B |
|
@ -1,37 +0,0 @@
|
|||
<tal:main define="tool context/getTool">
|
||||
<html metal:use-macro="context/skyn/template/macros/main">
|
||||
<metal:fill fill-slot="content"
|
||||
tal:define="contextObj context/getParentNode;
|
||||
errors request/errors | python:{};
|
||||
layoutType python:'edit';
|
||||
layout python: contextObj.getPageLayout(layoutType);
|
||||
phaseInfo python: contextObj.getAppyPhases(currentOnly=True, layoutType=layoutType);
|
||||
phase phaseInfo/name;
|
||||
page request/page|python:'main';
|
||||
cssJs python: contextObj.getCssAndJs(contextObj.getAppyTypes(layoutType, page), layoutType);
|
||||
confirmMsg request/confirmMsg | nothing;">
|
||||
|
||||
<tal:comment replace="nothing">Include type-specific CSS and JS.</tal:comment>
|
||||
<link tal:repeat="cssFile cssJs/css" rel="stylesheet" type="text/css"
|
||||
tal:attributes="href string:$appUrl/skyn/$cssFile"/>
|
||||
<script tal:repeat="jsFile cssJs/js" type="text/javascript"
|
||||
tal:attributes="src string:$appUrl/skyn/$jsFile"></script>
|
||||
|
||||
<metal:prologue use-macro="here/skyn/page/macros/prologue"/>
|
||||
<form id="appyEditForm" name="appyEditForm" method="post" enctype="multipart/form-data"
|
||||
tal:attributes="action python: contextObj.absolute_url()+'/skyn/do';
|
||||
class python: test(confirmMsg, 'atBaseEditForm', 'enableUnloadProtection atBaseEditForm')">
|
||||
<input type="hidden" name="action" value="Update"/>
|
||||
<input type="hidden" name="page" tal:attributes="value page"/>
|
||||
<input type="hidden" name="nav" tal:attributes="value request/nav|nothing"/>
|
||||
<input type="hidden" name="is_new" tal:attributes="value contextObj/isTemporary"/>
|
||||
<input type="hidden" name="confirmed" value="False"/>
|
||||
<metal:show use-macro="here/skyn/page/macros/show"/>
|
||||
</form>
|
||||
<script tal:condition="confirmMsg"
|
||||
tal:content="python: 'askConfirm(\'script\', \'postConfirmedEditForm()\', \'%s\')' % confirmMsg">
|
||||
</script>
|
||||
<metal:footer use-macro="here/skyn/page/macros/footer"/>
|
||||
</metal:fill>
|
||||
</html>
|
||||
</tal:main>
|
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 72 B |
Before Width: | Height: | Size: 372 B |
Before Width: | Height: | Size: 62 B |
Before Width: | Height: | Size: 719 B |
Before Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 591 B |
Before Width: | Height: | Size: 589 B |
Before Width: | Height: | Size: 705 B |
|
@ -1,125 +0,0 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
|
||||
lang="en" xmlns:tal="http://xml.zope.org/namespaces/tal"
|
||||
xmlns:metal="http://xml.zope.org/namespaces/metal"
|
||||
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
||||
metal:use-macro="here/main_template/macros/master">
|
||||
|
||||
<tal:comment replace="nothing">Disable standard Plone green tabs</tal:comment>
|
||||
<div metal:fill-slot="top_slot">
|
||||
<metal:block metal:use-macro="here/global_defines/macros/defines" />
|
||||
<div tal:define="dummy python:request.set('disable_border', 1)" />
|
||||
</div>
|
||||
|
||||
<tal:comment replace="nothing">Fill main slot of Plone main_template</tal:comment>
|
||||
<body>
|
||||
<metal:fill fill-slot="main"
|
||||
tal:define="appFolder context/getParentNode;
|
||||
contentType request/type_name;
|
||||
tool python: portal.get('portal_%s' % appFolder.id.lower());
|
||||
importElems python: tool.getImportElements(contentType);
|
||||
global allAreImported python:True">
|
||||
|
||||
<div metal:use-macro="here/skyn/page/macros/prologue"/>
|
||||
<script language="javascript">
|
||||
<!--
|
||||
var importedElemsShown = false;
|
||||
function toggleViewableElements() {
|
||||
var rows = document.getElementsByName('importedElem');
|
||||
var newDisplay = 'table-row';
|
||||
if (isIe) newDisplay = 'block';
|
||||
if (importedElemsShown) newDisplay = 'none';
|
||||
for (var i=0; i<rows.length; i++) {
|
||||
rows[i].style.display = newDisplay;
|
||||
}
|
||||
importedElemsShown = !importedElemsShown;
|
||||
}
|
||||
var checkBoxesChecked = true;
|
||||
function toggleCheckboxes() {
|
||||
var checkBoxes = document.getElementsByName('cbElem');
|
||||
var newCheckValue = true;
|
||||
if (checkBoxesChecked) newCheckValue = false;
|
||||
for (var i=0; i<checkBoxes.length; i++) {
|
||||
checkBoxes[i].checked = newCheckValue;
|
||||
}
|
||||
checkBoxesChecked = newCheckValue;
|
||||
}
|
||||
function importSingleElement(importPath) {
|
||||
var f = document.forms['importElements'];
|
||||
f.importPath.value = importPath;
|
||||
f.submit();
|
||||
}
|
||||
function importManyElements() {
|
||||
var f = document.forms['importElements'];
|
||||
var importPaths = '';
|
||||
// Get the values of the checkboxes
|
||||
var checkBoxes = document.getElementsByName('cbElem');
|
||||
for (var i=0; i<checkBoxes.length; i++) {
|
||||
if (checkBoxes[i].checked) {
|
||||
importPaths += checkBoxes[i].value + '|';
|
||||
}
|
||||
}
|
||||
if (! importPaths) alert(no_elem_selected);
|
||||
else {
|
||||
f.importPath.value = importPaths;
|
||||
f.submit();
|
||||
}
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
<tal:comment replace="nothing">Form for importing several meetings at once.</tal:comment>
|
||||
<form name="importElements"
|
||||
tal:attributes="action python: appFolder.absolute_url()+'/skyn/do'" method="post">
|
||||
<input type="hidden" name="action" value="ImportObjects"/>
|
||||
<input type="hidden" name="type_name" tal:attributes="value contentType"/>
|
||||
<input type="hidden" name="importPath" value=""/>
|
||||
</form>
|
||||
|
||||
<h1 tal:content="python: tool.translate('import_title')"></h1><br/>
|
||||
<table class="list" width="100%">
|
||||
<tr>
|
||||
<th tal:repeat="columnHeader python: importElems[0]">
|
||||
<img tal:condition="python: repeat['columnHeader'].number() == 1"
|
||||
tal:attributes="src string:$appUrl/skyn/eye.png;
|
||||
title python: tool.translate('import_show_hide')"
|
||||
style="cursor:pointer" onClick="toggleViewableElements()" align="left" />
|
||||
<span tal:replace="columnHeader"/>
|
||||
</th>
|
||||
<th tal:content="python: tool.translate('ref_actions')"></th>
|
||||
<th width="20px"><img
|
||||
tal:attributes="src string: $appUrl/skyn/select_elems.png;
|
||||
title python: tool.translate('select_delesect')"
|
||||
onClick="toggleCheckboxes()" style="cursor:pointer"/>
|
||||
</tr>
|
||||
<tal:row repeat="row python: importElems[1]">
|
||||
<tr tal:define="alreadyImported python: tool.isAlreadyImported(contentType, row[0]);
|
||||
global allAreImported python: allAreImported and alreadyImported;
|
||||
odd repeat/row/odd"
|
||||
tal:attributes="id python: alreadyImported and 'importedElem' or 'notImportedElem';
|
||||
name python: alreadyImported and 'importedElem' or 'notImportedElem';
|
||||
style python: alreadyImported and 'display:none' or 'display:table-row';
|
||||
class python: odd and 'even' or 'odd'">
|
||||
<td tal:repeat="elem python: row[1:]" tal:content="elem">
|
||||
</td>
|
||||
<td>
|
||||
<input type="button" tal:condition="not: alreadyImported"
|
||||
tal:attributes="onClick python: 'importSingleElement(\'%s\')' % row[0];
|
||||
value python: tool.translate('query_import')"/>
|
||||
<span tal:condition="alreadyImported" tal:replace="python: tool.translate('import_already')"/>
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="checkbox" checked="checked" id="cbElem" name="cbElem"
|
||||
tal:attributes="value python: row[0]" tal:condition="not: alreadyImported"/>
|
||||
</td>
|
||||
</tr>
|
||||
</tal:row>
|
||||
<tr tal:condition="python: not importElems[1] or allAreImported"><td colspan="15" tal:content="python: tool.translate('query_no_result')"></td></tr>
|
||||
</table>
|
||||
<tal:comment replace="nothing">Button for importing several elements at once.</tal:comment>
|
||||
<p align="right"><br/>
|
||||
<input type="button" onClick="importManyElements()"
|
||||
tal:condition="python: importElems[1] and not allAreImported"
|
||||
tal:attributes="value python:tool.translate('import_many')"/>
|
||||
</p>
|
||||
</metal:fill>
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 51 B |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 636 B |
|
@ -1,117 +0,0 @@
|
|||
<div metal:define-macro="appyNavigate" tal:condition="python: totalNumber > batchSize" align="right">
|
||||
<tal:comment replace="nothing">
|
||||
Buttons for navigating among a list of elements (next, back, first, last, etc).
|
||||
</tal:comment>
|
||||
<table class="listNavigate"
|
||||
tal:define="mustSortAndFilter python: ajaxHookId == 'queryResult';
|
||||
sortKey sortKey|python:'';
|
||||
sortOrder sortOrder|python:'';
|
||||
filterKey filterKey|python:'';
|
||||
sortAndFilter python: test(mustSortAndFilter, ',\'%s\',\'%s\',\'%s\'' % (sortKey, sortOrder, filterKey), '')">
|
||||
<tr valign="middle">
|
||||
<tal:comment replace="nothing">Go to the first page</tal:comment>
|
||||
<td tal:condition="python: (startNumber != 0) and (startNumber != batchSize)"><img style="cursor:pointer"
|
||||
tal:attributes="src string: $appUrl/skyn/arrowLeftDouble.png;
|
||||
title python: tool.translate('goto_first');
|
||||
onClick python: navBaseCall.replace('**v**', '0'+sortAndFilter)"/></td>
|
||||
<tal:comment replace="nothing">Go to the previous page</tal:comment>
|
||||
<td tal:define="sNumber python: startNumber - batchSize"
|
||||
tal:condition="python: startNumber != 0"><img style="cursor:pointer"
|
||||
tal:attributes="src string: $appUrl/skyn/arrowLeftSimple.png;
|
||||
title python: tool.translate('goto_previous');
|
||||
onClick python: navBaseCall.replace('**v**', str(sNumber)+sortAndFilter)"/></td>
|
||||
<tal:comment replace="nothing">Explain which elements are currently shown</tal:comment>
|
||||
<td class="discreet">
|
||||
<span tal:replace="python: startNumber+1"/>
|
||||
<img tal:attributes="src string: $appUrl/skyn/to.png"/>
|
||||
<span tal:replace="python: startNumber+len(objs)"/> <b>//</b>
|
||||
<span tal:replace="python: totalNumber"/>
|
||||
</td>
|
||||
<tal:comment replace="nothing">Go to the next page</tal:comment>
|
||||
<td tal:define="sNumber python: startNumber + batchSize"
|
||||
tal:condition="python: sNumber < totalNumber"><img style="cursor:pointer"
|
||||
tal:attributes="src string: $appUrl/skyn/arrowRightSimple.png;
|
||||
title python: tool.translate('goto_next');
|
||||
onClick python: navBaseCall.replace('**v**', str(sNumber)+sortAndFilter)"/></td>
|
||||
<tal:comment replace="nothing">Go to the last page</tal:comment>
|
||||
<td tal:define="lastPageIsIncomplete python: totalNumber % batchSize;
|
||||
nbOfCompletePages python: totalNumber/batchSize;
|
||||
nbOfCountedPages python: test(lastPageIsIncomplete, nbOfCompletePages, nbOfCompletePages-1);
|
||||
sNumber python: (nbOfCountedPages*batchSize)"
|
||||
tal:condition="python: (startNumber != sNumber) and (startNumber != sNumber-batchSize)"><img style="cursor:pointer"
|
||||
tal:attributes="src string: $appUrl/skyn/arrowRightDouble.png;
|
||||
title python: tool.translate('goto_last');
|
||||
onClick python: navBaseCall.replace('**v**', str(sNumber)+sortAndFilter)"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div metal:define-macro="objectNavigate" tal:condition="request/nav|nothing">
|
||||
<tal:comment replace="nothing">
|
||||
Buttons for going to next/previous elements if this one is among bunch of referenced or searched objects.
|
||||
currentNumber starts with 1.
|
||||
</tal:comment>
|
||||
<table class="objectNavigate"
|
||||
tal:define="navInfo tool/getNavigationInfo;
|
||||
currentNumber navInfo/currentNumber;
|
||||
totalNumber navInfo/totalNumber;
|
||||
firstUrl navInfo/firstUrl;
|
||||
previousUrl navInfo/previousUrl;
|
||||
nextUrl navInfo/nextUrl;
|
||||
lastUrl navInfo/lastUrl;
|
||||
sourceUrl navInfo/sourceUrl;
|
||||
backText navInfo/backText">
|
||||
<tr valign="middle">
|
||||
<tal:comment replace="nothing">Go to the source URL (search or referred object)</tal:comment>
|
||||
<td tal:condition="sourceUrl"><a tal:attributes="href sourceUrl"><img style="cursor:pointer"
|
||||
tal:attributes="src string: $appUrl/skyn/gotoSource.png;
|
||||
title python: backText + ' : ' + tool.translate('goto_source')"/></a></td>
|
||||
<tal:comment replace="nothing">Go to the first page</tal:comment>
|
||||
<td tal:condition="firstUrl"><a tal:attributes="href firstUrl"><img style="cursor:pointer"
|
||||
tal:attributes="src string: $appUrl/skyn/arrowLeftDouble.png;
|
||||
title python: tool.translate('goto_first')"/></a></td>
|
||||
<tal:comment replace="nothing">Go to the previous page</tal:comment>
|
||||
<td tal:condition="previousUrl"><a tal:attributes="href previousUrl"><img style="cursor:pointer"
|
||||
tal:attributes="src string: $appUrl/skyn/arrowLeftSimple.png;
|
||||
title python: tool.translate('goto_previous')"/></a></td>
|
||||
<tal:comment replace="nothing">Explain which element is currently shown</tal:comment>
|
||||
<td class="discreet">
|
||||
<span tal:replace="python: currentNumber"/> <b>//</b>
|
||||
<span tal:replace="python: totalNumber"/>
|
||||
</td>
|
||||
<tal:comment replace="nothing">Go to the next page</tal:comment>
|
||||
<td tal:condition="python: nextUrl"><a tal:attributes="href nextUrl"><img style="cursor:pointer"
|
||||
tal:attributes="src string: $appUrl/skyn/arrowRightSimple.png;
|
||||
title python: tool.translate('goto_next')"/></a></td>
|
||||
<tal:comment replace="nothing">Go to the last page</tal:comment>
|
||||
<td tal:condition="lastUrl"><a tal:attributes="href lastUrl"><img style="cursor:pointer"
|
||||
tal:attributes="src string: $appUrl/skyn/arrowRightDouble.png;
|
||||
title python: tool.translate('goto_last')"/></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<tal:comment replace="nothing">
|
||||
This macro displays up/down arrows in a table header column for sorting a given column.
|
||||
It requires variables "sortable", 'filterable' and 'fieldName'.
|
||||
</tal:comment>
|
||||
<metal:sortAndFilter define-macro="sortAndFilter" tal:define="fieldName widget/name">
|
||||
<tal:sort condition="sortable">
|
||||
<img tal:attributes="src string: $appUrl/skyn/sortDown.gif;
|
||||
onClick python: navBaseCall.replace('**v**', '0,\'%s\',\'asc\',\'%s\'' % (fieldName, filterKey))"
|
||||
tal:condition="python: (sortKey != fieldName) or (sortOrder == 'desc')"
|
||||
style="cursor:pointer"/>
|
||||
<img tal:attributes="src string: $appUrl/skyn/sortUp.gif;
|
||||
onClick python: navBaseCall.replace('**v**', '0,\'%s\',\'desc\',\'%s\'' % (fieldName, filterKey))"
|
||||
tal:condition="python: (sortKey != fieldName) or (sortOrder == 'asc')"
|
||||
style="cursor:pointer"/>
|
||||
</tal:sort>
|
||||
<tal:filter condition="filterable">
|
||||
<input type="text" size="7"
|
||||
tal:attributes="id python: '%s_%s' % (ajaxHookId, fieldName);
|
||||
value python: test(filterKey == fieldName, filterValue, '')"/>
|
||||
<img tal:attributes="src string: $appUrl/skyn/funnel.png;
|
||||
onClick python: navBaseCall.replace('**v**', '0,\'%s\',\'%s\',\'%s\'' % (sortKey, sortOrder, fieldName))"
|
||||
style="cursor:pointer"/>
|
||||
</tal:filter>
|
||||
</metal:sortAndFilter>
|
Before Width: | Height: | Size: 951 B |
Before Width: | Height: | Size: 211 B |
Before Width: | Height: | Size: 192 B |
Before Width: | Height: | Size: 754 B |
|
@ -1,339 +0,0 @@
|
|||
<tal:comment replace="nothing">
|
||||
This macro contains global page-related Javascripts.
|
||||
</tal:comment>
|
||||
<div metal:define-macro="prologue">
|
||||
<tal:comment replace="nothing">Javascript messages</tal:comment>
|
||||
<script language="javascript" tal:content="tool/getJavascriptMessages"></script>
|
||||
|
||||
<tal:comment replace="nothing">Global form for deleting an object</tal:comment>
|
||||
<form id="deleteForm" method="post" action="skyn/do">
|
||||
<input type="hidden" name="action" value="Delete"/>
|
||||
<input type="hidden" name="objectUid"/>
|
||||
</form>
|
||||
<tal:comment replace="nothing">Global form for generating a document from a pod template.</tal:comment>
|
||||
<form name="podTemplateForm" method="post"
|
||||
tal:attributes="action python: tool.absolute_url() + '/generateDocument'">
|
||||
<input type="hidden" name="objectUid"/>
|
||||
<input type="hidden" name="fieldName"/>
|
||||
<input type="hidden" name="podFormat"/>
|
||||
<input type="hidden" name="askAction"/>
|
||||
<input type="hidden" name="queryData"/>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<tal:comment replace="nothing">
|
||||
This macro shows the content of page. Because a page is a layouted object,
|
||||
we simply call the macro that displays a layouted object.
|
||||
contextObj The Zope object for which this page must be shown
|
||||
layoutType The kind of layout: "view"? "edit"? "cell"?
|
||||
layout The layout object that will dictate how object content
|
||||
will be rendered.
|
||||
</tal:comment>
|
||||
<metal:show define-macro="show">
|
||||
<metal:layout use-macro="here/skyn/widgets/show/macros/layout"/>
|
||||
</metal:show>
|
||||
|
||||
<tal:comment replace="nothing">
|
||||
This macro displays all widgets of a given page. It requires:
|
||||
contextObj The Zope object for which widgets must be shown
|
||||
page We show widgets of a given page
|
||||
layoutType We must know if we must render the widgets in a "view",
|
||||
"edit" or "cell" layout
|
||||
</tal:comment>
|
||||
<table metal:define-macro="widgets"
|
||||
tal:attributes="width layout/width">
|
||||
<tr tal:repeat="widget python: contextObj.getGroupedAppyTypes(layoutType, page)">
|
||||
<td tal:condition="python: widget['type'] == 'group'">
|
||||
<metal:call use-macro="app/skyn/widgets/show/macros/group"/>
|
||||
</td>
|
||||
<td tal:condition="python: widget['type'] != 'group'">
|
||||
<metal:call use-macro="app/skyn/widgets/show/macros/field"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<tal:comment replace="nothing">
|
||||
This macro displays an object's history. It is used by macro "header" below.
|
||||
</tal:comment>
|
||||
<metal:history define-macro="objectHistory"
|
||||
tal:define="startNumber request/startNumber|python:0;
|
||||
startNumber python: int(startNumber);
|
||||
batchSize python: int(request.get('maxPerPage'));
|
||||
historyInfo python: contextObj.getHistory(startNumber, batchSize=batchSize);
|
||||
objs historyInfo/events;
|
||||
totalNumber historyInfo/totalNumber;
|
||||
ajaxHookId python:'appyHistory';
|
||||
navBaseCall python: 'askObjectHistory(\'%s\',\'%s\',%d,**v**)' % (ajaxHookId, contextObj.absolute_url(),batchSize);
|
||||
tool contextObj/getTool">
|
||||
|
||||
<tal:comment replace="nothing">Table containing the history</tal:comment>
|
||||
<tal:history condition="objs">
|
||||
<metal:nav use-macro="here/skyn/navigate/macros/appyNavigate"/>
|
||||
<table width="100%" class="history">
|
||||
<tr i18n:domain="plone">
|
||||
<th align="left" i18n:translate="listingheader_action">Action</th>
|
||||
<th align="left" i18n:translate="listingheader_performed_by">By</th>
|
||||
<th align="left" i18n:translate="listingheader_date_and_time">Date</th>
|
||||
<th align="left" i18n:translate="listingheader_comment">Comment</th>
|
||||
</tr>
|
||||
<tal:event repeat="event objs">
|
||||
<tr tal:define="odd repeat/event/odd;
|
||||
rhComments event/comments|nothing;
|
||||
state event/review_state|nothing;
|
||||
isDataChange python: event['action'] == '_datachange_'"
|
||||
tal:attributes="class python:test(odd, 'even', 'odd')" valign="top">
|
||||
<td tal:condition="isDataChange" tal:content="python: tool.translate('data_change')"></td>
|
||||
<td tal:condition="not: isDataChange"
|
||||
tal:content="python: tool.translate(contextObj.getWorkflowLabel(event['action']))"
|
||||
tal:attributes="class string:state-${state}"/>
|
||||
<td tal:define="actorid python:event.get('actor');
|
||||
actor python:contextObj.portal_membership.getMemberInfo(actorid);
|
||||
fullname actor/fullname|nothing;
|
||||
username actor/username|nothing"
|
||||
tal:content="python:fullname or username or actorid"/>
|
||||
<td tal:content="python:contextObj.restrictedTraverse('@@plone').toLocalizedTime(event['time'],long_format=True)"/>
|
||||
<td tal:condition="not: isDataChange"><tal:comment condition="rhComments" tal:content="structure rhComments"/>
|
||||
<tal:noComment condition="not: rhComments" i18n:translate="no_comments" i18n:domain="plone"/></td>
|
||||
<td tal:condition="isDataChange">
|
||||
<tal:comment replace="nothing">
|
||||
Display the previous values of the fields whose value were modified in this change.</tal:comment>
|
||||
<table class="appyChanges" width="100%">
|
||||
<tr>
|
||||
<th align="left" width="30%" tal:content="python: tool.translate('modified_field')"></th>
|
||||
<th align="left" width="70%" tal:content="python: tool.translate('previous_value')"></th>
|
||||
</tr>
|
||||
<tr tal:repeat="change event/changes/items" valign="top">
|
||||
<tal:change define="appyType python:contextObj.getAppyType(change[0], asDict=True);">
|
||||
<td tal:content="structure python: tool.translate(appyType['labelId'])"></td>
|
||||
<td tal:define="appyValue python: contextObj.getFormattedFieldValue(change[0], change[1][0]);
|
||||
severalValues python: (appyType['multiplicity'][1] > 1) or (appyType['multiplicity'][1] == None)">
|
||||
<span tal:condition="not: severalValues" tal:replace="appyValue"></span>
|
||||
<ul tal:condition="python: severalValues">
|
||||
<li tal:repeat="av appyValue" tal:content="av"></li>
|
||||
</ul>
|
||||
</td>
|
||||
</tal:change>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tal:event>
|
||||
</table>
|
||||
</tal:history>
|
||||
</metal:history>
|
||||
|
||||
<tal:comment replace="nothing">
|
||||
This macro displays an object's state(s). It is used by macro "header" below.
|
||||
</tal:comment>
|
||||
<metal:states define-macro="states"
|
||||
tal:define="showAllStatesInPhase python: tool.getAttr('showAllStatesInPhaseFor' + contextObj.meta_type);
|
||||
states python: contextObj.getAppyStates(phase, currentOnly=not showAllStatesInPhase)"
|
||||
tal:condition="python: test(showAllStatesInPhase, len(states)>1, True)">
|
||||
<table>
|
||||
<tr>
|
||||
<tal:state repeat="stateInfo states">
|
||||
<td class="state"
|
||||
tal:content="python: _(contextObj.getWorkflowLabel(stateInfo['name']))">
|
||||
</td>
|
||||
<td tal:condition="python: stateInfo['name'] != states[-1]['name']">
|
||||
<img tal:attributes="src string: $appUrl/skyn/nextState.png"/>
|
||||
</td>
|
||||
</tal:state>
|
||||
</tr>
|
||||
</table>
|
||||
</metal:states>
|
||||
|
||||
<tal:comment replace="nothing">
|
||||
This macro displays an object's transitions(s). It is used by macro "header" below.
|
||||
</tal:comment>
|
||||
<metal:transitions define-macro="transitions"
|
||||
tal:define="transitions contextObj/getAppyTransitions"
|
||||
tal:condition="transitions">
|
||||
<form id="triggerTransitionForm" method="post"
|
||||
tal:attributes="action python: contextObj.absolute_url() + '/skyn/do'">
|
||||
<input type="hidden" name="action" value="Do"/>
|
||||
<input type="hidden" name="workflow_action"/>
|
||||
<table>
|
||||
<tr valign="middle">
|
||||
<tal:comment replace="nothing">Input field allowing to enter a comment before triggering a transition</tal:comment>
|
||||
<td tal:define="showCommentsField python:tool.getAttr('showWorkflowCommentFieldFor'+contextObj.meta_type)"
|
||||
align="right" tal:condition="showCommentsField">
|
||||
<span tal:content="python: tool.translate('workflow_comment')" class="discreet"></span>
|
||||
<input type="text" id="comment" name="comment" size="30"/>
|
||||
</td>
|
||||
|
||||
<tal:comment replace="nothing">Buttons for triggering transitions</tal:comment>
|
||||
<td align="right" tal:repeat="transition transitions">
|
||||
<tal:comment replace="nothing">Real button</tal:comment>
|
||||
<input type="button" class="appyButton" tal:condition="transition/may_trigger"
|
||||
tal:attributes="value transition/title;
|
||||
onClick python: 'triggerTransition(\'%s\',\'%s\')' % (transition['name'],transition['confirm']);"/>
|
||||
<tal:comment replace="nothing">Fake button, explaining why the transition can't be triggered</tal:comment>
|
||||
<div class="appyButton fakeButton" tal:condition="not: transition/may_trigger">
|
||||
<acronym tal:content="transition/title"
|
||||
tal:attributes="title transition/reason"></acronym>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</metal:transitions>
|
||||
|
||||
<tal:comment replace="nothing">
|
||||
This macros displays the page header, containing object title,
|
||||
workflow-related info, object history, etc.
|
||||
</tal:comment>
|
||||
<div metal:define-macro="header"
|
||||
tal:define="showWorkflow python: tool.getAttr('showWorkflowFor' + contextObj.meta_type);
|
||||
hasHistory contextObj/hasHistory;
|
||||
historyMaxPerPage options/maxPerPage|python: 5;
|
||||
historyExpanded python: request.get('appyHistory', 'collapsed') == 'expanded';
|
||||
creator contextObj/Creator"
|
||||
tal:condition="not: contextObj/isTemporary">
|
||||
|
||||
<tal:comment replace="nothing">Information that is common to all tabs (object title, state, etc)</tal:comment>
|
||||
<table width="100%" class="summary">
|
||||
<tr>
|
||||
<tal:comment replace="nothing">Title</tal:comment>
|
||||
<td colspan="2" class="objectTitle" tal:content="contextObj/title_or_id"></td>
|
||||
</tr>
|
||||
<tr class="underTitle">
|
||||
<td colspan="2" class="by">
|
||||
<tal:comment replace="nothing">Creator and last modification date</tal:comment>
|
||||
<tal:comment replace="nothing">Plus/minus icon for accessing history</tal:comment>
|
||||
<tal:accessHistory condition="hasHistory">
|
||||
<img align="left" style="cursor:pointer" onClick="toggleCookie('appyHistory')"
|
||||
tal:attributes="src python:test(historyExpanded, 'skyn/collapse.gif', 'skyn/expand.gif');"
|
||||
id="appyHistory_img"/>
|
||||
<span i18n:translate="label_history" i18n:domain="plone" class="historyLabel">History</span> ||
|
||||
</tal:accessHistory>
|
||||
|
||||
<tal:comment replace="nothing">Show document creator</tal:comment>
|
||||
<span class="by" tal:condition="creator"
|
||||
tal:define="author python:contextObj.portal_membership.getMemberInfo(creator)">
|
||||
<span i18n:domain="plone" i18n:translate="label_by_author">
|
||||
by <span tal:content="python:author and author['fullname'] or creator"
|
||||
tal:omit-tag="not:author" i18n:name="author"/>
|
||||
—
|
||||
</span>
|
||||
</span>
|
||||
<tal:comment replace="nothing">Show last modification date</tal:comment>
|
||||
<span tal:replace="python:contextObj.restrictedTraverse('@@plone').toLocalizedTime(contextObj.ModificationDate(),long_format=1)"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tal:comment replace="nothing">Object history</tal:comment>
|
||||
<tr tal:condition="hasHistory" class="underTitle">
|
||||
<td colspan="2">
|
||||
<span id="appyHistory"
|
||||
tal:attributes="style python:test(historyExpanded, 'display:block', 'display:none')">
|
||||
<div tal:define="ajaxHookId python: contextObj.UID() + '_history';"
|
||||
tal:attributes="id ajaxHookId">
|
||||
<script tal:content="python: 'askObjectHistory(\'%s\',\'%s\',%d,0)' % (ajaxHookId, contextObj.absolute_url(),historyMaxPerPage)">
|
||||
</script>
|
||||
</div>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tal:comment replace="nothing">Workflow-related information and actions</tal:comment>
|
||||
<tr tal:condition="python: showWorkflow and contextObj.getWorkflowLabel()" class="workflow">
|
||||
<td colspan="2">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td><metal:states use-macro="here/skyn/page/macros/states"/></td>
|
||||
<td align="right"><metal:states use-macro="here/skyn/page/macros/transitions"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<tal:comment replace="nothing">The page footer.</tal:comment>
|
||||
<metal:footer define-macro="footer">
|
||||
<tal:dummy define="messages app/plone_utils/showPortalMessages"/>
|
||||
<script language="javascript">
|
||||
<!--
|
||||
initSlaves();
|
||||
-->
|
||||
</script>
|
||||
</metal:footer>
|
||||
|
||||
<tal:comment replace="nothing">
|
||||
This macro shows the range of buttons (next, previous, save,...).
|
||||
</tal:comment>
|
||||
<div metal:define-macro="buttons"
|
||||
tal:define="previousPage python: contextObj.getPreviousPage(phaseInfo, page)[0];
|
||||
nextPage python: contextObj.getNextPage(phaseInfo, page)[0];
|
||||
isEdit python: layoutType == 'edit';
|
||||
pageInfo python: phaseInfo['pagesInfo'][page]">
|
||||
<br/>
|
||||
<tal:previous condition="python: previousPage and pageInfo['showPrevious']">
|
||||
<tal:button condition="isEdit">
|
||||
<input type="image" class="imageInput" style="cursor:pointer" name="buttonPrevious"
|
||||
title="label_previous" i18n:attributes="title" i18n:domain="plone"
|
||||
tal:attributes="src string:$appUrl/skyn/previous.png"/>
|
||||
<input type="hidden" name="previousPage" tal:attributes="value previousPage"/>
|
||||
</tal:button>
|
||||
<tal:link condition="not: isEdit">
|
||||
<a tal:attributes="href python: contextObj.getUrl(page=previousPage)">
|
||||
<img tal:attributes="src string:$appUrl/skyn/previous.png"
|
||||
title="label_previous" i18n:attributes="title" i18n:domain="plone"/>
|
||||
</a>
|
||||
</tal:link>
|
||||
</tal:previous>
|
||||
|
||||
<tal:save condition="python: isEdit and pageInfo['showSave']">
|
||||
<input type="image" class="imageInput" style="cursor:pointer" name="buttonOk"
|
||||
title="label_save" i18n:attributes="title" i18n:domain="plone"
|
||||
tal:attributes="src string:$appUrl/skyn/save.png"/>
|
||||
</tal:save>
|
||||
|
||||
<tal:cancel condition="python: isEdit and pageInfo['showCancel']">
|
||||
<input type="image" class="imageInput" style="cursor:pointer" name="buttonCancel"
|
||||
title="label_cancel" i18n:attributes="title" i18n:domain="plone"
|
||||
tal:attributes="src string:$appUrl/skyn/cancel.png"/>
|
||||
</tal:cancel>
|
||||
|
||||
<tal:edit condition="python: not isEdit and pageInfo['showOnEdit']">
|
||||
<img title="Edit" i18n:domain="plone" i18n:attributes="title" style="cursor:pointer"
|
||||
tal:attributes="onClick python: 'href: window.location=\'%s\'' % contextObj.getUrl(mode='edit', page=page);
|
||||
src string: $appUrl/skyn/editBig.png"
|
||||
tal:condition="python: contextObj.allows('Modify portal content')"/>
|
||||
</tal:edit>
|
||||
|
||||
<tal:refresh condition="contextObj/isDebug">
|
||||
<img title="Refresh" style="cursor:pointer"
|
||||
tal:attributes="onClick python: 'href: window.location=\'%s\'' % contextObj.getUrl(mode=layoutType, page=page, refresh='yes');
|
||||
src string: $appUrl/skyn/refresh.png"/>
|
||||
</tal:refresh>
|
||||
|
||||
<tal:next condition="python: nextPage and pageInfo['showNext']">
|
||||
<tal:button condition="isEdit">
|
||||
<input type="image" class="imageInput" style="cursor:pointer" name="buttonNext"
|
||||
title="label_next" i18n:attributes="title" i18n:domain="plone"
|
||||
tal:attributes="src string:$appUrl/skyn/next.png"/>
|
||||
<input type="hidden" name="nextPage" tal:attributes="value nextPage"/>
|
||||
</tal:button>
|
||||
<tal:link condition="not: isEdit">
|
||||
<a tal:attributes="href python: contextObj.getUrl(page=nextPage)">
|
||||
<img tal:attributes="src string:$appUrl/skyn/next.png"
|
||||
title="label_next" i18n:attributes="title" i18n:domain="plone"/>
|
||||
</a>
|
||||
</tal:link>
|
||||
</tal:next>
|
||||
</div>
|
||||
|
||||
<tal:comment replace="nothing">
|
||||
This macro displays the global message on the page.
|
||||
</tal:comment>
|
||||
<metal:message define-macro="message">
|
||||
<tal:comment replace="nothing">Single message from portal_status_message request key</tal:comment>
|
||||
<div tal:define="msg req/portal_status_message | nothing"
|
||||
tal:condition="msg" class="message" tal:content="structure msg"></div>
|
||||
|
||||
<tal:comment replace="nothing">Messages added via plone_utils</tal:comment>
|
||||
<tal:messages define="messages python: ''.join([m.message for m in app.plone_utils.showPortalMessages()])"
|
||||
condition="messages">
|
||||
<div class="message" tal:content="structure messages"></div>
|
||||
</tal:messages>
|
||||
</metal:message>
|
Before Width: | Height: | Size: 228 B |
Before Width: | Height: | Size: 246 B |
|
@ -1,156 +0,0 @@
|
|||
<tal:comment replace="nothing">
|
||||
This macro displays the content of the application portlet.
|
||||
</tal:comment>
|
||||
<metal:portlet define-macro="portlet"
|
||||
tal:define="queryUrl python: '%s/skyn/query' % tool.absolute_url();
|
||||
toolUrl tool/absolute_url;
|
||||
currentSearch req/search|nothing;
|
||||
currentType req/type_name|nothing;
|
||||
contextObj tool/getPublishedObject;
|
||||
rootClasses tool/getRootClasses">
|
||||
|
||||
<tal:publishedObject condition="python: contextObj and contextObj.mayNavigate()">
|
||||
<div class="portletTitle" tal:content="contextObj/Title"></div>
|
||||
<span><metal:phases use-macro="here/skyn/portlet/macros/phases"/></span>
|
||||
</tal:publishedObject>
|
||||
|
||||
<tal:comment replace="nothing">One section for every searchable root class.</tal:comment>
|
||||
<tal:section repeat="rootClass python: [rc for rc in rootClasses if tool.userMaySearch(rc)]">
|
||||
<tal:comment replace="nothing">Section title, with action icons</tal:comment>
|
||||
<table width="100%"
|
||||
tal:define="afUrl appFolder/absolute_url"
|
||||
tal:attributes="class python:test((repeat['rootClass'].number()==1) and not contextObj, '', 'portletSep')">
|
||||
<tr>
|
||||
<td>
|
||||
<a tal:attributes="href python: '%s?type_name=%s' % (queryUrl, rootClass);
|
||||
class python:test(not currentSearch and (currentType==rootClass), 'portletCurrent', '')"
|
||||
tal:content="structure python: _(rootClass + '_plural')"></a>
|
||||
</td>
|
||||
<td align="right"
|
||||
tal:define="addPermission python: '%s: Add %s' % (appName, rootClass);
|
||||
userMayAdd python: user.has_permission(addPermission, appFolder);
|
||||
createMeans python: tool.getCreateMeans(rootClass)">
|
||||
<tal:comment replace="nothing">Create a new object from a web form</tal:comment>
|
||||
<img style="cursor:pointer"
|
||||
tal:condition="python: ('form' in createMeans) and userMayAdd"
|
||||
tal:attributes="onClick python: 'href: window.location=\'%s/skyn/do?action=Create&type_name=%s\'' % (afUrl, rootClass);
|
||||
src string: $appUrl/skyn/plus.png;
|
||||
title python: _('query_create')"/>
|
||||
<tal:comment replace="nothing">Create (a) new object(s) by importing data</tal:comment>
|
||||
<img style="cursor:pointer"
|
||||
tal:condition="python: ('import' in createMeans) and userMayAdd"
|
||||
tal:attributes="onClick python: 'href: window.location=\'%s/skyn/import?type_name=%s\'' % (toolUrl, rootClass);
|
||||
src string: $appUrl/skyn/import.png;
|
||||
title python: _('query_import')"/>
|
||||
<tal:comment replace="nothing">Search objects of this type</tal:comment>
|
||||
<img style="cursor:pointer"
|
||||
tal:define="showSearch python: tool.getAttr('enableAdvancedSearchFor%s' % rootClass)"
|
||||
tal:condition="showSearch"
|
||||
tal:attributes="onClick python: 'href: window.location=\'%s/skyn/search?type_name=%s\'' % (toolUrl, rootClass);
|
||||
src string: $appUrl/skyn/search.gif;
|
||||
title python: _('search_objects')"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<tal:comment replace="nothing">Searches for this content type.</tal:comment>
|
||||
<tal:searchOrGroup repeat="searchOrGroup python: tool.getSearches(rootClass)">
|
||||
<tal:group condition="searchOrGroup/isGroup">
|
||||
<tal:expanded define="group searchOrGroup;
|
||||
expanded python: request.get(group['labelId'], 'collapsed') == 'expanded'">
|
||||
<tal:comment replace="nothing">Group name</tal:comment>
|
||||
<dt class="portletAppyItem portletGroup">
|
||||
<img align="left" style="cursor:pointer"
|
||||
tal:attributes="id python: '%s_img' % group['labelId'];
|
||||
src python:test(expanded, 'skyn/collapse.gif', 'skyn/expand.gif');
|
||||
onClick python:'toggleCookie(\'%s\')' % group['labelId']"/>
|
||||
<span tal:replace="group/label"/>
|
||||
</dt>
|
||||
<tal:comment replace="nothing">Group searches</tal:comment>
|
||||
<span tal:attributes="id group/labelId;
|
||||
style python:test(expanded, 'display:block', 'display:none')">
|
||||
<dt class="portletAppyItem portletSearch portletGroupItem" tal:repeat="search group/searches">
|
||||
<a tal:attributes="href python: '%s?type_name=%s&search=%s' % (queryUrl, rootClass, search['name']);
|
||||
title search/descr;
|
||||
class python: test(search['name'] == currentSearch, 'portletCurrent', '');"
|
||||
tal:content="structure search/label"></a>
|
||||
</dt>
|
||||
</span>
|
||||
</tal:expanded>
|
||||
</tal:group>
|
||||
<dt tal:define="search searchOrGroup" tal:condition="not: searchOrGroup/isGroup"
|
||||
class="portletAppyItem portletSearch">
|
||||
|
||||
<a tal:attributes="href python: '%s?type_name=%s&search=%s' % (queryUrl, rootClass, search['name']);
|
||||
title search/descr;
|
||||
class python: test(search['name'] == currentSearch, 'portletCurrent', '');"
|
||||
tal:content="structure search/label"></a>
|
||||
</dt>
|
||||
</tal:searchOrGroup>
|
||||
</tal:section>
|
||||
</metal:portlet>
|
||||
|
||||
<tal:comment replace="nothing">
|
||||
This macro displays, within the portlet, the navigation tree for the
|
||||
currently shown object, made of phases and contained pages.
|
||||
</tal:comment>
|
||||
<metal:phases define-macro="phases">
|
||||
<table tal:define="phases contextObj/getAppyPhases|nothing;
|
||||
singlePhase python: len(phases) == 1;
|
||||
page python: req.get('page', 'main')"
|
||||
tal:condition="python: phases and not (singlePhase and len(phases[0]['pages'])==1)"
|
||||
width="100%">
|
||||
<tal:phase repeat="phase phases">
|
||||
<tal:comment replace="nothing">The box containing phase-related information</tal:comment>
|
||||
<tr>
|
||||
<td tal:define="label python:'%s_phase_%s' % (contextObj.meta_type, phase['name']);
|
||||
singlePage python: len(phase['pages']) == 1;
|
||||
status phase/phaseStatus;
|
||||
phaseCss python: (status == 'Current') and ' phaseSelected' or '';
|
||||
underCreation python: '/portal_factory' in context.absolute_url();
|
||||
displayLink python: (status != 'Future') and not underCreation and singlePage"
|
||||
tal:attributes="class python: not singlePhase and 'phase%s' % phaseCss or ''">
|
||||
<div class="portletGroup" tal:condition="not: singlePhase">
|
||||
|
||||
<tal:comment replace="nothing">A single page in the phase</tal:comment>
|
||||
<table tal:condition="displayLink" width="100%">
|
||||
<tr tal:define="pageName python: phase['pages'][0]">
|
||||
<td><a tal:attributes="href python: contextObj.getUrl(page=pageName)"
|
||||
tal:content="structure python: _(label)"></a>
|
||||
</td>
|
||||
<td align="right">
|
||||
<img title="Edit" i18n:domain="plone" i18n:attributes="title" style="cursor:pointer"
|
||||
tal:attributes="onClick python: 'href: window.location=\'%s\'' % contextObj.getUrl(mode='edit', page=pageName);
|
||||
src string: $appUrl/skyn/edit.gif"
|
||||
tal:condition="python: contextObj.allows('Modify portal content') and phase['pagesInfo'][pageName]['showOnEdit']"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<tal:comment replace="nothing">Several pages in the phase</tal:comment>
|
||||
<span tal:condition="not: displayLink" tal:replace="structure python: _(label)"/>
|
||||
</div>
|
||||
<div class="portletMenu">
|
||||
<table width="100%" cellpadding="0" tal:condition="python: len(phase['pages']) > 1">
|
||||
<tr tal:repeat="aPage phase/pages" valign="top">
|
||||
<td tal:attributes="class python: test(aPage == page, 'portletCurrent portletPage', 'portletPage')">
|
||||
<a tal:attributes="href python: contextObj.getUrl(page=aPage)"
|
||||
tal:content="structure python: _('%s_page_%s' % (contextObj.meta_type, aPage))">
|
||||
</a>
|
||||
</td>
|
||||
<td align="right">
|
||||
<img title="Edit" i18n:domain="plone" i18n:attributes="title" style="cursor:pointer"
|
||||
tal:attributes="onClick python: 'href: window.location=\'%s\'' % contextObj.getUrl(mode='edit', page=aPage);
|
||||
src string: $appUrl/skyn/edit.gif"
|
||||
tal:condition="python: user.has_permission('Modify portal content', contextObj) and phase['pagesInfo'][aPage]['showOnEdit']"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tal:comment replace="nothing">The down arrow pointing to the next phase (if any)</tal:comment>
|
||||
<tr tal:condition="python: phase['name'] != phases[-1]['name']">
|
||||
<td> <img tal:attributes="src string: $appUrl/skyn/nextPhase.png"/></td>
|
||||
</tr>
|
||||
</tal:phase>
|
||||
</table>
|
||||
</metal:phases>
|
Before Width: | Height: | Size: 905 B |
|
@ -1,17 +0,0 @@
|
|||
<tal:main define="tool context/getParentNode">
|
||||
<html metal:use-macro="context/skyn/template/macros/main">
|
||||
<metal:fill fill-slot="content"
|
||||
tal:define="contentType request/type_name;
|
||||
searchName request/search|python:''">
|
||||
|
||||
<div metal:use-macro="here/skyn/page/macros/prologue"/>
|
||||
<tal:comment replace="nothing">Query result</tal:comment>
|
||||
<div id="queryResult"></div>
|
||||
|
||||
<script type="text/javascript"
|
||||
tal:define="ajaxUrl python: tool.getQueryUrl(contentType, searchName)"
|
||||
tal:content="python: 'askQueryResult(\'queryResult\', \'%s\',\'%s\',\'%s\',0)' % (tool.absolute_url(), contentType, searchName)">
|
||||
</script>
|
||||
</metal:fill>
|
||||
</html>
|
||||
</tal:main>
|
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 53 B |
|
@ -1,158 +0,0 @@
|
|||
<metal:queryResults define-macro="queryResult"
|
||||
tal:define="contentType request/type_name;
|
||||
refInfo tool/getRefInfo;
|
||||
refObject python: refInfo[0];
|
||||
refField python: refInfo[1];
|
||||
refUrlPart python: refObject and ('&ref=%s:%s' % (refObject.UID(), refField)) or '';
|
||||
startNumber request/startNumber|python:'0';
|
||||
startNumber python: int(startNumber);
|
||||
searchName request/search;
|
||||
labelId python: searchName and ('%s_search_%s' % (contentType, searchName)) or '';
|
||||
labelId python: (searchName == '_advanced') and 'search_results' or labelId;
|
||||
searchLabel python: labelId and tool.translate(labelId) or '';
|
||||
severalTypes python: contentType and (contentType.find(',') != -1);
|
||||
sortKey request/sortKey| python:'';
|
||||
sortOrder request/sortOrder| python:'asc';
|
||||
filterKey request/filterKey| python:'';
|
||||
filterValue request/filterValue | python:'';
|
||||
queryResult python: tool.executeQuery(contentType, searchName, startNumber, remember=True, sortBy=sortKey, sortOrder=sortOrder, filterKey=filterKey, filterValue=filterValue, refObject=refObject, refField=refField);
|
||||
objs queryResult/objects;
|
||||
totalNumber queryResult/totalNumber;
|
||||
batchSize queryResult/batchSize;
|
||||
ajaxHookId python:'queryResult';
|
||||
navBaseCall python: 'askQueryResult(\'%s\',\'%s\',\'%s\',\'%s\',**v**)' % (ajaxHookId, tool.absolute_url(), contentType, searchName);
|
||||
newSearchUrl python: '%s/skyn/search?type_name=%s%s' % (tool.absolute_url(), contentType, refUrlPart)">
|
||||
|
||||
<tal:result condition="objs">
|
||||
|
||||
<fieldset>
|
||||
<legend>
|
||||
<span tal:replace="structure python: test(searchName, searchLabel, test(severalTypes, tool.translate(tool.getAppName()), tool.translate('%s_plural' % contentType)))"/>
|
||||
(<span tal:replace="totalNumber"/>)
|
||||
<tal:newSearch condition="python: searchName == '_advanced'">
|
||||
— <i><a tal:attributes="href newSearchUrl"
|
||||
tal:content="python: tool.translate('search_new')"></a></i>
|
||||
</tal:newSearch>
|
||||
</legend>
|
||||
|
||||
<tal:comment replace="nothing">Display here POD templates if required.</tal:comment>
|
||||
<table align="right"
|
||||
tal:define="widgets python: tool.getResultPodFields(contentType);
|
||||
layoutType python:'view'"
|
||||
tal:condition="python: objs and widgets">
|
||||
<tr><td tal:define="contextObj python: objs[0]"
|
||||
tal:repeat="widget widgets">
|
||||
<metal:pod use-macro="here/skyn/widgets/show/macros/field"/>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<tal:descr condition="searchName">
|
||||
<td tal:define="descr python: tool.translate('%s_descr' % labelId)"
|
||||
tal:condition="descr/strip">
|
||||
<span class="discreet" tal:content="descr"></span><br/><br/>
|
||||
</td>
|
||||
</tal:descr>
|
||||
<td align="right" width="25%">
|
||||
<tal:comment replace="nothing">Appy (top) navigation</tal:comment>
|
||||
<metal:nav use-macro="here/skyn/navigate/macros/appyNavigate"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table tal:define="fieldNames python: tool.getResultColumnsNames(contentType, refInfo);
|
||||
widgets python: objs[0].getAppyTypesFromNames(fieldNames);"
|
||||
class="list" width="100%">
|
||||
<tal:comment replace="nothing">Headers, with filters and sort arrows</tal:comment>
|
||||
<tr>
|
||||
<tal:header repeat="widget widgets">
|
||||
<th tal:define="sortable python: tool.isSortable(widget['name'], contentType, 'search');
|
||||
filterable widget/filterable|nothing;">
|
||||
<span tal:replace="structure python: tool.truncateText(tool.translate(widget['labelId']))"/>
|
||||
<metal:icons use-macro="here/skyn/navigate/macros/sortAndFilter"/>
|
||||
</th>
|
||||
</tal:header>
|
||||
<tal:comment replace="nothing">Object type, shown if instances of several types are shown</tal:comment>
|
||||
<th tal:condition="severalTypes">
|
||||
<span tal:replace="python: tool.translate('root_type')"></span>
|
||||
</th>
|
||||
<tal:comment replace="nothing">Actions</tal:comment>
|
||||
<th tal:content="python: tool.translate('ref_actions')"></th>
|
||||
</tr>
|
||||
|
||||
<tal:comment replace="nothing">Results</tal:comment>
|
||||
<tal:row repeat="obj objs">
|
||||
<tr id="query_row" tal:define="odd repeat/obj/odd"
|
||||
tal:attributes="class python:test(odd, 'even', 'odd')">
|
||||
|
||||
<tal:fields repeat="widget widgets">
|
||||
<tal:comment replace="nothing">Title</tal:comment>
|
||||
<td id="field_title"
|
||||
tal:condition="python: widget['name'] == 'title'">
|
||||
<a tal:define="navInfo python:'search.%s.%s.%d.%d' % (contentType, searchName, repeat['obj'].number()+startNumber, totalNumber);"
|
||||
tal:content="obj/Title" tal:attributes="href python: obj.getUrl(nav=navInfo, page='main')"></a>
|
||||
</td>
|
||||
|
||||
<tal:comment replace="nothing">Workflow state</tal:comment>
|
||||
<td id="field_workflow_state"
|
||||
tal:condition="python: widget['name'] == 'state'"
|
||||
tal:content="python: tool.translate(obj.getWorkflowLabel())">
|
||||
</td>
|
||||
|
||||
<tal:comment replace="nothing">Any other field</tal:comment>
|
||||
<td tal:condition="python: widget['name'] not in ('title', 'state')"
|
||||
tal:attributes="id python:'field_%s' % widget['name']">
|
||||
<tal:field define="contextObj python:obj;
|
||||
layoutType python:'cell';
|
||||
innerRef python:True"
|
||||
condition="python: contextObj.showField(widget['name'], 'view')">
|
||||
<metal:field use-macro="here/skyn/widgets/show/macros/field"/>
|
||||
</tal:field>
|
||||
</td>
|
||||
</tal:fields>
|
||||
|
||||
<tal:comment replace="nothing">Column "Object type", shown if instances of several types are shown</tal:comment>
|
||||
<td tal:condition="severalTypes" id="field_root_type"
|
||||
tal:content="python: tool.translate(obj.portal_type)"></td>
|
||||
|
||||
<tal:comment replace="nothing">Column "Actions"</tal:comment>
|
||||
<td align="right">
|
||||
<table class="noStyle">
|
||||
<tr>
|
||||
<tal:comment replace="nothing">Edit the element</tal:comment>
|
||||
<td>
|
||||
<a tal:define="navInfo python:'search.%s.%s.%d.%d' % (contentType, searchName, repeat['obj'].number()+startNumber, totalNumber);"
|
||||
tal:attributes="href python: obj.getUrl(mode='edit', page='main', nav=navInfo)"
|
||||
tal:condition="python: obj.allows('Modify portal content')">
|
||||
<img title="Edit" i18n:domain="plone" i18n:attributes="title"
|
||||
tal:attributes="src string: $appUrl/skyn/edit.gif"/>
|
||||
</a></td>
|
||||
<tal:comment replace="nothing">Delete the element</tal:comment>
|
||||
<td>
|
||||
<img tal:condition="python: obj.allows('Delete objects') and obj.mayDelete()"
|
||||
title="Delete" i18n:domain="plone" i18n:attributes="title" style="cursor:pointer"
|
||||
tal:attributes="src string: $appUrl/skyn/delete.png;
|
||||
onClick python:'onDeleteObject(\'%s\')' % obj.UID()"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tal:row>
|
||||
</table>
|
||||
|
||||
<tal:comment replace="nothing">Appy (bottom) navigation</tal:comment>
|
||||
<metal:nav use-macro="here/skyn/navigate/macros/appyNavigate"/>
|
||||
</fieldset>
|
||||
</tal:result>
|
||||
|
||||
<tal:noResult condition="not: objs">
|
||||
<span tal:replace="python: tool.translate('query_no_result')"/>
|
||||
<tal:newSearch condition="python: searchName == '_advanced'">
|
||||
<br/><i class="discreet"><a tal:attributes="href newSearchUrl"
|
||||
tal:content="python: tool.translate('search_new')"></a></i>
|
||||
</tal:newSearch>
|
||||
</tal:noResult>
|
||||
|
||||
</metal:queryResults>
|
Before Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 189 B |
|
@ -1,47 +0,0 @@
|
|||
<tal:main define="tool context/getParentNode">
|
||||
<html metal:use-macro="context/skyn/template/macros/main">
|
||||
<metal:fill fill-slot="content"
|
||||
tal:define="contentType request/type_name;
|
||||
refInfo request/ref|nothing;
|
||||
searchInfo python: tool.getSearchInfo(contentType, refInfo);
|
||||
cssJs python: tool.getCssAndJs(searchInfo['fields'], 'edit')">
|
||||
|
||||
<tal:comment replace="nothing">Include type-specific CSS and JS.</tal:comment>
|
||||
<link tal:repeat="cssFile cssJs/css" rel="stylesheet" type="text/css"
|
||||
tal:attributes="href string:$appUrl/skyn/$cssFile"/>
|
||||
<script tal:repeat="jsFile cssJs/js" type="text/javascript"
|
||||
tal:attributes="src string:$appUrl/skyn/$jsFile"></script>
|
||||
|
||||
<tal:comment replace="nothing">Search title</tal:comment>
|
||||
<h1><span tal:replace="python: tool.translate('%s_plural' % contentType)"/> —
|
||||
<span tal:replace="python: tool.translate('search_title')"/></h1><br/>
|
||||
|
||||
<tal:comment replace="nothing">Form for searching objects of request/type_name.</tal:comment>
|
||||
<form name="search" tal:attributes="action python: appFolder.absolute_url()+'/skyn/do'" method="post">
|
||||
<input type="hidden" name="action" value="SearchObjects"/>
|
||||
<input type="hidden" name="type_name" tal:attributes="value contentType"/>
|
||||
<input tal:condition="refInfo" type="hidden" name="ref" tal:attributes="value refInfo"/>
|
||||
|
||||
<table width="100%">
|
||||
<tr tal:repeat="searchRow python: tool.tabularize(searchInfo['fieldDicts'], searchInfo['nbOfColumns'])"
|
||||
valign="top">
|
||||
<td tal:repeat="widget searchRow" tal:attributes="width python:'%d%%' % (100/searchInfo['nbOfColumns'])">
|
||||
<tal:field condition="widget">
|
||||
<tal:show define="name widget/name;
|
||||
widgetName python: 'w_%s' % name;
|
||||
macroPage python: widget['type'].lower()">
|
||||
<metal:call use-macro="python: appFolder.skyn.widgets.get(macroPage).macros.get('search')"/>
|
||||
</tal:show>
|
||||
</tal:field><br class="discreet"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<tal:comment replace="nothing">Submit button</tal:comment>
|
||||
<p align="right"><br/>
|
||||
<input type="submit" tal:attributes="value python:tool.translate('search_button')"/>
|
||||
</p>
|
||||
</form>
|
||||
</metal:fill>
|
||||
</html>
|
||||
</tal:main>
|
Before Width: | Height: | Size: 235 B |
Before Width: | Height: | Size: 367 B |
Before Width: | Height: | Size: 316 B |
Before Width: | Height: | Size: 97 B |
Before Width: | Height: | Size: 97 B |
Before Width: | Height: | Size: 43 B |
Before Width: | Height: | Size: 149 B |
Before Width: | Height: | Size: 168 B |
Before Width: | Height: | Size: 203 B |
Before Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 207 B |
Before Width: | Height: | Size: 171 B |
|
@ -1,155 +0,0 @@
|
|||
<html metal:define-macro="main"
|
||||
tal:define="user context/portal_membership/getAuthenticatedMember;
|
||||
isAnon python: user.getUserName() == 'Anonymous User';
|
||||
app tool/getApp;
|
||||
appUrl app/absolute_url;
|
||||
appFolder tool/getAppFolder;
|
||||
appName appFolder/getId;
|
||||
_ python: tool.translate;
|
||||
req python: request;
|
||||
resp req/RESPONSE;
|
||||
x python: resp.setHeader('Content-Type', 'text/html;;charset=utf-8');
|
||||
x python: resp.setHeader('Expires', 'Thu, 11 Dec 1975 12:05:00 GMT+2');
|
||||
x python: resp.setHeader('Content-Language', req.get('language', 'en'))">
|
||||
|
||||
<head>
|
||||
<title tal:content="tool/getAppName"></title>
|
||||
<link rel="stylesheet" type="text/css" tal:attributes="href string:$appUrl/skyn/appy.css"/>
|
||||
<script type="text/javascript" tal:attributes="src string:$appUrl/skyn/appy.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<table class="main" align="center" cellpadding="0">
|
||||
<tal:comment replace="nothing">Top banner</tal:comment>
|
||||
<tr class="top" metal:define-slot="top">
|
||||
<td>
|
||||
<table width="100%">
|
||||
<tr valign="top">
|
||||
<tal:comment replace="nothing">Logo</tal:comment>
|
||||
<td><a tal:attributes="href appUrl"><img tal:attributes="src string: $appUrl/skyn/logo.jpg"/></a></td>
|
||||
<tal:comment replace="nothing">Language selector (links or listbox)</tal:comment>
|
||||
<td align="right"
|
||||
tal:define="appLangs app/portal_languages/listSupportedLanguages;
|
||||
defLang python: app.portal_languages.getLanguageBindings()[0];
|
||||
suffix python: req.get('ACTUAL_URL').split('/')[-1];
|
||||
asLinks python: len(appLangs) <= 5"
|
||||
tal:condition="python: len(appLangs) >= 2 and (suffix not in ('edit', 'query', 'search'))">
|
||||
<table tal:condition="asLinks">
|
||||
<tr>
|
||||
<td tal:repeat="lang appLangs">
|
||||
<a class="lang"
|
||||
tal:attributes="href python: req.get('ACTUAL_URL')+'/switchLanguage?set_language=%s' % lang[0];
|
||||
title python: app.portal_languages.getNameForLanguageCode(lang[1])"
|
||||
tal:content="python: lang[0]"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<select tal:condition="not: asLinks"
|
||||
tal:attributes="onchange string:window.location='${context/absolute_url}/switchLanguage?set_language=' + this.options[this.selectedIndex].value">
|
||||
<option tal:repeat="lang appLangs"
|
||||
tal:content="python:app.portal_languages.getNameForLanguageCode(lang[0]) or lang[1]"
|
||||
tal:attributes="selected python:defLanguage == lang[0];
|
||||
value python:lang[0]">
|
||||
</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tal:comment replace="nothing">The message strip</tal:comment>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="position: relative" align="right">
|
||||
<metal:msg use-macro="app/skyn/page/macros/message"/>
|
||||
</div>
|
||||
<tal:comment replace="nothing">Grey background shown when popups are shown</tal:comment>
|
||||
<div id="grey" class="grey"></div>
|
||||
|
||||
<tal:comment replace="nothing">Popup for confirming an action</tal:comment>
|
||||
<div id="confirmActionPopup" class="popup">
|
||||
<form id="confirmActionForm" method="post">
|
||||
<div align="center">
|
||||
<p id="appyConfirmText"></p>
|
||||
<input type="hidden" name="actionType"/>
|
||||
<input type="hidden" name="action"/>
|
||||
<input type="button" onClick="doConfirm()"
|
||||
tal:attributes="value python:_('yes')"/>
|
||||
<input type="button" value="No" onClick="closePopup('confirmActionPopup')"
|
||||
tal:attributes="value python:_('no')"/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tal:comment replace="nothing">The user data strip</tal:comment>
|
||||
<tr>
|
||||
<td>
|
||||
<table class="userStrip" width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<tal:comment replace="nothing">The user login form for anonymous users</tal:comment>
|
||||
<table align="center" tal:condition="isAnon" class="login"
|
||||
tal:define="auth nocall:app/acl_users/credentials_cookie_auth">
|
||||
<tr><td>
|
||||
<form name="loginform" method="post"
|
||||
tal:attributes="action python: tool.absolute_url() + '/performLogin'">
|
||||
|
||||
<input type="hidden" name="js_enabled" id="js_enabled" value="0"/>
|
||||
<input type="hidden" name="cookies_enabled" id="cookies_enabled" value=""/>
|
||||
<input type="hidden" name="login_name" id="login_name" value=""/>
|
||||
<input type="hidden" name="pwd_empty" id="pwd_empty" value="0"/>
|
||||
|
||||
<span>Login</span>
|
||||
<input type="text" size="15" name="__ac_name" id="__ac_name" value=""/>
|
||||
<span>Password</span>
|
||||
<input type="password" size="15" name="__ac_password" id="__ac_password"/>
|
||||
<input type="submit" name="submit" onclick="setLoginVars()"
|
||||
tal:define="label python: _('Login');" tal:attributes="value label; alt label;"/>
|
||||
</form>
|
||||
</td></tr>
|
||||
</table>
|
||||
<tal:comment replace="nothing">User info and controls for authenticated users</tal:comment>
|
||||
<table tal:condition="not: isAnon" class="buttons" width="99%">
|
||||
<tr>
|
||||
<td>
|
||||
<!-- Go home -->
|
||||
<a tal:attributes="href appUrl; title python: _('home')">
|
||||
<img tal:attributes="src string: $appUrl/skyn/home.gif"/>
|
||||
</a>
|
||||
<!-- Config -->
|
||||
<img style="cursor:pointer" tal:condition="python: user.has_role('Manager')"
|
||||
tal:attributes="onClick python: 'href: window.location=\'%s\'' % tool.getUrl(page='main', nav='');
|
||||
title python: _('%sTool' % appName);
|
||||
src string:$appUrl/skyn/appyConfig.gif"/>
|
||||
<!-- Logout -->
|
||||
<a tal:attributes="href python: tool.absolute_url() + '/performLogout';
|
||||
title python: _('logout')">
|
||||
<img tal:attributes="src string: $appUrl/skyn/logout.gif"/>
|
||||
</a>
|
||||
</td>
|
||||
<td align="right" tal:content="python: tool.getUserLine(user)"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<table width="99%">
|
||||
<tr valign="top">
|
||||
<tal:comment replace="nothing">Portlet</tal:comment>
|
||||
<td tal:condition="python: tool.showPortlet(context)" class="portlet">
|
||||
<metal:portlet use-macro="app/skyn/portlet/macros/portlet"/>
|
||||
</td>
|
||||
<tal:comment replace="nothing">Page content</tal:comment>
|
||||
<td class="content"><span metal:define-slot="content"></span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
1
gen/plone25/skin/tiny_mce/langs/en.js
vendored
|
@ -1,504 +0,0 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
input.radio {border:1px none #000; background:transparent; vertical-align:middle;}
|
||||
.panel_wrapper div.current {height:80px;}
|
||||
#width {width:50px; vertical-align:middle;}
|
||||
#width2 {width:50px; vertical-align:middle;}
|
||||
#size {width:100px;}
|
|
@ -1 +0,0 @@
|
|||
(function(){tinymce.create("tinymce.plugins.AdvancedHRPlugin",{init:function(a,b){a.addCommand("mceAdvancedHr",function(){a.windowManager.open({file:b+"/rule.htm",width:250+parseInt(a.getLang("advhr.delta_width",0)),height:160+parseInt(a.getLang("advhr.delta_height",0)),inline:1},{plugin_url:b})});a.addButton("advhr",{title:"advhr.advhr_desc",cmd:"mceAdvancedHr"});a.onNodeChange.add(function(d,c,e){c.setActive("advhr",e.nodeName=="HR")});a.onClick.add(function(c,d){d=d.target;if(d.nodeName==="HR"){c.selection.select(d)}})},getInfo:function(){return{longname:"Advanced HR",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advhr",tinymce.plugins.AdvancedHRPlugin)})();
|
|
@ -1,57 +0,0 @@
|
|||
/**
|
||||
* editor_plugin_src.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.AdvancedHRPlugin', {
|
||||
init : function(ed, url) {
|
||||
// Register commands
|
||||
ed.addCommand('mceAdvancedHr', function() {
|
||||
ed.windowManager.open({
|
||||
file : url + '/rule.htm',
|
||||
width : 250 + parseInt(ed.getLang('advhr.delta_width', 0)),
|
||||
height : 160 + parseInt(ed.getLang('advhr.delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('advhr', {
|
||||
title : 'advhr.advhr_desc',
|
||||
cmd : 'mceAdvancedHr'
|
||||
});
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
cm.setActive('advhr', n.nodeName == 'HR');
|
||||
});
|
||||
|
||||
ed.onClick.add(function(ed, e) {
|
||||
e = e.target;
|
||||
|
||||
if (e.nodeName === 'HR')
|
||||
ed.selection.select(e);
|
||||
});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Advanced HR',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('advhr', tinymce.plugins.AdvancedHRPlugin);
|
||||
})();
|
|
@ -1,43 +0,0 @@
|
|||
var AdvHRDialog = {
|
||||
init : function(ed) {
|
||||
var dom = ed.dom, f = document.forms[0], n = ed.selection.getNode(), w;
|
||||
|
||||
w = dom.getAttrib(n, 'width');
|
||||
f.width.value = w ? parseInt(w) : (dom.getStyle('width') || '');
|
||||
f.size.value = dom.getAttrib(n, 'size') || parseInt(dom.getStyle('height')) || '';
|
||||
f.noshade.checked = !!dom.getAttrib(n, 'noshade') || !!dom.getStyle('border-width');
|
||||
selectByValue(f, 'width2', w.indexOf('%') != -1 ? '%' : 'px');
|
||||
},
|
||||
|
||||
update : function() {
|
||||
var ed = tinyMCEPopup.editor, h, f = document.forms[0], st = '';
|
||||
|
||||
h = '<hr';
|
||||
|
||||
if (f.size.value) {
|
||||
h += ' size="' + f.size.value + '"';
|
||||
st += ' height:' + f.size.value + 'px;';
|
||||
}
|
||||
|
||||
if (f.width.value) {
|
||||
h += ' width="' + f.width.value + (f.width2.value == '%' ? '%' : '') + '"';
|
||||
st += ' width:' + f.width.value + (f.width2.value == '%' ? '%' : 'px') + ';';
|
||||
}
|
||||
|
||||
if (f.noshade.checked) {
|
||||
h += ' noshade="noshade"';
|
||||
st += ' border-width: 1px; border-style: solid; border-color: #CCCCCC; color: #ffffff;';
|
||||
}
|
||||
|
||||
if (ed.settings.inline_styles)
|
||||
h += ' style="' + tinymce.trim(st) + '"';
|
||||
|
||||
h += ' />';
|
||||
|
||||
ed.execCommand("mceInsertContent", false, h);
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
};
|
||||
|
||||
tinyMCEPopup.requireLangPack();
|
||||
tinyMCEPopup.onInit.add(AdvHRDialog.init, AdvHRDialog);
|
|
@ -1 +0,0 @@
|
|||
tinyMCE.addI18n('en.advhr_dlg',{size:"Height",noshade:"No Shadow",width:"Width",normal:"Normal",widthunits:"Units"});
|
58
gen/plone25/skin/tiny_mce/plugins/advhr/rule.htm
vendored
|
@ -1,58 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#advhr.advhr_desc}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="js/rule.js"></script>
|
||||
<script type="text/javascript" src="../../utils/mctabs.js"></script>
|
||||
<script type="text/javascript" src="../../utils/form_utils.js"></script>
|
||||
<link href="css/advhr.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body role="application">
|
||||
<form onsubmit="AdvHRDialog.update();return false;" action="#">
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advhr.advhr_desc}</a></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel_wrapper">
|
||||
<div id="general_panel" class="panel current">
|
||||
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
|
||||
<tr role="group" aria-labelledby="width_label">
|
||||
<td><label id="width_label" for="width">{#advhr_dlg.width}</label></td>
|
||||
<td class="nowrap">
|
||||
<input id="width" name="width" type="text" value="" class="mceFocus" />
|
||||
<span style="display:none;" id="width_unit_label">{#advhr_dlg.widthunits}</span>
|
||||
<select name="width2" id="width2" aria-labelledby="width_unit_label">
|
||||
<option value="">px</option>
|
||||
<option value="%">%</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="size">{#advhr_dlg.size}</label></td>
|
||||
<td><select id="size" name="size">
|
||||
<option value="">{#advhr_dlg.normal}</option>
|
||||
<option value="1">1</option>
|
||||
<option value="2">2</option>
|
||||
<option value="3">3</option>
|
||||
<option value="4">4</option>
|
||||
<option value="5">5</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="noshade">{#advhr_dlg.noshade}</label></td>
|
||||
<td><input type="checkbox" name="noshade" id="noshade" class="radio" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<input type="submit" id="insert" name="insert" value="{#insert}" />
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
|
@ -1,13 +0,0 @@
|
|||
#src_list, #over_list, #out_list {width:280px;}
|
||||
.mceActionPanel {margin-top:7px;}
|
||||
.alignPreview {border:1px solid #000; width:140px; height:140px; overflow:hidden; padding:5px;}
|
||||
.checkbox {border:0;}
|
||||
.panel_wrapper div.current {height:305px;}
|
||||
#prev {margin:0; border:1px solid #000; width:428px; height:150px; overflow:auto;}
|
||||
#align, #classlist {width:150px;}
|
||||
#width, #height {vertical-align:middle; width:50px; text-align:center;}
|
||||
#vspace, #hspace, #border {vertical-align:middle; width:30px; text-align:center;}
|
||||
#class_list {width:180px;}
|
||||
input {width: 280px;}
|
||||
#constrain, #onmousemovecheck {width:auto;}
|
||||
#id, #dir, #lang, #usemap, #longdesc {width:200px;}
|
|
@ -1 +0,0 @@
|
|||
(function(){tinymce.create("tinymce.plugins.AdvancedImagePlugin",{init:function(a,b){a.addCommand("mceAdvImage",function(){if(a.dom.getAttrib(a.selection.getNode(),"class","").indexOf("mceItem")!=-1){return}a.windowManager.open({file:b+"/image.htm",width:480+parseInt(a.getLang("advimage.delta_width",0)),height:385+parseInt(a.getLang("advimage.delta_height",0)),inline:1},{plugin_url:b})});a.addButton("image",{title:"advimage.image_desc",cmd:"mceAdvImage"})},getInfo:function(){return{longname:"Advanced image",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advimage",tinymce.plugins.AdvancedImagePlugin)})();
|
|
@ -1,50 +0,0 @@
|
|||
/**
|
||||
* editor_plugin_src.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.AdvancedImagePlugin', {
|
||||
init : function(ed, url) {
|
||||
// Register commands
|
||||
ed.addCommand('mceAdvImage', function() {
|
||||
// Internal image object like a flash placeholder
|
||||
if (ed.dom.getAttrib(ed.selection.getNode(), 'class', '').indexOf('mceItem') != -1)
|
||||
return;
|
||||
|
||||
ed.windowManager.open({
|
||||
file : url + '/image.htm',
|
||||
width : 480 + parseInt(ed.getLang('advimage.delta_width', 0)),
|
||||
height : 385 + parseInt(ed.getLang('advimage.delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('image', {
|
||||
title : 'advimage.image_desc',
|
||||
cmd : 'mceAdvImage'
|
||||
});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Advanced image',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('advimage', tinymce.plugins.AdvancedImagePlugin);
|
||||
})();
|
235
gen/plone25/skin/tiny_mce/plugins/advimage/image.htm
vendored
|
@ -1,235 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#advimage_dlg.dialog_title}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="../../utils/mctabs.js"></script>
|
||||
<script type="text/javascript" src="../../utils/form_utils.js"></script>
|
||||
<script type="text/javascript" src="../../utils/validate.js"></script>
|
||||
<script type="text/javascript" src="../../utils/editable_selects.js"></script>
|
||||
<script type="text/javascript" src="js/image.js"></script>
|
||||
<link href="css/advimage.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body id="advimage" style="display: none" role="application" aria-labelledby="app_title">
|
||||
<span id="app_title" style="display:none">{#advimage_dlg.dialog_title}</span>
|
||||
<form onsubmit="ImageDialog.insert();return false;" action="#">
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advimage_dlg.tab_general}</a></span></li>
|
||||
<li id="appearance_tab" aria-controls="appearance_panel"><span><a href="javascript:mcTabs.displayTab('appearance_tab','appearance_panel');" onmousedown="return false;">{#advimage_dlg.tab_appearance}</a></span></li>
|
||||
<li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#advimage_dlg.tab_advanced}</a></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel_wrapper">
|
||||
<div id="general_panel" class="panel current">
|
||||
<fieldset>
|
||||
<legend>{#advimage_dlg.general}</legend>
|
||||
|
||||
<table role="presentation" class="properties">
|
||||
<tr>
|
||||
<td class="column1"><label id="srclabel" for="src">{#advimage_dlg.src}</label></td>
|
||||
<td colspan="2"><table role="presentation" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input name="src" type="text" id="src" value="" class="mceFocus" onchange="ImageDialog.showPreviewImage(this.value);" aria-required="true" /></td>
|
||||
<td id="srcbrowsercontainer"> </td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="src_list">{#advimage_dlg.image_list}</label></td>
|
||||
<td><select id="src_list" name="src_list" onchange="document.getElementById('src').value=this.options[this.selectedIndex].value;document.getElementById('alt').value=this.options[this.selectedIndex].text;document.getElementById('title').value=this.options[this.selectedIndex].text;ImageDialog.showPreviewImage(this.options[this.selectedIndex].value);"><option value=""></option></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label id="altlabel" for="alt">{#advimage_dlg.alt}</label></td>
|
||||
<td colspan="2"><input id="alt" name="alt" type="text" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label id="titlelabel" for="title">{#advimage_dlg.title}</label></td>
|
||||
<td colspan="2"><input id="title" name="title" type="text" value="" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{#advimage_dlg.preview}</legend>
|
||||
<div id="prev"></div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div id="appearance_panel" class="panel">
|
||||
<fieldset>
|
||||
<legend>{#advimage_dlg.tab_appearance}</legend>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td class="column1"><label id="alignlabel" for="align">{#advimage_dlg.align}</label></td>
|
||||
<td><select id="align" name="align" onchange="ImageDialog.updateStyle('align');ImageDialog.changeAppearance();">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="baseline">{#advimage_dlg.align_baseline}</option>
|
||||
<option value="top">{#advimage_dlg.align_top}</option>
|
||||
<option value="middle">{#advimage_dlg.align_middle}</option>
|
||||
<option value="bottom">{#advimage_dlg.align_bottom}</option>
|
||||
<option value="text-top">{#advimage_dlg.align_texttop}</option>
|
||||
<option value="text-bottom">{#advimage_dlg.align_textbottom}</option>
|
||||
<option value="left">{#advimage_dlg.align_left}</option>
|
||||
<option value="right">{#advimage_dlg.align_right}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td rowspan="6" valign="top">
|
||||
<div class="alignPreview">
|
||||
<img id="alignSampleImg" src="img/sample.gif" alt="{#advimage_dlg.example_img}" />
|
||||
Lorem ipsum, Dolor sit amet, consectetuer adipiscing loreum ipsum edipiscing elit, sed diam
|
||||
nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Loreum ipsum
|
||||
edipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam
|
||||
erat volutpat.
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr role="group" aria-labelledby="widthlabel">
|
||||
<td class="column1"><label id="widthlabel" for="width">{#advimage_dlg.dimensions}</label></td>
|
||||
<td class="nowrap">
|
||||
<span style="display:none" id="width_voiceLabel">{#advimage_dlg.width}</span>
|
||||
<input name="width" type="text" id="width" value="" size="5" maxlength="5" class="size" onchange="ImageDialog.changeHeight();" aria-labelledby="width_voiceLabel" /> x
|
||||
<span style="display:none" id="height_voiceLabel">{#advimage_dlg.height}</span>
|
||||
<input name="height" type="text" id="height" value="" size="5" maxlength="5" class="size" onchange="ImageDialog.changeWidth();" aria-labelledby="height_voiceLabel" /> px
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input id="constrain" type="checkbox" name="constrain" class="checkbox" /></td>
|
||||
<td><label id="constrainlabel" for="constrain">{#advimage_dlg.constrain_proportions}</label></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label id="vspacelabel" for="vspace">{#advimage_dlg.vspace}</label></td>
|
||||
<td><input name="vspace" type="text" id="vspace" value="" size="3" maxlength="3" class="number" onchange="ImageDialog.updateStyle('vspace');ImageDialog.changeAppearance();" onblur="ImageDialog.updateStyle('vspace');ImageDialog.changeAppearance();" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label id="hspacelabel" for="hspace">{#advimage_dlg.hspace}</label></td>
|
||||
<td><input name="hspace" type="text" id="hspace" value="" size="3" maxlength="3" class="number" onchange="ImageDialog.updateStyle('hspace');ImageDialog.changeAppearance();" onblur="ImageDialog.updateStyle('hspace');ImageDialog.changeAppearance();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label id="borderlabel" for="border">{#advimage_dlg.border}</label></td>
|
||||
<td><input id="border" name="border" type="text" value="" size="3" maxlength="3" class="number" onchange="ImageDialog.updateStyle('border');ImageDialog.changeAppearance();" onblur="ImageDialog.updateStyle('border');ImageDialog.changeAppearance();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="class_list">{#class_name}</label></td>
|
||||
<td colspan="2"><select id="class_list" name="class_list" class="mceEditableSelect"><option value=""></option></select></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label id="stylelabel" for="style">{#advimage_dlg.style}</label></td>
|
||||
<td colspan="2"><input id="style" name="style" type="text" value="" onchange="ImageDialog.changeAppearance();" /></td>
|
||||
</tr>
|
||||
|
||||
<!-- <tr>
|
||||
<td class="column1"><label id="classeslabel" for="classes">{#advimage_dlg.classes}</label></td>
|
||||
<td colspan="2"><input id="classes" name="classes" type="text" value="" onchange="selectByValue(this.form,'classlist',this.value,true);" /></td>
|
||||
</tr> -->
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div id="advanced_panel" class="panel">
|
||||
<fieldset>
|
||||
<legend>{#advimage_dlg.swap_image}</legend>
|
||||
|
||||
<input type="checkbox" id="onmousemovecheck" name="onmousemovecheck" class="checkbox" onclick="ImageDialog.setSwapImage(this.checked);" aria-controls="onmouseoversrc onmouseoutsrc" />
|
||||
<label id="onmousemovechecklabel" for="onmousemovecheck">{#advimage_dlg.alt_image}</label>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="4" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td class="column1"><label id="onmouseoversrclabel" for="onmouseoversrc">{#advimage_dlg.mouseover}</label></td>
|
||||
<td><table role="presentation" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input id="onmouseoversrc" name="onmouseoversrc" type="text" value="" /></td>
|
||||
<td id="onmouseoversrccontainer"> </td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="over_list">{#advimage_dlg.image_list}</label></td>
|
||||
<td><select id="over_list" name="over_list" onchange="document.getElementById('onmouseoversrc').value=this.options[this.selectedIndex].value;"><option value=""></option></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label id="onmouseoutsrclabel" for="onmouseoutsrc">{#advimage_dlg.mouseout}</label></td>
|
||||
<td class="column2"><table role="presentation" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input id="onmouseoutsrc" name="onmouseoutsrc" type="text" value="" /></td>
|
||||
<td id="onmouseoutsrccontainer"> </td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="out_list">{#advimage_dlg.image_list}</label></td>
|
||||
<td><select id="out_list" name="out_list" onchange="document.getElementById('onmouseoutsrc').value=this.options[this.selectedIndex].value;"><option value=""></option></select></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{#advimage_dlg.misc}</legend>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td class="column1"><label id="idlabel" for="id">{#advimage_dlg.id}</label></td>
|
||||
<td><input id="id" name="id" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label id="dirlabel" for="dir">{#advimage_dlg.langdir}</label></td>
|
||||
<td>
|
||||
<select id="dir" name="dir" onchange="ImageDialog.changeAppearance();">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="ltr">{#advimage_dlg.ltr}</option>
|
||||
<option value="rtl">{#advimage_dlg.rtl}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label id="langlabel" for="lang">{#advimage_dlg.langcode}</label></td>
|
||||
<td>
|
||||
<input id="lang" name="lang" type="text" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label id="usemaplabel" for="usemap">{#advimage_dlg.map}</label></td>
|
||||
<td>
|
||||
<input id="usemap" name="usemap" type="text" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label id="longdesclabel" for="longdesc">{#advimage_dlg.long_desc}</label></td>
|
||||
<td><table role="presentation" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input id="longdesc" name="longdesc" type="text" value="" /></td>
|
||||
<td id="longdesccontainer"> </td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<input type="submit" id="insert" name="insert" value="{#insert}" />
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 1.6 KiB |
|
@ -1,462 +0,0 @@
|
|||
var ImageDialog = {
|
||||
preInit : function() {
|
||||
var url;
|
||||
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
if (url = tinyMCEPopup.getParam("external_image_list_url"))
|
||||
document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
|
||||
},
|
||||
|
||||
init : function(ed) {
|
||||
var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode(), fl = tinyMCEPopup.getParam('external_image_list', 'tinyMCEImageList');
|
||||
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
this.fillClassList('class_list');
|
||||
this.fillFileList('src_list', fl);
|
||||
this.fillFileList('over_list', fl);
|
||||
this.fillFileList('out_list', fl);
|
||||
TinyMCE_EditableSelects.init();
|
||||
|
||||
if (n.nodeName == 'IMG') {
|
||||
nl.src.value = dom.getAttrib(n, 'src');
|
||||
nl.width.value = dom.getAttrib(n, 'width');
|
||||
nl.height.value = dom.getAttrib(n, 'height');
|
||||
nl.alt.value = dom.getAttrib(n, 'alt');
|
||||
nl.title.value = dom.getAttrib(n, 'title');
|
||||
nl.vspace.value = this.getAttrib(n, 'vspace');
|
||||
nl.hspace.value = this.getAttrib(n, 'hspace');
|
||||
nl.border.value = this.getAttrib(n, 'border');
|
||||
selectByValue(f, 'align', this.getAttrib(n, 'align'));
|
||||
selectByValue(f, 'class_list', dom.getAttrib(n, 'class'), true, true);
|
||||
nl.style.value = dom.getAttrib(n, 'style');
|
||||
nl.id.value = dom.getAttrib(n, 'id');
|
||||
nl.dir.value = dom.getAttrib(n, 'dir');
|
||||
nl.lang.value = dom.getAttrib(n, 'lang');
|
||||
nl.usemap.value = dom.getAttrib(n, 'usemap');
|
||||
nl.longdesc.value = dom.getAttrib(n, 'longdesc');
|
||||
nl.insert.value = ed.getLang('update');
|
||||
|
||||
if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseover')))
|
||||
nl.onmouseoversrc.value = dom.getAttrib(n, 'onmouseover').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1');
|
||||
|
||||
if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseout')))
|
||||
nl.onmouseoutsrc.value = dom.getAttrib(n, 'onmouseout').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1');
|
||||
|
||||
if (ed.settings.inline_styles) {
|
||||
// Move attribs to styles
|
||||
if (dom.getAttrib(n, 'align'))
|
||||
this.updateStyle('align');
|
||||
|
||||
if (dom.getAttrib(n, 'hspace'))
|
||||
this.updateStyle('hspace');
|
||||
|
||||
if (dom.getAttrib(n, 'border'))
|
||||
this.updateStyle('border');
|
||||
|
||||
if (dom.getAttrib(n, 'vspace'))
|
||||
this.updateStyle('vspace');
|
||||
}
|
||||
}
|
||||
|
||||
// Setup browse button
|
||||
document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image');
|
||||
if (isVisible('srcbrowser'))
|
||||
document.getElementById('src').style.width = '260px';
|
||||
|
||||
// Setup browse button
|
||||
document.getElementById('onmouseoversrccontainer').innerHTML = getBrowserHTML('overbrowser','onmouseoversrc','image','theme_advanced_image');
|
||||
if (isVisible('overbrowser'))
|
||||
document.getElementById('onmouseoversrc').style.width = '260px';
|
||||
|
||||
// Setup browse button
|
||||
document.getElementById('onmouseoutsrccontainer').innerHTML = getBrowserHTML('outbrowser','onmouseoutsrc','image','theme_advanced_image');
|
||||
if (isVisible('outbrowser'))
|
||||
document.getElementById('onmouseoutsrc').style.width = '260px';
|
||||
|
||||
// If option enabled default contrain proportions to checked
|
||||
if (ed.getParam("advimage_constrain_proportions", true))
|
||||
f.constrain.checked = true;
|
||||
|
||||
// Check swap image if valid data
|
||||
if (nl.onmouseoversrc.value || nl.onmouseoutsrc.value)
|
||||
this.setSwapImage(true);
|
||||
else
|
||||
this.setSwapImage(false);
|
||||
|
||||
this.changeAppearance();
|
||||
this.showPreviewImage(nl.src.value, 1);
|
||||
},
|
||||
|
||||
insert : function(file, title) {
|
||||
var ed = tinyMCEPopup.editor, t = this, f = document.forms[0];
|
||||
|
||||
if (f.src.value === '') {
|
||||
if (ed.selection.getNode().nodeName == 'IMG') {
|
||||
ed.dom.remove(ed.selection.getNode());
|
||||
ed.execCommand('mceRepaint');
|
||||
}
|
||||
|
||||
tinyMCEPopup.close();
|
||||
return;
|
||||
}
|
||||
|
||||
if (tinyMCEPopup.getParam("accessibility_warnings", 1)) {
|
||||
if (!f.alt.value) {
|
||||
tinyMCEPopup.confirm(tinyMCEPopup.getLang('advimage_dlg.missing_alt'), function(s) {
|
||||
if (s)
|
||||
t.insertAndClose();
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
t.insertAndClose();
|
||||
},
|
||||
|
||||
insertAndClose : function() {
|
||||
var ed = tinyMCEPopup.editor, f = document.forms[0], nl = f.elements, v, args = {}, el;
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
|
||||
// Fixes crash in Safari
|
||||
if (tinymce.isWebKit)
|
||||
ed.getWin().focus();
|
||||
|
||||
if (!ed.settings.inline_styles) {
|
||||
args = {
|
||||
vspace : nl.vspace.value,
|
||||
hspace : nl.hspace.value,
|
||||
border : nl.border.value,
|
||||
align : getSelectValue(f, 'align')
|
||||
};
|
||||
} else {
|
||||
// Remove deprecated values
|
||||
args = {
|
||||
vspace : '',
|
||||
hspace : '',
|
||||
border : '',
|
||||
align : ''
|
||||
};
|
||||
}
|
||||
|
||||
tinymce.extend(args, {
|
||||
src : nl.src.value.replace(/ /g, '%20'),
|
||||
width : nl.width.value,
|
||||
height : nl.height.value,
|
||||
alt : nl.alt.value,
|
||||
title : nl.title.value,
|
||||
'class' : getSelectValue(f, 'class_list'),
|
||||
style : nl.style.value,
|
||||
id : nl.id.value,
|
||||
dir : nl.dir.value,
|
||||
lang : nl.lang.value,
|
||||
usemap : nl.usemap.value,
|
||||
longdesc : nl.longdesc.value
|
||||
});
|
||||
|
||||
args.onmouseover = args.onmouseout = '';
|
||||
|
||||
if (f.onmousemovecheck.checked) {
|
||||
if (nl.onmouseoversrc.value)
|
||||
args.onmouseover = "this.src='" + nl.onmouseoversrc.value + "';";
|
||||
|
||||
if (nl.onmouseoutsrc.value)
|
||||
args.onmouseout = "this.src='" + nl.onmouseoutsrc.value + "';";
|
||||
}
|
||||
|
||||
el = ed.selection.getNode();
|
||||
|
||||
if (el && el.nodeName == 'IMG') {
|
||||
ed.dom.setAttribs(el, args);
|
||||
} else {
|
||||
tinymce.each(args, function(value, name) {
|
||||
if (value === "") {
|
||||
delete args[name];
|
||||
}
|
||||
});
|
||||
|
||||
ed.execCommand('mceInsertContent', false, tinyMCEPopup.editor.dom.createHTML('img', args), {skip_undo : 1});
|
||||
ed.undoManager.add();
|
||||
}
|
||||
|
||||
tinyMCEPopup.editor.execCommand('mceRepaint');
|
||||
tinyMCEPopup.editor.focus();
|
||||
tinyMCEPopup.close();
|
||||
},
|
||||
|
||||
getAttrib : function(e, at) {
|
||||
var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2;
|
||||
|
||||
if (ed.settings.inline_styles) {
|
||||
switch (at) {
|
||||
case 'align':
|
||||
if (v = dom.getStyle(e, 'float'))
|
||||
return v;
|
||||
|
||||
if (v = dom.getStyle(e, 'vertical-align'))
|
||||
return v;
|
||||
|
||||
break;
|
||||
|
||||
case 'hspace':
|
||||
v = dom.getStyle(e, 'margin-left')
|
||||
v2 = dom.getStyle(e, 'margin-right');
|
||||
|
||||
if (v && v == v2)
|
||||
return parseInt(v.replace(/[^0-9]/g, ''));
|
||||
|
||||
break;
|
||||
|
||||
case 'vspace':
|
||||
v = dom.getStyle(e, 'margin-top')
|
||||
v2 = dom.getStyle(e, 'margin-bottom');
|
||||
if (v && v == v2)
|
||||
return parseInt(v.replace(/[^0-9]/g, ''));
|
||||
|
||||
break;
|
||||
|
||||
case 'border':
|
||||
v = 0;
|
||||
|
||||
tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) {
|
||||
sv = dom.getStyle(e, 'border-' + sv + '-width');
|
||||
|
||||
// False or not the same as prev
|
||||
if (!sv || (sv != v && v !== 0)) {
|
||||
v = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sv)
|
||||
v = sv;
|
||||
});
|
||||
|
||||
if (v)
|
||||
return parseInt(v.replace(/[^0-9]/g, ''));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (v = dom.getAttrib(e, at))
|
||||
return v;
|
||||
|
||||
return '';
|
||||
},
|
||||
|
||||
setSwapImage : function(st) {
|
||||
var f = document.forms[0];
|
||||
|
||||
f.onmousemovecheck.checked = st;
|
||||
setBrowserDisabled('overbrowser', !st);
|
||||
setBrowserDisabled('outbrowser', !st);
|
||||
|
||||
if (f.over_list)
|
||||
f.over_list.disabled = !st;
|
||||
|
||||
if (f.out_list)
|
||||
f.out_list.disabled = !st;
|
||||
|
||||
f.onmouseoversrc.disabled = !st;
|
||||
f.onmouseoutsrc.disabled = !st;
|
||||
},
|
||||
|
||||
fillClassList : function(id) {
|
||||
var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
|
||||
|
||||
if (v = tinyMCEPopup.getParam('theme_advanced_styles')) {
|
||||
cl = [];
|
||||
|
||||
tinymce.each(v.split(';'), function(v) {
|
||||
var p = v.split('=');
|
||||
|
||||
cl.push({'title' : p[0], 'class' : p[1]});
|
||||
});
|
||||
} else
|
||||
cl = tinyMCEPopup.editor.dom.getClasses();
|
||||
|
||||
if (cl.length > 0) {
|
||||
lst.options.length = 0;
|
||||
lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), '');
|
||||
|
||||
tinymce.each(cl, function(o) {
|
||||
lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']);
|
||||
});
|
||||
} else
|
||||
dom.remove(dom.getParent(id, 'tr'));
|
||||
},
|
||||
|
||||
fillFileList : function(id, l) {
|
||||
var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
|
||||
|
||||
l = typeof(l) === 'function' ? l() : window[l];
|
||||
lst.options.length = 0;
|
||||
|
||||
if (l && l.length > 0) {
|
||||
lst.options[lst.options.length] = new Option('', '');
|
||||
|
||||
tinymce.each(l, function(o) {
|
||||
lst.options[lst.options.length] = new Option(o[0], o[1]);
|
||||
});
|
||||
} else
|
||||
dom.remove(dom.getParent(id, 'tr'));
|
||||
},
|
||||
|
||||
resetImageData : function() {
|
||||
var f = document.forms[0];
|
||||
|
||||
f.elements.width.value = f.elements.height.value = '';
|
||||
},
|
||||
|
||||
updateImageData : function(img, st) {
|
||||
var f = document.forms[0];
|
||||
|
||||
if (!st) {
|
||||
f.elements.width.value = img.width;
|
||||
f.elements.height.value = img.height;
|
||||
}
|
||||
|
||||
this.preloadImg = img;
|
||||
},
|
||||
|
||||
changeAppearance : function() {
|
||||
var ed = tinyMCEPopup.editor, f = document.forms[0], img = document.getElementById('alignSampleImg');
|
||||
|
||||
if (img) {
|
||||
if (ed.getParam('inline_styles')) {
|
||||
ed.dom.setAttrib(img, 'style', f.style.value);
|
||||
} else {
|
||||
img.align = f.align.value;
|
||||
img.border = f.border.value;
|
||||
img.hspace = f.hspace.value;
|
||||
img.vspace = f.vspace.value;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
changeHeight : function() {
|
||||
var f = document.forms[0], tp, t = this;
|
||||
|
||||
if (!f.constrain.checked || !t.preloadImg) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (f.width.value == "" || f.height.value == "")
|
||||
return;
|
||||
|
||||
tp = (parseInt(f.width.value) / parseInt(t.preloadImg.width)) * t.preloadImg.height;
|
||||
f.height.value = tp.toFixed(0);
|
||||
},
|
||||
|
||||
changeWidth : function() {
|
||||
var f = document.forms[0], tp, t = this;
|
||||
|
||||
if (!f.constrain.checked || !t.preloadImg) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (f.width.value == "" || f.height.value == "")
|
||||
return;
|
||||
|
||||
tp = (parseInt(f.height.value) / parseInt(t.preloadImg.height)) * t.preloadImg.width;
|
||||
f.width.value = tp.toFixed(0);
|
||||
},
|
||||
|
||||
updateStyle : function(ty) {
|
||||
var dom = tinyMCEPopup.dom, b, bStyle, bColor, v, isIE = tinymce.isIE, f = document.forms[0], img = dom.create('img', {style : dom.get('style').value});
|
||||
|
||||
if (tinyMCEPopup.editor.settings.inline_styles) {
|
||||
// Handle align
|
||||
if (ty == 'align') {
|
||||
dom.setStyle(img, 'float', '');
|
||||
dom.setStyle(img, 'vertical-align', '');
|
||||
|
||||
v = getSelectValue(f, 'align');
|
||||
if (v) {
|
||||
if (v == 'left' || v == 'right')
|
||||
dom.setStyle(img, 'float', v);
|
||||
else
|
||||
img.style.verticalAlign = v;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle border
|
||||
if (ty == 'border') {
|
||||
b = img.style.border ? img.style.border.split(' ') : [];
|
||||
bStyle = dom.getStyle(img, 'border-style');
|
||||
bColor = dom.getStyle(img, 'border-color');
|
||||
|
||||
dom.setStyle(img, 'border', '');
|
||||
|
||||
v = f.border.value;
|
||||
if (v || v == '0') {
|
||||
if (v == '0')
|
||||
img.style.border = isIE ? '0' : '0 none none';
|
||||
else {
|
||||
if (b.length == 3 && b[isIE ? 2 : 1])
|
||||
bStyle = b[isIE ? 2 : 1];
|
||||
else if (!bStyle || bStyle == 'none')
|
||||
bStyle = 'solid';
|
||||
if (b.length == 3 && b[isIE ? 0 : 2])
|
||||
bColor = b[isIE ? 0 : 2];
|
||||
else if (!bColor || bColor == 'none')
|
||||
bColor = 'black';
|
||||
img.style.border = v + 'px ' + bStyle + ' ' + bColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle hspace
|
||||
if (ty == 'hspace') {
|
||||
dom.setStyle(img, 'marginLeft', '');
|
||||
dom.setStyle(img, 'marginRight', '');
|
||||
|
||||
v = f.hspace.value;
|
||||
if (v) {
|
||||
img.style.marginLeft = v + 'px';
|
||||
img.style.marginRight = v + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
// Handle vspace
|
||||
if (ty == 'vspace') {
|
||||
dom.setStyle(img, 'marginTop', '');
|
||||
dom.setStyle(img, 'marginBottom', '');
|
||||
|
||||
v = f.vspace.value;
|
||||
if (v) {
|
||||
img.style.marginTop = v + 'px';
|
||||
img.style.marginBottom = v + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
// Merge
|
||||
dom.get('style').value = dom.serializeStyle(dom.parseStyle(img.style.cssText), 'img');
|
||||
}
|
||||
},
|
||||
|
||||
changeMouseMove : function() {
|
||||
},
|
||||
|
||||
showPreviewImage : function(u, st) {
|
||||
if (!u) {
|
||||
tinyMCEPopup.dom.setHTML('prev', '');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!st && tinyMCEPopup.getParam("advimage_update_dimensions_onchange", true))
|
||||
this.resetImageData();
|
||||
|
||||
u = tinyMCEPopup.editor.documentBaseURI.toAbsolute(u);
|
||||
|
||||
if (!st)
|
||||
tinyMCEPopup.dom.setHTML('prev', '<img id="previewImg" src="' + u + '" border="0" onload="ImageDialog.updateImageData(this);" onerror="ImageDialog.resetImageData();" />');
|
||||
else
|
||||
tinyMCEPopup.dom.setHTML('prev', '<img id="previewImg" src="' + u + '" border="0" onload="ImageDialog.updateImageData(this, 1);" />');
|
||||
}
|
||||
};
|
||||
|
||||
ImageDialog.preInit();
|
||||
tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog);
|
|
@ -1 +0,0 @@
|
|||
tinyMCE.addI18n('en.advimage_dlg',{"image_list":"Image List","align_right":"Right","align_left":"Left","align_textbottom":"Text Bottom","align_texttop":"Text Top","align_bottom":"Bottom","align_middle":"Middle","align_top":"Top","align_baseline":"Baseline",align:"Alignment",hspace:"Horizontal Space",vspace:"Vertical Space",dimensions:"Dimensions",border:"Border",list:"Image List",alt:"Image Description",src:"Image URL","dialog_title":"Insert/Edit Image","missing_alt":"Are you sure you want to continue without including an Image Description? Without it the image may not be accessible to some users with disabilities, or to those using a text browser, or browsing the Web with images turned off.","example_img":"Appearance Preview Image",misc:"Miscellaneous",mouseout:"For Mouse Out",mouseover:"For Mouse Over","alt_image":"Alternative Image","swap_image":"Swap Image",map:"Image Map",id:"ID",rtl:"Right to Left",ltr:"Left to Right",classes:"Classes",style:"Style","long_desc":"Long Description Link",langcode:"Language Code",langdir:"Language Direction","constrain_proportions":"Constrain Proportions",preview:"Preview",title:"Title",general:"General","tab_advanced":"Advanced","tab_appearance":"Appearance","tab_general":"General",width:"Width",height:"Height"});
|
|
@ -1,8 +0,0 @@
|
|||
.mceLinkList, .mceAnchorList, #targetlist {width:280px;}
|
||||
.mceActionPanel {margin-top:7px;}
|
||||
.panel_wrapper div.current {height:320px;}
|
||||
#classlist, #title, #href {width:280px;}
|
||||
#popupurl, #popupname {width:200px;}
|
||||
#popupwidth, #popupheight, #popupleft, #popuptop {width:30px;vertical-align:middle;text-align:center;}
|
||||
#id, #style, #classes, #target, #dir, #hreflang, #lang, #charset, #type, #rel, #rev, #tabindex, #accesskey {width:200px;}
|
||||
#events_panel input {width:200px;}
|
|
@ -1 +0,0 @@
|
|||
(function(){tinymce.create("tinymce.plugins.AdvancedLinkPlugin",{init:function(a,b){this.editor=a;a.addCommand("mceAdvLink",function(){var c=a.selection;if(c.isCollapsed()&&!a.dom.getParent(c.getNode(),"A")){return}a.windowManager.open({file:b+"/link.htm",width:480+parseInt(a.getLang("advlink.delta_width",0)),height:400+parseInt(a.getLang("advlink.delta_height",0)),inline:1},{plugin_url:b})});a.addButton("link",{title:"advlink.link_desc",cmd:"mceAdvLink"});a.addShortcut("ctrl+k","advlink.advlink_desc","mceAdvLink");a.onNodeChange.add(function(d,c,f,e){c.setDisabled("link",e&&f.nodeName!="A");c.setActive("link",f.nodeName=="A"&&!f.name)})},getInfo:function(){return{longname:"Advanced link",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advlink",tinymce.plugins.AdvancedLinkPlugin)})();
|
|
@ -1,61 +0,0 @@
|
|||
/**
|
||||
* editor_plugin_src.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.AdvancedLinkPlugin', {
|
||||
init : function(ed, url) {
|
||||
this.editor = ed;
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('mceAdvLink', function() {
|
||||
var se = ed.selection;
|
||||
|
||||
// No selection and not in link
|
||||
if (se.isCollapsed() && !ed.dom.getParent(se.getNode(), 'A'))
|
||||
return;
|
||||
|
||||
ed.windowManager.open({
|
||||
file : url + '/link.htm',
|
||||
width : 480 + parseInt(ed.getLang('advlink.delta_width', 0)),
|
||||
height : 400 + parseInt(ed.getLang('advlink.delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('link', {
|
||||
title : 'advlink.link_desc',
|
||||
cmd : 'mceAdvLink'
|
||||
});
|
||||
|
||||
ed.addShortcut('ctrl+k', 'advlink.advlink_desc', 'mceAdvLink');
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm, n, co) {
|
||||
cm.setDisabled('link', co && n.nodeName != 'A');
|
||||
cm.setActive('link', n.nodeName == 'A' && !n.name);
|
||||
});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Advanced link',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('advlink', tinymce.plugins.AdvancedLinkPlugin);
|
||||
})();
|
|
@ -1,532 +0,0 @@
|
|||
/* Functions for the advlink plugin popup */
|
||||
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
var templates = {
|
||||
"window.open" : "window.open('${url}','${target}','${options}')"
|
||||
};
|
||||
|
||||
function preinit() {
|
||||
var url;
|
||||
|
||||
if (url = tinyMCEPopup.getParam("external_link_list_url"))
|
||||
document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
|
||||
}
|
||||
|
||||
function changeClass() {
|
||||
var f = document.forms[0];
|
||||
|
||||
f.classes.value = getSelectValue(f, 'classlist');
|
||||
}
|
||||
|
||||
function init() {
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
|
||||
var formObj = document.forms[0];
|
||||
var inst = tinyMCEPopup.editor;
|
||||
var elm = inst.selection.getNode();
|
||||
var action = "insert";
|
||||
var html;
|
||||
|
||||
document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','advlink');
|
||||
document.getElementById('popupurlbrowsercontainer').innerHTML = getBrowserHTML('popupurlbrowser','popupurl','file','advlink');
|
||||
document.getElementById('targetlistcontainer').innerHTML = getTargetListHTML('targetlist','target');
|
||||
|
||||
// Link list
|
||||
html = getLinkListHTML('linklisthref','href');
|
||||
if (html == "")
|
||||
document.getElementById("linklisthrefrow").style.display = 'none';
|
||||
else
|
||||
document.getElementById("linklisthrefcontainer").innerHTML = html;
|
||||
|
||||
// Anchor list
|
||||
html = getAnchorListHTML('anchorlist','href');
|
||||
if (html == "")
|
||||
document.getElementById("anchorlistrow").style.display = 'none';
|
||||
else
|
||||
document.getElementById("anchorlistcontainer").innerHTML = html;
|
||||
|
||||
// Resize some elements
|
||||
if (isVisible('hrefbrowser'))
|
||||
document.getElementById('href').style.width = '260px';
|
||||
|
||||
if (isVisible('popupurlbrowser'))
|
||||
document.getElementById('popupurl').style.width = '180px';
|
||||
|
||||
elm = inst.dom.getParent(elm, "A");
|
||||
if (elm != null && elm.nodeName == "A")
|
||||
action = "update";
|
||||
|
||||
formObj.insert.value = tinyMCEPopup.getLang(action, 'Insert', true);
|
||||
|
||||
setPopupControlsDisabled(true);
|
||||
|
||||
if (action == "update") {
|
||||
var href = inst.dom.getAttrib(elm, 'href');
|
||||
var onclick = inst.dom.getAttrib(elm, 'onclick');
|
||||
|
||||
// Setup form data
|
||||
setFormValue('href', href);
|
||||
setFormValue('title', inst.dom.getAttrib(elm, 'title'));
|
||||
setFormValue('id', inst.dom.getAttrib(elm, 'id'));
|
||||
setFormValue('style', inst.dom.getAttrib(elm, "style"));
|
||||
setFormValue('rel', inst.dom.getAttrib(elm, 'rel'));
|
||||
setFormValue('rev', inst.dom.getAttrib(elm, 'rev'));
|
||||
setFormValue('charset', inst.dom.getAttrib(elm, 'charset'));
|
||||
setFormValue('hreflang', inst.dom.getAttrib(elm, 'hreflang'));
|
||||
setFormValue('dir', inst.dom.getAttrib(elm, 'dir'));
|
||||
setFormValue('lang', inst.dom.getAttrib(elm, 'lang'));
|
||||
setFormValue('tabindex', inst.dom.getAttrib(elm, 'tabindex', typeof(elm.tabindex) != "undefined" ? elm.tabindex : ""));
|
||||
setFormValue('accesskey', inst.dom.getAttrib(elm, 'accesskey', typeof(elm.accesskey) != "undefined" ? elm.accesskey : ""));
|
||||
setFormValue('type', inst.dom.getAttrib(elm, 'type'));
|
||||
setFormValue('onfocus', inst.dom.getAttrib(elm, 'onfocus'));
|
||||
setFormValue('onblur', inst.dom.getAttrib(elm, 'onblur'));
|
||||
setFormValue('onclick', onclick);
|
||||
setFormValue('ondblclick', inst.dom.getAttrib(elm, 'ondblclick'));
|
||||
setFormValue('onmousedown', inst.dom.getAttrib(elm, 'onmousedown'));
|
||||
setFormValue('onmouseup', inst.dom.getAttrib(elm, 'onmouseup'));
|
||||
setFormValue('onmouseover', inst.dom.getAttrib(elm, 'onmouseover'));
|
||||
setFormValue('onmousemove', inst.dom.getAttrib(elm, 'onmousemove'));
|
||||
setFormValue('onmouseout', inst.dom.getAttrib(elm, 'onmouseout'));
|
||||
setFormValue('onkeypress', inst.dom.getAttrib(elm, 'onkeypress'));
|
||||
setFormValue('onkeydown', inst.dom.getAttrib(elm, 'onkeydown'));
|
||||
setFormValue('onkeyup', inst.dom.getAttrib(elm, 'onkeyup'));
|
||||
setFormValue('target', inst.dom.getAttrib(elm, 'target'));
|
||||
setFormValue('classes', inst.dom.getAttrib(elm, 'class'));
|
||||
|
||||
// Parse onclick data
|
||||
if (onclick != null && onclick.indexOf('window.open') != -1)
|
||||
parseWindowOpen(onclick);
|
||||
else
|
||||
parseFunction(onclick);
|
||||
|
||||
// Select by the values
|
||||
selectByValue(formObj, 'dir', inst.dom.getAttrib(elm, 'dir'));
|
||||
selectByValue(formObj, 'rel', inst.dom.getAttrib(elm, 'rel'));
|
||||
selectByValue(formObj, 'rev', inst.dom.getAttrib(elm, 'rev'));
|
||||
selectByValue(formObj, 'linklisthref', href);
|
||||
|
||||
if (href.charAt(0) == '#')
|
||||
selectByValue(formObj, 'anchorlist', href);
|
||||
|
||||
addClassesToList('classlist', 'advlink_styles');
|
||||
|
||||
selectByValue(formObj, 'classlist', inst.dom.getAttrib(elm, 'class'), true);
|
||||
selectByValue(formObj, 'targetlist', inst.dom.getAttrib(elm, 'target'), true);
|
||||
} else
|
||||
addClassesToList('classlist', 'advlink_styles');
|
||||
}
|
||||
|
||||
function checkPrefix(n) {
|
||||
if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_email')))
|
||||
n.value = 'mailto:' + n.value;
|
||||
|
||||
if (/^\s*www\./i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_external')))
|
||||
n.value = 'http://' + n.value;
|
||||
}
|
||||
|
||||
function setFormValue(name, value) {
|
||||
document.forms[0].elements[name].value = value;
|
||||
}
|
||||
|
||||
function parseWindowOpen(onclick) {
|
||||
var formObj = document.forms[0];
|
||||
|
||||
// Preprocess center code
|
||||
if (onclick.indexOf('return false;') != -1) {
|
||||
formObj.popupreturn.checked = true;
|
||||
onclick = onclick.replace('return false;', '');
|
||||
} else
|
||||
formObj.popupreturn.checked = false;
|
||||
|
||||
var onClickData = parseLink(onclick);
|
||||
|
||||
if (onClickData != null) {
|
||||
formObj.ispopup.checked = true;
|
||||
setPopupControlsDisabled(false);
|
||||
|
||||
var onClickWindowOptions = parseOptions(onClickData['options']);
|
||||
var url = onClickData['url'];
|
||||
|
||||
formObj.popupname.value = onClickData['target'];
|
||||
formObj.popupurl.value = url;
|
||||
formObj.popupwidth.value = getOption(onClickWindowOptions, 'width');
|
||||
formObj.popupheight.value = getOption(onClickWindowOptions, 'height');
|
||||
|
||||
formObj.popupleft.value = getOption(onClickWindowOptions, 'left');
|
||||
formObj.popuptop.value = getOption(onClickWindowOptions, 'top');
|
||||
|
||||
if (formObj.popupleft.value.indexOf('screen') != -1)
|
||||
formObj.popupleft.value = "c";
|
||||
|
||||
if (formObj.popuptop.value.indexOf('screen') != -1)
|
||||
formObj.popuptop.value = "c";
|
||||
|
||||
formObj.popuplocation.checked = getOption(onClickWindowOptions, 'location') == "yes";
|
||||
formObj.popupscrollbars.checked = getOption(onClickWindowOptions, 'scrollbars') == "yes";
|
||||
formObj.popupmenubar.checked = getOption(onClickWindowOptions, 'menubar') == "yes";
|
||||
formObj.popupresizable.checked = getOption(onClickWindowOptions, 'resizable') == "yes";
|
||||
formObj.popuptoolbar.checked = getOption(onClickWindowOptions, 'toolbar') == "yes";
|
||||
formObj.popupstatus.checked = getOption(onClickWindowOptions, 'status') == "yes";
|
||||
formObj.popupdependent.checked = getOption(onClickWindowOptions, 'dependent') == "yes";
|
||||
|
||||
buildOnClick();
|
||||
}
|
||||
}
|
||||
|
||||
function parseFunction(onclick) {
|
||||
var formObj = document.forms[0];
|
||||
var onClickData = parseLink(onclick);
|
||||
|
||||
// TODO: Add stuff here
|
||||
}
|
||||
|
||||
function getOption(opts, name) {
|
||||
return typeof(opts[name]) == "undefined" ? "" : opts[name];
|
||||
}
|
||||
|
||||
function setPopupControlsDisabled(state) {
|
||||
var formObj = document.forms[0];
|
||||
|
||||
formObj.popupname.disabled = state;
|
||||
formObj.popupurl.disabled = state;
|
||||
formObj.popupwidth.disabled = state;
|
||||
formObj.popupheight.disabled = state;
|
||||
formObj.popupleft.disabled = state;
|
||||
formObj.popuptop.disabled = state;
|
||||
formObj.popuplocation.disabled = state;
|
||||
formObj.popupscrollbars.disabled = state;
|
||||
formObj.popupmenubar.disabled = state;
|
||||
formObj.popupresizable.disabled = state;
|
||||
formObj.popuptoolbar.disabled = state;
|
||||
formObj.popupstatus.disabled = state;
|
||||
formObj.popupreturn.disabled = state;
|
||||
formObj.popupdependent.disabled = state;
|
||||
|
||||
setBrowserDisabled('popupurlbrowser', state);
|
||||
}
|
||||
|
||||
function parseLink(link) {
|
||||
link = link.replace(new RegExp(''', 'g'), "'");
|
||||
|
||||
var fnName = link.replace(new RegExp("\\s*([A-Za-z0-9\.]*)\\s*\\(.*", "gi"), "$1");
|
||||
|
||||
// Is function name a template function
|
||||
var template = templates[fnName];
|
||||
if (template) {
|
||||
// Build regexp
|
||||
var variableNames = template.match(new RegExp("'?\\$\\{[A-Za-z0-9\.]*\\}'?", "gi"));
|
||||
var regExp = "\\s*[A-Za-z0-9\.]*\\s*\\(";
|
||||
var replaceStr = "";
|
||||
for (var i=0; i<variableNames.length; i++) {
|
||||
// Is string value
|
||||
if (variableNames[i].indexOf("'${") != -1)
|
||||
regExp += "'(.*)'";
|
||||
else // Number value
|
||||
regExp += "([0-9]*)";
|
||||
|
||||
replaceStr += "$" + (i+1);
|
||||
|
||||
// Cleanup variable name
|
||||
variableNames[i] = variableNames[i].replace(new RegExp("[^A-Za-z0-9]", "gi"), "");
|
||||
|
||||
if (i != variableNames.length-1) {
|
||||
regExp += "\\s*,\\s*";
|
||||
replaceStr += "<delim>";
|
||||
} else
|
||||
regExp += ".*";
|
||||
}
|
||||
|
||||
regExp += "\\);?";
|
||||
|
||||
// Build variable array
|
||||
var variables = [];
|
||||
variables["_function"] = fnName;
|
||||
var variableValues = link.replace(new RegExp(regExp, "gi"), replaceStr).split('<delim>');
|
||||
for (var i=0; i<variableNames.length; i++)
|
||||
variables[variableNames[i]] = variableValues[i];
|
||||
|
||||
return variables;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function parseOptions(opts) {
|
||||
if (opts == null || opts == "")
|
||||
return [];
|
||||
|
||||
// Cleanup the options
|
||||
opts = opts.toLowerCase();
|
||||
opts = opts.replace(/;/g, ",");
|
||||
opts = opts.replace(/[^0-9a-z=,]/g, "");
|
||||
|
||||
var optionChunks = opts.split(',');
|
||||
var options = [];
|
||||
|
||||
for (var i=0; i<optionChunks.length; i++) {
|
||||
var parts = optionChunks[i].split('=');
|
||||
|
||||
if (parts.length == 2)
|
||||
options[parts[0]] = parts[1];
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
function buildOnClick() {
|
||||
var formObj = document.forms[0];
|
||||
|
||||
if (!formObj.ispopup.checked) {
|
||||
formObj.onclick.value = "";
|
||||
return;
|
||||
}
|
||||
|
||||
var onclick = "window.open('";
|
||||
var url = formObj.popupurl.value;
|
||||
|
||||
onclick += url + "','";
|
||||
onclick += formObj.popupname.value + "','";
|
||||
|
||||
if (formObj.popuplocation.checked)
|
||||
onclick += "location=yes,";
|
||||
|
||||
if (formObj.popupscrollbars.checked)
|
||||
onclick += "scrollbars=yes,";
|
||||
|
||||
if (formObj.popupmenubar.checked)
|
||||
onclick += "menubar=yes,";
|
||||
|
||||
if (formObj.popupresizable.checked)
|
||||
onclick += "resizable=yes,";
|
||||
|
||||
if (formObj.popuptoolbar.checked)
|
||||
onclick += "toolbar=yes,";
|
||||
|
||||
if (formObj.popupstatus.checked)
|
||||
onclick += "status=yes,";
|
||||
|
||||
if (formObj.popupdependent.checked)
|
||||
onclick += "dependent=yes,";
|
||||
|
||||
if (formObj.popupwidth.value != "")
|
||||
onclick += "width=" + formObj.popupwidth.value + ",";
|
||||
|
||||
if (formObj.popupheight.value != "")
|
||||
onclick += "height=" + formObj.popupheight.value + ",";
|
||||
|
||||
if (formObj.popupleft.value != "") {
|
||||
if (formObj.popupleft.value != "c")
|
||||
onclick += "left=" + formObj.popupleft.value + ",";
|
||||
else
|
||||
onclick += "left='+(screen.availWidth/2-" + (formObj.popupwidth.value/2) + ")+',";
|
||||
}
|
||||
|
||||
if (formObj.popuptop.value != "") {
|
||||
if (formObj.popuptop.value != "c")
|
||||
onclick += "top=" + formObj.popuptop.value + ",";
|
||||
else
|
||||
onclick += "top='+(screen.availHeight/2-" + (formObj.popupheight.value/2) + ")+',";
|
||||
}
|
||||
|
||||
if (onclick.charAt(onclick.length-1) == ',')
|
||||
onclick = onclick.substring(0, onclick.length-1);
|
||||
|
||||
onclick += "');";
|
||||
|
||||
if (formObj.popupreturn.checked)
|
||||
onclick += "return false;";
|
||||
|
||||
// tinyMCE.debug(onclick);
|
||||
|
||||
formObj.onclick.value = onclick;
|
||||
|
||||
if (formObj.href.value == "")
|
||||
formObj.href.value = url;
|
||||
}
|
||||
|
||||
function setAttrib(elm, attrib, value) {
|
||||
var formObj = document.forms[0];
|
||||
var valueElm = formObj.elements[attrib.toLowerCase()];
|
||||
var dom = tinyMCEPopup.editor.dom;
|
||||
|
||||
if (typeof(value) == "undefined" || value == null) {
|
||||
value = "";
|
||||
|
||||
if (valueElm)
|
||||
value = valueElm.value;
|
||||
}
|
||||
|
||||
// Clean up the style
|
||||
if (attrib == 'style')
|
||||
value = dom.serializeStyle(dom.parseStyle(value), 'a');
|
||||
|
||||
dom.setAttrib(elm, attrib, value);
|
||||
}
|
||||
|
||||
function getAnchorListHTML(id, target) {
|
||||
var ed = tinyMCEPopup.editor, nodes = ed.dom.select('a'), name, i, len, html = "";
|
||||
|
||||
for (i=0, len=nodes.length; i<len; i++) {
|
||||
if ((name = ed.dom.getAttrib(nodes[i], "name")) != "")
|
||||
html += '<option value="#' + name + '">' + name + '</option>';
|
||||
}
|
||||
|
||||
if (html == "")
|
||||
return "";
|
||||
|
||||
html = '<select id="' + id + '" name="' + id + '" class="mceAnchorList"'
|
||||
+ ' onchange="this.form.' + target + '.value=this.options[this.selectedIndex].value"'
|
||||
+ '>'
|
||||
+ '<option value="">---</option>'
|
||||
+ html
|
||||
+ '</select>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function insertAction() {
|
||||
var inst = tinyMCEPopup.editor;
|
||||
var elm, elementArray, i;
|
||||
|
||||
elm = inst.selection.getNode();
|
||||
checkPrefix(document.forms[0].href);
|
||||
|
||||
elm = inst.dom.getParent(elm, "A");
|
||||
|
||||
// Remove element if there is no href
|
||||
if (!document.forms[0].href.value) {
|
||||
i = inst.selection.getBookmark();
|
||||
inst.dom.remove(elm, 1);
|
||||
inst.selection.moveToBookmark(i);
|
||||
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
||||
tinyMCEPopup.close();
|
||||
return;
|
||||
}
|
||||
|
||||
// Create new anchor elements
|
||||
if (elm == null) {
|
||||
inst.getDoc().execCommand("unlink", false, null);
|
||||
tinyMCEPopup.execCommand("mceInsertLink", false, "#mce_temp_url#", {skip_undo : 1});
|
||||
|
||||
elementArray = tinymce.grep(inst.dom.select("a"), function(n) {return inst.dom.getAttrib(n, 'href') == '#mce_temp_url#';});
|
||||
for (i=0; i<elementArray.length; i++)
|
||||
setAllAttribs(elm = elementArray[i]);
|
||||
} else
|
||||
setAllAttribs(elm);
|
||||
|
||||
// Don't move caret if selection was image
|
||||
if (elm.childNodes.length != 1 || elm.firstChild.nodeName != 'IMG') {
|
||||
inst.focus();
|
||||
inst.selection.select(elm);
|
||||
inst.selection.collapse(0);
|
||||
tinyMCEPopup.storeSelection();
|
||||
}
|
||||
|
||||
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
|
||||
function setAllAttribs(elm) {
|
||||
var formObj = document.forms[0];
|
||||
var href = formObj.href.value.replace(/ /g, '%20');
|
||||
var target = getSelectValue(formObj, 'targetlist');
|
||||
|
||||
setAttrib(elm, 'href', href);
|
||||
setAttrib(elm, 'title');
|
||||
setAttrib(elm, 'target', target == '_self' ? '' : target);
|
||||
setAttrib(elm, 'id');
|
||||
setAttrib(elm, 'style');
|
||||
setAttrib(elm, 'class', getSelectValue(formObj, 'classlist'));
|
||||
setAttrib(elm, 'rel');
|
||||
setAttrib(elm, 'rev');
|
||||
setAttrib(elm, 'charset');
|
||||
setAttrib(elm, 'hreflang');
|
||||
setAttrib(elm, 'dir');
|
||||
setAttrib(elm, 'lang');
|
||||
setAttrib(elm, 'tabindex');
|
||||
setAttrib(elm, 'accesskey');
|
||||
setAttrib(elm, 'type');
|
||||
setAttrib(elm, 'onfocus');
|
||||
setAttrib(elm, 'onblur');
|
||||
setAttrib(elm, 'onclick');
|
||||
setAttrib(elm, 'ondblclick');
|
||||
setAttrib(elm, 'onmousedown');
|
||||
setAttrib(elm, 'onmouseup');
|
||||
setAttrib(elm, 'onmouseover');
|
||||
setAttrib(elm, 'onmousemove');
|
||||
setAttrib(elm, 'onmouseout');
|
||||
setAttrib(elm, 'onkeypress');
|
||||
setAttrib(elm, 'onkeydown');
|
||||
setAttrib(elm, 'onkeyup');
|
||||
|
||||
// Refresh in old MSIE
|
||||
if (tinyMCE.isMSIE5)
|
||||
elm.outerHTML = elm.outerHTML;
|
||||
}
|
||||
|
||||
function getSelectValue(form_obj, field_name) {
|
||||
var elm = form_obj.elements[field_name];
|
||||
|
||||
if (!elm || elm.options == null || elm.selectedIndex == -1)
|
||||
return "";
|
||||
|
||||
return elm.options[elm.selectedIndex].value;
|
||||
}
|
||||
|
||||
function getLinkListHTML(elm_id, target_form_element, onchange_func) {
|
||||
if (typeof(tinyMCELinkList) == "undefined" || tinyMCELinkList.length == 0)
|
||||
return "";
|
||||
|
||||
var html = "";
|
||||
|
||||
html += '<select id="' + elm_id + '" name="' + elm_id + '"';
|
||||
html += ' class="mceLinkList" onfoc2us="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target_form_element + '.value=';
|
||||
html += 'this.options[this.selectedIndex].value;';
|
||||
|
||||
if (typeof(onchange_func) != "undefined")
|
||||
html += onchange_func + '(\'' + target_form_element + '\',this.options[this.selectedIndex].text,this.options[this.selectedIndex].value);';
|
||||
|
||||
html += '"><option value="">---</option>';
|
||||
|
||||
for (var i=0; i<tinyMCELinkList.length; i++)
|
||||
html += '<option value="' + tinyMCELinkList[i][1] + '">' + tinyMCELinkList[i][0] + '</option>';
|
||||
|
||||
html += '</select>';
|
||||
|
||||
return html;
|
||||
|
||||
// tinyMCE.debug('-- image list start --', html, '-- image list end --');
|
||||
}
|
||||
|
||||
function getTargetListHTML(elm_id, target_form_element) {
|
||||
var targets = tinyMCEPopup.getParam('theme_advanced_link_targets', '').split(';');
|
||||
var html = '';
|
||||
|
||||
html += '<select id="' + elm_id + '" name="' + elm_id + '" onf2ocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target_form_element + '.value=';
|
||||
html += 'this.options[this.selectedIndex].value;">';
|
||||
html += '<option value="_self">' + tinyMCEPopup.getLang('advlink_dlg.target_same') + '</option>';
|
||||
html += '<option value="_blank">' + tinyMCEPopup.getLang('advlink_dlg.target_blank') + ' (_blank)</option>';
|
||||
html += '<option value="_parent">' + tinyMCEPopup.getLang('advlink_dlg.target_parent') + ' (_parent)</option>';
|
||||
html += '<option value="_top">' + tinyMCEPopup.getLang('advlink_dlg.target_top') + ' (_top)</option>';
|
||||
|
||||
for (var i=0; i<targets.length; i++) {
|
||||
var key, value;
|
||||
|
||||
if (targets[i] == "")
|
||||
continue;
|
||||
|
||||
key = targets[i].split('=')[0];
|
||||
value = targets[i].split('=')[1];
|
||||
|
||||
html += '<option value="' + key + '">' + value + ' (' + key + ')</option>';
|
||||
}
|
||||
|
||||
html += '</select>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
// While loading
|
||||
preinit();
|
||||
tinyMCEPopup.onInit.add(init);
|
|
@ -1 +0,0 @@
|
|||
tinyMCE.addI18n('en.advlink_dlg',{"target_name":"Target Name",classes:"Classes",style:"Style",id:"ID","popup_position":"Position (X/Y)",langdir:"Language Direction","popup_size":"Size","popup_dependent":"Dependent (Mozilla/Firefox Only)","popup_resizable":"Make Window Resizable","popup_location":"Show Location Bar","popup_menubar":"Show Menu Bar","popup_toolbar":"Show Toolbars","popup_statusbar":"Show Status Bar","popup_scrollbars":"Show Scrollbars","popup_return":"Insert \'return false\'","popup_name":"Window Name","popup_url":"Popup URL",popup:"JavaScript Popup","target_blank":"Open in New Window","target_top":"Open in Top Frame (Replaces All Frames)","target_parent":"Open in Parent Window/Frame","target_same":"Open in This Window/Frame","anchor_names":"Anchors","popup_opts":"Options","advanced_props":"Advanced Properties","event_props":"Events","popup_props":"Popup Properties","general_props":"General Properties","advanced_tab":"Advanced","events_tab":"Events","popup_tab":"Popup","general_tab":"General",list:"Link List","is_external":"The URL you entered seems to be an external link. Do you want to add the required http:// prefix?","is_email":"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",titlefield:"Title",target:"Target",url:"Link URL",title:"Insert/Edit Link","link_list":"Link List",rtl:"Right to Left",ltr:"Left to Right",accesskey:"AccessKey",tabindex:"TabIndex",rev:"Relationship Target to Page",rel:"Relationship Page to Target",mime:"Target MIME Type",encoding:"Target Character Encoding",langcode:"Language Code","target_langcode":"Target Language",width:"Width",height:"Height"});
|
338
gen/plone25/skin/tiny_mce/plugins/advlink/link.htm
vendored
|
@ -1,338 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#advlink_dlg.title}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="../../utils/mctabs.js"></script>
|
||||
<script type="text/javascript" src="../../utils/form_utils.js"></script>
|
||||
<script type="text/javascript" src="../../utils/validate.js"></script>
|
||||
<script type="text/javascript" src="js/advlink.js"></script>
|
||||
<link href="css/advlink.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body id="advlink" style="display: none" role="application" onload="javascript:mcTabs.displayTab('general_tab','general_panel', true);" aria-labelledby="app_label">
|
||||
<span class="mceVoiceLabel" id="app_label" style="display:none;">{#advlink_dlg.title}</span>
|
||||
<form onsubmit="insertAction();return false;" action="#">
|
||||
<div class="tabs" role="presentation">
|
||||
<ul>
|
||||
<li id="general_tab" class="current" aria-controls="general_panel" ><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advlink_dlg.general_tab}</a></span></li>
|
||||
<li id="popup_tab" aria-controls="popup_panel" ><span><a href="javascript:mcTabs.displayTab('popup_tab','popup_panel');" onmousedown="return false;">{#advlink_dlg.popup_tab}</a></span></li>
|
||||
<li id="events_tab" aria-controls="events_panel"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#advlink_dlg.events_tab}</a></span></li>
|
||||
<li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#advlink_dlg.advanced_tab}</a></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel_wrapper" role="presentation">
|
||||
<div id="general_panel" class="panel current">
|
||||
<fieldset>
|
||||
<legend>{#advlink_dlg.general_props}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0" role="presentation">
|
||||
<tr>
|
||||
<td class="nowrap"><label id="hreflabel" for="href">{#advlink_dlg.url}</label></td>
|
||||
<td><table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input id="href" name="href" type="text" class="mceFocus" value="" onchange="selectByValue(this.form,'linklisthref',this.value);" aria-required="true" /></td>
|
||||
<td id="hrefbrowsercontainer"> </td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr id="linklisthrefrow">
|
||||
<td class="column1"><label for="linklisthref">{#advlink_dlg.list}</label></td>
|
||||
<td colspan="2" id="linklisthrefcontainer"><select id="linklisthref"><option value=""></option></select></td>
|
||||
</tr>
|
||||
<tr id="anchorlistrow">
|
||||
<td class="column1"><label for="anchorlist">{#advlink_dlg.anchor_names}</label></td>
|
||||
<td colspan="2" id="anchorlistcontainer"><select id="anchorlist"><option value=""></option></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label id="targetlistlabel" for="targetlist">{#advlink_dlg.target}</label></td>
|
||||
<td id="targetlistcontainer"><select id="targetlist"><option value=""></option></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><label id="titlelabel" for="title">{#advlink_dlg.titlefield}</label></td>
|
||||
<td><input id="title" name="title" type="text" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label id="classlabel" for="classlist">{#class_name}</label></td>
|
||||
<td>
|
||||
<select id="classlist" name="classlist" onchange="changeClass();">
|
||||
<option value="" selected="selected">{#not_set}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div id="popup_panel" class="panel">
|
||||
<fieldset>
|
||||
<legend>{#advlink_dlg.popup_props}</legend>
|
||||
|
||||
<input type="checkbox" id="ispopup" name="ispopup" class="radio" onclick="setPopupControlsDisabled(!this.checked);buildOnClick();" />
|
||||
<label id="ispopuplabel" for="ispopup">{#advlink_dlg.popup}</label>
|
||||
|
||||
<table border="0" cellpadding="0" cellspacing="4" role="presentation" >
|
||||
<tr>
|
||||
<td class="nowrap"><label for="popupurl">{#advlink_dlg.popup_url}</label> </td>
|
||||
<td>
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input type="text" name="popupurl" id="popupurl" value="" onchange="buildOnClick();" /></td>
|
||||
<td id="popupurlbrowsercontainer"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><label for="popupname">{#advlink_dlg.popup_name}</label> </td>
|
||||
<td><input type="text" name="popupname" id="popupname" value="" onchange="buildOnClick();" /></td>
|
||||
</tr>
|
||||
<tr role="group" aria-labelledby="popup_size_label">
|
||||
<td class="nowrap"><label id="popup_size_label">{#advlink_dlg.popup_size}</label> </td>
|
||||
<td class="nowrap">
|
||||
<span style="display:none" id="width_voiceLabel">{#advlink_dlg.width}</span>
|
||||
<input type="text" id="popupwidth" name="popupwidth" value="" onchange="buildOnClick();" aria-labelledby="width_voiceLabel" /> x
|
||||
<span style="display:none" id="height_voiceLabel">{#advlink_dlg.height}</span>
|
||||
<input type="text" id="popupheight" name="popupheight" value="" onchange="buildOnClick();" aria-labelledby="height_voiceLabel" /> px
|
||||
</td>
|
||||
</tr>
|
||||
<tr role="group" aria-labelledby="popup_position_label center_hint">
|
||||
<td class="nowrap" id="labelleft"><label id="popup_position_label">{#advlink_dlg.popup_position}</label> </td>
|
||||
<td class="nowrap">
|
||||
<span style="display:none" id="x_voiceLabel">X</span>
|
||||
<input type="text" id="popupleft" name="popupleft" value="" onchange="buildOnClick();" aria-labelledby="x_voiceLabel" /> /
|
||||
<span style="display:none" id="y_voiceLabel">Y</span>
|
||||
<input type="text" id="popuptop" name="popuptop" value="" onchange="buildOnClick();" aria-labelledby="y_voiceLabel" /> <span id="center_hint">(c /c = center)</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<fieldset>
|
||||
<legend>{#advlink_dlg.popup_opts}</legend>
|
||||
|
||||
<table border="0" cellpadding="0" cellspacing="4" role="presentation" >
|
||||
<tr>
|
||||
<td><input type="checkbox" id="popuplocation" name="popuplocation" class="checkbox" onchange="buildOnClick();" /></td>
|
||||
<td class="nowrap"><label id="popuplocationlabel" for="popuplocation">{#advlink_dlg.popup_location}</label></td>
|
||||
<td><input type="checkbox" id="popupscrollbars" name="popupscrollbars" class="checkbox" onchange="buildOnClick();" /></td>
|
||||
<td class="nowrap"><label id="popupscrollbarslabel" for="popupscrollbars">{#advlink_dlg.popup_scrollbars}</label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox" id="popupmenubar" name="popupmenubar" class="checkbox" onchange="buildOnClick();" /></td>
|
||||
<td class="nowrap"><label id="popupmenubarlabel" for="popupmenubar">{#advlink_dlg.popup_menubar}</label></td>
|
||||
<td><input type="checkbox" id="popupresizable" name="popupresizable" class="checkbox" onchange="buildOnClick();" /></td>
|
||||
<td class="nowrap"><label id="popupresizablelabel" for="popupresizable">{#advlink_dlg.popup_resizable}</label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox" id="popuptoolbar" name="popuptoolbar" class="checkbox" onchange="buildOnClick();" /></td>
|
||||
<td class="nowrap"><label id="popuptoolbarlabel" for="popuptoolbar">{#advlink_dlg.popup_toolbar}</label></td>
|
||||
<td><input type="checkbox" id="popupdependent" name="popupdependent" class="checkbox" onchange="buildOnClick();" /></td>
|
||||
<td class="nowrap"><label id="popupdependentlabel" for="popupdependent">{#advlink_dlg.popup_dependent}</label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox" id="popupstatus" name="popupstatus" class="checkbox" onchange="buildOnClick();" /></td>
|
||||
<td class="nowrap"><label id="popupstatuslabel" for="popupstatus">{#advlink_dlg.popup_statusbar}</label></td>
|
||||
<td><input type="checkbox" id="popupreturn" name="popupreturn" class="checkbox" onchange="buildOnClick();" checked="checked" /></td>
|
||||
<td class="nowrap"><label id="popupreturnlabel" for="popupreturn">{#advlink_dlg.popup_return}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div id="advanced_panel" class="panel">
|
||||
<fieldset>
|
||||
<legend>{#advlink_dlg.advanced_props}</legend>
|
||||
|
||||
<table border="0" cellpadding="0" cellspacing="4" role="presentation" >
|
||||
<tr>
|
||||
<td class="column1"><label id="idlabel" for="id">{#advlink_dlg.id}</label></td>
|
||||
<td><input id="id" name="id" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label id="stylelabel" for="style">{#advlink_dlg.style}</label></td>
|
||||
<td><input type="text" id="style" name="style" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label id="classeslabel" for="classes">{#advlink_dlg.classes}</label></td>
|
||||
<td><input type="text" id="classes" name="classes" value="" onchange="selectByValue(this.form,'classlist',this.value,true);" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label id="targetlabel" for="target">{#advlink_dlg.target_name}</label></td>
|
||||
<td><input type="text" id="target" name="target" value="" onchange="selectByValue(this.form,'targetlist',this.value,true);" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label id="dirlabel" for="dir">{#advlink_dlg.langdir}</label></td>
|
||||
<td>
|
||||
<select id="dir" name="dir">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="ltr">{#advlink_dlg.ltr}</option>
|
||||
<option value="rtl">{#advlink_dlg.rtl}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label id="hreflanglabel" for="hreflang">{#advlink_dlg.target_langcode}</label></td>
|
||||
<td><input type="text" id="hreflang" name="hreflang" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label id="langlabel" for="lang">{#advlink_dlg.langcode}</label></td>
|
||||
<td>
|
||||
<input id="lang" name="lang" type="text" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label id="charsetlabel" for="charset">{#advlink_dlg.encoding}</label></td>
|
||||
<td><input type="text" id="charset" name="charset" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label id="typelabel" for="type">{#advlink_dlg.mime}</label></td>
|
||||
<td><input type="text" id="type" name="type" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label id="rellabel" for="rel">{#advlink_dlg.rel}</label></td>
|
||||
<td><select id="rel" name="rel">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="lightbox">Lightbox</option>
|
||||
<option value="alternate">Alternate</option>
|
||||
<option value="designates">Designates</option>
|
||||
<option value="stylesheet">Stylesheet</option>
|
||||
<option value="start">Start</option>
|
||||
<option value="next">Next</option>
|
||||
<option value="prev">Prev</option>
|
||||
<option value="contents">Contents</option>
|
||||
<option value="index">Index</option>
|
||||
<option value="glossary">Glossary</option>
|
||||
<option value="copyright">Copyright</option>
|
||||
<option value="chapter">Chapter</option>
|
||||
<option value="subsection">Subsection</option>
|
||||
<option value="appendix">Appendix</option>
|
||||
<option value="help">Help</option>
|
||||
<option value="bookmark">Bookmark</option>
|
||||
<option value="nofollow">No Follow</option>
|
||||
<option value="tag">Tag</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label id="revlabel" for="rev">{#advlink_dlg.rev}</label></td>
|
||||
<td><select id="rev" name="rev">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="alternate">Alternate</option>
|
||||
<option value="designates">Designates</option>
|
||||
<option value="stylesheet">Stylesheet</option>
|
||||
<option value="start">Start</option>
|
||||
<option value="next">Next</option>
|
||||
<option value="prev">Prev</option>
|
||||
<option value="contents">Contents</option>
|
||||
<option value="index">Index</option>
|
||||
<option value="glossary">Glossary</option>
|
||||
<option value="copyright">Copyright</option>
|
||||
<option value="chapter">Chapter</option>
|
||||
<option value="subsection">Subsection</option>
|
||||
<option value="appendix">Appendix</option>
|
||||
<option value="help">Help</option>
|
||||
<option value="bookmark">Bookmark</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label id="tabindexlabel" for="tabindex">{#advlink_dlg.tabindex}</label></td>
|
||||
<td><input type="text" id="tabindex" name="tabindex" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label id="accesskeylabel" for="accesskey">{#advlink_dlg.accesskey}</label></td>
|
||||
<td><input type="text" id="accesskey" name="accesskey" value="" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div id="events_panel" class="panel">
|
||||
<fieldset>
|
||||
<legend>{#advlink_dlg.event_props}</legend>
|
||||
|
||||
<table border="0" cellpadding="0" cellspacing="4" role="presentation" >
|
||||
<tr>
|
||||
<td class="column1"><label for="onfocus">onfocus</label></td>
|
||||
<td><input id="onfocus" name="onfocus" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="onblur">onblur</label></td>
|
||||
<td><input id="onblur" name="onblur" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="onclick">onclick</label></td>
|
||||
<td><input id="onclick" name="onclick" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="ondblclick">ondblclick</label></td>
|
||||
<td><input id="ondblclick" name="ondblclick" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="onmousedown">onmousedown</label></td>
|
||||
<td><input id="onmousedown" name="onmousedown" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="onmouseup">onmouseup</label></td>
|
||||
<td><input id="onmouseup" name="onmouseup" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="onmouseover">onmouseover</label></td>
|
||||
<td><input id="onmouseover" name="onmouseover" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="onmousemove">onmousemove</label></td>
|
||||
<td><input id="onmousemove" name="onmousemove" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="onmouseout">onmouseout</label></td>
|
||||
<td><input id="onmouseout" name="onmouseout" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="onkeypress">onkeypress</label></td>
|
||||
<td><input id="onkeypress" name="onkeypress" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="onkeydown">onkeydown</label></td>
|
||||
<td><input id="onkeydown" name="onkeydown" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="onkeyup">onkeyup</label></td>
|
||||
<td><input id="onkeyup" name="onkeyup" type="text" value="" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<input type="submit" id="insert" name="insert" value="{#insert}" />
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
|
@ -1 +0,0 @@
|
|||
(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.AdvListPlugin",{init:function(b,c){var d=this;d.editor=b;function e(g){var f=[];a(g.split(/,/),function(h){f.push({title:"advlist."+(h=="default"?"def":h.replace(/-/g,"_")),styles:{listStyleType:h=="default"?"":h}})});return f}d.numlist=b.getParam("advlist_number_styles")||e("default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");d.bullist=b.getParam("advlist_bullet_styles")||e("default,circle,disc,square");if(tinymce.isIE&&/MSIE [2-7]/.test(navigator.userAgent)){d.isIE7=true}},createControl:function(d,b){var f=this,e,i,g=f.editor;if(d=="numlist"||d=="bullist"){if(f[d][0].title=="advlist.def"){i=f[d][0]}function c(j,l){var k=true;a(l.styles,function(n,m){if(g.dom.getStyle(j,m)!=n){k=false;return false}});return k}function h(){var k,l=g.dom,j=g.selection;k=l.getParent(j.getNode(),"ol,ul");if(!k||k.nodeName==(d=="bullist"?"OL":"UL")||c(k,i)){g.execCommand(d=="bullist"?"InsertUnorderedList":"InsertOrderedList")}if(i){k=l.getParent(j.getNode(),"ol,ul");if(k){l.setStyles(k,i.styles);k.removeAttribute("data-mce-style")}}g.focus()}e=b.createSplitButton(d,{title:"advanced."+d+"_desc","class":"mce_"+d,onclick:function(){h()}});e.onRenderMenu.add(function(j,k){k.onHideMenu.add(function(){if(f.bookmark){g.selection.moveToBookmark(f.bookmark);f.bookmark=0}});k.onShowMenu.add(function(){var n=g.dom,m=n.getParent(g.selection.getNode(),"ol,ul"),l;if(m||i){l=f[d];a(k.items,function(o){var p=true;o.setSelected(0);if(m&&!o.isDisabled()){a(l,function(q){if(q.id==o.id){if(!c(m,q)){p=false;return false}}});if(p){o.setSelected(1)}}});if(!m){k.items[i.id].setSelected(1)}}g.focus();if(tinymce.isIE){f.bookmark=g.selection.getBookmark(1)}});k.add({id:g.dom.uniqueId(),title:"advlist.types","class":"mceMenuItemTitle",titleItem:true}).setDisabled(1);a(f[d],function(l){if(f.isIE7&&l.styles.listStyleType=="lower-greek"){return}l.id=g.dom.uniqueId();k.add({id:l.id,title:l.title,onclick:function(){i=l;h()}})})});return e}},getInfo:function(){return{longname:"Advanced lists",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlist",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advlist",tinymce.plugins.AdvListPlugin)})();
|
|
@ -1,176 +0,0 @@
|
|||
/**
|
||||
* editor_plugin_src.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var each = tinymce.each;
|
||||
|
||||
tinymce.create('tinymce.plugins.AdvListPlugin', {
|
||||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
||||
t.editor = ed;
|
||||
|
||||
function buildFormats(str) {
|
||||
var formats = [];
|
||||
|
||||
each(str.split(/,/), function(type) {
|
||||
formats.push({
|
||||
title : 'advlist.' + (type == 'default' ? 'def' : type.replace(/-/g, '_')),
|
||||
styles : {
|
||||
listStyleType : type == 'default' ? '' : type
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return formats;
|
||||
};
|
||||
|
||||
// Setup number formats from config or default
|
||||
t.numlist = ed.getParam("advlist_number_styles") || buildFormats("default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");
|
||||
t.bullist = ed.getParam("advlist_bullet_styles") || buildFormats("default,circle,disc,square");
|
||||
|
||||
if (tinymce.isIE && /MSIE [2-7]/.test(navigator.userAgent))
|
||||
t.isIE7 = true;
|
||||
},
|
||||
|
||||
createControl: function(name, cm) {
|
||||
var t = this, btn, format, editor = t.editor;
|
||||
|
||||
if (name == 'numlist' || name == 'bullist') {
|
||||
// Default to first item if it's a default item
|
||||
if (t[name][0].title == 'advlist.def')
|
||||
format = t[name][0];
|
||||
|
||||
function hasFormat(node, format) {
|
||||
var state = true;
|
||||
|
||||
each(format.styles, function(value, name) {
|
||||
// Format doesn't match
|
||||
if (editor.dom.getStyle(node, name) != value) {
|
||||
state = false;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
return state;
|
||||
};
|
||||
|
||||
function applyListFormat() {
|
||||
var list, dom = editor.dom, sel = editor.selection;
|
||||
|
||||
// Check for existing list element
|
||||
list = dom.getParent(sel.getNode(), 'ol,ul');
|
||||
|
||||
// Switch/add list type if needed
|
||||
if (!list || list.nodeName == (name == 'bullist' ? 'OL' : 'UL') || hasFormat(list, format))
|
||||
editor.execCommand(name == 'bullist' ? 'InsertUnorderedList' : 'InsertOrderedList');
|
||||
|
||||
// Append styles to new list element
|
||||
if (format) {
|
||||
list = dom.getParent(sel.getNode(), 'ol,ul');
|
||||
if (list) {
|
||||
dom.setStyles(list, format.styles);
|
||||
list.removeAttribute('data-mce-style');
|
||||
}
|
||||
}
|
||||
|
||||
editor.focus();
|
||||
};
|
||||
|
||||
btn = cm.createSplitButton(name, {
|
||||
title : 'advanced.' + name + '_desc',
|
||||
'class' : 'mce_' + name,
|
||||
onclick : function() {
|
||||
applyListFormat();
|
||||
}
|
||||
});
|
||||
|
||||
btn.onRenderMenu.add(function(btn, menu) {
|
||||
menu.onHideMenu.add(function() {
|
||||
if (t.bookmark) {
|
||||
editor.selection.moveToBookmark(t.bookmark);
|
||||
t.bookmark = 0;
|
||||
}
|
||||
});
|
||||
|
||||
menu.onShowMenu.add(function() {
|
||||
var dom = editor.dom, list = dom.getParent(editor.selection.getNode(), 'ol,ul'), fmtList;
|
||||
|
||||
if (list || format) {
|
||||
fmtList = t[name];
|
||||
|
||||
// Unselect existing items
|
||||
each(menu.items, function(item) {
|
||||
var state = true;
|
||||
|
||||
item.setSelected(0);
|
||||
|
||||
if (list && !item.isDisabled()) {
|
||||
each(fmtList, function(fmt) {
|
||||
if (fmt.id == item.id) {
|
||||
if (!hasFormat(list, fmt)) {
|
||||
state = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (state)
|
||||
item.setSelected(1);
|
||||
}
|
||||
});
|
||||
|
||||
// Select the current format
|
||||
if (!list)
|
||||
menu.items[format.id].setSelected(1);
|
||||
}
|
||||
|
||||
editor.focus();
|
||||
|
||||
// IE looses it's selection so store it away and restore it later
|
||||
if (tinymce.isIE) {
|
||||
t.bookmark = editor.selection.getBookmark(1);
|
||||
}
|
||||
});
|
||||
|
||||
menu.add({id : editor.dom.uniqueId(), title : 'advlist.types', 'class' : 'mceMenuItemTitle', titleItem: true}).setDisabled(1);
|
||||
|
||||
each(t[name], function(item) {
|
||||
// IE<8 doesn't support lower-greek, skip it
|
||||
if (t.isIE7 && item.styles.listStyleType == 'lower-greek')
|
||||
return;
|
||||
|
||||
item.id = editor.dom.uniqueId();
|
||||
|
||||
menu.add({id : item.id, title : item.title, onclick : function() {
|
||||
format = item;
|
||||
applyListFormat();
|
||||
}});
|
||||
});
|
||||
});
|
||||
|
||||
return btn;
|
||||
}
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Advanced lists',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlist',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('advlist', tinymce.plugins.AdvListPlugin);
|
||||
})();
|
|
@ -1 +0,0 @@
|
|||
(function(){tinymce.create("tinymce.plugins.AutolinkPlugin",{init:function(a,b){var c=this;if(tinyMCE.isIE){return}a.onKeyDown.add(function(d,f){if(f.keyCode==13){return c.handleEnter(d)}});a.onKeyPress.add(function(d,f){if(f.which==41){return c.handleEclipse(d)}});a.onKeyUp.add(function(d,f){if(f.keyCode==32){return c.handleSpacebar(d)}})},handleEclipse:function(a){this.parseCurrentLine(a,-1,"(",true)},handleSpacebar:function(a){this.parseCurrentLine(a,0,"",true)},handleEnter:function(a){this.parseCurrentLine(a,-1,"",false)},parseCurrentLine:function(i,d,b,g){var a,f,c,n,k,m,h,e,j;a=i.selection.getRng().cloneRange();if(a.startOffset<5){e=a.endContainer.previousSibling;if(e==null){if(a.endContainer.firstChild==null||a.endContainer.firstChild.nextSibling==null){return}e=a.endContainer.firstChild.nextSibling}j=e.length;a.setStart(e,j);a.setEnd(e,j);if(a.endOffset<5){return}f=a.endOffset;n=e}else{n=a.endContainer;if(n.nodeType!=3&&n.firstChild){while(n.nodeType!=3&&n.firstChild){n=n.firstChild}a.setStart(n,0);a.setEnd(n,n.nodeValue.length)}if(a.endOffset==1){f=2}else{f=a.endOffset-1-d}}c=f;do{a.setStart(n,f-2);a.setEnd(n,f-1);f-=1}while(a.toString()!=" "&&a.toString()!=""&&a.toString().charCodeAt(0)!=160&&(f-2)>=0&&a.toString()!=b);if(a.toString()==b||a.toString().charCodeAt(0)==160){a.setStart(n,f);a.setEnd(n,c);f+=1}else{if(a.startOffset==0){a.setStart(n,0);a.setEnd(n,c)}else{a.setStart(n,f);a.setEnd(n,c)}}m=a.toString();h=m.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)(.+)$/i);if(h){if(h[1]=="www."){h[1]="http://www."}k=i.selection.getBookmark();i.selection.setRng(a);tinyMCE.execCommand("createlink",false,h[1]+h[2]);i.selection.moveToBookmark(k);if(tinyMCE.isWebKit){i.selection.collapse(false);var l=Math.min(n.length,c+1);a.setStart(n,l);a.setEnd(n,l);i.selection.setRng(a)}}},getInfo:function(){return{longname:"Autolink",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autolink",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("autolink",tinymce.plugins.AutolinkPlugin)})();
|
|
@ -1,172 +0,0 @@
|
|||
/**
|
||||
* editor_plugin_src.js
|
||||
*
|
||||
* Copyright 2011, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.AutolinkPlugin', {
|
||||
/**
|
||||
* Initializes the plugin, this will be executed after the plugin has been created.
|
||||
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
||||
* of the editor instance to intercept that event.
|
||||
*
|
||||
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
||||
* @param {string} url Absolute URL to where the plugin is located.
|
||||
*/
|
||||
|
||||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
||||
// Internet Explorer has built-in automatic linking
|
||||
if (tinyMCE.isIE)
|
||||
return;
|
||||
|
||||
// Add a key down handler
|
||||
ed.onKeyDown.add(function(ed, e) {
|
||||
if (e.keyCode == 13)
|
||||
return t.handleEnter(ed);
|
||||
});
|
||||
|
||||
ed.onKeyPress.add(function(ed, e) {
|
||||
if (e.which == 41)
|
||||
return t.handleEclipse(ed);
|
||||
});
|
||||
|
||||
// Add a key up handler
|
||||
ed.onKeyUp.add(function(ed, e) {
|
||||
if (e.keyCode == 32)
|
||||
return t.handleSpacebar(ed);
|
||||
});
|
||||
},
|
||||
|
||||
handleEclipse : function(ed) {
|
||||
this.parseCurrentLine(ed, -1, '(', true);
|
||||
},
|
||||
|
||||
handleSpacebar : function(ed) {
|
||||
this.parseCurrentLine(ed, 0, '', true);
|
||||
},
|
||||
|
||||
handleEnter : function(ed) {
|
||||
this.parseCurrentLine(ed, -1, '', false);
|
||||
},
|
||||
|
||||
parseCurrentLine : function(ed, end_offset, delimiter, goback) {
|
||||
var r, end, start, endContainer, bookmark, text, matches, prev, len;
|
||||
|
||||
// We need at least five characters to form a URL,
|
||||
// hence, at minimum, five characters from the beginning of the line.
|
||||
r = ed.selection.getRng().cloneRange();
|
||||
if (r.startOffset < 5) {
|
||||
// During testing, the caret is placed inbetween two text nodes.
|
||||
// The previous text node contains the URL.
|
||||
prev = r.endContainer.previousSibling;
|
||||
if (prev == null) {
|
||||
if (r.endContainer.firstChild == null || r.endContainer.firstChild.nextSibling == null)
|
||||
return;
|
||||
|
||||
prev = r.endContainer.firstChild.nextSibling;
|
||||
}
|
||||
len = prev.length;
|
||||
r.setStart(prev, len);
|
||||
r.setEnd(prev, len);
|
||||
|
||||
if (r.endOffset < 5)
|
||||
return;
|
||||
|
||||
end = r.endOffset;
|
||||
endContainer = prev;
|
||||
} else {
|
||||
endContainer = r.endContainer;
|
||||
|
||||
// Get a text node
|
||||
if (endContainer.nodeType != 3 && endContainer.firstChild) {
|
||||
while (endContainer.nodeType != 3 && endContainer.firstChild)
|
||||
endContainer = endContainer.firstChild;
|
||||
|
||||
r.setStart(endContainer, 0);
|
||||
r.setEnd(endContainer, endContainer.nodeValue.length);
|
||||
}
|
||||
|
||||
if (r.endOffset == 1)
|
||||
end = 2;
|
||||
else
|
||||
end = r.endOffset - 1 - end_offset;
|
||||
}
|
||||
|
||||
start = end;
|
||||
|
||||
do
|
||||
{
|
||||
// Move the selection one character backwards.
|
||||
r.setStart(endContainer, end - 2);
|
||||
r.setEnd(endContainer, end - 1);
|
||||
end -= 1;
|
||||
|
||||
// Loop until one of the following is found: a blank space, , delimeter, (end-2) >= 0
|
||||
} while (r.toString() != ' ' && r.toString() != '' && r.toString().charCodeAt(0) != 160 && (end -2) >= 0 && r.toString() != delimiter);
|
||||
|
||||
if (r.toString() == delimiter || r.toString().charCodeAt(0) == 160) {
|
||||
r.setStart(endContainer, end);
|
||||
r.setEnd(endContainer, start);
|
||||
end += 1;
|
||||
} else if (r.startOffset == 0) {
|
||||
r.setStart(endContainer, 0);
|
||||
r.setEnd(endContainer, start);
|
||||
}
|
||||
else {
|
||||
r.setStart(endContainer, end);
|
||||
r.setEnd(endContainer, start);
|
||||
}
|
||||
|
||||
text = r.toString();
|
||||
matches = text.match(/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)(.+)$/i);
|
||||
|
||||
if (matches) {
|
||||
if (matches[1] == 'www.') {
|
||||
matches[1] = 'http://www.';
|
||||
}
|
||||
|
||||
bookmark = ed.selection.getBookmark();
|
||||
|
||||
ed.selection.setRng(r);
|
||||
tinyMCE.execCommand('createlink',false, matches[1] + matches[2]);
|
||||
ed.selection.moveToBookmark(bookmark);
|
||||
|
||||
// TODO: Determine if this is still needed.
|
||||
if (tinyMCE.isWebKit) {
|
||||
// move the caret to its original position
|
||||
ed.selection.collapse(false);
|
||||
var max = Math.min(endContainer.length, start + 1);
|
||||
r.setStart(endContainer, max);
|
||||
r.setEnd(endContainer, max);
|
||||
ed.selection.setRng(r);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns information about the plugin as a name/value array.
|
||||
* The current keys are longname, author, authorurl, infourl and version.
|
||||
*
|
||||
* @return {Object} Name/value array containing information about the plugin.
|
||||
*/
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Autolink',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autolink',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('autolink', tinymce.plugins.AutolinkPlugin);
|
||||
})();
|
|
@ -1 +0,0 @@
|
|||
(function(){tinymce.create("tinymce.plugins.AutoResizePlugin",{init:function(a,c){var d=this,e=0;if(a.getParam("fullscreen_is_enabled")){return}function b(){var i=a.getDoc(),f=i.body,k=i.documentElement,h=tinymce.DOM,j=d.autoresize_min_height,g;g=tinymce.isIE?f.scrollHeight:i.body.offsetHeight;if(g>d.autoresize_min_height){j=g}if(d.autoresize_max_height&&g>d.autoresize_max_height){j=d.autoresize_max_height;a.getBody().style.overflowY="auto"}else{a.getBody().style.overflowY="hidden"}if(j!==e){h.setStyle(h.get(a.id+"_ifr"),"height",j+"px");e=j}if(d.throbbing){a.setProgressState(false);a.setProgressState(true)}}d.editor=a;d.autoresize_min_height=parseInt(a.getParam("autoresize_min_height",a.getElement().offsetHeight));d.autoresize_max_height=parseInt(a.getParam("autoresize_max_height",0));a.onInit.add(function(f){f.dom.setStyle(f.getBody(),"paddingBottom",f.getParam("autoresize_bottom_margin",50)+"px")});a.onChange.add(b);a.onSetContent.add(b);a.onPaste.add(b);a.onKeyUp.add(b);a.onPostRender.add(b);if(a.getParam("autoresize_on_init",true)){a.onInit.add(function(g,f){g.setProgressState(true);d.throbbing=true;g.getBody().style.overflowY="hidden"});a.onLoadContent.add(function(g,f){b();setTimeout(function(){b();g.setProgressState(false);d.throbbing=false},1250)})}a.addCommand("mceAutoResize",b)},getInfo:function(){return{longname:"Auto Resize",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autoresize",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("autoresize",tinymce.plugins.AutoResizePlugin)})();
|
|
@ -1,137 +0,0 @@
|
|||
/**
|
||||
* editor_plugin_src.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
(function() {
|
||||
/**
|
||||
* Auto Resize
|
||||
*
|
||||
* This plugin automatically resizes the content area to fit its content height.
|
||||
* It will retain a minimum height, which is the height of the content area when
|
||||
* it's initialized.
|
||||
*/
|
||||
tinymce.create('tinymce.plugins.AutoResizePlugin', {
|
||||
/**
|
||||
* Initializes the plugin, this will be executed after the plugin has been created.
|
||||
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
||||
* of the editor instance to intercept that event.
|
||||
*
|
||||
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
||||
* @param {string} url Absolute URL to where the plugin is located.
|
||||
*/
|
||||
init : function(ed, url) {
|
||||
var t = this, oldSize = 0;
|
||||
|
||||
if (ed.getParam('fullscreen_is_enabled'))
|
||||
return;
|
||||
|
||||
/**
|
||||
* This method gets executed each time the editor needs to resize.
|
||||
*/
|
||||
function resize() {
|
||||
var d = ed.getDoc(), b = d.body, de = d.documentElement, DOM = tinymce.DOM, resizeHeight = t.autoresize_min_height, myHeight;
|
||||
|
||||
// Get height differently depending on the browser used
|
||||
myHeight = tinymce.isIE ? b.scrollHeight : d.body.offsetHeight;
|
||||
|
||||
// Don't make it smaller than the minimum height
|
||||
if (myHeight > t.autoresize_min_height)
|
||||
resizeHeight = myHeight;
|
||||
|
||||
// If a maximum height has been defined don't exceed this height
|
||||
if (t.autoresize_max_height && myHeight > t.autoresize_max_height) {
|
||||
resizeHeight = t.autoresize_max_height;
|
||||
ed.getBody().style.overflowY = "auto";
|
||||
} else
|
||||
ed.getBody().style.overflowY = "hidden";
|
||||
|
||||
// Resize content element
|
||||
if (resizeHeight !== oldSize) {
|
||||
DOM.setStyle(DOM.get(ed.id + '_ifr'), 'height', resizeHeight + 'px');
|
||||
oldSize = resizeHeight;
|
||||
}
|
||||
|
||||
// if we're throbbing, we'll re-throb to match the new size
|
||||
if (t.throbbing) {
|
||||
ed.setProgressState(false);
|
||||
ed.setProgressState(true);
|
||||
}
|
||||
};
|
||||
|
||||
t.editor = ed;
|
||||
|
||||
// Define minimum height
|
||||
t.autoresize_min_height = parseInt( ed.getParam('autoresize_min_height', ed.getElement().offsetHeight) );
|
||||
|
||||
// Define maximum height
|
||||
t.autoresize_max_height = parseInt( ed.getParam('autoresize_max_height', 0) );
|
||||
|
||||
// Add padding at the bottom for better UX
|
||||
ed.onInit.add(function(ed){
|
||||
ed.dom.setStyle(ed.getBody(), 'paddingBottom', ed.getParam('autoresize_bottom_margin', 50) + 'px');
|
||||
});
|
||||
|
||||
// Add appropriate listeners for resizing content area
|
||||
ed.onChange.add(resize);
|
||||
ed.onSetContent.add(resize);
|
||||
ed.onPaste.add(resize);
|
||||
ed.onKeyUp.add(resize);
|
||||
ed.onPostRender.add(resize);
|
||||
|
||||
if (ed.getParam('autoresize_on_init', true)) {
|
||||
// Things to do when the editor is ready
|
||||
ed.onInit.add(function(ed, l) {
|
||||
// Show throbber until content area is resized properly
|
||||
ed.setProgressState(true);
|
||||
t.throbbing = true;
|
||||
|
||||
// Hide scrollbars
|
||||
ed.getBody().style.overflowY = "hidden";
|
||||
});
|
||||
|
||||
ed.onLoadContent.add(function(ed, l) {
|
||||
resize();
|
||||
|
||||
// Because the content area resizes when its content CSS loads,
|
||||
// and we can't easily add a listener to its onload event,
|
||||
// we'll just trigger a resize after a short loading period
|
||||
setTimeout(function() {
|
||||
resize();
|
||||
|
||||
// Disable throbber
|
||||
ed.setProgressState(false);
|
||||
t.throbbing = false;
|
||||
}, 1250);
|
||||
});
|
||||
}
|
||||
|
||||
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
||||
ed.addCommand('mceAutoResize', resize);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns information about the plugin as a name/value array.
|
||||
* The current keys are longname, author, authorurl, infourl and version.
|
||||
*
|
||||
* @return {Object} Name/value array containing information about the plugin.
|
||||
*/
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Auto Resize',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autoresize',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('autoresize', tinymce.plugins.AutoResizePlugin);
|
||||
})();
|
|
@ -1 +0,0 @@
|
|||
(function(e){var c="autosave",g="restoredraft",b=true,f,d,a=e.util.Dispatcher;e.create("tinymce.plugins.AutoSave",{init:function(i,j){var h=this,l=i.settings;h.editor=i;function k(n){var m={s:1000,m:60000};n=/^(\d+)([ms]?)$/.exec(""+n);return(n[2]?m[n[2]]:1)*parseInt(n)}e.each({ask_before_unload:b,interval:"30s",retention:"20m",minlength:50},function(n,m){m=c+"_"+m;if(l[m]===f){l[m]=n}});l.autosave_interval=k(l.autosave_interval);l.autosave_retention=k(l.autosave_retention);i.addButton(g,{title:c+".restore_content",onclick:function(){if(i.getContent({draft:true}).replace(/\s| |<\/?p[^>]*>|<br[^>]*>/gi,"").length>0){i.windowManager.confirm(c+".warning_message",function(m){if(m){h.restoreDraft()}})}else{h.restoreDraft()}}});i.onNodeChange.add(function(){var m=i.controlManager;if(m.get(g)){m.setDisabled(g,!h.hasDraft())}});i.onInit.add(function(){if(i.controlManager.get(g)){h.setupStorage(i);setInterval(function(){h.storeDraft();i.nodeChanged()},l.autosave_interval)}});h.onStoreDraft=new a(h);h.onRestoreDraft=new a(h);h.onRemoveDraft=new a(h);if(!d){window.onbeforeunload=e.plugins.AutoSave._beforeUnloadHandler;d=b}},getInfo:function(){return{longname:"Auto save",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave",version:e.majorVersion+"."+e.minorVersion}},getExpDate:function(){return new Date(new Date().getTime()+this.editor.settings.autosave_retention).toUTCString()},setupStorage:function(i){var h=this,k=c+"_test",j="OK";h.key=c+i.id;e.each([function(){if(localStorage){localStorage.setItem(k,j);if(localStorage.getItem(k)===j){localStorage.removeItem(k);return localStorage}}},function(){if(sessionStorage){sessionStorage.setItem(k,j);if(sessionStorage.getItem(k)===j){sessionStorage.removeItem(k);return sessionStorage}}},function(){if(e.isIE){i.getElement().style.behavior="url('#default#userData')";return{autoExpires:b,setItem:function(l,n){var m=i.getElement();m.setAttribute(l,n);m.expires=h.getExpDate();try{m.save("TinyMCE")}catch(o){}},getItem:function(l){var m=i.getElement();try{m.load("TinyMCE");return m.getAttribute(l)}catch(n){return null}},removeItem:function(l){i.getElement().removeAttribute(l)}}}},],function(l){try{h.storage=l();if(h.storage){return false}}catch(m){}})},storeDraft:function(){var i=this,l=i.storage,j=i.editor,h,k;if(l){if(!l.getItem(i.key)&&!j.isDirty()){return}k=j.getContent({draft:true});if(k.length>j.settings.autosave_minlength){h=i.getExpDate();if(!i.storage.autoExpires){i.storage.setItem(i.key+"_expires",h)}i.storage.setItem(i.key,k);i.onStoreDraft.dispatch(i,{expires:h,content:k})}}},restoreDraft:function(){var h=this,j=h.storage,i;if(j){i=j.getItem(h.key);if(i){h.editor.setContent(i);h.onRestoreDraft.dispatch(h,{content:i})}}},hasDraft:function(){var h=this,k=h.storage,i,j;if(k){j=!!k.getItem(h.key);if(j){if(!h.storage.autoExpires){i=new Date(k.getItem(h.key+"_expires"));if(new Date().getTime()<i.getTime()){return b}h.removeDraft()}else{return b}}}return false},removeDraft:function(){var h=this,k=h.storage,i=h.key,j;if(k){j=k.getItem(i);k.removeItem(i);k.removeItem(i+"_expires");if(j){h.onRemoveDraft.dispatch(h,{content:j})}}},"static":{_beforeUnloadHandler:function(h){var i;e.each(tinyMCE.editors,function(j){if(j.plugins.autosave){j.plugins.autosave.storeDraft()}if(j.getParam("fullscreen_is_enabled")){return}if(!i&&j.isDirty()&&j.getParam("autosave_ask_before_unload")){i=j.getLang("autosave.unload_msg")}});return i}}});e.PluginManager.add("autosave",e.plugins.AutoSave)})(tinymce);
|