Changeset 1833


Ignore:
Timestamp:
06/09/07 22:29:10 (12 years ago)
Author:
jukka
Message:

Closed #1423, spent 5h. Adds field 'score' to every resource type. If you have lemill.net's Data.fs it is better to do archetype's update schema on resource type at a time. Didn't work for me if tried to do all at once. After archetype update it is better to reindex catalog and restart zope, as it has probably reserved huge amounts of memory.

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Activity.py

    r1432 r1833  
    2828from Tool import homepage 
    2929 
    30 schema = BaseSchema + bodytext + coverImage + tags + no_description + homepage + author_schema + language_schema + license_schema + lemill_metadata_mods + deletionReason + translation_schema + latest_edit_schema + Schema(( 
     30schema = BaseSchema + bodytext + coverImage + tags + no_description + homepage + author_schema + language_schema + license_schema + lemill_metadata_mods + deletionReason + translation_schema + latest_edit_schema + score + Schema(( 
    3131 
    3232    FileField('video', 
  • trunk/BlogPost.py

    r1802 r1833  
    2727from config import PROJECTNAME, MODIFY_CONTENT, VIEW 
    2828from Resources import CommonMixIn 
    29 from SharedMetadata import bodytext, bodytext_simple, tags, coverImage, latest_edit_schema 
     29from SharedMetadata import bodytext, bodytext_simple, tags, coverImage, latest_edit_schema, score 
    3030from Products.Archetypes.atapi import DisplayList 
    3131from FieldsWidgets import TagsField, TagsWidget, LeStringWidget 
     
    3737# Same thing as with MemberFolder but easier: MemberBlogs contain the values of groups itself in indexable storage. 
    3838 
    39 schema = BaseSchema + bodytext_simple + coverImage + latest_edit_schema + Schema(( 
     39schema = BaseSchema + bodytext_simple + coverImage + latest_edit_schema + score + Schema(( 
    4040    StringField( 
    4141        name='title', 
  • trunk/Collection.py

    r1679 r1833  
    2727from Products.CMFCore.utils import getToolByName 
    2828from AccessControl import ClassSecurityInfo, Unauthorized 
     29from SharedMetadata import score 
    2930 
    3031from config import PROJECTNAME, ALL_CONTENT_TYPES, CONTENT_TYPES, DEFAULT_ICONS, ACTIVITY_TYPES, TOOLS_TYPES 
     
    3738from urllib2 import urlopen, HTTPError 
    3839 
    39 schema = BaseSchema + Schema(( 
     40schema = BaseSchema + score + Schema(( 
    4041 
    4142    StringField('description', 
  • trunk/GroupBlog.py

    r1803 r1833  
    4545# Same thing as with MemberFolder but easier: MemberBlogs contain the values of groups itself in indexable storage. 
    4646 
    47 schema = BaseFolderSchema + description + tags + coverImage + deletionReason + Schema(( 
     47schema = BaseFolderSchema + description + tags + coverImage + deletionReason + score+ Schema(( 
    4848    StringField('title', 
    4949        default_method='prefill_title', 
     
    8484            visible = {'view':'invisible', 'edit':'invisible'}, 
    8585            ), 
    86         ), 
    87  
    88     IntegerField('activity_score', 
    89         index = 'FieldIndex:schema', 
    90         default = 0, 
    91         widget = IntegerWidget( 
    92                  visible = {'view':'invisible', 'edit':'invisible'}, 
    93              ), 
    9486        ), 
    9587 
  • trunk/LeMillReference.py

    r1753 r1833  
    132132 
    133133# removed target_group_schema and lrt for LeMill 1.1. They're still up there if needed. 
    134 schema = BaseSchema + author + language_schema + location + tags + bodytext + coverImage + subject_area_schema + target_group_schema + licenses + latest_edit_schema + deletionReason 
     134schema = BaseSchema + author + language_schema + location + tags + bodytext + coverImage + subject_area_schema + target_group_schema + licenses + latest_edit_schema + deletionReason + score 
    135135 
    136136schema = schema.copy() 
  • trunk/MemberFolder.py

    r1814 r1833  
    2727from AccessControl import ClassSecurityInfo, Unauthorized 
    2828from config import * 
    29 from SharedMetadata import coverImage 
     29from SharedMetadata import coverImage, score 
    3030from permissions import MODIFY_CONTENT 
    3131from Products.PloneLanguageTool.availablelanguages import countries 
     
    5151# if it is plausible that just this field is searched somewhere, then field can have its own index. Otherwise it should be just 'searchable=True'. Those are all kept in one big text index. 
    5252 
    53 schema = BaseFolderSchema + Schema(( 
     53schema = BaseFolderSchema +coverImage + score + Schema(( 
    5454    StringField('title', 
    5555        mode ='r', 
     
    223223            visible = {'view':'invisible', 'edit':'invisible'}, 
    224224            ), 
    225         ), 
    226  
    227     IntegerField('activity_score', 
    228         index = 'FieldIndex:schema', 
    229         default = 0, 
    230         widget = IntegerWidget( 
    231                  visible = {'view':'invisible', 'edit':'invisible'}, 
    232              ), 
    233225        ), 
    234226 
     
    270262        ), 
    271263 
    272 ))+coverImage 
     264)) 
    273265 
    274266# This lists the fields that also exist in 
  • trunk/MultimediaMaterial.py

    r1804 r1833  
    4747))  
    4848 
    49 schema = schema + tags + language_schema + group_sharing + subject_area_schema + target_group_schema + license_schema + coverImage + lemill_metadata_mods + no_description + author_schema + deletionReason + version_schema + translation_schema + ieee_lom_lre_ap + latest_edit_schema 
     49schema = schema + tags + language_schema + group_sharing + subject_area_schema + target_group_schema + license_schema + coverImage + lemill_metadata_mods + no_description + author_schema + deletionReason + version_schema + translation_schema + ieee_lom_lre_ap + latest_edit_schema + score 
    5050 
    5151schema = schema.copy() 
  • trunk/PILOTMaterial.py

    r1432 r1833  
    7878)) 
    7979 
    80 schema = BaseSchema + short_description + full_description + tags + group_sharing + coverImage + lemill_metadata_mods + language_schema + license_schema + author_schema + subject_area_schema + target_group_schema + deletionReason + version_schema + translation_schema + bodyText + ieee_lom_lre_ap + latest_edit_schema 
     80schema = BaseSchema + short_description + full_description + tags + group_sharing + coverImage + lemill_metadata_mods + language_schema + license_schema + author_schema + subject_area_schema + target_group_schema + deletionReason + version_schema + translation_schema + bodyText + ieee_lom_lre_ap + latest_edit_schema + score 
    8181 
    8282schema = schema.copy() 
  • trunk/Piece.py

    r1762 r1833  
    3333    pass 
    3434 
    35 schema = BaseSchema + description + tags + author_schema + original_author_schema + piece_license_schema + coverImage + contentFile + sourceFile + lemill_metadata_mods + deletionReason + latest_edit_schema 
     35schema = BaseSchema + description + tags + author_schema + original_author_schema + piece_license_schema + coverImage + contentFile + sourceFile + lemill_metadata_mods + deletionReason + latest_edit_schema + score 
    3636 
    3737schema = schema + Schema(( 
  • trunk/PresentationMaterial.py

    r1658 r1833  
    7171)) 
    7272 
    73 schema = BaseSchema + tags + group_sharing + audioFile + bodyText + coverImage + lemill_metadata_mods + description + language_schema + license_schema + author_schema + subject_area_schema + target_group_schema + deletionReason + version_schema + translation_schema + ieee_lom_lre_ap + latest_edit_schema 
     73schema = BaseSchema + tags + group_sharing + audioFile + bodyText + coverImage + lemill_metadata_mods + description + language_schema + license_schema + author_schema + subject_area_schema + target_group_schema + deletionReason + version_schema + translation_schema + ieee_lom_lre_ap + latest_edit_schema + score 
    7474 
    7575schema = schema.copy() 
  • trunk/Resources.py

    r1832 r1833  
    129129        else: 
    130130            return '[%s] %s' % (self.portal_type, self.title_or_id())         
     131 
     132    def recalculateScore(self): 
     133        """ fallback method if resource doesn't have this method implemented, do nothing """ 
     134        pass 
    131135 
    132136InitializeClass(CommonMixIn) 
     
    217221        self.post_edit_credit_author() 
    218222        self.recalculateAuthors() 
    219  
     223        self.recalculateScore() 
     224        self.reindexObject() 
    220225 
    221226 
  • trunk/SharedMetadata.py

    r1759 r1833  
    510510)) 
    511511 
     512 
     513score = Schema(( 
     514    IntegerField('score', 
     515        index = 'FieldIndex:schema', 
     516        default = 1, 
     517        widget = IntegerWidget( 
     518                 visible = {'view':'invisible', 'edit':'invisible'}, 
     519             ), 
     520        ), 
     521)) 
  • trunk/Tool.py

    r1432 r1833  
    2121from Products.Archetypes.public import LinesWidget, TextAreaWidget, IdWidget, StringWidget, SelectionWidget, RichWidget 
    2222from Products.Archetypes.public import BaseContent, registerType 
    23 from SharedMetadata import bodytext, language_schema, tags, coverImage, lemill_metadata_mods, no_description, author_schema, license_schema, deletionReason, translation_schema, latest_edit_schema 
     23from SharedMetadata import bodytext, language_schema, tags, coverImage, lemill_metadata_mods, no_description, author_schema, license_schema, deletionReason, translation_schema, latest_edit_schema, score 
    2424from FieldsWidgets import TagsField, HTMLLinkWidget 
    2525from Globals import InitializeClass 
     
    4444)) 
    4545 
    46 schema = BaseSchema + bodytext + coverImage + tags + no_description + author_schema + homepage + language_schema + lemill_metadata_mods + license_schema + deletionReason + translation_schema + latest_edit_schema 
     46schema = BaseSchema + bodytext + coverImage + tags + no_description + author_schema + homepage + language_schema + lemill_metadata_mods + license_schema + deletionReason + translation_schema + latest_edit_schema + score 
    4747 
    4848# ALWAYS schema.copy before making changes to fields. 
  • trunk/skins/lemill/portlet_material_actions.pt

    r1831 r1833  
    9595    <ul> 
    9696        <li tal:condition="python: not isAnon"><a href="" tal:attributes="href python:'%s/translate_resource' % here_url"><tal:block i18n:translate="label_translate">Translate</tal:block>...</a></li> 
    97         <tal:notAnons condition="python: translations">  
     97        <tal:notAnons condition="translations">  
    9898            <tal:trans repeat="rr translations"> 
    9999             <tal:defs tal:define="tlang python:rr.Language()"> 
Note: See TracChangeset for help on using the changeset viewer.