Changeset 755 in products


Ignore:
Timestamp:
Jan 15, 2007 4:46:55 PM (17 years ago)
Author:
piv
Message:

added word statistics support on seo properties form

Location:
qSEOptimizer/branches/js-statistics
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • qSEOptimizer/branches/js-statistics/Extensions/Install.py

    r184 r755  
    66from Products.CMFCore.DirectoryView import addDirectoryViews 
    77from Products.qSEOptimizer import qSEO_globals 
     8from Products.CMFCore.CMFCorePermissions import ManagePortal 
    89from OFS.ObjectManager import BadRequestException 
    910 
     11from Products.CMFPlone.migrations.migration_util import safeEditProperty 
    1012from Products.qSEOptimizer.config import * 
    11  
    12 try: 
    13     #for Plone-2.5 and higher 
    14     from Products.CMFCore.permissions import ManagePortal 
    15 except ImportError: 
    16     from Products.CMFCore.CMFCorePermissions import ManagePortal 
    1713 
    1814configlets = ({'id':'qSEOptimizer', 
     
    4440        out.write('Skipped adding %s property sheet to portal_properties\n' % PROPERTY_SHEET) 
    4541    sheet = getattr(portal_props, PROPERTY_SHEET) 
    46  
    47     if not sheet.hasProperty('stop_words'): 
    48         sheet._setProperty('stop_words', STOP_WORDS, 'lines') 
    49         out.write("Added 'stop_words' property field to %s property sheet\n" % PROPERTY_SHEET) 
    50  
    51     if not sheet.hasProperty('fields'): 
    52         sheet._setProperty('fields', FIELDS, 'lines') 
    53         out.write("Added 'fields' property field to %s property sheet\n" % PROPERTY_SHEET) 
    54  
    55     if not sheet.hasProperty('additional_keywords'): 
    56         sheet._setProperty('additional_keywords', [], 'lines') 
    57         out.write("Added 'additional_keywords' property field to %s property sheet\n" % PROPERTY_SHEET) 
    58  
    59     if not sheet.hasProperty('default_custom_metatags'): 
    60         sheet._setProperty('default_custom_metatags', DEFAULT_CUSTOM_METATAGS, 'lines') 
    61         out.write("Added 'default_custom_metatags' property field to %s property sheet\n" % PROPERTY_SHEET) 
     42    if not hasattr(sheet, 'stop_words'): 
     43        safeEditProperty(sheet, 'stop_words', STOP_WORDS, 'lines') 
     44        out.write('Added \'stop_words\' property field to %s property sheet\n' % PROPERTY_SHEET) 
     45    else: 
     46        out.write('Skipped adding \'stop_words\' property field to %s property sheet\n' % PROPERTY_SHEET) 
     47    if not hasattr(sheet, 'fields'): 
     48        safeEditProperty(sheet, 'fields', FIELDS, 'lines') 
     49        out.write('Added \'fields\' property field to %s property sheet\n' % PROPERTY_SHEET) 
     50    else: 
     51        out.write('Skipped adding \'fields\' property field to %s property sheet\n' % PROPERTY_SHEET) 
    6252 
    6353def setupSkin(self, out, layers): 
     
    9383        for l in original_path: 
    9484            if (l == layer) or (l.startswith(layer+'/')): 
    95                 continue 
     85                continue 
    9686            new_path.append(l) 
    9787        skinstool.addSkinSelection(skinName, ','.join(new_path)) 
     
    10494        if ptype.getId() in qSEO_TYPES: 
    10595            #add the action for viewing versioning 
    106             try: 
    107                 #for Plone-2.5 and higher 
    108                 acts = filter(lambda x: x.id == 'seo_properties', ptype.listActions()) 
    109                 action = acts and acts[0] or None 
    110             except AttributeError: 
    111                 action = ptype.getActionById('seo_properties', default=None ) 
    112  
     96            action = ptype.getActionById( 'seo_properties', default=None ) 
    11397            if action is None: 
    11498                out.write( '  Added SEO Properties tab for %s\n' % ptype.getId() ) 
    115                 ptype.addAction( 'seo_properties', 
    116                                  'SEO Properties', 
    117                                  'string:${object_url}/qseo_properties_edit_form', 
    118                                  '', 
    119                                  'Modify portal content', 
    120                                  'object', 
    121                                  visible=1 
     99                ptype.addAction( 'seo_properties' 
     100                               , 'SEO Properties' 
     101                               , 'string:${object_url}/qseo_properties_edit_form' 
     102                               , '' 
     103                               , 'Modify portal content' 
     104                               , 'object' 
     105                               , visible=1 
    122106                               ) 
    123107def removeActions(self): 
     
    127111        if ptype.getId() in qSEO_TYPES: 
    128112            #delet the action for viewing versioning 
    129             try: 
    130                 #for Plone-2.5 and higher 
    131                 acts = filter(lambda x: x.id == 'seo_properties', ptype.listActions()) 
    132                 action = acts and acts[0] or None 
    133             except AttributeError: 
    134                 action = ptype.getActionById('seo_properties', default=None ) 
     113            action = ptype.getActionById( 'seo_properties', default=None ) 
    135114            if action != None: 
    136115                acts = list(ptype.listActions()) 
     
    157136        out.write('found.\n') 
    158137        Layers.append('qSEOptimizer/%s' % plone_version) 
    159     elif str(plone_version) < "3": 
    160         out.write("not found.\nLimited functionality mode. Upgrade" 
    161                   "qSEOptimizer product or report to support@quintagroup.com" 
    162                   "if uprade not available.\n\n") 
     138    else: 
     139        out.write("""not found.\nLimited functionality mode. Upgrade qSEOptimizer product or report to support@quintagroup.com if uprade not available.\n\n""")  
    163140    out.write('Call setupSkin... \n') 
    164141    setupSkin(self, out, Layers) 
  • qSEOptimizer/branches/js-statistics/skins/qSEOptimizer/qseo_properties_edit_form.cpt

    r63 r755  
    77    <tal:border define="dummy python:request.set('enable_border',1)" /> 
    88  </metal:border> 
    9   <metal:style_head fill-slot="style_slot"> 
    10       <style type="text/css"> 
    11           tr.datagridwidget-empty-row { 
    12               display:none; 
    13           } 
    14       </style> 
    15   </metal:style_head> 
    169  <metal:javascript_head fill-slot="javascript_head_slot"> 
    1710      <script type="text/javascript" 
    1811              tal:condition="python:exists('portal/statistics.js')" 
    19               tal:attributes="src string:${here/absolute_url}/statistics.js"> 
    20       </script> 
    21       <script type="text/javascript" 
    22               tal:condition="python:exists('portal/checkkeywords.js')" 
    23               tal:attributes="src string:${here/absolute_url}/checkkeywords.js"> 
    24       </script> 
    25       <script type="text/javascript" 
    26               tal:condition="python:exists('portal/custommetatags.js')" 
    27               tal:attributes="src string:${here/absolute_url}/custommetatags.js"> 
     12              tal:attributes="src string:$portal_url/statistics.js"> 
    2813      </script> 
    2914  </metal:javascript_head> 
     
    7964 
    8065            <input type="text" 
    81                    id="seo_title" 
     66                   id="title" 
    8267                   name="title" 
    8368                   size="40" 
     
    115100            <textarea  
    116101                      type="text" 
    117                       id="seo_description" 
     102                      id="description" 
    118103                      name="description" 
    119104                      rows="5" 
     
    153138 
    154139            <textarea  
    155                       id="seo_keywords" 
     140                      id="keywords" 
    156141                      name="keywords:lines" 
    157142                      rows="11" 
     
    187172 
    188173            <textarea  
    189                       id="seo_html_comment" 
     174                      id="html_comment" 
    190175                      name="html_comment" 
    191176                      rows="5" 
     
    220205 
    221206            <input type="text" 
    222                    id="seo_robots" 
     207                   id="robots" 
    223208                   name="robots" 
    224209                   size="25" 
     
    253238 
    254239            <input type="text" 
    255                    id="seo_distribution" 
     240                   id="distribution" 
    256241                   name="distribution" 
    257242                   size="25" 
     
    261246                                   tabindex tabindex/next;" 
    262247                   /> 
    263           </div> 
    264  
    265           <div class="field" 
    266                tal:define="fieldName string:custommetatags;"> 
    267             <label i18n:translate="label_custom_metatags" for="custom_metatags"> 
    268               Custom Meta Tags 
    269             </label> 
    270  
    271             <div class="formHelp" i18n:translate="help_seo_custommetatags"> 
    272               Here you can manage your custom meta tags. 
    273             </div> 
    274  
    275             <table class="custom-metatags-table" 
    276                    id="datagridwidget-table-custommetatags" 
    277                    style="width: 100%" 
    278                    tal:define="columnNames python:['meta name', 'meta content']; 
    279                                columnIds   python:['meta_name', 'meta_content']; 
    280                                fielddata context/qSEO_CustomMetaTags|python:[];"> 
    281                 <thead> 
    282                     <tr> 
    283                         <th class="discreet" style="text-align: left" 
    284                             tal:repeat="columnName columnNames" 
    285                             tal:content="columnName" 
    286                             i18n:translate="">Column name</th> 
    287                         <th /> 
    288                         <th /> 
    289                     </tr> 
    290                 </thead> 
    291                 <tbody id="datagridwidget-tbody-custommetatags"> 
    292                     <tal:row-loop tal:repeat="row fielddata"> 
    293                         <tr id="datagridwidget-row"> 
    294                             <tal:vars define="fieldId string:${fieldName}_${repeat/row/number}"> 
    295                                 <td class="datagridwidget-cell" 
    296                                     tal:repeat="column columnIds"> 
    297                                     <tal:cell tal:define="cell_value python:row.get(column);"> 
    298                                         <input type="text" 
    299                                                id="columnId_fieldId" 
    300                                                value="" 
    301                                                name="fieldId.columnId:records" 
    302                                                style="width: 100%;" 
    303                                                tal:attributes="name string:${fieldName}.${column}:records; 
    304                                                                id string:${column}_${fieldId}; 
    305                                                                value cell_value"/> 
    306                                     </tal:cell> 
    307                                 </td> 
    308                                 <td  class="datagridwidget-manipulator"> 
    309                                     <img alt="Delete row" 
    310                                          onclick="customMetaTagsFunctions.removeFieldRow(this);return false" 
    311                                          tal:attributes="src string:${portal_url}/delete_icon.gif;" /> 
    312                                 </td> 
    313                                 <td class="datagridwidget-hidden-data"> 
    314                                     <input type="hidden" 
    315                                            tal:attributes="name string:${fieldName}.orderindex_:records; 
    316                                                            id string:orderindex__${fieldId}; 
    317                                                            value repeat/row/number;" /> 
    318                                 </td> 
    319                             </tal:vars> 
    320                         </tr> 
    321                     </tal:row-loop> 
    322                     <tr id="datagridwidget-empty-row" 
    323                         class="datagridwidget-empty-row" 
    324                         tal:define="fieldId string:${fieldName}_new"> 
    325                         <td class="datagridwidget-cell" 
    326                             tal:repeat="column columnIds"> 
    327                             <span> 
    328                                 <input type="text" 
    329                                        id="columnId_fieldName_new" 
    330                                        value="" 
    331                                        name="fieldName.columnId:records" 
    332                                        style="width: 100%;" 
    333                                        tal:attributes="id string:${column}_${fieldName}_new; 
    334                                                        name string:${fieldName}.${column}:records;" /> 
    335                            </span> 
    336                         </td> 
    337                         <td  class="datagridwidget-manipulator"> 
    338                             <img alt="Delete row" 
    339                                  onclick="customMetaTagsFunctions.removeFieldRow(this);return false" 
    340                                  tal:attributes="src string:${portal_url}/delete_icon.gif;" /> 
    341                         </td> 
    342                         <td class="datagridwidget-hidden-data"> 
    343                             <input type="hidden" 
    344                                    value="template_row_marker" 
    345                                    tal:attributes="name string:${fieldName}.orderindex_:records; 
    346                                                   id string:orderindex__${fieldId};" /> 
    347                         </td> 
    348                     </tr> 
    349                 </tbody> 
    350             </table> 
    351  
    352             <input type="button" 
    353                    class="datagridwidget-add-button" 
    354                    id="datagridwidget-add-button" 
    355                    value="Add new row" 
    356                    tal:attributes="onclick string:customMetaTagsFunctions.addRow('${fieldName}')" /> 
    357  
    358248          </div> 
    359249 
  • qSEOptimizer/branches/js-statistics/version.txt

    r614 r755  
    1 1.6.1 
     10.4.1-stats 
Note: See TracChangeset for help on using the changeset viewer.