Browse Source

Fixes for the content modeler. Lists have become sets.

pull/105/head
Nigel Banks 14 years ago
parent
commit
9635c23c70
  1. 20
      ContentModel.inc
  2. 48
      islandoracm.xsd

20
ContentModel.inc

@ -2105,8 +2105,13 @@ class ContentModel extends XMLDatastream {
}
$result = $this->xpath->query("//cm:form[@name='$name']");
if($result->length == 1) {
$element = $this->xml->importNode($element);
$form = $result->item(0);
$result = $this->xpath->query("child::node()", $form);
$element = $this->xml->importNode($element);
for($i = 0; $i < $result->length; $i++) {
$child = $result->item($i);
$element->appendChild($child);
}
$form->parentNode->replaceChild($element, $form);
return TRUE;
}
@ -2132,8 +2137,17 @@ class ContentModel extends XMLDatastream {
*/
public function editFormElement($new_element, $edit_element) {
$new_element = $this->xml->importNode($new_element, TRUE);
$this->insertElementInPlace($new_element, $edit_element);
$edit_element->parentNode->removeChild($edit_element);
$name = $new_element->tagName;
$result = $new_element->getElementsByTagName('content');
if($result->length == 1) {
$new_content = $result->item(0);
$result = $this->xpath->query("child::cm:content/child::node()", $edit_element);
for($i = 0; $i < $result->length; $i++) {
$child = $result->item($i);
$new_content->appendChild($child);
}
}
$edit_element->parentNode->replaceChild($new_element, $edit_element);
return TRUE;
}

48
islandoracm.xsd

@ -193,45 +193,46 @@
<xsd:choice maxOccurs="unbounded" minOccurs="0">
<xsd:element maxOccurs="1" minOccurs="1" name="fieldset">
<xsd:complexType>
<xsd:sequence maxOccurs="1" minOccurs="1">
<xsd:all maxOccurs="1" minOccurs="1">
<xsd:element name="title" type="xsd:normalizedString"/>
<xsd:element minOccurs="0" name="description" type="xsd:normalizedString"/>
<xsd:element default="true" minOccurs="0" name="collapsible"
type="xsd:boolean"/>
<xsd:element default="false" minOccurs="0" name="collapsed"
type="xsd:boolean"/>
<xsd:element minOccurs="0" name="form_builder" type="formBuilderControlType"/>
<xsd:element name="content" type="formElementType"/>
</xsd:sequence>
<xsd:element minOccurs="0" name="form_builder" type="formBuilderControlType"
/>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="textfield">
<xsd:complexType>
<xsd:sequence maxOccurs="1" minOccurs="1">
<xsd:all maxOccurs="1" minOccurs="1">
<xsd:element name="title" type="xsd:normalizedString"/>
<xsd:element minOccurs="0" name="description" type="xsd:normalizedString"/>
<xsd:element minOccurs="0" name="required" type="xsd:boolean"/>
<xsd:element minOccurs="0" name="default_value" type="xsd:normalizedString"/>
<xsd:element minOccurs="0" name="form_builder" type="formBuilderControlType"
/>
</xsd:sequence>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element minOccurs="1" name="textarea">
<xsd:complexType>
<xsd:sequence maxOccurs="1" minOccurs="1">
<xsd:all maxOccurs="1" minOccurs="1">
<xsd:element name="title" type="xsd:normalizedString"/>
<xsd:element minOccurs="0" name="description" type="xsd:normalizedString"/>
<xsd:element minOccurs="0" name="required" type="xsd:boolean"/>
<xsd:element minOccurs="0" name="default_value" type="xsd:normalizedString"/>
<xsd:element minOccurs="0" name="form_builder" type="formBuilderControlType"
/>
</xsd:sequence>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element maxOccurs="1" minOccurs="1" name="select">
<xsd:complexType>
<xsd:sequence maxOccurs="1" minOccurs="1">
<xsd:all maxOccurs="1" minOccurs="1">
<xsd:element name="title" type="xsd:normalizedString"/>
<xsd:element minOccurs="0" name="description" type="xsd:normalizedString"/>
<xsd:element name="options" type="formControlOptionsType"/>
@ -239,73 +240,74 @@
<xsd:element minOccurs="0" name="default_value" type="xsd:normalizedString"/>
<xsd:element minOccurs="0" name="form_builder" type="formBuilderControlType"
/>
</xsd:sequence>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element minOccurs="1" name="list">
<xsd:element minOccurs="1" name="set">
<xsd:complexType>
<xsd:sequence maxOccurs="1" minOccurs="1">
<xsd:all maxOccurs="1" minOccurs="1">
<xsd:element name="title" type="xsd:normalizedString"/>
<xsd:element minOccurs="0" name="description" type="xsd:normalizedString"/>
<xsd:element minOccurs="0" name="required" type="xsd:boolean"/>
<xsd:element minOccurs="0" name="default_value" type="xsd:normalizedString"/>
<xsd:element minOccurs="0" name="form_builder" type="formBuilderControlType"
/>
</xsd:sequence>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element minOccurs="1" name="filechooser">
<xsd:complexType>
<xsd:sequence maxOccurs="1" minOccurs="1">
<xsd:all maxOccurs="1" minOccurs="1">
<xsd:element name="title" type="xsd:normalizedString"/>
<xsd:element minOccurs="0" name="description" type="xsd:normalizedString"/>
<xsd:element minOccurs="0" name="required" type="xsd:boolean"/>
<xsd:element minOccurs="0" name="default_value" type="xsd:normalizedString"/>
<xsd:element minOccurs="0" name="form_builder" type="formBuilderControlType"
/>
</xsd:sequence>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element minOccurs="1" name="datepicker">
<xsd:complexType>
<xsd:sequence maxOccurs="1" minOccurs="1">
<xsd:all maxOccurs="1" minOccurs="1">
<xsd:element name="title" type="xsd:normalizedString"/>
<xsd:element minOccurs="0" name="description" type="xsd:normalizedString"/>
<xsd:element minOccurs="0" name="required" type="xsd:boolean"/>
<xsd:element minOccurs="0" name="default_value" type="xsd:normalizedString"/>
<xsd:element minOccurs="0" name="form_builder" type="formBuilderControlType"
/>
</xsd:sequence>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element maxOccurs="1" minOccurs="1" name="tabpanel">
<xsd:complexType>
<xsd:sequence maxOccurs="1" minOccurs="1">
<xsd:all maxOccurs="1" minOccurs="1">
<xsd:element name="title" type="xsd:normalizedString"/>
<xsd:element minOccurs="0" name="description" type="xsd:normalizedString"/>
<xsd:element minOccurs="0" name="form_builder" type="formBuilderControlType"/>
<xsd:element name="content" type="formElementType"/>
</xsd:sequence>
<xsd:element minOccurs="0" name="form_builder" type="formBuilderControlType"
/>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="checkbox">
<xsd:complexType>
<xsd:sequence maxOccurs="1" minOccurs="1">
<xsd:all maxOccurs="1" minOccurs="1">
<xsd:element name="title" type="xsd:normalizedString"/>
<xsd:element minOccurs="0" name="description" type="xsd:normalizedString"/>
<xsd:element name="return_value" type="xsd:normalizedString"/>
<xsd:element minOccurs="0" name="form_builder" type="formBuilderControlType"
/>
</xsd:sequence>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element minOccurs="1" name="hidden">
<xsd:complexType>
<xsd:sequence>
<xsd:all>
<xsd:element minOccurs="1" name="value" type="xsd:normalizedString"/>
<xsd:element minOccurs="0" name="form_builder" type="formBuilderControlType"
/>
</xsd:sequence>
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:choice>

Loading…
Cancel
Save