Browse Source

Added collection policy checking and cleaned up code

pull/122/head
rwincewicz 13 years ago
parent
commit
788fa329ca
  1. 4
      islandora_basic_collection/includes/CollectionPolicy.inc
  2. 8
      islandora_basic_collection/includes/child_collection.inc

4
islandora_basic_collection/includes/CollectionPolicy.inc

@ -20,9 +20,9 @@ class CollectionPolicy {
* @return CollectionPolicy * @return CollectionPolicy
* The parsed collection policy. * The parsed collection policy.
*/ */
public function __construct($xmlStr) { public function __construct($xml_string) {
$this->xml = new DOMDocument(); $this->xml = new DOMDocument();
$this->xml->loadXML($xmlStr); $this->xml->loadXML($xml_string);
$this->name = 'Collection Policy'; $this->name = 'Collection Policy';
} }

8
islandora_basic_collection/includes/child_collection.inc

@ -19,7 +19,15 @@ function islandora_create_child_collection_form($form, &$form_state, $this_colle
$rest_connection = new RestConnection(); $rest_connection = new RestConnection();
$collection_object = new FedoraObject($this_collection_pid, $rest_connection->repository); $collection_object = new FedoraObject($this_collection_pid, $rest_connection->repository);
$policy_datastream = $collection_object->getDatastream(variable_get('Islandora_Collection_Policy_DSID', 'COLLECTION_POLICY')); $policy_datastream = $collection_object->getDatastream(variable_get('Islandora_Collection_Policy_DSID', 'COLLECTION_POLICY'));
if (!$policy_datastream) {
$form['no_policy'] = array(
'#type' => 'item',
'#title' => t('No collection policy datastream found!'),
);
return $form;
}
$collection_policy = new CollectionPolicy($policy_datastream->content); $collection_policy = new CollectionPolicy($policy_datastream->content);
$current_content_models = $collection_policy->getContentModels(); $current_content_models = $collection_policy->getContentModels();
$collection_content_model_exists = FALSE; $collection_content_model_exists = FALSE;

Loading…
Cancel
Save