Changeset 1007

Show
Ignore:
Timestamp:
11/27/07 07:52:14
Author:
piv
Message:

close todo item https://quintagroup.updatelog.com/projects/1298212/todos/list/2985465, custom meta tags functionality

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • qSEOptimizer/trunk/HISTORY.txt

    r988 r1007  
     11.2.0 
     2 
     3    * added custom meta tags functionality 
     4 
    151.1.0 
    26 
  • qSEOptimizer/trunk/skins/qSEOptimizer/qseo_properties_edit.cpy

    r954 r1007  
    77##bind subpath=traverse_subpath 
    88##title=Update SEO Properties 
    9 ##parameters=title=None,description=None,keywords=None,html_comment=None,robots=None,distribution=None,title_override=0,description_override=0,keywords_override=0,html_comment_override=0,robots_override=0,distribution_override=0 
     9##parameters=title=None,description=None,keywords=None,html_comment=None,robots=None,distribution=None,title_override=0,description_override=0,keywords_override=0,html_comment_override=0,robots_override=0,distribution_override=0,custommetatags=None 
    1010 
    1111def setProperty(context, property, value, type='string'): 
     
    1414    else: 
    1515        context.manage_addProperty(property, value, type) 
     16 
     17delete_list = [] 
     18 
     19# update custom meta tags 
     20property_prefix = 'qSEO_custom_' 
     21custom_existing = [] 
     22for property, value in context.propertyItems(): 
     23    if property.find(property_prefix) == 0 and len(property) > len(property_prefix): 
     24        custom_existing.append(property) 
     25 
     26custom_updated = [] 
     27for tag in custommetatags: 
     28    meta_name, meta_content = tag['meta_name'], tag['meta_content'] 
     29    if meta_name and meta_content: 
     30        setProperty(context, '%s%s' % (property_prefix, meta_name), meta_content) 
     31        custom_updated.append('%s%s' % (property_prefix, meta_name)) 
     32 
     33#add not updated custom metatags to delete list 
     34for tag in custom_existing: 
     35    if tag not in custom_updated: 
     36        delete_list.append(tag) 
    1637 
    1738setProperty(context, 'qSEO_title', title) 
     
    2243setProperty(context, 'qSEO_distribution', distribution) 
    2344 
    24 delete_list = [] 
    2545if not title_override:        delete_list.append('qSEO_title') 
    2646if not description_override:  delete_list.append('qSEO_description') 
  • qSEOptimizer/trunk/skins/qSEOptimizer/qseo_properties_edit_form.cpt

    r1004 r1007  
    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> 
    916  <metal:javascript_head fill-slot="javascript_head_slot"> 
    1017      <script type="text/javascript" 
     
    1522              tal:condition="python:exists('portal/checkkeywords.js')" 
    1623              tal:attributes="src string:$portal_url/checkkeywords.js"> 
     24      </script> 
     25      <script type="text/javascript" 
     26              tal:condition="python:exists('portal/custommetatags.js')" 
     27              tal:attributes="src string:$portal_url/custommetatags.js"> 
    1728      </script> 
    1829  </metal:javascript_head> 
     
    252263          </div> 
    253264 
     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 
     358          </div> 
     359 
    254360          <div class="formControls" 
    255361               tal:define="process_creation request/process_creation|nothing;" 
  • qSEOptimizer/trunk/version.txt

    r988 r1007  
    1 1.1.0 
     11.2.0