Conjunto de mudanças 809 no repositório publico


Ignorar:
Timestamp:
03/10/2005 16:51:52 (14 anos atrás)
Autor:
ciciliati
Mensagem:

Versão 1.0: Alterados os meta-types das classes!!!
Esta versão foi desenvolvida com base na versão 0.0.2.
Faltam, portanto, as implementações da v. 0.0.3.
Fazer um diff(v002,v003) e aplicar sobre a v100.

Localização:
SDE/trunk
Arquivos:
7 editados

Legenda:

Não Modificado
Adicionado
Removido
  • SDE/trunk/StrDoc.py

    r806 r809  
    4141    return instance
    4242
    43 #class StrDoc(OrderedFolder,CatalogAware,ObjectManager,PropertyManager):
    44 class StrDoc(OrderedFolder,CatalogAware):
     43class StrDoc(OrderedFolder,CatalogAware,ObjectManager,PropertyManager):
    4544    "Classe de documentos estruturados"
    46     meta_type = 'StructuredDocument'
     45    meta_type = 'SDE-Document'
    4746    filtered_meta_types = []
    4847
     
    6564        newElem = self.manage_addProduct['StructuredDoc'].StrDocElem_add(request)
    6665        return newElem.id
    67 
    68     def addChildFromClipboard (self,ch_position='',obj=''):
    69 
    70         request = self.REQUEST
    71         session = request.SESSION
    72        
    73         if session.has_key('SDE_clip_key'):
    74             if session['SDE_clip_key']:
    75                 if obj:
    76                     self=obj
    77                 clip_type = session['SDE_clip_type']     
    78                 self.manage_pasteObjects(session['SDE_clip_key'])
    79                 session['SDE_clip_type'] = ''
    80                 session['SDE_clip_key'] = ''
    81                 session['SDE_clip_object_type'] = ''
    82                 #if clip_type == 'CUT':
    83                 #    pass   
    84                 #elif clip_type == 'COPY':
    85                 #    pass
    86                 #    # No caso de cópia: recriar IDs, verificar se objetos-filho são diferentes
    87                 #    #self.setNewIdForChildren(recursive=1,obj=self)
    88 
    89         return
    9066
    9167    # *** checksum
     
    10682        else:
    10783            crc = 0L
    108         if (self.meta_type == 'StrDocElement'):
     84        if (self.meta_type == 'SDE-Document-Element'):
    10985            crc = crc + crc32(self.id + self.text)
    11086        return crc
     
    145121            self = obj
    146122        result = []
    147         for x in self.objectValues('StrDocElement'):
     123        for x in self.objectValues('SDE-Document-Element'):
    148124            if (not type) or (x.type == type):
    149125                result.append(x)
     
    169145        printed+= "       xmlns:%s=\"/XSD/%s\"" % (pref, self.type)
    170146        printed+= "       xsi:noNamespaceSchemaLocation=\"/XSD/%s.xsd\">" % self.type
    171         for x in (self.objectValues("StrDocElement")):
     147        for x in (self.objectValues("SDE-Document-Element")):
    172148            printed+= x.renderXML("   ")
    173149        printed+= "</%s:%s>" % (pref,tag)
     
    180156        request = self.REQUEST
    181157        RESPONSE = request.RESPONSE
    182         tpt = self.definitionElement(obj=self).objectValues(['StrDocElementDefinition','StrDocElemDefLink'])
    183         doc = self.objectValues('StrDocElement')
     158        tpt = self.definitionElement(obj=self).objectValues(['SDE-Template-Element','SDE-Template-Link'])
     159        doc = self.objectValues('SDE-Document-Element')
    184160        exc = []
    185         if ((len(doc) == 0) and (self.meta_type == 'StructuredDocument')):
     161        if ((len(doc) == 0) and (self.meta_type == 'SDE-Document')):
    186162            exc.append ("Documento Inválido: Está Vazio.")
    187163        if (len(exc) == 0):
     
    405381        """ Renderiza o documento em XML, em estrutura especial para edição.
    406382        'action'   parameters             description
    407         EDIT       p_id                   renders the sd_element which has (id=p_id) with the attribute editing='yes'
     383        EDIT       p_id                   renders the sd_element whose id=p_id with the attribute editing='yes'
    408384        MOVE_UP    p_path, p_id           move one position up the element identified by p_id located at p_path
    409385        MOVE_DOWN  p_path, p_id           move one position down the element identified by p_id located at p_path
     
    413389                                          in REQUEST object there shall be a form called 'form_edit' containing
    414390                                          a object (textarea) called 'txa_text' and several objects (text) named
    415                                           tat_??????, where ?????? is an attribute name (sde_attr)
    416         CUT        p_path, p_id           mark as 'cut' the element identified by p_id located at p_path and put it and its subtree in the clipboard
    417         COPY       p_path, p_id           put a copy of the referred element and its subtree in the clipboard
    418         PASTE      p_path, p_pos          put the contents of the clipboard under the element p_path """
    419        
     391                                          tat_??????, where ?????? is an attribute name (sde_attr) """
    420392        request = self.REQUEST
    421393        response = request.RESPONSE
     
    444416            e = self.restrictedTraverse(p_path + p_id)
    445417            e.move_down()
    446         elif (action in ['CUT','COPY']):
    447             e = self.restrictedTraverse(p_path + p_id)
    448             e.add_to_clipboard(action,request)
    449         elif (action == 'PASTE'):
    450             e = self.restrictedTraverse(p_path)
    451             e.addChildFromClipboard(int(p_pos),obj=e)
    452418        if (action == 'EDIT'):
    453419            id_edit = p_id
  • SDE/trunk/StrDocAttrDef.py

    r802 r809  
    3535class StrDocAttrDef(CatalogAware,PropertyManager,ObjectManager):
    3636    "Classe de definição de atributos de documentos estruturados"
    37     meta_type="StrDocAttrDef"
     37    meta_type="SDE-Template-Attribute"
    3838    def __init__(self,REQUEST):
    3939        self.lista_xsd_type=('anySimpleType','anyURI','base64Binary','boolean','byte','date','dateTime',
  • SDE/trunk/StrDocDef.py

    r802 r809  
    4141    #   return instance
    4242
     43# ------------------------------------------------------------------------------
     44# CLASS DEFINITION
     45# ------------------------------------------------------------------------------
    4346class StrDocDef(OrderedFolder,CatalogAware,ObjectManager,PropertyManager):
    4447    "Classe de definição (modelo) de documentos estruturados"
    45     meta_type = 'StructuredDocumentDefinition'
     48    meta_type = 'SDE-Template'
    4649    filtered_meta_types = []
    47     __tEmPtYPe = {'product': 'StructuredDoc', 'name': 'StrDocElementDefinition', 'permission': 'Add StrDocElementDefinitions', 'interfaces': [], 'visibility': 'Global', 'instance': None, 'action': 'manage_addProduct/StructuredDoc/StrDocElemDef_addForm', 'container_filter': None}
     50    __tEmPtYPe = {'product': 'StructuredDoc', 'name': 'SDE-Template-Element', 'permission': 'Add StrDocElementDefinitions', 'interfaces': [], 'visibility': 'Global', 'instance': None, 'action': 'manage_addProduct/StructuredDoc/StrDocElemDef_addForm', 'container_filter': None}
    4851    filtered_meta_types.append(__tEmPtYPe)
    49 
     52    __tEmPtYPe = {'product': 'StructuredDoc', 'name': 'SDE-Template-Link', 'permission': 'Add StrDocElemDefLinks', 'interfaces': [], 'visibility': 'Global', 'instance': None, 'action': 'manage_addProduct/StructuredDoc/StrDocElemDefLink_addForm', 'container_filter': None}
     53    filtered_meta_types.append(__tEmPtYPe)
    5054
    5155    def __init__(self,REQUEST):
     
    5660        self._setProperty("default_xslt_for_editor",'')
    5761
     62# ------------------------------------------------------------------------------
     63# PRIVATE METHODS
     64# ------------------------------------------------------------------------------
    5865    # *** getDefElement
    5966    def getDefElement(self,subtree,obj=''):
     
    6572            child_id = subtree.pop(0)
    6673            child = self.restrictedTraverse(child_id)
    67             if child.meta_type == "StrDocElemDefLink":
     74            if child.meta_type == "SDE-Template-Link":
    6875                child = child.restrictedTraverse(child.link_to)
    6976            return child.getDefElement(subtree=subtree,obj=child)
     
    7582        chd=[]
    7683        pos=0
    77         for x in self.objectValues(['StrDocElementDefinition','StrDocElemDefLink']):
     84        for x in self.objectValues(['SDE-Template-Element','SDE-Template-Link']):
    7885            elm=[]
    7986            elm.append (x.id)
     
    8794        return chd
    8895
    89     # *** renderXSD   ACHO QUE NÃO DEVE MAIS SER UTLIZADA.
     96    # *** xmlTag
     97    def xmlTag(self):
     98        if self.xml_tag == "":
     99            return string.lower(self.id)
     100        else:
     101            return self.xml_tag
     102
     103# ------------------------------------------------------------------------------
     104# PUBLIC METHODS
     105# ------------------------------------------------------------------------------
     106    # *** renderXSD
    90107    def renderXSD(self,indent=""):
    91         group_open = -1
    92         tag = self.xmlTag()
    93         shift = "   "
    94         printed=""
    95         printed+= "%s<?xml version=\"1.0\" ?>" % indent
    96         printed+= "%s<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"" % indent
    97         printed+= "%s           targetNamespace=\"http://servidor1.interlegis.gov.br/XSD/%s\"" % (indent,self.id)  # A URL DO SERVIDOR DEVERIA SER PARAMETRIZADA!!!
    98         printed+= "%s           xmlns=\"http://servidor1.interlegis.gov.br/XSD/%s\"" % (indent,self.id)
    99         printed+= "%s           elementFormDefault=\"qualified\">" % indent
    100         printed+= "%s   <xs:element name=\"%s\">" % (indent,tag)
    101         printed+= "%s      <xs:complexType>" % indent
    102         printed+= "%s         <xs:sequence>" % indent
    103 
    104         subtree = self.objectValues(["StrDocElementDefinition","StrDocElemDefLink"])
    105         if len(subtree) > 0:
    106             for x in subtree:
    107                 if x.exclusivity_group != group_open:
    108                     if group_open != -1:
    109                         printed+= "%s            </xs:choice>" % indent
    110                     printed+= "%s            <xs:choice>" % indent
    111                     group_open = x.exclusivity_group
    112                     shift = shift + shift
    113                 printed+= x.renderXSD(indent + "         " + shift)
    114             if group_open != -1:
    115                 printed+= "%s            </xs:choice>" % indent
    116                 group_open = -1
    117         printed+= "%s         </xs:sequence>" % indent
    118         printed+= "%s      </xs:complexType>" % indent
    119         printed+= "%s   </xs:element>" % indent
    120         printed+= "%s</xs:schema>" % indent
    121         return printed
    122 
    123     # *** renderXSDv
    124     def renderXSDv(self,indent=""):
     108        """ renderXSD - Returns a XML-Schema file representing the Template """
    125109        tag = self.xmlTag()
    126110        group_open = -1
     
    136120        printed+= "%s         <xs:sequence>\n" % indent
    137121
    138         subtree = self.objectValues(["StrDocElementDefinition","StrDocElemDefLink"])
     122        subtree = self.objectValues(["SDE-Template-Element","SDE-Template-Link"])
    139123
    140124        if len(subtree) > 0:
     
    166150        printed+= "%s   </xs:element>\n" % indent
    167151
    168         subtree = self.objectValues("StrDocElementDefinition")
     152        subtree = self.objectValues("SDE-Template-Element")
    169153        for x in subtree:
    170             printed+= x.renderXSDv(indent+"   ")
     154            printed+= x.renderXSD(indent+"   ")
    171155        printed+= "%s</xs:schema>\n" % indent
    172156        self.REQUEST.RESPONSE.setHeader('Content-type', 'text/xml')
    173157        return printed
    174 
    175     # *** xmlTag
    176     def xmlTag(self):
    177         if self.xml_tag == "":
    178             return string.lower(self.id)
    179         else:
    180             return self.xml_tag
  • SDE/trunk/StrDocElem.py

    r806 r809  
    3333def StrDocElem_add(self,REQUEST):
    3434    "Método para adicionar um objeto StrDocElem"
    35     print "### DEBUG: StrDocElem_add: id do self: %s - %s" % (self.id,`self`)
    36     print "### DEBUG: StrDocElem_add: id do self.this(): %s - %s" % (self.this().id,`self.this()`)
    3735    request = REQUEST
    3836    RESPONSE =  request.RESPONSE
    3937    temp_id = self.newElemId()
    4038    request.set('id',temp_id)
    41     instance = StrDocElem(request,self.this())
     39    instance = StrDocElem(request)
    4240    instance.reindex_object()
    43        
    44     # add the instance to the ObjectManager
    4541    self._setObject(request.id,instance)
    4642    instance=getattr(self.this(),request.id)
     43    defelem = ""
     44    if request.has_key('type'):
     45        instance.manage_changeProperties(type=request.type)
     46        defelem=instance.definitionElement(obj=instance)
     47        for p in defelem.objectValues('SDE-Template-Attribute'):
     48            instance.manage_addProperty(id='@'+p.id+'@', value='', type='string')
    4749    if request.has_key('position'):
    4850        offset = request.position
     
    5254    if offset > 0:
    5355        self.manage_move_objects_down (request, temp_id, offset)
     56    if hasattr(defelem,"initial_text"):
     57        if defelem.initial_text != "":
     58            instance.manage_changeProperties(text=defelem.initial_text)
     59    if 'SDE_AfterInsert' in defelem.objectIds('Script (Python)'):
     60        defelem.SDE_AfterInsert(instance)
    5461    return instance
    5562
    56 class StrDocElem(OrderedFolder,CatalogAware):
     63class StrDocElem(OrderedFolder,CatalogAware,ObjectManager,PropertyManager):
    5764    "Classe de elementos de documentos estruturados"
    58     meta_type = 'StrDocElement'
     65    meta_type = 'SDE-Document-Element'
    5966    filtered_meta_types = []
    6067
    61     def __init__(self,REQUEST,container):
     68    def __init__(self,REQUEST):
    6269        self.id = REQUEST.id
    6370        self._setProperty("type",'')
    6471        self._setProperty("text",'')
    65         if REQUEST.has_key('type'):
    66             self.type = REQUEST['type']
    67             doc=container.document()
    68             print "### DEBUG - __init__ - doc: %s - %s" % (doc.id, `doc`)
    69             defpath=container.definitionPath()+'/'+self.type
    70             print "### DEBUG - defpath : %s " % defpath
    71             defelem=doc.definitionElement(element_path=defpath)
    72             print "### DEBUG - defelem : %s - %s " % (defelem.id, `defelem`)
    73             for p in defelem.objectValues('StrDocAttrDef'):
    74                 self.manage_addProperty(id='@'+p.id+'@', value='', type='string')
    75             if hasattr(defelem,"initial_text"):
    76                 if defelem.initial_text != "":
    77                     self.text = defelem.initial_text
    7872
    7973    # *** attributes
     
    106100        else:
    107101            return ""
    108            
    109     def setNewIdForChildren(self, recursive=1, obj=""):
    110         if obj:           
    111             self=obj
    112         for t_obj in self.objectValues():           
    113             OrderedFolder.manage_renameObject(self, t_obj.id, self.newElemId())
    114             if recursive:
    115                 t_obj.setNewIdForChildren (recursive=recursive, obj=t_obj)
    116 
    117     def _get_id(self, id):
    118         # This is a overriding of the CopyContainer._get_id method,
    119         # located in OFS/CopySupport.py
    120         new_id = id
    121         session=self.REQUEST.SESSION
    122         if session.has_key('SDE_clip_type'):
    123             if session['SDE_clip_type'] == 'COPY':
    124                 new_id = self.newElemId()
    125         print "### DEBUG: _get_id: old=%s new=%s" % (id,new_id)
    126         return new_id
    127        
     102
    128103    # *** manage_beforeDelete (EVENT)
    129104    def manage_beforeDelete (self, item, containeR):
    130         defElem = item.definitionElement(obj=item)
     105        defElem = self.definitionElement(obj=self)
    131106        if 'SDE_BeforeDelete' in defElem.objectIds('Script (Python)'):
    132107            defElem.SDE_BeforeDelete(item)
    133108        return
    134        
    135     # *** manage_afterAdd (EVENT)
    136     def manage_afterAdd (self, item, containeR):
    137         print "### DEBUG: AfterAdd para o item %s" % item.id
    138         defElem = item.definitionElement(obj=item)
    139         print "### DEBUG: id do defelem: %s" % defElem.id
    140         if 'SDE_AfterInsert' in defElem.objectIds('Script (Python)'):
    141             print "### DEBUG: Achou Python de evento"
    142             print defElem.SDE_AfterInsert(item)
    143         return       
    144 
    145     # *** manage_afterClone (EVENT)
    146     def manage_afterClone (self, item):
    147         print "### DEBUG: AfterClone para o item %s" % item.id
    148         session=self.REQUEST.SESSION
    149         if session.has_key('SDE_clip_type'):
    150             if session['SDE_clip_type'] == 'COPY':
    151                 self.setNewIdForChildren(recursive=1,obj=self)
    152         return
    153 #        return self.manage_afterAdd (item, containeR=None)
    154 
    155109
    156110    # *** parent
     
    236190        if self.has_own_value():
    237191            printed+= "%s<%s:%s_text>%s</%s:%s_text>" % (indent+"   ",pref,xmltag,self.text,pref,xmltag)
    238         for x in (self.objectValues("StrDocElement")):
     192        for x in (self.objectValues("SDE-Document-Element")):
    239193            printed+= x.renderXML(indent+"   ")
    240194        printed+= "%s</%s:%s>" % (indent,pref,xmltag)
     
    244198    def renderXMLforEditing (self,indent=0, id_edit='', path='', prev='', next=''):
    245199        "Método de renderização XML"
    246        
    247         session = self.REQUEST.SESSION
    248200        printed=""
    249201        spaces = ''
     
    275227            if next.type == self.type:
    276228                str_movedn_attrib = 'yes'
    277                
    278         str_canpaste_attrib = 'no'
    279         if session.has_key('SDE_clip_key'):
    280             if session['SDE_clip_key']:
    281                 for c in chd:
    282                     if c[0] == session['SDE_clip_object_type']:
    283                         str_canpaste_attrib = 'yes'
    284                         break;
    285 
    286         printed+= '%s<sd_element id="%s" type="%s" type_name="%s" editing="%s" path="%s" up="%s" down="%s" paste="%s">\n' % (spaces, id, self.type, defelem.name(), str_edit_attrib, path, str_moveup_attrib, str_movedn_attrib, str_canpaste_attrib)
     229
     230        printed+= '%s<sd_element id="%s" type="%s" type_name="%s" editing="%s" path="%s" up="%s" down="%s">\n' % (spaces, id, self.type, defelem.name(), str_edit_attrib, path, str_moveup_attrib, str_movedn_attrib)
    287231        if defelem.has_own_value:
    288232            printed+= '%s    <sde_text>%s</sde_text>\n' % (spaces, self.text)
     
    332276        printed+= '%s</sd_element>\n' % spaces
    333277        return printed
    334        
    335     def add_to_clipboard (self, op_type, REQUEST):
    336         """ Método que coloca uma referência do objeto na área de teransferência (clipboard).
    337             se op_type = 'CUT', quando a operação de "paste" for realizada, o objeto será movido,
    338             senão (se op_type='COPY') o objeto será copiado. """
    339        
    340         session=self.REQUEST.SESSION
    341         session['SDE_clip_object_type'] = self.type   
    342         if op_type == 'COPY':
    343             v_clip_key = self.parent().manage_copyObjects(self.id)
    344         elif op_type == 'CUT':
    345             v_clip_key = self.parent().manage_cutObjects(self.id)
    346         else:
    347             return 0
    348        
    349         session['SDE_clip_type'] = op_type
    350         session['SDE_clip_key'] = v_clip_key
    351        
    352         return
    353278
    354279    def move_up(self):
     
    382307            if len(dic_attr) > 0:
    383308                self.manage_changeProperties(dic_attr)
    384             if (father.meta_type == "StructuredDocument"):
     309            if (father.meta_type == "SDE-Document"):
    385310                anchor = ""
    386311            else:
  • SDE/trunk/StrDocElemDef.py

    r802 r809  
    3636    REQUEST.RESPONSE.redirect(instance.aq_parent.absolute_url() + '/manage_main')
    3737
     38# ------------------------------------------------------------------------------
     39# CLASS DEFINITION
     40# ------------------------------------------------------------------------------
    3841class StrDocElemDef(OrderedFolder,CatalogAware,ObjectManager,PropertyManager):
    3942    "Classe de definição de elementos de documentos estruturados"
    40     meta_type = 'StrDocElementDefinition'
     43    meta_type = 'SDE-Template-Element'
    4144
    4245    filtered_meta_types = []
    43     __tEmPtYPe = {'product': 'StructuredDoc', 'name': 'StrDocElementDefinition', 'permission': 'Add StrDocElementDefinitions', 'interfaces': [], 'visibility': 'Global', 'instance': None, 'action': 'manage_addProduct/StructuredDoc/StrDocElemDef_addForm', 'container_filter': None}
     46    __tEmPtYPe = {'product': 'StructuredDoc', 'name': 'SDE-Template-Element', 'permission': 'Add StrDocElementDefinitions', 'interfaces': [], 'visibility': 'Global', 'instance': None, 'action': 'manage_addProduct/StructuredDoc/StrDocElemDef_addForm', 'container_filter': None}
    4447    filtered_meta_types.append(__tEmPtYPe)
    45     __tEmPtYPe = {'product': 'StructuredDoc', 'name': 'StrDocAttrDef', 'permission': 'Add StrDocAttrDefs', 'interfaces': [], 'visibility': 'Global', 'instance': None, 'action': 'manage_addProduct/StructuredDoc/StrDocAttrDef_addForm', 'container_filter': None}
     48    __tEmPtYPe = {'product': 'StructuredDoc', 'name': 'SDE-Template-Attribute', 'permission': 'Add StrDocAttrDefs', 'interfaces': [], 'visibility': 'Global', 'instance': None, 'action': 'manage_addProduct/StructuredDoc/StrDocAttrDef_addForm', 'container_filter': None}
    4649    filtered_meta_types.append(__tEmPtYPe)
    47     __tEmPtYPe = {'product': 'StructuredDoc', 'name': 'StrDocElemDefLink', 'permission': 'Add StrDocElemDefLinks', 'interfaces': [], 'visibility': 'Global', 'instance': None, 'action': 'manage_addProduct/StructuredDoc/StrDocElemDefLink_addForm', 'container_filter': None}
     50    __tEmPtYPe = {'product': 'StructuredDoc', 'name': 'SDE-Template-Link', 'permission': 'Add StrDocElemDefLinks', 'interfaces': [], 'visibility': 'Global', 'instance': None, 'action': 'manage_addProduct/StructuredDoc/StrDocElemDefLink_addForm', 'container_filter': None}
    4851    filtered_meta_types.append(__tEmPtYPe)
    4952    __tEmPtYPe = {'product': 'PythonScripts', 'name': 'Script (Python)', 'permission': 'Add Python Scripts', 'interfaces': [], 'visibility': 'Global', 'instance': None, 'action': 'manage_addProduct/PythonScripts/pyScriptAdd', 'container_filter': None}
     
    6164        self.manage_addProperty('element_name','','string')
    6265
     66# ------------------------------------------------------------------------------
     67# PRIVATE METHODS
     68# ------------------------------------------------------------------------------
    6369    # *** isMultiple
    6470    def isMultiple(self):
     
    7884    # *** renderXSD
    7985    def renderXSD(self,indent=""):
    80         group_open = -1
    81         tag = self.xmlTag()
    82         shift = "   "
    83         minOccurs = "minOccurs=\"1\""
    84         maxOccurs = "maxOccurs=\"1\""
    85         printed =""
    86 
    87         if self.isMultiple():
    88             maxOccurs = "maxOccurs=\"unbounded\""
    89         if self.isOptional():
    90             minOccurs = "minOccurs=\"0\""
    91         printed+= "%s<xs:element name=\"%s\" %s %s>" % (indent,tag,minOccurs,maxOccurs)
    92         printed+= "%s   <xs:complexType>" % indent
    93         printed+= "%s      <xs:sequence>" % indent
    94         if self.has_own_value:
    95             printed+= "%s         <xs:element name=\"%s_text\" type=\"xs:string\" />" % (indent,tag)
    96         subtree = self.objectValues(["StrDocElementDefinition","StrDocElemDefLink"])
    97         if len(subtree) > 0:
    98             for x in subtree:
    99                 if x.exclusivity_group != group_open:
    100                     if group_open != -1:
    101                         printed+= "%s         </xs:choice>" % indent
    102                     printed+= "%s         <xs:choice>" % indent
    103                     group_open = x.exclusivity_group
    104                     shift = shift + shift
    105                 printed+= x.renderXSD(indent + "      " + shift)
    106             if group_open != -1:
    107                 printed+= "%s         </xs:choice>" % indent
    108                 group_open = -1
    109         printed+= "%s      </xs:sequence>" % indent
    110         printed+= "%s   </xs:complexType>" % indent
    111         printed+= "%s</xs:element>" % indent
    112         return printed
    113 
    114     # *** renderXSDv
    115     def renderXSDv(self,indent=""):
    11686        tag = self.xmlTag()
    11787        group_open = -1
     
    12292        if self.has_own_value:
    12393            printed+= "%s      <xs:element name=\"%s_text\" type=\"xs:string\" />\n" % (indent,tag)
    124         subtree = self.objectValues(["StrDocElementDefinition","StrDocElemDefLink"])
     94        subtree = self.objectValues(["SDE-Template-Element","SDE-Template-Link"])
    12595        if len(subtree) > 0:
    12696            for x in subtree:
     
    148118        printed+= "%s   </xs:sequence>\n" % indent
    149119        printed+= "%s   <xs:attribute name=\"id\" type=\"xs:string\" />\n" % indent
    150         for a in self.objectValues('StrDocAttrDef'):
     120        for a in self.objectValues('SDE-Template-Attribute'):
    151121            printed+= '%s   <xs:attribute name="%s" type="xs:%s" />\n' % (indent,  a.id, a.xsd_type)
    152122        printed+= "%s</xs:complexType>\n" % indent
    153         subtree = self.objectValues("StrDocElementDefinition")
     123        subtree = self.objectValues("SDE-Template-Element")
    154124        for x in subtree:
    155             printed+= x.renderXSDv(indent)
     125            printed+= x.renderXSD(indent)
    156126        return printed
    157127
     
    162132        else:
    163133            return self.xml_tag
     134
     135# ------------------------------------------------------------------------------
     136# PUBLIC METHODS
     137# ------------------------------------------------------------------------------
     138
     139
     140    def updateMetaType(self):
     141        """ Sets the object's meta_type to the class current meta_type """
     142        self.meta_type = StrDocElemDef.meta_type
     143
     144    def showMetaType(self):
     145        """ Debug """
     146        printed  = '<html><body>\n'
     147        printed += 'Class meta_type: %s<br>\n' % StrDocElemDef.meta_type
     148        printed += 'Object meta_type: %s<br>\n' % self.meta_type
     149        printed += '</body></html>\n'
     150        return printed
  • SDE/trunk/StrDocElemDefLink.py

    r802 r809  
    3434class StrDocElemDefLink(OrderedFolder,CatalogAware,ObjectManager,PropertyManager):
    3535    "Classe de Link para definição de elementos de documentos estruturados"
    36     meta_type="StrDocElemDefLink"
     36    meta_type="SDE-Template-Link"
     37    filtered_meta_types = []
    3738    def __init__(self,REQUEST):
    3839        self.id = REQUEST.id
     
    5859        return self.restrictedTraverse(self.link_to).possibleChild()
    5960
    60     # *** renderXSD_old
    61     def renderXSD_old(self,indent=''):
    62         printed= "%s<xs:element ref=\"%s\" />" % (indent,self.xmlTag())
    63         return printed
    64 
    6561    # *** xmlTag
    6662    def xmlTag(self):
  • SDE/trunk/version.txt

    r806 r809  
    1 StructuredDoc-v0.0.3
     1StructuredDoc-v1.0.0
Note: Veja TracChangeset para ajuda no uso do visualizador de conjunto de mudanças.
 

The contents and data of this website are published under license:
Creative Commons 4.0 Brasil - Atribuir Fonte - Compartilhar Igual.