Changeset 1447

Show
Ignore:
Timestamp:
12/31/06 00:11:26 (2 years ago)
Author:
dominik
Message:

allow multiple <settings> blocks which can define a prefix to their settings (defaults to 'core.')
closes #375

Location:
branches/0.11/src/config
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/0.11/src/config/AgaviConfigValueHolder.class.php

    r1384 r1447  
    180180   * Returns the children of this value. 
    181181   * 
     182   * @param      string Return only the childs matching this node (tag) name. 
     183   * 
    182184   * @return     array An array with the childs of this value. 
    183185   * 
     
    185187   * @since      0.11.0 
    186188   */ 
    187   public function getChildren() 
    188   { 
    189     return $this->_childs; 
     189  public function getChildren($nodename = null) 
     190  { 
     191    if($nodename === null) { 
     192      return $this->_childs; 
     193    } else { 
     194      $childs = array(); 
     195      foreach($this->_childs as $child) { 
     196        if($child->getName() == $nodename) { 
     197          $childs[] = $child; 
     198        } 
     199      } 
     200 
     201      return $childs; 
     202    } 
    190203  } 
    191204 
  • branches/0.11/src/config/AgaviSettingConfigHandler.class.php

    r1391 r1447  
    6666 
    6767      if(isset($cfg->settings)) { 
    68         foreach($cfg->settings as $setting) 
    69         { 
    70           $data['core.' . $setting->getAttribute('name')] = $this->literalize($setting->getValue()); 
     68        $multiSettings = $cfg->getChildren('settings'); 
     69        foreach($multiSettings as $settings) { 
     70          $prefix = $settings->getAttribute('prefix', 'core.'); 
     71          foreach($settings as $setting) 
     72          { 
     73            $data[$prefix . $setting->getAttribute('name')] = $this->literalize($setting->getValue()); 
     74          } 
    7175        } 
    7276      } 
  • branches/0.11/src/config/xsd/settings.xsd

    r908 r1447  
    66      <xs:element name="configuration" minOccurs="0" maxOccurs="unbounded"> 
    77        <xs:complexType> 
    8           <xs:all> 
    9             <xs:element name="system_actions" type="system_actions" minOccurs="0" /> 
    10             <xs:element name="settings" type="settings" minOccurs="0" /> 
    11             <xs:element name="exception_templates" type="exception_templates" minOccurs="0" /> 
    12           </xs:all> 
     8          <xs:sequence minOccurs="0" maxOccurs="unbounded" > 
     9            <xs:group ref="system_actions" minOccurs="0" /> 
     10            <xs:group ref="settings" minOccurs="0" maxOccurs="unbounded" /> 
     11            <xs:group ref="exception_templates" minOccurs="0" /> 
     12          </xs:sequence> 
    1313          <xs:attribute name="environment" type="xs:string" /> 
    1414        </xs:complexType> 
     
    1717    <xs:attribute name="parent" type="xs:string" /> 
    1818  </xs:complexType> 
     19 
     20  <xs:group name="system_actions"> 
     21    <xs:choice> 
     22      <xs:element name="system_actions" type="system_actions" minOccurs="0" /> 
     23      <xs:element name="system_action" type="system_action" minOccurs="0" maxOccurs="unbounded" /> 
     24    </xs:choice> 
     25  </xs:group> 
    1926 
    2027  <xs:complexType name="system_actions"> 
     
    3138  </xs:complexType> 
    3239 
     40  <xs:group name="settings"> 
     41    <xs:choice> 
     42      <xs:element name="settings" type="settings" minOccurs="0" /> 
     43      <xs:element name="setting" type="setting" minOccurs="0" maxOccurs="unbounded" /> 
     44    </xs:choice> 
     45  </xs:group> 
     46 
    3347  <xs:complexType name="settings"> 
    3448    <xs:sequence> 
    3549      <xs:element name="setting" type="setting" maxOccurs="unbounded" /> 
    3650    </xs:sequence> 
     51    <xs:attribute name="prefix" type="xs:string" /> 
    3752  </xs:complexType> 
    3853  <xs:complexType name="setting"> 
     
    4358    </xs:simpleContent> 
    4459  </xs:complexType> 
     60 
     61  <xs:group name="exception_templates"> 
     62    <xs:choice> 
     63      <xs:element name="exception_templates" type="exception_templates" minOccurs="0" /> 
     64      <xs:element name="exception_template" type="exception_template" minOccurs="0" maxOccurs="unbounded" /> 
     65    </xs:choice> 
     66  </xs:group> 
    4567 
    4668  <xs:complexType name="exception_templates">