예제 #1
0
파일: E3HTML.py 프로젝트: CoachCoen/ECL
def SearchNode(objItem, strSearchText):
    """Return True if strSearchText is found in objItem
        Note: objItem may have a special function that returns its content"""
    if 'PageContents' in objItem.objectIds():
        varContents = objItem.PageContents.__call__(objItem)
        strContents = ToUnicode(varContents)
        if strSearchText.lower() in strContents.lower():
            return (True, objItem.title, OneMapItem(objItem))
    return (False, '', '')
예제 #2
0
파일: libForms.py 프로젝트: CoachCoen/ECL
def BuildRichTextAreaControl(dictElement, dictData, blnFieldsActive):
#    strLabel = BuildLabel(dictElement['Label'])
    strLabel = dictElement["Label"]
    strName = dictElement['Name']
    strValue = ""
    if dictData:
        if strName in dictData.keys():
            strValue = dictData[strName]
    if dictElement.has_key('Comments'):
        strComments = dictElement['Comments']
        strComments = """<br><label>&nbsp;</label>%s""" % strComments
    else:
        strComments = ""

    if dictElement.has_key("Width"):
        strWidth = "rte1.width=%s;" % dictElement["Width"]
    else:
        strWidth = ""

    if dictElement.has_key("Height"):
        strHeight = "rte1.height=%s;" % dictElement["Height"]
    else:
        strHeight = ""

    if not blnFieldsActive:
        strReadOnly = "rte1.readOnly = true"
    else:
        strReadOnly = ""

#    print "0:", strValue
    strValue = ToUnicode(strValue)

#    print "1:", strValue
    strValue = strValue.replace("\n", " \n")
    strValue = re.escape(strValue)
#    print "2:", strValue
#    strValue = strValue.encode('ascii', 'xmlcharrefreplace')
#    print "3:", strValue
    strValue = encode_for_xml(strValue)
#    print "4:", strValue

    return """
<p>%s</p>
<script language="JavaScript" type="text/javascript">

//Usage: initRTE(imagesPath, includesPath, cssFile, genXHTML, encHTML)
initRTE("/images/RTE/", "/js/", "", false);
//-->
</script>
<noscript><p><b>Javascript must be enabled to use this form.</b></p></noscript>

<script language="JavaScript" type="text/javascript">
<!--
//build new richTextEditor
var rte1 = new richTextEditor('%s');
// rte1.html = unescape('');
rte1.html = '%s';

//enable all commands for demo
rte1.cmdFormatBlock = true;
rte1.cmdFontName = true;
rte1.cmdFontSize = true;
rte1.cmdIncreaseFontSize = true;
rte1.cmdDecreaseFontSize = true;

rte1.cmdBold = true;
rte1.cmdItalic = true;
rte1.cmdUnderline = true;
rte1.cmdStrikethrough = true;
rte1.cmdSuperscript = true;
rte1.cmdSubscript = true;

rte1.cmdJustifyLeft = true;
rte1.cmdJustifyCenter = true;
rte1.cmdJustifyRight = true;
rte1.cmdJustifyFull = true;

rte1.cmdInsertHorizontalRule = true;
rte1.cmdInsertOrderedList = true;
rte1.cmdInsertUnorderedList = true;

rte1.cmdOutdent = true;
rte1.cmdIndent = true;
rte1.cmdForeColor = true;
rte1.cmdHiliteColor = true;
rte1.cmdInsertLink = true;
rte1.cmdInsertImage = true;
rte1.cmdInsertSpecialChars = true;
rte1.cmdInsertTable = true;
rte1.cmdSpellcheck = true;

rte1.cmdCut = true;
rte1.cmdCopy = true;
rte1.cmdPaste = true;
rte1.cmdUndo = true;
rte1.cmdRedo = true;
rte1.cmdRemoveFormat = true;
rte1.cmdUnlink = true;

rte1.toggleSrc = false;
%s
%s
%s
rte1.build();
//-->
</script>

%s""" % (strLabel, strName, strValue, strWidth, strHeight, strReadOnly, strComments)