diff --git a/CollectionClass.inc b/CollectionClass.inc index a7c369a3..5882a460 100644 --- a/CollectionClass.inc +++ b/CollectionClass.inc @@ -1,544 +1,800 @@ -collectionObject = new ObjectHelper($pid); - $this->pid = $pid; - } - } - - /* gets objects related to this object. must include offset and limit - * calls getRelatedItems but enforces limit and offset - */ - - function getRelatedObjects($pid, $limit, $offset, $itqlquery=NULL) { - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - $objectHelper = new ObjectHelper(); - if (!isset($itqlquery)) { - // $query_string = $objectHelper->getStream($pid, 'QUERY', 0); - $itqlquery = $objectHelper->getStream($pid, 'QUERY', 0); - } - return $this->getRelatedItems($pid, $itqlquery, $limit, $offset); - } - - /** - * Gets objects related to this item. It will query the object for a Query stream and use that as a itql query - * or if there is no query stream it will use the default. If you pass a query to this method it will use the passed in query no matter what - */ - function getRelatedItems($pid, $itqlquery = NULL, $limit = NULL, $offset = NULL) { - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); - if (!isset($limit)) { - $limit = 1000; - } - if (!isset($offset)) { - $offset = 0; - } - global $user; - if (!fedora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { - drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied."), 'error'); - return ' '; - } - $objectHelper = new ObjectHelper(); - $query_string = $itqlquery; - if (!isset($query_string)) { - $query_string = $objectHelper->getStream($pid, 'QUERY', 0); - if ($query_string == NULL) { - $query_string = 'select $object $title $content from <#ri> - where ($object $title - and $object $content - and ($object - or $object ) - and $object ) - minus $content - order by $title'; - } - } - else { - // Replace %parent_collection% with the actual collection PID - $query_string = preg_replace("/\%parent_collection\%/", "", $query_string); - } - - $query_string = htmlentities(urlencode($query_string)); - - $content = ''; - $url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'); - $url .= "?type=tuples&flush=TRUE&format=Sparql&limit=$limit&offset=$offset&lang=itql&stream=on&query=" . $query_string; - $content .= do_curl($url); - - return $content; - } - - function getCollectionPolicyStream($collection_pid) { - if ($this->collectionPolicyStream != NULL) { - return $this->collectionPolicyStream; - } - $this->collectionPolicyStream = $this->getStream($collection_pid, CollectionClass :: $COLLECTION_CLASS_COLLECTION_POLICY_STREAM, 0); - return $this->collectionPolicyStream; - } - - function getRelationshipElement($collection_pid) { - $stream = $this->getCollectionPolicyStream($collection_pid); - try { - $xml = new SimpleXMLElement($stream); - } catch (Exception $e) { - drupal_set_message(t('Error getting relationship element from policy stream !e', array('!e' => $e->getMessage())), 'error'); - return; - } - $relationship = $xml->relationship[0]; - return $relationship; - } - - function getCollectionViewStream($collection_pid) { - $this->collectionViewStream = $this->getStream($collection_pid, CollectionClass :: $COLLECTION_CLASS_COLLECTION_VIEW_STREAM, 0); - return $this->collectionViewStream; - } - - function getStream($pid, $dsid, $showError = 1) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - $item = new fedora_item($pid); - return isset($item->datastreams[$dsid]) ? $item->get_datastream_dissemination($dsid) : NULL; - } - - function getPidNameSpace($pid, $dsid) { - $stream = $this->getCollectionPolicyStream($pid); - try { - $xml = new SimpleXMLElement($stream); - } catch (Exception $e) { - drupal_set_message(t('Error getting PID namespace !e', array('!e' => $e->getMessage())), 'error'); - return; - } - foreach ($xml->contentmodels->contentmodel as $contentModel) { - // $contentModelName=strip_tags($contentModel['name']); - $contentdsid = strip_tags($contentModel->dsid); - if (strtolower($contentdsid) == strtolower($dsid)) { - return strip_tags($contentModel->pid_namespace->asXML()); - } - } - drupal_set_message(t('Error getting PID namespace! using collection pid of !pid and content model of !dsid', array('!pid' => $pid, '!dsid' => $dsid)), 'error'); - return NULL; - } - - /** - * gets a list of content models from a collection policy - */ - function getContentModels($collection_pid, $showError = TRUE) { - module_load_include('inc', 'Fedora_Repository', 'ContentModel'); - $collection_stream = $this->getCollectionPolicyStream($collection_pid); - try { - $xml = new SimpleXMLElement($collection_stream); - } catch (Exception $e) { - if ($showError) { - drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error'); - } - return NULL; - } - foreach ($xml->contentmodels->contentmodel as $content_model) { - $contentModel = new ContentModel(); - $contentModel->contentModelDsid = $content_model->dsid; - $contentModel->contentModelPid = $content_model->pid; - $contentModel->pidNamespace = $content_model->pidNamespace; - $contentModel->contentModelName = $content_model['name']; - $models[] = $contentModel; - } - return $models; - } - - /** - * using the collection policies pid namespace get a new pid by calling fedora' get next pid and appending it to the namespace - * $pid is the $pid of the content model - * $dsid is the datastream id of the content model. - */ - function getNextPid($pid, $dsid) { - module_load_include('inc', 'Fedora_Repository', 'ConnectionHelper'); - $pidNameSpace = $this->getPidNameSpace($pid, $dsid); - $pname = substr($pidNameSpace, 0, strpos($pidNameSpace, ":")); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - return Fedora_Item::get_next_pid_in_namespace($pname); - } - - /** - * gets the form handler file, class and method and returns them in an array - * - * @param string $pid The content model PID - * @param string $dsid The content model DSID - * @return array The file, class and method name to handle the ingest form. - */ - function getFormHandler($pid, $dsid) { - $stream = $this->getContentModelStream($pid, $dsid); - try { - $xml = new SimpleXMLElement($stream); - } catch (Exception $e) { - drupal_set_message(t('Error Getting FormHandler: !e', array('!e' => $e->getMessage())), 'error'); - return NULL; - } - $formHandler = $xml->ingest_form; - if ($formHandler != NULL) { - $handlerDsid = strip_tags($formHandler['dsid']); - $handlerMethod = strip_tags($formHandler->form_builder_method->form_handler->asXML()); - $handlerFile = strip_tags($formHandler->form_builder_method->file->asXML()); - $handlerClass = strip_tags($formHandler->form_builder_method->class_name->asXML()); - $handlerModule = strip_tags($formHandler->form_builder_method->module->asXML()); - $returnArray = array(); - $returnArray['module'] = $handlerModule; - $returnArray['method'] = $handlerMethod; - $returnArray['class'] = $handlerClass; - $returnArray['file'] = $handlerFile; - return $returnArray; - } - - drupal_set_message(t("Error getting form handler. No handler found for !pid - !dsid", array('!pid' => $pid, '!dsid' => $dsid)), 'error'); - return NULL; - } - - function getAllowedMimeTypes($contentModelPid, $contentModel_dsid) { - $stream = $this->getContentModelStream($contentModelPid, $contentModel_dsid); - try { - $xml = new SimpleXMLElement($stream); - } catch (Exception $e) { - drupal_set_message(t('Error getting content model stream for mime types !e', array('!e' => $e->getMessage())), 'error'); - return; - } - foreach ($xml->mimetypes->type as $type) { - $types[] = $type; - } - return $types; - } - - /** - * Grabs the rules from the content model stream - * file the file that has been uploaded - */ - function getAndDoRules($file, $mimetype, $pid, $dsid) { - if (!user_access('ingest new fedora objects')) { - drupal_set_message(t('You do not have permission to ingest objects.')); - return FALSE; - } - - $stream = $this->getContentModelStream($pid, $dsid); - - try { - $xml = new SimpleXMLElement($stream); - } catch (Exception $e) { - drupal_set_message(t('Error getting content model stream !e', array('!e' => $e->getMessage())), 'error'); - return FALSE; - } - foreach ($xml->ingest_rules->rule as $rule) { - foreach ($rule->applies_to as $type) { - if (!strcmp(trim($type), trim($mimetype))) { - $methods = $rule->methods->method; - return $this->callMethods($file, $methods); - } - } - } - } - - /** - * calls the methods defined in the content model rules .xml file stored in a Fedora object - */ - function callMethods($file, $methods) { - foreach ($methods as $method) { - $phpFile = strip_tags($method->file->asXML()); - $phpClass = strip_tags($method->class_name->asXML()); - $phpMethod = strip_tags($method->method_name->asXML()); - $file_ext = strip_tags($method->modified_files_ext->asXML()); - $parameters = $method->parameters->parameter; - $dsid = strip_tags($method->datastream_id); - $parametersArray = array(); - if (isset($parameters)) { - foreach ($parameters as $parameter) { - $name = strip_tags($parameter['name']); - $value = strip_tags($parameter->asXML()); - $parametersArray["$name"] = $value; - } - } - // module_load_include( $phpFile, 'Fedora_Repository', ' '); - require_once(drupal_get_path('module', 'fedora_repository') . '/' . $phpFile); - $thisClass = new $phpClass (); - $returnValue = $thisClass->$phpMethod($parametersArray, $dsid, $file, $file_ext); - if (!$returnValue) { - drupal_set_message('Error! Failed running content model method !m !rv', array('!m' => $phpMethod, '!rv' => $returnValue)); - return FALSE; - } - } - return TRUE; - } - - /** - * grabs a xml form definition from a content model and builds - * the form using drupals forms api - */ - function build_ingest_form(&$form, &$form_state, $contentModelPid, $contentModelDsid) { - $stream = $this->getContentModelStream($contentModelPid, $contentModelDsid); - try { - $xml = new SimpleXMLElement($stream); - } catch (Exception $e) { - drupal_set_message(t('Error getting ingest form stream !e', array('!e' => $e->getMessage())), 'error'); - return FALSE; - } - $docRoot = $_SERVER['DOCUMENT_ROOT']; - - $file = (isset($form_state['values']['ingest-file-location']) ? $form_state['values']['ingest-file-location'] : ''); - // $fullPath = $docRoot . '' . $file; - $fullpath = $file; - // $form = array(); - $form['step'] = array( - '#type' => 'hidden', - '#value' => (isset($form_state['values']['step']) ? $form_state['values']['step'] : 0) + 1, - ); - $form['ingest-file-location'] = array( - '#type' => 'hidden', - '#value' => $file, - ); - - $form['content_model_name'] = array( - '#type' => 'hidden', - '#value' => $contentModelDsid - ); - $form['models'] = array(//content models available - '#type' => 'hidden', - '#value' => $form_state['values']['models'], - ); - $form['fullpath'] = array( - '#type' => 'hidden', - '#value' => $fullpath, - ); - - $form['#attributes']['enctype'] = 'multipart/form-data'; - $form['indicator']['ingest-file-location'] = array( - '#type' => 'file', - '#title' => t('Upload Document'), - '#size' => 48, - '#description' => t('Full text'), - ); - if ($xml->ingest_form->hide_file_chooser == 'TRUE') { - $form['indicator']['ingest-file-location']['#type'] = 'hidden'; - } - $ingest_form = $xml->ingest_form; //should only be one - $drupal_module = strip_tags($ingest_form->form_builder_method->module->asXML()); - if (empty($drupal_module)) { - $drupal_module = 'fedora_repository'; - } - $phpFile = strip_tags($ingest_form->form_builder_method->file->asXML()); - $phpClass = strip_tags($ingest_form->form_builder_method->class_name->asXML()); - $phpMethod = strip_tags($ingest_form->form_builder_method->method_name->asXML()); - $dsid = strip_tags($ingest_form['dsid']); - // module_load_include('php', 'Fedora_Repository', $phpFile); - require_once(drupal_get_path('module', $drupal_module) . '/' . $phpFile); - $thisClass = new $phpClass (); - - return $thisClass->$phpMethod($form, $ingest_form, $form_state['values'], $form_state); - } - - //this will also create a personal collection for an existing user if they don't have one - //not using this function currently - function createUserCollection(& $user) { - if (isset($user->fedora_personal_pid)) { - return; - } - $username = array( - 'name' => variable_get('fedora_admin_user', 'fedoraAdmin') - ); - $admin_user = user_load($username); - module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); - $connectionHelper = new ConnectionHelper(); - try { - $soapClient = $connectionHelper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); - $pidNameSpace = variable_get('fedora_repository_pid', 'vre:'); - $pidNameSpace = substr($pidNameSpace, 0, strpos($pidNameSpace, ":")); - $params = array( - 'numPIDs' => '', - 'pidNamespace' => $pidNameSpace - ); - $object = $soapClient->__soapCall('getNextPID', array( - $params - )); - } catch (exception $e) { - drupal_set_message(t('Error getting Next PID: !e', array('!e' => $e->getMessage())), 'error'); - return FALSE; - } - $pid = implode(get_object_vars($object)); - $pidNumber = strstr($pid, ":"); - $pid = $pidNameSpace . ':' . 'USER-' . $user->name . '-' . substr($pidNumber, 1); - $personal_collection_pid = array( - 'fedora_personal_pid' => $pid - ); - module_load_include('inc', 'fedora_repository', 'plugins/PersonalCollectionClass'); - $personalCollectionClass = new PersonalCollectionClass(); - if (!$personalCollectionClass->createCollection($user, $pid, $soapClient)) { - drupal_set_message("Did not create a personal collection object for !u", array('!u' => $user->name)); - return FALSE; //creation failed don't save the collection pid in drupal db - } - user_save($user, $personal_collection_pid); - return TRUE; - } - - /** - * Queries a collection object for an xslt to format how the - * collection of objects is displayed. - */ - function getXslContent($pid, $path, $canUseDefault = TRUE) { - module_load_include('inc', 'fedora_repository', 'CollectionClass'); - $collectionClass = new CollectionClass(); - $xslContent = $collectionClass->getCollectionViewStream($pid); - if (!$xslContent && $canUseDefault) { //no xslt so we will use the default sent with the module - $xslContent = file_get_contents($path . '/xsl/sparql_to_html.xsl'); - } - return $xslContent; - } - - function showFieldSets($page_number) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - global $base_url; - - $tabset = array(); - - global $user; - $objectHelper = new ObjectHelper(); - $item = new Fedora_Item($this->pid); - $query = NULL; - if ($item->exists() && array_key_exists('QUERY', $item->datastreams)) { - $query = $item->get_datastream_dissemination('QUERY'); - } - $results = $this->getRelatedItems($this->pid, $query); - - $collection_items = $this->renderCollection($results, $this->pid, NULL, NULL, $page_number); - $collection_item = new Fedora_Item($this->pid); - // Check the form post to see if we are in the middle of an ingest operation. - $show_ingest_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'fedora_repository_ingest_form'); - $add_to_collection = $this->getIngestInterface(); - - $tabset['view_tab'] = array( - '#type' => 'tabpage', - '#title' => 'View', - '#content' => $collection_items - ); - $tabset['add_tab'] = array( - // #type and #title are the minimum requirements. - '#type' => 'tabpage', - '#title' => t('Add'), - '#selected' => $show_ingest_tab, - // This will be the content of the tab. - '#content' => $add_to_collection, - ); - return $tabset; - } - - function getIngestInterface() { - global $base_url; - $objectHelper = new ObjectHelper(); - module_load_include('inc', 'Fedora_Repository', 'CollectionPolicy'); - $collectionPolicyExists = $objectHelper->getMimeType($this->pid, CollectionPolicy::getDefaultDSID()); - if (user_access(ObjectHelper :: $INGEST_FEDORA_OBJECTS) && $collectionPolicyExists) { - if (!empty($collectionPolicyExists)) { - $allow = TRUE; - if (module_exists('fedora_fesl')) { - $allow = fedora_fesl_check_roles($this->pid, 'write'); - } - if ($allow) { - $ingestObject = drupal_get_form('fedora_repository_ingest_form', $this->pid); - } - } - } - else { - $ingestObject = ''; - } - - return $ingestObject; - } - - function renderCollection($content, $pid, $dsId, $collection, $pageNumber = NULL) { - $path = drupal_get_path('module', 'fedora_repository'); - global $base_url; - $collection_pid = $pid; //we will be changing the pid later maybe - $objectHelper = new ObjectHelper(); - $parsedContent = NULL; - $contentModels = $objectHelper->get_content_models_list($pid); - $isCollection = FALSE; - //if this is a collection object store the $pid in the session as it will come in handy - //after a purge or ingest to return to the correct collection. - - $fedoraItem = NULL; - - - - $collectionName = $collection; - if (!$pageNumber) { - $pageNumber = 1; - } - - if (!isset($collectionName)) { - $collectionName = variable_get('fedora_repository_name', 'Collection'); - } - $xslContent = $this->getXslContent($pid, $path); - - //get collection list and display using xslt------------------------------------------- - $objectList = ''; - if (isset($content) && $content != FALSE) { - $input = new DomDocument(); - $input->loadXML(trim($content)); - $results = $input->getElementsByTagName('result'); - if ($results->length > 0) { - try { - $proc = new XsltProcessor(); - $proc->setParameter('', 'collectionPid', $collection_pid); - $proc->setParameter('', 'collectionTitle', $collectionName); - $proc->setParameter('', 'baseUrl', $base_url); - $proc->setParameter('', 'path', $base_url . '/' . $path); - $proc->setParameter('', 'hitPage', $pageNumber); - $proc->registerPHPFunctions(); - $xsl = new DomDocument(); - $xsl->loadXML($xslContent); - // php xsl does not seem to work with namespaces so removing it below - // I may have just been being stupid here - // $content = str_ireplace('xmlns="http://www.w3.org/2001/sw/DataAccess/rf1/result"', '', $content); - - $xsl = $proc->importStylesheet($xsl); - $newdom = $proc->transformToDoc($input); - - $objectList = $newdom->saveXML(); //is the xml transformed to html as defined in the xslt associated with the collection object - - if (!$objectList) { - throw new Exception("Invalid XML."); - } - } catch (Exception $e) { - drupal_set_message(t('!e', array('!e' => $e->getMessage())), 'error'); - return ''; - } - } - } - else { - drupal_set_message(t("No Objects in this collection or bad query.")); - } - return $objectList; - } - -} - +collectionObject = new ObjectHelper($pid); + $this->pid = $pid; + } + } + + public static function getCollectionQuery($pid) { + if ($query = self::getCollectionQueryFromStream($pid)) { + return $query; + } + else { + return self::getDefaultCollectionQuery($pid); + } + } + + protected static function getCollectionQueryFromStream($pid) { + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + $item = new Fedora_Item($pid); + if ($item->exists() && array_key_exists('QUERY', $item->datastreams)) { + return $item->get_datastream_dissemination('QUERY'); + } + else { + return FALSE; + } + } + + protected static function getDefaultCollectionQuery($pid) { + return 'select $object $title $content from <#ri> + where ($object $title + and $object $content + and ($object + or $object ) + and $object ) + minus $content + order by $title'; + } + + /** + * Gets objects related to this object. Must include offset and limit! + * + * Calls self::getRelatedItems() but requires limit and offset. + * + * @param $pid string + * A string containing a Fedora PID. + * @param $limit + * An integer + * @param type $offset + * @param type $itqlquery + * @return type + */ + function getRelatedObjects($pid, $limit, $offset, $itqlquery=NULL) { + return $this->getRelatedItems($pid, $itqlquery, $limit, $offset); + } + + /** + * Gets objects related to this item. + * + * Query the resource index using the provided iTQL query. If no query is + * provided, one should be obtained via self::getCollectionQuery() which + * grabs the child objects. + * + * @param $pid string + * A string containing a PID which may be substituted into the query, + * in place of the %parent_collection% placeholder. + * @param $query_string string + * An optional iTQL query. + * @param $limit int + * An optional integer to limit the number of results returned. + * @param int $offset + * An optional integer used to offset the results returned. (Query should + * involve a sort to maintain consistency. + * @return string + * Sparql XML results from the resource index. + */ + function getRelatedItems($pid, $query_string = NULL, $limit = NULL, $offset = NULL) { + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + + if (!fedora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid)) { + drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied."), 'error'); + return ' '; + } + + if ($query_string === NULL) { + $query_string = self::getCollectionQuery($pid); + } + + // Replace %parent_collection% with the actual collection PID + $query_string = preg_replace("/\%parent_collection\%/", "", $query_string); + + $url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'); + + $settings = array( + 'type' => 'tuples', + 'flush' => TRUE, + 'format' => 'Sparql', + 'lang' => 'itql', + 'stream' => 'on', + 'query' => $query_string + ); + + if ($limit > 0) { + $settings['limit'] = $limit; + } + if ($offset > 0) { + $settings['offset'] = $offset; + } + + $url .= '?' . http_build_query($settings, NULL, '&'); + $content = do_curl($url); + return $content; + } + + /** + * get Collection Policy Stream ? + * @param type $collection_pid + * @return type + */ + function getCollectionPolicyStream($collection_pid) { + if ($this->collectionPolicyStream != NULL) { + return $this->collectionPolicyStream; + } + $this->collectionPolicyStream = $this->getStream($collection_pid, CollectionClass :: $COLLECTION_CLASS_COLLECTION_POLICY_STREAM, 0); + return $this->collectionPolicyStream; + } + + /** + * get Relationship element ? + * @param type $collection_pid + * @return type + */ + function getRelationshipElement($collection_pid) { + $stream = $this->getCollectionPolicyStream($collection_pid); + try { + $xml = new SimpleXMLElement($stream); + } catch (Exception $e) { + drupal_set_message(t('Error getting relationship element from policy stream @e', array('@e' => check_plain($e->getMessage()))), 'error'); + return; + } + $relationship = $xml->relationship[0]; + return $relationship; + } + + /** + * get Collection View Stream ? + * @param type $collection_pid + * @return type + */ + function getCollectionViewStream($collection_pid) { + $this->collectionViewStream = $this->getStream($collection_pid, CollectionClass :: $COLLECTION_CLASS_COLLECTION_VIEW_STREAM, 0); + return $this->collectionViewStream; + } + + /** + * get Stream ? + * @param type $pid + * @param type $dsid + * @param type $showError + * @return type + */ + function getStream($pid, $dsid, $showError = 1) { + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + $item = new fedora_item($pid); + return isset($item->datastreams[$dsid]) ? $item->get_datastream_dissemination($dsid) : NULL; + } + + /** + * get Pid name space ? + * @param type $pid + * @param type $dsid + * @return type + */ + function getPidNameSpace($pid, $dsid) { + $stream = $this->getCollectionPolicyStream($pid); + try { + $xml = new SimpleXMLElement($stream); + } catch (Exception $e) { + drupal_set_message(t('Error getting PID namespace @e', array('@e' => check_plain($e->getMessage()))), 'error'); + return; + } + foreach ($xml->contentmodels->contentmodel as $contentModel) { + // $contentModelName=strip_tags($contentModel['name']); + $contentdsid = strip_tags($contentModel->dsid); + if (strtolower($contentdsid) == strtolower($dsid)) { + return strip_tags($contentModel->pid_namespace->asXML()); + } + } + drupal_set_message(t('Error getting PID namespace! using collection pid of !pid and content model of !dsid', array('!pid' => $pid, '!dsid' => $dsid)), 'error'); + return NULL; + } + + /** + * gets a list of content models from a collection policy + * @param type $collection_pid + * @param type $showError + * @return ContentModel + */ + function getContentModels($collection_pid, $showError = TRUE) { + module_load_include('inc', 'Fedora_Repository', 'ContentModel'); + $collection_stream = $this->getCollectionPolicyStream($collection_pid); + try { + $xml = new SimpleXMLElement($collection_stream); + } catch (Exception $e) { + if ($showError) { + drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))), 'error'); + } + return NULL; + } + foreach ($xml->contentmodels->contentmodel as $content_model) { + $contentModel = new ContentModel(); + $contentModel->contentModelDsid = $content_model->dsid; + $contentModel->contentModelPid = $content_model->pid; + $contentModel->pidNamespace = $content_model->pidNamespace; + $contentModel->contentModelName = $content_model['name']; + $models[] = $contentModel; + } + return $models; + } + + /** + * using the collection policies pid namespace get a new pid by calling fedora' get next pid and appending it to the namespace + * $pid is the $pid of the content model + * $dsid is the datastream id of the content model. + */ + function getNextPid($pid, $dsid) { + module_load_include('inc', 'Fedora_Repository', 'ConnectionHelper'); + $pidNameSpace = $this->getPidNameSpace($pid, $dsid); + $pname = substr($pidNameSpace, 0, strpos($pidNameSpace, ":")); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + return Fedora_Item::get_next_pid_in_namespace($pname); + } + + /** + * gets the form handler file, class and method and returns them in an array + * + * @param string $pid The content model PID + * @param string $dsid The content model DSID + * @return array The file, class and method name to handle the ingest form. + */ + function getFormHandler($pid, $dsid) { + $stream = $this->getContentModelStream($pid, $dsid); + try { + $xml = new SimpleXMLElement($stream); + } catch (Exception $e) { + drupal_set_message(t('Error Getting FormHandler: @e', array('@e' => check_plain($e->getMessage()))), 'error'); + return NULL; + } + $formHandler = $xml->ingest_form; + if ($formHandler != NULL) { + $handlerDsid = strip_tags($formHandler['dsid']); + $handlerMethod = strip_tags($formHandler->form_builder_method->form_handler->asXML()); + $handlerFile = strip_tags($formHandler->form_builder_method->file->asXML()); + $handlerClass = strip_tags($formHandler->form_builder_method->class_name->asXML()); + $handlerModule = strip_tags($formHandler->form_builder_method->module->asXML()); + $returnArray = array(); + $returnArray['module'] = $handlerModule; + $returnArray['method'] = $handlerMethod; + $returnArray['class'] = $handlerClass; + $returnArray['file'] = $handlerFile; + return $returnArray; + } + + drupal_set_message(t("Error getting form handler. No handler found for !pid - !dsid", array('!pid' => $pid, '!dsid' => $dsid)), 'error'); + return NULL; + } + + /** + * get Allowed Mime Types + * @param type $contentModelPid + * @param type $contentModel_dsid + * @return type + */ + function getAllowedMimeTypes($contentModelPid, $contentModel_dsid) { + $stream = $this->getContentModelStream($contentModelPid, $contentModel_dsid); + try { + $xml = new SimpleXMLElement($stream); + } catch (Exception $e) { + drupal_set_message(t('Error getting content model stream for mime types @e', array('@e' => check_plain($e->getMessage()))), 'error'); + return; + } + foreach ($xml->mimetypes->type as $type) { + $types[] = $type; + } + return $types; + } + + /** + * Grabs the rules from the content model stream + * file the file that has been uploaded + * + * @param type $file + * @param type $mimetype + * @param type $pid + * @param type $dsid + * @return type + */ + function getAndDoRules($file, $mimetype, $pid, $dsid) { + if (!user_access('ingest new fedora objects')) { + drupal_set_message(t('You do not have permission to ingest objects.')); + return FALSE; + } + + $stream = $this->getContentModelStream($pid, $dsid); + + try { + $xml = new SimpleXMLElement($stream); + } catch (Exception $e) { + drupal_set_message(t('Error getting content model stream @e', array('@e' => check_plain($e->getMessage()))), 'error'); + return FALSE; + } + foreach ($xml->ingest_rules->rule as $rule) { + foreach ($rule->applies_to as $type) { + if (!strcmp(trim($type), trim($mimetype))) { + $methods = $rule->methods->method; + return $this->callMethods($file, $methods); + } + } + } + } + + /** + * calls the methods defined in the content model rules .xml file stored in a Fedora object + * + * @param type $file + * @param type $methods + * @return type + */ + function callMethods($file, $methods) { + foreach ($methods as $method) { + $phpFile = strip_tags($method->file->asXML()); + $phpClass = strip_tags($method->class_name->asXML()); + $phpMethod = strip_tags($method->method_name->asXML()); + $file_ext = strip_tags($method->modified_files_ext->asXML()); + $parameters = $method->parameters->parameter; + $dsid = strip_tags($method->datastream_id); + $parametersArray = array(); + if (isset($parameters)) { + foreach ($parameters as $parameter) { + $name = strip_tags($parameter['name']); + $value = strip_tags($parameter->asXML()); + $parametersArray["$name"] = $value; + } + } + // module_load_include( $phpFile, 'Fedora_Repository', ' '); + require_once(drupal_get_path('module', 'fedora_repository') . '/' . $phpFile); + $thisClass = new $phpClass (); + $returnValue = $thisClass->$phpMethod($parametersArray, $dsid, $file, $file_ext); + if (!$returnValue) { + drupal_set_message(t('Error! Failed running content model method !m !rv', array('!m' => $phpMethod, '!rv' => $returnValue))); + return FALSE; + } + } + return TRUE; + } + + /** + * grabs a xml form definition from a content model and builds + * the form using drupals forms api + * + * @param type $form + * @param type $form_state + * @param type $contentModelPid + * @param type $contentModelDsid + * @return type + */ + function build_ingest_form(&$form, &$form_state, $contentModelPid, $contentModelDsid) { + $stream = $this->getContentModelStream($contentModelPid, $contentModelDsid); + try { + $xml = new SimpleXMLElement($stream); + } catch (Exception $e) { + drupal_set_message(t('Error getting ingest form stream @e', array('@e' => check_plain($e->getMessage()))), 'error'); + return FALSE; + } + $docRoot = $_SERVER['DOCUMENT_ROOT']; + + $file = (isset($form_state['values']['ingest-file-location']) ? $form_state['values']['ingest-file-location'] : ''); + // $fullPath = $docRoot . '' . $file; + $fullpath = $file; + // $form = array(); + $form['step'] = array( + '#type' => 'hidden', + '#value' => (isset($form_state['values']['step']) ? $form_state['values']['step'] : 0) + 1, + ); + $form['ingest-file-location'] = array( + '#type' => 'hidden', + '#value' => $file, + ); + + $form['content_model_name'] = array( + '#type' => 'hidden', + '#value' => $contentModelDsid + ); + $form['models'] = array(//content models available + '#type' => 'hidden', + '#value' => $form_state['values']['models'], + ); + $form['fullpath'] = array( + '#type' => 'hidden', + '#value' => $fullpath, + ); + + $form['#attributes']['enctype'] = 'multipart/form-data'; + $form['indicator']['ingest-file-location'] = array( + '#type' => 'file', + '#title' => t('Upload Document'), + '#size' => 48, + '#description' => t('Full text'), + ); + if ($xml->ingest_form->hide_file_chooser == 'TRUE') { + $form['indicator']['ingest-file-location']['#type'] = 'hidden'; + } + $ingest_form = $xml->ingest_form; //should only be one + $drupal_module = strip_tags($ingest_form->form_builder_method->module->asXML()); + if (empty($drupal_module)) { + $drupal_module = 'fedora_repository'; + } + $phpFile = strip_tags($ingest_form->form_builder_method->file->asXML()); + $phpClass = strip_tags($ingest_form->form_builder_method->class_name->asXML()); + $phpMethod = strip_tags($ingest_form->form_builder_method->method_name->asXML()); + $dsid = strip_tags($ingest_form['dsid']); + // module_load_include('php', 'Fedora_Repository', $phpFile); + require_once(drupal_get_path('module', $drupal_module) . '/' . $phpFile); + $thisClass = new $phpClass (); + + return $thisClass->$phpMethod($form, $ingest_form, $form_state['values'], $form_state); + } + + /** + * this will also create a personal collection for an existing user if they don't have one + * not using this function currently + * + * @param type $user + * @return type + */ + function createUserCollection(& $user) { + if (isset($user->fedora_personal_pid)) { + return; + } + $username = array( + 'name' => variable_get('fedora_admin_user', 'fedoraAdmin') + ); + $admin_user = user_load($username); + module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); + $connectionHelper = new ConnectionHelper(); + try { + $soapClient = $connectionHelper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/wsdl?api=API-M')); + $pidNameSpace = variable_get('fedora_repository_pid', 'vre:'); + $pidNameSpace = substr($pidNameSpace, 0, strpos($pidNameSpace, ":")); + $params = array( + 'numPIDs' => '', + 'pidNamespace' => $pidNameSpace + ); + $object = $soapClient->__soapCall('getNextPID', array( + $params + )); + } catch (exception $e) { + drupal_set_message(t('Error getting Next PID: @e', array('@e' => check_plain($e->getMessage()))), 'error'); + return FALSE; + } + $pid = implode(get_object_vars($object)); + $pidNumber = strstr($pid, ":"); + $pid = $pidNameSpace . ':' . 'USER-' . $user->name . '-' . substr($pidNumber, 1); + $personal_collection_pid = array( + 'fedora_personal_pid' => $pid + ); + module_load_include('inc', 'fedora_repository', 'plugins/PersonalCollectionClass'); + $personalCollectionClass = new PersonalCollectionClass(); + if (!$personalCollectionClass->createCollection($user, $pid, $soapClient)) { + drupal_set_message(t("Did not create a personal collection object for !u", array('!u' => $user->name))); + return FALSE; //creation failed don't save the collection pid in drupal db + } + user_save($user, $personal_collection_pid); + return TRUE; + } + + /** + * Queries a collection object for an xslt to format how the + * collection of objects is displayed. + * + * @param type $pid + * @param type $path + * @param type $canUseDefault + * @return type + */ + function getXslContent($pid, $path, $canUseDefault = TRUE) { + module_load_include('inc', 'fedora_repository', 'CollectionClass'); + $collectionClass = new CollectionClass(); + $xslContent = $collectionClass->getCollectionViewStream($pid); + + //If there's no XSLT from the object, then check if the one which used to exist, does... + if (!$xslContent && $canUseDefault && file_exists($path . '/xsl/sparql_to_html.xsl')) { + $xslContent = file_get_contents($path . '/xsl/sparql_to_html.xsl'); + } + + return $xslContent; + } + + /** + * show field sets ? + * @global type $base_url + * @global type $user + * @param type $page_number + * @return string + */ + function showFieldSets($page_number) { + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); + //module_load_include('inc', 'fedora_repository', 'BatchIngest'); //Legacy code? + global $base_url; + global $user; + + $tabset = array(); + $query = NULL; + $item = new Fedora_Item($this->pid); + if ($item->exists() && array_key_exists('QUERY', $item->datastreams)) { + $query = $item->get_datastream_dissemination('QUERY'); + } + $results = $this->getRelatedItems($this->pid, $query); + + $collection_items = $this->renderCollection($results, $this->pid, NULL, NULL, $page_number); + + $show_batch_tab = FALSE; + $policy = CollectionPolicy::loadFromCollection($this->pid, TRUE); + + if (!empty($policy)) { + $content_models = $policy->getContentModels(); + } + if (count($content_models) == 1 && $content_models[0]->pid == "islandora:collectionCModel") { + $show_batch_tab = FALSE; + } + + // Check the form post to see if we are in the middle of an ingest operation. + $add_selected = ((!empty($_POST['form_id']) && $_POST['form_id'] == 'fedora_repository_ingest_form') || !$collection_items); + $view_selected = !$add_selected; + + $tabset['view_tab'] = array( + '#type' => 'tabpage', + '#title' => t('View'), + '#selected' => $view_selected, + '#content' => $collection_items, + '#tab_name' => 'view-tab', + ); + + $add_to_collection = $this->getIngestInterface(); + if (!empty($add_to_collection)) { + $tabset['add_tab'] = array( + '#type' => 'tabpage', + '#title' => t('Add'), + '#selected' => $add_selected, + // This will be the content of the tab. + '#content' => $add_to_collection, + '#tab_name' => 'add-tab', + ); + } + + return $tabset; + } + + /** + * get Ingest Interface ?? + * @global type $base_url + * @return string + */ + function getIngestInterface() { + module_load_include('inc', 'Fedora_Repository', 'CollectionPolicy'); + $collectionPolicyExists = $this->collectionObject->getMimeType($this->pid, CollectionPolicy::getDefaultDSID()); + if (user_access(ObjectHelper :: $INGEST_FEDORA_OBJECTS) && $collectionPolicyExists) { + if (!empty($collectionPolicyExists)) { + $allow = TRUE; + if (module_exists('fedora_fesl')) { + $allow = fedora_fesl_check_roles($this->pid, 'write'); + } + if ($allow) { + $ingestObject = drupal_get_form('fedora_repository_ingest_form', $this->pid); + } + } + } + else { + $ingestObject = ''; + } + + return $ingestObject; + } + + /** + * Unfortunate function, I know... + * + * Does just what it says: Hacks the default Drupal pager such that it might + * be rendered, likely with: theme('pager', array(), $per_page, $pager_name) + * (I reccomend seeing the real documentation for more detail, but the first + * array can be a list of the tags to use for first, previous, next and last + * (text in the pager), I don't believe per_page is actually used in the theme + * function, and $pager_name is an integer used to identify the pager (such + * that there can be more than one--that is, tracking different lists of + * content on a single page. You can render the exact same pager multiple + * times, say if you want one at the top and bottom of a list, using the same + * ID/pager_name. + * + * @global $pager_total array + * Numerically indexed array, where keys are the $pager_names and values + * are the number of pages in the given set, based on: ceil($total_items/$per_page); + * @global $pager_page_array array + * Numerically indexed array, where keys are the $pager_names and values + * are the page selected in the relevant set. + * @param $pager_name int + * An integer to identify the pager to affect. Do note that paging in using + * this function will add the 'page' HTTP GET parameter to the URL, with + * the value containing a comma-separated list with max($pager_name + 1) + * values--that is, if you create a single pager named '10', the 'next' + * link will look something like: 0,0,0,0,0,0,0,0,0,0,1 + * @param $per_page int + * An integer representing the number of items per page. + * @param $total_items int + * An integer representing the total number of items in the set. + * @return int + * An integer representing what the current page should be. + */ + protected static function hackPager($pager_name, $per_page = NULL, $total_items = NULL) { + global $pager_total, $pager_page_array; + + if ($per_page !== NULL && $total_items !== NULL) { + $pager_total[$pager_name] = ceil($total_items / $per_page); + } + + //XXX: Don't know that this is neccessary, to try to load all the time, or + // whether Drupal will load it automatically somewhere... Docs seems a + // a little sparse. + $page_info = explode(',', isset($_GET['page']) ? $_GET['page'] : ''); + $page = $page_info[$pager_name]; + if ($page < 0) { + $page = 0; + } + + if (!isset($pager_page_array)) { + $pager_page_array = pager_load_array($page, $pager_name, $page_info); + } + else { + $pager_page_array = pager_load_array($page, $pager_name, $pager_page_array); + } + + $page = $pager_page_array[$pager_name]; + return $page; + } + + /** + * render collection + * @global type $base_url + * @param type $content + * @param type $pid + * @param type $dsId + * @param type $collection + * @param int $pageNumber + * @return type + */ + function renderCollection($content, $pid, $dsId, $collectionName, $pageNumber = NULL) { + $path = drupal_get_path('module', 'fedora_repository'); + global $base_url; + $collection_pid = $pid; //we will be changing the pid later maybe + $parsedContent = NULL; + $contentModels = $this->collectionObject->get_content_models_list($pid); + $isCollection = FALSE; + //if this is a collection object store the $pid in the session as it will come in handy + //after a purge or ingest to return to the correct collection. + + $fedoraItem = NULL; + + if (empty($collectionName)) { + $collectionName = menu_get_active_title(); + } + + $xslContent = $this->getXslContent($pid, $path); + + $objectList = ''; + if (isset($content) && $content != FALSE) { + if (!$xslContent) { //Didn't find an XSLT. + $intermediate_results = ObjectHelper::parse_sparql_results($content); + unset($content); + + $per_page = 20; //XXX: Make this configurable. + $pager_name = 0; + $total = count($intermediate_results); + $pager_page = self::hackPager($pager_name, $per_page, $total); + + $results = array(); + foreach (array_slice($intermediate_results, $per_page * $pager_page, $per_page) as $result) { + $title = $result['title']; + $obj_path = "fedora/repository/{$result['object']}"; + $thumbnail = theme('image', "$obj_path/TN", $title, $title, array(), FALSE); + $results[] = array( + 'data' => l($thumbnail, $obj_path, array( + 'html' => TRUE, + 'attributes' => array( + 'class' => 'results-image', + ), + )) . l($title, $obj_path, array('attributes' => array('class' => 'results-text'))), + ); + } + if (!$results) { + drupal_set_message(t("No objects in this collection (or bad query).")); + } + else { + $first = $per_page * $pager_page; + $last = (($total - $first) > $per_page)? + ($first + $per_page): + $total; + $results_range_text = t('Results @first to @last of @total', array( + '@first' => $first + 1, + '@last' => $last, + '@total' => $total, + )); + //$objectList = '

' . $results_range_text . '

'; + $objectList .= theme('pager', array(), $per_page, $pager_name); + $objectList .= theme('item_list', $results, $result_range_text, 'ul', array( + 'class' => 'islandora-collection-results-list', + )); + $objectList .= theme('pager', array(), $per_page, $pager_name); + } + } + else { + if (!$pageNumber) { + $pageNumber = 1; + } + + //get collection list and display using xslt------------------------------------------- + $input = new DomDocument(); + $input->loadXML(trim($content)); + $results = $input->getElementsByTagName('result'); + if ($results->length > 0) { + try { + $proc = new XsltProcessor(); + $options = array( //Could make this the return of a hook? + 'collectionPid' => $collection_pid, + 'collectionTitle' => $collectionName, + 'baseUrl' => $base_url, + 'path' => "$base_url/$path", + 'hitPage' => $pageNumber, + ); + + $proc->setParameter('', $options); + + $proc->registerPHPFunctions(); + $xsl = new DomDocument(); + $xsl->loadXML($xslContent); + // php xsl does not seem to work with namespaces so removing it below + // I may have just been being stupid here + // $content = str_ireplace('xmlns="http://www.w3.org/2001/sw/DataAccess/rf1/result"', '', $content); + + $xsl = $proc->importStylesheet($xsl); + $newdom = $proc->transformToDoc($input); + + $objectList = $newdom->saveHTML(); //is the xml transformed to html as defined in the xslt associated with the collection object + + if (!$objectList) { + throw new Exception("Invalid XML."); + } + } catch (Exception $e) { + drupal_set_message(check_plain($e->getMessage()), 'error'); + return ''; + } + } + } + } + else { + drupal_set_message(t("No objects in this collection (or bad query).")); + } + return $objectList; + } + +} + diff --git a/CollectionPolicy.inc b/CollectionPolicy.inc index 8997b42e..71d95a6c 100644 --- a/CollectionPolicy.inc +++ b/CollectionPolicy.inc @@ -1,16 +1,20 @@ get_datastream_dissemination($dsid); - } else { - $ds=null; + if (array_key_exists($dsid, $fedoraItem->get_datastreams_list_as_array())) { + $ds = $fedoraItem->get_datastream_dissemination($dsid); + } + else { //No collection policy stream (of the default name, anyway) + return FALSE; + } + } + else { + $ds = NULL; } - } - + if (!empty($ds) || !$preFetch) { - $ret=new CollectionPolicy($ds, $pid, $dsid); + $ret = new CollectionPolicy($ds, $pid, $dsid); } - } - catch (SOAPException $e) { - + } catch (SOAPException $e) { $ret = FALSE; } return $ret; } - + /** * Ingests a new Collection Policy datastream to the specified * PID with the DSID specified. The file should be a valid collection - * policy XML. Returns false on failure. + * policy XML. Returns FALSE on failure. * * @param string $pid * @param string $name * @param string $cpDsid * @param string $file * @return CollectionPolicy $ret - */ + */ public static function ingestFromFile($pid, $name, $cpDsid, $file) { $ret = FALSE; - + if (($cp = self::loadFromCollection($pid, $cpDsid)) === FALSE && file_exists($file)) { $cp = new ContentModel(file_get_contents($file), $pid, $cpDsid); $rootEl = $cp->xml->getElementsByTagName('collection_policy')->item(0); $rootEl->setAttribute('name', $name); - + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $fedoraItem = new Fedora_Item($pid); $fedoraItem->add_datastream_from_string($cp->dumpXml(), $cpDsid, $name, 'text/xml', 'X'); $ret = $cp; } - + return $ret; } - + /** * Ingests a new Collection Policy datastream to the specified * PID with the DSID specified. Clones the collection policy from the - * source collection pid. Returns false on failure. + * source collection pid. Returns FALSE on failure. * * @param string $pid * @param string $name * @param string $cpDsid * @param string $copy_collection_pid * @return CollectionPolicy $ret - */ + */ public static function ingestFromCollection($pid, $name, $cpDsid, $copy_collection_pid) { $ret = FALSE; - + if (($cp = self::loadFromCollection($pid, $cpDsid)) === FALSE && ($copy_cp = self::loadFromCollection($copy_collection_pid)) !== FALSE && $copy_cp->validate()) { $newDom = $copy_cp->xml; $rootEl = $newDom->getElementsByTagName('collection_policy')->item(0); $rootEl->setAttribute('name', $name); - + $cp = new CollectionPolicy($newDom, $pid, $cpDsid); - + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $fedoraItem = new Fedora_Item($pid); $fedoraItem->add_datastream_from_string($cp->dumpXml(), $cpDsid, $name, 'text/xml', 'X'); $ret = $cp; } - + return $ret; - } - + } + /** * Ingests a new minimum Collection Policy datastream to the specified * PID with the DSID specified. Initializes the policy with the specified values. - * Returns false on failure + * Returns FALSE on failure * * @param string $pid * @param string $name @@ -130,10 +137,10 @@ class CollectionPolicy extends XMLDatastream { * @param string $searchField * @param string $searchValue * @return CollectionPolicy $ret - */ + */ public static function ingestBlankPolicy($pid, $name, $policyDsid, $model_pid, $model_namespace, $relationship, $searchField, $searchValue) { - $ret = FALSE; - if (($cp = self::loadFromCollection($pid )) === FALSE) { //removed second, non-existant variable + $ret = FALSE; + if (($cp = self::loadFromCollection($pid)) === FALSE) { //removed second, non-existant variable module_load_include('inc', 'fedora_repository', 'ContentModel'); if (($cm = ContentModel::loadFromModel($model_pid)) !== FALSE && $cm->validate()) { $newDom = new DOMDocument('1.0', 'utf-8'); @@ -142,45 +149,43 @@ class CollectionPolicy extends XMLDatastream { $rootEl->setAttribute('name', $name); $rootEl->setAttribute('xmlns', self::$XMLNS); $rootEl->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); - $rootEl->setAttribute('xsi:schemaLocation', self::$XMLNS .' '. self::$SCHEMA_URI); - + $rootEl->setAttribute('xsi:schemaLocation', self::$XMLNS . ' ' . self::$SCHEMA_URI); + $modelsEl = $newDom->createElement('content_models'); - + $cmEl = $newDom->createElement('content_model'); $cmEl->setAttribute('name', $cm->getName()); $cmEl->setAttribute('dsid', $cm->dsid); $cmEl->setAttribute('namespace', $model_namespace); $cmEl->setAttribute('pid', $cm->pid); - - $modelsEl->appendChild($cmEl); + + $modelsEl->appendChild($cmEl); $rootEl->appendChild($modelsEl); - + $relEl = $newDom->createElement('relationship', $relationship); $rootEl->appendChild($relEl); - + $searchTermsEl = $newDom->createElement('search_terms'); $newTermEl = $newDom->createElement('term', $searchValue); $newTermEl->setAttribute('field', $searchField); $searchTermsEl->appendChild($newTermEl); $rootEl->appendChild($searchTermsEl); - + $newDom->appendChild($rootEl); - + $cp = new CollectionPolicy($newDom, $pid, $policyDsid); - + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - - + + $fedoraItem = new Fedora_Item($pid); $fedoraItem->add_datastream_from_string($cp->dumpXml(), $policyDsid, $name, 'text/xml', 'X'); $ret = $cp; } - } - + return $ret; - } - + } /** * Constructor @@ -192,10 +197,10 @@ class CollectionPolicy extends XMLDatastream { * @return XMLDatastream $cm */ public function __construct($xmlStr, $pid = NULL, $dsid = NULL) { - parent::__construct($xmlStr,$pid,$dsid); - $this->name= 'Collection Policy'; + parent::__construct($xmlStr, $pid, $dsid); + $this->name = 'Collection Policy'; } - + /** * Attempts to convert from the old XML schema to the new by * traversing the XML DOM and building a new DOM. When done @@ -205,17 +210,17 @@ class CollectionPolicy extends XMLDatastream { */ protected function convertFromOldSchema() { if ($this->xml == NULL) { - $this->fetchXml(); + $this->fetchXml(); } $sXml = simplexml_load_string($this->xml->saveXML()); $newDom = new DOMDocument('1.0', 'utf-8'); $newDom->formatOutput = TRUE; - + $rootEl = $newDom->createElement('collection_policy'); $rootEl->setAttribute('name', $sXml['name']); $rootEl->setAttribute('xmlns', self::$XMLNS); $rootEl->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); - $rootEl->setAttribute('xsi:schemaLocation', self::$XMLNS .' '. self::$SCHEMA_URI); + $rootEl->setAttribute('xsi:schemaLocation', self::$XMLNS . ' ' . self::$SCHEMA_URI); $content_modelsEl = $newDom->createElement('content_models'); foreach ($sXml->contentmodels->contentmodel as $contentmodel) { @@ -227,13 +232,13 @@ class CollectionPolicy extends XMLDatastream { $content_modelsEl->appendChild($content_modelEl); } $rootEl->appendChild($content_modelsEl); - + $search_termsEl = $newDom->createElement('search_terms'); foreach ($sXml->search_terms->term as $term) { $termEl = $newDom->createElement('term', $term->value); $termEl->setAttribute('field', $term->field); if (strval($sXml->search_terms->default) == $term->field) { - $termEl->setAttribute('default', 'true'); + $termEl->setAttribute('default', 'TRUE'); } $search_termsEl->appendChild($termEl); } @@ -241,13 +246,12 @@ class CollectionPolicy extends XMLDatastream { $relationshipEl = $newDom->createElement('relationship', $sXml->relationship); $rootEl->appendChild($relationshipEl); - - $newDom->appendChild($rootEl); - $this->xml = DOMDocument::loadXML($newDom->saveXml()); + $newDom->appendChild($rootEl); + $this->xml = new DOMDocument(); + $this->xml->loadXML($newDom->saveXml()); } - /** * Gets the name of the relationship to use * for members of this collection. @@ -256,14 +260,14 @@ class CollectionPolicy extends XMLDatastream { * @return string $relationship */ public function getRelationship() { - $ret=FALSE; + $ret = FALSE; if ($this->validate()) { - $ret=trim($this->xml->getElementsByTagName('relationship')->item(0)->nodeValue); + $ret = trim($this->xml->getElementsByTagName('relationship')->item(0)->nodeValue); } return $ret; } - - /** + + /** * Sets the name of the relationship to use * for members of this collection. * Returns FALSE on failure. @@ -272,16 +276,16 @@ class CollectionPolicy extends XMLDatastream { * @return boolean $ret */ public function setRelationship($relationship) { - $ret=FALSE; + $ret = FALSE; if ($this->validate()) { - $relationshipEl=$this->xml->getElementsByTagName('relationship')->item(0); - $relationshipEl->nodeValue=trim($relationship); + $relationshipEl = $this->xml->getElementsByTagName('relationship')->item(0); + $relationshipEl->nodeValue = trim($relationship); $ret = TRUE; } - return $ret; + return $ret; } - - /** + + /** * Gets the path to the staging area to use for this * collection. By default recurses to the parent collection * if the staging area is undefined @@ -290,17 +294,18 @@ class CollectionPolicy extends XMLDatastream { * @return string $path */ public function getStagingArea($recurse=TRUE) { - $ret=FALSE; + $ret = FALSE; if ($this->validate()) { if ($this->staging_area === NULL) { - $stagingEl=$this->xml->getElementsByTagName('staging_area'); - + $stagingEl = $this->xml->getElementsByTagName('staging_area'); + if ($stagingEl->length > 0) { $this->staging_area = trim($stagingEl->item(0)->nodeValue); - } elseif ($recurse) { + } + elseif ($recurse) { module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - $item=new Fedora_Item($this->pid); - $rels=$item->get_relationships(); + $item = new Fedora_Item($this->pid); + $rels = $item->get_relationships(); if (count($rels) > 0) { foreach ($rels as $rel) { $cp = CollectionPolicy::loadFromCollection($rel['object']); @@ -310,18 +315,17 @@ class CollectionPolicy extends XMLDatastream { } } } - } + } } - + $ret = $this->staging_area; - } return $ret; } - - /** + + /** * Sets the path to the staging area to use for this - * collection. If specified path is blank (or false) it will + * collection. If specified path is blank (or FALSE) it will * remove the staging are path element from the collection policy. * * @param string $path @@ -329,84 +333,81 @@ class CollectionPolicy extends XMLDatastream { * @return string $relationship */ public function setStagingArea($path) { - $ret=FALSE; + $ret = FALSE; if ($this->validate()) { - $rootEl=$this->xml->getElementsByTagName('collection_policy')->item(0); - $stagingEl=$this->xml->getElementsByTagName('staging_area'); + $rootEl = $this->xml->getElementsByTagName('collection_policy')->item(0); + $stagingEl = $this->xml->getElementsByTagName('staging_area'); if ($stagingEl->length > 0) { - $stagingEl=$stagingEl->item(0); - if (trim($path) == '') { - $rootEl->removeChild($stagingEl); - } + $stagingEl = $stagingEl->item(0); + if (trim($path) == '') { + $rootEl->removeChild($stagingEl); + } else { - $stagingEl->nodeValue=trim($path); - } - } + $stagingEl->nodeValue = trim($path); + } + } elseif (trim($path) != '') { - $stagingEl=$this->xml->createElement('staging_area', trim($path)); - $rootEl->appendChild($stagingEl); + $stagingEl = $this->xml->createElement('staging_area', trim($path)); + $rootEl->appendChild($stagingEl); } $ret = TRUE; } - return $ret; - } - - + return $ret; + } + /** - * Gets the next available PID for the - * content model specified by the DSID - * parameter. - * - * @param string $dsid - * @return string $nextPid - */ - public function getNextPid($dsid) { + * Gets the next available PID for the + * content model specified by the DSID + * parameter. + * + * @param string $dsid + * @return string $nextPid + */ + public function getNextPid($dsid, $content_model = null) { $ret = FALSE; - if (self::validDsid($dsid) && $this->validate()) { + + if (self::valid_dsid($dsid) && $this->validate()) { $content_models = $this->xml->getElementsByTagName('content_models')->item(0)->getElementsByTagName('content_model'); $namespace = FALSE; - for ($i=0; $namespace === FALSE && $i<$content_models->length;$i++) { - if (strtolower($content_models->item($i)->getAttribute('dsid')) == strtolower($dsid)) { + for ($i = 0; $namespace === FALSE && $i < $content_models->length; $i++) { + if (strtolower($content_models->item($i)->getAttribute('dsid')) == strtolower($dsid) && (strtolower($content_models->item($i)->getAttribute('pid') == $content_model) || $content_model == null)) { $namespace = $content_models->item($i)->getAttribute('namespace'); } } $pname = substr($namespace, 0, strpos($namespace, ":")); - + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $ret = Fedora_Item::get_next_pid_in_namespace($pname); } return $ret; } - + /** - * Gets a list of ContentModel objects supported by this collection. - * - * @return ContentModel[] $models - */ + * Gets a list of ContentModel objects supported by this collection. + * + * @return ContentModel[] $models + */ function getContentModels() { - $ret=FALSE; + $ret = FALSE; if ($this->validate()) { module_load_include('inc', 'Fedora_Repository', 'ContentModel'); - $ret=array(); + $ret = array(); $content_models = $this->xml->getElementsByTagName('content_models')->item(0)->getElementsByTagName('content_model'); - for ($i=0;$i<$content_models->length;$i++) { - $cm=ContentModel::loadFromModel($content_models->item($i)->getAttribute('pid'), - $content_models->item($i)->getAttribute('dsid'), - $content_models->item($i)->getAttribute('namespace'), - $content_models->item($i)->getAttribute('name')); - if ($cm !== FALSE) { - $ret[]=$cm; - } - + for ($i = 0; $i < $content_models->length; $i++) { + $cm = ContentModel::loadFromModel($content_models->item($i)->getAttribute('pid'), + $content_models->item($i)->getAttribute('dsid'), + $content_models->item($i)->getAttribute('namespace'), + $content_models->item($i)->getAttribute('name')); + if ($cm !== FALSE) { + $ret[] = $cm; + } } } return $ret; } - - /** * Gets a list of search terms from the Collection Policy. If asArray is set * it will return an associative array with the value, field name, and the default value. @@ -421,52 +422,52 @@ class CollectionPolicy extends XMLDatastream { */ function getSearchTerms($asArray = FALSE, $recurse = FALSE, $cache = FALSE) { $ret = FALSE; - - if ($cache == TRUE && ($cache = cache_get('collection_policy_search_terms-'.$this->pid)) !== 0 ) { - $ret=$cache->data; - } else { - + + if ($cache == TRUE && ($cache = cache_get('collection_policy_search_terms-' . $this->pid)) !== 0) { + $ret = $cache->data; + } + else { + if ($this->xml == NULL) { - $fedoraItem = new Fedora_Item($this->pid); - $ds = $fedoraItem->get_datastream_dissemination($this->dsid); - $this->xml = DOMDocument::loadXML($ds); + $fedoraItem = new Fedora_Item($this->pid); + $ds = $fedoraItem->get_datastream_dissemination($this->dsid); + $this->xml = new DOMDocument(); + $this->xml->loadXML($ds); } - + if ($this->validate()) { - $ret=array(); - $terms= $this->xml->getElementsByTagName('search_terms')->item(0)->getElementsByTagName('term'); - for ($i=0;$i<$terms->length;$i++) { - $default = $terms->item($i)->attributes->getNamedItem('default'); - $default = ($default !== NULL) ? (strtolower($default->nodeValue) == 'true') : FALSE; - $ret[] = ($asArray)?array( 'value' => $terms->item($i)->nodeValue, - 'field' => $terms->item($i)->getAttribute('field'), - 'default' => $default): $terms->item($i)->nodeValue; - } - - - if ($recurse && count($ret) == 0) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - $item=new Fedora_Item($this->pid); - $rels=$item->get_relationships(); - if (count($rels) > 0) { - foreach ($rels as $rel) { - $cp = CollectionPolicy::loadFromCollection($rel['object']); - if ($cp !== FALSE) { - $ret = $cp->getSearchTerms($asArray, $recurse); - break; - } - } - } - } - cache_set('collection_policy_search_terms-'.$this->pid, $ret, 'cache', time()+3600); - + $ret = array(); + $terms = $this->xml->getElementsByTagName('search_terms')->item(0)->getElementsByTagName('term'); + for ($i = 0; $i < $terms->length; $i++) { + $default = $terms->item($i)->attributes->getNamedItem('default'); + $default = ($default !== NULL) ? (strtolower($default->nodeValue) == 'TRUE') : FALSE; + $ret[] = ($asArray) ? array('value' => $terms->item($i)->nodeValue, + 'field' => $terms->item($i)->getAttribute('field'), + 'default' => $default) : $terms->item($i)->nodeValue; + } + + + if ($recurse && count($ret) == 0) { + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + $item = new Fedora_Item($this->pid); + $rels = $item->get_relationships(); + if (count($rels) > 0) { + foreach ($rels as $rel) { + $cp = CollectionPolicy::loadFromCollection($rel['object']); + if ($cp !== FALSE) { + $ret = $cp->getSearchTerms($asArray, $recurse); + break; + } + } + } + } + cache_set('collection_policy_search_terms-' . $this->pid, $ret, 'cache', time() + 3600); } } return $ret; } - /** * Adds a search term to the collection policy. * Returns fase on failure. @@ -476,17 +477,17 @@ class CollectionPolicy extends XMLDatastream { * @return boolean $success */ function addTerm($field, $value) { - $ret=FALSE; + $ret = FALSE; if ($this->validate()) { $search_termsEl = $this->xml->getElementsByTagName('search_terms')->item(0); - $terms= $search_termsEl->getElementsByTagName('term'); - $found=FALSE; - for ($i=0;!$found && $i<$terms->length;$i++) { + $terms = $search_termsEl->getElementsByTagName('term'); + $found = FALSE; + for ($i = 0; !$found && $i < $terms->length; $i++) { if ($terms->item($i)->getAttribute('field') == $field) { - $found = TRUE; + $found = TRUE; } } - + if (!$found) { $newTermEl = $this->xml->createElement('term', $value); $newTermEl->setAttribute('field', $field); @@ -502,19 +503,19 @@ class CollectionPolicy extends XMLDatastream { * * @param string $field * @return boolean $success - */ + */ function removeTerm($field) { - $ret=FALSE; + $ret = FALSE; if ($this->validate()) { $search_termsEl = $this->xml->getElementsByTagName('search_terms')->item(0); $terms = $search_termsEl->getElementsByTagName('term'); $found = FALSE; - for ($i=0; !$found && $i < $terms->length; $i++) { + for ($i = 0; !$found && $i < $terms->length; $i++) { if ($terms->item($i)->getAttribute('field') == $field) { - $found = $terms->item($i); + $found = $terms->item($i); } } - + if ($found !== FALSE) { $search_termsEl->removeChild($found); $ret = TRUE; @@ -523,53 +524,56 @@ class CollectionPolicy extends XMLDatastream { return $ret; } - - function setDefaultTerm($field) { + /** + * setDefaultTerm ?? + * @param type $field + * @return boolean + */ + function setDefaultTerm($field) { $ret = FALSE; if ($this->validate()) { $search_termsEl = $this->xml->getElementsByTagName('search_terms')->item(0); - $terms= $search_termsEl->getElementsByTagName('term'); - $found=FALSE; - for ($i=0;!$found && $i<$terms->length;$i++) { + $terms = $search_termsEl->getElementsByTagName('term'); + $found = FALSE; + for ($i = 0; !$found && $i < $terms->length; $i++) { if ($terms->item($i)->getAttribute('field') == $field) { - $found = $terms->item($i); + $found = $terms->item($i); } } - + if ($found !== FALSE) { - for ($i=0;$i<$terms->length;$i++) + for ($i = 0; $i < $terms->length; $i++) if ($terms->item($i)->attributes->getNamedItem('default') !== NULL) { $terms->item($i)->removeAttribute('default'); } - $found->setAttribute('default', 'true'); + $found->setAttribute('default', 'TRUE'); $ret = TRUE; } } return $ret; } - - + /** * Removes the specified content model from the collection policy. This will only * prevent future ingests of the removed model to the collection. $cm should be - * a valid ContentModel object. Returns false on failure or when the CM was not found in + * a valid ContentModel object. Returns FALSE on failure or when the CM was not found in * the collection policy. * * @param ContentModel $cm * @return boolean $valid */ function removeModel($cm) { - $ret=FALSE; + $ret = FALSE; if ($this->validate() && $cm->validate()) { $contentmodelsEl = $this->xml->getElementsByTagName('content_models'); $models = $contentmodelsEl->item(0)->getElementsByTagName('content_model'); $found = FALSE; - for ($i=0; $found === FALSE && $i < $models->length; $i++) { + for ($i = 0; $found === FALSE && $i < $models->length; $i++) { if ($models->item($i)->getAttribute('pid') == $cm->pid) { - $found=$models->item($i); + $found = $models->item($i); } - } - + } + if ($found !== FALSE && $models->length > 1) { $contentmodelsEl->item(0)->removeChild($found); $ret = TRUE; @@ -577,21 +581,24 @@ class CollectionPolicy extends XMLDatastream { } return $ret; } - - - + /** + * addModel ?? + * @param ContentModel $cm + * @param type $namespace + * @return type + */ function addModel($cm, $namespace) { $ret = FALSE; - if (self::validPid($namespace) && $this->validate() && $cm->validate()) { + if (self::valid_pid($namespace) && $this->validate() && $cm->validate()) { $contentmodelsEl = $this->xml->getElementsByTagName('content_models'); $models = $contentmodelsEl->item(0)->getElementsByTagName('content_model'); $found = FALSE; - for ($i=0;!$found && $i<$models->length;$i++) { + for ($i = 0; !$found && $i < $models->length; $i++) { if ($models->item($i)->getAttribute('pid') == $cm->pid) $found = TRUE; } - + if (!$found) { $cmEl = $this->xml->createElement('content_model'); $cmEl->setAttribute('name', $cm->getName()); @@ -600,16 +607,20 @@ class CollectionPolicy extends XMLDatastream { $cmEl->setAttribute('pid', $cm->pid); $contentmodelsEl->item(0)->appendChild($cmEl); } - + $ret = !$found; } return $ret; } - + + /** + * getName ?? + * @return type + */ function getName() { - $ret=FALSE; + $ret = FALSE; if ($this->validate()) { - $ret=$this->xml->getElementsByTagName('collection_policy')->item(0)->getAttribute('name'); + $ret = $this->xml->getElementsByTagName('collection_policy')->item(0)->getAttribute('name'); } return $ret; } diff --git a/ConnectionHelper.inc b/ConnectionHelper.inc index 68ed4124..a385199c 100644 --- a/ConnectionHelper.inc +++ b/ConnectionHelper.inc @@ -1,75 +1,112 @@ - $url))); - return NULL; - } - - return $new_url; - } - - function getSoapClient($url = NULL, $exceptions = TRUE) { - if (empty($url)) { - $url=variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl'); - } - - global $user; - if ($user->uid == 0) { - //anonymous user. We will need an entry in the fedora users.xml file - //with the appropriate entry for a username of anonymous password of anonymous - try { - $client = new SoapClient($this->_fixURL($url, 'anonymous', 'anonymous'), array( - 'login' => 'anonymous', - 'password' => 'anonymous', - 'exceptions' => $exceptions, - )); - } - catch (SoapFault $e) { - drupal_set_message(t("!e", array('!e' => $e->getMessage()))); - return NULL; - } - } - else { - try { - $client = new SoapClient($this->_fixURL($url, $user->name, $user->pass), array( - 'login' => $user->name, - 'password' => $user->pass, - 'exceptions' => TRUE, - )); - } - catch (SoapFault $e) { - drupal_set_message(t("!e", array('!e' => $e->getMessage()))); - return NULL; - } - } - return $client; - } -} - + $url))); + return NULL; + } + + return $new_url; + } + + /** + * getSoapClient + * @global type $user + * @param type $url + * @param type $exceptions + * @return SoapClient + */ + function getSoapClient($url = NULL, $exceptions = TRUE) { + if (empty($url)) { + $url = variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl'); + } + + global $user; + if ($user->uid == 0) { + //anonymous user. We will need an entry in the fedora users.xml file + //with the appropriate entry for a username of anonymous password of anonymous + try { + $client = new SoapClient($url, array( + 'login' => 'anonymous', + 'password' => 'anonymous', + 'exceptions' => $exceptions, + 'authentication' => SOAP_AUTHENTICATION_BASIC + )); + } catch (SoapFault $e) { + drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage())))); + return NULL; + } + } + else { + try { + $client = new SoapClient($url, array( + 'login' => $user->name, + 'password' => $user->pass, + 'exceptions' => TRUE, + 'authentication' => SOAP_AUTHENTICATION_BASIC, + 'cache_wsdl' => WSDL_CACHE_MEMORY + )); + } catch (SoapFault $e) { + drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage())))); + return NULL; + } + } + if (isset($_SESSION['islandora_soapcookies'])) { + + // just set the cookies + + $client->_cookies = ($_SESSION['islandora_soapcookies']); + } + else { + try { + //we need to make a call to set the cookie this extra call would only happen once per session + $client->__soapCall('describeRepository', array()); + $_SESSION['islandora_soapcookies'] = $client->_cookies; + } catch (exception $e) { + //connection is tested elsewhere so eat this for now here we just want the cookie + } + } + + + return $client; + } + +} + diff --git a/ContentModel.inc b/ContentModel.inc index 9bac23eb..be362c70 100644 --- a/ContentModel.inc +++ b/ContentModel.inc @@ -1,2239 +1,2412 @@ -get_content_models_list($pid); - foreach ($content_models as $content_model) { - if ($content_model != 'fedora-system:FedoraObject-3.0') { - $ret = $content_model; - break; - } - } - } - return $ret; - } - - /** - * Ingests a Content Model from a file to the specified pid/dsid . - * Returns false on failure. - * - * @param string $pid - * @param string $name - * @param string $modelDsid - * @param string $file - * @return ContentModel $cm - */ - public static function ingestFromFile($pid, $name, $modelDsid, $file) { - $ret = FALSE; - - if (($cm = self::loadFromModel($pid, $modelDsid)) === FALSE && file_exists($file)) { - $cm = new ContentModel(file_get_contents($file), $pid, $modelDsid); - $rootEl = $cm->xml->getElementsByTagName('content_model')->item(0); - $rootEl->setAttribute('name', $name); - - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - $fedoraItem = new Fedora_Item($pid); - $fedoraItem->add_datastream_from_string($cm->dumpXml(), $modelDsid, $name, 'text/xml', 'X'); - $ret= $cm; - } - - return $ret; - } - - - /** - * Ingests a Content Model from an existing model to the specified pid/dsid . - * Returns false on failure. - * - * @param string $pid - * @param string $name - * @param string $modelDsid - * @param string $copy_model_pid - * @return ContentModel $cm - */ - public static function ingestFromModel($pid, $name, $modelDsid, $copy_model_pid) { - $ret = FALSE; - - if (($cm = self::loadFromModel($pid, $modelDsid)) === FALSE && ($copy_cm = self::loadFromModel($copy_model_pid)) !== FALSE && $copy_cm->validate()) { - $newDom = $copy_cm->xml; - $rootEl = $newDom->getElementsByTagName('content_model')->item(0); - $rootEl->setAttribute('name', $name); - - $cm = new ContentModel($newDom, $pid, $modelDsid); - - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - $fedoraItem = new Fedora_Item($pid); - $fedoraItem->add_datastream_from_string($cm->dumpXml(), $modelDsid, $name, 'text/xml', 'X'); - $ret = $cm; -} - - return $ret; - } - - - /** - * Ingests a minimum Content Model to the specified pid/dsid. - * Returns false on failure. - * - * @param string $pid - * @param string $name - * @param string $modelDsid - * @param string $defaultMimetype - * @param string $ingestFromDsid - * @param integer $ingestFormPage - * @param boolean $ingestFormHideFileChooser - * @param string $ingestFormModule - * @param string $ingestFormModule - * @param string $ingestFormFile - * @param string $ingestFormClass - * @param string $ingestFormMethod - * @param string $ingestFormHandler - * - * @return ContentModel $cm - */ - public static function ingestBlankModel($pid, $name, $modelDsid, $defaultMimetype, $ingestFormDsid, $ingestFormPage, $ingestFormHideChooser, $ingestFormModule, $ingestFormModule, $ingestFormFile, $ingestFormClass, $ingestFormMethod, $ingestFormHandler) { - $ret = FALSE; - if (($cm = self::loadFromModel($pid, $modelDsid)) === FALSE) { - $newDom = new DOMDocument('1.0', 'utf-8'); - $newDom->formatOutput = TRUE; - $rootEl = $newDom->createElement('content_model'); - $rootEl->setAttribute('name', $name); - $rootEl->setAttribute('xmlns', self::$XMLNS); - $rootEl->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); - $rootEl->setAttribute('xsi:schemaLocation', self::$XMLNS .' '. self::$SCHEMA_URI); - - $mimeEl = $newDom->createElement('mimetypes'); - $typeEl=$newDom->createElement('type', $defaultMimetype); - $mimeEl->appendChild($typeEl); - $rootEl->appendChild($mimeEl); - - $ingestRulesEl = $newDom->createElement('ingest_rules'); - $rootEl->appendChild($ingestRulesEl); - - $ingestFormEl = $newDom->createElement('ingest_form'); - $ingestFormEl->setAttribute('dsid', $ingestFormDsid); - $ingestFormEl->setAttribute('page', $ingestFormPage); - if ($ingestFormHideChooser == 'true') { - $ingestFormEl->setAttribute('hide_file_chooser', 'true'); - } - - $builderEl= $newDom->createElement('form_builder_method'); - $builderEl->setAttribute('module', $ingestFormModule); - $builderEl->setAttribute('file', $ingestFormFile); - $builderEl->setAttribute('class', $ingestFormClass); - $builderEl->setAttribute('method', $ingestFormMethod); - $builderEl->setAttribute('handler', $ingestFormHandler); - $ingestFormEl->appendChild($builderEl); - - $elementsEl = $newDom->createElement('form_elements'); - $ingestFormEl->appendChild($elementsEl); - $rootEl->appendChild($ingestFormEl); - $newDom->appendChild($rootEl); - - $cm = new ContentModel($newDom, $pid, $modelDsid); - - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - $fedoraItem = new Fedora_Item($pid); - $fedoraItem->add_datastream_from_string($cm->dumpXml(), $modelDsid, $name, 'text/xml', 'X'); - $ret = $cm; - } - - return $ret; - } - - - /** - * Constructs a ContentModel object from the PID of the model in Fedora. - * If DSID is specified it will use that datastream as the model, otherwise it will - * use the default (usually ISLANDORACM). PID_NAMESPACE and name can also be initialized - * from the collection policy. - * Returns false on failure. - * - * NOTE: $name will be overwritten with the content model name found in the datastream - * when the model is first validated.\ - * - * @param string $pid - * @param string $dsid - * @param string $pid_namespace - * @param string $name - * @return ContentModel $cm - */ - public static function loadFromModel($pid, $dsid = NULL, $pid_namespace = NULL, $name = NULL) { - $ret = FALSE; - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - try { - if (self::validPid($pid)) { - $fedoraItem = new Fedora_Item($pid); - $dsid = ($dsid != NULL && self::validDsid($dsid)) ? $dsid : ContentModel::getDefaultDSID(); - $ds = $fedoraItem->get_datastream_dissemination($dsid); - if (!empty($ds)) { - $ret=new ContentModel($ds, $pid, $dsid, $pid_namespace, $name); - } - } - } - catch (SOAPException $e) { - $ret = FALSE; - } - return $ret; - } - - /** - * Constructor - * NOTE: Use the static constructor methods whenever possible. - * - * @param string $xmlStr - * @param string $pid - * @param string $dsid - * @param string $pid_namespace - * @param string $name - * @return XMLDatastream $cm - */ - public function __construct($xmlStr, $pid = NULL, $dsid = NULL, $pid_namespace = NULL, $name = NULL) { - parent::__construct($xmlStr, $pid, $dsid); - $this->pid_namespace = $pid_namespace; - $this->name = ($name == NULL)?'Islandora Content Model':$name; - $this->xpath = new DOMXPath($this->xml); - $this->xpath->registerNamespace('cm', 'http://www.islandora.ca'); - } - - /** - * Attempts to convert from the old XML schema to the new by - * traversing the XML DOM and building a new DOM. When done - * $this->xml is replaced by the newly created DOM.. - * - * @return void - */ - protected function convertFromOldSchema() { - $sXml = simplexml_load_string($this->xml->saveXML()); - $newDom = new DOMDocument('1.0', 'utf-8'); - $newDom->formatOutput = TRUE; - $rootEl = $newDom->createElement('content_model'); - $rootEl->setAttribute('name', $sXml['name']); - $rootEl->setAttribute('xmlns', self::$XMLNS); - $rootEl->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); - $rootEl->setAttribute('xsi:schemaLocation', self::$XMLNS .' ' . self::$SCHEMA_URI); - - $mimeEl = $newDom->createElement('mimetypes'); - foreach ($sXml->mimetypes->type as $mime) { - $typeEl = $newDom->createElement('type', $mime); - $mimeEl->appendChild($typeEl); - } - $rootEl->appendChild($mimeEl); - - $ingestRulesEl = $newDom->createElement('ingest_rules'); - foreach ($sXml->ingest_rules->rule as $rule) { - $ruleEl = $newDom->createElement('rule'); - foreach ($rule->applies_to as $appTo) { - $applToEl = $newDom->createElement('applies_to', trim($appTo)); - $ruleEl->appendChild($applToEl); - } - if (isset($rule->methods->method) && count($rule->methods->method) > 0) { - $methodsEl = $newDom->createElement('ingest_methods'); - foreach ($rule->methods->method as $method) { - $methodEl = $newDom->createElement('ingest_method'); - $methodEl->setAttribute('module', $method->module); - $methodEl->setAttribute('file', $method->file); - $methodEl->setAttribute('class', $method->class_name); - $methodEl->setAttribute('method', $method->method_name); - $methodEl->setAttribute('dsid', $method->datastream_id); - $methodEl->setAttribute('modified_files_ext', $method->modified_files_ext); - - if (isset($method->parameters)) { - $paramsEl = $newDom->createElement('parameters'); - foreach ($method->parameters->parameter as $param) { - $paramEl = $newDom->createElement('parameter', $param); - $paramEl->setAttribute('name', $param['name']); - $paramsEl->appendChild($paramEl); - } - $methodEl->appendChild($paramsEl); - } - - - $methodsEl->appendChild($methodEl); - } - $ruleEl->appendChild($methodsEl); - $ingestRulesEl->appendChild($ruleEl); - } - - } - $rootEl->appendChild($ingestRulesEl); - - if (isset($sXml->display_in_fieldset) && count($sXml->display_in_fieldset->datastream) > 0) { - $datastreamsEl = $newDom->createElement('datastreams'); - - foreach ($sXml->display_in_fieldset->datastream as $ds) { - $dsEl = $newDom->createElement('datastream'); - $dsEl->setAttribute('dsid', $ds['id']); - - if (isset($ds->add_datastream_method)) { - $add_ds_methodEl = $newDom->createElement('add_datastream_method'); - $add_ds_methodEl->setAttribute('module', $ds->add_datastream_method->module); - $add_ds_methodEl->setAttribute('file', $ds->add_datastream_method->file); - $add_ds_methodEl->setAttribute('class', $ds->add_datastream_method->class_name); - $add_ds_methodEl->setAttribute('method', $ds->add_datastream_method->method_name); - $add_ds_methodEl->setAttribute('dsid', $ds->add_datastream_method->datastream_id); - $add_ds_methodEl->setAttribute('modified_files_ext', $ds->add_datastream_method->modified_files_ext); - - if (isset($ds->add_datastream_method->parameters)) { - $paramsEl = $newDom->createElement('parameters'); - foreach ($ds->add_datastream_method->parameters->parameter as $param) { - $paramEl = $newDom->createElement('parameter', $param); - $paramEl->setAttribute('name', $param['name']); - $paramsEl->appendChild($paramEl); - } - $add_ds_methodEl->appendChild($paramsEl); - } - - $dsEl->appendChild($add_ds_methodEl); - } - - foreach ($ds->method as $disp_meth) { - $disp_methEl = $newDom->createElement('display_method'); - $disp_methEl->setAttribute('module', $disp_meth->module); - $disp_methEl->setAttribute('file', $disp_meth->file); - $disp_methEl->setAttribute('class', $disp_meth->class_name); - $disp_methEl->setAttribute('method', $disp_meth->method_name); - $dsEl->appendChild($disp_methEl); - } - $datastreamsEl->appendChild($dsEl); - } - $rootEl->appendChild($datastreamsEl); - } - - $ingest_formEl = $newDom->createElement('ingest_form'); - $ingest_formEl->setAttribute('dsid', $sXml->ingest_form['dsid']); - $ingest_formEl->setAttribute('page', $sXml->ingest_form['page']); - if (isset($sXml->ingest_form['hide_file_chooser'])) { - $ingest_formEl->setAttribute('hide_file_chooser', (strtolower($sXml->ingest_form['hide_file_chooser']) == 'true') ? 'true' : 'false'); - } - - $form_builderEl = $newDom->createElement('form_builder_method'); - $form_builderEl->setAttribute('module', $sXml->ingest_form->form_builder_method->module); - $form_builderEl->setAttribute('file', $sXml->ingest_form->form_builder_method->file); - $form_builderEl->setAttribute('class', $sXml->ingest_form->form_builder_method->class_name); - $form_builderEl->setAttribute('method', $sXml->ingest_form->form_builder_method->method_name); - $form_builderEl->setAttribute('handler', $sXml->ingest_form->form_builder_method->form_handler); - $ingest_formEl->appendChild($form_builderEl); - - $form_elementsEl = $newDom->createElement('form_elements'); - foreach ($sXml->ingest_form->form_elements->element as $element) { - - //I found an XML where the label was HTML.. this code will attempt to - //walk the object setting the label to be the first string it finds. - if (count(get_object_vars($element->label)) > 0) { - $obj=$element->label; - while ($obj != NULL && !is_string($obj)) { - $keys = get_object_vars($obj); - $obj = array_shift($keys); - } - $element->label=($obj == NULL) ? '' : $obj; - } - - $elEl = $newDom->createElement('element'); - $elEl->setAttribute('label', $element->label); - $elEl->setAttribute('name', $element->name); - $elEl->setAttribute('type', $element->type); - if (strtolower($element->required) == 'true') { - $elEl->setAttribute('required', 'true'); - } - if (isset($element->description) && trim($element->description) != '') { - $descEl = $newDom->createElement('description', trim($element->description)); - $elEl->appendChild($descEl); - } - if (isset($element->authoritative_list)) { - $authListEl = $newDom->createElement('authoritative_list'); - foreach ($element->authoritative_list->item as $item) { - $itemEl = $newDom->createElement('item', trim($item->value)); - if (trim($item->value) != trim($item->field)) { - $itemEl->setAttribute('field', trim($item->field)); - } - $authListEl->appendChild($itemEl); - } - $elEl->appendChild($authListEl); - } - $form_elementsEl->appendChild($elEl); - } - $ingest_formEl->appendChild($form_builderEl); - $ingest_formEl->appendChild($form_elementsEl); - $rootEl->appendChild($ingest_formEl); - - if (isset($sXml->edit_metadata) && - trim($sXml->edit_metadata->build_form_method->module) != '' && - trim($sXml->edit_metadata->build_form_method->file) != '' && - trim($sXml->edit_metadata->build_form_method->class_name) != '' && - trim($sXml->edit_metadata->build_form_method->method_name) != '' && - trim($sXml->edit_metadata->submit_form_method->method_name) != '' && - trim($sXml->edit_metadata->build_form_method['dsid']) != '' - ) { - $edit_metadata_methodEl= $newDom->createElement('edit_metadata_method'); - $edit_metadata_methodEl->setAttribute('module', $sXml->edit_metadata->build_form_method->module); - $edit_metadata_methodEl->setAttribute('file', $sXml->edit_metadata->build_form_method->file); - $edit_metadata_methodEl->setAttribute('class', $sXml->edit_metadata->build_form_method->class_name); - $edit_metadata_methodEl->setAttribute('method', $sXml->edit_metadata->build_form_method->method_name); - $edit_metadata_methodEl->setAttribute('handler', $sXml->edit_metadata->submit_form_method->method_name); - $edit_metadata_methodEl->setAttribute('dsid', $sXml->edit_metadata->build_form_method['dsid']); - $rootEl->appendChild($edit_metadata_methodEl); - } - - $newDom->appendChild($rootEl); - - $this->xml = DOMDocument::loadXML($newDom->saveXml()); - - } - - /** - * Gets a list of service deployments that this model has. - * - * NOTE: Not currently being used. - * - * @return String[] $serviceDepPids - */ - public function getServices() { - $query = 'select $object $title from <#ri> - where ($object $title - and $object $deploymentOf - and $object - and $object pid .'> - and $object ) - order by $title'; - - module_load_include('inc', 'fedora_repository', 'CollectionClass'); - - $collectionHelper = new CollectionClass(); - $xml = simplexml_load_string($collectionHelper->getRelatedItems($this->pid, $query)); - - $results = array(); - foreach ($xml->results->result as $result) { - $pid = strval(($result->object['uri'])); - $pid = substr($pid, strpos($pid, "/") + 1, strlen($pid)); - $results[] = $pid; - } - - return $results; - } - - /** - * Gets the name of the ContentModel - * Returns false on failure. - * - * @return String $name - */ - public function getName() { - $ret = FALSE; - if ($this->name != NULL) { - $ret = $this->name; - } - elseif ($this->validate()) { - $rootEl = $this->xml->getElementsByTagName('content_model')->item(0); - $this->name = $rootEl->getAttribute('name'); - $ret = $this->name; - } - return $ret; - } - - - /** - * Gets the element corresponding to the datastream specified - * in the element of the schema. - * Returns FALSE on failure. - * - * @param $dsid - * @return DOMElement $datastream - */ - private function getDSModel($dsid) { - $ret = FALSE; - if (self::validDsid($dsid) && $this->validate()) { - $result=$this->xml->getElementsByTagName('datastreams'); - if ($result->length > 0) { - $result=$result->item(0)->getElementsByTagName('datastream'); - for ($i = 0; $ret == FALSE && $i < $result->length; $i++) { - if ($result->item($i)->getAttribute('dsid') == $dsid) - $ret=$result->item($i); - } - } - } - return $ret; - } - - /** - * Gets an array of form elements to use in the ingest form. The results of this array are passed - * to the specified ingest form builder. The form builder can optionally not use the elements as defined - * in the form builder if more complex forms or behaviour is required. - * Each element has the following keys: 'label', 'type', 'required', 'description', and if defined, 'authoritative_list' and/or 'parameters' - * - * @return string[] $elements - */ - public function getIngestFormElements() { - $ret = FALSE; - if ($this->validate()) { - $elements_array = array(); - $form_elements_wrapper = $this->xml->getElementsbyTagName('ingest_form')->item(0)->getElementsByTagName('form_elements'); - - if ($form_elements_wrapper->length == 0) { - return $ret; - } - $elements = $this->xml->getElementsbyTagName('ingest_form')->item(0)->getElementsByTagName('form_elements')->item(0)->getElementsByTagName('element'); - for ($i=0;$i<$elements->length;$i++) { - $desc = $elements->item($i)->getElementsByTagName('description'); - $desc = ($desc->length > 0)?$desc->item(0)->nodeValue:''; - - $label = $elements->item($i)->getAttribute('label'); - if ($label == NULL) { - $label=$elements->item($i)->getAttribute('name'); - } - - $element=array('name' => $elements->item($i)->getAttribute('name'), - 'label' => $label, - 'type' => $elements->item($i)->getAttribute('type'), - 'required' => ($elements->item($i)->getAttribute('required') == 'true') ? TRUE : FALSE, - 'description' => $desc - ); - - $auth_list = $elements->item($i)->getElementsByTagName('authoritative_list'); - if ($auth_list->length > 0) { - $list = array(); - $items = $auth_list->item(0)->getElementsByTagName('item'); - for ($j = 0; $j < $items->length; $j++) { - $field = $items->item($j)->attributes->getNamedItem('field'); - $list[ $items->item($j)->nodeValue ] = ($field !== NULL) ? $field->nodeValue : $items->item($j)->nodeValue; - } - $element['authoritative_list']=$list; - } - - - $params = $elements->item($i)->getElementsByTagName('parameters'); - $list = array(); - if ($params->length > 0) { - $items = $params->item(0)->getElementsByTagName('parameter'); - for ($j = 0; $j < $items->length; $j++) { - $value = $items-> item($j)->nodeValue; - $list[$items->item($j)->getAttribute('name')] = (strtolower($value) == 'true' ? TRUE : (strtolower($value) == 'false' ? FALSE : $value)); - } - } - $element['parameters'] = $list; - - $elements_array[] = $element; - } - $ret = $elements_array; - } - - return $ret; - } - - /** - * Decrements an ingest form element in the list of elements. - * Updates the "order". This method is simply an overload to the incIngestFormElement - * which has a direction parameter. - * - * TODO: Might be useful to move multiple places at once, or define - * a method to move to an absolute position. - * - * @param String $name - * @return boolean $success - */ - public function decIngestFormElement($name) { - return $this->incIngestFormElement($name, 'dec'); - } - - /** - * Increments (or decrements) ingest form element in the list of elements. - * Updates the "order". The $reorder parameter accepts 'inc' or 'dec' to - * specify the direction to move (defaults to increment.) - * - * TODO: Might be useful to move multiple places at once, or define - * a method to move to an absolute position. - * - * @param String $name - * @param String $reorder - * @return boolean $success - */ - public function incIngestFormElement($name, $reorder = 'inc') { - $ret = FALSE; - if ($this->validate()) { - $elementsEl = $this->xml->getElementsbyTagName('ingest_form')->item(0)->getElementsByTagName('form_elements')->item(0); - $elements = $elementsEl->getElementsByTagName('element'); - $found = FALSE; - $refEl = FALSE; - for ($i = 0; $found === FALSE && $i < $elements->length; $i++) { - if ($elements->item($i)->getAttribute('name') == trim($name)) { - if ($reorder == 'inc') { - $found=$elements->item($i); - $refEl = ($i > 0)?$elements->item($i-1):false; - } - else { - $found = ($i + 1 < $elements->length) ? $elements->item($i + 1) : FALSE; - $refEl = $elements->item($i); - } - } - } - - if ($found !== FALSE) { - $elementsEl->removeChild($found); - $elementsEl->insertBefore($found, $refEl); - $ret = TRUE; - } - } - return $ret; - } - - /** - * Removes an ingest form element from the list of ingest form elements. - * @param String $name - * @return boolean $success - */ - public function removeIngestFormElement($name) { - $ret = FALSE; - if ($this->validate()) { - $elementsEl = $this->xml->getElementsbyTagName('ingest_form')->item(0)->getElementsByTagName('form_elements')->item(0); - $elements = $elementsEl->getElementsByTagName('element'); - $found = FALSE; - for ($i = 0; $found === FALSE && $i < $elements->length; $i++) { - if ($elements->item($i)->getAttribute('name') == trim($name)) { - $found=$elements->item($i); - } - } - - if ($found !== FALSE) { - $elementsEl->removeChild($found); - $ret = TRUE; - } - } - return $ret; - } - - /** - * Sets a parameter of an ingest form element. If the value of the element is FALSE the parameter - * will be removed entirely (if you want to store false as a value, then send the String "false"). - * - * @param String $elementName - * @param String $paramName - * @param String $paramValue - * @return boolean success - */ - public function setIngestFormElementParam($name, $paramName, $paramValue) { - $ret = FALSE; - - if ($this->validate()) { - $elements = $this->xml->getElementsbyTagName('ingest_form')->item(0)->getElementsByTagName('form_elements')->item(0)->getElementsByTagName('element'); - $element = FALSE; - for ($i = 0; $element === FALSE && $i < $elements->length; $i++) { - if ($elements->item($i)->getAttribute('name') == $name) { - $element = $elements->item($i); - } - } - - if ($element !== FALSE) { - $paramsEl = $element->getElementsByTagName('parameters'); - if ($paramsEl->length == 0) { - if ($paramValue !== FALSE) { - $paramsEl = $this->xml->createElement('parameters'); - $element->appendChild($paramsEl); - } - else { - $ret = TRUE; - } - } - else { - $paramsEl=$paramsEl->item(0); - } - - if (!$ret) { - $params = $paramsEl->getElementsByTagName('parameter'); - $found = FALSE; - for ($i = 0; $found === FALSE && $i < $params->length; $i++) { - if ($params->item($i)->getAttribute('name') == $paramName) { - $found=$params->item($i); - } - } - - if ($paramValue === FALSE) { - if ($found !== FALSE) { - $paramsEl->removeChild($found); - if ($params->length == 0) { - $element->removeChild($paramsEl); - } - } - $ret = TRUE; - } - else { - if ($found !== FALSE) { - $found->nodeValue = $paramValue; - } - else { - $paramEl=$this->xml->createElement('parameter', $paramValue); - $paramEl->setAttribute('name', $paramName); - $paramsEl->appendChild($paramEl); - } - $ret = TRUE; - } - } - } - } - - return $ret; - } - - -/** - * Gets a list of all parameters that belong to the specified ingest form element. - * - * @param String $elementName - * @return boolean success - */ - public function getIngestFormElementParams($name) { - $ret = FALSE; - - if ($this->validate()) { - $elements = $this->xml->getElementsbyTagName('ingest_form')->item(0)->getElementsByTagName('form_elements')->item(0)->getElementsByTagName('element'); - $element = FALSE; - for ($i=0; $element === FALSE && $i < $elements->length; $i++) { - if ($elements->item($i)->getAttribute('name') == $name) { - $element = $elements->item($i); - } - } - - if ($element !== FALSE) { - $ret = array(); - $paramsEl = $element->getElementsByTagName('parameters'); - - if ($paramsEl->length > 0) { - $params = $paramsEl->item(0)->getElementsByTagName('parameter'); - for ($i = 0; $i < $params->length; $i++) { - $ret[$params->item($i)->getAttribute('name')]=$params->item($i)->nodeValue; - } - } - } - } - - return $ret; - } - - /** - * Edits the ingest form element specified. - * NOTE: The element name can not be changed. To update an elements name - * it must be deleted and added with the new name. - * - * @param String $name - * @param String $label - * @param String $type - * @param boolean $required - * @param String description - * @return boolean success - */ - public function editIngestFormElement($name, $label, $type, $required, $description) { - $ret = FALSE; - if ($this->validate()) { - $elements = $this->xml->getElementsbyTagName('ingest_form')->item(0)->getElementsByTagName('form_elements')->item(0)->getElementsByTagName('element'); - $found = FALSE; - for ($i = 0; $found === FALSE && $i < $elements->length; $i++) { - if ($elements->item($i)->getAttribute('name') == $name) { - $found = $elements->item($i); - } - } - - $found->setAttribute('name', $name); - $found->setAttribute('type', $type); - $found->setAttribute('required', $required ? 'true' : 'false'); - if (trim($label) != '' && trim($label) != trim($name)) { - $found->setAttribute('label', $label); - } - elseif ($found->getAttribute('label') != '') { - $found->removeAttribute('label'); - } - - $descEl=$found->getElementsByTagName('description'); - if (trim($description) != '') { - if ($descEl->length > 0) { - $descEl=$descEl->item(0); - $descEl->nodeValue = $description; - } - else { - $descEl = $this->xml->createElement('description', $description); - $found->appendChild($descEl); - } - } - elseif ($descEl->length > 0) { - $found->removeChild($descEl->item(0)); - } - - if ($found->getAttribute('type') != 'select' && $found->getAttribute('type') != 'radio') { - $authList = $found->getElementsByTagName('authoritative_list'); - if ($authList->length > 0) { - $found->removeChild($authList->item(0)); - } - } - - $ret = TRUE; - } - return $ret; - } - - - /** - * Add an ingest form element to the model. - * - * @param String $name - * @param String $label - * @param String $type - * @param boolean $required - * @param String $description - * @return boolean $success - */ - public function addIngestFormElement($name, $label, $type, $required, $description = '') { - $ret = FALSE; - if ($this->validate()) { - $elements = $this->xml->getElementsbyTagName('ingest_form')->item(0)->getElementsByTagName('form_elements')->item(0); - $elementEl = $this->xml->createElement('element'); - $elementEl->setAttribute('name', $name); - $elementEl->setAttribute('type', $type); - $elementEl->setAttribute('required', $requiredi ? 'true' : 'false'); - if (trim($label) != '' && trim($label) != trim($name)) { - $elementEl->setAttribute('label', $label); - } - if (trim($description) != '') { - $descEl=$this->xml->createElement('description', $description); - $elementEl->appendChild($descEl); - } - $elements->appendChild($elementEl); - - $ret = TRUE; - } - return $ret; - } - - /** - * Decrements an authority list item from a form element in the list of elements. - * Updates the "order". This method is simply an overload to the incAuthListItem - * which has a direction parameter. - - * - * @param String $elementName - * @param String $value - * @return boolean $success - */ - public function decAuthListItem($elementName, $value) { - return $this->incAuthListItem($elementName, $value, 'dec'); - } - - /** - * Increments (or decrements) an authority list item from a form element in the list of elements. - * Updates the "order". - * - * @param String $elementName - * @param String $value - * @param String $direction - * @return boolean $success - */ - public function incAuthListItem($elementName, $value, $reorder = 'inc') { - $ret = FALSE; - if ($this->validate()) { - $elements = $this->xml->getElementsbyTagName('ingest_form')->item(0)->getElementsByTagName('form_elements')->item(0)->getElementsByTagName('element'); - $found = FALSE; - for ($i = 0; $found === FALSE && $i < $elements->length; $i++) { - if ($elements->item($i)->getAttribute('name') == $elementName) { - $found = $elements->item($i); - } - } - - if ($found !== FALSE) { - - $authListEl = $found->getElementsByTagName('authoritative_list'); - if ($authListEl->length > 0) { - $authListEl = $authListEl->item(0); - - $items = $authListEl->getElementsByTagName('item'); - $found = FALSE; - $refEl = FALSE; - for ($i = 0; $found === FALSE && $i < $items->length; $i++) { - if ($items->item($i)->nodeValue == $value) { - if ($reorder == 'inc') { - $refEl = ($i > 0) ? $items->item($i - 1) : FALSE; - $found = $items->item($i); - } - else { - $refEl = $items->item($i); - $found = ($i + 1 < $items->length) ? $items->item($i + 1) : FALSE; - } - } - } - - if ($found !== FALSE && $refEl !== FALSE) { - $authListEl->removeChild($found); - $authListEl->insertBefore($found, $refEl); - $ret = TRUE; - } - } - } - } - return $ret; - } - - /** - * Removes an authority list item from a form element. - @param String $elementName - @param String $value - @return boolean $success - */ - public function removeAuthListItem($elementName, $value) { - $ret = FALSE; - if ($this->validate()) { - $elements = $this->xml->getElementsbyTagName('ingest_form')->item(0)->getElementsByTagName('form_elements')->item(0)->getElementsByTagName('element'); - $found = FALSE; - for ($i = 0; $found === FALSE && $i < $elements->length; $i++) { - if ($elements->item($i)->getAttribute('name') == $elementName) { - $found = $elements->item($i); - } - } - - if ($found !== FALSE) { - $authListEl = $found->getElementsByTagName('authoritative_list'); - if ($authListEl->length > 0) { - $authListEl = $authListEl->item(0); - $items = $authListEl->getElementsByTagName('item'); - $found = FALSE; - for ($i = 0; $found === FALSE && $i < $items->length; $i++) { - if ($items->item($i)->nodeValue == $value) { - $found=$items->item($i); - } - } - - if ($found !== FALSE) { - if ($items->length == 1) { - $found->removeChild($authListEl); - } - else { - $authListEl->removeChild($found); - } - - $ret = TRUE; - } - } - } - } - return $ret; - } - - /** - * Adds an authority list item to a form element. - @param String $elementName - @param String $value - @param String $label (optional) - @return boolean $success - */ - public function addAuthListItem($elementName, $value, $label = '') { - $ret = FALSE; - if ($this->validate()) { - $elements = $this->xml->getElementsbyTagName('ingest_form')->item(0)->getElementsByTagName('form_elements')->item(0)->getElementsByTagName('element'); - $found = FALSE; - for ($i = 0; $found === FALSE && $i < $elements->length; $i++) { - if ($elements->item($i)->getAttribute('name') == $elementName) { - $found = $elements->item($i); - } - } - - if ($found !== FALSE) { - $authListEl = $found->getElementsByTagName('authoritative_list'); - if ($authListEl->length == 0) { - $authListEl = $this->xml->createElement('authoritative_list'); - $found->appendChild($authListEl); - } - else { - $authListEl = $authListEl->item(0); - } - - $items = $authListEl->getElementsByTagName('item'); - $found = FALSE; - for ($i = 0; $found == FALSE && $i < $items->length; $i++) { - if ($items->item($i)->nodeValue == $value) { - $found = TRUE; - } - } - - if (!$found) { - $itemEl = $this->xml->createElement('item', trim($value)); - if (trim($label) != '' && trim($label) != trim($value)) { - $itemEl->setAttribute('field', trim($label)); - } - $authListEl->appendChild($itemEl); - $ret = TRUE; - } - } - - } - return $ret; - } - - /** - * Builds an ingest form using the method specified in element of - * Returns FALSE on failure. - * - * @param &$form - * @param &$form_state - * @return string identifier - */ - public function buildIngestForm(&$form, &$form_state) { - $ret = FALSE; - if ($this->validate()) { - $docRoot = $_SERVER['DOCUMENT_ROOT']; - $file = (isset($form_state['values']['ingest-file-location']) ? $form_state['values']['ingest-file-location'] : ''); - - $fullpath = $file; - - $form['step'] = array( - '#type' => 'hidden', - '#value' => (isset($form_state['values']['step']) ? $form_state['values']['step'] : 0) + 1, - ); - $form['ingest-file-location'] = array( - '#type' => 'hidden', - '#value' => $file, - ); - $form['content_model_name'] = array( - '#type' => 'hidden', - '#value' => 'ISLANDORACM', - ); - $form['models'] = array( //content models available - '#type' => 'hidden', - '#value' => $form_state['values']['models'], - ); - $form['fullpath'] = array( - '#type' => 'hidden', - '#value' => $fullpath, - ); - - $form['#attributes']['enctype'] = 'multipart/form-data'; - $form['indicator']['ingest-file-location'] = array( - '#type' => 'file', - '#title' => t('Upload Document'), - '#size' => 48, - '#description' => t('Full text'), - ); - - $ingest_form = $this->xml->getElementsByTagName('ingest_form')->item(0); - - if (!empty($ingest_form)) { - if (strtolower($ingest_form->getAttribute('hide_file_chooser')) == 'true') { - $form['indicator']['ingest-file-location']['#type'] = 'hidden'; - } - } - $dsid = $ingest_form->getAttribute('dsid'); - - $method=$ingest_form->getElementsByTagName('form_builder_method')->item(0); - $module = $method->getAttribute('module'); - $path=drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file'); - if (!file_exists($path)) { - self::$errors[]='Build Ingest Form: file \''. $path .'\' does not exist.'; - } - else { - @require_once($path); - $className=$method->getAttribute('class'); - $methodName=($method->getAttribute('method')); - if (!class_exists($className)) { - self::$errors[] = 'Build Ingest Form: class \''. $className .' does not exist.'; - } - else { - $class = new $className; - $elements_array=$this->getIngestFormElements(); - if (method_exists($class, $methodName)) { - $ret = $class->$methodName ($form, $elements_array, $form_state); - } - else { - self::$errors[] = 'Build Ingest Form: method \''. $className .'->'. $methodName .'\' does not exist.'; - } - } - } - } - return $ret; - } - - /** - * Builds an edit metadata form using the method specified in the element -= * The DSID specified must match the DSID attribute of . Returns FALSE on failure. - * - * @param string $dsid - * @return $form - */ - public function buildEditMetadataForm($pid, $dsid) { - $ret = FALSE; - if (self::validDsid($dsid) && $this->validate()) { - $method = $this->xml->getElementsByTagName('edit_metadata_method'); - if ($method->length > 0 && $method->item(0)->getAttribute('dsid') == $dsid) { - $method = $method->item(0); - $module = $method->getAttribute('module'); - $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file') ; - if (!file_exists($path)) { - self::$errors[] = 'Build Edit Metadata Form: file \''. $path .'\' does not exist.'; - } - else { - @require_once($path ); - $className=$method->getAttribute('class'); - $methodName=($method->getAttribute('method')); - if (!class_exists($className)) { - self::$errors[] = 'Build Edit Metadata Form: class \''. $className .'\' does not exist.'; - } - else { - $class = new $className($pid); - if (!method_exists($class, $methodName)) { - self::$errors[] = 'Build Edit Metadata Form: method \''. $className .'->'. $methodName .'\' does not exist.'; - } - else { - $ret = $class->$methodName(); - } - } - } - } - } - return $ret; - } - - /** - * Handles the edit metadata form using the handler specified in the element - * Returns FALSE on failure. - * - * @param &$form_id - * @param &$form_values - * @param &$soap_client - * @return $result - */ - public function handleEditMetadataForm(&$form_id, &$form_state, &$soap_client) { - global $base_url; - $ret = FALSE; - if ($this->validate()) { - $method = $this->xml->getElementsByTagName('edit_metadata_method'); - if ($method->length > 0) { - $method=$method->item(0); - $module = $method->getAttribute('module'); - $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file'); - if (!file_exists($path)) { - self::$errors[] = 'Handle Edit Metadata Form: file \''. $path .'\' does not exist.'; - } - else { - @require_once($path); - $className = $method->getAttribute('class'); - $methodName = ($method->getAttribute('handler')); - if (!class_exists($className)) { - self::$errors[] = 'Handle Edit Metadata Form: class \''. $className .'\' does not exist.'; - } - else { - $class = new $className($form_state['values']['pid']); - if (!method_exists($class, $methodName)) { - self::$errors[] = 'Handle Edit Metadata Form: metho \''. $className .'->'. $methodName .'\' does not exist.'; - } - else { - $ret = $class->$methodName($form_id, $form_state['values'], $soap_client); - } - } - } - } - else { - // Assume DC form if none is specified. - module_load_include('inc', 'fedora_repository', 'formClass'); - $metaDataForm = new formClass(); - $ret = $metaDataForm->updateMetaData($form_state['values']['form_id'], $form_state['values'], $soap_client); - $form_state['redirect'] = $base_url . '/fedora/repository/' . $form_state['values']['pid']; - - } - } - return $ret; - } - - - /** - * Gets an associative array describing the edit metadata method. - * Array has the following keys: 'file', 'class', 'method', 'handler', 'dsid' - * @return String[] $method - */ - public function getEditMetadataMethod() { - $ret = FALSE; - if ($this->validate()) { - $method=$this->xml->getElementsByTagName('content_model')->item(0)->getElementsByTagName('edit_metadata_method'); - if ($method->length > 0) { - $method = $method->item(0); - $ret = array('module' => $method->getAttribute('module') == '' ? 'fedora_repository' : $method->getAttribute('module'), - 'file' => $method->getAttribute('file'), - 'class' => $method->getAttribute('class'), - 'method' => $method->getAttribute('method'), - 'handler' => $method->getAttribute('handler'), - 'dsid' => $method->getAttribute('dsid') - ); - } - } - return $ret; - } - - /** - * Removes the edit data method from the Content Model. - * @return boolean $success - */ - public function removeEditMetadataMethod() { - $ret = FALSE; - if ($this->validate()) { - $rootEl=$this->xml->getElementsByTagName('content_model')->item(0); - $method = $rootEl->getElementsByTagName('edit_metadata_method'); - if ($method->length > 0) { - $rootEl->removeChild($method->item(0)); - $ret = TRUE; - } - } - return $ret; - } - - /** - * Update the Edit Metadata Method defined in the Content Model - * @param String $module - * @param String $file - * @param String $class - * @param String $method - * @param String $handler - * @param String $dsid - * @return boolean $success - */ - public function updateEditMetadataMethod($module, $file, $class, $method, $handler, $dsid) { - $ret = FALSE; - if (self::validDsid($dsid) && $this->validate()) { - $methodEl = $this->xml->getElementsByTagName('content_model')->item(0)->getElementsByTagName('edit_metadata_method'); - if ($methodEl->length > 0) { - $methodEl=$methodEl->item(0); - } - else { - $methodEl = $this->xml->createElement('edit_metadata_method'); - $this->xml->getElementsByTagName('content_model')->item(0)->appendChild($methodEl); - } - $methodEl->setAttribute('module', $module); - $methodEl->setAttribute('file', $file); - $methodEl->setAttribute('class', $class); - $methodEl->setAttribute('method', $method); - $methodEl->setAttribute('handler', $handler); - $methodEl->setAttribute('dsid', $dsid); - $ret = TRUE; - } - return $ret; - } - - /** - * Executes the add datastream method for the specified datastream on the specified file. - * Returns FALSE on failure. - * - * @param string $dsid - * @param string $filen - * @return $result - */ - public function execAddDatastreamMethods($dsid, $file) { - $ret = FALSE; - if (self::validDsid($dsid) && $this->validate() && ($ds = $this->getDSModel($dsid)) !== FALSE) { - $addMethod = $ds->getElementsByTagName('add_datastream_method'); - if ($addMethod->length > 0) { - $addMethod=$addMethod->item(0); - $paramArray = array(); - $params= $addMethod->getElementsByTagName('parameters'); - if ($params->length > 0) { - $params=$params->item(0)->getElementsByTagName('parameter'); - for ($i = 0; $i < $params->length; $i++) { - $paramsArray[$params->item($i)->getAttribute('name')] = $params->item($i)->nodeValue; - } - } - $module = $addMethod->getAttribute('module'); - $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $addMethod->getAttribute('file') ; - if (!file_exists($path)) { - self::$errors[] = 'Execute Add Datastream Methods: file \''. $path .'\' does not exist.'; - } - else { - @require_once($path); - $className = $addMethod->getAttribute('class'); - $methodName = $addMethod->getAttribute('method'); - if (!class_exists($className)) { - self::$errors[] = 'Execute Add Datastream Methods: class \''. $className .'\' does not exist.'; - } - else { - $class = new $className; - if (!method_exists($class, $methodName)) { - self::$errors[] = 'Execute Add Datastream Methods: method \''. $className .'->'. $methodName .'\' does not exist.'; - } - else { - $ret = $class->$methodName($paramsArray, $addMethod->getAttribute('dsid'), $file, $addMethod->getAttribute('modified_files_ext')); - } - } - } - } - } - return $ret; - } - - /** - * Executes the ingest rules that apply to the specified file/mimetype. - * Returns FALSE on failure. - * - * If $preview is TRUE, then only execute rules with - * a parameter 'preview'. Used to generate previews for the file chooser. - * - * @param string $file - * @param string $mimetype - * @param boolean $preview - * @return $result - */ - public function execIngestRules($file, $mimetype, $preview = FALSE) { - $ret = FALSE; - if ($this->validate()) { - $ret = TRUE; - $rules = $this->xml->getElementsByTagName('ingest_rules')->item(0)->getElementsByTagName('rule'); - for ($i = 0; $i < $rules->length; $i++) { - $rule=$rules->item($i); - $types = $rule->getElementsbyTagName('applies_to'); - $valid_types = array(); - for ($j = 0; $j < $types->length; $j++) { - $valid_types[]=trim($types->item($j)->nodeValue); - } - - if (in_array($mimetype, $valid_types)) { - $methods = $rule->getElementsByTagName('ingest_methods'); - if ($methods->length > 0) { - $methods = $methods->item(0)->getElementsbyTagName('ingest_method'); - for ($j = 0; $j < $methods->length; $j++) { - $method=$methods->item($j); - $param_array=array(); - $params=$method->getElementsByTagName('parameters'); - $param_array['model_pid'] = $this->pid; - if ($params->length > 0) { - $params = $params->item(0)->getElementsByTagName('parameter'); - for ($k = 0; $k < $params->length; $k++) - $param_array[$params->item($k)->getAttribute('name')]=$params->item($k)->nodeValue; - } - - - if (!$preview || isset($param_array['preview'])) { - $module = $method->getAttribute('module'); - $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file') ; - - if (!file_exists($path) || substr_compare($path, 'fedora_repository/', -strlen('fedora_repository/'), strlen('fedora_repository/')) === 0) { - self::$errors[] = 'Execute Ingest Rules: file \''. $path .'\' does not exist.'; - $ret = FALSE; - } - else { - require_once($path); - $className=$method->getAttribute('class'); - $methodName=($method->getAttribute('method')); - if (!class_exists($className)) { - self::$errors[] = 'Execute Ingest Rules: class \''. $className .'\' does not exist.'; - $ret = FALSE; - } - else $class = new $className; - if (!method_exists($class, $methodName)) { - self::$errors[] = 'Execute Ingest Rules: method \''. $className .'->' . $methodName .'\' does not exist.'; - $ret = FALSE; - } - else { - $status = $class->$methodName($param_array, $method->getAttribute('dsid'), $file, $method->getAttribute('modified_files_ext')); - if ($status !== TRUE) { - $ret = FALSE; - } - } - } - } - } - } - } - } - - } - return $ret; - } - - /** - * Executes the form handler from the element of . - * - * @param &$formData - * @param &$form_state - * @return boolean $success - */ - public function execFormHandler(&$data,&$form_state) { - $ret = FALSE; - if ($this->validate()) { - $method =$this->xml->getElementsByTagName('ingest_form')->item(0)->getElementsByTagName('form_builder_method')->item(0); - $module = $method->getAttribute('module'); - $path=drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file') ; - if (!file_exists($path)) { - self::$errors[] = 'Execute Form Handler: file \''. $path .'\' does not exist.'; - } - else { - require_once($path); - $className=$method->getAttribute('class'); - $methodName=($method->getAttribute('handler')); - if (!class_exists($className)) { - self::$errors[] = 'Execute Form Handler: class \''. $className .'\' does not exist.'; - } - else { - $class = new $className; - if (!method_exists($class, $methodName)) { - self::$errors[] = 'Execute Form Handler: method \''. $className .'->'. $methodName .'\' does not exist.'; - } - else { - $class->$methodName($data,$form_state); - $ret = TRUE; - } - } - } - } - - return $ret; - } - - /** - * Gets a list of valid mimetypes that can apply to this model. - * Returns FALSE on failure. - * - * @return string[] $mimetypes - */ - public function getMimetypes() { - //only proceed if the xml is valid. - if ($this->validate()) { - if ($this->mimes === NULL) { - $result=$this->xml->getElementsByTagName('mimetypes'); - $result=$result->item(0)->getElementsByTagName('type'); - $mimes = array(); - for ($i = 0; $i < $result->length; $i++) { - $mimes[] = trim($result->item($i)->nodeValue); - } - $this->mimes=$mimes; - } - return $this->mimes; - } - } - - /** - * Calls all defined display methods for the ContentModel. - * The PID specified is passed to the constructor of the display - * class(es) specified in the Content Model. - * - * @param string $pid - * @return string $output - */ - public function displayExtraFieldset($pid, $page_number) { - $output = ''; - if ($this->validate()) { - $datastreams = $this->xml->getElementsByTagName('datastreams'); - if ($datastreams->length > 0) { - $datastreams = $datastreams->item(0)->getElementsByTagName('datastream'); - for ($i=0; $i < $datastreams->length; $i++) { - $ds = $datastreams->item($i); - if ($ds->attributes->getNamedItem('display_in_fieldset') == NULL || strtolower($ds->getAttribute('display_in_fieldset')) != 'false' ) { - $dispMethods = $ds->getElementsByTagName('display_method'); - for ($j = 0; $j < $dispMethods->length; $j++) { - $method = $dispMethods->item($j); - $module = $method->getAttribute('module'); - $path=drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file') ; - if (!file_exists($path)) { - self::$errors[] = 'Execute Form Handler: file \''. $path .'\' does not exist.'; - } - else { - require_once($path); - $className = $method->getAttribute('class'); - $methodName = ($method->getAttribute('method')); - if (!class_exists($className)) { - self::$errors[] = 'Execute Form Handler: class \''. $className .'\' does not exist.'; - } - else { - $class = new $className($pid); - if (!method_exists($class, $methodName)) { - self::$errors[] = 'Execute Form Handler: method \''. $className .'->'. $methodName .'\' does not exist.'; - } - else { - $output = $class->$methodName($page_number); - } - } - } - } - } - } - } - } - - return $output; - } - - /** - * Gets a list of datastreams from the ContentModel - * (not including the QDC ds if it is listed). - * Returns FALSE on failure. - * - * @return string[] $datastreams - */ - public function listDatastreams() { - $ds_array=array(); - if ($this->validate()) { - $datastreams = $this->xml->getElementsByTagName('datastreams'); - if ($datastreams->length > 0) { - $datastreams=$datastreams->item(0)->getElementsByTagName('datastream'); - for ($i=0;$i<$datastreams->length;$i++) { - $dsName=$datastreams->item($i)->getAttribute('dsid'); - // if ($dsName != 'QDC') - // { - $ds_array[]=$dsName; - // } - } - } - } - - return $ds_array; - } - - /** - * Adds an allowed mimetype to the model. - * - * @param String $type - * @return boolean $success - */ - public function addMimetype($type) { - $ret=FALSE; - if ($this->validate()) { - $mimetypesEl = $this->xml->getElementsByTagName('mimetypes')->item(0); - $types= $mimetypesEl->getElementsByTagName('type'); - - $found = FALSE; - for ($i=0;!$found && $i<$types->length;$i++) { - if ($types->item($i)->nodeValue == $type) - $found = TRUE; - } - - if (!$found) { - $newTypeEl = $this->xml->createElement('type', $type); - $mimetypesEl->appendChild($newTypeEl); - $ret=TRUE; - } - - } - return $ret; - } - - /** - * Removes an allowed mimetype from the model. - * - * @param String $type - * @return boolean $success - */ - public function removeMimetype($type) { - $ret=FALSE; - if ($this->validate()) { - $mimetypesEl = $this->xml->getElementsByTagName('mimetypes')->item(0); - $types= $mimetypesEl->getElementsByTagName('type'); - $found=FALSE; - for ($i=0;!$found && $i<$types->length;$i++) { - if ($types->item($i)->nodeValue == $type) - $found=$types->item($i); - } - - if ($found !== FALSE && $types->length > 1) { - $mimetypesEl->removeChild($found); - $ret = TRUE; - } - - } - return $ret; - } - - public function getDisplayMethods($ds) { - $ret=FALSE; - if (($ds = $this->getDSModel($ds))!==FALSE) { - $ret=array(); - $dispMethods= $ds->getElementsByTagName('display_method'); - for ($i=0;$i<$dispMethods->length;$i++) { - $ret[] = array( 'module' => $dispMethods->item($i)->getAttribute('module')==''?'fedora_repository':$dispMethods->item($i)->getAttribute('module'), - 'file' => $dispMethods->item($i)->getAttribute('file'), - 'class' => $dispMethods->item($i)->getAttribute('class'), - 'method' => $dispMethods->item($i)->getAttribute('method'), - 'default' => ($dispMethods->item($i)->attributes->getNamedItem('default') !== NULL ? strtolower($dispMethods->item($i)->getAttribute('default')) == 'true' : FALSE)); - } - } - return $ret; - } - - public function addDs($dsid, $display_in_fieldset = FALSE) { - $ret=FALSE; - - if (self::validDsid($dsid) && ($ds = $this->getDSModel($dsid)) === FALSE) { - $datastreamsEl = $this->xml->getElementsByTagName('datastreams'); - if ($datastreamsEl->length > 0) { - $datastreamsEl=$datastreamsEl->item(0); - } - else { - $datastreamsEl = $this->xml->createElement('datastreams'); - $this->xml->getElementsByTagName('content_model')->item(0)->appendChild($datastreamsEl); - } - - $dsEl = $this->xml->createElement('datastream'); - $dsEl->setAttribute('dsid', $dsid); - if ($display_in_fieldset == TRUE) { - $dsEl->setAttribute('display_in_fieldset', 'true'); - } - $datastreamsEl->appendChild($dsEl); - $ret = TRUE; - } - return $ret; - } - - public function removeDs($dsid) { - $ret = FALSE; - - if (self::validDsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) { - $datastreamsEl = $this->xml->getElementsByTagName('datastreams')->item(0); - $datastreamsEl->removeChild($ds); - $ret = TRUE; - } - return $ret; - } - - public function displayInFieldset($dsid) { - $ret = FALSE; - if (self::validDsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) { - $ret = strtolower($ds->getAttribute('display_in_fieldset')) == 'true'; - } - return $ret; - } - - public function setDisplayInFieldset($dsid, $value = TRUE) { - $ret = FALSE; - if (self::validDsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) { - if ($value == FALSE && $ds->attributes->getNamedItem('display_in_fieldset') !== NULL) { - $ds->removeAttribute('display_in_fieldset'); - $ret = TRUE; - } - elseif ($value == TRUE) { - $ds->setAttribute('display_in_fieldset', 'true'); - $ret = TRUE; - } - } - return $ret; - } - - public function setDefaultDispMeth($dsid, $module, $file, $class, $method) { - $ret = FALSE; - - if (self::validDsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) { - $found = FALSE; - $dispMethods = $ds->getElementsByTagName('display_method'); - for ($i = 0; !$found && $i < $dispMethods->length; $i++) { - if ($module == ($dispMethods->item($i)->getAttribute('module') == '' ? 'fedora_repository' : $dispMethods->item($i)->getAttribute('module')) && - $file == $dispMethods->item($i)->getAttribute('file') && - $class == $dispMethods->item($i)->getAttribute('class') && - $method == $dispMethods->item($i)->getAttribute('method')) { - $found=$dispMethods->item($i); - } - } - - if ($found !== FALSE) { - - for ($i = 0; $i < $dispMethods->length; $i++) { - if ($dispMethods->item($i)->attributes->getNamedItem('default') !== NULL) { - $dispMethods->item($i)->removeAttribute('default'); - } - } - - $found->setAttribute('default', 'true'); - $ret = TRUE; - } - - } - return $ret; - } - - public function removeDispMeth($dsid, $module, $file, $class, $method) { - $ret = FALSE; - if (self::validDsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) { - $found = FALSE; - $dispMethods= $ds->getElementsByTagName('display_method'); - for ($i=0;!$found && $i<$dispMethods->length;$i++) { - if ($module == ($dispMethods->item($i)->getAttribute('module') == '' ? 'fedora_repository' : $dispMethods->item($i)->getAttribute('module') == '') && - $file == $dispMethods->item($i)->getAttribute('file') && - $class == $dispMethods->item($i)->getAttribute('class') && - $method == $dispMethods->item($i)->getAttribute('method')) { - $found=$dispMethods->item($i); - } - } - - if ($found !== FALSE) { - $ds->removeChild($found); - $ret = TRUE; - } - - } - return $ret; - } - - public function addDispMeth($dsid, $module, $file, $class, $method, $default = FALSE) { - $ret=FALSE; - if (self::validDsid($dsid) && ($ds = $this->getDSModel($dsid))!==FALSE) { - $dispMethEl = $this->xml->createElement('display_method'); - $dispMethEl->setAttribute('module', $module); - $dispMethEl->setAttribute('file', $file); - $dispMethEl->setAttribute('class', $class); - $dispMethEl->setAttribute('method', $method); - if ($default==TRUE) { - $dispMethEl->setAttribute('default', TRUE); - } - $ds->appendChild($dispMethEl); - $ret = TRUE; - } - return $ret; - } - - public function getAddDsMethod($ds) { - $ret=FALSE; - if (($ds = $this->getDSModel($ds))!==FALSE) { - $addDsMethod= $ds->getElementsByTagName('add_datastream_method'); - if ($addDsMethod !== FALSE && $addDsMethod->length > 0) { - $ret = array('module' => $addDsMethod->item(0)->getAttribute('module') == '' ? 'fedora_repository' : $addDsMethod->item(0)->getAttribute('module'), - 'file' => $addDsMethod->item(0)->getAttribute('file'), - 'class' => $addDsMethod->item(0)->getAttribute('class'), - 'method' => $addDsMethod->item(0)->getAttribute('method'), - 'modified_files_ext' => $addDsMethod->item(0)->getAttribute('modified_files_ext'), - 'dsid' => $addDsMethod->item(0)->getAttribute('dsid') - ); - } - } - return $ret; - } - - public function getIngestRule($rule_id) { - $ret = FALSE; - if ($this->validate()) { - $rules = $this->xml->getElementsByTagName('ingest_rules')->item(0)->getElementsByTagName('rule'); - if ($rule_id < $rules->length) - $ret = $rules->item($rule_id); - } - return $ret; - } - - public function removeAppliesTo($rule_id, $type) { - $ret = FALSE; - if (($rule = $this->getIngestRule($rule_id)) !== FALSE) { - $applies = $rule->getElementsByTagName('applies_to'); - $found = FALSE; - for ($i=0; $found === FALSE && $i < $applies->length; $i++) { - if ($type == $applies->item($i)->nodeValue) { - $found = $applies->item($i); - } - } - - if ($found) { - $rule->removeChild($found); - $ret = TRUE; - } - } - return $ret; - } - - public function addAppliesTo($rule_id, $type) { - $ret=FALSE; - if (($rule = $this->getIngestRule($rule_id))!==FALSE) { - $applies = $rule->getElementsByTagName('applies_to'); - $found = FALSE; - for ($i=0;!$found && $i<$applies->length;$i++) { - $found = ($type == $applies->item($i)->nodeValue); - } - - if (!$found) { - $newAppliesTo = $this->xml->createElement('applies_to', $type); - $rule->insertBefore($newAppliesTo, $rule->getElementsByTagName('ingest_methods')->item(0)); - $ret = TRUE; - } - } - return $ret; - } - - public function addIngestMethod($rule_id, $module, $file, $class, $method, $dsid, $modified_files_ext) { - $ret=FALSE; - if (self::validDsid($dsid) && ($rule=$this->getIngestRule($rule_id))!==FALSE) { - $methodsEl = $rule->getElementsByTagName('ingest_methods')->item(0); - $meth = $this->xml->createElement('ingest_method'); - $meth->setAttribute('module', $module); - $meth->setAttribute('file', $file); - $meth->setAttribute('class', $class); - $meth->setAttribute('method', $method); - $meth->setAttribute('dsid', $dsid); - $meth->setAttribute('modified_files_ext', $modified_files_ext); - - $methodsEl->appendChild($meth); - $ret = TRUE; - } - return $ret; - } - - public function removeIngestMethod($rule_id, $module, $file, $class, $method) { - $ret=FALSE; - if (($rule=$this->getIngestRule($rule_id))!==FALSE) { - $found=FALSE; - $methodsEl = $rule->getElementsByTagName('ingest_methods')->item(0); - $methods = $methodsEl->getElementsByTagName('ingest_method'); - for ($i=0;!$found && $i<$methods->length;$i++) { - if ($methods->item($i)->getAttribute('module') == $module && $methods->item($i)->getAttribute('file') == $file && $methods->item($i)->getAttribute('class') == $class && $methods->item($i)->getAttribute('method') == $method) { - $found = $methods->item($i); - } - } - - if ($found !== FALSE && $methods->length > 1) { - $methodsEl->removeChild($found); - $ret = TRUE; - } - } - return $ret; - } - - public function addIngestMethodParam($rule_id, $module, $file, $class, $method, $name, $value) { - $ret = FALSE; - if (($rule=$this->getIngestRule($rule_id)) !== FALSE) { - $methods = $rule->getElementsByTagName('ingest_methods')->item(0)->getElementsByTagName('ingest_method'); - $found = FALSE; - for ($i = 0; $found === FALSE && $i < $methods->length; $i++) { - if (($methods->item($i)->getAttribute('module') == '' ? 'fedora_repository' : $methods->item($i)->getAttribute('module')) == $module && - $methods->item($i)->getAttribute('file') == $file && - $methods->item($i)->getAttribute('class') == $class && - $methods->item($i)->getAttribute('method') == $method) { - $found=$methods->item($i); - } - } - - if ($found !== FALSE) { - $paramsEl = $found->getElementsByTagName('parameters'); - if ($paramsEl->length == 0) { - $paramsEl=$found->appendChild($this->xml->createElement('parameters')); - } - else { - $paramsEl=$paramsEl->item(0); - } - - $params = $paramsEl->getElementsByTagName('parameter'); - $found = FALSE; - for ($i=0; $found === FALSE && $i < $params->length; $i++) { - if ($params->item($i)->getAttribute('name') == $name) { - $found = $params->item($i); - } - } - - if ($found === FALSE) { - $param = $this->xml->createElement('parameter', $value); - $param->setAttribute('name', $name); - $paramsEl->appendChild($param); - $ret = TRUE; - } - } - } - return $ret; - } - - public function removeIngestMethodParam($rule_id, $module, $file, $class, $method, $name) { - $ret = FALSE; - if (($rule=$this->getIngestRule($rule_id)) !== FALSE) { - $found = FALSE; - $methodsEl = $rule->getElementsByTagName('ingest_methods')->item(0); - $methods = $methodsEl->getElementsByTagName('ingest_method'); - for ($i=0; !$found && $i < $methods->length; $i++) { - if (( trim($methods->item($i)->getAttribute('module')) == $module || (trim($methods->item($i)->getAttribute('module')) == '' && $module == 'fedora_repository')) && trim($methods->item($i)->getAttribute('file')) == $file && trim($methods->item($i)->getAttribute('class')) == $class && trim($methods->item($i)->getAttribute('method')) == $method) { - $found = $methods->item($i); - } - } - if ($found !== FALSE) { - $methodEl = $found; - $paramsEl = $found->getElementsByTagName('parameters'); - if ($paramsEl->length > 0) { - $paramsEl=$paramsEl->item(0); - $params = $paramsEl->getElementsByTagName('parameter'); - $found = FALSE; - for ($i=0; $found === FALSE && $i < $params->length; $i++) { - if ($params->item($i)->getAttribute('name') == $name) { - $found=$params->item($i); - } - } - - if ($found !== FALSE) { - $paramsEl->removeChild($found); - if ($params->length == 0) { - $methodEl->removeChild($paramsEl); - } - - $ret = TRUE; - } - } - - } - } - return $ret; - } - - public function removeIngestRule($rule_id) { - $ret = FALSE; - if (($rule = $this->getIngestRule($rule_id))!==FALSE) { - $ret = $this->xml->getElementsByTagName('ingest_rules')->item(0)->removeChild($rule); - } - return $ret; - } - - public function addIngestRule($applies_to, $module, $file, $class, $method, $dsid, $modified_files_ext) { - $ret = FALSE; - if (self::validDsid($dsid) && $this->validate()) { - $ingestRulesEl = $this->xml->getElementsByTagName('ingest_rules')->item(0); - $rule = $this->xml->createElement('rule'); - $ingestMethodsEl = $this->xml->createElement('ingest_methods'); - $rule->appendChild($ingestMethodsEl); - $ingestRulesEl->appendChild($rule); - $newRuleId = $ingestRulesEl->getElementsByTagName('rule')->length - 1; - $ret = ($this->addAppliesTo($newRuleId, $applies_to) && $this->addIngestMethod($newRuleId, $module, $file, $class, $method, $dsid, $modified_files_ext)); - } - return $ret; - } - - public function getIngestRules() { - $ret = FALSE; - if ($this->validate()) { - $ret = array(); - $rules = $this->xml->getElementsByTagName('ingest_rules')->item(0)->getElementsByTagName('rule'); - for ($i=0; $i < $rules->length; $i++) { - $rule = array('applies_to' => array(), - 'ingest_methods' => array()); - $applies_to = $rules->item($i)->getElementsByTagName('applies_to'); - for ($j=0; $j < $applies_to->length; $j++) { - $rule['applies_to'][] = trim($applies_to->item($j)->nodeValue); - } - - $methods = $rules->item($i)->getElementsByTagName('ingest_methods')->item(0)->getElementsByTagName('ingest_method'); - for ($j=0; $j < $methods->length; $j++) { - $method = array('module' => $methods->item($j)->getAttribute('module') == '' ? 'fedora_repository' : $methods->item($j)->getAttribute('module'), - 'file' => $methods->item($j)->getAttribute('file'), - 'class' => $methods->item($j)->getAttribute('class'), - 'method' => $methods->item($j)->getAttribute('method'), - 'dsid' => $methods->item($j)->getAttribute('dsid'), - 'modified_files_ext' => $methods->item($j)->getAttribute('modified_files_ext'), - 'parameters' => array()); - - $params = $methods->item($j)->getElementsByTagName('parameters'); - if ($params->length > 0) { - $params=$params->item(0)->getElementsByTagName('parameter'); - for ($k=0; $k < $params->length; $k++) { - $method['parameters'][$params->item($k)->getAttribute('name')] = $params->item($k)->nodeValue; - } - } - - $rule['ingest_methods'][] = $method; - - } - - $ret[] = $rule; - } - } - return $ret; - } - - public function getIngestFormAttributes() { - $ret = FALSE; - if ($this->validate()) { - $ingest_formEl = $this->xml->getElementsByTagName('ingest_form')->item(0); - $ret=array('dsid' => $ingest_formEl->getAttribute('dsid'), - 'page' => $ingest_formEl->getAttribute('page'), - 'hide_file_chooser' => strtolower($ingest_formEl->getAttribute('hide_file_chooser')) == 'true', - 'redirect' => strtolower($ingest_formEl->getAttribute('redirect')) == 'false' ? FALSE : TRUE); - - } - return $ret; - } - - public function editIngestFormAttributes($dsid, $page, $hide_file_chooser = FALSE, $redirect = TRUE) { - $ret = FALSE; - if (self::validDsid($dsid) && $this->validate()) { - $ingest_formEl = $this->xml->getElementsByTagName('ingest_form')->item(0); - $ingest_formEl->setAttribute('dsid', $dsid); - $ingest_formEl->setAttribute('page', $page); - if (!$redirect) { - $ingest_formEl->setAttribute('redirect', 'false'); - } - else { - $ingest_formEl->removeAttribute('redirect'); - } - if ($hide_file_chooser) { - $ingest_formEl->setAttribute('hide_file_chooser', 'true'); - } - else { - $ingest_formEl->removeAttribute('hide_file_chooser'); - } - $ret = TRUE; - } - return $ret; - } - - public function getIngestFormBuilderMethod() { - $ret = FALSE; - if ($this->validate()) { - $method = $this->xml->getElementsByTagName('ingest_form')->item(0)->getElementsByTagName('form_builder_method')->item(0); - $ret = array( 'module' => ($method->getAttribute('module')==''?'fedora_repository':$method->getAttribute('module')), - 'file' => $method->getAttribute('file'), - 'class' => $method->getAttribute('class'), - 'method' => $method->getAttribute('method'), - 'handler' => $method->getAttribute('handler')); - } - return $ret; - } - - public function editIngestFormBuilderMethod($module, $file, $class, $method, $handler) { - $ret = FALSE; - if ($this->validate()) { - $methodEl = $this->xml->getElementsByTagName('ingest_form')->item(0)->getElementsByTagName('form_builder_method')->item(0); - $methodEl->setAttribute('module', $module); - $methodEl->setAttribute('file', $file); - $methodEl->setAttribute('class', $class); - $methodEl->setAttribute('method', $method); - $methodEl->setAttribute('handler', $handler); - $ret = TRUE; - } - return $ret; - } - - /** - * Find the form element with name $name. - * - * @param string $name - * The name of the form element to find. - * @return DOMElement - * The form element $name, if found FALSE otherwise. - */ - public function getForm($name) { - $result = $this->xpath->query("//cm:form[@name='$name']"); - return $result->length == 1 ? $result->item(0) : FALSE; - } - - /** - * - * @return array - * An array of form names that exist in this content model. - */ - public function getFormNames() { - if (!$this->validate()) { - return FALSE; - } - $names = FALSE; - $result = $this->xpath->query('//cm:forms/cm:form/@name'); // Select the name attribute of all forms. - for($i = 0; $i < $result->length; $i++) { - $attribute = $result->item($i); - $name = $attribute->value; - $names[$name] = $name; - } - return $names; - } - - /** - * - * @return array - * An array of form names that exist in this content model. - */ - public function getIngestFormNames() { - if (!$this->validate()) { - return FALSE; - } - $result = $this->xpath->query('//cm:forms/cm:form[@ingest_class and @ingest_file and @ingest_module]/@name'); // Select the name attribute of all forms. - for($i = 0; $i < $result->length; $i++) { - $attribute = $result->item($i); - $name = $attribute->value; - $names[$name] = $name; - } - return $names; - } - - /** - * - * @return array - * An array of form names that exist in this content model. - */ - public function getEditFormNames() { - if (!$this->validate()) { - return FALSE; - } - $result = $this->xpath->query('//cm:forms/cm:form[@edit_class and @edit_file and @edit_module]/@name'); // Select the name attribute of all forms. - for($i = 0; $i < $result->length; $i++) { - $attribute = $result->item($i); - $name = $attribute->value; - $names[$name] = $name; - } - return $names; - } - - /** - * Removes the named form. - * - * @param string $name - * Name of the form to remove. - * - * @return boolean - * TRUE on success, FALSE otherwise. - */ - public function removeForm($name) { - $result = $this->xpath->query("//cm:form[@name='$name']"); - if ($result->length == 1) { - $form = $result->item(0); - $form->parentNode->removeChild($form); - return TRUE; - } - return FALSE; - } - - /** - * Adds the named form. - * - * @param string $element - * Name of the form to add. - * - * @return boolean - * TRUE on success, FALSE otherwise. - */ - public function addForm($element) { - $result = $this->xpath->query("//cm:forms"); - if ($result->length == 0) { // Forms doesn't exist - $forms = $this->xml->createElement('forms'); - $element = $this->xml->importNode($element); - $forms->appendChild($element); - $result = $this->xpath->query("//cm:content_model"); - $result->item(0)->appendChild($forms); - return TRUE; - } - else if ($result->length == 1) { - $element = $this->xml->importNode($element); - $result->item(0)->appendChild($element); - return TRUE; - } - return FALSE; - } - - - /** - * Edits a form element with attribute name='$name' from the 'forms' element. - * - * @param String $name - */ - public function editForm($name, $element) { - if (!$this->validate()) { - return FALSE; - } - $result = $this->xpath->query("//cm:form[@name='$name']"); - if($result->length == 1) { - $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; - } - return FALSE; - } - - /** - * - * @param $element_definition - * @param $parent_element - * @return - */ - public function addElementToForm($element, $parent_element) { - $element = $this->xml->importNode($element, TRUE); - $parent_element->appendChild($element); - return TRUE; - } - - /** - * - * @param $element_definition - * @param $parent_element - */ - public function editFormElement($new_element, $edit_element) { - $new_element = $this->xml->importNode($new_element, TRUE); - $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; - } - - /** - * - * @param $new_element - * @param $element - */ - private function insertElementInPlace($new_element, $element) { - $next = $element->nextSibling; - if ($next) { - $element->parentNode->insertBefore($new_element, $next); - } - else { - $element->parentNode->appendChild($new_element); - } - } - - /** - * - * @param $form_element - * @return - */ - public function incFormElement($form_element) { - $prev = $form_element; - $name = $prev->getAttribute('name'); - while ($prev = $prev->previousSibling) { - if (get_class($prev) == 'DOMElement') { - $form_element->parentNode->insertBefore($form_element, $prev); - break; - } - } - return TRUE; - } - - /** - * - * @param $form_element - * @return - */ - public function decFormElement($form_element) { - $next = $form_element; - while ($next = $next->nextSibling) { - if (get_class($next) == 'DOMElement') { - $this->insertElementInPlace($form_element, $next); - break; - } - } - return TRUE; - } - -} +get_content_models_list($pid); + foreach ($content_models as $content_model) { + if ($content_model != 'fedora-system:FedoraObject-3.0') { + $ret = $content_model; + break; + } + } + } + return $ret; + } + + /** + * Ingests a Content Model from a file to the specified pid/dsid . + * Returns FALSE on failure. + * + * @param string $pid + * @param string $name + * @param string $modelDsid + * @param string $file + * @return ContentModel $cm + */ + public static function ingestFromFile($pid, $name, $modelDsid, $file) { + $ret = FALSE; + + if (($cm = self::loadFromModel($pid, $modelDsid)) === FALSE && file_exists($file)) { + $cm = new ContentModel(file_get_contents($file), $pid, $modelDsid); + $rootEl = $cm->xml->getElementsByTagName('content_model')->item(0); + $rootEl->setAttribute('name', $name); + + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + $fedoraItem = new Fedora_Item($pid); + $fedoraItem->add_datastream_from_string($cm->dumpXml(), $modelDsid, $name, 'text/xml', 'X'); + $ret = $cm; + } + + return $ret; + } + + /** + * Ingests a Content Model from an existing model to the specified pid/dsid . + * Returns FALSE on failure. + * + * @param string $pid + * @param string $name + * @param string $modelDsid + * @param string $copy_model_pid + * @return ContentModel $cm + */ + public static function ingestFromModel($pid, $name, $modelDsid, $copy_model_pid) { + $ret = FALSE; + + if (($cm = self::loadFromModel($pid, $modelDsid)) === FALSE && ($copy_cm = self::loadFromModel($copy_model_pid)) !== FALSE && $copy_cm->validate()) { + $newDom = $copy_cm->xml; + $rootEl = $newDom->getElementsByTagName('content_model')->item(0); + $rootEl->setAttribute('name', $name); + + $cm = new ContentModel($newDom, $pid, $modelDsid); + + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + $fedoraItem = new Fedora_Item($pid); + $fedoraItem->add_datastream_from_string($cm->dumpXml(), $modelDsid, $name, 'text/xml', 'X'); + $ret = $cm; + } + + return $ret; + } + + /** + * Ingests a minimum Content Model to the specified pid/dsid. + * Returns FALSE on failure. + * + * @param string $pid + * @param string $name + * @param string $modelDsid + * @param string $defaultMimetype + * @param string $ingestFromDsid + * @param integer $ingestFormPage + * @param boolean $ingestFormHideFileChooser + * @param string $ingestFormModule + * @param string $ingestFormModule + * @param string $ingestFormFile + * @param string $ingestFormClass + * @param string $ingestFormMethod + * @param string $ingestFormHandler + * + * @return ContentModel $cm + */ + public static function ingestBlankModel($pid, $name, $modelDsid, $defaultMimetype, $ingestFormDsid, $ingestFormPage, $ingestFormHideChooser, $ingestFormModule, $ingestFormModule, $ingestFormFile, $ingestFormClass, $ingestFormMethod, $ingestFormHandler) { + $ret = FALSE; + if (($cm = self::loadFromModel($pid, $modelDsid)) === FALSE) { + $newDom = new DOMDocument('1.0', 'utf-8'); + $newDom->formatOutput = TRUE; + $rootEl = $newDom->createElement('content_model'); + $rootEl->setAttribute('name', $name); + $rootEl->setAttribute('xmlns', self::$XMLNS); + $rootEl->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); + $rootEl->setAttribute('xsi:schemaLocation', self::$XMLNS . ' ' . self::$SCHEMA_URI); + + $mimeEl = $newDom->createElement('mimetypes'); + $typeEl = $newDom->createElement('type', $defaultMimetype); + $mimeEl->appendChild($typeEl); + $rootEl->appendChild($mimeEl); + + $ingestRulesEl = $newDom->createElement('ingest_rules'); + $rootEl->appendChild($ingestRulesEl); + + $ingestFormEl = $newDom->createElement('ingest_form'); + $ingestFormEl->setAttribute('dsid', $ingestFormDsid); + $ingestFormEl->setAttribute('page', $ingestFormPage); + if ($ingestFormHideChooser == 'TRUE') { + $ingestFormEl->setAttribute('hide_file_chooser', 'TRUE'); + } + + $builderEl = $newDom->createElement('form_builder_method'); + $builderEl->setAttribute('module', $ingestFormModule); + $builderEl->setAttribute('file', $ingestFormFile); + $builderEl->setAttribute('class', $ingestFormClass); + $builderEl->setAttribute('method', $ingestFormMethod); + $builderEl->setAttribute('handler', $ingestFormHandler); + $ingestFormEl->appendChild($builderEl); + + $elementsEl = $newDom->createElement('form_elements'); + $ingestFormEl->appendChild($elementsEl); + $rootEl->appendChild($ingestFormEl); + $newDom->appendChild($rootEl); + + $cm = new ContentModel($newDom, $pid, $modelDsid); + + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + $fedoraItem = new Fedora_Item($pid); + $fedoraItem->add_datastream_from_string($cm->dumpXml(), $modelDsid, $name, 'text/xml', 'X'); + $ret = $cm; + } + + return $ret; + } + + /** + * Constructs a ContentModel object from the PID of the model in Fedora. + * If DSID is specified it will use that datastream as the model, otherwise it will + * use the default (usually ISLANDORACM). PID_NAMESPACE and name can also be initialized + * from the collection policy. + * Returns FALSE on failure. + * + * NOTE: $name will be overwritten with the content model name found in the datastream + * when the model is first validated.\ + * + * @param string $pid + * @param string $dsid + * @param string $pid_namespace + * @param string $name + * @return ContentModel $cm + */ + public static function loadFromModel($pid, $dsid = NULL, $pid_namespace = NULL, $name = NULL) { + $ret = FALSE; + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + try { + if (self::valid_pid($pid)) { + $fedoraItem = new Fedora_Item($pid); + if (!$name) { + $name = $fedoraItem->objectProfile->objLabel; + } + $dsid = ($dsid != NULL && self::valid_dsid($dsid)) ? $dsid : ContentModel::getDefaultDSID(); + $ds = $fedoraItem->get_datastream_dissemination($dsid); + if (!empty($ds)) { + $ret = new ContentModel($ds, $pid, $dsid, $pid_namespace, $name); + } + } + } catch (SOAPException $e) { + $ret = FALSE; + } + return $ret; + } + + /** + * Constructor + * NOTE: Use the static constructor methods whenever possible. + * + * @param string $xmlStr + * @param string $pid + * @param string $dsid + * @param string $pid_namespace + * @param string $name + * @return XMLDatastream $cm + */ + public function __construct($xmlStr, $pid = NULL, $dsid = NULL, $pid_namespace = NULL, $name = NULL) { + parent::__construct($xmlStr, $pid, $dsid); + $this->pid_namespace = $pid_namespace; + $this->name = ($name == NULL) ? 'Islandora Content Model' : $name; + $this->xpath = new DOMXPath($this->xml); + $this->xpath->registerNamespace('cm', 'http://www.islandora.ca'); + } + + /** + * Attempts to convert from the old XML schema to the new by + * traversing the XML DOM and building a new DOM. When done + * $this->xml is replaced by the newly created DOM.. + * + * @return void + */ + protected function convertFromOldSchema() { + $sXml = simplexml_load_string($this->xml->saveXML()); + $newDom = new DOMDocument('1.0', 'utf-8'); + $newDom->formatOutput = TRUE; + $rootEl = $newDom->createElement('content_model'); + $rootEl->setAttribute('name', $sXml['name']); + $rootEl->setAttribute('xmlns', self::$XMLNS); + $rootEl->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); + $rootEl->setAttribute('xsi:schemaLocation', self::$XMLNS . ' ' . self::$SCHEMA_URI); + + $mimeEl = $newDom->createElement('mimetypes'); + foreach ($sXml->mimetypes->type as $mime) { + $typeEl = $newDom->createElement('type', $mime); + $mimeEl->appendChild($typeEl); + } + $rootEl->appendChild($mimeEl); + + $ingestRulesEl = $newDom->createElement('ingest_rules'); + foreach ($sXml->ingest_rules->rule as $rule) { + $ruleEl = $newDom->createElement('rule'); + foreach ($rule->applies_to as $appTo) { + $applToEl = $newDom->createElement('applies_to', trim($appTo)); + $ruleEl->appendChild($applToEl); + } + if (isset($rule->methods->method) && count($rule->methods->method) > 0) { + $methodsEl = $newDom->createElement('ingest_methods'); + foreach ($rule->methods->method as $method) { + $methodEl = $newDom->createElement('ingest_method'); + $methodEl->setAttribute('module', $method->module); + $methodEl->setAttribute('file', $method->file); + $methodEl->setAttribute('class', $method->class_name); + $methodEl->setAttribute('method', $method->method_name); + $methodEl->setAttribute('dsid', $method->datastream_id); + $methodEl->setAttribute('modified_files_ext', $method->modified_files_ext); + + if (isset($method->parameters)) { + $paramsEl = $newDom->createElement('parameters'); + foreach ($method->parameters->parameter as $param) { + $paramEl = $newDom->createElement('parameter', $param); + $paramEl->setAttribute('name', $param['name']); + $paramsEl->appendChild($paramEl); + } + $methodEl->appendChild($paramsEl); + } + + + $methodsEl->appendChild($methodEl); + } + $ruleEl->appendChild($methodsEl); + $ingestRulesEl->appendChild($ruleEl); + } + } + $rootEl->appendChild($ingestRulesEl); + + if (isset($sXml->display_in_fieldset) && count($sXml->display_in_fieldset->datastream) > 0) { + $datastreamsEl = $newDom->createElement('datastreams'); + + foreach ($sXml->display_in_fieldset->datastream as $ds) { + $dsEl = $newDom->createElement('datastream'); + $dsEl->setAttribute('dsid', $ds['id']); + + if (isset($ds->add_datastream_method)) { + $add_ds_methodEl = $newDom->createElement('add_datastream_method'); + $add_ds_methodEl->setAttribute('module', $ds->add_datastream_method->module); + $add_ds_methodEl->setAttribute('file', $ds->add_datastream_method->file); + $add_ds_methodEl->setAttribute('class', $ds->add_datastream_method->class_name); + $add_ds_methodEl->setAttribute('method', $ds->add_datastream_method->method_name); + $add_ds_methodEl->setAttribute('dsid', $ds->add_datastream_method->datastream_id); + $add_ds_methodEl->setAttribute('modified_files_ext', $ds->add_datastream_method->modified_files_ext); + + if (isset($ds->add_datastream_method->parameters)) { + $paramsEl = $newDom->createElement('parameters'); + foreach ($ds->add_datastream_method->parameters->parameter as $param) { + $paramEl = $newDom->createElement('parameter', $param); + $paramEl->setAttribute('name', $param['name']); + $paramsEl->appendChild($paramEl); + } + $add_ds_methodEl->appendChild($paramsEl); + } + + $dsEl->appendChild($add_ds_methodEl); + } + + foreach ($ds->method as $disp_meth) { + $disp_methEl = $newDom->createElement('display_method'); + $disp_methEl->setAttribute('module', $disp_meth->module); + $disp_methEl->setAttribute('file', $disp_meth->file); + $disp_methEl->setAttribute('class', $disp_meth->class_name); + $disp_methEl->setAttribute('method', $disp_meth->method_name); + $dsEl->appendChild($disp_methEl); + } + $datastreamsEl->appendChild($dsEl); + } + $rootEl->appendChild($datastreamsEl); + } + + $ingest_formEl = $newDom->createElement('ingest_form'); + $ingest_formEl->setAttribute('dsid', $sXml->ingest_form['dsid']); + $ingest_formEl->setAttribute('page', $sXml->ingest_form['page']); + if (isset($sXml->ingest_form['hide_file_chooser'])) { + $ingest_formEl->setAttribute('hide_file_chooser', (strtolower($sXml->ingest_form['hide_file_chooser']) == 'TRUE') ? 'TRUE' : 'FALSE'); + } + + $form_builderEl = $newDom->createElement('form_builder_method'); + $form_builderEl->setAttribute('module', $sXml->ingest_form->form_builder_method->module); + $form_builderEl->setAttribute('file', $sXml->ingest_form->form_builder_method->file); + $form_builderEl->setAttribute('class', $sXml->ingest_form->form_builder_method->class_name); + $form_builderEl->setAttribute('method', $sXml->ingest_form->form_builder_method->method_name); + $form_builderEl->setAttribute('handler', $sXml->ingest_form->form_builder_method->form_handler); + $ingest_formEl->appendChild($form_builderEl); + + $form_elementsEl = $newDom->createElement('form_elements'); + foreach ($sXml->ingest_form->form_elements->element as $element) { + + //I found an XML where the label was HTML.. this code will attempt to + //walk the object setting the label to be the first string it finds. + if (count(get_object_vars($element->label)) > 0) { + $obj = $element->label; + while ($obj != NULL && !is_string($obj)) { + $keys = get_object_vars($obj); + $obj = array_shift($keys); + } + $element->label = ($obj == NULL) ? '' : $obj; + } + + $elEl = $newDom->createElement('element'); + $elEl->setAttribute('label', $element->label); + $elEl->setAttribute('name', $element->name); + $elEl->setAttribute('type', $element->type); + if (strtolower($element->required) == 'TRUE') { + $elEl->setAttribute('required', 'TRUE'); + } + if (isset($element->description) && trim($element->description) != '') { + $descEl = $newDom->createElement('description', trim($element->description)); + $elEl->appendChild($descEl); + } + if (isset($element->authoritative_list)) { + $authListEl = $newDom->createElement('authoritative_list'); + foreach ($element->authoritative_list->item as $item) { + $itemEl = $newDom->createElement('item', trim($item->value)); + if (trim($item->value) != trim($item->field)) { + $itemEl->setAttribute('field', trim($item->field)); + } + $authListEl->appendChild($itemEl); + } + $elEl->appendChild($authListEl); + } + $form_elementsEl->appendChild($elEl); + } + $ingest_formEl->appendChild($form_builderEl); + $ingest_formEl->appendChild($form_elementsEl); + $rootEl->appendChild($ingest_formEl); + + if (isset($sXml->edit_metadata) && + trim($sXml->edit_metadata->build_form_method->module) != '' && + trim($sXml->edit_metadata->build_form_method->file) != '' && + trim($sXml->edit_metadata->build_form_method->class_name) != '' && + trim($sXml->edit_metadata->build_form_method->method_name) != '' && + trim($sXml->edit_metadata->submit_form_method->method_name) != '' && + trim($sXml->edit_metadata->build_form_method['dsid']) != '' + ) { + $edit_metadata_methodEl = $newDom->createElement('edit_metadata_method'); + $edit_metadata_methodEl->setAttribute('module', $sXml->edit_metadata->build_form_method->module); + $edit_metadata_methodEl->setAttribute('file', $sXml->edit_metadata->build_form_method->file); + $edit_metadata_methodEl->setAttribute('class', $sXml->edit_metadata->build_form_method->class_name); + $edit_metadata_methodEl->setAttribute('method', $sXml->edit_metadata->build_form_method->method_name); + $edit_metadata_methodEl->setAttribute('handler', $sXml->edit_metadata->submit_form_method->method_name); + $edit_metadata_methodEl->setAttribute('dsid', $sXml->edit_metadata->build_form_method['dsid']); + $rootEl->appendChild($edit_metadata_methodEl); + } + + $newDom->appendChild($rootEl); + + $this->xml = DOMDocument::loadXML($newDom->saveXml()); + } + + /** + * Gets a list of service deployments that this model has. + * + * NOTE: Not currently being used. + * + * @return String[] $serviceDepPids + */ + public function getServices() { + $query = 'select $object $title from <#ri> + where ($object $title + and $object $deploymentOf + and $object + and $object pid . '> + and $object ) + order by $title'; + + module_load_include('inc', 'fedora_repository', 'CollectionClass'); + + $collectionHelper = new CollectionClass(); + $xml = simplexml_load_string($collectionHelper->getRelatedItems($this->pid, $query)); + + $results = array(); + foreach ($xml->results->result as $result) { + $pid = strval(($result->object['uri'])); + $pid = substr($pid, strpos($pid, "/") + 1, strlen($pid)); + $results[] = $pid; + } + + return $results; + } + + /** + * Gets the name of the ContentModel + * Returns FALSE on failure. + * + * @return String $name + */ + public function getName() { + $ret = FALSE; + if ($this->name != NULL) { + $ret = $this->name; + } + elseif ($this->validate()) { + $rootEl = $this->xml->getElementsByTagName('content_model')->item(0); + $this->name = $rootEl->getAttribute('name'); + $ret = $this->name; + } + return $ret; + } + + /** + * Gets the element corresponding to the datastream specified + * in the element of the schema. + * Returns FALSE on failure. + * + * @param $dsid + * @return DOMElement $datastream + */ + private function getDSModel($dsid) { + $ret = FALSE; + if (self::valid_dsid($dsid) && $this->validate()) { + $result = $this->xml->getElementsByTagName('datastreams'); + if ($result->length > 0) { + $result = $result->item(0)->getElementsByTagName('datastream'); + for ($i = 0; $ret == FALSE && $i < $result->length; $i++) { + if ($result->item($i)->getAttribute('dsid') == $dsid) + $ret = $result->item($i); + } + } + } + return $ret; + } + + /** + * Gets the DSID of the default datastream + * from the element of the schema. + * Returns FALSE on failure. + * + * @return String + */ + public function getDatastreamNameDSID() { + $datastreams = $this->xml->getElementsByTagName('datastreams'); + $datastream = $datastreams->item(0); + if ($datastreams->length > 0) { + $datastream = $datastreams->item(0)->getElementsByTagName('datastream'); + return $datastream->item(0)->getAttribute('dsid'); + } + } + + /** + * Gets an array of form elements to use in the ingest form. The results of this array are passed + * to the specified ingest form builder. The form builder can optionally not use the elements as defined + * in the form builder if more complex forms or behaviour is required. + * Each element has the following keys: 'label', 'type', 'required', 'description', and if defined, 'authoritative_list' and/or 'parameters' + * + * @return string[] $elements + */ + public function getIngestFormElements() { + $ret = FALSE; + if ($this->validate()) { + $elements_array = array(); + $form_elements_wrapper = $this->xml->getElementsbyTagName('ingest_form')->item(0)->getElementsByTagName('form_elements'); + + if ($form_elements_wrapper->length == 0) { + return $ret; + } + $elements = $this->xml->getElementsbyTagName('ingest_form')->item(0)->getElementsByTagName('form_elements')->item(0)->getElementsByTagName('element'); + for ($i = 0; $i < $elements->length; $i++) { + $desc = $elements->item($i)->getElementsByTagName('description'); + $desc = ($desc->length > 0) ? $desc->item(0)->nodeValue : ''; + + $label = $elements->item($i)->getAttribute('label'); + if ($label == NULL) { + $label = $elements->item($i)->getAttribute('name'); + } + + $element = array('name' => $elements->item($i)->getAttribute('name'), + 'label' => $label, + 'type' => $elements->item($i)->getAttribute('type'), + 'required' => ($elements->item($i)->getAttribute('required') == 'TRUE') ? TRUE : FALSE, + 'description' => $desc + ); + + $auth_list = $elements->item($i)->getElementsByTagName('authoritative_list'); + if ($auth_list->length > 0) { + $list = array(); + $items = $auth_list->item(0)->getElementsByTagName('item'); + for ($j = 0; $j < $items->length; $j++) { + $field = $items->item($j)->attributes->getNamedItem('field'); + $list[$items->item($j)->nodeValue] = ($field !== NULL) ? $field->nodeValue : $items->item($j)->nodeValue; + } + $element['authoritative_list'] = $list; + } + + + $params = $elements->item($i)->getElementsByTagName('parameters'); + $list = array(); + if ($params->length > 0) { + $items = $params->item(0)->getElementsByTagName('parameter'); + for ($j = 0; $j < $items->length; $j++) { + $value = $items->item($j)->nodeValue; + $list[$items->item($j)->getAttribute('name')] = (strtolower($value) == 'TRUE' ? TRUE : (strtolower($value) == 'FALSE' ? FALSE : $value)); + } + } + $element['parameters'] = $list; + + $elements_array[] = $element; + } + $ret = $elements_array; + } + + return $ret; + } + + /** + * Decrements an ingest form element in the list of elements. + * Updates the "order". This method is simply an overload to the incIngestFormElement + * which has a direction parameter. + * + * TODO: Might be useful to move multiple places at once, or define + * a method to move to an absolute position. + * + * @param String $name + * @return boolean $success + */ + public function decIngestFormElement($name) { + return $this->incIngestFormElement($name, 'dec'); + } + + /** + * Increments (or decrements) ingest form element in the list of elements. + * Updates the "order". The $reorder parameter accepts 'inc' or 'dec' to + * specify the direction to move (defaults to increment.) + * + * TODO: Might be useful to move multiple places at once, or define + * a method to move to an absolute position. + * + * @param String $name + * @param String $reorder + * @return boolean $success + */ + public function incIngestFormElement($name, $reorder = 'inc') { + $ret = FALSE; + if ($this->validate()) { + $elementsEl = $this->xml->getElementsbyTagName('ingest_form')->item(0)->getElementsByTagName('form_elements')->item(0); + $elements = $elementsEl->getElementsByTagName('element'); + $found = FALSE; + $ref_el = FALSE; + for ($i = 0; $found === FALSE && $i < $elements->length; $i++) { + if ($elements->item($i)->getAttribute('name') == trim($name)) { + if ($reorder == 'inc') { + $found = $elements->item($i); + $ref_el = ($i > 0) ? $elements->item($i - 1) : FALSE; + } + else { + $found = ($i + 1 < $elements->length) ? $elements->item($i + 1) : FALSE; + $ref_el = $elements->item($i); + } + } + } + + if ($found !== FALSE) { + $elementsEl->removeChild($found); + $elementsEl->insertBefore($found, $ref_el); + $ret = TRUE; + } + } + return $ret; + } + + /** + * Removes an ingest form element from the list of ingest form elements. + * @param String $name + * @return boolean $success + */ + public function removeIngestFormElement($name) { + $ret = FALSE; + if ($this->validate()) { + $elementsEl = $this->xml->getElementsbyTagName('ingest_form')->item(0)->getElementsByTagName('form_elements')->item(0); + $elements = $elementsEl->getElementsByTagName('element'); + $found = FALSE; + for ($i = 0; $found === FALSE && $i < $elements->length; $i++) { + if ($elements->item($i)->getAttribute('name') == trim($name)) { + $found = $elements->item($i); + } + } + + if ($found !== FALSE) { + $elementsEl->removeChild($found); + $ret = TRUE; + } + } + return $ret; + } + + /** + * Sets a parameter of an ingest form element. If the value of the element is FALSE the parameter + * will be removed entirely (if you want to store FALSE as a value, then send the String "FALSE"). + * + * @param String $elementName + * @param String $paramName + * @param String $paramValue + * @return boolean success + */ + public function setIngestFormElementParam($name, $paramName, $paramValue) { + $ret = FALSE; + + if ($this->validate()) { + $elements = $this->xml->getElementsbyTagName('ingest_form')->item(0)->getElementsByTagName('form_elements')->item(0)->getElementsByTagName('element'); + $element = FALSE; + for ($i = 0; $element === FALSE && $i < $elements->length; $i++) { + if ($elements->item($i)->getAttribute('name') == $name) { + $element = $elements->item($i); + } + } + + if ($element !== FALSE) { + $paramsEl = $element->getElementsByTagName('parameters'); + if ($paramsEl->length == 0) { + if ($paramValue !== FALSE) { + $paramsEl = $this->xml->createElement('parameters'); + $element->appendChild($paramsEl); + } + else { + $ret = TRUE; + } + } + else { + $paramsEl = $paramsEl->item(0); + } + + if (!$ret) { + $params = $paramsEl->getElementsByTagName('parameter'); + $found = FALSE; + for ($i = 0; $found === FALSE && $i < $params->length; $i++) { + if ($params->item($i)->getAttribute('name') == $paramName) { + $found = $params->item($i); + } + } + + if ($paramValue === FALSE) { + if ($found !== FALSE) { + $paramsEl->removeChild($found); + if ($params->length == 0) { + $element->removeChild($paramsEl); + } + } + $ret = TRUE; + } + else { + if ($found !== FALSE) { + $found->nodeValue = $paramValue; + } + else { + $paramEl = $this->xml->createElement('parameter', $paramValue); + $paramEl->setAttribute('name', $paramName); + $paramsEl->appendChild($paramEl); + } + $ret = TRUE; + } + } + } + } + + return $ret; + } + + /** + * Gets a list of all parameters that belong to the specified ingest form element. + * + * @param String $elementName + * @return boolean success + */ + public function getIngestFormElementParams($name) { + $ret = FALSE; + + if ($this->validate()) { + $elements = $this->xml->getElementsbyTagName('ingest_form')->item(0)->getElementsByTagName('form_elements')->item(0)->getElementsByTagName('element'); + $element = FALSE; + for ($i = 0; $element === FALSE && $i < $elements->length; $i++) { + if ($elements->item($i)->getAttribute('name') == $name) { + $element = $elements->item($i); + } + } + + if ($element !== FALSE) { + $ret = array(); + $paramsEl = $element->getElementsByTagName('parameters'); + + if ($paramsEl->length > 0) { + $params = $paramsEl->item(0)->getElementsByTagName('parameter'); + for ($i = 0; $i < $params->length; $i++) { + $ret[$params->item($i)->getAttribute('name')] = $params->item($i)->nodeValue; + } + } + } + } + + return $ret; + } + + /** + * Edits the ingest form element specified. + * NOTE: The element name can not be changed. To update an elements name + * it must be deleted and added with the new name. + * + * @param String $name + * @param String $label + * @param String $type + * @param boolean $required + * @param String description + * @return boolean success + */ + public function editIngestFormElement($name, $label, $type, $required, $description) { + $ret = FALSE; + if ($this->validate()) { + $elements = $this->xml->getElementsbyTagName('ingest_form')->item(0)->getElementsByTagName('form_elements')->item(0)->getElementsByTagName('element'); + $found = FALSE; + for ($i = 0; $found === FALSE && $i < $elements->length; $i++) { + if ($elements->item($i)->getAttribute('name') == $name) { + $found = $elements->item($i); + } + } + + $found->setAttribute('name', $name); + $found->setAttribute('type', $type); + $found->setAttribute('required', $required ? 'TRUE' : 'FALSE'); + if (trim($label) != '' && trim($label) != trim($name)) { + $found->setAttribute('label', $label); + } + elseif ($found->getAttribute('label') != '') { + $found->removeAttribute('label'); + } + + $descEl = $found->getElementsByTagName('description'); + if (trim($description) != '') { + if ($descEl->length > 0) { + $descEl = $descEl->item(0); + $descEl->nodeValue = $description; + } + else { + $descEl = $this->xml->createElement('description', $description); + $found->appendChild($descEl); + } + } + elseif ($descEl->length > 0) { + $found->removeChild($descEl->item(0)); + } + + if ($found->getAttribute('type') != 'select' && $found->getAttribute('type') != 'radio') { + $authList = $found->getElementsByTagName('authoritative_list'); + if ($authList->length > 0) { + $found->removeChild($authList->item(0)); + } + } + + $ret = TRUE; + } + return $ret; + } + + /** + * Add an ingest form element to the model. + * + * @param String $name + * @param String $label + * @param String $type + * @param boolean $required + * @param String $description + * @return boolean $success + */ + public function addIngestFormElement($name, $label, $type, $required, $description = '') { + $ret = FALSE; + if ($this->validate()) { + $elements = $this->xml->getElementsbyTagName('ingest_form')->item(0)->getElementsByTagName('form_elements')->item(0); + $elementEl = $this->xml->createElement('element'); + $elementEl->setAttribute('name', $name); + $elementEl->setAttribute('type', $type); + $elementEl->setAttribute('required', $requiredi ? 'TRUE' : 'FALSE'); + if (trim($label) != '' && trim($label) != trim($name)) { + $elementEl->setAttribute('label', $label); + } + if (trim($description) != '') { + $descEl = $this->xml->createElement('description', $description); + $elementEl->appendChild($descEl); + } + $elements->appendChild($elementEl); + + $ret = TRUE; + } + return $ret; + } + + /** + * Decrements an authority list item from a form element in the list of elements. + * Updates the "order". This method is simply an overload to the incAuthListItem + * which has a direction parameter. + + * + * @param String $elementName + * @param String $value + * @return boolean $success + */ + public function decAuthListItem($elementName, $value) { + return $this->incAuthListItem($elementName, $value, 'dec'); + } + + /** + * Increments (or decrements) an authority list item from a form element in the list of elements. + * Updates the "order". + * + * @param String $elementName + * @param String $value + * @param String $direction + * @return boolean $success + */ + public function incAuthListItem($elementName, $value, $reorder = 'inc') { + $ret = FALSE; + if ($this->validate()) { + $elements = $this->xml->getElementsbyTagName('ingest_form')->item(0)->getElementsByTagName('form_elements')->item(0)->getElementsByTagName('element'); + $found = FALSE; + for ($i = 0; $found === FALSE && $i < $elements->length; $i++) { + if ($elements->item($i)->getAttribute('name') == $elementName) { + $found = $elements->item($i); + } + } + + if ($found !== FALSE) { + + $authListEl = $found->getElementsByTagName('authoritative_list'); + if ($authListEl->length > 0) { + $authListEl = $authListEl->item(0); + + $items = $authListEl->getElementsByTagName('item'); + $found = FALSE; + $ref_el = FALSE; + for ($i = 0; $found === FALSE && $i < $items->length; $i++) { + if ($items->item($i)->nodeValue == $value) { + if ($reorder == 'inc') { + $ref_el = ($i > 0) ? $items->item($i - 1) : FALSE; + $found = $items->item($i); + } + else { + $ref_el = $items->item($i); + $found = ($i + 1 < $items->length) ? $items->item($i + 1) : FALSE; + } + } + } + + if ($found !== FALSE && $ref_el !== FALSE) { + $authListEl->removeChild($found); + $authListEl->insertBefore($found, $ref_el); + $ret = TRUE; + } + } + } + } + return $ret; + } + + /** + * Removes an authority list item from a form element. + * @param String $elementName + * @param String $value + * @return boolean $success + */ + public function removeAuthListItem($elementName, $value) { + $ret = FALSE; + if ($this->validate()) { + $elements = $this->xml->getElementsbyTagName('ingest_form')->item(0)->getElementsByTagName('form_elements')->item(0)->getElementsByTagName('element'); + $found = FALSE; + for ($i = 0; $found === FALSE && $i < $elements->length; $i++) { + if ($elements->item($i)->getAttribute('name') == $elementName) { + $found = $elements->item($i); + } + } + + if ($found !== FALSE) { + $authListEl = $found->getElementsByTagName('authoritative_list'); + if ($authListEl->length > 0) { + $authListEl = $authListEl->item(0); + $items = $authListEl->getElementsByTagName('item'); + $found = FALSE; + for ($i = 0; $found === FALSE && $i < $items->length; $i++) { + if ($items->item($i)->nodeValue == $value) { + $found = $items->item($i); + } + } + + if ($found !== FALSE) { + if ($items->length == 1) { + $found->removeChild($authListEl); + } + else { + $authListEl->removeChild($found); + } + + $ret = TRUE; + } + } + } + } + return $ret; + } + + /** + * Adds an authority list item to a form element. + * @param String $elementName + * @param String $value + * @param String $label (optional) + * @return boolean $success + */ + public function addAuthListItem($elementName, $value, $label = '') { + $ret = FALSE; + if ($this->validate()) { + $elements = $this->xml->getElementsbyTagName('ingest_form')->item(0)->getElementsByTagName('form_elements')->item(0)->getElementsByTagName('element'); + $found = FALSE; + for ($i = 0; $found === FALSE && $i < $elements->length; $i++) { + if ($elements->item($i)->getAttribute('name') == $elementName) { + $found = $elements->item($i); + } + } + + if ($found !== FALSE) { + $authListEl = $found->getElementsByTagName('authoritative_list'); + if ($authListEl->length == 0) { + $authListEl = $this->xml->createElement('authoritative_list'); + $found->appendChild($authListEl); + } + else { + $authListEl = $authListEl->item(0); + } + + $items = $authListEl->getElementsByTagName('item'); + $found = FALSE; + for ($i = 0; $found == FALSE && $i < $items->length; $i++) { + if ($items->item($i)->nodeValue == $value) { + $found = TRUE; + } + } + + if (!$found) { + $itemEl = $this->xml->createElement('item', trim($value)); + if (trim($label) != '' && trim($label) != trim($value)) { + $itemEl->setAttribute('field', trim($label)); + } + $authListEl->appendChild($itemEl); + $ret = TRUE; + } + } + } + return $ret; + } + + /** + * Builds an ingest form using the method specified in element of + * Returns FALSE on failure. + * + * @param &$form + * @param &$form_state + * @return string identifier + */ + public function buildIngestForm(&$form, &$form_state) { + $ret = FALSE; + if ($this->validate()) { + $docRoot = $_SERVER['DOCUMENT_ROOT']; + $file = (isset($form_state['values']['ingest-file-location']) ? $form_state['values']['ingest-file-location'] : ''); + + $fullpath = $file; + + $form['step'] = array( + '#type' => 'hidden', + '#value' => (isset($form_state['values']['step']) ? $form_state['values']['step'] : 0) + 1, + ); + $form['ingest-file-location'] = array( + '#type' => 'hidden', + '#value' => $file, + ); + $form['content_model_name'] = array( + '#type' => 'hidden', + '#value' => 'ISLANDORACM', + ); + $form['models'] = array(//content models available + '#type' => 'hidden', + '#value' => $form_state['values']['models'], + ); + $form['fullpath'] = array( + '#type' => 'hidden', + '#value' => $fullpath, + ); + + $form['#attributes']['enctype'] = 'multipart/form-data'; + $form['indicator']['ingest-file-location'] = array( + '#type' => 'file', + '#title' => t('Upload Document'), + '#size' => 48, + '#description' => t('Full text'), + ); + + $ingest_form = $this->xml->getElementsByTagName('ingest_form')->item(0); + + if (!empty($ingest_form)) { + if (strtolower($ingest_form->getAttribute('hide_file_chooser')) == 'TRUE') { + $form['indicator']['ingest-file-location']['#type'] = 'hidden'; + } + } + $dsid = $ingest_form->getAttribute('dsid'); + + $method = $ingest_form->getElementsByTagName('form_builder_method')->item(0); + $module = $method->getAttribute('module'); + $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file'); + if (!file_exists($path)) { + self::$errors[] = 'Build Ingest Form: file \'' . $path . '\' does not exist.'; + } + else { + @require_once($path); + $className = $method->getAttribute('class'); + $methodName = ($method->getAttribute('method')); + if (!class_exists($className)) { + self::$errors[] = 'Build Ingest Form: class \'' . $className . ' does not exist.'; + } + else { + $class = new $className; + $elements_array = $this->getIngestFormElements(); + if (method_exists($class, $methodName)) { + $ret = $class->$methodName($form, $elements_array, $form_state); + } + else { + self::$errors[] = 'Build Ingest Form: method \'' . $className . '->' . $methodName . '\' does not exist.'; + } + } + } + } + return $ret; + } + + /** + * Builds an edit metadata form using the method specified in the element + * The DSID specified must match the DSID attribute of . Returns FALSE on failure. + * + * @param string $dsid + * @return $form + */ + public function buildEditMetadataForm($pid, $dsid) { + $ret = FALSE; + if (self::valid_dsid($dsid) && $this->validate()) { + $method = $this->xml->getElementsByTagName('edit_metadata_method'); + if ($method->length > 0 && $method->item(0)->getAttribute('dsid') == $dsid) { + $method = $method->item(0); + $module = $method->getAttribute('module'); + $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file'); + if (!file_exists($path)) { + self::$errors[] = 'Build Edit Metadata Form: file \'' . $path . '\' does not exist.'; + } + else { + @require_once($path ); + $className = $method->getAttribute('class'); + $methodName = ($method->getAttribute('method')); + if (!class_exists($className)) { + self::$errors[] = 'Build Edit Metadata Form: class \'' . $className . '\' does not exist.'; + } + else { + $class = new $className($pid); + if (!method_exists($class, $methodName)) { + self::$errors[] = 'Build Edit Metadata Form: method \'' . $className . '->' . $methodName . '\' does not exist.'; + } + else { + $ret = $class->$methodName(); + } + } + } + } + } + return $ret; + } + + /** + * Handles the edit metadata form using the handler specified in the element + * Returns FALSE on failure. + * + * @param &$form_id + * @param &$form_values + * @param &$soap_client + * @return $result + */ + public function handleEditMetadataForm(&$form_id, &$form_state, &$soap_client) { + global $base_url; + $ret = FALSE; + if ($this->validate()) { + $method = $this->xml->getElementsByTagName('edit_metadata_method'); + if ($method->length > 0) { + $method = $method->item(0); + $module = $method->getAttribute('module'); + $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file'); + if (!file_exists($path)) { + self::$errors[] = 'Handle Edit Metadata Form: file \'' . $path . '\' does not exist.'; + } + else { + @require_once($path); + $className = $method->getAttribute('class'); + $methodName = ($method->getAttribute('handler')); + if (!class_exists($className)) { + self::$errors[] = 'Handle Edit Metadata Form: class \'' . $className . '\' does not exist.'; + } + else { + $class = new $className($form_state['values']['pid']); + if (!method_exists($class, $methodName)) { + self::$errors[] = 'Handle Edit Metadata Form: metho \'' . $className . '->' . $methodName . '\' does not exist.'; + } + else { + $ret = $class->$methodName($form_id, $form_state['values'], $soap_client); + } + } + } + } + else { + // Assume DC form if none is specified. + module_load_include('inc', 'fedora_repository', 'formClass'); + $metaDataForm = new formClass(); + $ret = $metaDataForm->updateMetaData($form_state['values']['form_id'], $form_state['values'], $soap_client); + $form_state['storage'] = NULL; + $form_state['redirect'] = $base_url . '/fedora/repository/' . $form_state['values']['pid']; + } + } + return $ret; + } + + /** + * Gets an associative array describing the edit metadata method. + * Array has the following keys: 'file', 'class', 'method', 'handler', 'dsid' + * @return String[] $method + */ + public function getEditMetadataMethod() { + $ret = FALSE; + if ($this->validate()) { + $method = $this->xml->getElementsByTagName('content_model')->item(0)->getElementsByTagName('edit_metadata_method'); + if ($method->length > 0) { + $method = $method->item(0); + $ret = array('module' => $method->getAttribute('module') == '' ? 'fedora_repository' : $method->getAttribute('module'), + 'file' => $method->getAttribute('file'), + 'class' => $method->getAttribute('class'), + 'method' => $method->getAttribute('method'), + 'handler' => $method->getAttribute('handler'), + 'dsid' => $method->getAttribute('dsid') + ); + } + } + return $ret; + } + + /** + * Removes the edit data method from the Content Model. + * @return boolean $success + */ + public function removeEditMetadataMethod() { + $ret = FALSE; + if ($this->validate()) { + $rootEl = $this->xml->getElementsByTagName('content_model')->item(0); + $method = $rootEl->getElementsByTagName('edit_metadata_method'); + if ($method->length > 0) { + $rootEl->removeChild($method->item(0)); + $ret = TRUE; + } + } + return $ret; + } + + /** + * Update the Edit Metadata Method defined in the Content Model + * @param String $module + * @param String $file + * @param String $class + * @param String $method + * @param String $handler + * @param String $dsid + * @return boolean $success + */ + public function updateEditMetadataMethod($module, $file, $class, $method, $handler, $dsid) { + $ret = FALSE; + if (self::valid_dsid($dsid) && $this->validate()) { + $methodEl = $this->xml->getElementsByTagName('content_model')->item(0)->getElementsByTagName('edit_metadata_method'); + if ($methodEl->length > 0) { + $methodEl = $methodEl->item(0); + } + else { + $methodEl = $this->xml->createElement('edit_metadata_method'); + $this->xml->getElementsByTagName('content_model')->item(0)->appendChild($methodEl); + } + $methodEl->setAttribute('module', $module); + $methodEl->setAttribute('file', $file); + $methodEl->setAttribute('class', $class); + $methodEl->setAttribute('method', $method); + $methodEl->setAttribute('handler', $handler); + $methodEl->setAttribute('dsid', $dsid); + $ret = TRUE; + } + return $ret; + } + + /** + * Executes the add datastream method for the specified datastream on the specified file. + * Returns FALSE on failure. + * + * @param string $dsid + * @param string $filen + * @return $result + */ + public function execAddDatastreamMethods($dsid, $file) { + $ret = FALSE; + if (self::valid_dsid($dsid) && $this->validate() && ($ds = $this->getDSModel($dsid)) !== FALSE) { + $addMethod = $ds->getElementsByTagName('add_datastream_method'); + if ($addMethod->length > 0) { + $addMethod = $addMethod->item(0); + $paramArray = array(); + $params = $addMethod->getElementsByTagName('parameters'); + if ($params->length > 0) { + $params = $params->item(0)->getElementsByTagName('parameter'); + for ($i = 0; $i < $params->length; $i++) { + $paramsArray[$params->item($i)->getAttribute('name')] = $params->item($i)->nodeValue; + } + } + $module = $addMethod->getAttribute('module'); + $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $addMethod->getAttribute('file'); + if (!file_exists($path)) { + self::$errors[] = 'Execute Add Datastream Methods: file \'' . $path . '\' does not exist.'; + } + else { + @require_once($path); + $className = $addMethod->getAttribute('class'); + $methodName = $addMethod->getAttribute('method'); + if (!class_exists($className)) { + self::$errors[] = 'Execute Add Datastream Methods: class \'' . $className . '\' does not exist.'; + } + else { + $class = new $className; + if (!method_exists($class, $methodName)) { + self::$errors[] = 'Execute Add Datastream Methods: method \'' . $className . '->' . $methodName . '\' does not exist.'; + } + else { + $ret = $class->$methodName($paramsArray, $addMethod->getAttribute('dsid'), $file, $addMethod->getAttribute('modified_files_ext')); + } + } + } + } + } + return $ret; + } + + /** + * Executes the ingest rules that apply to the specified file/mimetype. + * Returns FALSE on failure. + * + * If $preview is TRUE, then only execute rules with + * a parameter 'preview'. Used to generate previews for the file chooser. + * + * @param string $file + * @param string $mimetype + * @param boolean $preview + * @return $result + */ + public function execIngestRules($file, $mimetype, $preview = FALSE) { + $ret = FALSE; + if ($this->validate()) { + $ret = TRUE; + $rules = $this->xml->getElementsByTagName('ingest_rules')->item(0)->getElementsByTagName('rule'); + for ($i = 0; $i < $rules->length; $i++) { + $rule = $rules->item($i); + $types = $rule->getElementsbyTagName('applies_to'); + $valid_types = array(); + for ($j = 0; $j < $types->length; $j++) { + $valid_types[] = trim($types->item($j)->nodeValue); + } + + if (in_array($mimetype, $valid_types)) { + $methods = $rule->getElementsByTagName('ingest_methods'); + if ($methods->length > 0) { + $methods = $methods->item(0)->getElementsbyTagName('ingest_method'); + for ($j = 0; $j < $methods->length; $j++) { + $method = $methods->item($j); + $param_array = array(); + $params = $method->getElementsByTagName('parameters'); + $param_array['model_pid'] = $this->pid; + if ($params->length > 0) { + $params = $params->item(0)->getElementsByTagName('parameter'); + for ($k = 0; $k < $params->length; $k++) + $param_array[$params->item($k)->getAttribute('name')] = $params->item($k)->nodeValue; + } + + + if (!$preview || isset($param_array['preview'])) { + $module = $method->getAttribute('module'); + $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file'); + + if (!file_exists($path) || substr_compare($path, 'fedora_repository/', -strlen('fedora_repository/'), strlen('fedora_repository/')) === 0) { + self::$errors[] = 'Execute Ingest Rules: file \'' . $path . '\' does not exist.'; + $ret = FALSE; + } + else { + require_once($path); + $className = $method->getAttribute('class'); + $methodName = ($method->getAttribute('method')); + if (!class_exists($className)) { + self::$errors[] = 'Execute Ingest Rules: class \'' . $className . '\' does not exist.'; + $ret = FALSE; + } + else + $class = new $className; + if (!method_exists($class, $methodName)) { + self::$errors[] = 'Execute Ingest Rules: method \'' . $className . '->' . $methodName . '\' does not exist.'; + $ret = FALSE; + } + else { + $status = $class->$methodName($param_array, $method->getAttribute('dsid'), $file, $method->getAttribute('modified_files_ext')); + if ($status !== TRUE) { + self::$errors[] = 'Execute Ingest Rules: method \'' . $className . '->' . $methodName . '\' failed.'; + $ret = FALSE; + } + } + } + } + } + } + } + } + } + return $ret; + } + + /** + * Executes the form handler from the element of . + * + * @param &$formData + * @param &$form_state + * @return boolean $success + */ + public function execFormHandler(&$data, &$form_state) { + $ret = FALSE; + if ($this->validate()) { + $method = $this->xml->getElementsByTagName('ingest_form')->item(0)->getElementsByTagName('form_builder_method')->item(0); + $module = $method->getAttribute('module'); + $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file'); + if (!file_exists($path)) { + self::$errors[] = 'Execute Form Handler: file \'' . $path . '\' does not exist.'; + } + else { + require_once($path); + $className = $method->getAttribute('class'); + $methodName = ($method->getAttribute('handler')); + if (!class_exists($className)) { + self::$errors[] = 'Execute Form Handler: class \'' . $className . '\' does not exist.'; + } + else { + $class = new $className; + if (!method_exists($class, $methodName)) { + self::$errors[] = 'Execute Form Handler: method \'' . $className . '->' . $methodName . '\' does not exist.'; + } + else { + $class->$methodName($data, $form_state); + $ret = TRUE; + } + } + } + } + + return $ret; + } + + /** + * Gets a list of valid mimetypes that can apply to this model. + * Returns FALSE on failure. + * + * @return string[] $mimetypes + */ + public function getMimetypes() { + //only proceed if the xml is valid. + if ($this->validate()) { + if ($this->mimes === NULL) { + $result = $this->xml->getElementsByTagName('mimetypes'); + $result = $result->item(0)->getElementsByTagName('type'); + $mimes = array(); + for ($i = 0; $i < $result->length; $i++) { + $mimes[] = trim($result->item($i)->nodeValue); + } + $this->mimes = $mimes; + } + return $this->mimes; + } + } + + /** + * Calls all defined display methods for the ContentModel. + * The PID specified is passed to the constructor of the display + * class(es) specified in the Content Model. + * + * @param string $pid + * @return string $output + */ + public function displayExtraFieldset($pid, $page_number) { + $output = ''; + if ($this->validate()) { + $datastreams = $this->xml->getElementsByTagName('datastreams'); + if ($datastreams->length > 0) { + $datastreams = $datastreams->item(0)->getElementsByTagName('datastream'); + for ($i = 0; $i < $datastreams->length; $i++) { + $ds = $datastreams->item($i); + if ($ds->attributes->getNamedItem('display_in_fieldset') == NULL || strtolower($ds->getAttribute('display_in_fieldset')) != 'FALSE') { + $dispMethods = $ds->getElementsByTagName('display_method'); + for ($j = 0; $j < $dispMethods->length; $j++) { + $method = $dispMethods->item($j); + $module = $method->getAttribute('module'); + $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file'); + if (!file_exists($path)) { + self::$errors[] = 'Execute Form Handler: file \'' . $path . '\' does not exist.'; + } + else { + require_once($path); + $className = $method->getAttribute('class'); + $methodName = ($method->getAttribute('method')); + if (!class_exists($className)) { + self::$errors[] = 'Execute Form Handler: class \'' . $className . '\' does not exist.'; + } + else { + $class = new $className($pid); + if (!method_exists($class, $methodName)) { + self::$errors[] = 'Execute Form Handler: method \'' . $className . '->' . $methodName . '\' does not exist.'; + } + else { + $output = $class->$methodName($page_number); + } + } + } + } + } + } + } + } + + return $output; + } + + /** + * Gets a list of datastreams from the ContentModel + * (not including the QDC ds if it is listed). + * Returns FALSE on failure. + * + * @return string[] $datastreams + */ + public function listDatastreams() { + $ds_array = array(); + if ($this->validate()) { + $datastreams = $this->xml->getElementsByTagName('datastreams'); + if ($datastreams->length > 0) { + $datastreams = $datastreams->item(0)->getElementsByTagName('datastream'); + for ($i = 0; $i < $datastreams->length; $i++) { + $dsName = $datastreams->item($i)->getAttribute('dsid'); + // if ($dsName != 'QDC') + // { + $ds_array[] = $dsName; + // } + } + } + } + + return $ds_array; + } + + /** + * Adds an allowed mimetype to the model. + * + * @param String $type + * @return boolean $success + */ + public function addMimetype($type) { + $ret = FALSE; + if ($this->validate()) { + $mimetypesEl = $this->xml->getElementsByTagName('mimetypes')->item(0); + $types = $mimetypesEl->getElementsByTagName('type'); + + $found = FALSE; + for ($i = 0; !$found && $i < $types->length; $i++) { + if ($types->item($i)->nodeValue == $type) + $found = TRUE; + } + + if (!$found) { + $newTypeEl = $this->xml->createElement('type', $type); + $mimetypesEl->appendChild($newTypeEl); + $ret = TRUE; + } + } + return $ret; + } + + /** + * Removes an allowed mimetype from the model. + * + * @param String $type + * @return boolean $success + */ + public function removeMimetype($type) { + $ret = FALSE; + if ($this->validate()) { + $mimetypesEl = $this->xml->getElementsByTagName('mimetypes')->item(0); + $types = $mimetypesEl->getElementsByTagName('type'); + $found = FALSE; + for ($i = 0; !$found && $i < $types->length; $i++) { + if ($types->item($i)->nodeValue == $type) + $found = $types->item($i); + } + + if ($found !== FALSE && $types->length > 1) { + $mimetypesEl->removeChild($found); + $ret = TRUE; + } + } + return $ret; + } + + /** + * getDisplayMethods ?? + * @param type $ds + * @return type + */ + public function getDisplayMethods($ds) { + $ret = FALSE; + if (($ds = $this->getDSModel($ds)) !== FALSE) { + $ret = array(); + $dispMethods = $ds->getElementsByTagName('display_method'); + for ($i = 0; $i < $dispMethods->length; $i++) { + $ret[] = array('module' => $dispMethods->item($i)->getAttribute('module') == '' ? 'fedora_repository' : $dispMethods->item($i)->getAttribute('module'), + 'file' => $dispMethods->item($i)->getAttribute('file'), + 'class' => $dispMethods->item($i)->getAttribute('class'), + 'method' => $dispMethods->item($i)->getAttribute('method'), + 'default' => ($dispMethods->item($i)->attributes->getNamedItem('default') !== NULL ? strtolower($dispMethods->item($i)->getAttribute('default')) == 'TRUE' : FALSE)); + } + } + return $ret; + } + + /** + * addDs ?? + * @param type $dsid + * @param type $display_in_fieldset + * @return boolean + */ + public function addDs($dsid, $display_in_fieldset = FALSE) { + $ret = FALSE; + + if (self::valid_dsid($dsid) && ($ds = $this->getDSModel($dsid)) === FALSE) { + $datastreamsEl = $this->xml->getElementsByTagName('datastreams'); + if ($datastreamsEl->length > 0) { + $datastreamsEl = $datastreamsEl->item(0); + } + else { + $datastreamsEl = $this->xml->createElement('datastreams'); + $this->xml->getElementsByTagName('content_model')->item(0)->appendChild($datastreamsEl); + } + + $dsEl = $this->xml->createElement('datastream'); + $dsEl->setAttribute('dsid', $dsid); + if ($display_in_fieldset == TRUE) { + $dsEl->setAttribute('display_in_fieldset', 'TRUE'); + } + $datastreamsEl->appendChild($dsEl); + $ret = TRUE; + } + return $ret; + } + + /** + * removeDs ?? + * @param type $dsid + * @return boolean + */ + public function removeDs($dsid) { + $ret = FALSE; + + if (self::valid_dsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) { + $datastreamsEl = $this->xml->getElementsByTagName('datastreams')->item(0); + $datastreamsEl->removeChild($ds); + $ret = TRUE; + } + return $ret; + } + + /** + * displayInFieldset ?? + * @param type $dsid + * @return type + */ + public function displayInFieldset($dsid) { + $ret = FALSE; + if (self::valid_dsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) { + $ret = strtolower($ds->getAttribute('display_in_fieldset')) == 'TRUE'; + } + return $ret; + } + + /** + * setDisplayInFieldset ?? + * @param type $dsid + * @param type $value + * @return boolean + */ + public function setDisplayInFieldset($dsid, $value = TRUE) { + $ret = FALSE; + if (self::valid_dsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) { + if ($value == FALSE && $ds->attributes->getNamedItem('display_in_fieldset') !== NULL) { + $ds->removeAttribute('display_in_fieldset'); + $ret = TRUE; + } + elseif ($value == TRUE) { + $ds->setAttribute('display_in_fieldset', 'TRUE'); + $ret = TRUE; + } + } + return $ret; + } + + /** + * setDefaultDispMeth ?? + * @param type $dsid + * @param type $module + * @param type $file + * @param type $class + * @param type $method + * @return boolean + */ + public function setDefaultDispMeth($dsid, $module, $file, $class, $method) { + $ret = FALSE; + + if (self::valid_dsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) { + $found = FALSE; + $dispMethods = $ds->getElementsByTagName('display_method'); + for ($i = 0; !$found && $i < $dispMethods->length; $i++) { + if ($module == ($dispMethods->item($i)->getAttribute('module') == '' ? 'fedora_repository' : $dispMethods->item($i)->getAttribute('module')) && + $file == $dispMethods->item($i)->getAttribute('file') && + $class == $dispMethods->item($i)->getAttribute('class') && + $method == $dispMethods->item($i)->getAttribute('method')) { + $found = $dispMethods->item($i); + } + } + + if ($found !== FALSE) { + + for ($i = 0; $i < $dispMethods->length; $i++) { + if ($dispMethods->item($i)->attributes->getNamedItem('default') !== NULL) { + $dispMethods->item($i)->removeAttribute('default'); + } + } + + $found->setAttribute('default', 'TRUE'); + $ret = TRUE; + } + } + return $ret; + } + + /** + * removeDispMeth ?? + * @param type $dsid + * @param type $module + * @param type $file + * @param type $class + * @param type $method + * @return boolean + */ + public function removeDispMeth($dsid, $module, $file, $class, $method) { + $ret = FALSE; + if (self::valid_dsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) { + $found = FALSE; + $dispMethods = $ds->getElementsByTagName('display_method'); + for ($i = 0; !$found && $i < $dispMethods->length; $i++) { + if ($module == ($dispMethods->item($i)->getAttribute('module') == '' ? 'fedora_repository' : $dispMethods->item($i)->getAttribute('module') == '') && + $file == $dispMethods->item($i)->getAttribute('file') && + $class == $dispMethods->item($i)->getAttribute('class') && + $method == $dispMethods->item($i)->getAttribute('method')) { + $found = $dispMethods->item($i); + } + } + + if ($found !== FALSE) { + $ds->removeChild($found); + $ret = TRUE; + } + } + return $ret; + } + + /** + * addDispMeth ?? + * @param type $dsid + * @param type $module + * @param type $file + * @param type $class + * @param type $method + * @param type $default + * @return boolean + */ + public function addDispMeth($dsid, $module, $file, $class, $method, $default = FALSE) { + $ret = FALSE; + if (self::valid_dsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) { + $dispMethEl = $this->xml->createElement('display_method'); + $dispMethEl->setAttribute('module', $module); + $dispMethEl->setAttribute('file', $file); + $dispMethEl->setAttribute('class', $class); + $dispMethEl->setAttribute('method', $method); + if ($default == TRUE) { + $dispMethEl->setAttribute('default', TRUE); + } + $ds->appendChild($dispMethEl); + $ret = TRUE; + } + return $ret; + } + + /** + * getAddDsMethod ?? + * @param type $ds + * @return type + */ + public function getAddDsMethod($ds) { + $ret = FALSE; + if (($ds = $this->getDSModel($ds)) !== FALSE) { + $addDsMethod = $ds->getElementsByTagName('add_datastream_method'); + if ($addDsMethod !== FALSE && $addDsMethod->length > 0) { + $ret = array('module' => $addDsMethod->item(0)->getAttribute('module') == '' ? 'fedora_repository' : $addDsMethod->item(0)->getAttribute('module'), + 'file' => $addDsMethod->item(0)->getAttribute('file'), + 'class' => $addDsMethod->item(0)->getAttribute('class'), + 'method' => $addDsMethod->item(0)->getAttribute('method'), + 'modified_files_ext' => $addDsMethod->item(0)->getAttribute('modified_files_ext'), + 'dsid' => $addDsMethod->item(0)->getAttribute('dsid') + ); + } + } + return $ret; + } + + /** + * getIngestRule ?? + * @param type $rule_id + * @return type + */ + public function getIngestRule($rule_id) { + $ret = FALSE; + if ($this->validate()) { + $rules = $this->xml->getElementsByTagName('ingest_rules')->item(0)->getElementsByTagName('rule'); + if ($rule_id < $rules->length) + $ret = $rules->item($rule_id); + } + return $ret; + } + + /** + * removeAppliesTo ?? + * @param type $rule_id + * @param type $type + * @return boolean + */ + public function removeAppliesTo($rule_id, $type) { + $ret = FALSE; + if (($rule = $this->getIngestRule($rule_id)) !== FALSE) { + $applies = $rule->getElementsByTagName('applies_to'); + $found = FALSE; + for ($i = 0; $found === FALSE && $i < $applies->length; $i++) { + if ($type == $applies->item($i)->nodeValue) { + $found = $applies->item($i); + } + } + + if ($found) { + $rule->removeChild($found); + $ret = TRUE; + } + } + return $ret; + } + + /** + * addAppliesTo ?? + * @param type $rule_id + * @param type $type + * @return boolean + */ + public function addAppliesTo($rule_id, $type) { + $ret = FALSE; + if (($rule = $this->getIngestRule($rule_id)) !== FALSE) { + $applies = $rule->getElementsByTagName('applies_to'); + $found = FALSE; + for ($i = 0; !$found && $i < $applies->length; $i++) { + $found = ($type == $applies->item($i)->nodeValue); + } + + if (!$found) { + $newAppliesTo = $this->xml->createElement('applies_to', $type); + $rule->insertBefore($newAppliesTo, $rule->getElementsByTagName('ingest_methods')->item(0)); + $ret = TRUE; + } + } + return $ret; + } + + /** + * addIngestMethods ?? + * @param type $rule_id + * @param type $module + * @param type $file + * @param type $class + * @param type $method + * @param type $dsid + * @param type $modified_files_ext + * @return boolean + */ + public function addIngestMethod($rule_id, $module, $file, $class, $method, $dsid, $modified_files_ext) { + $ret = FALSE; + if (self::valid_dsid($dsid) && ($rule = $this->getIngestRule($rule_id)) !== FALSE) { + $methodsEl = $rule->getElementsByTagName('ingest_methods')->item(0); + $meth = $this->xml->createElement('ingest_method'); + $meth->setAttribute('module', $module); + $meth->setAttribute('file', $file); + $meth->setAttribute('class', $class); + $meth->setAttribute('method', $method); + $meth->setAttribute('dsid', $dsid); + $meth->setAttribute('modified_files_ext', $modified_files_ext); + + $methodsEl->appendChild($meth); + $ret = TRUE; + } + return $ret; + } + + /** + * removeIngestMethod ?? + * @param type $rule_id + * @param type $module + * @param type $file + * @param type $class + * @param type $method + * @return boolean + */ + public function removeIngestMethod($rule_id, $module, $file, $class, $method) { + $ret = FALSE; + if (($rule = $this->getIngestRule($rule_id)) !== FALSE) { + $found = FALSE; + $methodsEl = $rule->getElementsByTagName('ingest_methods')->item(0); + $methods = $methodsEl->getElementsByTagName('ingest_method'); + for ($i = 0; !$found && $i < $methods->length; $i++) { + if ($methods->item($i)->getAttribute('module') == $module && $methods->item($i)->getAttribute('file') == $file && $methods->item($i)->getAttribute('class') == $class && $methods->item($i)->getAttribute('method') == $method) { + $found = $methods->item($i); + } + } + + if ($found !== FALSE && $methods->length > 1) { + $methodsEl->removeChild($found); + $ret = TRUE; + } + } + return $ret; + } + + /** + * addIngestMethodParam ?? + * @param type $rule_id + * @param type $module + * @param type $file + * @param type $class + * @param type $method + * @param type $name + * @param type $value + * @return boolean + */ + public function addIngestMethodParam($rule_id, $module, $file, $class, $method, $name, $value) { + $ret = FALSE; + if (($rule = $this->getIngestRule($rule_id)) !== FALSE) { + $methods = $rule->getElementsByTagName('ingest_methods')->item(0)->getElementsByTagName('ingest_method'); + $found = FALSE; + for ($i = 0; $found === FALSE && $i < $methods->length; $i++) { + if (($methods->item($i)->getAttribute('module') == '' ? 'fedora_repository' : $methods->item($i)->getAttribute('module')) == $module && + $methods->item($i)->getAttribute('file') == $file && + $methods->item($i)->getAttribute('class') == $class && + $methods->item($i)->getAttribute('method') == $method) { + $found = $methods->item($i); + } + } + + if ($found !== FALSE) { + $paramsEl = $found->getElementsByTagName('parameters'); + if ($paramsEl->length == 0) { + $paramsEl = $found->appendChild($this->xml->createElement('parameters')); + } + else { + $paramsEl = $paramsEl->item(0); + } + + $params = $paramsEl->getElementsByTagName('parameter'); + $found = FALSE; + for ($i = 0; $found === FALSE && $i < $params->length; $i++) { + if ($params->item($i)->getAttribute('name') == $name) { + $found = $params->item($i); + } + } + + if ($found === FALSE) { + $param = $this->xml->createElement('parameter', $value); + $param->setAttribute('name', $name); + $paramsEl->appendChild($param); + $ret = TRUE; + } + } + } + return $ret; + } + + /** + * removeIngestMethodParam ?? + * @param type $rule_id + * @param type $module + * @param type $file + * @param type $class + * @param type $method + * @param type $name + * @return boolean + */ + public function removeIngestMethodParam($rule_id, $module, $file, $class, $method, $name) { + $ret = FALSE; + if (($rule = $this->getIngestRule($rule_id)) !== FALSE) { + $found = FALSE; + $methodsEl = $rule->getElementsByTagName('ingest_methods')->item(0); + $methods = $methodsEl->getElementsByTagName('ingest_method'); + for ($i = 0; !$found && $i < $methods->length; $i++) { + if (( trim($methods->item($i)->getAttribute('module')) == $module || (trim($methods->item($i)->getAttribute('module')) == '' && $module == 'fedora_repository')) && trim($methods->item($i)->getAttribute('file')) == $file && trim($methods->item($i)->getAttribute('class')) == $class && trim($methods->item($i)->getAttribute('method')) == $method) { + $found = $methods->item($i); + } + } + if ($found !== FALSE) { + $methodEl = $found; + $paramsEl = $found->getElementsByTagName('parameters'); + if ($paramsEl->length > 0) { + $paramsEl = $paramsEl->item(0); + $params = $paramsEl->getElementsByTagName('parameter'); + $found = FALSE; + for ($i = 0; $found === FALSE && $i < $params->length; $i++) { + if ($params->item($i)->getAttribute('name') == $name) { + $found = $params->item($i); + } + } + + if ($found !== FALSE) { + $paramsEl->removeChild($found); + if ($params->length == 0) { + $methodEl->removeChild($paramsEl); + } + + $ret = TRUE; + } + } + } + } + return $ret; + } + + /** + * removeIngestRule ?? + * @param type $rule_id + * @return type + */ + public function removeIngestRule($rule_id) { + $ret = FALSE; + if (($rule = $this->getIngestRule($rule_id)) !== FALSE) { + $ret = $this->xml->getElementsByTagName('ingest_rules')->item(0)->removeChild($rule); + } + return $ret; + } + + /** + * addIngestRule ?? + * @param type $applies_to + * @param type $module + * @param type $file + * @param type $class + * @param type $method + * @param type $dsid + * @param type $modified_files_ext + * @return type + */ + public function addIngestRule($applies_to, $module, $file, $class, $method, $dsid, $modified_files_ext) { + $ret = FALSE; + if (self::valid_dsid($dsid) && $this->validate()) { + $ingestRulesEl = $this->xml->getElementsByTagName('ingest_rules')->item(0); + $rule = $this->xml->createElement('rule'); + $ingestMethodsEl = $this->xml->createElement('ingest_methods'); + $rule->appendChild($ingestMethodsEl); + $ingestRulesEl->appendChild($rule); + $newRuleId = $ingestRulesEl->getElementsByTagName('rule')->length - 1; + $ret = ($this->addAppliesTo($newRuleId, $applies_to) && $this->addIngestMethod($newRuleId, $module, $file, $class, $method, $dsid, $modified_files_ext)); + } + return $ret; + } + + /** + * getIngestRules ?? + * @return type + */ + public function getIngestRules() { + $ret = FALSE; + if ($this->validate()) { + $ret = array(); + $rules = $this->xml->getElementsByTagName('ingest_rules')->item(0)->getElementsByTagName('rule'); + for ($i = 0; $i < $rules->length; $i++) { + $rule = array('applies_to' => array(), + 'ingest_methods' => array()); + $applies_to = $rules->item($i)->getElementsByTagName('applies_to'); + for ($j = 0; $j < $applies_to->length; $j++) { + $rule['applies_to'][] = trim($applies_to->item($j)->nodeValue); + } + + $methods = $rules->item($i)->getElementsByTagName('ingest_methods')->item(0)->getElementsByTagName('ingest_method'); + for ($j = 0; $j < $methods->length; $j++) { + $method = array('module' => $methods->item($j)->getAttribute('module') == '' ? 'fedora_repository' : $methods->item($j)->getAttribute('module'), + 'file' => $methods->item($j)->getAttribute('file'), + 'class' => $methods->item($j)->getAttribute('class'), + 'method' => $methods->item($j)->getAttribute('method'), + 'dsid' => $methods->item($j)->getAttribute('dsid'), + 'modified_files_ext' => $methods->item($j)->getAttribute('modified_files_ext'), + 'parameters' => array()); + + $params = $methods->item($j)->getElementsByTagName('parameters'); + if ($params->length > 0) { + $params = $params->item(0)->getElementsByTagName('parameter'); + for ($k = 0; $k < $params->length; $k++) { + $method['parameters'][$params->item($k)->getAttribute('name')] = $params->item($k)->nodeValue; + } + } + + $rule['ingest_methods'][] = $method; + } + + $ret[] = $rule; + } + } + return $ret; + } + + /** + * getIngestFormAttributes ?? + * @return type + */ + public function getIngestFormAttributes() { + $ret = FALSE; + if ($this->validate()) { + $ingest_formEl = $this->xml->getElementsByTagName('ingest_form')->item(0); + $ret = array('dsid' => $ingest_formEl->getAttribute('dsid'), + 'page' => $ingest_formEl->getAttribute('page'), + 'hide_file_chooser' => strtolower($ingest_formEl->getAttribute('hide_file_chooser')) == 'TRUE', + 'redirect' => strtolower($ingest_formEl->getAttribute('redirect')) == 'FALSE' ? FALSE : TRUE); + } + return $ret; + } + + /** + * editIngestFormAttributes ?? + * @param type $dsid + * @param type $page + * @param type $hide_file_chooser + * @param type $redirect + * @return boolean + */ + public function editIngestFormAttributes($dsid, $page, $hide_file_chooser = FALSE, $redirect = TRUE) { + $ret = FALSE; + if (self::valid_dsid($dsid) && $this->validate()) { + $ingest_formEl = $this->xml->getElementsByTagName('ingest_form')->item(0); + $ingest_formEl->setAttribute('dsid', $dsid); + $ingest_formEl->setAttribute('page', $page); + if (!$redirect) { + $ingest_formEl->setAttribute('redirect', 'FALSE'); + } + else { + $ingest_formEl->removeAttribute('redirect'); + } + if ($hide_file_chooser) { + $ingest_formEl->setAttribute('hide_file_chooser', 'TRUE'); + } + else { + $ingest_formEl->removeAttribute('hide_file_chooser'); + } + $ret = TRUE; + } + return $ret; + } + + /** + * getIngestFormBuilderMethod + * @return type + */ + public function getIngestFormBuilderMethod() { + $ret = FALSE; + if ($this->validate()) { + $method = $this->xml->getElementsByTagName('ingest_form')->item(0)->getElementsByTagName('form_builder_method')->item(0); + $ret = array('module' => ($method->getAttribute('module') == '' ? 'fedora_repository' : $method->getAttribute('module')), + 'file' => $method->getAttribute('file'), + 'class' => $method->getAttribute('class'), + 'method' => $method->getAttribute('method'), + 'handler' => $method->getAttribute('handler')); + } + return $ret; + } + + /** + * editIngestFormBuilderMethod ?? + * @param type $module + * @param type $file + * @param type $class + * @param type $method + * @param type $handler + * @return boolean + */ + public function editIngestFormBuilderMethod($module, $file, $class, $method, $handler) { + $ret = FALSE; + if ($this->validate()) { + $methodEl = $this->xml->getElementsByTagName('ingest_form')->item(0)->getElementsByTagName('form_builder_method')->item(0); + $methodEl->setAttribute('module', $module); + $methodEl->setAttribute('file', $file); + $methodEl->setAttribute('class', $class); + $methodEl->setAttribute('method', $method); + $methodEl->setAttribute('handler', $handler); + $ret = TRUE; + } + return $ret; + } + + /** + * Find the form element with name $name. + * + * @param string $name + * The name of the form element to find. + * @return DOMElement + * The form element $name, if found FALSE otherwise. + */ + public function getForm($name) { + $result = $this->xpath->query("//cm:form[@name='$name']"); + return $result->length == 1 ? $result->item(0) : FALSE; + } + + /** + * + * @return array + * An array of form names that exist in this content model. + */ + public function getFormNames() { + if (!$this->validate()) { + return FALSE; + } + $names = FALSE; + $result = $this->xpath->query('//cm:forms/cm:form/@name'); // Select the name attribute of all forms. + for ($i = 0; $i < $result->length; $i++) { + $attribute = $result->item($i); + $name = $attribute->value; + $names[$name] = $name; + } + return $names; + } + + /** + * + * @return array + * An array of form names that exist in this content model. + */ + public function getIngestFormNames() { + if (!$this->validate()) { + return FALSE; + } + $result = $this->xpath->query('//cm:forms/cm:form[@ingest_class and @ingest_file and @ingest_module]/@name'); // Select the name attribute of all forms. + for ($i = 0; $i < $result->length; $i++) { + $attribute = $result->item($i); + $name = $attribute->value; + $names[$name] = $name; + } + return $names; + } + + /** + * + * @return array + * An array of form names that exist in this content model. + */ + public function getEditFormNames() { + if (!$this->validate()) { + return FALSE; + } + $result = $this->xpath->query('//cm:forms/cm:form[@edit_class and @edit_file and @edit_module]/@name'); // Select the name attribute of all forms. + for ($i = 0; $i < $result->length; $i++) { + $attribute = $result->item($i); + $name = $attribute->value; + $names[$name] = $name; + } + return $names; + } + + /** + * Removes the named form. + * + * @param string $name + * Name of the form to remove. + * + * @return boolean + * TRUE on success, FALSE otherwise. + */ + public function removeForm($name) { + $result = $this->xpath->query("//cm:form[@name='$name']"); + if ($result->length == 1) { + $form = $result->item(0); + $form->parentNode->removeChild($form); + return TRUE; + } + return FALSE; + } + + /** + * Adds the named form. + * + * @param string $element + * Name of the form to add. + * + * @return boolean + * TRUE on success, FALSE otherwise. + */ + public function addForm($element) { + $result = $this->xpath->query("//cm:forms"); + if ($result->length == 0) { // Forms doesn't exist + $forms = $this->xml->createElement('forms'); + $element = $this->xml->importNode($element); + $forms->appendChild($element); + $result = $this->xpath->query("//cm:content_model"); + $result->item(0)->appendChild($forms); + return TRUE; + } + elseif ($result->length == 1) { + $element = $this->xml->importNode($element); + $result->item(0)->appendChild($element); + return TRUE; + } + return FALSE; + } + + /** + * Edits a form element with attribute name='$name' from the 'forms' element. + * + * @param String $name + */ + public function editForm($name, $element) { + if (!$this->validate()) { + return FALSE; + } + $result = $this->xpath->query("//cm:form[@name='$name']"); + if ($result->length == 1) { + $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; + } + return FALSE; + } + + /** + * + * @param $element_definition + * @param $parent_element + * @return + */ + public function addElementToForm($element, $parent_element) { + $element = $this->xml->importNode($element, TRUE); + $parent_element->appendChild($element); + return TRUE; + } + + /** + * + * @param $element_definition + * @param $parent_element + */ + public function editFormElement($new_element, $edit_element) { + $new_element = $this->xml->importNode($new_element, TRUE); + $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; + } + + /** + * + * @param $new_element + * @param $element + */ + private function insertElementInPlace($new_element, $element) { + $next = $element->nextSibling; + if ($next) { + $element->parentNode->insertBefore($new_element, $next); + } + else { + $element->parentNode->appendChild($new_element); + } + } + + /** + * + * @param $form_element + * @return + */ + public function incFormElement($form_element) { + $prev = $form_element; + $name = $prev->getAttribute('name'); + while ($prev = $prev->previousSibling) { + if (get_class($prev) == 'DOMElement') { + $form_element->parentNode->insertBefore($form_element, $prev); + break; + } + } + return TRUE; + } + + /** + * + * @param $form_element + * @return + */ + public function decFormElement($form_element) { + $next = $form_element; + while ($next = $next->nextSibling) { + if (get_class($next) == 'DOMElement') { + $this->insertElementInPlace($form_element, $next); + break; + } + } + return TRUE; + } + +} diff --git a/MimeClass.inc b/MimeClass.inc index f1c5cb16..42c11e37 100644 --- a/MimeClass.inc +++ b/MimeClass.inc @@ -1,8 +1,9 @@ extension lookups in the context of Islandora collections. - * - * It has been cut from a much longer list. - * - * Two types of mimetypes should be put in this list: - * 1) Special emerging formats which may not yet be expressed in the system - * mime.types file. - * 2) Heavily used mimetypes of particular importance to the Islandora - * project, as lookups against this list will be quicker and less - * resource intensive than other methods. - * - * Lookups are first checked against this short list. If no results are found, - * then the lookup function may move on to check other sources, namely the - * system's mime.types file. - * - * In most cases though, this short list should suffice. - * - * If modifying this list, please note that for promiscuous mimetypes - * (those which map to multiple extensions, such as text/plain) - * The function get_extension will always return the *LAST* extension in this list, - * so you should put your preferred extension *LAST*. - * - * e.g... - * "jpeg" => "image/jpeg", - * "jpe" => "image/jpeg", - * "jpg" => "image/jpeg", - * - * $this->get_extension('image/jpeg') will always return 'jpg'. - * - */ + /** + * This is a shortlist of mimetypes which should catch most + * mimetype<-->extension lookups in the context of Islandora collections. + * + * It has been cut from a much longer list. + * + * Two types of mimetypes should be put in this list: + * 1) Special emerging formats which may not yet be expressed in the system + * mime.types file. + * 2) Heavily used mimetypes of particular importance to the Islandora + * project, as lookups against this list will be quicker and less + * resource intensive than other methods. + * + * Lookups are first checked against this short list. If no results are found, + * then the lookup function may move on to check other sources, namely the + * system's mime.types file. + * + * In most cases though, this short list should suffice. + * + * If modifying this list, please note that for promiscuous mimetypes + * (those which map to multiple extensions, such as text/plain) + * The function get_extension will always return the *LAST* extension in this list, + * so you should put your preferred extension *LAST*. + * + * e.g... + * "jpeg" => "image/jpeg", + * "jpe" => "image/jpeg", + * "jpg" => "image/jpeg", + * + * $this->get_extension('image/jpeg') will always return 'jpg'. + * + */ // openoffice: - 'odb' => 'application/vnd.oasis.opendocument.database', - 'odc' => 'application/vnd.oasis.opendocument.chart', - 'odf' => 'application/vnd.oasis.opendocument.formula', - 'odg' => 'application/vnd.oasis.opendocument.graphics', - 'odi' => 'application/vnd.oasis.opendocument.image', - 'odm' => 'application/vnd.oasis.opendocument.text-master', - 'odp' => 'application/vnd.oasis.opendocument.presentation', - 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', - 'odt' => 'application/vnd.oasis.opendocument.text', - 'otg' => 'application/vnd.oasis.opendocument.graphics-template', - 'oth' => 'application/vnd.oasis.opendocument.text-web', - 'otp' => 'application/vnd.oasis.opendocument.presentation-template', - 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', - 'ott' => 'application/vnd.oasis.opendocument.text-template', + 'odb' => 'application/vnd.oasis.opendocument.database', + 'odc' => 'application/vnd.oasis.opendocument.chart', + 'odf' => 'application/vnd.oasis.opendocument.formula', + 'odg' => 'application/vnd.oasis.opendocument.graphics', + 'odi' => 'application/vnd.oasis.opendocument.image', + 'odm' => 'application/vnd.oasis.opendocument.text-master', + 'odp' => 'application/vnd.oasis.opendocument.presentation', + 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', + 'odt' => 'application/vnd.oasis.opendocument.text', + 'otg' => 'application/vnd.oasis.opendocument.graphics-template', + 'oth' => 'application/vnd.oasis.opendocument.text-web', + 'otp' => 'application/vnd.oasis.opendocument.presentation-template', + 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', + 'ott' => 'application/vnd.oasis.opendocument.text-template', // staroffice: - 'stc' => 'application/vnd.sun.xml.calc.template', - 'std' => 'application/vnd.sun.xml.draw.template', - 'sti' => 'application/vnd.sun.xml.impress.template', - 'stw' => 'application/vnd.sun.xml.writer.template', - 'sxc' => 'application/vnd.sun.xml.calc', - 'sxd' => 'application/vnd.sun.xml.draw', - 'sxg' => 'application/vnd.sun.xml.writer.global', - 'sxi' => 'application/vnd.sun.xml.impress', - 'sxm' => 'application/vnd.sun.xml.math', - 'sxw' => 'application/vnd.sun.xml.writer', + 'stc' => 'application/vnd.sun.xml.calc.template', + 'std' => 'application/vnd.sun.xml.draw.template', + 'sti' => 'application/vnd.sun.xml.impress.template', + 'stw' => 'application/vnd.sun.xml.writer.template', + 'sxc' => 'application/vnd.sun.xml.calc', + 'sxd' => 'application/vnd.sun.xml.draw', + 'sxg' => 'application/vnd.sun.xml.writer.global', + 'sxi' => 'application/vnd.sun.xml.impress', + 'sxm' => 'application/vnd.sun.xml.math', + 'sxw' => 'application/vnd.sun.xml.writer', // k-office: - 'kil' => 'application/x-killustrator', - 'kpt' => 'application/x-kpresenter', - 'kpr' => 'application/x-kpresenter', - 'ksp' => 'application/x-kspread', - 'kwt' => 'application/x-kword', - 'kwd' => 'application/x-kword', + 'kil' => 'application/x-killustrator', + 'kpt' => 'application/x-kpresenter', + 'kpr' => 'application/x-kpresenter', + 'ksp' => 'application/x-kspread', + 'kwt' => 'application/x-kword', + 'kwd' => 'application/x-kword', // ms office 97: - 'doc' => 'application/msword', - 'xls' => 'application/vnd.ms-excel', - 'ppt' => 'application/vnd.ms-powerpoint', + 'doc' => 'application/msword', + 'xls' => 'application/vnd.ms-excel', + 'ppt' => 'application/vnd.ms-powerpoint', // office2007: - 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'docm' => 'application/vnd.ms-word.document.macroEnabled.12', - 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', - 'dotm' => 'application/vnd.ms-word.template.macroEnabled.12', - 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12', - 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', - 'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12', - 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', - 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', - 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', - 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', - 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', - 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', - 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', - 'potm' => 'application/vnd.ms-powerpoint.template.macroEnabled.12', - 'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12', - 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', - 'sldm' => 'application/vnd.ms-powerpoint.slide.macroEnabled.12', + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'docm' => 'application/vnd.ms-word.document.macroEnabled.12', + 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', + 'dotm' => 'application/vnd.ms-word.template.macroEnabled.12', + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12', + 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', + 'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12', + 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', + 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', + 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', + 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', + 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', + 'potm' => 'application/vnd.ms-powerpoint.template.macroEnabled.12', + 'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12', + 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', + 'sldm' => 'application/vnd.ms-powerpoint.slide.macroEnabled.12', // wordperfect (who cares?): - 'wpd' => 'application/wordperfect', + 'wpd' => 'application/wordperfect', // common and generic containers: - 'pdf' => 'application/pdf', - 'eps' => 'application/postscript', - 'ps' => 'application/postscript', - 'rtf' => 'text/rtf', - 'rtx' => 'text/richtext', - 'latex' => 'application/x-latex', - 'tex' => 'application/x-tex', - 'texi' => 'application/x-texinfo', + 'pdf' => 'application/pdf', + 'eps' => 'application/postscript', + 'ps' => 'application/postscript', + 'rtf' => 'text/rtf', + 'rtx' => 'text/richtext', + 'latex' => 'application/x-latex', + 'tex' => 'application/x-tex', + 'texi' => 'application/x-texinfo', 'texinfo' => 'application/x-texinfo', // *ml: - 'css' => 'text/css', - 'htm' => 'text/html', - 'html' => 'text/html', - 'wbxml' => 'application/vnd.wap.wbxml', - 'xht' => 'application/xhtml+xml', - 'xhtml' => 'application/xhtml+xml', - 'xsl' => 'text/xml', - 'xml' => 'text/xml', - 'csv' => 'text/csv', - 'tsv' => 'text/tab-separated-values', - 'txt' => 'text/plain', + 'css' => 'text/css', + 'htm' => 'text/html', + 'html' => 'text/html', + 'wbxml' => 'application/vnd.wap.wbxml', + 'xht' => 'application/xhtml+xml', + 'xhtml' => 'application/xhtml+xml', + 'xsl' => 'text/xml', + 'xml' => 'text/xml', + 'csv' => 'text/csv', + 'tsv' => 'text/tab-separated-values', + 'txt' => 'text/plain', // images: - "bmp" => "image/bmp", - "gif" => "image/gif", - "ief" => "image/ief", - "jpeg" => "image/jpeg", - "jpe" => "image/jpeg", - "jpg" => "image/jpeg", - "jp2" => "image/jp2", - "png" => "image/png", - "tiff" => "image/tiff", - "tif" => "image/tif", - "djvu" => "image/vnd.djvu", - "djv" => "image/vnd.djvu", - "wbmp" => "image/vnd.wap.wbmp", - "ras" => "image/x-cmu-raster", - "pnm" => "image/x-portable-anymap", - "pbm" => "image/x-portable-bitmap", - "pgm" => "image/x-portable-graymap", - "ppm" => "image/x-portable-pixmap", - "rgb" => "image/x-rgb", - "xbm" => "image/x-xbitmap", - "xpm" => "image/x-xpixmap", - "xwd" => "image/x-windowdump", + "bmp" => "image/bmp", + "gif" => "image/gif", + "ief" => "image/ief", + "jpeg" => "image/jpeg", + "jpe" => "image/jpeg", + "jpg" => "image/jpeg", + "jp2" => "image/jp2", + "png" => "image/png", + "tiff" => "image/tiff", + "tif" => "image/tif", + "djvu" => "image/vnd.djvu", + "djv" => "image/vnd.djvu", + "wbmp" => "image/vnd.wap.wbmp", + "ras" => "image/x-cmu-raster", + "pnm" => "image/x-portable-anymap", + "pbm" => "image/x-portable-bitmap", + "pgm" => "image/x-portable-graymap", + "ppm" => "image/x-portable-pixmap", + "rgb" => "image/x-rgb", + "xbm" => "image/x-xbitmap", + "xpm" => "image/x-xpixmap", + "xwd" => "image/x-windowdump", // videos: - "mpeg" => "video/mpeg", - "mpe" => "video/mpeg", - "mpg" => "video/mpeg", - "m4v" => "video/mp4", - "mp4" => "video/mp4", - "ogv" => "video/ogg", - "qt" => "video/quicktime", - "mov" => "video/quicktime", - "mxu" => "video/vnd.mpegurl", - "avi" => "video/x-msvideo", - "movie" => "video/x-sgi-movie", - "flv" => "video/x-flv", - "swf" => "application/x-shockwave-flash", + "mpeg" => "video/mpeg", + "mpe" => "video/mpeg", + "mpg" => "video/mpeg", + "m4v" => "video/mp4", + "mp4" => "video/mp4", + "ogv" => "video/ogg", + "qt" => "video/quicktime", + "mov" => "video/quicktime", + "mxu" => "video/vnd.mpegurl", + "avi" => "video/x-msvideo", + "movie" => "video/x-sgi-movie", + "flv" => "video/x-flv", + "swf" => "application/x-shockwave-flash", // audio: - "mp3" => "audio/mpeg", - "mp4a" => "audio/mp4", - "m4a" => "audio/mp4", - "oga" => "audio/ogg", - "ogg" => "audio/ogg", - "flac" => "audio/x-flac", - "wav" => "audio/vnd.wave", + "mp3" => "audio/mpeg", + "mp4a" => "audio/mp4", + "m4a" => "audio/mp4", + "oga" => "audio/ogg", + "ogg" => "audio/ogg", + "flac" => "audio/x-flac", + "wav" => "audio/vnd.wave", // compressed formats: (note: http://svn.cleancode.org/svn/email/trunk/mime.types) - "tgz" => "application/x-gzip", - "gz" => "application/x-gzip", - "tar" => "application/x-tar", - "gtar" => "application/x-gtar", - "zip" => "application/x-zip", + "tgz" => "application/x-gzip", + "gz" => "application/x-gzip", + "tar" => "application/x-tar", + "gtar" => "application/x-gtar", + "zip" => "application/x-zip", // others: - 'bin' => 'application/octet-stream', + 'bin' => 'application/octet-stream', ); - private $private_file_extensions; private $system_types; private $system_exts; private $etc_mime_types = '/etc/mime.types'; + /** + * Construtor + */ public function __construct() { // populate the reverse shortlist: - $this->private_file_extensions = array_flip( $this->private_mime_types ); + $this->private_file_extensions = array_flip($this->private_mime_types); // pick up a local mime.types file if it is available - if (is_readable('mime.types') ) { + if (is_readable('mime.types')) { $this->etc_mime_types = 'mime.types'; } - } - + /** * function: getType * description: An alias to get_mimetype, * for backwards-compatibility with our old mimetype class. + * + * @param type $filename + * @return type */ - public function getType( $filename ) { - return $this->get_mimetype( $filename ); + public function getType($filename) { + return $this->get_mimetype($filename); } /** * function: get_mimetype * description: returns a mimetype associated with the file extension of $filename + * + * @param type $filename + * @param type $debug + * @return type */ - public function get_mimetype( $filename, $debug = FALSE ) { + public function get_mimetype($filename, $debug = FALSE) { + + $file_name_and_extension = explode('.', $filename); + $ext = strtolower(array_pop($file_name_and_extension)); - $file_name_and_extension = explode( '.', $filename ); - $ext = strtolower( array_pop( $file_name_and_extension ) ); - - if ( ! empty( $this->private_mime_types[$ext] ) ) { - if ( TRUE === $debug ) - return array( 'mime_type' => $this->private_mime_types[$ext], 'method' => 'from_array' ); + if (!empty($this->private_mime_types[$ext])) { + if (TRUE === $debug) + return array('mime_type' => $this->private_mime_types[$ext], 'method' => 'from_array'); return $this->private_mime_types[$ext]; } - + if (function_exists('file_get_mimetype')) { - $drupal_mimetype = file_get_mimetype( $filename ); + $drupal_mimetype = file_get_mimetype($filename); if ('application/octet-stream' != $drupal_mimetype) { if (TRUE == $debug) return array('mime_type' => $drupal_mimetype, 'method' => 'file_get_mimetype'); return $drupal_mimetype; } } - - if (!isset( $this->system_types)) + + if (!isset($this->system_types)) $this->system_types = $this->system_extension_mime_types(); - if (isset( $this->system_types[$ext])) { + if (isset($this->system_types[$ext])) { if (TRUE == $debug) return array('mime_type' => $this->system_types[$ext], 'method' => 'mime.types'); return $this->system_types[$ext]; } - - if ( TRUE === $debug ) - return array( 'mime_type' => 'application/octet-stream', 'method' => 'last_resort' ); - return 'application/octet-stream'; + if (TRUE === $debug) + return array('mime_type' => 'application/octet-stream', 'method' => 'last_resort'); + return 'application/octet-stream'; } /** * function: get_extension * description: returns *one* valid file extension for a given $mime_type + * + * @param type $mime_type + * @param type $debug + * @return type */ - public function get_extension( $mime_type, $debug = FALSE ) { + public function get_extension($mime_type, $debug = FALSE) { - if (!empty( $this->private_file_extensions[$mime_type])) { + if (!empty($this->private_file_extensions[$mime_type])) { if (TRUE == $debug) - return array( 'extension' => $this->private_file_extensions[$mime_type], 'method' => 'from_array' ); + return array('extension' => $this->private_file_extensions[$mime_type], 'method' => 'from_array'); return $this->private_file_extensions[$mime_type]; } - if (!isset ( $this->system_exts)) + if (!isset($this->system_exts)) $this->system_exts = $this->system_mime_type_extensions(); - if (isset( $this->system_exts[$mime_type])) { + if (isset($this->system_exts[$mime_type])) { if (TRUE == $debug) - return array( 'extension' => $this->system_exts[$mime_type], 'method' => 'mime.types' ); + return array('extension' => $this->system_exts[$mime_type], 'method' => 'mime.types'); return $this->system_exts[$mime_type]; } if (TRUE == $debug) - return array( 'extension' => 'bin', 'method' => 'last_resort' ); + return array('extension' => 'bin', 'method' => 'last_resort'); return 'bin'; } @@ -289,21 +301,23 @@ class MimeClass { */ private function system_mime_type_extensions() { $out = array(); - $file = fopen($this->etc_mime_types, 'r'); - while (($line = fgets($file)) !== FALSE) { - $line = trim(preg_replace('/#.*/', '', $line)); - if (!$line) - continue; - $parts = preg_split('/\s+/', $line); - if (count($parts) == 1) - continue; + if (file_exists($this->etc_mime_types)) { + $file = fopen($this->etc_mime_types, 'r'); + while (($line = fgets($file)) !== FALSE) { + $line = trim(preg_replace('/#.*/', '', $line)); + if (!$line) + continue; + $parts = preg_split('/\s+/', $line); + if (count($parts) == 1) + continue; // A single part means a mimetype without extensions, which we ignore. - $type = array_shift($parts); - if (!isset($out[$type])) - $out[$type] = array_shift($parts); + $type = array_shift($parts); + if (!isset($out[$type])) + $out[$type] = array_shift($parts); // We take the first ext from the line if many are present. + } + fclose($file); } - fclose($file); return $out; } @@ -316,20 +330,22 @@ class MimeClass { */ private function system_extension_mime_types() { $out = array(); - $file = fopen($this->etc_mime_types, 'r'); - while (($line = fgets($file)) !== FALSE) { - $line = trim(preg_replace('/#.*/', '', $line)); - if (!$line) - continue; - $parts = preg_split('/\s+/', $line); - if (count($parts) == 1) - continue; + if (file_exists($this->etc_mime_types)) { + $file = fopen($this->etc_mime_types, 'r'); + while (($line = fgets($file)) !== FALSE) { + $line = trim(preg_replace('/#.*/', '', $line)); + if (!$line) + continue; + $parts = preg_split('/\s+/', $line); + if (count($parts) == 1) + continue; // A single part means a mimetype without extensions, which we ignore. - $type = array_shift($parts); - foreach ($parts as $part) - $out[$part] = $type; + $type = array_shift($parts); + foreach ($parts as $part) + $out[$part] = $type; + } + fclose($file); } - fclose($file); return $out; } diff --git a/ObjectHelper.inc b/ObjectHelper.inc index 4a12240b..3979aaba 100644 --- a/ObjectHelper.inc +++ b/ObjectHelper.inc @@ -1,12 +1,13 @@ fedoraUser = $connectionHelper->getUser(); //$this->fedoraPass = $connectionHelper->getPassword(); } + + private static function getBinaryLength($bin) { + $has_mbstring = extension_loaded('mbstring') ||@dl(PHP_SHLIB_PREFIX.'mbstring.'.PHP_SHLIB_SUFFIX); + $has_mb_shadow = (int) ini_get('mbstring.func_overload'); + + if ($has_mbstring && ($has_mb_shadow & 2) ) { + return mb_strlen($bin,'latin1'); + } else { + return strlen($bin); + } + } /** * Grabs a stream from fedora sets the mimetype and returns it. $dsID is the * datastream id. If $forceSoap is set, the function will always buffer the datastream from fedora. Otherwise, it will * try and use a redirect if possible. - * @param $pid String - * @param $dsID String + * + * @global type $user + * @param type $pid + * @param type $dsID + * @param type $asAttachment + * @param type $label + * @param type $filePath + * @param type $version + * @param type $forceSoap + * @return type */ function makeObject($pid, $dsID, $asAttachment = FALSE, $label = NULL, $filePath=FALSE, $version=NULL, $forceSoap = TRUE) { global $user; @@ -48,7 +71,7 @@ class ObjectHelper { } $headers = module_invoke_all('file_download', "/fedora/repository/$pid/$dsID"); if (in_array(-1, $headers)) { - drupal_set_message('hello'); + drupal_set_message(t('hello')); drupal_access_denied(); return ' '; @@ -85,7 +108,8 @@ class ObjectHelper { if ($label == NULL) { $label = $item->datastreams[$dsID]['label']; } - } else { + } + else { drupal_not_found(); exit(); } @@ -103,13 +127,7 @@ class ObjectHelper { $contentSize = $dataStreamInfo->datastream->size; if (function_exists("curl_init")) { - if (!isset($mimeType)) { - $pid = variable_get('fedora_default_display_pid', 'demo:10'); - $dsID = variable_get('fedora_default_display_dsid', 'TN'); - $mimeType = 'image/jpeg'; - } - - $url = variable_get('fedora_base_url', 'http://localhost:8080/fedora') . '/get/' . $pid . '/' . $dsID; + $url = variable_get('fedora_base_url', 'http://localhost:8080/fedora') . '/objects/' . $pid . '/datastreams/' . $dsID . '/content'; if ($version) { $url .= '/' . $version; //drupal_urlencode($version); } @@ -125,7 +143,7 @@ class ObjectHelper { curl_setopt($ch, CURLOPT_USERPWD, "$fedoraUser:$fedoraPass"); // There seems to be a bug in Fedora 3.1's REST authentication, removing this line fixes the authorization denied error. // curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0); // return into a variable + curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // return into a variable curl_setopt($ch, CURLOPT_URL, $url); @@ -135,50 +153,101 @@ class ObjectHelper { curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); fclose($fp); - } else { - - header("Content-type: $mimeType"); - if ($contentSize > 0) { - header("Content-length: $contentSize"); - } - - if ($asAttachment) { - $suggestedFileName = "$label"; - $pos = strpos($suggestedFileName, '.'); - /** - * Here we used to take an object of, say, type application/pdf with label, say, "My Document" - * and we assemble the output filename extension based on the post-slash portion of the mimetype. - * (If the label has a period anywhere in it, we leave it alone.) - * - * This is great for simple mimetypes like application/pdf, text/html, image/jpeg, etc. - * but it's terrible for, say, application/vnd.oasis.opendocument.text (.odt). - * - * Instead we'll use the get_extension function in MimeClass.inc to discover a valid extension - * for the mimetype in question. - */ - if ($pos === FALSE) { - module_load_include('inc', 'fedora_repository', 'MimeClass'); - $mimeclass = new MimeClass(); - $ext = $mimeclass->get_extension($mimeType); - $suggestedFileName = "$label.$ext"; + } + else { + curl_setopt($ch, CURLOPT_NOBODY, TRUE); + $curl_out = curl_exec($ch); + + if ($curl_out !== FALSE) { + $info = curl_getinfo($ch); + + //Set what headers we can... + if ($mimeType = $info['content_type']) { + header("Content-Type: $mimeType"); + + if ($asAttachment) { + $suggestedFileName = "$label"; + $pos = strpos($suggestedFileName, '.'); + + /* + * Here we used to take an object of, say, type application/pdf with + * label, say, "My Document" and we assemble the output filename + * extension based on the post-slash portion of the mimetype. (If the + * label has a period anywhere in it, we leave it alone.) + * + * This is great for simple mimetypes like application/pdf, text/html, + * image/jpeg, etc., but it's terrible for, say + * application/vnd.oasis.opendocument.text (.odt). + * + * Instead we'll use the get_extension function in MimeClass.inc to + * discover a valid extension for the mimetype in question. + */ + if ($pos === FALSE) { + module_load_include('inc', 'fedora_repository', 'MimeClass'); + $mimeclass = new MimeClass(); + $ext = $mimeclass->get_extension($mimeType); + $suggestedFileName = "$label.$ext"; + } + + header('Content-Disposition: attachment; filename="' . $suggestedFileName . '"'); + } + } + + $effective_url = $info['url']; + //dd($info, 'header/nobody info'); + if ($url !== $effective_url) { //Handle redirect streams (the final URL is not the same as the Fedora URL) + + //Add the parameters passed to Drupal, leaving out the 'q' + $query = array(); + parse_str($_SERVER['QUERY_STRING'], $query); + if (isset($query['q'])) { + unset($query['q']); + } + + header('HTTP/1.1 307 Moved Temporarily'); + header('Location: ' . $effective_url . '?' . http_build_query($query)); //Fedora seems to discard the query portion. + } + elseif ((isset($user) && $user->uid != 0) || $forceSoap || isset($_SERVER['HTTPS'])) { //If not anonymous, soap is force or we're using HTTPS + //Have the webserver mediate the transfer (download and restream) + + curl_setopt($ch, CURLOPT_NOBODY, FALSE); + curl_setopt($ch, CURLOPT_HTTPGET, TRUE); //CURLOPT_NOBODY sets it to 'HEAD' + $toReturn = curl_exec($ch); + + if (($contentSize = self::getBinaryLength($toReturn)) > 0) { + header("Content-Length: $contentSize"); + } + //Done applying headers... + + echo $toReturn; + } + else { + header('HTTP/1.1 307 Moved Temporarily'); + header('Location: ' . $url); } - - header('Content-Disposition: attachment; filename="' . $suggestedFileName . '"'); - } - - if ((isset($user) && $user->uid != 0) || $forceSoap || isset($_SERVER['HTTPS'])) { - curl_exec($ch); - } else { - header('Location: ' . $url); } + else { + watchdog('fedora_repository', 'Curl error while trying to get datastream %dsid from Fedora object %dsid. Curl info: !info', array( + '%pid' => $pid, + '%dsid' => $dsID, + '!info' => print_r(curl_getinfo($ch), TRUE), + ), WATCHDOG_WARNING); + } } curl_close($ch); - } else { + } + else { drupal_set_message(t('No curl support.'), 'error'); } } - //Gets collection objects t + /** + * Gets collection objects t + * + * @param type $pid + * @param type $query + * @return type + */ function getCollectionInfo($pid, $query = NULL) { module_load_include('inc', 'fedora_repository', 'CollectionClass'); $collectionClass = new CollectionClass(); @@ -188,6 +257,11 @@ class ObjectHelper { /** * returns the mime type + * + * @global type $user + * @param type $pid + * @param type $dsID + * @return type */ function getMimeType($pid, $dsID) { global $user; @@ -217,6 +291,13 @@ class ObjectHelper { return ''; } + /** + * getDatastreamInfo ?? + * @global type $user + * @param type $pid + * @param type $dsID + * @return type + */ function getDatastreamInfo($pid, $dsID) { global $user; if (empty($pid) || empty($dsID)) { @@ -253,35 +334,42 @@ class ObjectHelper { function create_link_for_ds($pid, $dataStreamValue) { global $base_url; $path = drupal_get_path('module', 'fedora_repository'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - require_once($path . '/api/fedora_item.inc'); $item = new Fedora_Item($pid); + $purge_image = ' '; if (user_access(ObjectHelper :: $PURGE_FEDORA_OBJECTSANDSTREAMS)) { $allow = TRUE; if (module_exists('fedora_fesl')) { $allow = fedora_fesl_check_roles($pid, 'write'); } if ($allow) { - $purgeImage = 'purge datastream'; + $purge_text = t('Purge datastream "@label"', array('@label' => $dataStreamValue->label)); + $purge_path = "fedora/repository/purgeStream/$pid/{$dataStreamValue->ID}/{$dataStreamValue->label}"; + $purge_image = l(theme('image', "$path/images/purge.gif", $purge_text, $purge_text, NULL, FALSE), $purge_path, array( + 'html' => TRUE, + )); } - } else { - $purgeImage = ' '; } - $fullPath = base_path() . $path; + else { + $purge_image = ' '; + } // Add an icon to replace a datastream // @TODO Note: using l(theme_image(..), ...); for these image links (and other links) may remove the need to have clean urls enabled. - $replaceImage = ' '; + $replace_image = ' '; if (user_access(ObjectHelper :: $ADD_FEDORA_STREAMS)) { $allow = TRUE; if (module_exists('fedora_fesl')) { $allow = fedora_fesl_check_roles($pid, 'write'); } if ($allow) { - $replaceImage = 'label . '" href="' . $base_url . '/fedora/repository/replaceStream/' . $pid . '/' . $dataStreamValue->ID . '/' . $dataStreamValue->label . '">replace datastream'; + $replace_text = t('Replace datastream "@label"', array('@label' => $dataStreamValue->label)); + $replace_path = "fedora/repository/replaceStream/$pid/{$dataStreamValue->ID}/{$dataStreamValue->label}"; + $replace_image = l(theme('image', "$path/images/replace.png", $replace_text, $replace_text, NULL, FALSE), $replace_path, array( + 'html' => TRUE, + )); } } @@ -289,28 +377,54 @@ class ObjectHelper { $id = $dataStreamValue->ID; $label = $dataStreamValue->label; $label = str_replace("_", " ", $label); + $label_deslashed = preg_replace('/\//i', '${1}_', $label); // Necessary to handle the case of Datastream labels that contain slashes. Ugh. $mimeType = $dataStreamValue->MIMEType; - $view = '' . t('View') . ''; - $action = "$base_url/fedora/repository/object_download/" . drupal_urlencode($pid) . '/' . $id . '/' . drupal_urlencode(preg_replace('/\//i', '${1}_', $label)); // Necessary to handle the case of Datastream labels that contain slashes. Ugh. + $view = l(t('View'), "fedora/repository/$pid/$id/$label_deslashed", array( + 'attributes' => array( + 'target' => '_blank', + ), + )); + $action = url("fedora/repository/object_download/$pid/$id/$label_deslashed"); $downloadVersion = '
'; - if (user_access(ObjectHelper :: $EDIT_FEDORA_METADATA)) { + if (user_access(ObjectHelper::$EDIT_FEDORA_METADATA)) { $versions = $item->get_datastream_history($id); if (is_array($versions)) { $downloadVersion = '
'; + $downloadVersion .= ''; $downloadVersion .= '
'; + $downloadVersion .= ''; } } - $content .= "$label $view $downloadVersion $mimeType $replaceImage $purgeImage\n"; - return $content; + return array( + array( + 'data' => $label, + ), + array( + 'data' => $view, + ), + array( + 'data' => $downloadVersion, + ), + array( + 'data' => $mimeType + ), + array( + 'data' => $replace_image . $purge_image, + ), + ); } + /** + * getFormattedDC ?? + * @global type $base_url + * @param type $item + * @return type + */ function getFormattedDC($item) { global $base_url; $path = drupal_get_path('module', 'fedora_repository'); @@ -318,37 +432,38 @@ class ObjectHelper { $dsid = array_key_exists('QDC', $item->get_datastreams_list_as_array()) ? 'QDC' : 'DC'; $xmlstr = $item->get_datastream_dissemination($dsid); - - + if (empty($xmlstr)) { return ''; - } - try { - $proc = new XsltProcessor(); - } catch (Exception $e) { - drupal_set_message($e->getMessage(), 'error'); - return; - } + $simplexml = new SimpleXMLElement($xmlstr); - $proc->setParameter('', 'baseUrl', $base_url); - $proc->setParameter('', 'path', $base_url . '/' . $path); - $input = NULL; - $xsl = new DomDocument(); - try { - $xsl->load($path . '/xsl/convertQDC.xsl'); - $input = new DomDocument(); - $input->loadXML(trim($xmlstr)); - } catch (exception $e) { - watchdog(t("Fedora_Repository"), t("Problem loading XSL file: !e", array('!e' => $e)), NULL, WATCHDOG_ERROR); + $headers = array( + array( + 'data' => t('Metadata'), + 'colspan' => 2, + ), + ); + $rows = array(); + foreach ($simplexml->getNamespaces(TRUE) as $ns) { + foreach ($simplexml->children($ns) as $child) { + $rows[] = array( + array( + 'data' => $child->getName(), + 'class' => 'dc-tag-name', + ), + array( + 'data' => (string)$child, + 'class' => 'dc-content', + ), + ); + } } - $xsl = $proc->importStylesheet($xsl); - $newdom = $proc->transformToDoc($input); - $output = $newdom->saveHTML(); - return $output; + + return theme('table', $headers, $rows, array('class' => 'dc-table')); } - + /** * Queries fedora for what we call the qualified dublin core. Currently only dc.coverage has * any qualified fields @@ -364,24 +479,23 @@ class ObjectHelper { $output = $this->getFormattedDC($item); $dsid = array_key_exists('QDC', $ds_list) ? 'QDC' : 'DC'; $path = drupal_get_path('module', 'fedora_repository'); - - //$baseUrl=substr($baseUrl, 0, (strpos($baseUrl, "/")-1)); + if (user_access(ObjectHelper :: $EDIT_FEDORA_METADATA)) { $allow = TRUE; if (module_exists('fedora_fesl')) { $allow = fedora_fesl_check_roles($pid, 'write'); } if ($allow) { - - $output .= '
' . t('Edit Meta Data') . ''; - + $link_image = theme('image', "$path/images/edit.gif", t('Edit Metadata')); + $link = l($link_image, "fedora/repository/editmetadata/$pid", array( + 'html' => TRUE, + )); + $output .= '
' . $link; } } return $output; } - /** * Gets a list of datastreams from an object using its pid * @@ -396,7 +510,7 @@ class ObjectHelper { * */ function get_formatted_datastream_list($object_pid, $contentModels, &$fedoraItem) { - global $fedoraUser, $fedoraPass, $base_url, $user; + global $base_url, $user; module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); module_load_include('inc', 'fedora_repository', 'ObjectHelper'); module_load_include('inc', 'fedora_repository', 'api/fedora_item'); @@ -408,65 +522,47 @@ class ObjectHelper { if (user_access(ObjectHelper :: $VIEW_DETAILED_CONTENT_LIST)) { $availableDataStreamsText = 'Detailed List of Content'; - //$metaDataText='Description'; + $mainStreamLabel = NULL; $object = $fedoraItem->get_datastreams_list_as_SimpleXML(); if (!isset($object)) { drupal_set_message(t("No datastreams available")); return ' '; } - $hasOBJStream = NULL; - $hasTNStream = FALSE; - $dataStreamBody = "
\n"; $cmDatastreams = array(); if (variable_get('fedora_object_restrict_datastreams', FALSE) == TRUE && ($cm = ContentModel::loadFromObject($object_pid)) !== FALSE) { $cmDatastreams = $cm->listDatastreams(); } - $dataStreamBody .= $this->get_parent_objects_asHTML($object_pid); - $dataStreamBody .= ''; + $headers = array( + array( + 'data' => $availableDataStreamsText, + 'colspan' => 4, + ), + ); + $DSs = array(); foreach ($object as $datastream) { foreach ($datastream as $datastreamValue) { - if (variable_get('fedora_object_restrict_datastreams', FALSE) == FALSE || ((isset($user) && in_array('administrator', $user->roles)) || in_array($datastreamValue->ID, $cmDatastreams))) { - if ($datastreamValue->ID == 'OBJ') { - $hasOBJStream = '1'; - $mainStreamLabel = $datastreamValue->label; - $mainStreamLabel = str_replace("_", " ", $mainStreamLabel); - } - if ($datastreamValue->ID == 'TN') { - $hasTNStream = TRUE; - } + if (variable_get('fedora_object_restrict_datastreams', FALSE) == FALSE || ((isset($user) && in_array('administrator', $user->roles)) || in_array($datastreamValue->ID, $cmDatastreams))) { //create the links to each datastream - $dataStreamBody .= $this->create_link_for_ds($object_pid, $datastreamValue); //"\n"; + $DSs []= $this->create_link_for_ds($object_pid, $datastreamValue); } } } - $dataStreamBody .= "

' . t("!text", array('!text' => $availableDataStreamsText)) . '

$key :$value
\n"; + + $dataStreamBody = theme('table', $headers, $DSs); //if they have access let them add a datastream - if (user_access(ObjectHelper :: $ADD_FEDORA_STREAMS)) { - $allow = TRUE; - if (module_exists('fedora_fesl')) { - $allow = fedora_fesl_check_roles($object_pid, 'write'); - } - if ($allow) { - $dataStreamBody .= drupal_get_form('add_stream_form', $object_pid); - } + if (user_access(ObjectHelper::$ADD_FEDORA_STREAMS) && //If allowed throw Drupal + ((module_exists('fedora_fesl') && fedora_fesl_check_roles($object_pid, 'write')) || //And allowed throw FESL + !module_exists('fedora_fesl'))) { //Or not using FESL, draw the add datastream form. + $dataStreamBody .= drupal_get_form('add_stream_form', $object_pid); } - $fieldset = array( - '#title' => t("!text", array('!text' => $availableDataStreamsText)), - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#value' => $dataStreamBody - ); - $dataStreamBody = '
' . theme('fieldset', $fieldset) . '
'; return $dataStreamBody; } return ''; } - - /** * returns a stream from a fedora object given a pid and dsid @@ -499,13 +595,16 @@ class ObjectHelper { return $content; } - /* + /** * gets the name of the content models for the specified object * this now returns an array of pids as in Fedora 3 we can have more then one Cmodel for an object + * @param type $pid + * @param type $include_fedora_system_content_models + * @return array */ - function get_content_models_list($pid, $include_fedora_system_content_models = FALSE) { module_load_include('inc', 'fedora_repository', 'CollectionClass'); + module_load_include('inc', 'fedora_repository', 'ContentModel'); $collectionHelper = new CollectionClass(); $pids = array(); $query = 'select $object from <#ri> @@ -520,7 +619,7 @@ class ObjectHelper { try { $sxml = new SimpleXMLElement($content_models); } catch (exception $e) { - watchdog(t("Fedora_Repository"), t("Could not find a parent object for %s", $pid), NULL, WATCHDOG_ERROR); + watchdog(t("Fedora_Repository"), "Could not find a parent object for %s", $pid, NULL, WATCHDOG_ERROR); return $pids; } @@ -542,59 +641,52 @@ class ObjectHelper { return $cmodels; } - /* + /** * determines whether we can see the object or not * checks PID namespace permissions, and user permissions + * @global type $user + * @param type $op + * @param type $pid + * @return type */ - - function fedora_repository_access($op, $pid) { - global $user; - + function fedora_repository_access($op, $pid = NULL, $as_user = NULL) { $returnValue = FALSE; - $isRestricted = variable_get('fedora_namespace_restriction_enforced', TRUE); - if (!$isRestricted) { - $namespaceAccess = TRUE; - } + if ($pid == NULL) { - $pid = variable_get('fedora_repository_pid', 'islandora:top'); + $pid = variable_get('fedora_repository_pid', 'islandora:root'); } - $nameSpaceAllowed = explode(" ", variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: ')); - $pos = NULL; - foreach ($nameSpaceAllowed as $nameSpace) { - $pos = stripos($pid, $nameSpace); - if ($pos === 0) { - $namespaceAccess = TRUE; - } + + $isRestricted = variable_get('fedora_namespace_restriction_enforced', TRUE); + $namespace_access = NULL; + if (!$isRestricted) { + $namespace_access = TRUE; } - if ($namespaceAccess) { - $user_access = user_access($op); - if ($user_access == NULL) { - return FALSE; - } - return $user_access; - } else { - return FALSE; + else { + $pid_namespace = substr($pid, 0, strpos($pid, ':') + 1); //Get the namespace (with colon) + $allowed_namespaces = explode(" ", variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: ')); + + $namespace_access = in_array($pid_namespace, $allowed_namespaces); } + + return ($namespace_access && user_access($op, $as_user)); } /** * internal function * uses an xsl to parse the sparql xml returned from the ITQL query - * - * + * @deprecated + * This is only used in the fedora/repository/collection path, + * which should probably be nuked. * @param $content String */ function parseContent($content, $pid, $dsId, $collection, $pageNumber = NULL) { $path = drupal_get_path('module', 'fedora_repository'); global $base_url; $collection_pid = $pid; //we will be changing the pid later maybe - //module_load_include('php', ''Fedora_Repository'', 'ObjectHelper'); $objectHelper = $this; $parsedContent = NULL; - $contentModels = $objectHelper->get_content_models_list($pid); + $contentModels = $this->get_content_models_list($pid); $isCollection = FALSE; - //if this is a collection object store the $pid in the session as it will come in handy - //after a purge or ingest to return to the correct collection. $fedoraItem = NULL; $datastreams = $this->get_formatted_datastream_list($pid, $contentModels, $fedoraItem); @@ -602,6 +694,9 @@ class ObjectHelper { if (!empty($contentModels)) { foreach ($contentModels as $contentModel) { if ($contentModel == variable_get('fedora_collection_model_pid', 'islandora:collectionCModel')) { + //if this is a collection object store the $pid in the session as it will come in handy + //after a purge or ingest to return to the correct collection. + $_SESSION['fedora_collection'] = $pid; $isCollection = TRUE; } @@ -619,8 +714,8 @@ class ObjectHelper { if ($results->length > 0 || $isCollection == TRUE) { // if(strlen($objectList)>22||$contentModel=='Collection'||$contentModel=='Community')//length of empty dom still equals 22 because of etc module_load_include('inc', 'Fedora_Repository', 'CollectionPolicy'); - $collectionPolicyExists = $objectHelper->getMimeType($pid, CollectionPolicy::getDefaultDSID()); - if (user_access(ObjectHelper :: $INGEST_FEDORA_OBJECTS) && $collectionPolicyExists) { + $collectionPolicyExists = $this->getMimeType($pid, CollectionPolicy::getDefaultDSID()); + if (user_access(ObjectHelper::$INGEST_FEDORA_OBJECTS) && $collectionPolicyExists) { if (!empty($collectionPolicyExists)) { $allow = TRUE; if (module_exists('fedora_fesl')) { @@ -628,18 +723,20 @@ class ObjectHelper { } if ($allow) { // $ingestObject = ' $collectionName, '!collection_pid' => $collection_pid)) . '" href="' . base_path() . - 'fedora/ingestObject/' . $collection_pid . '/' . $collectionName . '">' . t('Add a New Object') . '' . t(' Add to this Collection'); + $ingest_text = t('Ingest a new object into @collection_name PID @collection_pid', array('@collection_name' => $collectionName, '@collection_pid' => $collection_pid)); + $ingestObject = l(theme('image', "$path/images/ingest.png", $ingest_text), "fedora/ingestObject/$collection_pid/$collectionName", array('attributes' => array( + 'class' => 'icon', + 'title' => $ingest_text, + ))) . t('Add to this Collection'); } } - } else { + } + else { $ingestObject = ' '; } - } - $datastreams .= $ingestObject; + $datastreams .= $ingestObject; $output .= $datastreams; @@ -671,57 +768,77 @@ class ObjectHelper { $output .= theme('fieldset', $fieldset); } - + return $output; } + /** + * Get the query to find parent objects. + * + * @param $pid string + * A string containing a Fedora PID to find the parents for. + * @return string + * A string containing an iTQL query, selecting something into $object and $title + */ + static function parentQuery($pid) { + return 'select $object $title from <#ri> + where ($object $title + and $object + and $object ) + order by $title'; + } + /** * Gets the parent objects that this object is related to * - * @param unknown_type $pid - * @return unknown + * @param $pid string + * A string containing a Fedora PID to find the parents for. + * @return string + * A string containing Sparql XML (the results of the self::parentQuery()) */ function get_parent_objects($pid) { - $query_string = 'select $object $title from <#ri> - where ($object $title - and $object - and $object ) - order by $title'; - $objects = $this->getCollectionInfo($pid, $query_string); + $query_string = self::parentQuery(); + module_load_include('inc', 'fedora_repository', 'CollectionClass'); + $collection_class = new CollectionClass($pid); + $objects = CollectionClass::getRelatedItems($pid, $query_string); return $objects; } + /** + * get_parent_objects_asHTML ?? + * @global type $base_url + * @param type $pid + * @return string + */ function get_parent_objects_asHTML($pid) { - global $base_url; - $parent_collections = $this->get_parent_objects($pid); - try { - $parent_collections = new SimpleXMLElement($parent_collections); - } catch (exception $e) { - drupal_set_message(t('Error getting parent objects !e', array('!e' => $e->getMessage()))); - return; - } - - $parent_collections_HTML = ''; - foreach ($parent_collections->results->result as $result) { - $collection_label = $result->title; - foreach ($result->object->attributes() as $a => $b) { - if ($a == 'uri') { - $uri = (string) $b; - $uri = $base_url . '/fedora/repository' . substr($uri, strpos($uri, '/')) . '/-/' . $collection_label; - } - } - $parent_collections_HTML .= '' . $collection_label . '
'; + module_load_include('inc', 'fedora_repository', 'CollectionClass'); + $results = self::performItqlQuery(self::parentQuery($pid)); + + $parent_collections = array(); + foreach ($results as $result) { + $collection_title = $result['title']; + $collection_pid = $result['object']; + $path = "fedora/repository/$collection_pid/-/$collection_title"; + $parent = array( + 'data' => l($collection_title, $path), + ); + + $parent_collections[] = $parent; } - if (!empty($parent_collections_HTML)) { - $parent_collections_HTML = '
'; + + if (!empty($parent_collections)) { + return theme('item_list', $parent_collections, t('Belongs to these collections'), 'ul'); } - - return $parent_collections_HTML; } - + /** * gets a list of datastreams and related function that we should use to show datastreams in their own fieldsets * from the content model associated with the object + * + * @param type $pid + * @param type $contentModel + * @param type $page_number + * @return type */ function createExtraFieldsets($pid, $contentModel, $page_number) { //$models = $collectionHelper->getContentModels($collectionPid, FALSE); @@ -760,6 +877,11 @@ class ObjectHelper { /** * Get a tree of related pids - for the basket functionality + * + * FIXME: This doesn't actually get a tree... + * + * @param type $pid + * @return type */ function get_all_related_pids($pid) { if (!$pid) { @@ -768,19 +890,18 @@ class ObjectHelper { module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); // Get title and descriptions for $pid - $query_string = 'select $title $desc from <#ri> - where $o $title + $query_string = 'select $title $description from <#ri> + where $o $title and $o $desc and $o '; - - $url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'); - $url .= "?type=tuples&flush=true&format=csv&limit=1000&lang=itql&stream=on&query="; - $content = do_curl($url . htmlentities(urlencode($query_string))); - - $rows = explode("\n", $content); - $fields = explode(',', $rows[1]); - - $pids[$pid] = array('title' => $fields[0], 'description' => $fields[1]); + + $results = self::performItqlQuery($query_string); + + $pids = array(); + //There should only be one... Anyway. + foreach($results as $result) { + $pids[$pid] = $result; + } // $pids += $this->get_child_pids(array($pid)); @@ -789,40 +910,29 @@ class ObjectHelper { /** * Get children of PID - but only 2 levels deep + * + * @param type $pids + * @return type */ function get_child_pids($pids) { + //Build the parts which are used to filter to the list of input. + $query_chunks = array(); + foreach ($pids as $pid) { + $query_chunks[] = '$s '; + } // Get pid, title and description for children of object $pid $query_string = 'select $o $title from <#ri> ' . -// $query_string = 'select $o $title $desc from <#ri> '. 'where $s $o ' . - 'and $o $title ' . -// 'and $o $desc '. - 'and ( '; - - foreach ($pids as $pid) { - $query_string .= '$s or '; - } - $query_string = substr($query_string, 0, -3) . ' )'; - - $url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'); - $url .= "?type=tuples&flush=true&format=csv&limit=1000&lang=itql&stream=on&query="; - $url .= htmlentities(urlencode($query_string)); - $content = $this->doCurl($url); - - $rows = explode("\n", $content); - // Knock of the first heading row - array_shift($rows); + 'and $o $title ' . + 'and ( ' . implode(' or ', $query_chunks) . ' )'; + + $results = self::performItqlQuery($query_string); $child_pids = array(); - if (count($rows)) { + if ($results) { // iterate through each row - foreach ($rows as $row) { - if ($row == "") { - continue; - } - $fields = explode(',', $row); - $child_pid = substr($fields[0], 12); - $child_pids[$child_pid] = array('title' => $fields[1], 'description' => $fields[2]); + foreach ($results as $result) { + $child_pids[$result['o']] = array('title' => $result['title']); } if (!empty($child_pids)) { $child_pids += $this->get_child_pids(array_keys($child_pids)); @@ -834,6 +944,11 @@ class ObjectHelper { /** * Returns XML description of the object (export). + * + * @param type $pid + * @param type $context + * @param type $format + * @return type */ function getObject($pid, $context = 'archive', $format = FOXML_11) { module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); @@ -845,46 +960,71 @@ class ObjectHelper { /** * Builds an array of drupal links for use in breadcrumbs. + * + * @todo Make fully recursive... + * + * @global type $base_url + * @param type $pid + * @param type $breadcrumbs + * @param type $level */ - function getBreadcrumbs($pid, &$breadcrumbs, $level=10) { + function getBreadcrumbs($pid, &$breadcrumbs) { module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); // Before executing the query, we hve a base case of accessing the top-level collection global $base_url; - if ($pid == variable_get('fedora_repository_pid', 'islandora:top')){ - $breadcrumbs[] = l(t('Digital repository'), 'fedora/repository'); - $breadcrumbs[] = l(t('Home'), $base_url); - } else { + static $max_level = 10; + static $level = -1; + + if (count($breadcrumbs) === 0) { + $level = $max_level; + } + + $root = variable_get('fedora_repository_pid', 'islandora:root'); + + if ($pid == $root) { + $breadcrumbs[] = l(menu_get_active_title(), 'fedora/repository'); + $breadcrumbs[] = l(t('Home'), ''); + } + else { $query_string = 'select $parentObject $title $content from <#ri> - where ( $title - and $parentObject $content - and ( $parentObject - or $parentObject - or $parentObject) - and $parentObject ) - minus $content - order by $title'; - $query_string = htmlentities(urlencode($query_string)); - - $url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'); - $url .= "?type=tuples&flush=TRUE&format=CSV&limit=1&offset=0&lang=itql&stream=on&query=" . $query_string; - - $result = preg_split('/[\r\n]+/',do_curl($url)); - array_shift($result); // throw away first line - $matches =str_getcsv(join("\n",$result)); - if ($matches !== FALSE) { - $parent = preg_replace('/^info:fedora\//','',$matches[0]); - - $breadcrumbs[] = l($matches[1], 'fedora/repository/' . $pid); - if ($parent == variable_get('fedora_repository_pid', 'islandora:top')) { - $breadcrumbs[] = l(t('Digital repository'), 'fedora/repository'); - $breadcrumbs[] = l(t('Home'), $base_url); - } elseif ($level > 0) { - $this->getBreadcrumbs($parent, $breadcrumbs, $level - 1); + where ( + $title + and $parentObject $content + and ( + $parentObject + or $parentObject + or $parentObject + ) + and $parentObject + ) + minus $content + order by $title desc'; + + if (count($results = self::performItqlQuery($query_string)) > 0 && $level > 0) { + $parent = $results[0]['parentObject']; + $this_title = $results[0]['title']; + + if (empty($this_title)) { + $this_title = t('Unlabeled Object'); } + + $breadcrumbs[] = l($this_title, "fedora/repository/$pid"); + + $level--; + $this->getBreadcrumbs($parent, $breadcrumbs); + } + else { + watchdog('fedora_repository', 'Error generating breadcrumbs for %pid. Verify there exists relationships back up to %root. (May also be due to a hierarchy deeper than %max_depth).', array('%pid' => $pid, '%root' => $root, '%max_depth' => $max_depth), WATCHDOG_WARNING); + $breadcrumbs[] = '...'; //Add an non-link, as we don't know how to get back to the root. + $this->getBreadcrumbs($root, $breadcrumbs); //And render the last two links and break (on the next pass). } } } + /** + * warnIfMisconfigured ?? + * @param type $app + */ public static function warnIfMisconfigured($app) { $messMap = array( 'Kakadu' => 'Full installation instructions for Kakadu can be found @@ -895,9 +1035,141 @@ class ObjectHelper { $warnMess = "Creation of one or more datastreams failed.
"; $configMess = "Please ensure that %app is installed and configured for this site. "; - drupal_set_message($warnMess, 'warning', false); - drupal_set_message(t($configMess . "
" . $messMap[$app] . "
", array('%app' => $app)), 'warning', false); + drupal_set_message($warnMess, 'warning', FALSE); + drupal_set_message(t($configMess . "
" . $messMap[$app] . "
", array('%app' => $app)), 'warning', FALSE); } + /** + * Parse the passed in Sparql XML string into a more easily usable format. + * + * @param $sparql string + * A string containing Sparql result XML. + * @return array + * Indexed (numerical) array, containing a number of associative arrays, + * with keys being the same as the variable names in the query. + * URIs beginning with 'info:fedora/' will have this beginning stripped + * off, to facilitate their use as PIDs. + */ + public static function parseSparqlResults($sparql) { + //Load the results into a SimpleXMLElement + $doc = new SimpleXMLElement($sparql, 0, FALSE, 'http://www.w3.org/2001/sw/DataAccess/rf1/result'); + + $results = array(); //Storage. + + //Build the results. + foreach ($doc->results->children() as $result) { + //Built a single result. + $r = array(); + foreach ($result->children() as $element) { + $val = NULL; + + $attrs = $element->attributes(); + if (!empty($attrs['uri'])) { + $val = self::pidUriToBarePid((string)$attrs['uri']); + } + else { + $val = (string)$element; + } + + //Map the name to the value in the array. + $r[$element->getName()] = $val; + } + + //Add the single result to the set to return. + $results[] = $r; + } + return $results; + } + + /** + * Performs the given Resource Index query and return the results. + * + * @param $query string + * A string containing the RI query to perform. + * @param $type string + * The type of query to perform, as used by the risearch interface. + * @param $limit int + * An integer, used to limit the number of results to return. + * @param $offset int + * An integer, used to offset the results (results should be ordered, to + * maintain consistency. + * + * @return array + * Indexed (numerical) array, containing a number of associative arrays, + * with keys being the same as the variable names in the query. + * URIs beginning with 'info:fedora/' will have this beginning stripped + * off, to facilitate their use as PIDs. + */ + static function performRiQuery($query, $type = 'itql', $limit = -1, $offset = 0) { + //Setup the query options... + $options = array( + 'type' => 'tuples', + 'flush' => TRUE, + 'format' => 'Sparql', //Sparql XML is processed into the array below. + 'lang' => $type, + 'query' => $query + ); + //Add limit if provided. + if ($limit > 0) { + $options['limit'] = $limit; + } + //Add offset if provided. + if ($offset > 0) { + $options['offset'] = $offset; + } + + //Construct the query URL. + $queryUrl = url(variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'), array('query' => $options)); + + //Perform the query. + $curl_result = do_curl_ext($queryUrl); + + //If the query failed, write message to the logs and return. + if (!$curl_result[0]) { + watchdog('fedora_repository', 'Failed to perform %type resource index query: %query', array('%type' => $type, '%query' => $query), WATCHDOG_ERROR); + return FALSE; + } + + //Pass the query's results off to a decent parser. + return self::parseSparqlResults($curl_result[0]); + } + /** + * Thin wrapper for self::_performRiQuery(). + * + * @see self::performRiQuery() + */ + public static function performItqlQuery($query, $limit = -1, $offset = 0) { + return self::performRiQuery($query, 'itql', $limit, $offset); + } + /** + * Thin wrapper for self::performRiQuery(). + * + * @see self::_performRiQuery() + */ + public static function performSparqlQuery($query, $limit = -1, $offset = 0) { + return self::performRiQuery($query, 'sparql', $limit, $offset); + } + /** + * Utility function used in self::performRiQuery(). + * + * Strips off the 'info:fedora/' prefix from the passed in string. + * + * @param $uri string + * A string containing a URI. + * + * @return string + * The input string less the 'info:fedora/' prefix (if it has it). + * The original string otherwise. + */ + protected static function pidUriToBarePid($uri) { + $chunk = 'info:fedora/'; + $pos = strpos($uri, $chunk); + if ($pos === 0) { //Remove info:fedora/ chunk + return substr($uri, strlen($chunk)); + } + else { //Doesn't start with info:fedora/ chunk... + return $uri; + } + } } diff --git a/README b/README index 71ece32c..7a642cc4 100644 --- a/README +++ b/README @@ -4,10 +4,6 @@ For installation and customization instructions please see the documentation and https://wiki.duraspace.org/display/ISLANDORA/Islandora -Specifically the Islandora Guide: +All bugs, feature requests and improvement suggestions are tracked at the DuraSpace JIRA: -https://wiki.duraspace.org/display/ISLANDORA/Islandora+Guide - -All bugs, feature requests and improvement suggestions are tracked at the DuraSpace JIRA: - -https://jira.duraspace.org/browse/ISLANDORA \ No newline at end of file +https://jira.duraspace.org/browse/ISLANDORA diff --git a/SearchClass.inc b/SearchClass.inc index 85a91968..751dbbfa 100644 --- a/SearchClass.inc +++ b/SearchClass.inc @@ -1,141 +1,189 @@ $e->getMessage())), NULL, WATCHDOG_ERROR); + watchdog(t("Fedora_Repository"), "Error getting solr search results class: !message", array('!message' => $e->getMessage()), NULL, WATCHDOG_ERROR); return 'Error getting solr search results class. Check watchdog for more info.'; - } + } return $implementation->$solrFunction($query, $startPage, $fq, $dismax); } + + /** + * build solr search form ?? + * @param type $repeat + * @param type $pathToSearchTerms + * @param type $query + * @return type + */ function build_solr_search_form($repeat = NULL, $pathToSearchTerms = NULL, $query = NULL) { $types = $this->get_search_terms_array(NULL, 'solrSearchTerms.xml'); - $queryArray=NULL; + $queryArray = NULL; if (isset($query)) { $queryArray = explode('AND', $query); } $andOrArray = array( - 'AND' => 'and', - //'OR' => 'or' //removed or for now as it would be a pain to parse + 'AND' => 'and', + //'OR' => 'or' //removed or for now as it would be a pain to parse ); $form = array(); if (!isset($repeat)) { - $repeat = variable_get('islandora_solr_search_block_repeat', t('3')); + $repeat = variable_get('islandora_solr_search_block_repeat', t('3')); } $var0 = explode(':', $queryArray[0]); $var1 = explode(':', $queryArray[1]); $form['search_type']['type1'] = array( - '#title' => t(''), - '#type' => 'select', - '#options' => $types, - '#default_value' => trim($var0[0]) + '#title' => t(''), + '#type' => 'select', + '#options' => $types, + '#default_value' => trim($var0[0]) ); $form['fedora_terms1'] = array( - '#size' => '24', - '#type' => 'textfield', - '#title' => t(''), - '#required' => TRUE, - '#default_value' => (count($var0) >= 2 ? trim($var0[1]) : ''), + '#size' => '24', + '#type' => 'textfield', + '#title' => t(''), + '#required' => TRUE, + '#default_value' => (count($var0) >= 2 ? trim($var0[1]) : ''), ); $form['andor1'] = array( - '#title' => t(''), - '#type' => 'select', - '#default_value' => 'AND', - '#options' => $andOrArray + '#title' => t(''), + '#type' => 'select', + '#default_value' => 'AND', + '#options' => $andOrArray ); $form['search_type']['type2'] = array( - '#title' => t(''), - '#type' => 'select', - '#options' => $types, - '#default_value' => (count($var1) >= 2 ? trim($var1[0]) : ''), + '#title' => t(''), + '#type' => 'select', + '#options' => $types, + '#default_value' => (count($var1) >= 2 ? trim($var1[0]) : ''), ); $form['fedora_terms2'] = array( - '#size' => '24', - '#type' => 'textfield', - '#title' => t(''), - '#default_value' => (count($var1) >= 2 ? $var1[1] : ''), + '#size' => '24', + '#type' => 'textfield', + '#title' => t(''), + '#default_value' => (count($var1) >= 2 ? $var1[1] : ''), ); - if ($repeat>2 && $repeat < 9) { //don't want less then 2 or more then 9 + if ($repeat > 2 && $repeat < 9) { //don't want less then 2 or more then 9 for ($i = 3; $i < $repeat + 1; $i++) { $t = $i - 1; $field_and_term = explode(':', $queryArray[$t]); $form["andor$t"] = array( - '#title' => t(''), - '#type' => 'select', - '#default_value' => 'AND', - '#options' => $andOrArray + '#title' => t(''), + '#type' => 'select', + '#default_value' => 'AND', + '#options' => $andOrArray ); $form['search_type']["type$i"] = array( - '#title' => t(''), - '#type' => 'select', - '#options' => $types, - '#default_value' => trim($field_and_term[0]) + '#title' => t(''), + '#type' => 'select', + '#options' => $types, + '#default_value' => trim($field_and_term[0]) ); $form["fedora_terms$i"] = array( - '#size' => '24', - '#type' => 'textfield', - '#title' => t(''), - '#default_value' => (count($field_and_term) >= 2 ? trim($field_and_term[1]) : ''), + '#size' => '24', + '#type' => 'textfield', + '#title' => t(''), + '#default_value' => (count($field_and_term) >= 2 ? trim($field_and_term[1]) : ''), ); } } $form['submit'] = array( - '#type' => 'submit', - '#value' => t('search') + '#type' => 'submit', + '#value' => t('search') ); return $form; } + /** + * build simple solr form ?? + * @return string + */ function build_simple_solr_form() { //$form = array(); $form["search_query"] = array( - '#size' => '30', - '#type' => 'textfield', - '#title' => t(''), - // '#default_value' => (count($field_and_term) >= 2 ? trim($field_and_term[1]) : ''), - ); + '#size' => '30', + '#type' => 'textfield', + '#title' => t(''), + // '#default_value' => (count($field_and_term) >= 2 ? trim($field_and_term[1]) : ''), + ); $form['submit'] = array( - '#type' => 'submit', - '#value' => t('search') + '#type' => 'submit', + '#value' => t('search') ); return $form; } + + /** + * theme solr search form ?? + * @param type $form + * @return type + */ function theme_solr_search_form($form) { if (!isset($repeat)) { - $repeat = variable_get('islandora_solr_search_block_repeat', t('3')); + $repeat = variable_get('islandora_solr_search_block_repeat', t('3')); } - $output = drupal_render($form['search_type']['type1']) ; - $output .= drupal_render($form['fedora_terms1']) ; - $output .= drupal_render($form['andor1']) . drupal_render($form['search_type']['type2']) ; + $output = drupal_render($form['search_type']['type1']); + $output .= drupal_render($form['fedora_terms1']); + $output .= drupal_render($form['andor1']) . drupal_render($form['search_type']['type2']); $output .= drupal_render($form['fedora_terms2']); - if ($repeat>2 && $repeat < 9) { - for ($i=3;$i<$repeat+1;$i++) { + if ($repeat > 2 && $repeat < 9) { + for ($i = 3; $i < $repeat + 1; $i++) { $t = $i - 1; - $output .= drupal_render($form["andor$t"]) . drupal_render($form['search_type']["type$i"]) ; - $output .= drupal_render($form["fedora_terms$i"]) ; + $output .= drupal_render($form["andor$t"]) . drupal_render($form['search_type']["type$i"]); + $output .= drupal_render($form["fedora_terms$i"]); } } - $output .= drupal_render($form['submit']) ; + $output .= drupal_render($form['submit']); $output .= drupal_render($form); return $output; - - } + + /** + * quick search ?? + * @param type $type + * @param type $query + * @param type $showForm + * @param type $orderBy + * @param type $userArray + * @return type + */ function quickSearch($type, $query, $showForm = 1, $orderBy = 0, & $userArray) { module_load_include('inc', 'fedora_repository', 'ObjectHelper'); module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); @@ -146,15 +194,15 @@ class SearchClass { $keywords = explode(' ', $query); foreach ($keywords as $keyword) { - $luceneQuery .= $type . ':'. $keyword . '+AND+'; + $luceneQuery .= $type . ':' . $keyword . '+AND+'; } $luceneQuery = substr($luceneQuery, 0, strlen($luceneQuery) - 5); $indexName = variable_get('fedora_index_name', 'DemoOnLucene'); $keys = htmlentities(urlencode($query)); $searchUrl = variable_get('fedora_fgsearch_url', 'http://localhost:8080/fedoragsearch/rest'); - $searchString = '?operation=gfindObjects&indexName='. $indexName . '&restXslt=copyXml&query='. $luceneQuery; - $searchString .= '&hitPageSize='. $numberOfHistPerPage . '&hitPageStart=1'; + $searchString = '?operation=gfindObjects&indexName=' . $indexName . '&restXslt=copyXml&query=' . $luceneQuery; + $searchString .= '&hitPageSize=' . $numberOfHistPerPage . '&hitPageStart=1'; //$searchString = htmlentities($searchString); $searchUrl .= $searchString; @@ -169,20 +217,25 @@ class SearchClass { $nodeList = $xPath->query('//field[@name="refworks.u1"]'); foreach ($nodeList as $node) { if (!in_array($node->nodeValue, $userArray)) { - $userArray[]=$node->nodeValue; + $userArray[] = $node->nodeValue; } } } if ($showForm) { - $output = 'Quick Search

' . t("Belongs to these collections: ") . '

' . $parent_collections_HTML . '
'. drupal_get_form('fedora_repository_quick_search_form') . '
'; + $output = 'Quick Search
' . drupal_get_form('fedora_repository_quick_search_form') . '
'; } $output .= $this->applyXSLT($resultData, $orderBy); return $output; } } - - // gets term from a lucene index and displays them in a list + /** + * gets term from a lucene index and displays them in a list + * @param type $fieldName + * @param type $startTerm + * @param type $displayName + * @return type + */ function getTerms($fieldName, $startTerm, $displayName = NULL) { module_load_include('inc', 'fedora_repository', 'ObjectHelper'); module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); @@ -192,10 +245,10 @@ class SearchClass { $startTerm = ""; } $startTerm = drupal_urlencode($startTerm); - $query = 'operation=browseIndex&startTerm='. $startTerm . '&fieldName='. $fieldName . '&termPageSize=20&indexName='. $indexName . '&restXslt=copyXml&resultPageXslt=copyXml'; + $query = 'operation=browseIndex&startTerm=' . $startTerm . '&fieldName=' . $fieldName . '&termPageSize=20&indexName=' . $indexName . '&restXslt=copyXml&resultPageXslt=copyXml'; // $query=drupal_urlencode($query); - $query = '?'. $query; - $searchString=$searchUrl . $query; + $query = '?' . $query; + $searchString = $searchUrl . $query; $objectHelper = new ObjectHelper(); @@ -205,11 +258,16 @@ class SearchClass { $output .= $this->applySpecifiedXSLT($resultData, $path . '/xsl/browseIndexToResultPage.xslt', $displayName); //$output .= '
'.$alpha_out; return $output; - } - - + /** + * custom search ?? + * @param type $query + * @param type $startPage + * @param type $xslt + * @param type $numberOfHistPerPage + * @return type + */ function custom_search($query, $startPage=1, $xslt= '/xsl/advanced_search_results.xsl', $numberOfHistPerPage = 50) { module_load_include('inc', 'fedora_repository', 'ObjectHelper'); module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); @@ -225,8 +283,8 @@ class SearchClass { $query = trim($query); $query = htmlentities(urlencode($query)); $searchUrl = variable_get('fedora_fgsearch_url', 'http://localhost:8080/fedoragsearch/rest'); - $searchString = '?operation=gfindObjects&indexName=' . $indexName . '&restXslt='. $copyXMLFile . '&query=' . $query; - $searchString .= '&hitPageSize='. $numberOfHistPerPage . '&hitPageStart='. $startPage; + $searchString = '?operation=gfindObjects&indexName=' . $indexName . '&restXslt=' . $copyXMLFile . '&query=' . $query; + $searchString .= '&hitPageSize=' . $numberOfHistPerPage . '&hitPageStart=' . $startPage; //$searchString = htmlentities($searchString); $searchUrl .= $searchString; @@ -242,7 +300,14 @@ class SearchClass { } } - + /** + * apply specified xslt ?? + * @global type $user + * @param type $resultData + * @param type $pathToXSLT + * @param type $displayName + * @return type + */ function applySpecifiedXSLT($resultData, $pathToXSLT, $displayName = NULL) { $proc = NULL; global $user; @@ -252,9 +317,8 @@ class SearchClass { } try { $proc = new XsltProcessor(); - } - catch (Exception $e) { - drupal_set_message(t('Error loading '. $pathToXSLT . ' xslt!') . $e->getMessage()); + } catch (Exception $e) { + drupal_set_message(t('Error loading ' . $pathToXSLT . ' xslt!') . $e->getMessage()); return ' '; } @@ -270,10 +334,10 @@ class SearchClass { $xsl = new DomDocument(); - $test= $xsl->load($pathToXSLT); + $test = $xsl->load($pathToXSLT); if (!isset($test)) { - drupal_set_message(t('Error loading '. $pathToXSLT . ' xslt!')); + drupal_set_message(t('Error loading ' . $pathToXSLT . ' xslt!')); return t('Error loading !pathToXSLT xslt.', array('!pathToXSLT' => $pathToXSLT)); } @@ -291,8 +355,8 @@ class SearchClass { return $newdom->saveXML(); } } - //default function for lucene results + //default function for lucene results /** * apply an xslt to lucene gsearch search results @@ -305,8 +369,8 @@ class SearchClass { function applyLuceneXSLT($resultData, $startPage = 1, $xslt_file = '/xsl/results.xsl', $query=NULL) { $path = drupal_get_path('module', 'Fedora_Repository'); $test = $xslt_file; - $isRestricted = variable_get('fedora_namespace_restriction_enforced',TRUE); - if(!isRestricted && $xslt_file == null){ + $isRestricted = variable_get('fedora_namespace_restriction_enforced', TRUE); + if (!isRestricted && $xslt_file == NULL) { $xslt_file = '/xsl/unfilteredresults.xsl'; } $proc = NULL; @@ -329,7 +393,7 @@ class SearchClass { $proc->setParameter('', 'searchToken', drupal_get_token('fedora_repository_advanced_search')); //token generated by Drupal, keeps tack of what tab etc we are on $proc->setParameter('', 'searchUrl', url('search') . '/fedora_repository'); //needed in our xsl $proc->setParameter('', 'objectsPage', base_path()); - $proc->setParameter('', 'allowedPidNameSpaces', variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: ')); + $proc->setParameter('', 'allowedPidNameSpaces', variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: ')); $proc->setParameter('', 'hitPageStart', $startPage); $proc->registerPHPFunctions(); $xsl = new DomDocument(); @@ -354,7 +418,12 @@ class SearchClass { } } - //xslt for islandscholar these xslt functions can probably be pulled into one + /** + * xslt for islandscholar these xslt functions can probably be pulled into one + * @param type $resultData + * @param type $orderBy + * @return type + */ function applyXSLT($resultData, $orderBy = 0) { $path = drupal_get_path('module', 'Fedora_Repository'); $proc = NULL; @@ -365,7 +434,7 @@ class SearchClass { try { $proc = new XsltProcessor(); } catch (Exception $e) { - drupal_set_message(t('Error loading results xslt! ') . $e->getMessage()); + drupal_set_message(t('Error loading results xslt!') . " " . $e->getMessage()); return ' '; } @@ -374,11 +443,11 @@ class SearchClass { $proc->setParameter('', 'userID', $user->uid); $proc->setParameter('', 'searchUrl', url('search') . '/fedora_repository'); //needed in our xsl $proc->setParameter('', 'objectsPage', base_path()); - $proc->setParameter('', 'allowedPidNameSpaces', variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: ')); + $proc->setParameter('', 'allowedPidNameSpaces', variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: ')); $proc->setParameter('', 'orderBy', $orderBy); $xsl = new DomDocument(); - $test=$xsl->load($path . '/ir/xsl/results.xsl'); + $test = $xsl->load($path . '/ir/xsl/results.xsl'); if (!isset($test)) { drupal_set_message(t('Error loading search results xslt!')); return t('Error loading search results XSLT.'); @@ -398,110 +467,127 @@ class SearchClass { } } + /** + * theme advanced search form ?? + * @param type $form + * @param type $repeat + * @return type + */ function theme_advanced_search_form($form, $repeat=NULL) { if (!isset($repeat)) { - $repeat = variable_get('fedora_repository_advanced_block_repeat', t('3')); + $repeat = variable_get('fedora_repository_advanced_block_repeat', t('3')); } - $output = drupal_render($form['search_type']['type1']) ; - $output .= drupal_render($form['fedora_terms1']) ; - $output .= drupal_render($form['andor1']) . drupal_render($form['search_type']['type2']) ; + $output = drupal_render($form['search_type']['type1']); + $output .= drupal_render($form['fedora_terms1']); + $output .= drupal_render($form['andor1']) . drupal_render($form['search_type']['type2']); $output .= drupal_render($form['fedora_terms2']); - if ($repeat>2 && $repeat < 9) { - for ($i=3;$i<$repeat+1;$i++) { + if ($repeat > 2 && $repeat < 9) { + for ($i = 3; $i < $repeat + 1; $i++) { $t = $i - 1; - $output .= drupal_render($form["andor$t"]) . drupal_render($form['search_type']["type$i"]) ; - $output .= drupal_render($form["fedora_terms$i"]) ; + $output .= drupal_render($form["andor$t"]) . drupal_render($form['search_type']["type$i"]); + $output .= drupal_render($form["fedora_terms$i"]); } } - $output .= drupal_render($form['submit']) ; + $output .= drupal_render($form['submit']); $output .= drupal_render($form); return $output; } - //build search form, custom blocks should set the number of repeats or it will use the default + /** + * build search form, custom blocks should set the number of repeats or it will use the default + * @param type $repeat + * @param type $pathToSearchTerms + * @param type $query + * @return string + */ function build_advanced_search_form($repeat = NULL, $pathToSearchTerms = NULL, $query = NULL) { $types = $this->get_search_terms_array($pathToSearchTerms); - $queryArray=NULL; + $queryArray = NULL; if (isset($query)) { $queryArray = explode('AND', $query); } $andOrArray = array( - 'AND' => 'and', - //'OR' => 'or' //removed or for now as it would be a pain to parse + 'AND' => 'and', + //'OR' => 'or' //removed or for now as it would be a pain to parse ); $form = array(); if (!isset($repeat)) { - $repeat = variable_get('fedora_repository_advanced_block_repeat', t('3')); + $repeat = variable_get('fedora_repository_advanced_block_repeat', t('3')); } $var0 = explode(':', $queryArray[0]); $var1 = explode(':', $queryArray[1]); $form['search_type']['type1'] = array( - '#title' => t(''), - '#type' => 'select', - '#options' => $types, - '#default_value' => trim($var0[0]) + '#title' => t(''), + '#type' => 'select', + '#options' => $types, + '#default_value' => trim($var0[0]) ); $form['fedora_terms1'] = array( - '#size' => '24', - '#type' => 'textfield', - '#title' => t(''), - '#required' => TRUE, - '#default_value' => (count($var0) >= 2 ? trim($var0[1]) : ''), + '#size' => '24', + '#type' => 'textfield', + '#title' => t(''), + '#required' => TRUE, + '#default_value' => (count($var0) >= 2 ? trim($var0[1]) : ''), ); $form['andor1'] = array( - '#title' => t(''), - '#type' => 'select', - '#default_value' => 'AND', - '#options' => $andOrArray + '#title' => t(''), + '#type' => 'select', + '#default_value' => 'AND', + '#options' => $andOrArray ); $form['search_type']['type2'] = array( - '#title' => t(''), - '#type' => 'select', - '#options' => $types, - '#default_value' => (count($var1) >= 2 ? trim($var1[0]) : ''), + '#title' => t(''), + '#type' => 'select', + '#options' => $types, + '#default_value' => (count($var1) >= 2 ? trim($var1[0]) : ''), ); $form['fedora_terms2'] = array( - '#size' => '24', - '#type' => 'textfield', - '#title' => t(''), - '#default_value' => (count($var1) >= 2 ? $var1[1] : ''), + '#size' => '24', + '#type' => 'textfield', + '#title' => t(''), + '#default_value' => (count($var1) >= 2 ? $var1[1] : ''), ); - if ($repeat>2 && $repeat < 9) { //don't want less then 2 or more then 9 + if ($repeat > 2 && $repeat < 9) { //don't want less then 2 or more then 9 for ($i = 3; $i < $repeat + 1; $i++) { $t = $i - 1; $field_and_term = explode(':', $queryArray[$t]); $form["andor$t"] = array( - '#title' => t(''), - '#type' => 'select', - '#default_value' => 'AND', - '#options' => $andOrArray + '#title' => t(''), + '#type' => 'select', + '#default_value' => 'AND', + '#options' => $andOrArray ); $form['search_type']["type$i"] = array( - '#title' => t(''), - '#type' => 'select', - '#options' => $types, - '#default_value' => trim($field_and_term[0]) + '#title' => t(''), + '#type' => 'select', + '#options' => $types, + '#default_value' => trim($field_and_term[0]) ); $form["fedora_terms$i"] = array( - '#size' => '24', - '#type' => 'textfield', - '#title' => t(''), - '#default_value' => (count($field_and_term) >= 2 ? trim($field_and_term[1]) : ''), + '#size' => '24', + '#type' => 'textfield', + '#title' => t(''), + '#default_value' => (count($field_and_term) >= 2 ? trim($field_and_term[1]) : ''), ); } } $form['submit'] = array( - '#type' => 'submit', - '#value' => t('search') + '#type' => 'submit', + '#value' => t('search') ); return $form; } - + /** + * get search terms array + * @param type $path + * @param string $file + * @return type + */ function get_search_terms_array($path = NULL, $file = NULL) { if (!isset($path)) { $path = drupal_get_path('module', 'Fedora_Repository'); @@ -510,7 +596,7 @@ class SearchClass { if (!isset($file)) { $file = 'searchTerms.xml'; } - $xmlDoc->load($path . '/'. $file); + $xmlDoc->load($path . '/' . $file); $nodeList = $xmlDoc->getElementsByTagName('term'); $types = array(); for ($i = 0; $i < $nodeList->length; $i++) { @@ -522,4 +608,5 @@ class SearchClass { } return $types; } + } diff --git a/SecurityClass.inc b/SecurityClass.inc index c314cbd1..970b108b 100644 --- a/SecurityClass.inc +++ b/SecurityClass.inc @@ -1,203 +1,211 @@ -getStream($collection_pid, SECURITYCLASS :: $SECURITY_CLASS_SECURITY_STREAM, FALSE); - - if ($policyStream == NULL) { - // no child policy stream so collection is wide open to anyone to ingest, that has the permission ingest in Drupal. - // maybe we should return FALSE here?? would be more secure. - return TRUE; - } - $allowedUsersAndRoles = $this->getAllowedUsersAndRoles($policyStream); - if (!$allowedUsersAndRoles) { - // error processing stream so don't let them ingest here. - return FALSE; - } - $allowedUsers = $allowedUsersAndRoles["users"]; - $allowedRoles = $allowedUsersAndRoles["roles"]; - - foreach ($user->roles as $role) { - if (in_array($role, $allowedRoles)) { - return TRUE; - } - } - - if (in_array($user->name, $allowedUsers)) { - return TRUE; - } - return FALSE; - } - - //parses our simple xacml policies checking for users or roles that are allowed to ingest - function getAllowedUsersAndRoles($policyStream) { - $allowedRoles = array(); - $allowedUsers = array(); - $usersAndRoles = array(); - try { - $xml = new SimpleXMLElement($policyStream); - } - catch (Exception $e) { - watchdog(t("Fedora_Repository"), t("No roles found in security policy, could not parse policy stream."), NULL, WATCHDOG_ERROR); - //we may not want to send this to the screen. - drupal_set_message(t('No roles found in security policy, could not parse policy stream: !message', array('!message' => $e->getMessage())), 'error'); - return NULL; - } - $xml->registerXPathNamespace('default', 'urn:oasis:names:tc:xacml:1.0:policy'); - - $conditions = $xml->xpath("//default:Condition"); - - foreach ($conditions as $condition) { - $designator = $condition->Apply->SubjectAttributeDesignator; - if (empty($designator)) {//$disignator may be wrapped by an or - $designator=$condition->Apply->Apply->SubjectAttributeDesignator; - } - $attributeId = strip_tags($designator['AttributeId']); - - if ($attributeId == "fedoraRole") { - foreach ($condition->Apply->Apply->AttributeValue as $attributeValue) { - $allowedRoles[] = strip_tags($attributeValue->asXML()); - } - foreach ($condition->Apply->Apply->Apply->AttributeValue as $attributeValue) { - $allowedRoles[] = strip_tags($attributeValue->asXML()); - } - } - if ($attributeId == "urn:fedora:names:fedora:2.1:subject:loginId") { - foreach ($condition->Apply->Apply->AttributeValue as $attributeValue) { - $allowedUsers[] = strip_tags($attributeValue->asXML()); - } - foreach ($condition->Apply->Apply->Apply->AttributeValue as $attributeValue) { - $allowedUsers[] = strip_tags($attributeValue->asXML()); - } - } - } - $usersAndRoles['users'] = $allowedUsers; - $usersAndRoles['roles'] = $allowedRoles; - return $usersAndRoles; - - } - // When a user's profile is saved in drupal we will attempt to create a collection for them in Fedora - // this will be their personal space. In the IR it is editable by users with the same role in the VRE - // it probably would not be. - function createPersonalPolicy($user) { - $doc = new DOMDocument(); - try { - $doc->load(drupal_get_path('module', 'Fedora_Repository') . '/policies/noObjectEditPolicy.xml'); - } - catch (exception $e) { - watchdog(t("Fedora_Repository"), t("Problem loading policy file."), NULL, WATCHDOG_ERROR); - } - $conditions = $doc->getElementsByTagName('Condition'); - foreach ($conditions as $condition) { - $designator = $condition->getElementsByTagName('SubjectAttributeDesignator'); - foreach ($designator as $des) { - $attributeId = $des->getAttribute('AttributeId'); - if ($attributeId == 'fedoraRole') { - $applies = $condition->getElementsByTagName('Apply'); - foreach ($applies as $apply) { - $functionId = $apply->getAttribute('FunctionId'); - if ($functionId == 'urn:oasis:names:tc:xacml:1.0:function:string-bag') { - foreach ($user->roles as $role) { - if (!($role == 'authenticated user' || $role == 'administrator')) { //don't want authenticated user included administrator already is included' - $newAttributeValue=$doc->createElement('AttributeValue', ''); - $newAttributeValue->setAttribute('DataType', 'http://www.w3.org/2001/XMLSchema#string'); - // $newAttributeValue->setAttribute('MustBePresent', 'FALSE'); - $apply->appendChild($newAttributeValue); - } - } - } - } - } - - if ($attributeId == 'urn:fedora:names:fedora:2.1:subject:loginId') { - $applies = $condition->getElementsByTagName('Apply'); - foreach ($applies as $apply) { - $functionId = $apply->getAttribute('FunctionId'); - if ($functionId == 'urn:oasis:names:tc:xacml:1.0:function:string-bag') { - $newAttributeValue=$doc->createElement('AttributeValue', $user->name); - $newAttributeValue->setAttribute('DataType', 'http://www.w3.org/2001/XMLSchema#string'); - //$newAttributeValue->setAttribute('MustBePresent', 'FALSE'); - $apply->appendChild($newAttributeValue); - } - } - } - } - } - - return $doc; //NULL; //$xml; - } - - /** - * Add a list of allowed users and roles to the given policy stream and return it. - * - * @param string $policy_stream - * @param array $users_and_roles - * @return DOMDocument - */ - function set_allowed_users_and_roles(&$policy_stream, $users_and_roles) { - $allowed_roles = $users_and_roles['roles']; - $allowed_users = $users_and_roles['users']; - $dom = new DOMDocument(); - $dom->loadXML($policy_stream); - $conditions = $dom->getElementsByTagName('Condition'); - foreach ($conditions as $condition) { - $designator = $condition->getElementsByTagName('SubjectAttributeDesignator'); - foreach ($designator as $des) { - $attributeId = $des->getAttribute('AttributeId'); - if ($attributeId == 'fedoraRole') { - // $applies = $condition->getElementsByTagName('Apply'); - $applies = $des->parentNode->getElementsByTagName('Apply'); - foreach ($applies as $apply) { - $functionId = $apply->getAttribute('FunctionId'); - if ($functionId == 'urn:oasis:names:tc:xacml:1.0:function:string-bag') { - foreach ($allowed_roles as $role) { - if (!($role == 'authenticated user' || $role == 'administrator')) { //don't want authenticated user included administrator already is included' - $newAttributeValue=$dom->createElement('AttributeValue', $role); - $newAttributeValue->setAttribute('DataType', 'http://www.w3.org/2001/XMLSchema#string'); - //$newAttributeValue->setAttribute('MustBePresent', 'FALSE'); - $apply->appendChild($newAttributeValue); - } - } - } - } - } - - if ($attributeId == 'urn:fedora:names:fedora:2.1:subject:loginId') { - // $applies = $condition->getElementsByTagName('Apply'); - $applies = $des->parentNode->getElementsByTagName('Apply'); - foreach ($applies as $apply) { - $functionId = $apply->getAttribute('FunctionId'); - if ($functionId == 'urn:oasis:names:tc:xacml:1.0:function:string-bag') { - foreach ( $allowed_users as $username ) { - $newAttributeValue=$dom->createElement('AttributeValue', $username ); - $newAttributeValue->setAttribute('DataType', 'http://www.w3.org/2001/XMLSchema#string'); - //$newAttributeValue->setAttribute('MustBePresent', 'FALSE'); - $apply->appendChild($newAttributeValue); - } - } - } - } - } - } - // $this->collection_policy_stream = $dom->saveXML(); - return $dom->saveXML(); - } -} +getStream($collection_pid, SECURITYCLASS :: $SECURITY_CLASS_SECURITY_STREAM, FALSE); + if ($policyStream == NULL) { + // no child policy stream so collection is wide open to anyone to ingest, that has the permission ingest in Drupal. + // maybe we should return FALSE here?? would be more secure. + return TRUE; + } + $allowedUsersAndRoles = $this->getAllowedUsersAndRoles($policyStream); + if (!$allowedUsersAndRoles) { + // error processing stream so don't let them ingest here. + return FALSE; + } + $allowedUsers = $allowedUsersAndRoles["users"]; + $allowedRoles = $allowedUsersAndRoles["roles"]; + + foreach ($user->roles as $role) { + if (in_array($role, $allowedRoles)) { + return TRUE; + } + } + + if (in_array($user->name, $allowedUsers)) { + return TRUE; + } + return FALSE; + } + + /** + * parses our simple xacml policies checking for users or roles that are allowed to ingest + * @param type $policyStream + * @return type + */ + function getAllowedUsersAndRoles($policyStream) { + $allowedRoles = array(); + $allowedUsers = array(); + $usersAndRoles = array(); + try { + $xml = new SimpleXMLElement($policyStream); + } catch (Exception $e) { + watchdog(t("Fedora_Repository"), "No roles found in security policy, could not parse policy stream.", NULL, WATCHDOG_ERROR); + //we may not want to send this to the screen. + drupal_set_message(t('No roles found in security policy, could not parse policy stream: !message', array('!message' => check_plain($e->getMessage()))), 'error'); + return NULL; + } + $xml->registerXPathNamespace('default', 'urn:oasis:names:tc:xacml:1.0:policy'); + + $roles = $xml->xpath('//default:SubjectAttributeDesignator[@AttributeId="fedoraRole"]/../default:Apply/default:AttributeValue'); + $users = $xml->xpath('//default:SubjectAttributeDesignator[@AttributeId="urn:fedora:names:fedora:2.1:subject:loginId"]/../default:Apply/default:AttributeValue'); + + if($roles) { + foreach($roles as $role) { + $allowedRoles[] = (string)$role; + } + } + if($users) { + foreach($users as $user) { + $allowedUsers[] = (string)$user; + } + } + + $usersAndRoles['users'] = $allowedUsers; + $usersAndRoles['roles'] = $allowedRoles; + + return $usersAndRoles; + } + + /** + * When a user's profile is saved in drupal we will attempt to create a collection for them in Fedora + * this will be their personal space. In the IR it is editable by users with the same role in the VRE + * it probably would not be. + * @param type $user + * @return DOMDocument + */ + function createPersonalPolicy($user) { + $doc = new DOMDocument(); + try { + $doc->load(drupal_get_path('module', 'Fedora_Repository') . '/policies/noObjectEditPolicy.xml'); + } catch (exception $e) { + watchdog(t("Fedora_Repository"), "Problem loading policy file.", NULL, WATCHDOG_ERROR); + } + $conditions = $doc->getElementsByTagName('Condition'); + foreach ($conditions as $condition) { + $designator = $condition->getElementsByTagName('SubjectAttributeDesignator'); + foreach ($designator as $des) { + $attributeId = $des->getAttribute('AttributeId'); + if ($attributeId == 'fedoraRole') { + $applies = $condition->getElementsByTagName('Apply'); + foreach ($applies as $apply) { + $functionId = $apply->getAttribute('FunctionId'); + if ($functionId == 'urn:oasis:names:tc:xacml:1.0:function:string-bag') { + foreach ($user->roles as $role) { + if (!($role == 'authenticated user' || $role == 'administrator')) { //don't want authenticated user included administrator already is included' + $newAttributeValue = $doc->createElement('AttributeValue', ''); + $newAttributeValue->setAttribute('DataType', 'http://www.w3.org/2001/XMLSchema#string'); + // $newAttributeValue->setAttribute('MustBePresent', 'FALSE'); + $apply->appendChild($newAttributeValue); + } + } + } + } + } + + if ($attributeId == 'urn:fedora:names:fedora:2.1:subject:loginId') { + $applies = $condition->getElementsByTagName('Apply'); + foreach ($applies as $apply) { + $functionId = $apply->getAttribute('FunctionId'); + if ($functionId == 'urn:oasis:names:tc:xacml:1.0:function:string-bag') { + $newAttributeValue = $doc->createElement('AttributeValue', $user->name); + $newAttributeValue->setAttribute('DataType', 'http://www.w3.org/2001/XMLSchema#string'); + //$newAttributeValue->setAttribute('MustBePresent', 'FALSE'); + $apply->appendChild($newAttributeValue); + } + } + } + } + } + + return $doc; //NULL; //$xml; + } + + /** + * Add a list of allowed users and roles to the given policy stream and return it. + * + * @param string $policy_stream + * @param array $users_and_roles + * @return DOMDocument + */ + function set_allowed_users_and_roles(&$policy_stream, $users_and_roles) { + $allowed_roles = $users_and_roles['roles']; + $allowed_users = $users_and_roles['users']; + $dom = new DOMDocument(); + $dom->loadXML($policy_stream); + $conditions = $dom->getElementsByTagName('Condition'); + foreach ($conditions as $condition) { + $designator = $condition->getElementsByTagName('SubjectAttributeDesignator'); + foreach ($designator as $des) { + $attributeId = $des->getAttribute('AttributeId'); + if ($attributeId == 'fedoraRole') { + // $applies = $condition->getElementsByTagName('Apply'); + $applies = $des->parentNode->getElementsByTagName('Apply'); + foreach ($applies as $apply) { + $functionId = $apply->getAttribute('FunctionId'); + if ($functionId == 'urn:oasis:names:tc:xacml:1.0:function:string-bag') { + foreach ($allowed_roles as $role) { + if (!($role == 'authenticated user' || $role == 'administrator')) { //don't want authenticated user included administrator already is included' + $newAttributeValue = $dom->createElement('AttributeValue', $role); + $newAttributeValue->setAttribute('DataType', 'http://www.w3.org/2001/XMLSchema#string'); + //$newAttributeValue->setAttribute('MustBePresent', 'FALSE'); + $apply->appendChild($newAttributeValue); + } + } + } + } + } + + if ($attributeId == 'urn:fedora:names:fedora:2.1:subject:loginId') { + // $applies = $condition->getElementsByTagName('Apply'); + $applies = $des->parentNode->getElementsByTagName('Apply'); + foreach ($applies as $apply) { + $functionId = $apply->getAttribute('FunctionId'); + if ($functionId == 'urn:oasis:names:tc:xacml:1.0:function:string-bag') { + foreach ($allowed_users as $username) { + $newAttributeValue = $dom->createElement('AttributeValue', $username); + $newAttributeValue->setAttribute('DataType', 'http://www.w3.org/2001/XMLSchema#string'); + //$newAttributeValue->setAttribute('MustBePresent', 'FALSE'); + $apply->appendChild($newAttributeValue); + } + } + } + } + } + } + // $this->collection_policy_stream = $dom->saveXML(); + return $dom->saveXML(); + } + +} diff --git a/XMLDatastream.inc b/XMLDatastream.inc index f5efa4d2..ab8044f4 100644 --- a/XMLDatastream.inc +++ b/XMLDatastream.inc @@ -1,7 +1,18 @@ pid = $pid; $this->dsid = $dsid; - if ($xmlStr !== NULL) { - if(is_object($xmlStr) && get_class($xmlStr) == DOMDocument) { + if ($xmlStr !== NULL) { + if (is_object($xmlStr) && get_class($xmlStr) == DOMDocument) { $this->xml = $xmlStr; } else { $this->xml = new DOMDocument(); $this->xml->loadXML($xmlStr); - } + } } } @@ -180,7 +191,8 @@ abstract class XMLDatastream { // a subclass. $vars = get_class_vars(get_class($this)); $schemaLocation = $vars['SCHEMA_URI']; - } elseif ($rootEl->attributes->getNamedItem('schemaLocation') !== NULL) { + } + elseif ($rootEl->attributes->getNamedItem('schemaLocation') !== NULL) { //figure out where the schema is located and validate. list(, $schemaLocation) = preg_split('/\s+/', $rootEl->attributes->getNamedItem('schemaLocation')->nodeValue); } @@ -193,10 +205,12 @@ abstract class XMLDatastream { foreach ($errors as $err) { self::$errors[] = 'XML Error: Line ' . $err->line . ': ' . $err->message; } - } else { + } + else { $this->name = $rootEl->attributes->getNamedItem('name')->nodeValue; } - } else { + } + else { $ret = FALSE; self::$errors[] = 'Unable to load schema.'; } @@ -239,7 +253,7 @@ abstract class XMLDatastream { /** * Gets the history of the datastream from fedora. - * Returns false on failure. + * Returns FALSE on failure. * * @return string[] $ret */ diff --git a/api/dublin_core.inc b/api/dublin_core.inc index 04321677..ae8a3687 100644 --- a/api/dublin_core.inc +++ b/api/dublin_core.inc @@ -1,13 +1,19 @@ array(), 'dc:creator' => array(), @@ -41,25 +47,25 @@ class Dublin_Core { } /** - * + * Add Elements * @param $element_name * @param $value */ - function add_element( $element_name, $value ) { + function add_element($element_name, $value) { if (is_string($value) && is_array($this->dc[$element_name])) { $this->dc[$element_name][] = $value; } } -/** - * Replace the given DC element with the values in $values - * @param string $elemnt_name - * @param array $values - */ + /** + * Replace the given DC element with the values in $values + * @param string $elemnt_name + * @param array $values + */ function set_element($element_name, $values) { if (is_array($values)) { $this->dc[$element_name] = $values; - } + } elseif (is_string($values)) { $this->dc[$element_name] = array($values); } @@ -67,8 +73,10 @@ class Dublin_Core { /** * Serialize this object to XML and return it. + * @param type $with_preamble + * @return type */ - function as_xml( $with_preamble = FALSE ) { + function as_xml($with_preamble = FALSE) { $dc_xml = new DomDocument(); $oai_dc = $dc_xml->createElementNS('http://www.openarchives.org/OAI/2.0/oai_dc/', 'oai_dc:dc'); $oai_dc->setAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/'); @@ -78,7 +86,7 @@ class Dublin_Core { $new_item = $dc_xml->createElement($dc_element, $value); $oai_dc->appendChild($new_item); } - } + } else { $new_item = $dc_xml->createElement($dc_element); $oai_dc->appendChild($new_item); @@ -88,10 +96,17 @@ class Dublin_Core { return $dc_xml->saveXML(); } + /** + * Create dc from dict ( does nothing ) + */ static function create_dc_from_dict() { - + } + /** + * Save ?? + * @param type $alt_owner + */ function save($alt_owner = NULL) { $item_to_update = (!empty($alt_owner) ? $alt_owner : $this->owner); // My Java roots showing, trying to do polymorphism in PHP. @@ -114,7 +129,7 @@ class Dublin_Core { array_push($new_dc->dc[$child->nodeName], $child->nodeValue); } return $new_dc; - } + } else { return NULL; } diff --git a/api/fedora_collection.inc b/api/fedora_collection.inc index 3db41018..200fb324 100644 --- a/api/fedora_collection.inc +++ b/api/fedora_collection.inc @@ -1,10 +1,9 @@ $format + * @param type $collection_pid + * @param type $relationship + * @param type $format + * @return type */ -function export_collection($collection_pid, $relationship = 'isMemberOfCollection', $format = 'info:fedora/fedora-system:FOXML-1.1' ) { +function export_collection($collection_pid, $relationship = 'isMemberOfCollection', $format = 'info:fedora/fedora-system:FOXML-1.1') { $collection_item = new Fedora_Item($collection_pid); $foxml = $collection_item->export_as_foxml(); $file_dir = file_directory_path(); - + // Create a temporary directory to contain the exported FOXML files. $container = tempnam($file_dir, 'export_'); file_delete($container); print $container; - if (mkdir($container) && mkdir($container . '/'. $collection_pid)) { - $foxml_dir = $container . '/'. $collection_pid; - $file = fopen($foxml_dir . '/'. $collection_pid . '.xml', 'w'); + if (mkdir($container) && mkdir($container . '/' . $collection_pid)) { + $foxml_dir = $container . '/' . $collection_pid; + $file = fopen($foxml_dir . '/' . $collection_pid . '.xml', 'w'); fwrite($file, $foxml); fclose($file); - + $member_pids = get_related_items_as_array($collection_pid, $relationship); foreach ($member_pids as $member) { - $file = fopen($foxml_dir . '/'. $member . '.xml', 'w'); + $file = fopen($foxml_dir . '/' . $member . '.xml', 'w'); $item = new Fedora_Item($member); $item_foxml = $item->export_as_foxml(); fwrite($file, $item_foxml); fclose($file); } - if (system("cd $container;zip -r $collection_pid.zip $collection_pid/* >/dev/NULL") == 0) { + if (system("cd $container;zip -r $collection_pid.zip $collection_pid/* >/dev/null") == 0) { header("Content-type: application/zip"); - header('Content-Disposition: attachment; filename="' . $collection_pid . '.zip'. '"'); - $fh = fopen($container . '/'. $collection_pid . '.zip', 'r'); - $the_data = fread($fh, filesize($container . '/'. $collection_pid . '.zip')); + header('Content-Disposition: attachment; filename="' . $collection_pid . '.zip' . '"'); + $fh = fopen($container . '/' . $collection_pid . '.zip', 'r'); + $the_data = fread($fh, filesize($container . '/' . $collection_pid . '.zip')); fclose($fh); echo $the_data; } - if (file_exists($container . '/'. $collection_pid)) { + if (file_exists($container . '/' . $collection_pid)) { system("rm -rf $container"); // I'm sorry. } - } + } else { - drupal_set_message("Error creating temp directory for batch export.", 'error'); + drupal_set_message(t("Error creating temp directory for batch export."), 'error'); return FALSE; } return TRUE; @@ -67,56 +69,66 @@ function export_collection($collection_pid, $relationship = 'isMemberOfCollectio */ function get_related_items_as_xml($collection_pid, $relationship = array('isMemberOfCollection'), $limit = 10000, $offset = 0, $active_objects_only = TRUE, $cmodel = NULL, $orderby = '$title') { module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - $collection_item = new Fedora_Item($collection_pid); - + global $user; if (!fedora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied."), 'error'); return array(); } - + $query_string = 'select $object $title $content from <#ri> - where ($object $title + where ($object $title and $object $content and ('; if (is_array($relationship)) { foreach ($relationship as $rel) { - $query_string .= '$object '; + $query_string .= '$object '; if (next($relationship)) { $query_string .= ' OR '; } } } elseif (is_string($relationship)) { - $query_string .= '$object '; + $query_string .= '$object '; } else { return ''; } $query_string .= ') '; - $query_string .= $active_objects_only ? 'and $object ' : ''; - + $query_string .= $active_objects_only ? 'and $object ' : ''; + if ($cmodel) { $query_string .= ' and $content '; } - + $query_string .= ') minus $content - order by '.$orderby; - + order by ' . $orderby; + $query_string = htmlentities(urlencode($query_string)); - + $content = ''; $url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'); - $url .= "?type=tuples&flush=TRUE&format=Sparql&limit=$limit&offset=$offset&lang=itql&stream=on&query=". $query_string; + $url .= "?type=tuples&flush=TRUE&format=Sparql&limit=$limit&offset=$offset&lang=itql&stream=on&query=" . $query_string; $content .= do_curl($url); return $content; } +/** + * Get Related Items as Arrays + * @param type $collection_pid + * @param type $relationship + * @param type $limit + * @param type $offset + * @param type $active_objects_only + * @param type $cmodel + * @param type $orderby + * @return type + */ function get_related_items_as_array($collection_pid, $relationship = 'isMemberOfCollection', $limit = 10000, $offset = 0, $active_objects_only = TRUE, $cmodel = NULL, $orderby = '$title') { $content = get_related_items_as_xml($collection_pid, $relationship, $limit, $offset, $active_objects_only, $cmodel, $orderby); if (empty($content)) { diff --git a/api/fedora_export.inc b/api/fedora_export.inc index d2b08baf..f3c82160 100644 --- a/api/fedora_export.inc +++ b/api/fedora_export.inc @@ -1,7 +1,11 @@ get_datastreams_list_as_SimpleXML($pid)) { $log[] = log_line(t("Failed to get datastream %dsid for pid %pid", array('%dsid' => $ds->ID, '%pid' => $pid)), 'error'); return FALSE; - } + } // Datastreams added as a result of the ingest process $ignore_dsids = array('QUERY'); @@ -38,7 +54,7 @@ function export_objects_for_pid($pid, $dir, &$log) { $paths = array(); foreach ($object->datastreamDef as $ds) { if (!in_array($ds->ID, $ignore_dsids)) { - $file = $dir .'/'. $ds->label .'.'. get_file_extension($ds->MIMEType); + $file = $dir . '/' . $ds->label . '.' . get_file_extension($ds->MIMEType); $paths[$ds->ID] = $file; //$content = $ob_helper->getDatastreamDissemination($pid, $ds->ID); @@ -49,7 +65,7 @@ function export_objects_for_pid($pid, $dir, &$log) { } fwrite($fp, $content); fclose($fp); - } + } else { $log[] = log_line(t("Failed to get datastream %dsid for pid %pid", array('%dsid' => $ds->ID, '%pid' => $pid)), 'error'); } @@ -58,6 +74,16 @@ function export_objects_for_pid($pid, $dir, &$log) { return $paths; } +/** + * Export foxml for pid + * @param type $pid + * @param type $dir + * @param type $paths + * @param type $log + * @param type $format + * @param type $remove_islandora + * @return type + */ function export_foxml_for_pid($pid, $dir, $paths, &$log, $format = FOXML_11, $remove_islandora = FALSE) { module_load_include('inc', 'fedora_repository', 'ObjectHelper'); $ob_helper = new ObjectHelper(); @@ -65,7 +91,7 @@ function export_foxml_for_pid($pid, $dir, $paths, &$log, $format = FOXML_11, $re $log[] = log_line(t("Failed to get foxml for %pid", array('%pid' => $pid)), 'error'); return FALSE; } - + $foxml = new DOMDocument(); $foxml->loadXML($object_xml); @@ -74,14 +100,14 @@ function export_foxml_for_pid($pid, $dir, $paths, &$log, $format = FOXML_11, $re // Remove rdf elements added during ingest (if present) if ($remove_islandora) { $xpath->registerNamespace('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'); - $descNode = $xpath->query("//rdf:RDF/rdf:Description")->item(0); - - if ($model = $descNode->getElementsByTagName('hasModel')->item(0)) { - $descNode->removeChild($model); + $desc_node = $xpath->query("//rdf:RDF/rdf:Description")->item(0); + + if ($model = $desc_node->getElementsByTagName('hasModel')->item(0)) { + $desc_node->removeChild($model); } - - if ($member = $descNode->getElementsByTagName('rel:isMemberOfCollection')->item(0)) { - $descNode->removeChild($member); + + if ($member = $desc_node->getElementsByTagName('rel:isMemberOfCollection')->item(0)) { + $desc_node->removeChild($member); } } @@ -90,79 +116,79 @@ function export_foxml_for_pid($pid, $dir, $paths, &$log, $format = FOXML_11, $re switch ($format) { case FOXML_10: case FOXML_11: - + $disallowed_groups = array('E', 'R'); - + // Update datastream uris $xpath->registerNamespace('foxml', 'info:fedora/fedora-system:def/foxml#'); - foreach ($xpath->query("//foxml:datastream[@ID]") as $dsNode) { - + foreach ($xpath->query("//foxml:datastream[@ID]") as $ds_node) { + // Don't update datastreams having external uris - if (in_array($dsNode->getAttribute('CONTROL_GROUP'), $disallowed_groups)) { + if (in_array($ds_node->getAttribute('CONTROL_GROUP'), $disallowed_groups)) { continue; } - $dsId = $dsNode->getAttribute('ID'); - + $ds_id = $ds_node->getAttribute('ID'); + // Remove QUERY datastream - if ($dsId == "QUERY") { - $parentNode = $xpath->query('/foxml:digitalObject')->item(0); - $parentNode->removeChild($dsNode); + if ($ds_id == "QUERY") { + $parent_node = $xpath->query('/foxml:digitalObject')->item(0); + $parent_node->removeChild($ds_node); } - - foreach ($dsNode->getElementsByTagName('*') as $contentNode) { - if ($str = $contentNode->getAttribute('REF')) { - $contentNode->setAttribute('REF', url($paths[$dsId], array('absolute' => TRUE))); + + foreach ($ds_node->getElementsByTagName('*') as $content_node) { + if ($str = $content_node->getAttribute('REF')) { + $content_node->setAttribute('REF', url($paths[$ds_id], array('absolute' => TRUE))); } } } break; - + case METS_10: case METS_11: // Update datastream uris $xpath->registerNamespace('METS', 'http://www.loc.gov/METS/'); - foreach ($xpath->query('//METS:fileGrp[@ID="DATASTREAMS"]/METS:fileGrp') as $dsNode) { - - $dsId = $dsNode->getAttribute('ID'); - + foreach ($xpath->query('//METS:fileGrp[@ID="DATASTREAMS"]/METS:fileGrp') as $ds_node) { + + $ds_id = $ds_node->getAttribute('ID'); + // Remove QUERY datastream - if ($dsId == "QUERY") { - $parentNode = $xpath->query('//METS:fileGrp[@ID="DATASTREAMS"]')->item(0); - $parentNode->removeChild($dsNode); + if ($ds_id == "QUERY") { + $parent_node = $xpath->query('//METS:fileGrp[@ID="DATASTREAMS"]')->item(0); + $parent_node->removeChild($ds_node); } - + $xpath->registerNamespace('xlink', 'http://www.loc.gov/METS/'); - foreach ($xpath->query('METS:file[@OWNERID!="E"][@OWNERID!="R"]/METS:FLocat[@xlink:href]', $dsNode) as $Floc) { - $Floc->setAttribute('xlink:href', url($paths[$dsId], array('absolute' => TRUE))); + foreach ($xpath->query('METS:file[@OWNERID!="E"][@OWNERID!="R"]/METS:FLocat[@xlink:href]', $ds_node) as $floc) { + $floc->setAttribute('xlink:href', url($paths[$ds_id], array('absolute' => TRUE))); } -/* - foreach ($dsNode->getElementsByTagName('METS:file') as $contentNode) { + /* + foreach ($ds_node->getElementsByTagName('METS:file') as $content_node) { // Don't update datastreams having external uris - if (in_array($dsNode->getAttribute('OWNERID'), $disallowed_groups)) { - continue; + if (in_array($ds_node->getAttribute('OWNERID'), $disallowed_groups)) { + continue; } - foreach ($xpath->('METS:FLocat[@xlink:href]', $contentNode) as $Floc) { - $Floc->setAttribute('xlink:href', url($paths[$dsId], array('absolute' => true))); + foreach ($xpath->('METS:FLocat[@xlink:href]', $content_node) as $floc) { + $floc->setAttribute('xlink:href', url($paths[$ds_id], array('absolute' => TRUE))); } - `} -*/ + `} + */ } - + break; - + default: - $log[] = log_line(t("Unknown or invalid format: ". $format), 'error'); + $log[] = log_line(t("Unknown or invalid format: " . $format), 'error'); return FALSE; } } //if $remove_islandora - $file = $dir .'/'. $pid .'.xml'; + $file = $dir . '/' . $pid . '.xml'; if (!$foxml->save($file)) { $log[] = log_line(t("Failed to write datastream %dsid for pid %pid to %file", array('%dsid' => $ds->ID, '%pid' => $pid, '%file' => $file)), 'error'); return FALSE; - } + } else { $log[] = log_line(t("Exported %pid to %file", array('%pid' => $pid, '%file' => $file)), 'info'); } @@ -170,10 +196,22 @@ function export_foxml_for_pid($pid, $dir, $paths, &$log, $format = FOXML_11, $re return TRUE; } -function get_file_extension($mimeType) { - return substr(strstr($mimeType, '/'), 1); +/** + * Get file extension + * @param type $mimeType + * @return type + */ +function get_file_extension($mime_type) { + return substr(strstr($mime_type, '/'), 1); } +/** + * Log line + * @param type $msg + * @param type $severity + * @param type $sep + * @return type + */ function log_line($msg, $severity = 'info', $sep = "\t") { return date("Y-m-d H:i:s") . $sep . ucfirst($severity) . $sep . $msg; } diff --git a/api/fedora_item.inc b/api/fedora_item.inc index aabe5d32..fdb4a00d 100644 --- a/api/fedora_item.inc +++ b/api/fedora_item.inc @@ -1,10 +1,16 @@ soap_call('getObjectProfile', array('pid' => $this->pid, 'asOfDateTime' => "")); + $raw_objprofile = $this->soap_call('getObjectProfile', array('pid' => $this->pid, 'asOfDateTime' => ""), TRUE); if (!empty($raw_objprofile)) { $this->objectProfile = $raw_objprofile->objectProfile; @@ -51,12 +73,44 @@ class Fedora_Item { } } + /** + * Forget this Object, do manually when memory constraints apply. + * + * Removes this object from the static list of $instantiated_pids + */ + function forget() { + unset(Fedora_Item::$instantiated_pids[$this->pid]); + } + + /** + * Exists + * @return type + */ function exists() { return (!empty($this->objectProfile)); } - function add_datastream_from_file($datastream_file, $datastream_id, $datastream_label = NULL, $datastream_mimetype = '', $controlGroup = 'M', $logMessage = null) { + /** + * Add datastream from file + * @param type $datastream_file + * @param type $datastream_id + * @param type $datastream_label + * @param type $datastream_mimetype + * @param type $controlGroup + * @param type $logMessage + * @return type + */ + function add_datastream_from_file($datastream_file, $datastream_id, $datastream_label = NULL, $datastream_mimetype = '', $controlGroup = 'M', $logMessage = NULL) { module_load_include('inc', 'fedora_repository', 'MimeClass'); + if (!is_file($datastream_file)) { + drupal_set_message(t('The datastream file %datastream_file could not found! (or is not a regular file...)', array('%datastream_file' => $datastream_file)), 'warning'); + return; + } + elseif (!is_readable($datastream_file)) { + drupal_set_message(t('The datastream file %datastream_file could not be read! (likely due to permissions...)', array('%datastream_file' => $datastream_file)), 'warning'); + return; + } + if (empty($datastream_mimetype)) { // Get mime type from the file extension. $mimetype_helper = new MimeClass(); @@ -76,11 +130,29 @@ class Fedora_Item { return $return_value; } - function add_datastream_from_url($datastream_url, $datastream_id, $datastream_label = NULL, $datastream_mimetype = '', $controlGroup = 'M', $logMessage = null) { + /** + * Add datastream from url + * @param type $datastream_url + * @param type $datastream_id + * @param type $datastream_label + * @param type $datastream_mimetype + * @param type $controlGroup + * @param type $logMessage + * @return type + */ + function add_datastream_from_url($datastream_url, $datastream_id, $datastream_label = NULL, $datastream_mimetype = '', $controlGroup = 'M', $logMessage = NULL) { + global $base_url; + if (empty($datastream_label)) { $datastream_label = $datastream_id; } + // Fedora has some problems getting files from HTTPS connections sometimes, so if we are getting a file + // from the local drupal, we try to pass a HTTP url instead of a HTTPS one. + if(stripos($datastream_url, 'https://') !== FALSE && stripos($datastream_url, $base_url) !== FALSE) { + $datastream_url = str_ireplace('https://', 'http://', $datastream_url); + } + $params = array( 'pid' => $this->pid, 'dsID' => $datastream_id, @@ -94,16 +166,25 @@ class Fedora_Item { 'dsState' => 'A', 'checksumType' => 'DISABLED', 'checksum' => 'none', - 'logMessage' => ($logMessage != null) ? $logMessage : 'Ingested object ' . $datastream_id + 'logMessage' => ($logMessage != NULL) ? $logMessage : 'Ingested object ' . $datastream_id ); - return $this->soap_call( 'addDataStream', $params ); - + return $this->soap_call('addDataStream', $params); } - function add_datastream_from_string($str, $datastream_id, $datastream_label = NULL, $datastream_mimetype = 'text/xml', $controlGroup = 'M', $logMessage = null) { - $dir = sys_get_temp_dir(); + /** + * Add datastream from string + * @param type $str + * @param type $datastream_id + * @param type $datastream_label + * @param type $datastream_mimetype + * @param type $controlGroup + * @param type $logMessage + * @return type + */ + function add_datastream_from_string($str, $datastream_id, $datastream_label = NULL, $datastream_mimetype = 'text/xml', $controlGroup = 'M', $logMessage = NULL) { + $dir = file_directory_temp(); $tmpfilename = tempnam($dir, 'fedoratmp'); $tmpfile = fopen($tmpfilename, 'w'); fwrite($tmpfile, $str, strlen($str)); @@ -113,44 +194,89 @@ class Fedora_Item { return $returnvalue; } + /** + * Wrapper to add new or modify existing datastream + * @global url $base_url + * @param url $external_url + * @param string $dsid + * @param string $label + * @param string $mime_type + * @param string $controlGroup + * @param boolean $force + * @param string $logMessage + * @param boolean $quiet + */ + function add_or_modify_by_reference($external_url, $dsid, $label, $mime_type, $controlGroup = 'M', $force = FALSE, $logMessage = 'Modified by Islandora API', $quiet=FALSE) { + global $base_url; + if (array_key_exists($dsid, $this->datastreams)) { + $this->modify_datastream_by_reference($external_url, $dsid, $label, $mime_type, $force, $logMessage, $quiet); + } + else { + $file_location = str_replace("$base_url/", '', $external_url); + $this->add_datastream_from_file($file_location, $dsid, $label, $mime_type, $controlGroup = 'M', $logMessage = NULL); + } + } + /** * Add a relationship string to this object's RELS-EXT. + * * does not support rels-int yet. + * * @param string $relationship - * @param $object + * The predicate/relationship tag to add + * @param string $object + * The object to be related to. + * @param string $namespaceURI + * The predicate namespace. + * @param boolean $literal_value + * Whether or not the object should be added as a URI (FALSE) or a literal (TRUE). */ - function add_relationship($relationship, $object, $namespaceURI = RELS_EXT_URI) { + function add_relationship($relationship, $object, $namespaceURI = RELS_EXT_URI, $literal_value = FALSE) { + //dd($this, 'The Fedora_Item'); $ds_list = $this->get_datastreams_list_as_array(); - - if (empty($ds_list['RELS-EXT'])) { - $this->add_datastream_from_string(' - + $f_prefix = 'info:fedora/'; + if (!array_key_exists('RELS-EXT', $ds_list)) { + $rdf_string = << + - ', 'RELS-EXT', 'Fedora object-to-object relationship metadata', 'text/xml', 'X'); + +RDF; + $this->add_datastream_from_string($rdf_string, 'RELS-EXT', 'Fedora object-to-object relationship metadata', 'application/rdf+xml', 'X'); } $relsext = $this->get_datastream_dissemination('RELS-EXT'); - - if (substr($object, 0, 12) != 'info:fedora/') { - $object = "info:fedora/$object"; + + if (!$literal_value && strpos($object, $f_prefix) !== 0) { + $object = $f_prefix . $object; } - $relsextxml = new DomDocument(); + $relsextxml = new DOMDocument(); $relsextxml->loadXML($relsext); $description = $relsextxml->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'Description'); if ($description->length == 0) { + //XXX: This really shouldn't be done; lower case d doesn't fit the schema. Warn users to fix the data and generators, pending deprecation. $description = $relsextxml->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'description'); + if ($description->length > 0) { + drupal_set_message(t('RDF with lower case "d" in "description" encountered. Should be uppercase! PID: %pid', array('%pid' => $this->pid)), 'warning'); + } } $description = $description->item(0); // Create the new relationship node. $newrel = $relsextxml->createElementNS($namespaceURI, $relationship); - $newrel->setAttribute('rdf:resource', $object); + if ($literal_value) { + $newrel->appendChild($relsextxml->createTextNode($object)); + } + else { + $newrel->setAttribute('rdf:resource', $object); + } $description->appendChild($newrel); - $this->modify_datastream_by_value($relsextxml->saveXML(), 'RELS-EXT', "Fedora Object-to-Object Relationship Metadata", 'text/xml'); + + return $this->modify_datastream($relsextxml->saveXML(), 'RELS-EXT', "Fedora Object-to-Object Relationship Metadata", 'application/rdf+xml'); //print ($description->dump_node()); /* $params = array( 'pid' => $this->pid, @@ -164,8 +290,55 @@ class Fedora_Item { */ } + /** + * Purge/delete relationships string from this object's RELS-EXT. + * + * does not support rels-int yet. + * + * @param string $relationship + * The predicate/relationship tag to delete + * @param string $object + * The object to be related to. (NULL/value for which empty() evaluates to true will remove all relations of the given type, ignoring $literal_value) + * @param string $namespaceURI + * The predicate namespace. + * @param boolean $literal_value + * Whether or not the object should be looked for as a URI (FALSE) or a literal (TRUE). + * @return boolean + * Whether or not this operation has produced any changes in the RELS-EXT + */ + function purge_relationships($relationship, $object, $namespaceURI = RELS_EXT_URI, $literal_value = FALSE) { + $relsext = $this->get_datastream_dissemination('RELS-EXT'); + + $relsextxml = new DomDocument(); + $relsextxml->loadXML($relsext); + $modified = FALSE; + $rels = $relsextxml->getElementsByTagNameNS($namespaceURI, $relationship); + if (!empty($rels)) { + foreach ($rels as $rel) { + if ( //If either no object is specified, or the object matches (in either the literal or URI case), remove this node from it's parent, and mark as changed. + empty($object) || + (!$literal_value && $rel->getAttributeNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'resource') == $object) || + ($literal_value && $rel->textContent == $object)) { + $rel->parentNode->removeChild($rel); + $modified = TRUE; + } + } + } + + //Save changes. + if ($modified) { + $this->modify_datastream($relsextxml->saveXML(), 'RELS-EXT', "Fedora Object-to-Object Relationship Metadata", 'text/xml'); + } + + //Return whether or not we've introduced any changes. + return $modified; + } + /** * Removes the given relationship from the item's RELS-EXT and re-saves it. + * + * @deprecated + * Dropped in favour of purge_relationships, which follows the same paradigm as add_relationship. This function tries to figure out the predicate URI based on the prefix/predicate given, which requires specific naming... * @param string $relationship * @param string $object */ @@ -189,9 +362,18 @@ class Fedora_Item { $relationship = "isPartOf"; $namespaceURI = 'info:fedora/fedora-system:def/relations-external#'; break; + case "rel:hasModel": + case "hasModel": + $relationship = "hasModel"; + $namespaceURI = FEDORA_MODEL_URI; + break; + case "isPageNumber": + $relationship = "isPageNumber"; + $namespaceURI = ISLANDORA_PAGE_URI; + break; } - if (substr($object, 0, 12) != 'info:fedora/') { + if (!empty($object) && substr($object, 0, 12) != 'info:fedora/') { $object = "info:fedora/$object"; } @@ -201,19 +383,22 @@ class Fedora_Item { $rels = $relsextxml->getElementsByTagNameNS($namespaceURI, $relationship); if (!empty($rels)) { foreach ($rels as $rel) { - if ($rel->getAttributeNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'resource') == $object) { + if (empty($object) || $rel->getAttributeNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'resource') == $object) { $rel->parentNode->removeChild($rel); $modified = TRUE; } } } if ($modified) { - $this->modify_datastream_by_value($relsextxml->saveXML(), 'RELS-EXT', "Fedora Object-to-Object Relationship Metadata", 'text/xml'); + $this->modify_datastream($relsextxml->saveXML(), 'RELS-EXT', "Fedora Object-to-Object Relationship Metadata", 'text/xml'); } return $modified; - //print ($description->dump_node()); } + /** + * Export as foxml + * @return type + */ function export_as_foxml() { $params = array( 'pid' => $this->pid, @@ -245,10 +430,10 @@ class Fedora_Item { $i++; $url = variable_get('fedora_base_url', 'http://localhost:8080/fedora'); if ($cursor == 0) { - $url .= "/objects?query=$field~$pattern&pid=true&title=true&resultFormat=xml&maxResults=$max_results"; + $url .= "/objects?query=$field~$pattern&pid=true&title=TRUE&resultFormat=xml&maxResults=$max_results"; } else { - $url .= "/objects?pid=true&title=truesessionToken=$session_token&resultFormat=xml&maxResults=$max_results"; + $url .= "/objects?pid=true&title=true&sessionToken=$session_token&resultFormat=xml&maxResults=$max_results"; } if (count($resultFields) > 0) { @@ -256,7 +441,6 @@ class Fedora_Item { } $resultxml = do_curl($url); - libxml_use_internal_errors(TRUE); $resultelements = simplexml_load_string($resultxml); if ($resultelements === FALSE) { @@ -290,13 +474,22 @@ class Fedora_Item { return $results; } - function get_datastream_dissemination($dsid, $as_of_date_time = "") { + /** + * Get datastream dissemination + * @param type $dsid + * @param type $as_of_date_time + * @param type $quiet + * @return null + */ + function get_datastream_dissemination($dsid, $as_of_date_time = "", $quiet=TRUE) { $params = array( 'pid' => $this->pid, 'dsID' => $dsid, 'asOfDateTime' => $as_of_date_time, ); - $object = self::soap_call('getDataStreamDissemination', $params); + + // Make soap call with quite + $object = self::soap_call('getDataStreamDissemination', $params, $quiet); if (!empty($object)) { $content = $object->dissemination->stream; $content = trim($content); @@ -307,7 +500,13 @@ class Fedora_Item { return $content; } - function get_datastream($dsid, $as_of_date_time = "") { + /** + * Get datastream + * @param type $dsid + * @param type $as_of_date_time + * @return type + */ + function get_datastream($dsid, $as_of_date_time = '') { $params = array( 'pid' => $this->pid, 'dsID' => $dsid, @@ -318,6 +517,11 @@ class Fedora_Item { return $object->datastream; } + /** + * Get datastream history + * @param type $dsid + * @return type + */ function get_datastream_history($dsid) { $params = array( 'pid' => $this->pid, @@ -332,7 +536,15 @@ class Fedora_Item { return $ret; } - function get_dissemination($service_definition_pid, $method_name, $parameters = array(), $as_of_date_time = null) { + /** + * Get dissemination + * @param type $service_definition_pid + * @param type $method_name + * @param type $parameters + * @param type $as_of_date_time + * @return string + */ + function get_dissemination($service_definition_pid, $method_name, $parameters = array(), $as_of_date_time = NULL) { $params = array( 'pid' => $this->pid, 'serviceDefinitionPid' => $service_definition_pid, @@ -390,7 +602,7 @@ class Fedora_Item { * @return datastream object * get the mimetype size etc. in one shot. instead of iterating throught the datastream list for what we need */ - function get_datastream_info($dsid, $as_of_date_time = "") { + function get_datastream_info($dsid, $as_of_date_time = '') { $params = array( 'pid' => $this->pid, 'dsID' => $dsid, @@ -423,7 +635,7 @@ class Fedora_Item { // datastream, instead of returning it as an array, only // the single item will be returned directly. We have to // check for this. - if (count($this->datastreams_list->datastreamDef) >= 2) { + if (count($this->datastreams_list->datastreamDef) > 1) { foreach ($this->datastreams_list->datastreamDef as $ds) { if (!is_object($ds)) { print_r($ds); @@ -476,7 +688,7 @@ class Fedora_Item { try { $relsext = $this->get_datastream_dissemination('RELS-EXT'); } catch (exception $e) { - drupal_set_message("Error retrieving RELS-EXT of object $pid", 'error'); + drupal_set_message(t("Error retrieving RELS-EXT of object $pid"), 'error'); return $relationships; } @@ -485,7 +697,6 @@ class Fedora_Item { $relsextxml->loadXML($relsext); $relsextxml->normalizeDocument(); $rels = $relsextxml->getElementsByTagNameNS('info:fedora/fedora-system:def/relations-external#', '*'); - foreach ($rels as $child) { if (empty($relationship) || preg_match("/$relationship/", $child->tagName)) { $relationships[] = array( @@ -495,12 +706,42 @@ class Fedora_Item { ); } } + return $relationships; - //$children = $relsextxml->RDF->description; - //$children = $relsextxml->RDF->description; - //$params = array( 'pid' => $this->pid, - // 'relationship' => 'NULL' ); - //return $this->soap_call( 'getRelationships', $params ); + } + + function get_rdf_relationships() { + + $relationships = array(); + try { + $relsext = $this->get_datastream_dissemination('RELS-EXT'); + } catch (exception $e) { + drupal_set_message(t('Error retrieving RELS-EXT of object %pid.', array('%pid' => $pid)), 'error'); + return $relationships; + } + + // Parse the RELS-EXT into an associative array. + $relsextxml = new DOMDocument(); + $relsextxml->loadXML($relsext); + $relsextxml->normalizeDocument(); + $allTags = array(); + $allTags[] = $relsextxml->getElementsByTagNameNS(RELS_EXT_URI, '*'); + $allTags[] = $relsextxml->getElementsByTagNameNS(FEDORA_MODEL_URI, '*'); + $allTags[] = $relsextxml->getElementsByTagNameNS(ISLANDORA_PAGE_URI, '*'); + foreach ($allTags as $tags) { + foreach ($tags as $child) { + $value = preg_replace('/info:fedora\//','',$child->getAttributeNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'resource')); + + $relationships[$child->tagName][] = $value; + } + } + + return $relationships; + } + + function get_models() { + //This is/was formerly just a copy/paste jobbie, without the parameter being passable... + return $this->get_relationships(); } /** @@ -517,7 +758,7 @@ class Fedora_Item { foreach ($relationships as $rel) { if (empty($rel['subject']) || empty($rel['predicate']) || empty($rel['object']) || $rel['subject'] != 'info:fedora/' . $this->pid) { // drupal_set_message should use parameterized variables, not interpolated. - drupal_set_message("Error with relationship format: " . $rel['subject'] . " - " . $rel['predicate'] . ' - ' . $rel['object'], "error"); + drupal_set_message(t("Error with relationship format: " . $rel['subject'] . " - " . $rel['predicate'] . ' - ' . $rel['object']), "error"); return FALSE; } } @@ -528,19 +769,59 @@ class Fedora_Item { return FALSE; } + /** + * Set the object to a deleted state + */ + function move_to_trash($log_message = 'Flagged deleted using Islandora API.') { + // Loop through the datastreams and mark them deleted + foreach ($this->get_datastreams_list_as_array() as $dsid) { + $this->set_datastream_state($dsid, 'D'); + } + + // Create a message to mark the object deleted + $params = array( + 'pid' => $this->pid, + 'state' => 'D', + 'logMessage' => $logMessage, + 'label' => $this->objectProfile->objLabel, + 'ownerId' => null, + ); + + // Send message to mark the object deleted + return self::soap_call('modifyObject', $params, $quiet); + } + /** * Removes this object form the repository. + * @param type $log_message + * @param type $force + * @return type */ function purge($log_message = 'Purged using Islandora API.', $force = FALSE) { + + // Flag the object to be deleted first + $this->move_to_trash($log_message); + + // Create the delete message $params = array( 'pid' => $this->pid, 'logMessage' => $log_message, 'force' => $force ); + // Delete the object return $this->soap_call('purgeObject', $params); } + /** + * Purge datastream + * @param type $dsID + * @param type $start_date + * @param type $end_date + * @param type $log_message + * @param type $force + * @return type + */ function purge_datastream($dsID, $start_date = NULL, $end_date = NULL, $log_message = 'Purged datastream using Islandora API', $force = FALSE) { $params = array( 'pid' => $this->pid, @@ -553,16 +834,27 @@ class Fedora_Item { return $this->soap_call('purgeDatastream', $params); } + /** + * URL + * @global type $base_url + * @return type + */ function url() { - global $base_url; - return $base_url . '/fedora/repository/' . $this->pid . (!empty($this->objectProfile) ? '/-/' . drupal_urlencode($this->objectProfile->objLabel) : ''); + return url('fedora/repository/' . $this->pid . (!empty($this->objectProfile) ? '/-/' . drupal_urlencode($this->objectProfile->objLabel) : ''), array( + 'absolute' => TRUE + )); } + /** + * Get Next PID in Namespace + * @param type $pid_namespace + * @return type + */ static function get_next_PID_in_namespace($pid_namespace = '') { if (empty($pid_namespace)) { // Just get the first one in the config settings. - $allowed_namespaces = explode(" ", variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: ')); + $allowed_namespaces = explode(" ", variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: ')); $pid_namespace = $allowed_namespaces[0]; if (!empty($pid_namespace)) { $pid_namespace = substr($pid_namespace, 0, strpos($pid_namespace, ":")); @@ -581,18 +873,37 @@ class Fedora_Item { return $result->pid; } - static function ingest_from_FOXML($foxml) { - $params = array('objectXML' => $foxml->saveXML(), 'format' => "info:fedora/fedora-system:FOXML-1.1", 'logMessage' => "Fedora Object Ingested"); + /** + * ingest from FOXML + * @param type $foxml + * @return Fedora_Item + */ + static function ingest_from_FOXML(DOMDocument $foxml) { + $params = array( + 'objectXML' => $foxml->saveXML(), + 'format' => 'info:fedora/fedora-system:FOXML-1.1', + 'logMessage' => 'Fedora Object Ingested' + ); $object = self::soap_call('ingest', $params); + //dd($object, 'Soap return'); return new Fedora_Item($object->objectPID); } + /** + * ingest from FOXML file + * @param type $foxml_file + * @return type + */ static function ingest_from_FOXML_file($foxml_file) { $foxml = new DOMDocument(); $foxml->load($foxml_file); return self::ingest_from_FOXML($foxml); } + /** + * ingest from FOXML files in directory + * @param type $path + */ static function ingest_from_FOXML_files_in_directory($path) { // Open the directory $dir_handle = @opendir($path); @@ -605,14 +916,23 @@ class Fedora_Item { try { self::ingest_from_FOXML_file($path . '/' . $file); } catch (exception $e) { - + } } // Close closedir($dir_handle); } - function modify_object($label = '', $state = null, $ownerId = null, $logMessage = 'Modified by Islandora API', $quiet=TRUE) { + /** + * Modify Object + * @param type $label + * @param type $state + * @param type $ownerId + * @param type $logMessage + * @param type $quiet + * @return type + */ + function modify_object($label = '', $state = NULL, $ownerId = NULL, $logMessage = 'Modified by Islandora API', $quiet=TRUE) { $params = array( 'pid' => $this->pid, @@ -625,6 +945,84 @@ class Fedora_Item { return self::soap_call('modifyObject', $params, $quiet); } + /** + * Wrap modify by value and reference + * + * Wrap modify by value and reference, so that the proper one gets called in the correct instance. (value if inline XML, reference otherwise) + * + * First tries to treat the passed in value as a filename, tries using as contents second. + * Coerces the data into what is required, and passes it on to the relevant function. + * + * @param string $filename_or_content + * Either a filename to add, or an string of content. + * @param string $dsid + * The DSID to update + * @param string $label + * A label to withwhich to update the datastream + * @param string $mime_type + * Mimetype for the data being pushed into the datastream + * @param boolean $force + * Dunno, refer to underlying functions/SOAP interface. We just pass it like a chump. + * @param string $logMessage + * A message for the audit log. + * @param boolean $quiet + * Error suppression? Refer to soap_call for usage (just passed along here). + */ + function modify_datastream($filename_or_content, $dsid, $label, $mime_type, $force = FALSE, $logMessage='Modified by Islandora API', $quiet=FALSE) { + $toReturn = NULL; + + //Determine if it's inline xml; if it is, modify by value + if ($this->get_datastream($dsid)->controlGroup === 'X') { + $content = ''; + if (is_file($filename_or_content) && is_readable($filename_or_content)) { + $content = file_get_contents($filename_or_content); + } + else { + $content = $filename_or_content; + } + + $toReturn = $this->modify_datastream_by_value($content, $dsid, $label, $mime_type, $force, $logMessage); + } + //Otherwise, write to web-accessible temp file and modify by reference. + else { + $file = ''; + $created_temp = FALSE; + if (is_file($filename_or_content) && is_readable($filename_or_content)) { + $file = $filename_or_content; + $original_path = $file; + // Temporarily move file to a web-accessible location. + file_copy($file, file_directory_path()); + $created_temp = ($original_path != $file); + } + else { + //Push contents to a web-accessible file + $file = file_save_data($filename_or_content, file_directory_path()); + $created_temp = TRUE; + } + + $file_url = file_create_url($file); + + $toReturn = $this->modify_datastream_by_reference($file_url, $dsid, $label, $mime_type, $force, $logMessage); + + if ($created_temp && is_file($file) && is_writable($file)) { + file_delete($file); + } + } + + return $toReturn; + } + + /** + * Modify datastream by reference + * @param type $external_url + * @param type $dsid + * @param type $label + * @param type $mime_type + * @param type $force + * @param type $logMessage + * @param type $quiet + * @return type + */ function modify_datastream_by_reference($external_url, $dsid, $label, $mime_type, $force = FALSE, $logMessage = 'Modified by Islandora API', $quiet=FALSE) { $params = array( 'pid' => $this->pid, @@ -642,6 +1040,17 @@ class Fedora_Item { return self::soap_call('modifyDatastreamByReference', $params, $quiet); } + /** + * Modify datastream by value + * @param type $content + * @param type $dsid + * @param type $label + * @param type $mime_type + * @param type $force + * @param type $logMessage + * @param type $quiet + * @return type + */ function modify_datastream_by_value($content, $dsid, $label, $mime_type, $force = FALSE, $logMessage = 'Modified by Islandora API', $quiet=FALSE) { $params = array( 'pid' => $this->pid, @@ -659,67 +1068,62 @@ class Fedora_Item { return self::soap_call('modifyDatastreamByValue', $params, $quiet); } - static function soap_call($function_name, $params_array, $quiet = FALSE) { + function set_datastream_state($dsid, $state, $log_message = 'Modified by Islandora API', $quiet = FALSE) { + $valid_states = array('A', 'D', 'I'); + if (array_search($state, $valid_states) !== FALSE) { + $params = array( + 'pid' => $this->pid, + 'dsID' => $dsid, + 'dsState' => $state, + 'logMessage' => $log_message, + ); + return self::soap_call('setDatastreamState', $params, $quiet); + } + } + + /** + * Make a soap call to the fedora API. + * + * @param string $function + * The name of the soap function to call. + * @param array $parameters + * Paramters to pass onto the soap call + * @param boolean $quiet + * If TRUE suppress drupal messages. + * + * @return mixed + * The return value from the soap function if successful, NULL otherwise. + */ + static function soap_call($function, $parameters, $quiet = FALSE) { if (!self::$connection_helper) { module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); self::$connection_helper = new ConnectionHelper(); } - switch ($function_name) { - case 'ingest': - case 'addDataStream': - case 'addRelationship': - case 'export': - case 'getDatastream': - case 'getDatastreamHistory': - case 'getNextPID': - case 'getRelationships': - case 'modifyDatastreamByValue': - case 'modifyDatastreamByReference': - case 'purgeDatastream': - case 'purgeObject': - case 'modifyObject': - $soap_client = self::$connection_helper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); - try { - if (!empty($soap_client)) { - $result = $soap_client->__soapCall($function_name, array('parameters' => $params_array)); - } - else { - watchdog(t("FEDORA_REPOSITORY"), t("Error trying to get SOAP client connection.")); - return NULL; - } - } catch (exception $e) { - if (!$quiet) { - - if (preg_match('/org\.fcrepo\.server\.security\.xacml\.pep\.AuthzDeniedException/', $e->getMessage())) { - drupal_set_message(t('Error: Insufficient permissions to call SOAP function !fn.', array('!fn' => $function_name)), 'error'); - } - else { - drupal_set_message(t("Error trying to call SOAP function $function_name. Check watchdog logs for more information."), 'error'); - } - - watchdog(t("FEDORA_REPOSITORY"), t("Error Trying to call SOAP function !fn: !e", array('!fn' => $function_name, '!e' => $e)), NULL, WATCHDOG_ERROR); - } - return NULL; - } - break; - - default: - try { - $soap_client = self::$connection_helper->getSoapClient(variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl')); - if (!empty($soap_client)) { - $result = $soap_client->__soapCall($function_name, array('parameters' => $params_array)); - } - else { - watchdog(t("FEDORA_REPOSITORY"), t("Error trying to get SOAP client connection.")); - return NULL; - } - } catch (exception $e) { - - if (!$quiet) { - watchdog(t("FEDORA_REPOSITORY"), t("Error trying to call SOAP function !fn: !e", array('!fn' => $function_name, '!e' => $e)), NULL, WATCHDOG_ERROR); - } - return NULL; + $url = ( + in_array($function, self::$SoapManagedFunctions)? + variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/wsdl?api=API-M') : + variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl') + ); + try { + $soap_client = self::$connection_helper->getSoapClient($url); + if (isset($soap_client)) { + $result = $soap_client->__soapCall($function, array('parameters' => $parameters)); + } + else { + if (!$quiet) { + drupal_set_message(t('Error trying to get SOAP client connection')); } + watchdog('fedora_repository', 'Error trying to get SOAP client connection.'); + return NULL; + } + } catch (Exception $e) { + if (!$quiet) { + preg_match('/org\.fcrepo\.server\.security\.xacml\.pep\.AuthzDeniedException/', $e->getMessage()) ? + drupal_set_message(t('Insufficient permissions to call SOAP function "%func".', array('%func' => $function)), 'error') : + drupal_set_message(t('Error trying to call SOAP function "%func". Check watchdog logs for more information.', array('%func' => $function)), 'error'); + } + watchdog('fedora_repository', 'Error Trying to call SOAP function "%func". Exception: @e in @f(@l)\n@t', array('%func' => $function, '@e' => $e->getMessage(), '@f' => $e->getFile(), '@l' => $e->getLine(), '@t' => $e->getTraceAsString()), NULL, WATCHDOG_ERROR); + return NULL; } return $result; } @@ -730,6 +1134,9 @@ class Fedora_Item { * * @param string $pid if none given, getnextpid will be called. * @param string $state The initial state, A - Active, I - Inactive, D - Deleted + * @param type $label + * @param type $owner + * @return DOMDocument */ static function create_object_FOXML($pid = '', $state = 'A', $label = 'Untitled', $owner = '') { $foxml = new DOMDocument("1.0", "UTF-8"); @@ -747,25 +1154,23 @@ class Fedora_Item { } } - $root_element = $foxml->createElement("foxml:digitalObject"); + $root_element = $foxml->createElementNS("info:fedora/fedora-system:def/foxml#", "foxml:digitalObject"); $root_element->setAttribute("VERSION", "1.1"); $root_element->setAttribute("PID", $pid); - $root_element->setAttribute("xmlns:foxml", "info:fedora/fedora-system:def/foxml#"); - $root_element->setAttribute("xmlns:xsl", "http://www.w3.org/2001/XMLSchema-instance"); - $root_element->setAttribute("xsl:schemaLocation", "info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd"); + $root_element->setAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "xsi:schemaLocation", "info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd"); $foxml->appendChild($root_element); // FOXML object properties section - $object_properties = $foxml->createElement("foxml:objectProperties"); - $state_property = $foxml->createElement("foxml:property"); + $object_properties = $foxml->createElementNS("info:fedora/fedora-system:def/foxml#", "foxml:objectProperties"); + $state_property = $foxml->createElementNS("info:fedora/fedora-system:def/foxml#", "foxml:property"); $state_property->setAttribute("NAME", "info:fedora/fedora-system:def/model#state"); $state_property->setAttribute("VALUE", $state); - $label_property = $foxml->createElement("foxml:property"); + $label_property = $foxml->createElementNS("info:fedora/fedora-system:def/foxml#", "foxml:property"); $label_property->setAttribute("NAME", "info:fedora/fedora-system:def/model#label"); $label_property->setAttribute("VALUE", $label); - $owner_property = $foxml->createElement("foxml:property"); + $owner_property = $foxml->createElementNS("info:fedora/fedora-system:def/foxml#", "foxml:property"); $owner_property->setAttribute("NAME", "info:fedora/fedora-system:def/model#ownerId"); $owner_property->setAttribute("VALUE", $owner); @@ -774,14 +1179,26 @@ class Fedora_Item { $object_properties->appendChild($owner_property); $root_element->appendChild($object_properties); $foxml->appendChild($root_element); - return $foxml; } + /** + * ingest new item + * @param type $pid + * @param type $state + * @param type $label + * @param type $owner + * @return type + */ static function ingest_new_item($pid = '', $state = 'A', $label = '', $owner = '') { return self::ingest_from_FOXML(self::create_object_FOXML($pid, $state, $label, $owner)); } + /** + * fedora item exists + * @param type $pid + * @return type + */ static function fedora_item_exists($pid) { $item = new Fedora_Item($pid); return $item->exists(); diff --git a/api/fedora_utils.inc b/api/fedora_utils.inc index d80ee701..459c86ba 100644 --- a/api/fedora_utils.inc +++ b/api/fedora_utils.inc @@ -1,35 +1,104 @@ uid == 0) { + // If the user is not valid for a Fedora call curl will throw an exception. + if ((!isset($user)) || $user->uid == 0) { $fedora_user = 'anonymous'; $fedora_pass = 'anonymous'; } @@ -44,18 +113,23 @@ function do_curl($url, $return_to_variable = 1, $number_of_post_vars = 0, $post curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_FAILONERROR, TRUE); // Fail on errors - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); // allow redirects curl_setopt($ch, CURLOPT_TIMEOUT, 90); // times out after 90s curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); curl_setopt($ch, CURLOPT_RETURNTRANSFER, $return_to_variable); // return into a variable curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERPWD, "$fedora_user:$fedora_pass"); //curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); - if ($number_of_post_vars>0&&$post) { + if ($number_of_post_vars > 0 && $post) { curl_setopt($ch, CURLOPT_POST, $number_of_post_vars); curl_setopt($ch, CURLOPT_POSTFIELDS, "$post"); } - return curl_exec($ch); + + $ret_val = curl_exec($ch); + + $error_code = curl_errno($ch); + $error_string = curl_error($ch); + return array($ret_val, $error_code, $error_string); } else { if (function_exists(drupal_set_message)) { @@ -65,13 +139,25 @@ function do_curl($url, $return_to_variable = 1, $number_of_post_vars = 0, $post } } +/** + * Fedora available + * @return type + */ function fedora_available() { - $response = do_curl(variable_get('fedora_base_url', 'http://localhost:8080/fedora').'/describe'); - return strstr($response, 'Repository Information HTML Presentation') !== FALSE; - + $response = do_curl_ext(variable_get('fedora_base_url', 'http://localhost:8080/fedora') . '/describe'); + return ($response != NULL) ? ($response[1] == 0) : FALSE; } +/** + * Resource index search available + * @return type + */ +function risearch_available() { + + $response = do_curl_ext(variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch')); + return ($response != NULL) ? ($response[1] == 0) : FALSE; +} /** * Returns a UTF-8-encoded transcripiton of the string given in $in_str. @@ -79,16 +165,21 @@ function fedora_available() { * @return string A UTF-8 encoded string. */ function fix_encoding($in_str) { - $cur_encoding = mb_detect_encoding($in_str) ; + $cur_encoding = mb_detect_encoding($in_str); if ($cur_encoding == "UTF-8" && mb_check_encoding($in_str, "UTF-8")) { return $in_str; } else { return utf8_encode($in_str); } -} +} -function validPid($pid) { +/** + * valid pid ?? + * @param type $pid + * @return boolean + */ +function valid_pid($pid) { $valid = FALSE; if (strlen(trim($pid)) <= 64 && preg_match('/^([A-Za-z0-9]|-|\.)+:(([A-Za-z0-9])|-|\.|~|_|(%[0-9A-F]{2}))+$/', trim($pid))) { $valid = TRUE; @@ -97,7 +188,12 @@ function validPid($pid) { return $valid; } -function validDsid($dsid) { +/** + * Valid Dsid ?? + * @param type $dsid + * @return boolean + */ +function valid_dsid($dsid) { $valid = FALSE; if (strlen(trim($dsid)) <= 64 && preg_match('/^[a-zA-Z0-9\_\-\.]+$/', trim($dsid))) { $valid = TRUE; @@ -106,23 +202,116 @@ function validDsid($dsid) { return $valid; } -function fixDsid($dsid) { +/** + * fixDsid ?? + * @param type $dsid + * @return string + */ +function fix_dsid($dsid) { $new_dsid = trim($dsid); $find = '/[^a-zA-Z0-9\.\_\-]/'; $replace = ''; $new_dsid = preg_replace($find, $replace, $new_dsid); - if( strlen($new_dsid) > 63 ) + if (strlen($new_dsid) > 63) $new_dsid = substr($new_dsid, -63); - if( preg_match('/^[^a-zA-Z]/', $dsid ) ) + if (preg_match('/^[^a-zA-Z]/', $dsid)) $new_dsid = 'x' . $new_dsid; - if( strlen($new_dsid) == 0 ) + if (strlen($new_dsid) == 0) $new_dsid = 'item' . rand(1, 100); return $new_dsid; +} + +/** + * Function: get_collections_as_option_array + * + * Description: Returns an associative array of all collection objects in Fedora instance + * + * @return array + */ +function get_collections_as_option_array() { + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + $restricted = variable_get('fedora_namespace_restriction_enforced', TRUE); + $allowed_string = variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora:'); + $namespaces = explode(':', $allowed_string); + $query = 'select $object $title from <#ri> + where ($object $title + and $object + and $object ) + order by $title'; + $url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'); + $url .= "?type=tuples&flush=TRUE&format=csv&limit=1000&lang=itql&stream=on&query="; + $content = do_curl($url . htmlentities(urlencode($query))); + $list = explode("\n", $content); + array_shift($list); + $list = preg_replace('/info:fedora\//', '', $list); + foreach ($namespaces as $namespace) { + $trimmed_names[] = trim($namespace); + } + $options = array(); + foreach ($list as $item) { //removes blanks + if ($item) { + $parts = explode(',', $item); + $namespace = explode(':', $parts[0]); + $namespace = trim($namespace[0]); + $bool = in_array($namespace, $trimmed_names); + if (!$restricted || in_array($namespace, $trimmed_names)) { + $options[$parts[0]] = $parts[1]; + } + } + } + unset($options['islandora:ContentModelCollection']); + return $options; } +/** + * Function: get_content_models_as_option_array + * + * Description: Returns an associative array of all available content models in Fedora instance + * + * @return array + */ +function get_content_models_as_option_array() { + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + $restricted = variable_get('fedora_namespace_restriction_enforced', TRUE); + $allowed_string = variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora:'); + $namespaces = explode(':', $allowed_string); + foreach ($namespaces as $namespace) { + if ($namespace) { + $allowed[] = trim($namespace); + } + } + $query = 'select $object $title from <#ri> + where ($object $title + and ($object + or $object ) + and $object ) + order by $title'; + + $url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'); + $url .= "?type=tuples&flush=TRUE&format=csv&limit=1000&lang=itql&stream=on&query="; + $content = do_curl($url . htmlentities(urlencode($query))); + $list = explode("\n", $content); + array_shift($list); + $list = preg_replace('/info:fedora\//', '', $list); + foreach ($list as $item) { //removes blanks + if ($item) { + $parts = explode(',', $item); + $nameparts = explode(':', $parts[0]); + if (!$restricted || in_array($nameparts[0], $allowed)) { + + if (!preg_match('/fedora-system/', $nameparts[0])) { + $options[$parts[0]] = $parts[1] . ' ~ ' . $parts[0]; + } + } + } + } + + return $options; +} \ No newline at end of file diff --git a/api/rels-ext.inc b/api/rels-ext.inc index 06aa4cd5..d89f9abd 100644 --- a/api/rels-ext.inc +++ b/api/rels-ext.inc @@ -1,43 +1,46 @@ get_datastream_dissemination('RELS-EXT'); - - } - - function modified() { - return !(empty(array_diff($this->relsExtArray, $this->originalRelsExtArray)) && - empty(array_diff($this->originalRelsExtArray, $this->relsExtArray))); - } - - /** - * Save the current state of the RELS-EXT array out to the repository item - * as a datastream. - */ - function save() { - - } + + // Instance variables + public $relsExtArray = array(); + private $originalRelsExtArray = array(); // Used to determine the result of modified() funciton. + + /** + * Constructor that builds itself by retrieving the RELS-EXT stream from + * the repository for the given Fedora_Item. + * @param Fedora_Item $item + */ + function RelsExt($item) { + $relsextxml = $item->get_datastream_dissemination('RELS-EXT'); + } + + /** + * modified + * @return type + */ + function modified() { + return!(empty(array_diff($this->relsExtArray, $this->originalRelsExtArray)) && + empty(array_diff($this->originalRelsExtArray, $this->relsExtArray))); + } + + /** + * Save the current state of the RELS-EXT array out to the repository item + * as a datastream. + */ + function save() { + + } + } diff --git a/api/tagging.inc b/api/tagging.inc index 4156d7d4..418193fa 100644 --- a/api/tagging.inc +++ b/api/tagging.inc @@ -1,20 +1,25 @@ item = $item; @@ -22,8 +27,12 @@ class TagSet { } } + /** + * Load ?? + * @return type + */ function load() { - $tagsxml = isset($this->item->datastreams[$this->tagsDSID])? $this->item->get_datastream_dissemination($this->tagsDSID) : NULL; + $tagsxml = isset($this->item->datastreams[$this->tagsDSID]) ? $this->item->get_datastream_dissemination($this->tagsDSID) : NULL; if (empty($tagsxml)) { $this->tags = array(); return FALSE; @@ -59,11 +68,11 @@ class TagSet { else { $this->item->modify_datastream_by_value($tagdoc->saveXML(), $this->tagsDSID, 'Tags', 'text/xml', 'X'); } - } - catch (exception $e) { - drupal_set_message('There was an error saving the tags datastream: !e', array('!e' => $e), 'error'); + } catch (exception $e) { + drupal_set_message(t('There was an error saving the tags datastream: @e'), array('@e' => $e), 'error'); return FALSE; } return TRUE; } + } diff --git a/collection_policies/COLLECTION-COLLECTION POLICY.xml b/collection_policies/COLLECTION-COLLECTION POLICY.xml index 5888fd35..4eaaf48b 100644 --- a/collection_policies/COLLECTION-COLLECTION POLICY.xml +++ b/collection_policies/COLLECTION-COLLECTION POLICY.xml @@ -1,21 +1,22 @@ + - - - - - dc.title - dc.creator - dc.description - dc.date - dc.identifier - dc.language - dc.publisher - dc.rights - dc.subject - dc.relation - dcterms.temporal - dcterms.spatial - Full Text - - isMemberOfCollection + + + + + dc.title + dc.creator + dc.description + dc.date + dc.identifier + dc.language + dc.publisher + dc.rights + dc.subject + dc.relation + dcterms.temporal + dcterms.spatial + Full Text + + isMemberOfCollection diff --git a/collection_policies/FLV-COLLECTION POLICY.xml b/collection_policies/FLV-COLLECTION POLICY.xml index e7ea27a8..e8037a2c 100644 --- a/collection_policies/FLV-COLLECTION POLICY.xml +++ b/collection_policies/FLV-COLLECTION POLICY.xml @@ -7,8 +7,8 @@ vre:contentmodel STANDARD_FLV - - + + dc.description @@ -63,5 +63,5 @@ fgs.DS.first.text Full Text - + \ No newline at end of file diff --git a/collection_policies/JPG-COLLECTION POLICY.xml b/collection_policies/JPG-COLLECTION POLICY.xml index e66cd198..1b80514c 100644 --- a/collection_policies/JPG-COLLECTION POLICY.xml +++ b/collection_policies/JPG-COLLECTION POLICY.xml @@ -1,22 +1,22 @@ - - - - - dc.title - dc.creator - dc.description - dc.date - dc.identifier - dc.language - dc.publisher - dc.rights - dc.subject - dc.relation - dcterms.temporal - dcterms.spatial - Full Text - - isMemberOf + + + + + dc.title + dc.creator + dc.description + dc.date + dc.identifier + dc.language + dc.publisher + dc.rights + dc.subject + dc.relation + dcterms.temporal + dcterms.spatial + Full Text + + isMemberOf diff --git a/collection_policies/PDF-COLLECTION POLICY.xml b/collection_policies/PDF-COLLECTION POLICY.xml index 3f86bf16..4821da06 100644 --- a/collection_policies/PDF-COLLECTION POLICY.xml +++ b/collection_policies/PDF-COLLECTION POLICY.xml @@ -1 +1,24 @@ - dc.title dc.creator dc.description dc.date dc.identifier dc.language dc.publisher dc.rights dc.subject dc.relation dcterms.temporal dcterms.spatial Full Text isMemberOfCollection \ No newline at end of file + + + + + + + + + dc.title + dc.creator + dc.description + dc.date + dc.identifier + dc.language + dc.publisher + dc.rights + dc.subject + dc.relation + dcterms.temporal + dcterms.spatial + Full Text + + isMemberOfCollection + \ No newline at end of file diff --git a/collection_policies/PERSONAL-COLLECTION-POLICY.xml b/collection_policies/PERSONAL-COLLECTION-POLICY.xml index be51e65b..9605c1d9 100644 --- a/collection_policies/PERSONAL-COLLECTION-POLICY.xml +++ b/collection_policies/PERSONAL-COLLECTION-POLICY.xml @@ -1,3 +1,4 @@ + @@ -11,7 +12,7 @@ vre:contentmodel STANDARD_PDF - + ir:image vre:contentmodel STANDARD_IMAGE diff --git a/collection_policies/RIRI COLLECTION POLICY.xml b/collection_policies/RIRI COLLECTION POLICY.xml index 8424f9e9..11f726af 100644 --- a/collection_policies/RIRI COLLECTION POLICY.xml +++ b/collection_policies/RIRI COLLECTION POLICY.xml @@ -63,5 +63,5 @@ fgs.DS.first.text Full Text - + diff --git a/collection_policies/book_collection_policy.xml b/collection_policies/book_collection_policy.xml index 4a6c4a0f..f17f1df9 100644 --- a/collection_policies/book_collection_policy.xml +++ b/collection_policies/book_collection_policy.xml @@ -1,69 +1,70 @@ + - - - islandora - ilives:bookCModel - ISLANDORACM - - + + + islandora + ilives:bookCModel + ISLANDORACM + + - isMemberOfCollection - + isMemberOfCollection + - dc.description - - dc.title - dc.title - - - dc.creator - dc.creator - - - dc.description - dc.description - - - dc.date - dc.date - - - dc.identifier - dc.identifier - - - dc.language - dc.language - - - dc.publisher - dc.publisher - - - dc.rights - dc.rights - - - dc.subject - dc.subject - - - dc.relation - dc.relation - - - dcterms.temporal - dcterms.temporal - - - dcterms.spatial - dcterms.spatial - - - fgs.DS.first.text - Full Text - - + dc.description + + dc.title + dc.title + + + dc.creator + dc.creator + + + dc.description + dc.description + + + dc.date + dc.date + + + dc.identifier + dc.identifier + + + dc.language + dc.language + + + dc.publisher + dc.publisher + + + dc.rights + dc.rights + + + dc.subject + dc.subject + + + dc.relation + dc.relation + + + dcterms.temporal + dcterms.temporal + + + dcterms.spatial + dcterms.spatial + + + fgs.DS.first.text + Full Text + + diff --git a/collection_policies/large_image_collection_policy.xml b/collection_policies/large_image_collection_policy.xml index 4f9793a6..8a158940 100644 --- a/collection_policies/large_image_collection_policy.xml +++ b/collection_policies/large_image_collection_policy.xml @@ -6,79 +6,79 @@ Purpose of the document follows. --> - - - islandora:slide - islandora:slideCModel - ISLANDORACM - - - islandora:map - islandora:mapCModel - ISLANDORACM - - - islandora:herb - islandora:herbCModel - ISLANDORACM - - + + + islandora:slide + islandora:slideCModel + ISLANDORACM + + + islandora:map + islandora:mapCModel + ISLANDORACM + + + islandora:herb + islandora:herbCModel + ISLANDORACM + + - isMemberOfCollection - - dc.description - - dc.title - dc.title - - - dc.creator - dc.creator - - - dc.description - dc.description - - - dc.date - dc.date - - - dc.identifier - dc.identifier - - - dc.language - dc.language - - - dc.publisher - dc.publisher - - - dc.rights - dc.rights - - - dc.subject - dc.subject - - - dc.relation - dc.relation - - - dcterms.temporal - dcterms.temporal - - - dcterms.spatial - dcterms.spatial - - - fgs.DS.first.text - Full Text - - + isMemberOfCollection + + dc.description + + dc.title + dc.title + + + dc.creator + dc.creator + + + dc.description + dc.description + + + dc.date + dc.date + + + dc.identifier + dc.identifier + + + dc.language + dc.language + + + dc.publisher + dc.publisher + + + dc.rights + dc.rights + + + dc.subject + dc.subject + + + dc.relation + dc.relation + + + dcterms.temporal + dcterms.temporal + + + dcterms.spatial + dcterms.spatial + + + fgs.DS.first.text + Full Text + + diff --git a/collection_policies/qt_collection_policy.xml b/collection_policies/qt_collection_policy.xml index 2f8df517..70ba7b49 100644 --- a/collection_policies/qt_collection_policy.xml +++ b/collection_policies/qt_collection_policy.xml @@ -1,35 +1,48 @@ - - - - - - -dc.title - -dc.creator - -dc.description - -dc.date - -dc.identifier - -dc.language - -dc.publisher - -dc.rights - -dc.subject - -dc.relation - -dcterms.temporal - -dcterms.spatial - - -isMemberOfCollection - + + + + + + +dc.title + + +dc.creator + + +dc.description + + +dc.date + + +dc.identifier + + +dc.language + + +dc.publisher + + +dc.rights + + +dc.subject + + +dc.relation + + +dcterms.temporal + + +dcterms.spatial + + + +isMemberOfCollection + + diff --git a/collection_policy.xsd b/collection_policy.xsd index 8822f103..d5ea6637 100644 --- a/collection_policy.xsd +++ b/collection_policy.xsd @@ -1,47 +1,48 @@ + - - + + Islandora Collection Policy Schema Islandora, Robertson Library, University of Prince Edward Island, 550 University Ave., Charlottetown, Prince Edward Island - - + + - - - - - - - - - - + + + + + + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - - - + + + + + + + + \ No newline at end of file diff --git a/collection_views/COLLECTION_VIEW.xml b/collection_views/COLLECTION_VIEW.xml index 7b30307d..4d7def0e 100644 --- a/collection_views/COLLECTION_VIEW.xml +++ b/collection_views/COLLECTION_VIEW.xml @@ -1,264 +1,264 @@ - - - - - - - - - - - - - - - - - - - - - -
-
-
-
- - - - - + - - - - - - - - - - - - - - - - - - - - - - - /fedora/repository/ - /-/ - - - - /fedora/repository/ - / - / - - - - - + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + /fedora/repository/ + /-/ + + + + /fedora/repository/ + / + / + + + + + - - - /fedora/repository/ - /TN - - -
+ + + /fedora/repository/ + /TN + + +
- + - -
-- - - - /fedora/repository/ - /-/ - - + +
-- +
+ + /fedora/repository/ + /-/ + + DETAILS - -- -
- - - - - - -
- - -   - - - - - - - - - - + -- + + + + + + + + + + +   + + + + + + + + + + - - + + - - - + + + - - - - - - - - - - - - - + + + + + + + + + + + + +
\ No newline at end of file diff --git a/collection_views/Coverflow_Collection_View.xsl b/collection_views/Coverflow_Collection_View.xsl index 1e67f79f..243ce893 100644 --- a/collection_views/Coverflow_Collection_View.xsl +++ b/collection_views/Coverflow_Collection_View.xsl @@ -1,59 +1,61 @@ + - - - - - - - - - - - - - - - - - + + + + + + + -
Testing YUI's CoverFlow version 0.1 (beta)
-
- - -
-
- + }; + + +
Testing YUI's CoverFlow version 0.1 (beta)
+
+ + +
+
+ diff --git a/collection_views/Coverflow_PRE_Collection_View.xsl b/collection_views/Coverflow_PRE_Collection_View.xsl index e9bae87d..091fbfe1 100644 --- a/collection_views/Coverflow_PRE_Collection_View.xsl +++ b/collection_views/Coverflow_PRE_Collection_View.xsl @@ -1,63 +1,65 @@ + - - - - - - - - - - - - - - - - - + + + + + + + -
Testing YUI's CoverFlow version 0.1 (beta)
-
- - -
-
- + }; + + +
Testing YUI's CoverFlow version 0.1 (beta)
+
+ + +
+
+ diff --git a/collection_views/FLV-COLLECTION VIEW(2).xml b/collection_views/FLV-COLLECTION VIEW(2).xml index e591de97..7eebe2f3 100644 --- a/collection_views/FLV-COLLECTION VIEW(2).xml +++ b/collection_views/FLV-COLLECTION VIEW(2).xml @@ -1,65 +1,96 @@ - - - - - - - - - - - - - - - - - -
-
+
+ -
-
- - - - - - - - - - - - - - - - - - - - - /fedora/repository//-/ - - - /fedora/repository//OBJ/ - - - - - - - /fedora/repository//-/ - - - /fedora/repository//TN - - - -
- - - /fedora/repository//-/ - - - + + + +
+ + + + + + + + + + + + + + + + + + + + + + + /fedora/repository/ + /-/ + + + + /fedora/repository/ + /OBJ/ + + + + + + + + /fedora/repository/ + /-/ + + + + + /fedora/repository/ + /TN + + + + + + +
+ + + /fedora/repository/ + /-/ + + + + - - - - - - -
- - -   - - - - - - - - - - + + + + + + + + + +   + + + + + + + + + + - - + + - - - + + + - - - - - - - - - - - - - + + + + + + + + + + + + + \ No newline at end of file diff --git a/collection_views/REFWORKS-COLLECTION_VIEW.xml b/collection_views/REFWORKS-COLLECTION_VIEW.xml index 26d637e4..9a8eebdd 100644 --- a/collection_views/REFWORKS-COLLECTION_VIEW.xml +++ b/collection_views/REFWORKS-COLLECTION_VIEW.xml @@ -1,65 +1,96 @@ - - - - - - - - - - - - - - - - - -
-
+
+ -
-
- - - - - - - - - - - - - - - - - - - - - - - /fedora/repository//-/ - - - /fedora/repository//OBJ/ - - - - - + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + /fedora/repository/ + /-/ + + + + /fedora/repository/ + /OBJ/ + + + + + + -
- - /fedora/repository//-/ - - - +
+ + + /fedora/repository/ + /-/ + + + + - - - - - - -
- - -   - - - - - - - - - - + + + + + + + + + +   + + + + + + + + + + - - + + - - - + + + - - - - - - - - - - - - - + + + + + + + + + + + + +
\ No newline at end of file diff --git a/collection_views/SIMPLE-COLLECTION_VIEW.xml b/collection_views/SIMPLE-COLLECTION_VIEW.xml index a01e66e0..8f67e1c0 100644 --- a/collection_views/SIMPLE-COLLECTION_VIEW.xml +++ b/collection_views/SIMPLE-COLLECTION_VIEW.xml @@ -1,65 +1,96 @@ - - - - - - - - - - - - - - - - - -
-
+
+ -
-
- - - - - - - - - - - - - - - - - - - - - - - /fedora/repository//-/ - - - /fedora/repository//OBJ/ - - - - - - - - - - /fedora/repository//TN - - - -
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + /fedora/repository/ + /-/ + + + + /fedora/repository/ + /OBJ/ + + + + + + + + + + + + + /fedora/repository/ + /TN + + + + + + +
-
- - /fedora/repository//-/ - - - +
+ + + /fedora/repository/ + /-/ + + + + - - - - - - -
- - -   - - - - - - - - - - + + + + + + + + + +   + + + + + + + + + + - - + + - - - + + + - - - - - - - - - - - - - + + + + + + + + + + + + + \ No newline at end of file diff --git a/collection_views/SmileyStuff-COLLECTION_VIEW.xml b/collection_views/SmileyStuff-COLLECTION_VIEW.xml index 58e28287..5aa853bc 100644 --- a/collection_views/SmileyStuff-COLLECTION_VIEW.xml +++ b/collection_views/SmileyStuff-COLLECTION_VIEW.xml @@ -1,67 +1,69 @@ + - - - - - - + + + + + +
- -

- -
- - - -

-
+ +

+ +
+ + + +

+

- - - - - + + + +
-
- - - - /fedora/repository/ - - /FULL_SIZE - - - - - /fedora/repository/ - - /MEDIUM_SIZE - - -
+ + + + + - - - -
+
+ + + + /fedora/repository/ + + /FULL_SIZE + + + + + /fedora/repository/ + + /MEDIUM_SIZE + + +
( Full Size ) -
-
-
- - - - - /fedora/repository/ - /-/ - - - - -
- -
+
+
+
+ + + + + /fedora/repository/ + /-/ + + + + + +
+ +
-
+
diff --git a/collection_views/Video-COLLECTION_VIEW.xml b/collection_views/Video-COLLECTION_VIEW.xml index f52dea89..39f9fe52 100644 --- a/collection_views/Video-COLLECTION_VIEW.xml +++ b/collection_views/Video-COLLECTION_VIEW.xml @@ -1,64 +1,66 @@ + - - - - - - + + + + + +
- -

- -
- - - -

-
+ +

+ +
+ + + +

+

- - - - - - - - -
-
- - - - /fedora/repository/ - - - - - - /fedora/repository/ - - /THUMBNAIL - - - -
-
- - - - - /fedora/repository/ - /-/ - - - - -
- -
+ + + + + + + + +
+
+ + + + /fedora/repository/ + + + + + + /fedora/repository/ + + /THUMBNAIL + + + +
+
+ + + + + /fedora/repository/ + /-/ + + + + + +
+ +
-
+
diff --git a/collection_views/default-sparqltoHtml.xsl b/collection_views/default-sparqltoHtml.xsl index 2f88acb5..8701c66d 100644 --- a/collection_views/default-sparqltoHtml.xsl +++ b/collection_views/default-sparqltoHtml.xsl @@ -1,124 +1,189 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - + + + + + + + + + +
-
+ + + /fedora/repository/ + /TN + + + + + + /fedora/repository/ + /-/ + + + + +
+ -
-
+ + + +
+ +
\ No newline at end of file diff --git a/collection_views/demo_image_collection_dc_record.xml b/collection_views/demo_image_collection_dc_record.xml index a0879d69..72433b60 100644 --- a/collection_views/demo_image_collection_dc_record.xml +++ b/collection_views/demo_image_collection_dc_record.xml @@ -1,7 +1,7 @@ - Demo Image Collection - islandora:demo_image_collection - Demo image collection + Demo Image Collection + islandora:demo_image_collection + Demo image collection diff --git a/collection_views/simple_list_view.xml b/collection_views/simple_list_view.xml index e8711651..37ada1d5 100644 --- a/collection_views/simple_list_view.xml +++ b/collection_views/simple_list_view.xml @@ -1,28 +1,30 @@ + - - - - + + + + - - + diff --git a/collection_views/standard_jpeg_collection_view.xml b/collection_views/standard_jpeg_collection_view.xml index 40a8c96a..4604b454 100644 --- a/collection_views/standard_jpeg_collection_view.xml +++ b/collection_views/standard_jpeg_collection_view.xml @@ -1,66 +1,68 @@ + - - - - - - -
- -

- -
- - - -

-
-
-
-
- - - - - + + + +
-
- - - - /fedora/repository/ - - /FULL_SIZE - - - - - /fedora/repository/ - - /MEDIUM_SIZE - - -
+ + + + + + +
+ +

+ +
+ + + +

+
+
+
+
+ + + + + - - - -
+
+ + + + /fedora/repository/ + + /FULL_SIZE + + + + + /fedora/repository/ + + /MEDIUM_SIZE + + +
( Full Size ) -
-
-
- - - - - /fedora/repository/ - /-/ - - - - -
- -
-
-
+
+
+
+ + + + + /fedora/repository/ + /-/ + + + + + +
+ +
+
+
diff --git a/collection_views/yui_coverflow/css/test.css b/collection_views/yui_coverflow/css/test.css index c6f215a7..0442d49e 100644 --- a/collection_views/yui_coverflow/css/test.css +++ b/collection_views/yui_coverflow/css/test.css @@ -1,18 +1,18 @@ body { - font-family: Arial; - font-size: 12px; - color: gray; - background: black; + font-family: Arial; + font-size: 12px; + color: gray; + background: black; } .title { - font-size: 18px; - font-weight: bold; + font-size: 18px; + font-weight: bold; } #coverFlowTest .coverFlowLabel { - margin-top: 10px; - font-size: 14px; - color: #C0C0C0; - font-weight: bold; + margin-top: 10px; + font-size: 14px; + color: #C0C0C0; + font-weight: bold; } \ No newline at end of file diff --git a/collection_views/yui_coverflow/js/CoverFlow.js b/collection_views/yui_coverflow/js/CoverFlow.js index 3b041592..4a521745 100644 --- a/collection_views/yui_coverflow/js/CoverFlow.js +++ b/collection_views/yui_coverflow/js/CoverFlow.js @@ -19,7 +19,7 @@ YAHOO.namespace("ext"); //(function(){ - /** +/** * @class CoverFlow * @namespace YAHOO.ext * @constructor @@ -31,906 +31,966 @@ YAHOO.namespace("ext"); * config.bgColor {String} Background color. Could be in the form #00000 or black. Optional. Default: CoverFlow.DEFAULT_BG_COLOR. * */ - YAHOO.ext.CoverFlow = function(el, userConfig){ - if(el) - this.init(el, userConfig || {}); - }; +YAHOO.ext.CoverFlow = function(el, userConfig){ + if(el) + this.init(el, userConfig || {}); +}; - //shortcuts - var CoverFlow = YAHOO.ext.CoverFlow; - var Dom = YAHOO.util.Dom; +//shortcuts +var CoverFlow = YAHOO.ext.CoverFlow; +var Dom = YAHOO.util.Dom; - /** +/** * Defaults */ - CoverFlow.DEFAULT_HEIGHT = 300; - CoverFlow.DEFAULT_WIDTH = 800; - CoverFlow.DEFAULT_BG_COLOR = '#000000'; - CoverFlow.IMAGE_SEPARATION = 50; - CoverFlow.RIGHT = 'right'; - CoverFlow.LEFT = 'left'; - CoverFlow.LABEL_CLASS = 'coverFlowLabel'; +CoverFlow.DEFAULT_HEIGHT = 300; +CoverFlow.DEFAULT_WIDTH = 800; +CoverFlow.DEFAULT_BG_COLOR = '#000000'; +CoverFlow.IMAGE_SEPARATION = 50; +CoverFlow.RIGHT = 'right'; +CoverFlow.LEFT = 'left'; +CoverFlow.LABEL_CLASS = 'coverFlowLabel'; - CoverFlow.prototype = { - //Images array (it's a sort of transient var) - images: [], - //Items array {CoverFlowItem[]} - coverFlowItems: [], +CoverFlow.prototype = { + //Images array (it's a sort of transient var) + images: [], + //Items array {CoverFlowItem[]} + coverFlowItems: [], - remainingImages: 9999, + remainingImages: 9999, - element: null, - labelElement: null, - containerHeight: 0, - containerWidth: 0, + element: null, + labelElement: null, + containerHeight: 0, + containerWidth: 0, - imageHeightRatio: 0.6, - imageWidthRatio: 0.2, - reflectionRatio: 0.6, // this causes: imageTotalHeightRatio = imageHeightRatio + imageHeightRatio*reflectionRatio - topRatio: 0.1, - sideRatio: 0.4, + imageHeightRatio: 0.6, + imageWidthRatio: 0.2, + reflectionRatio: 0.6, // this causes: imageTotalHeightRatio = imageHeightRatio + imageHeightRatio*reflectionRatio + topRatio: 0.1, + sideRatio: 0.4, - perspectiveAngle: 20, - imageZIndex: 1000, - selectedImageZIndex: 9999, - selectedItem: 0, + perspectiveAngle: 20, + imageZIndex: 1000, + selectedImageZIndex: 9999, + selectedItem: 0, - moveQueue: [], - animationWorking: false, + moveQueue: [], + animationWorking: false, - init: function(el, userConfig){ + init: function(el, userConfig){ - this.element = Dom.get(el); - this.applyConfig(userConfig); + this.element = Dom.get(el); + this.applyConfig(userConfig); - if(userConfig.images) - this.addImages(userConfig.images); + if(userConfig.images) + this.addImages(userConfig.images); - this.attachEventListeners(); - this.createLabelElement(); - }, - - applyConfig: function(config){ - this.containerHeight = config.height || CoverFlow.DEFAULT_HEIGHT; - this.containerWidth = config.width || CoverFlow.DEFAULT_WIDTH; - this.backgroundColor = config.bgColor || CoverFlow.DEFAULT_BG_COLOR; + this.attachEventListeners(); + this.createLabelElement(); + }, + + applyConfig: function(config){ + this.containerHeight = config.height || CoverFlow.DEFAULT_HEIGHT; + this.containerWidth = config.width || CoverFlow.DEFAULT_WIDTH; + this.backgroundColor = config.bgColor || CoverFlow.DEFAULT_BG_COLOR; - this.element.style.position = 'relative'; - this.element.style.height = this.containerHeight + 'px'; - this.element.style.width = this.containerWidth + 'px'; - this.element.style.background = this.backgroundColor; - this.element.style.overflow = 'hidden'; - }, - - addImages: function(images){ - this.images = []; - this.remainingImages = images.length; + this.element.style.position = 'relative'; + this.element.style.height = this.containerHeight + 'px'; + this.element.style.width = this.containerWidth + 'px'; + this.element.style.background = this.backgroundColor; + this.element.style.overflow = 'hidden'; + }, + + addImages: function(images){ + this.images = []; + this.remainingImages = images.length; - for(var i=0; i < images.length; i++){ - var img = images[i]; - var image = new Image(); - image.id = Dom.generateId(); - image.index = i; - image.onclick = img.onclick; - image.label = img.label; + for(var i=0; i < images.length; i++){ + var img = images[i]; + var image = new Image(); + image.id = Dom.generateId(); + image.index = i; + image.onclick = img.onclick; + image.label = img.label; - //hide images - image.style.visibility = 'hidden'; - image.style.display = 'none'; - //this is to maintain image order since image.onload will be called randomly - this.element.appendChild(image); - //a shortcut to not create another context to call onload - var me = this; -// image.onload = function(){ -// CoverFlow.preloadImage(me, this); // this = image -// }; - YAHOO.util.Event.on(image, 'load', this.preloadImage, image, this); - image.src = img.src; + //hide images + image.style.visibility = 'hidden'; + image.style.display = 'none'; + //this is to maintain image order since image.onload will be called randomly + this.element.appendChild(image); + //a shortcut to not create another context to call onload + var me = this; + // image.onload = function(){ + // CoverFlow.preloadImage(me, this); // this = image + // }; + YAHOO.util.Event.on(image, 'load', this.preloadImage, image, this); + image.src = img.src; - }; + }; - }, + }, - /** + /** * @function preloadImage * @param event * @param image * @return void */ - preloadImage : function(e, image){ - this.images.push(image); - this.checkAllImagesLoaded(); - }, - - checkAllImagesLoaded: function(){ - this.remainingImages--; - if(!this.remainingImages){ - this.setup(); - } - }, - - setup: function(){ - this.createCoverFlowItems(); - this.sortCoverFlowItems(); - this.initCoverFlow(); - }, - - initCoverFlow: function(){ + preloadImage : function(e, image){ + this.images.push(image); + this.checkAllImagesLoaded(); + }, + + checkAllImagesLoaded: function(){ + this.remainingImages--; + if(!this.remainingImages){ + this.setup(); + } + }, + + setup: function(){ + this.createCoverFlowItems(); + this.sortCoverFlowItems(); + this.initCoverFlow(); + }, + + initCoverFlow: function(){ - for(var i=0; i < this.coverFlowItems.length; i++){ - var coverFlowItem = this.coverFlowItems[i]; + for(var i=0; i < this.coverFlowItems.length; i++){ + var coverFlowItem = this.coverFlowItems[i]; - var angle = 0; - var direction; + var angle = 0; + var direction; - if(i==0){ - coverFlowItem.setZIndex(this.selectedImageZIndex); - coverFlowItem.setLeft(this.getCenter() - coverFlowItem.element.width/2); - coverFlowItem.isSelected(true); - this.selectedItem = 0; - this.showLabel(coverFlowItem.getLabel()); - }else{ - angle = this.perspectiveAngle; - direction = CoverFlow.LEFT; - coverFlowItem.setZIndex(this.imageZIndex - i); - coverFlowItem.setLeft( this.getRightStart()+ (i - 1)* CoverFlow.IMAGE_SEPARATION); - coverFlowItem.isSelected(false); - } - coverFlowItem.setAngle(angle); - coverFlowItem.drawInPerspective(direction); - } - }, - - createLabelElement: function(){ - var label = document.createElement('div'); - label.id = Dom.generateId(); - label.style.position = 'absolute'; - label.style.top = this.getFooterOffset() + 'px'; - label.innerHTML = ' '; - label.style.textAlign = 'center'; - label.style.width = this.containerWidth + 'px'; - label.style.zIndex = this.selectedImageZIndex + 10; - label.className = CoverFlow.LABEL_CLASS; - this.labelElement = this.element.appendChild(label); - }, - - showLabel: function(text){ - if(text) - this.labelElement.innerHTML = text; - else - this.labelElement.innerHTML = ''; - }, - - attachEventListeners: function(){ - new YAHOO.util.KeyListener(this.element, { keys:39 }, - { fn:this.selectNext, - scope:this, - correctScope:true } ).enable(); + if(i==0){ + coverFlowItem.setZIndex(this.selectedImageZIndex); + coverFlowItem.setLeft(this.getCenter() - coverFlowItem.element.width/2); + coverFlowItem.isSelected(true); + this.selectedItem = 0; + this.showLabel(coverFlowItem.getLabel()); + }else{ + angle = this.perspectiveAngle; + direction = CoverFlow.LEFT; + coverFlowItem.setZIndex(this.imageZIndex - i); + coverFlowItem.setLeft( this.getRightStart()+ (i - 1)* CoverFlow.IMAGE_SEPARATION); + coverFlowItem.isSelected(false); + } + coverFlowItem.setAngle(angle); + coverFlowItem.drawInPerspective(direction); + } + }, + + createLabelElement: function(){ + var label = document.createElement('div'); + label.id = Dom.generateId(); + label.style.position = 'absolute'; + label.style.top = this.getFooterOffset() + 'px'; + label.innerHTML = ' '; + label.style.textAlign = 'center'; + label.style.width = this.containerWidth + 'px'; + label.style.zIndex = this.selectedImageZIndex + 10; + label.className = CoverFlow.LABEL_CLASS; + this.labelElement = this.element.appendChild(label); + }, + + showLabel: function(text){ + if(text) + this.labelElement.innerHTML = text; + else + this.labelElement.innerHTML = ''; + }, + + attachEventListeners: function(){ + new YAHOO.util.KeyListener(this.element, { + keys:39 + }, +{ + fn:this.selectNext, + scope:this, + correctScope:true + } ).enable(); - new YAHOO.util.KeyListener(this.element, { keys:37 }, - { fn:this.selectPrevious, - scope:this, - correctScope:true } ).enable(); + new YAHOO.util.KeyListener(this.element, { + keys:37 + }, +{ + fn:this.selectPrevious, + scope:this, + correctScope:true + } ).enable(); - }, - - select: function(e,coverFlowItem){ - var distance = this.selectedItem - coverFlowItem.index; - if(distance < 0){ - for(var i=0; i < -distance; i++) - this.selectNext(); - }else{ - for(var i=0; i < distance; i++) - this.selectPrevious(); - } - }, - - - selectNext: function(){ - if(this.animationWorking){ - this.moveQueue.push('moveLeft'); - return; - } + }, + + select: function(e,coverFlowItem){ + var distance = this.selectedItem - coverFlowItem.index; + if(distance < 0){ + for(var i=0; i < -distance; i++) + this.selectNext(); + }else{ + for(var i=0; i < distance; i++) + this.selectPrevious(); + } + }, + + + selectNext: function(){ + if(this.animationWorking){ + this.moveQueue.push('moveLeft'); + return; + } - var animateItems = []; + var animateItems = []; - for(var i=0; i < this.coverFlowItems.length; i++){ - var coverFlowItem = this.coverFlowItems[i]; - var isLast = (this.selectedItem == this.coverFlowItems.length -1); - if(!isLast){ - var distance = i-this.selectedItem; + for(var i=0; i < this.coverFlowItems.length; i++){ + var coverFlowItem = this.coverFlowItems[i]; + var isLast = (this.selectedItem == this.coverFlowItems.length -1); + if(!isLast){ + var distance = i-this.selectedItem; - if(distance == 0){// selected - coverFlowItem.setZIndex(this.imageZIndex); - coverFlowItem.isSelected(false); - animateItems.push({item: coverFlowItem, attribute:{angle: {start: 0, end: this.perspectiveAngle} } }); + if(distance == 0){// selected + coverFlowItem.setZIndex(this.imageZIndex); + coverFlowItem.isSelected(false); + animateItems.push({ + item: coverFlowItem, + attribute:{ + angle: { + start: 0, + end: this.perspectiveAngle + } + } + }); - coverFlowItem = this.coverFlowItems[++i]; - coverFlowItem.isSelected(true); - this.showLabel(coverFlowItem.getLabel()); - animateItems.push({item: coverFlowItem, attribute:{angle: {start: this.perspectiveAngle, end: 0} } }); + coverFlowItem = this.coverFlowItems[++i]; + coverFlowItem.isSelected(true); + this.showLabel(coverFlowItem.getLabel()); + animateItems.push({ + item: coverFlowItem, + attribute:{ + angle: { + start: this.perspectiveAngle, + end: 0 + } + } + }); - }else{ - animateItems.push({item: coverFlowItem, attribute: {left: {start:coverFlowItem.getLeft(), end: coverFlowItem.getLeft() - CoverFlow.IMAGE_SEPARATION} }}); - } - } - } + }else{ + animateItems.push({ + item: coverFlowItem, + attribute: { + left: { + start:coverFlowItem.getLeft(), + end: coverFlowItem.getLeft() - CoverFlow.IMAGE_SEPARATION + } + } + }); +} +} +} - var animation = new CoverFlowAnimation({ - direction: CoverFlow.LEFT, - center: this.getCenter(), - startLeftPos: this.getLeftStart(), - startRightPos: this.getRightStart() - }, - animateItems, 0.5); +var animation = new CoverFlowAnimation({ + direction: CoverFlow.LEFT, + center: this.getCenter(), + startLeftPos: this.getLeftStart(), + startRightPos: this.getRightStart() +}, +animateItems, 0.5); - animation.onStart.subscribe(this.handleAnimationWorking, this); - animation.onComplete.subscribe(this.handleQueuedMove, this); +animation.onStart.subscribe(this.handleAnimationWorking, this); +animation.onComplete.subscribe(this.handleQueuedMove, this); - animation.animate(); +animation.animate(); - if(this.selectedItem + 1 < this.coverFlowItems.length) - this.selectedItem++; - }, +if(this.selectedItem + 1 < this.coverFlowItems.length) + this.selectedItem++; +}, - selectPrevious: function(){ - if(this.animationWorking){ - this.moveQueue.push('moveRight'); - return; - } +selectPrevious: function(){ + if(this.animationWorking){ + this.moveQueue.push('moveRight'); + return; + } - var animateItems = []; + var animateItems = []; - for(var i=0; i < this.coverFlowItems.length; i++){ - var coverFlowItem = this.coverFlowItems[i]; - var isFirst = (this.selectedItem == 0); - var distance = i-this.selectedItem; - if(!isFirst){ - if(distance == - 1){ - coverFlowItem.setZIndex(this.selectedImageZIndex); - coverFlowItem.isSelected(true); - this.showLabel(coverFlowItem.getLabel()); - animateItems.push({item: coverFlowItem, attribute: {angle: {start: this.perspectiveAngle, end: 0}}}); + for(var i=0; i < this.coverFlowItems.length; i++){ + var coverFlowItem = this.coverFlowItems[i]; + var isFirst = (this.selectedItem == 0); + var distance = i-this.selectedItem; + if(!isFirst){ + if(distance == - 1){ + coverFlowItem.setZIndex(this.selectedImageZIndex); + coverFlowItem.isSelected(true); + this.showLabel(coverFlowItem.getLabel()); + animateItems.push({ + item: coverFlowItem, + attribute: { + angle: { + start: this.perspectiveAngle, + end: 0 + } + } + }); - coverFlowItem = this.coverFlowItems[++i]; - coverFlowItem.isSelected(false); - coverFlowItem.setZIndex(this.imageZIndex); - animateItems.push({item: coverFlowItem, attribute: {angle: {start: 0, end: this.perspectiveAngle}}}); - }else{ - coverFlowItem.setZIndex(coverFlowItem.getZIndex() - 1); - animateItems.push({item: coverFlowItem, attribute: {left: {start:coverFlowItem.getLeft(), end: coverFlowItem.getLeft() + CoverFlow.IMAGE_SEPARATION} }}); - } - } - } - var animation = new CoverFlowAnimation({ - direction: CoverFlow.RIGHT, - center: this.getCenter(), - startLeftPos: this.getLeftStart(), - startRightPos: this.getRightStart() - }, - animateItems, 0.5); + coverFlowItem = this.coverFlowItems[++i]; + coverFlowItem.isSelected(false); + coverFlowItem.setZIndex(this.imageZIndex); + animateItems.push({ + item: coverFlowItem, + attribute: { + angle: { + start: 0, + end: this.perspectiveAngle + } + } + }); +}else{ + coverFlowItem.setZIndex(coverFlowItem.getZIndex() - 1); + animateItems.push({ + item: coverFlowItem, + attribute: { + left: { + start:coverFlowItem.getLeft(), + end: coverFlowItem.getLeft() + CoverFlow.IMAGE_SEPARATION + } + } + }); +} +} +} +var animation = new CoverFlowAnimation({ + direction: CoverFlow.RIGHT, + center: this.getCenter(), + startLeftPos: this.getLeftStart(), + startRightPos: this.getRightStart() +}, +animateItems, 0.5); - animation.onStart.subscribe(this.handleAnimationWorking, this); - animation.onComplete.subscribe(this.handleQueuedMove, this); +animation.onStart.subscribe(this.handleAnimationWorking, this); +animation.onComplete.subscribe(this.handleQueuedMove, this); - animation.animate(); +animation.animate(); - if(this.selectedItem > 0) - this.selectedItem--; - }, +if(this.selectedItem > 0) + this.selectedItem--; +}, - handleAnimationWorking: function(a, b, cf){ - cf.animationWorking = true; - }, +handleAnimationWorking: function(a, b, cf){ + cf.animationWorking = true; +}, - handleQueuedMove: function(msg, data, cf){ - cf.animationWorking = false; +handleQueuedMove: function(msg, data, cf){ + cf.animationWorking = false; - var next = cf.moveQueue.pop(); - if(next == 'moveLeft') - cf.selectNext(); - if(next == 'moveRight') - cf.selectPrevious(); - }, - - getCenter: function(){ - return this.containerWidth / 2; - }, - - getRightStart: function() { - return this.containerWidth - this.sideRatio * this.containerWidth; - }, - - getLeftStart: function() { - return this.sideRatio * this.containerWidth; - }, - - sortCoverFlowItems: function(){ - function sortFunction(aCoverFlowItem, bCoverFlowItem){ - return aCoverFlowItem.index - bCoverFlowItem.index; - } + var next = cf.moveQueue.pop(); + if(next == 'moveLeft') + cf.selectNext(); + if(next == 'moveRight') + cf.selectPrevious(); +}, + +getCenter: function(){ + return this.containerWidth / 2; +}, + +getRightStart: function() { + return this.containerWidth - this.sideRatio * this.containerWidth; +}, + +getLeftStart: function() { + return this.sideRatio * this.containerWidth; +}, + +sortCoverFlowItems: function(){ + function sortFunction(aCoverFlowItem, bCoverFlowItem){ + return aCoverFlowItem.index - bCoverFlowItem.index; + } - this.coverFlowItems.sort(sortFunction); - }, - - createCoverFlowItems: function(){ - this.coverFlowItems = []; - for(var i=0; i this.getMaxImageHeight() && image.width <= this.getMaxImageWidth()){ - height = ((image.height / this.getMaxImageHeight())) * image.height; - } - if(image.height <= this.getMaxImageHeight() && image.width > this.getMaxImageWidth()){ - height = ((image.width / this.getMaxImageWidth())) * image.height; - } - if(image.height > this.getMaxImageHeight() && image.width > this.getMaxImageWidth()){ - if(image.height > image.width) - height = ((this.getMaxImageHeight() / image.height)) * image.height; - else - height = ((this.getMaxImageWidth() / image.width)) * image.height; - } - return height; - }, +}, + +scaleHeight: function(image){ + var height = 0; + if(image.height <= this.getMaxImageHeight() && image.width <= this.getMaxImageWidth()){ + height = image.height; + } + if(image.height > this.getMaxImageHeight() && image.width <= this.getMaxImageWidth()){ + height = ((image.height / this.getMaxImageHeight())) * image.height; + } + if(image.height <= this.getMaxImageHeight() && image.width > this.getMaxImageWidth()){ + height = ((image.width / this.getMaxImageWidth())) * image.height; + } + if(image.height > this.getMaxImageHeight() && image.width > this.getMaxImageWidth()){ + if(image.height > image.width) + height = ((this.getMaxImageHeight() / image.height)) * image.height; + else + height = ((this.getMaxImageWidth() / image.width)) * image.height; + } + return height; +}, - scaleWidth: function(image){ - var width = 0; - if(image.height <= this.getMaxImageHeight() && image.width <= this.getMaxImageWidth()){ - width = image.width; - } - if(image.height > this.getMaxImageHeight() && image.width <= this.getMaxImageWidth()){ - width = ((image.height / this.getMaxImageHeight())) * image.width; - } - if(image.height <= this.getMaxImageHeight() && image.width > this.getMaxImageWidth()){ - width = ((image.width / this.getMaxImageWidth())) * image.width; - } - if(image.height > this.getMaxImageHeight() && image.width > this.getMaxImageWidth()){ - if(image.height > image.width) - width = ((this.getMaxImageHeight() / image.height)) * image.width; - else - width = ((this.getMaxImageWidth() / image.width)) * image.width; - } - return width; - }, - - - getMaxImageHeight: function(){ - return (this.containerHeight * this.imageHeightRatio); - }, - - getMaxImageWidth: function(){ - return (this.containerWidth * this.imageWidthRatio); - }, - - getTopOffset: function(){ - return this.containerHeight * this.topRatio; - }, - - getFooterOffset: function(){ - return this.containerHeight * (this.topRatio + this.imageHeightRatio); - } - }; +scaleWidth: function(image){ + var width = 0; + if(image.height <= this.getMaxImageHeight() && image.width <= this.getMaxImageWidth()){ + width = image.width; + } + if(image.height > this.getMaxImageHeight() && image.width <= this.getMaxImageWidth()){ + width = ((image.height / this.getMaxImageHeight())) * image.width; + } + if(image.height <= this.getMaxImageHeight() && image.width > this.getMaxImageWidth()){ + width = ((image.width / this.getMaxImageWidth())) * image.width; + } + if(image.height > this.getMaxImageHeight() && image.width > this.getMaxImageWidth()){ + if(image.height > image.width) + width = ((this.getMaxImageHeight() / image.height)) * image.width; + else + width = ((this.getMaxImageWidth() / image.width)) * image.width; + } + return width; +}, + + +getMaxImageHeight: function(){ + return (this.containerHeight * this.imageHeightRatio); +}, + +getMaxImageWidth: function(){ + return (this.containerWidth * this.imageWidthRatio); +}, + +getTopOffset: function(){ + return this.containerHeight * this.topRatio; +}, + +getFooterOffset: function(){ + return this.containerHeight * (this.topRatio + this.imageHeightRatio); +} +}; - /** +/** * @class CoverFlowItem * */ - CoverFlowItem = function(image, config){ - if(image) - this.init(image, config); - }; +CoverFlowItem = function(image, config){ + if(image) + this.init(image, config); +}; - CoverFlowItem.prototype = { - canvas: null, - element: null, - index: null, - id: null, - angle: 0, - selected: false, - onclickFn: null, - selectedOnclickFn: null, - label: null, - - onSelected: null, - - init: function(image, config){ - var scaledWidth = config.scaledWidth; - var scaledHeight = config.scaledHeight; - var reflectionRatio = config.reflectionRatio; - var bgColor = config.bgColor; +CoverFlowItem.prototype = { + canvas: null, + element: null, + index: null, + id: null, + angle: 0, + selected: false, + onclickFn: null, + selectedOnclickFn: null, + label: null, + + onSelected: null, + + init: function(image, config){ + var scaledWidth = config.scaledWidth; + var scaledHeight = config.scaledHeight; + var reflectionRatio = config.reflectionRatio; + var bgColor = config.bgColor; - this.id = image.id; - this.index = image.index; - this.onclickFn = config.onclick; - this.selectedOnclickFn = image.onclick; - this.label = image.label; - var parent = image.parentNode; - this.canvas = this.createImageCanvas(image,scaledWidth,scaledHeight,reflectionRatio, bgColor); - this.element = this.canvas.cloneNode(false); - this.element.id = this.id; - parent.replaceChild(this.element, image); + this.id = image.id; + this.index = image.index; + this.onclickFn = config.onclick; + this.selectedOnclickFn = image.onclick; + this.label = image.label; + var parent = image.parentNode; + this.canvas = this.createImageCanvas(image,scaledWidth,scaledHeight,reflectionRatio, bgColor); + this.element = this.canvas.cloneNode(false); + this.element.id = this.id; + parent.replaceChild(this.element, image); - this.onSelected = new YAHOO.util.CustomEvent('onSelected', this); - this.onSelected.subscribe(this.handleOnclick); + this.onSelected = new YAHOO.util.CustomEvent('onSelected', this); + this.onSelected.subscribe(this.handleOnclick); - }, - - getLabel: function(){ - return this.label; - }, - - handleOnclick: function(){ - YAHOO.util.Event.removeListener(this.element, 'click'); - if(!this.selected){ - YAHOO.util.Event.addListener(this.element, 'click', this.onclickFn.fn, this, this.onclickFn.scope); - }else{ - if(this.selectedOnclickFn && this.selectedOnclickFn.fn) - YAHOO.util.Event.addListener(this.element, 'click', this.selectedOnclickFn.fn, this, this.selectedOnclickFn.scope); - else - YAHOO.util.Event.addListener(this.element, 'click', this.selectedOnclickFn); - } - }, - - isSelected: function(selected){ - this.selected = selected; - this.onSelected.fire(); - }, - - setAngle: function(angle){ - this.angle = angle; - }, - - getAngle: function(){ - return this.angle; - }, - - setTop: function(top){ - this.element.style.top = top + 'px'; - }, - - setLeft: function(left){ - this.element.style.left = left + 'px'; - }, - - getLeft: function(){ - var ret = this.element.style.left; - return new Number(ret.replace("px", "")); - }, - - getZIndex: function(){ - return this.element.style.zIndex; - }, - - setZIndex: function(zIndex){ - this.element.style.zIndex = zIndex; - }, - - createImageCanvas: function(image, sWidth, sHeight, reflectionRatio, bgColor){ + }, + + getLabel: function(){ + return this.label; + }, + + handleOnclick: function(){ + YAHOO.util.Event.removeListener(this.element, 'click'); + if(!this.selected){ + YAHOO.util.Event.addListener(this.element, 'click', this.onclickFn.fn, this, this.onclickFn.scope); + }else{ + if(this.selectedOnclickFn && this.selectedOnclickFn.fn) + YAHOO.util.Event.addListener(this.element, 'click', this.selectedOnclickFn.fn, this, this.selectedOnclickFn.scope); + else + YAHOO.util.Event.addListener(this.element, 'click', this.selectedOnclickFn); + } + }, + + isSelected: function(selected){ + this.selected = selected; + this.onSelected.fire(); + }, + + setAngle: function(angle){ + this.angle = angle; + }, + + getAngle: function(){ + return this.angle; + }, + + setTop: function(top){ + this.element.style.top = top + 'px'; + }, + + setLeft: function(left){ + this.element.style.left = left + 'px'; + }, + + getLeft: function(){ + var ret = this.element.style.left; + return new Number(ret.replace("px", "")); + }, + + getZIndex: function(){ + return this.element.style.zIndex; + }, + + setZIndex: function(zIndex){ + this.element.style.zIndex = zIndex; + }, + + createImageCanvas: function(image, sWidth, sHeight, reflectionRatio, bgColor){ - var imageCanvas = document.createElement('canvas'); + var imageCanvas = document.createElement('canvas'); - if(imageCanvas.getContext){ + if(imageCanvas.getContext){ - var scaledWidth = sWidth; - var scaledHeight = sHeight; - var reflectionHeight = scaledHeight * reflectionRatio; + var scaledWidth = sWidth; + var scaledHeight = sHeight; + var reflectionHeight = scaledHeight * reflectionRatio; - imageCanvas.height = scaledHeight + reflectionHeight; - imageCanvas.width = scaledWidth; + imageCanvas.height = scaledHeight + reflectionHeight; + imageCanvas.width = scaledWidth; - var ctx = imageCanvas.getContext('2d'); + var ctx = imageCanvas.getContext('2d'); - ctx.clearRect(0, 0, imageCanvas.width, imageCanvas.height); - ctx.globalCompositeOperation = 'source-over'; - ctx.fillStyle = 'rgba(0, 0, 0, 1)'; - ctx.fillRect(0, 0, imageCanvas.width, imageCanvas.height); + ctx.clearRect(0, 0, imageCanvas.width, imageCanvas.height); + ctx.globalCompositeOperation = 'source-over'; + ctx.fillStyle = 'rgba(0, 0, 0, 1)'; + ctx.fillRect(0, 0, imageCanvas.width, imageCanvas.height); - //draw the reflection image - ctx.save(); - ctx.translate(0, (2*scaledHeight)); - ctx.scale(1, -1); - ctx.drawImage(image, 0, 0, scaledWidth, scaledHeight); - ctx.restore(); - //create the gradient effect - ctx.save(); - ctx.translate(0, scaledHeight); - ctx.globalCompositeOperation = 'destination-out'; - var grad = ctx.createLinearGradient( 0, 0, 0, scaledHeight); - grad.addColorStop(1, 'rgba(0, 0, 0, 1)'); - grad.addColorStop(0, 'rgba(0, 0, 0, 0.75)'); - ctx.fillStyle = grad; - ctx.fillRect(0, 0, scaledWidth, scaledHeight); - //apply the background color to the gradient - ctx.globalCompositeOperation = 'destination-over'; - ctx.fillStyle = bgColor; '#000'; - ctx.globalAlpha = 0.8; - ctx.fillRect(0, 0 , scaledWidth, scaledHeight); - ctx.restore(); - //draw the image - ctx.save(); - ctx.translate(0, 0); - ctx.globalCompositeOperation = 'source-over'; - ctx.drawImage(image, 0, 0, scaledWidth, scaledHeight); - ctx.restore(); + //draw the reflection image + ctx.save(); + ctx.translate(0, (2*scaledHeight)); + ctx.scale(1, -1); + ctx.drawImage(image, 0, 0, scaledWidth, scaledHeight); + ctx.restore(); + //create the gradient effect + ctx.save(); + ctx.translate(0, scaledHeight); + ctx.globalCompositeOperation = 'destination-out'; + var grad = ctx.createLinearGradient( 0, 0, 0, scaledHeight); + grad.addColorStop(1, 'rgba(0, 0, 0, 1)'); + grad.addColorStop(0, 'rgba(0, 0, 0, 0.75)'); + ctx.fillStyle = grad; + ctx.fillRect(0, 0, scaledWidth, scaledHeight); + //apply the background color to the gradient + ctx.globalCompositeOperation = 'destination-over'; + ctx.fillStyle = bgColor; + '#000'; + ctx.globalAlpha = 0.8; + ctx.fillRect(0, 0 , scaledWidth, scaledHeight); + ctx.restore(); + //draw the image + ctx.save(); + ctx.translate(0, 0); + ctx.globalCompositeOperation = 'source-over'; + ctx.drawImage(image, 0, 0, scaledWidth, scaledHeight); + ctx.restore(); - return imageCanvas; - } - }, - - drawInPerspective: function(direction, frameSize){ - var canvas = this.element; - var image = this.canvas; - var angle = Math.ceil(this.angle); - var ctx; - var originalWidth = image.width; - var originalHeight = image.height; - var destinationWidth = destinationWidth || originalWidth; // for future use - var destinationHeight = destinationHeight || originalHeight; // for future use + return imageCanvas; + } + }, + + drawInPerspective: function(direction, frameSize){ + var canvas = this.element; + var image = this.canvas; + var angle = Math.ceil(this.angle); + var ctx; + var originalWidth = image.width; + var originalHeight = image.height; + var destinationWidth = destinationWidth || originalWidth; // for future use + var destinationHeight = destinationHeight || originalHeight; // for future use - var perspectiveCanvas = document.createElement('canvas'); - perspectiveCanvas.height = destinationHeight; - perspectiveCanvas.width = destinationWidth; - var perspectiveCtx = perspectiveCanvas.getContext('2d'); + var perspectiveCanvas = document.createElement('canvas'); + perspectiveCanvas.height = destinationHeight; + perspectiveCanvas.width = destinationWidth; + var perspectiveCtx = perspectiveCanvas.getContext('2d'); - var alpha = angle * Math.PI/180; // Math uses radian + var alpha = angle * Math.PI/180; // Math uses radian - if(alpha > 0){ // if we have an angle greater than 0 then apply the perspective - var right = (direction == CoverFlow.RIGHT); + if(alpha > 0){ // if we have an angle greater than 0 then apply the perspective + var right = (direction == CoverFlow.RIGHT); - var initialX=0, finalX=0, initialY=0, finalY=0; + var initialX=0, finalX=0, initialY=0, finalY=0; - frameSize = frameSize || 1; - var xDes, yDes; - var heightDes, widthDes; - var perspectiveWidht = destinationWidth; + frameSize = frameSize || 1; + var xDes, yDes; + var heightDes, widthDes; + var perspectiveWidht = destinationWidth; - var frameFactor = frameSize / originalWidth; - var frames = Math.floor(originalWidth / frameSize); + var frameFactor = frameSize / originalWidth; + var frames = Math.floor(originalWidth / frameSize); - var widthSrc = frameSize ; - var heightSrc = originalHeight; + var widthSrc = frameSize ; + var heightSrc = originalHeight; - for(var i=0; i < frames; i++){ - var xSrc = (i) * frameSize; - var ySrc = 0; - var betaTan = 0; - width = destinationWidth * (i) * frameFactor; - horizon = destinationHeight / 2; + for(var i=0; i < frames; i++){ + var xSrc = (i) * frameSize; + var ySrc = 0; + var betaTan = 0; + width = destinationWidth * (i) * frameFactor; + horizon = destinationHeight / 2; - if(right){ - betaTan = horizon/((Math.tan(alpha)*horizon) + width); - xDes = (betaTan*width)/(Math.tan(alpha) + betaTan); - yDes = Math.tan(alpha) * xDes; + if(right){ + betaTan = horizon/((Math.tan(alpha)*horizon) + width); + xDes = (betaTan*width)/(Math.tan(alpha) + betaTan); + yDes = Math.tan(alpha) * xDes; - if(i == frames -1){ - finalX=xDes; - finalY=yDes; - } - }else{ - betaTan = horizon/((Math.tan(alpha)*horizon) +(destinationWidth-width)); - xDes = (Math.tan(alpha)*(destinationWidth) + (betaTan * width))/(Math.tan(alpha) + betaTan); - yDes = -Math.tan(alpha)*xDes + (Math.tan(alpha)*(destinationWidth)); + if(i == frames -1){ + finalX=xDes; + finalY=yDes; + } + }else{ + betaTan = horizon/((Math.tan(alpha)*horizon) +(destinationWidth-width)); + xDes = (Math.tan(alpha)*(destinationWidth) + (betaTan * width))/(Math.tan(alpha) + betaTan); + yDes = -Math.tan(alpha)*xDes + (Math.tan(alpha)*(destinationWidth)); - if(i == 0){ - initialX = xDes; - initialY = yDes; - finalX = destinationWidth; - finalY = 0; - } - } + if(i == 0){ + initialX = xDes; + initialY = yDes; + finalX = destinationWidth; + finalY = 0; + } + } - heightDes = destinationHeight - (2*yDes); - widthDes = heightDes / destinationHeight * destinationWidth; + heightDes = destinationHeight - (2*yDes); + widthDes = heightDes / destinationHeight * destinationWidth; - perspectiveCtx.drawImage(image, xSrc, ySrc, widthSrc, heightSrc, xDes, yDes, widthDes, heightDes); + perspectiveCtx.drawImage(image, xSrc, ySrc, widthSrc, heightSrc, xDes, yDes, widthDes, heightDes); - } + } - perspectiveWidth = finalX - initialX; - originalCanvasWidth = destinationWidth; - canvas.width = perspectiveWidth; + perspectiveWidth = finalX - initialX; + originalCanvasWidth = destinationWidth; + canvas.width = perspectiveWidth; - ctx = canvas.getContext('2d'); + ctx = canvas.getContext('2d'); - //remove exceeded pixels - ctx.beginPath(); - if(right){ - ctx.moveTo(0, 0); - ctx.lineTo(finalX, finalY); - ctx.lineTo(finalX, finalY + (destinationHeight - 2*finalY)); - ctx.lineTo(0, destinationHeight); - ctx.lineTo(0,0); - }else{ - var initialX1 = initialX - (originalCanvasWidth - perspectiveWidth); - var finalX1 = finalX - (originalCanvasWidth - perspectiveWidth); - ctx.moveTo(0, initialY); - ctx.lineTo(finalX1, finalY); - ctx.lineTo(finalX1, destinationHeight); - ctx.lineTo(initialX1, initialY + (destinationHeight - 2*initialY)); - ctx.lineTo(0, initialY); - } - ctx.closePath(); - ctx.clip(); + //remove exceeded pixels + ctx.beginPath(); + if(right){ + ctx.moveTo(0, 0); + ctx.lineTo(finalX, finalY); + ctx.lineTo(finalX, finalY + (destinationHeight - 2*finalY)); + ctx.lineTo(0, destinationHeight); + ctx.lineTo(0,0); + }else{ + var initialX1 = initialX - (originalCanvasWidth - perspectiveWidth); + var finalX1 = finalX - (originalCanvasWidth - perspectiveWidth); + ctx.moveTo(0, initialY); + ctx.lineTo(finalX1, finalY); + ctx.lineTo(finalX1, destinationHeight); + ctx.lineTo(initialX1, initialY + (destinationHeight - 2*initialY)); + ctx.lineTo(0, initialY); + } + ctx.closePath(); + ctx.clip(); - ctx.drawImage(perspectiveCanvas, initialX, 0, perspectiveWidth, destinationHeight, 0, 0, perspectiveWidth, destinationHeight); + ctx.drawImage(perspectiveCanvas, initialX, 0, perspectiveWidth, destinationHeight, 0, 0, perspectiveWidth, destinationHeight); - }else{ + }else{ - canvas.width = perspectiveCanvas.width; - canvas.height = perspectiveCanvas.height; - perspectiveCtx.drawImage(image, 0, 0, originalWidth, originalHeight, 0, 0, destinationWidth, destinationHeight); - ctx = canvas.getContext('2d'); - ctx.clearRect(0, 0, canvas.width, canvas.height); - ctx.drawImage(perspectiveCanvas, 0, 0); - } - } - - }; + canvas.width = perspectiveCanvas.width; + canvas.height = perspectiveCanvas.height; + perspectiveCtx.drawImage(image, 0, 0, originalWidth, originalHeight, 0, 0, destinationWidth, destinationHeight); + ctx = canvas.getContext('2d'); + ctx.clearRect(0, 0, canvas.width, canvas.height); + ctx.drawImage(perspectiveCanvas, 0, 0); + } + } + +}; - /** +/** * @class CoverFlowAnimation * @requires YAHOO.util.AnimMgr */ - CoverFlowAnimation = function(config, animationItems, duration){ - this.init(config, animationItems, duration); - }; +CoverFlowAnimation = function(config, animationItems, duration){ + this.init(config, animationItems, duration); +}; - CoverFlowAnimation.prototype = { - direction: null, +CoverFlowAnimation.prototype = { + direction: null, - center: null, + center: null, - startLeftPos: null, + startLeftPos: null, - startRightPos: null, + startRightPos: null, - animationItems: null, + animationItems: null, - method : YAHOO.util.Easing.easeNone, + method : YAHOO.util.Easing.easeNone, - animated: false, + animated: false, - startTime: null, + startTime: null, - actualFrames : 0, + actualFrames : 0, - useSeconds : true, // default to seconds + useSeconds : true, // default to seconds - currentFrame : 0, + currentFrame : 0, - totalFrames : YAHOO.util.AnimMgr.fps, + totalFrames : YAHOO.util.AnimMgr.fps, - init: function(config, animationItems, duration){ - this.direction = config.direction; - this.center = config.center; - this.startLeftPos = config.startLeftPos; - this.startRightPos = config.startRightPos; - this.animationItems = animationItems; - this.duration = duration || 1; - this.registerEvents(); - }, - - registerEvents: function(){ - /** + init: function(config, animationItems, duration){ + this.direction = config.direction; + this.center = config.center; + this.startLeftPos = config.startLeftPos; + this.startRightPos = config.startRightPos; + this.animationItems = animationItems; + this.duration = duration || 1; + this.registerEvents(); + }, + + registerEvents: function(){ + /** * Custom event that fires after onStart, useful in subclassing * @private */ - this._onStart = new YAHOO.util.CustomEvent('_start', this, true); + this._onStart = new YAHOO.util.CustomEvent('_start', this, true); - /** + /** * Custom event that fires when animation begins * Listen via subscribe method (e.g. myAnim.onStart.subscribe(someFunction) * @event onStart */ - this.onStart = new YAHOO.util.CustomEvent('start', this); + this.onStart = new YAHOO.util.CustomEvent('start', this); - /** + /** * Custom event that fires between each frame * Listen via subscribe method (e.g. myAnim.onTween.subscribe(someFunction) * @event onTween */ - this.onTween = new YAHOO.util.CustomEvent('tween', this); + this.onTween = new YAHOO.util.CustomEvent('tween', this); - /** + /** * Custom event that fires after onTween * @private */ - this._onTween = new YAHOO.util.CustomEvent('_tween', this, true); + this._onTween = new YAHOO.util.CustomEvent('_tween', this, true); - /** + /** * Custom event that fires when animation ends * Listen via subscribe method (e.g. myAnim.onComplete.subscribe(someFunction) * @event onComplete */ - this.onComplete = new YAHOO.util.CustomEvent('complete', this); - /** + this.onComplete = new YAHOO.util.CustomEvent('complete', this); + /** * Custom event that fires after onComplete * @private */ - this._onComplete = new YAHOO.util.CustomEvent('_complete', this, true); + this._onComplete = new YAHOO.util.CustomEvent('_complete', this, true); - this._onStart.subscribe(this.doOnStart); - this._onTween.subscribe(this.doOnTween); - this._onComplete.subscribe(this.doOnComplete); + this._onStart.subscribe(this.doOnStart); + this._onTween.subscribe(this.doOnTween); + this._onComplete.subscribe(this.doOnComplete); - }, + }, - isAnimated : function() { - return this.animated; - }, + isAnimated : function() { + return this.animated; + }, - getStartTime : function() { - return this.startTime; - }, + getStartTime : function() { + return this.startTime; + }, - doMethod: function(start, end) { - return this.method(this.currentFrame, start, end - start, this.totalFrames); - }, + doMethod: function(start, end) { + return this.method(this.currentFrame, start, end - start, this.totalFrames); + }, - animate : function() { - if ( this.isAnimated() ) { - return false; - } + animate : function() { + if ( this.isAnimated() ) { + return false; + } - this.currentFrame = 0; + this.currentFrame = 0; - this.totalFrames = ( this.useSeconds ) ? Math.ceil(YAHOO.util.AnimMgr.fps * this.duration) : this.duration; + this.totalFrames = ( this.useSeconds ) ? Math.ceil(YAHOO.util.AnimMgr.fps * this.duration) : this.duration; - if (this.duration === 0 && this.useSeconds) { // jump to last frame if zero second duration - this.totalFrames = 1; - } - YAHOO.util.AnimMgr.registerElement(this); - return true; - }, + if (this.duration === 0 && this.useSeconds) { // jump to last frame if zero second duration + this.totalFrames = 1; + } + YAHOO.util.AnimMgr.registerElement(this); + return true; + }, - stop : function(finish) { - if (!this.isAnimated()) { // nothing to stop - return false; - } + stop : function(finish) { + if (!this.isAnimated()) { // nothing to stop + return false; + } - if (finish) { - this.currentFrame = this.totalFrames; - this._onTween.fire(); - } - YAHOO.util.AnimMgr.stop(this); - }, + if (finish) { + this.currentFrame = this.totalFrames; + this._onTween.fire(); + } + YAHOO.util.AnimMgr.stop(this); + }, - doOnStart : function() { - this.onStart.fire(); + doOnStart : function() { + this.onStart.fire(); - this.runtimeItems = []; - for (var i=0; i 0){ - runtimeItem.attribute[attr].perspectiveDirection = this.direction; - runtimeItem.attribute[attr].center = true; - }else{ - runtimeItem.attribute[attr].perspectiveDirection = this.direction == CoverFlow.RIGHT ? CoverFlow.LEFT : CoverFlow.RIGHT; - runtimeItem.attribute[attr].center = false; - } - } - } - this.runtimeItems.push(runtimeItem); - }, + setRuntimeItem: function(item){ + var runtimeItem = {}; + runtimeItem.item = item.item; + runtimeItem.attribute = {}; + for(var attr in item.attribute){ + runtimeItem.attribute[attr] = item.attribute[attr]; + if(attr == 'angle'){ + if(item.attribute[attr].start - item.attribute[attr].end > 0){ + runtimeItem.attribute[attr].perspectiveDirection = this.direction; + runtimeItem.attribute[attr].center = true; + }else{ + runtimeItem.attribute[attr].perspectiveDirection = this.direction == CoverFlow.RIGHT ? CoverFlow.LEFT : CoverFlow.RIGHT; + runtimeItem.attribute[attr].center = false; + } + } + } + this.runtimeItems.push(runtimeItem); + }, - setItemAttributes: function(item){ + setItemAttributes: function(item){ - for(var attr in item.attribute){ + for(var attr in item.attribute){ - var value = Math.ceil(this.doMethod(item.attribute[attr].start, item.attribute[attr].end)); + var value = Math.ceil(this.doMethod(item.attribute[attr].start, item.attribute[attr].end)); - if(attr == 'angle'){ - item.item.setAngle(value); - var frameSize = Math.ceil(this.doMethod(3, 1)); - item.item.drawInPerspective(item.attribute[attr].perspectiveDirection, frameSize); - var left; - if(item.attribute[attr].center){ - left = this.doMethod(item.item.getLeft(), this.center - item.item.element.width/2); - }else{ - if(this.direction == CoverFlow.LEFT) - left = this.doMethod(item.item.getLeft(), this.startLeftPos - item.item.element.width); - else - left = this.doMethod(item.item.getLeft(), this.startRightPos); - } - item.item.setLeft(Math.ceil(left)); + if(attr == 'angle'){ + item.item.setAngle(value); + var frameSize = Math.ceil(this.doMethod(3, 1)); + item.item.drawInPerspective(item.attribute[attr].perspectiveDirection, frameSize); + var left; + if(item.attribute[attr].center){ + left = this.doMethod(item.item.getLeft(), this.center - item.item.element.width/2); + }else{ + if(this.direction == CoverFlow.LEFT) + left = this.doMethod(item.item.getLeft(), this.startLeftPos - item.item.element.width); + else + left = this.doMethod(item.item.getLeft(), this.startRightPos); + } + item.item.setLeft(Math.ceil(left)); - }else{ - item.item.setLeft(value); - } - } + }else{ + item.item.setLeft(value); + } } - }; + } +}; //}); \ No newline at end of file diff --git a/collection_views/yui_coverflow/js/test.js b/collection_views/yui_coverflow/js/test.js index 7ba4d637..e200d949 100644 --- a/collection_views/yui_coverflow/js/test.js +++ b/collection_views/yui_coverflow/js/test.js @@ -3,34 +3,83 @@ YAHOO.util.Event.onDOMReady(function(){ - var images = [ - {src: 'images/ardillitaMac.jpg', label: 'Ardileta!', onclick: function(){alert('image1');}}, - {src: 'http://farm2.static.flickr.com/1380/1426855399_b4b8eccbdb.jpg?v=0'}, - {src: 'http://farm1.static.flickr.com/69/213130158_0d1aa23576_d.jpg'}, - {src: 'http://farm1.static.flickr.com/69/213130158_0d1aa23576_d.jpg'}, - {src: 'images/msn2.jpg', label: 'My Mac'}, - {src: 'images/msn2.jpg', label: 'My Mac again...'} + var images = [ + { + src: 'images/ardillitaMac.jpg', + label: 'Ardileta!', + onclick: function(){ + alert('image1'); + } + }, +{ + src: 'http://farm2.static.flickr.com/1380/1426855399_b4b8eccbdb.jpg?v=0' +}, +{ + src: 'http://farm1.static.flickr.com/69/213130158_0d1aa23576_d.jpg' +}, +{ + src: 'http://farm1.static.flickr.com/69/213130158_0d1aa23576_d.jpg' +}, +{ + src: 'images/msn2.jpg', + label: 'My Mac' +}, +{ + src: 'images/msn2.jpg', + label: 'My Mac again...' +} - ]; - var myCoverFlow = new YAHOO.ext.CoverFlow('coverFlowTest', {height: 200, width: 600, images: images}); - - function moveLeft(e, coverFlow){ - coverFlow.selectNext(); - } - function moveRight(e, coverFlow){ - coverFlow.selectPrevious(); - } - var myMoveLeftBtn = new YAHOO.widget.Button('moveLeftButton', {onclick: {fn: moveLeft, obj: myCoverFlow}}); - var myMoveRightBtn = new YAHOO.widget.Button('moveRightButton', {onclick: {fn: moveRight, obj: myCoverFlow}}); +]; +var myCoverFlow = new YAHOO.ext.CoverFlow('coverFlowTest', { + height: 200, + width: 600, + images: images +}); + +function moveLeft(e, coverFlow){ + coverFlow.selectNext(); +} +function moveRight(e, coverFlow){ + coverFlow.selectPrevious(); +} +var myMoveLeftBtn = new YAHOO.widget.Button('moveLeftButton', { + onclick: { + fn: moveLeft, + obj: myCoverFlow + } +}); +var myMoveRightBtn = new YAHOO.widget.Button('moveRightButton', { + onclick: { + fn: moveRight, + obj: myCoverFlow + } +}); - var otherImages = [ - {src: 'images/ardillitaMac.jpg', label: 'Ardileta!', onclick: function(){alert('image1');}}, - {src: 'images/msn2.jpg', label: 'My Mac'}, - {src: 'images/msn2.jpg', label: 'My Mac again...'} +var otherImages = [ +{ + src: 'images/ardillitaMac.jpg', + label: 'Ardileta!', + onclick: function(){ + alert('image1'); + } +}, +{ + src: 'images/msn2.jpg', + label: 'My Mac' +}, +{ + src: 'images/msn2.jpg', + label: 'My Mac again...' +} - ]; - var anotherCoverFlow = new YAHOO.ext.CoverFlow('anotherCoverFlowTest', {height: 150, width: 500, images: otherImages, bgColor: '#C0C0C0'}); +]; +var anotherCoverFlow = new YAHOO.ext.CoverFlow('anotherCoverFlowTest', { + height: 150, + width: 500, + images: otherImages, + bgColor: '#C0C0C0' +}); diff --git a/content_models/BASIC_AUDIO.xml b/content_models/BASIC_AUDIO.xml deleted file mode 100644 index e3030f9f..00000000 --- a/content_models/BASIC_AUDIO.xml +++ /dev/null @@ -1,218 +0,0 @@ - - - - video/quicktime - - - - - plugins/qt_viewer.inc - ShowQtStreamsInFieldSets - showQt - - - - - plugins/ShowStreamsInFieldSets.inc - ShowStreamsInFieldSets - showQdc - - - - - - - - video/quicktime - - - - - - - plugins/QtFormBuilder.php - QtFormBuilder - buildQDCForm - handleQDCForm - - - - - - dc:title - textfield - The name given to the Video - true - - - - dc:creator - textfield - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - dc:subject - select - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - home recording - home recording - - - meeting - meeting - - - presentation - presentation - - - sound - sound - - - - - - - dc:description - textarea - Examples include an abstract, table of contents, or free-text account of the content of the resource. - true - - - - dc:publisher - textfield - An entity, (including persons, organizations, or services), responsible for making the resource available. - false - - - - dc:contributor - textfield - An entity responsible for contributing to the content of the resource such as a person, organization or service. - false - - - - dc:date - textfield - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - false - - - - dc:type - select - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - false - - - none - none - - - video - video - - - - event - event - - - image - image - - - interactive resource - interactive resource - - - model - model - - - party - party - - - physical object - physical object - - - place - place - - - service - service - - - software - software - - - sound - sound - - - text - text - - - - - - dc:source - textfield - A reference to a resource from which the present resource is derived. - false - - - - dc:identifier - textfield - A unique reference to the resource; In this instance, the accession number or collection number. - false - - - - dc:language - select - The language of the intellectual content of the resource. - false - - - eng - English - - - fre - French - - - - - - dc:relation - textfield - Reference to a related resource. - false - - - - dc:rights - textarea - Information about intellectual property rights, copyright, and various property rights. - false - - - - diff --git a/content_models/BASIC_VIDEO.xml b/content_models/BASIC_VIDEO.xml deleted file mode 100644 index e3030f9f..00000000 --- a/content_models/BASIC_VIDEO.xml +++ /dev/null @@ -1,218 +0,0 @@ - - - - video/quicktime - - - - - plugins/qt_viewer.inc - ShowQtStreamsInFieldSets - showQt - - - - - plugins/ShowStreamsInFieldSets.inc - ShowStreamsInFieldSets - showQdc - - - - - - - - video/quicktime - - - - - - - plugins/QtFormBuilder.php - QtFormBuilder - buildQDCForm - handleQDCForm - - - - - - dc:title - textfield - The name given to the Video - true - - - - dc:creator - textfield - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - dc:subject - select - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - home recording - home recording - - - meeting - meeting - - - presentation - presentation - - - sound - sound - - - - - - - dc:description - textarea - Examples include an abstract, table of contents, or free-text account of the content of the resource. - true - - - - dc:publisher - textfield - An entity, (including persons, organizations, or services), responsible for making the resource available. - false - - - - dc:contributor - textfield - An entity responsible for contributing to the content of the resource such as a person, organization or service. - false - - - - dc:date - textfield - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - false - - - - dc:type - select - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - false - - - none - none - - - video - video - - - - event - event - - - image - image - - - interactive resource - interactive resource - - - model - model - - - party - party - - - physical object - physical object - - - place - place - - - service - service - - - software - software - - - sound - sound - - - text - text - - - - - - dc:source - textfield - A reference to a resource from which the present resource is derived. - false - - - - dc:identifier - textfield - A unique reference to the resource; In this instance, the accession number or collection number. - false - - - - dc:language - select - The language of the intellectual content of the resource. - false - - - eng - English - - - fre - French - - - - - - dc:relation - textfield - Reference to a related resource. - false - - - - dc:rights - textarea - Information about intellectual property rights, copyright, and various property rights. - false - - - - diff --git a/content_models/COLLECTIONCM.xml b/content_models/COLLECTIONCM.xml index d20711c9..91d6f8f9 100644 --- a/content_models/COLLECTIONCM.xml +++ b/content_models/COLLECTIONCM.xml @@ -1,88 +1,89 @@ + - - text/xml - text/plain - application/xml - - - - - - - - - - - - - - The name given to the resource - - - An entity primarily responsible for making the content of the resource such as a person, organization or service. - - - An entity primarily responsible for making the content of the resource such as a person, organization or service. - - none - Multi Media - image - meeting - presentation - sound - text - - - - Examples include an abstract, table of contents, or free-text account of the content of the resource. - - - An entity, (including persons, organizations, or services), responsible for making the resource available. - - - An entity responsible for contributing to the content of the resource such as a person, organization or service. - - - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - - - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - - none - collection - dataset - event - image - interactive resource - model - party - physical object - place - service - software - sound - text - - - - A reference to a resource from which the present resource is derived. - - - A unique reference to the resource; In this instance, the accession number or collection number. - - - The language of the intellectual content of the resource. - - English - French - - - - Reference to a related resource. - - - Information about intellectual property rights, copyright, and various property rights. - - - + + text/xml + text/plain + application/xml + + + + + + + + + + + + + + The name given to the resource + + + An entity primarily responsible for making the content of the resource such as a person, organization or service. + + + An entity primarily responsible for making the content of the resource such as a person, organization or service. + + none + Multi Media + image + meeting + presentation + sound + text + + + + Examples include an abstract, table of contents, or free-text account of the content of the resource. + + + An entity, (including persons, organizations, or services), responsible for making the resource available. + + + An entity responsible for contributing to the content of the resource such as a person, organization or service. + + + Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) + + + Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. + + none + collection + dataset + event + image + interactive resource + model + party + physical object + place + service + software + sound + text + + + + A reference to a resource from which the present resource is derived. + + + A unique reference to the resource; In this instance, the accession number or collection number. + + + The language of the intellectual content of the resource. + + English + French + + + + Reference to a related resource. + + + Information about intellectual property rights, copyright, and various property rights. + + + diff --git a/content_models/CRITTERS.xml b/content_models/CRITTERS.xml deleted file mode 100644 index c06e6b51..00000000 --- a/content_models/CRITTERS.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - plugins/ShowStreamsInFieldSets.inc - ShowStreamsInFieldSets - showQdc - - - - - plugins/ShowStreamsInFieldSets.inc - ShowStreamsInFieldSets - showCritter - - - - - text/xml - text/plain - application/xml - - - - - - text/xml - - - text/plain - - - - application/xml - - - - - - - dis1 - - - - 200 - - - - - - - - text/xml - - - - addCritterToDCStream - critter - - - another XMLFile - - someotherstream - - - - - - - plugins/Refworks.inc - Refworks - - buildForm - handleForm - - - - - - - hiddenvalue - hidden - hidden - We now have all the information we need to ingest. - The name given to the resource - false - - - - - - - - - - dc.title - - - - - - - diff --git a/content_models/FAS_slideCModel.xml b/content_models/FAS_slideCModel.xml deleted file mode 100644 index 5d37ba49..00000000 --- a/content_models/FAS_slideCModel.xml +++ /dev/null @@ -1,166 +0,0 @@ - - - image/tiff - image/tif - - - - - plugins/slide_viewer.inc - ShowSlideStreamsInFieldSets - showJPG - - - - - - - - - - image/tiff - - - image/tif - - - - plugins/ImageManipulation.inc - ImageManipulation - createJP2 - jp2 - JP2 - - - - - - - plugins/DemoFormBuilder.inc - DemoFormBuilder - buildQDCForm - handleQDCForm - - - - - dc:title - textfield - The name given to the resource - true - - - - dc:creator - textfield - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - dc:subject - select - Subject - false - - - image - image - - - photograph - photograph - - - presentation - presentation - - - art - art - - - - - - dc:description - textarea - Description of the Image - true - - - - dc:publisher - textfield - An entity, (including persons, organizations, or services), responsible for making the resource available. - false - - - - dc:contributor - textfield - An entity responsible for contributing to the content of the resource such as a person, organization or service. - false - - - - dc:date - textfield - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - false - - - - dc:type - textfield - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - false - - - - dc:source - textfield - A reference to a resource from which the present resource is derived. - false - - - - dc:identifier - textfield - A unique reference to the resource; In this instance, the accession number or collection number. - false - - - - dc:language - select - The language of the intellectual content of the resource. - false - - - eng - English - - - fre - French - - - - - - dc:relation - textfield - Reference to a related resource. - false - - - - dc:rights - textarea - Information about intellectual property rights, copyright, and various property rights. - false - - - - diff --git a/content_models/REFWORKSCM.xml b/content_models/REFWORKSCM.xml deleted file mode 100644 index 6948278c..00000000 --- a/content_models/REFWORKSCM.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - plugins/ShowStreamsInFieldSets.inc - ShowStreamsInFieldSets - showQdc - - - - - plugins/ShowStreamsInFieldSets.inc - ShowStreamsInFieldSets - showRefworks - - - - - plugins/ShowStreamsInFieldSets.inc - ShowStreamsInFieldSets - showRomeo - - - - - - - - - - - text/xml - text/plain - application/xml - - - - - text/xml - - - text/plain - - - application/xml - - - - - - - - - - - plugins/Refworks.inc - Refworks - buildForm - handleForm - - - - - - hiddenvalue - hidden - hidden - We now have all the information we need to ingest. - The name given to the resource - false - - - - - diff --git a/content_models/REFWORKSCM_1.xml b/content_models/REFWORKSCM_1.xml deleted file mode 100644 index 6948278c..00000000 --- a/content_models/REFWORKSCM_1.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - plugins/ShowStreamsInFieldSets.inc - ShowStreamsInFieldSets - showQdc - - - - - plugins/ShowStreamsInFieldSets.inc - ShowStreamsInFieldSets - showRefworks - - - - - plugins/ShowStreamsInFieldSets.inc - ShowStreamsInFieldSets - showRomeo - - - - - - - - - - - text/xml - text/plain - application/xml - - - - - text/xml - - - text/plain - - - application/xml - - - - - - - - - - - plugins/Refworks.inc - Refworks - buildForm - handleForm - - - - - - hiddenvalue - hidden - hidden - We now have all the information we need to ingest. - The name given to the resource - false - - - - - diff --git a/content_models/STANDARD JPG.xml b/content_models/STANDARD JPG.xml deleted file mode 100644 index 911b1f91..00000000 --- a/content_models/STANDARD JPG.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - image/jpeg - - - - image/jpeg - - - - 160 - 120 - - - - - 120 - 120 - - - - - - - - - - - - - - - - 120 - 160 - - - - - - - - - The name given to the resource - - - An entity primarily responsible for making the content of the resource such as a person, organization or service. - - - Subject - - image - photograph - presentation - art - - - - Description of the Image - - - An entity, (including persons, organizations, or services), responsible for making the resource available. - - - An entity responsible for contributing to the content of the resource such as a person, organization or service. - - - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - - - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - - - A reference to a resource from which the present resource is derived. - - - A unique reference to the resource; In this instance, the accession number or collection number. - - - The language of the intellectual content of the resource. - - English - French - - - - Reference to a related resource. - - - Information about intellectual property rights, copyright, and various property rights. - - - - \ No newline at end of file diff --git a/content_models/STANDARD PDF.xml b/content_models/STANDARD PDF.xml deleted file mode 100644 index 2880bc10..00000000 --- a/content_models/STANDARD PDF.xml +++ /dev/null @@ -1,236 +0,0 @@ - - - - application/pdf - - - - - application/pdf - - - - plugins/ImageManipulation.inc - ImageManipulation - createThumbnailFromPDF - jpg - TN - - 100 - 120 - - - - - - dis1 - - - 200 - - - - - - a868aef684fa34923d4fe697db1e785b - - - plugins/FormBuilder.inc - FormBuilder - buildQDCForm - handleQDCForm - - - - - - dc:title - textfield - The name given to the resource - true - - - - dc:creator - textfield - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - dc:subject - select - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - experiment session - experiment session - - - home recording - home recording - - - image - image - - - meeting - meeting - - - presentation - presentation - - - sound - sound - - - text - text - - - - - - dc:description - textarea - Examples include an abstract, table of contents, or free-text account of the content of the resource. - true - - - - dc:publisher - textfield - An entity, (including persons, organizations, or services), responsible for making the resource available. - false - - - - dc:contributor - textfield - An entity responsible for contributing to the content of the resource such as a person, organization or service. - false - - - - dc:date - textfield - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - false - - - - dc:type - select - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - false - - - none - none - - - collection - collection - - - dataset - dataset - - - event - event - - - image - image - - - interactive resource - interactive resource - - - model - model - - - party - party - - - physical object - physical object - - - place - place - - - service - service - - - software - software - - - sound - sound - - - text - text - - - - - - dc:source - textfield - A reference to a resource from which the present resource is derived. - false - - - - dc:identifier - textfield - A unique reference to the resource; In this instance, the accession number or collection number. - false - - - - dc:language - select - The language of the intellectual content of the resource. - false - - - eng - English - - - fre - French - - - - - - dc:relation - textfield - Reference to a related resource. - false - - - - dc:rights - textarea - Information about intellectual property rights, copyright, and various property rights. - false - - - - diff --git a/content_models/STANDARD_FLVCM.xml b/content_models/STANDARD_FLVCM.xml deleted file mode 100644 index 75a691b5..00000000 --- a/content_models/STANDARD_FLVCM.xml +++ /dev/null @@ -1,218 +0,0 @@ - - - - video/x-flv - - - - - plugins/ShowStreamsInFieldSets.inc - ShowStreamsInFieldSets - showFLV - - - - - plugins/ShowStreamsInFieldSets.inc - ShowStreamsInFieldSets - showQdc - - - - - - - - video/x-flv - - - - - - - plugins/FlvFormBuilder.inc - FlvFormBuilder - buildQDCForm - handleQDCForm - - - - - - dc:title - textfield - The name given to the Video - true - - - - dc:creator - textfield - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - dc:subject - select - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - home recording - home recording - - - meeting - meeting - - - presentation - presentation - - - sound - sound - - - - - - - dc:description - textarea - Examples include an abstract, table of contents, or free-text account of the content of the resource. - true - - - - dc:publisher - textfield - An entity, (including persons, organizations, or services), responsible for making the resource available. - false - - - - dc:contributor - textfield - An entity responsible for contributing to the content of the resource such as a person, organization or service. - false - - - - dc:date - textfield - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - false - - - - dc:type - select - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - false - - - none - none - - - video - video - - - - event - event - - - image - image - - - interactive resource - interactive resource - - - model - model - - - party - party - - - physical object - physical object - - - place - place - - - service - service - - - software - software - - - sound - sound - - - text - text - - - - - - dc:source - textfield - A reference to a resource from which the present resource is derived. - false - - - - dc:identifier - textfield - A unique reference to the resource; In this instance, the accession number or collection number. - false - - - - dc:language - select - The language of the intellectual content of the resource. - false - - - eng - English - - - fre - French - - - - - - dc:relation - textfield - Reference to a related resource. - false - - - - dc:rights - textarea - Information about intellectual property rights, copyright, and various property rights. - false - - - - diff --git a/content_models/STANDARD_IMAGECM.xml b/content_models/STANDARD_IMAGECM.xml deleted file mode 100644 index 635b745c..00000000 --- a/content_models/STANDARD_IMAGECM.xml +++ /dev/null @@ -1,271 +0,0 @@ - - - - image/jpeg - image/gif - image/png - image/tiff - image/tif - - - - - image/jpeg - - - image/gif - - - image/png - - - image/tiff - - - image/tif - - - - - plugins/ImageManipulation.inc - ImageManipulation - createThumbnail - jpg - TN - - 100 - 120 - - - - plugins/ImageManipulation.inc - ImageManipulation - createPNG - png - PNG - - - plugins/ImageManipulation.inc - ImageManipulation - createPreview - jpg - PRE - - 240 - 300 - - - - - - dis1 - - - 200 - - - - - - a868aef684fa34923d4fe697db1e785b - - - plugins/FormBuilder.inc - FormBuilder - buildQDCForm - handleQDCForm - - - - - - dc:title - textfield - The name given to the resource - true - - - - dc:creator - textfield - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - dc:subject - select - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - experiment session - experiment session - - - home recording - home recording - - - image - image - - - meeting - meeting - - - presentation - presentation - - - sound - sound - - - text - text - - - - - - dc:description - textarea - Examples include an abstract, table of contents, or free-text account of the content of the resource. - true - - - - dc:publisher - textfield - An entity, (including persons, organizations, or services), responsible for making the resource available. - false - - - - dc:contributor - textfield - An entity responsible for contributing to the content of the resource such as a person, organization or service. - false - - - - dc:date - textfield - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - false - - - - dc:type - select - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - false - - - none - none - - - collection - collection - - - dataset - dataset - - - event - event - - - image - image - - - interactive resource - interactive resource - - - model - model - - - party - party - - - physical object - physical object - - - place - place - - - service - service - - - software - software - - - sound - sound - - - text - text - - - - - - dc:source - textfield - A reference to a resource from which the present resource is derived. - false - - - - dc:identifier - textfield - A unique reference to the resource; In this instance, the accession number or collection number. - false - - - - dc:language - select - The language of the intellectual content of the resource. - false - - - eng - English - - - fre - French - - - - - - dc:relation - textfield - Reference to a related resource. - false - - - - dc:rights - textarea - Information about intellectual property rights, copyright, and various property rights. - false - - - - diff --git a/content_models/STANDARD_JPG.xml b/content_models/STANDARD_JPG.xml deleted file mode 100644 index 911b1f91..00000000 --- a/content_models/STANDARD_JPG.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - image/jpeg - - - - image/jpeg - - - - 160 - 120 - - - - - 120 - 120 - - - - - - - - - - - - - - - - 120 - 160 - - - - - - - - - The name given to the resource - - - An entity primarily responsible for making the content of the resource such as a person, organization or service. - - - Subject - - image - photograph - presentation - art - - - - Description of the Image - - - An entity, (including persons, organizations, or services), responsible for making the resource available. - - - An entity responsible for contributing to the content of the resource such as a person, organization or service. - - - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - - - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - - - A reference to a resource from which the present resource is derived. - - - A unique reference to the resource; In this instance, the accession number or collection number. - - - The language of the intellectual content of the resource. - - English - French - - - - Reference to a related resource. - - - Information about intellectual property rights, copyright, and various property rights. - - - - \ No newline at end of file diff --git a/content_models/STANDARD_QT.xml b/content_models/STANDARD_QT.xml deleted file mode 100644 index 5d95e27b..00000000 --- a/content_models/STANDARD_QT.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - video/quicktime - video/mp4 - - audio/mp3 - audio/x-aiff - - - - video/quicktime - video/mp4 - - audio/mp3 - audio/x-aiff - - - - - - - - - - - - - 92x92 - - - - - - - - - - - - - - - - - - - - - - The name given to the file - - - An entity primarily responsible for making the - content of the resource such as a person, organization or - service. - - - An entity primarily responsible for making the - content of the resource such as a person, organization or - service. - - home recording - meeting - presentation - sound - - - - Examples include an abstract, table of - contents, or free-text account of the content of the - resource. - - - An entity, (including persons, organizations, - or services), responsible for making the resource - available. - - - An entity responsible for contributing to the - content of the resource such as a person, organization or - service. - - - Temporal scope of the content if known. Date - format is YYYY-MM-DD (e.g. 1890,1910-10,or - 2007-10-23) - - - Genre of the content of the resource. Examples - include: home page, novel, poem, working paper, technical - report, essay, dictionary. - - none - video - event - image - interactive resource - model - party - physical object - place - service - software - sound - text - - - - A reference to a resource from which the - present resource is derived. - - - A unique reference to the resource; In this - instance, the accession number or collection - number. - - - The language of the intellectual content of - the resource. - - English - French - - - - Reference to a related resource. - - - Information about intellectual property - rights, copyright, and various property - rights. - - - - - diff --git a/content_models/STRICT_PDFCM.xml b/content_models/STRICT_PDFCM.xml deleted file mode 100644 index 313d4ca4..00000000 --- a/content_models/STRICT_PDFCM.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - application/pdf - - - - application/pdf - - - - 100 - 120 - - - - - - - - - - - - - 100 - 120 - - - - - - - - - The name given to the resource - - - An entity primarily responsible for making the content of the resource such as a person, organization or service. - - - An entity primarily responsible for making the content of the resource such as a person, organization or service. - - experiment session - home recording - image - meeting - presentation - sound - text - - - - Examples include an abstract, table of contents, or free-text account of the content of the resource. - - - An entity, (including persons, organizations, or services), responsible for making the resource available. - - - An entity responsible for contributing to the content of the resource such as a person, organization or service. - - - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - - - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - - none - collection - dataset - event - image - interactive resource - model - party - physical object - place - service - software - sound - text - - - - A reference to a resource from which the present resource is derived. - - - A unique reference to the resource; In this instance, the accession number or collection number. - - - The language of the intellectual content of the resource. - - English - French - - - - Reference to a related resource. - - - Information about intellectual property rights, copyright, and various property rights. - - - - diff --git a/content_models/demo_Collection.xml b/content_models/demo_Collection.xml deleted file mode 100644 index a2e804eb..00000000 --- a/content_models/demo_Collection.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2011-03-29T14:15:20.712Z - Ingested from local file /usr/local/fedora/client/demo/foxml/local-server-demos/image-collection-demo/sDefObjects/demo_Collection.xml - - - - - - - - - - Service Definition Object (Collection) for Image Collection Demo - demo:Collection - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/content_models/demo_CollectionImpl.xml b/content_models/demo_CollectionImpl.xml deleted file mode 100644 index b907afb9..00000000 --- a/content_models/demo_CollectionImpl.xml +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2011-03-29T14:15:20.819Z - Ingested from local file /usr/local/fedora/client/demo/foxml/local-server-demos/image-collection-demo/sDepObjects/demo_CollectionImpl.xml - - - - - - - - - - Service Deployment Object (Collection) for Image Collection Demo - demo:ImageCollectionImpl - demo:CollectionImpl - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - XSLT Binding - text/xml - - - - LIST Binding - text/xml - - - - QUERY Binding - text/plain - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/content_models/demo_DualResImage.xml b/content_models/demo_DualResImage.xml deleted file mode 100644 index 0bb7dd8c..00000000 --- a/content_models/demo_DualResImage.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2011-03-29T14:15:19.456Z - Ingested from local file /usr/local/fedora/client/demo/foxml/local-server-demos/image-collection-demo/cModelObjects/demo_DualResImage.xml - - - - - - - - - - Content Model Object (Image) for Image Collection Demo - demo:DualResImage - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - diff --git a/content_models/demo_DualResImageCollection.xml b/content_models/demo_DualResImageCollection.xml deleted file mode 100644 index f4e1962f..00000000 --- a/content_models/demo_DualResImageCollection.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2011-03-29T14:15:19.509Z - Ingested from local file /usr/local/fedora/client/demo/foxml/local-server-demos/image-collection-demo/cModelObjects/demo_DualResImageCollection.xml - - - - - - - - - - Content Model Object (Image Collection) for Image Collection Demo - demo:DualResImageCollection - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/content_models/demo_DualResImageImpl.xml b/content_models/demo_DualResImageImpl.xml deleted file mode 100644 index 36df937a..00000000 --- a/content_models/demo_DualResImageImpl.xml +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2011-03-29T14:15:20.881Z - Ingested from local file /usr/local/fedora/client/demo/foxml/local-server-demos/image-collection-demo/sDepObjects/demo_DualResImageImpl.xml - - - - - - - - - - Service Deployment Object (Image) for Image Collection Demo - demo:DualResImageImpl - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FULL_SIZE Binding - image/jpeg - - - - MEDIUM_SIZE Binding - image/jpeg - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/content_models/demo_DualResolution.xml b/content_models/demo_DualResolution.xml deleted file mode 100644 index 62348a34..00000000 --- a/content_models/demo_DualResolution.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2011-03-29T14:15:20.765Z - Ingested from local file /usr/local/fedora/client/demo/foxml/local-server-demos/image-collection-demo/sDefObjects/demo_DualResolution.xml - - - - - - - - - - Service Definition Object (Image) for Image Collection Demo - demo:DualResolution - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/content_models/ilives_bookCModel.xml b/content_models/ilives_bookCModel.xml deleted file mode 100644 index 8c52cc1d..00000000 --- a/content_models/ilives_bookCModel.xml +++ /dev/null @@ -1,675 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2009-11-12T14:56:58.331Z - Ingested from local file /Users/aoneill/dev/iiv/iiv/etc/fedora-objects/ilives_bookCModel.xml - - - - ingest - - fedoraAdmin - 2010-05-31T19:56:44.131Z - Ingested from source repository with pid ilives:bookCModel - - - - ingest - - fedoraAdmin - 2010-06-10T17:43:56.335Z - Ingested from local file /Users/aoneill/fedora_repository/content_models/ilives_bookCModel.xml - - - - addDatastream - ISLANDORACM - fedoraAdmin - 2010-06-10T19:01:39.144Z - DatastreamsPane generated this logMessage. - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-06-10T19:29:20.220Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-06-10T19:46:24.930Z - - - - - ingest - - fedoraAdmin - 2010-06-15T07:01:30.019Z - Ingested from local file /Users/al/fedora_repository/content_models/ilives_bookCModel.xml - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-06-16T08:56:09.156Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-06-16T08:59:35.673Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-06-16T08:59:52.831Z - - - - - addDatastream - MODS - fedoraAdmin - 2010-06-16T09:13:08.428Z - DatastreamsPane generated this logMessage. - - - - purgeDatastream - MODS - fedoraAdmin - 2010-06-16T09:13:32.732Z - DatastreamPane generated this logMessage. . . . Purged datastream (ID=MODS), versions ranging from 2010-06-16T06:13:08.428Z to 2010-06-16T06:13:08.428Z. This resulted in the permanent removal of 1 datastream version(s) (2010-06-16T06:13:08.428Z) and all associated audit records. - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-06-16T09:21:14.357Z - - - - - ingest - - fedoraAdmin - 2010-08-30T13:14:03.487Z - Ingested from local file /Users/aoneill/fedora_repository/ilives/xml/ilives_bookCModel.xml - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-11-26T15:24:13.742Z - - - - - - - - - - - - - - - - - - - - - - - - This DS-COMPOSITE-MODEL datastream is included as a starting point to - assist in the creation of a content model. The DS-COMPOSITE-MODEL - should define the datastreams that are required for any objects - conforming to this content model. - For more information about content models, see: - http://fedora-commons.org/confluence/x/dgBI. - For examples of completed content model objects, see the demonstration - objects included with your Fedora distribution, such as: - demo:CMImage, demo:UVA_STD_IMAGE, demo:DualResImageCollection, - demo:TEI_TO_PDFDOC, and demo:XML_TO_HTMLDOC. - For more information about the demonstration objects, see: - http://fedora-commons.org/confluence/x/AwFI. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Book Content Model - ilives:bookCModel - - - - - - - - - - image/tiff - image/tif - - - - - ilives - plugins/herbarium.inc - Herbarium - showFieldSets - - - - - - - - text/xml - - - ilives - book.inc - IslandoraBook - ingestBook - MODS - - - - - - - ilives - book.inc - IslandoraBook - buildDrupalForm - handleIngestForm - - - - - ilives - book.inc - IslandoraBook - buildEditMetadataForm - - - ilives - book.inc - IslandoraBook - handleEditMetadataForm - - - - - - - - - - image/tiff - image/tif - - - - - fedora_ilives - plugins/herbarium.inc - Herbarium - showFieldSets - - - - - - - - text/xml - - - fedora_ilives - book.inc - IslandoraBook - ingestBook - MODS - - - - - - - fedora_ilives - book.inc - IslandoraBook - buildDrupalForm - handleIngestForm - - - - - fedora_ilives - book.inc - IslandoraBook - buildEditMetadataForm - - - fedora_ilives - book.inc - IslandoraBook - handleEditMetadataForm - - - - - - - - - - image/tiff - - - - - fedora_ilives - plugins/herbarium.inc - Herbarium - showFieldSets - - - - - - - - text/xml - - - fedora_ilives - book.inc - IslandoraBook - ingestBook - MODS - - - - - - - fedora_ilives - book.inc - IslandoraBook - buildDrupalForm - handleIngestForm - - - - - fedora_ilives - book.inc - IslandoraBook - buildEditMetadataForm - - - fedora_ilives - book.inc - IslandoraBook - handleEditMetadataForm - - - - - - - - - - image/tiff - - - - - fedora_ilives - book.inc - IslandoraBook - showFieldSets - - - - - - - - text/xml - - - fedora_ilives - book.inc - IslandoraBook - ingestBook - MODS - - - - - - - fedora_ilives - book.inc - IslandoraBook - buildDrupalForm - handleIngestForm - - - - - fedora_ilives - book.inc - IslandoraBook - buildEditMetadataForm - - - fedora_ilives - book.inc - IslandoraBook - handleEditMetadataForm - - - - - - - - - - image/tiff - - - - - fedora_ilives - book.inc - IslandoraBook - showFieldSet - - - - - - - - text/xml - - - fedora_ilives - book.inc - IslandoraBook - ingestBook - MODS - - - - - - - fedora_ilives - book.inc - IslandoraBook - buildDrupalForm - handleIngestForm - - - - - fedora_ilives - book.inc - IslandoraBook - buildEditMetadataForm - - - fedora_ilives - book.inc - IslandoraBook - handleEditMetadataForm - - - - - - - - - - image/tiff - - - - - fedora_ilives - book.inc - IslandoraBook - showFieldSets - - - - - - - - text/xml - - - fedora_ilives - book.inc - IslandoraBook - ingestBook - MODS - - - - - - - fedora_ilives - book.inc - IslandoraBook - buildDrupalForm - handleIngestForm - - - - - fedora_ilives - book.inc - IslandoraBook - buildEditMetadataForm - - - fedora_ilives - book.inc - IslandoraBook - handleEditMetadataForm - - - - - - - - - - image/tiff - - - - - fedora_ilives - book.inc - IslandoraBook - showFieldSets - - - - - - - - - text/xml - - - fedora_ilives - book.inc - IslandoraBook - ingestBook - MODS - - - - - - - fedora_ilives - book.inc - IslandoraBook - buildDrupalForm - handleIngestForm - - - - - fedora_ilives - book.inc - IslandoraBook - buildEditMetadataForm - - - fedora_ilives - book.inc - IslandoraBook - handleEditMetadataForm - - - - - - - - - - image/tiff - - - - text/xml - - - - - - - - - - - - - - - - - - - - - - - diff --git a/content_models/ilives_jp2Sdef.xml b/content_models/ilives_jp2Sdef.xml deleted file mode 100644 index 9fa5e9a7..00000000 --- a/content_models/ilives_jp2Sdef.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2009-11-12T14:56:59.840Z - Ingested from local file /Users/aoneill/dev/iiv/iiv/etc/fedora-objects/ilives_jp2Sdef.xml - - - - ingest - - admin - 2010-05-25T13:17:14.106Z - Fedora Object Ingested - - - - - - - - - - - - - - - - - - - - - ilives:jp2Sdef - ilives:jp2Sdef - - - - - - - - - - - - - - - diff --git a/content_models/ilives_jp2Sdep-pageCModel.xml b/content_models/ilives_jp2Sdep-pageCModel.xml deleted file mode 100644 index 7eedea6d..00000000 --- a/content_models/ilives_jp2Sdep-pageCModel.xml +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2009-11-12T14:57:00.246Z - Ingested from local file /Users/aoneill/dev/iiv/iiv/etc/fedora-objects/ilives_jp2Sdep-pageCModel.xml - - - - ingest - - fedoraAdmin - 2010-06-01T00:46:19.239Z - Ingested from local file /Users/al/Desktop/ilives_jp2Sdep-pageCModel.xml - - - - modifyDatastreamByValue - RELS-EXT - fedoraAdmin - 2010-06-01T00:48:39.302Z - - - - - - - - - - - ilives:jp2Sdep-pageCModel - ilives:jp2Sdep-pageCModel - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DC - text/xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/content_models/ilives_tei2htmlSdef.xml b/content_models/ilives_tei2htmlSdef.xml deleted file mode 100644 index a65ded77..00000000 --- a/content_models/ilives_tei2htmlSdef.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2009-11-12T14:57:01.057Z - Ingested from local file /Users/aoneill/dev/iiv/iiv/etc/fedora-objects/ilives_tei2htmlSdef.xml - - - - ingest - - fedoraAdmin - 2010-06-01T00:46:19.652Z - Ingested from local file /Users/al/Desktop/ilives_tei2htmlSdef.xml - - - - - - - - - - - - - - - - - - - - - ilives:tei2htmlSdef - ilives:tei2htmlSdef - - - - - - - - - - - - - - diff --git a/content_models/ilives_tei2htmlSdep-pageCModel.xml b/content_models/ilives_tei2htmlSdep-pageCModel.xml deleted file mode 100644 index b3d38549..00000000 --- a/content_models/ilives_tei2htmlSdep-pageCModel.xml +++ /dev/null @@ -1,234 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2009-11-12T14:57:01.366Z - Ingested from local file /Users/aoneill/dev/iiv/iiv/etc/fedora-objects/ilives_tei2htmlSdep-pageCModel.xml - - - - modifyDatastreamByValue - XSL - fedoraAdmin - 2009-12-11T19:09:52.417Z - - - - - modifyDatastreamByValue - XSL - fedoraAdmin - 2009-12-11T19:22:11.096Z - - - - - ingest - - fedoraAdmin - 2010-06-01T00:46:19.847Z - Ingested from local file /Users/al/Desktop/ilives_tei2htmlSdep-pageCModel.xml - - - - - - - - - - - - - - - - - - - - - - - ilives:tei2htmlSdep-pageCModel - ilives:tei2htmlSdep-pageCModel - - - - - - - - - - TEI - text/xml - - - - XSL - text/xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <xsl:value-of select="normalize-space(tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title)"/> - - - - - - - - -
- -
-
- -

- -

-
- - - - - - - - - - - search persName - _blank - http://islandlives.net/fedora/ilives_book_search/tei.persNameTERM:%22+%22+AND+dc.type:collection - - - - - - - - - - - - search placeName - _blank - http://islandlives.net/fedora/ilives_book_search/tei.placeNameTERM:%22%22+AND+dc.type:collection - - - - - - search orgName - _blank - http://islandlives.net/fedora/ilives_book_search/tei.orgNameTERM:%22%22+AND+dc.type:collection - - - - -
-
-
-
-
diff --git a/content_models/ilives_viewerSdef.xml b/content_models/ilives_viewerSdef.xml deleted file mode 100644 index 94a0031e..00000000 --- a/content_models/ilives_viewerSdef.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2009-11-12T17:09:29.912Z - Ingested from local file /Users/aoneill/dev/iiv/iiv/etc/fedora-objects/ilives_viewerSdef.xml - - - - ingest - - admin - 2010-05-25T13:17:14.247Z - Fedora Object Ingested - - - - - - - - - - - - - - - - - - - - - ilives:viewerSdef - ilives:viewerSdef - - - - - - - - - - - - - - diff --git a/content_models/ilives_viewerSdep-bookCModel.xml b/content_models/ilives_viewerSdep-bookCModel.xml deleted file mode 100644 index e91d3ce8..00000000 --- a/content_models/ilives_viewerSdep-bookCModel.xml +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2009-11-12T17:09:41.797Z - Ingested from local file /Users/aoneill/dev/iiv/iiv/etc/fedora-objects/ilives_viewerSdep-bookCModel.xml - - - - ingest - - fedoraAdmin - 2010-05-31T20:03:42.709Z - Ingested from source repository with pid ilives:viewerSdep-bookCModel - - - - modifyDatastreamByValue - RELS-EXT - fedoraAdmin - 2010-05-31T20:04:57.893Z - - - - - modifyDatastreamByValue - RELS-EXT - fedoraAdmin - 2010-05-31T20:57:49.117Z - - - - - - - - - - - ilives:viewerSdep-bookCModel - ilives:viewerSdep-bookCModel - - - - - - - - - - DC - text/xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/content_models/islandora_collectionCModel.xml b/content_models/islandora_collectionCModel.xml deleted file mode 100644 index 330a62cf..00000000 --- a/content_models/islandora_collectionCModel.xml +++ /dev/null @@ -1,584 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - admin - 2010-12-20T16:14:50.165Z - Fedora Object Ingested - - - - addDatastream - RELS-EXT - admin - 2010-12-20T16:14:50.352Z - Ingested object RELS-EXT - - - - modifyDatastreamByValue - RELS-EXT - admin - 2010-12-20T16:14:50.407Z - Modified by Islandora API - - - - addDatastream - ISLANDORACM - admin - 2010-12-20T16:14:50.475Z - Ingested object ISLANDORACM - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2011-01-17T15:04:59.169Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2011-01-17T15:06:08.023Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2011-01-21T19:40:39.790Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2011-01-21T19:41:19.709Z - - - - - - - - - - - Islandora Collection Content Model - islandora:collectionCModel - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/xml - text/plain - application/xml - - - - - - - The name given to the resource - - - An entity primarily responsible for making the content of the resource such as a person, organization or service. - - - An entity primarily responsible for making the content of the resource such as a person, organization or service. - - none - Multi Media - image - meeting - presentation - sound - text - - - - Examples include an abstract, table of contents, or free-text account of the content of the resource. - - - An entity, (including persons, organizations, or services), responsible for making the resource available. - - - An entity responsible for contributing to the content of the resource such as a person, organization or service. - - - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - - - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - - none - collection - dataset - event - image - interactive resource - model - party - physical object - place - service - software - sound - text - - - - A reference to a resource from which the present resource is derived. - - - A unique reference to the resource; In this instance, the accession number or collection number. - - - The language of the intellectual content of the resource. - - English - French - - - - Reference to a related resource. - - - Information about intellectual property rights, copyright, and various property rights. - - - - - - - - - - - text/xml - text/plain - application/xml - - - - - - - - - - - - The name given to the resource - - - An entity primarily responsible for making the content of the resource such as a person, organization or service. - - - An entity primarily responsible for making the content of the resource such as a person, organization or service. - - none - Multi Media - image - meeting - presentation - sound - text - - - - Examples include an abstract, table of contents, or free-text account of the content of the resource. - - - An entity, (including persons, organizations, or services), responsible for making the resource available. - - - An entity responsible for contributing to the content of the resource such as a person, organization or service. - - - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - - - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - - none - collection - dataset - event - image - interactive resource - model - party - physical object - place - service - software - sound - text - - - - A reference to a resource from which the present resource is derived. - - - A unique reference to the resource; In this instance, the accession number or collection number. - - - The language of the intellectual content of the resource. - - English - French - - - - Reference to a related resource. - - - Information about intellectual property rights, copyright, and various property rights. - - - - - - - - - - - text/xml - text/plain - application/xml - - - - - - - - - - - - The name given to the resource - - - An entity primarily responsible for making the content of the resource such as a person, organization or service. - - - An entity primarily responsible for making the content of the resource such as a person, organization or service. - - none - Multi Media - image - meeting - presentation - sound - text - - - - Examples include an abstract, table of contents, or free-text account of the content of the resource. - - - An entity, (including persons, organizations, or services), responsible for making the resource available. - - - An entity responsible for contributing to the content of the resource such as a person, organization or service. - - - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - - - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - - none - collection - dataset - event - image - interactive resource - model - party - physical object - place - service - software - sound - text - - - - A reference to a resource from which the present resource is derived. - - - A unique reference to the resource; In this instance, the accession number or collection number. - - - The language of the intellectual content of the resource. - - English - French - - - - Reference to a related resource. - - - Information about intellectual property rights, copyright, and various property rights. - - - - - - - - - - - text/xml - text/plain - application/xml - - - - - - - - - - - - - - - The name given to the resource - - - An entity primarily responsible for making the content of the resource such as a person, organization or service. - - - An entity primarily responsible for making the content of the resource such as a person, organization or service. - - none - Multi Media - image - meeting - presentation - sound - text - - - - Examples include an abstract, table of contents, or free-text account of the content of the resource. - - - An entity, (including persons, organizations, or services), responsible for making the resource available. - - - An entity responsible for contributing to the content of the resource such as a person, organization or service. - - - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - - - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - - none - collection - dataset - event - image - interactive resource - model - party - physical object - place - service - software - sound - text - - - - A reference to a resource from which the present resource is derived. - - - A unique reference to the resource; In this instance, the accession number or collection number. - - - The language of the intellectual content of the resource. - - English - French - - - - Reference to a related resource. - - - Information about intellectual property rights, copyright, and various property rights. - - - - - - - - - - - text/xml - text/plain - application/xml - - - - - - - - - - - - - - The name given to the resource - - - An entity primarily responsible for making the content of the resource such as a person, organization or service. - - - An entity primarily responsible for making the content of the resource such as a person, organization or service. - - none - Multi Media - image - meeting - presentation - sound - text - - - - Examples include an abstract, table of contents, or free-text account of the content of the resource. - - - An entity, (including persons, organizations, or services), responsible for making the resource available. - - - An entity responsible for contributing to the content of the resource such as a person, organization or service. - - - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - - - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - - none - collection - dataset - event - image - interactive resource - model - party - physical object - place - service - software - sound - text - - - - A reference to a resource from which the present resource is derived. - - - A unique reference to the resource; In this instance, the accession number or collection number. - - - The language of the intellectual content of the resource. - - English - French - - - - Reference to a related resource. - - - Information about intellectual property rights, copyright, and various property rights. - - - - - - - - diff --git a/content_models/islandora_herbCModel.xml b/content_models/islandora_herbCModel.xml deleted file mode 100644 index 4ad9e72c..00000000 --- a/content_models/islandora_herbCModel.xml +++ /dev/null @@ -1,1851 +0,0 @@ - - - - - - - - - - - - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-03-05T19:52:46.133Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-05-10T06:43:54.714Z - - - - - ingest - - fedoraAdmin - 2010-05-10T15:42:10.930Z - Ingested from local file /Applications/MAMP/htdocs/f3/sites/default/modules/fedora_repository/content_models/islandora_herbCModel.xml - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-05-10T16:56:37.065Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-05-10T16:58:56.685Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-05-10T19:07:11.023Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-05-11T19:12:28.380Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-05-13T19:30:13.540Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-05-17T20:10:15.478Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-05-18T18:58:52.382Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-05-19T18:16:39.272Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-05-19T18:36:31.560Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-05-19T19:52:41.316Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-05-19T20:06:17.332Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-05-20T19:12:33.099Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-06-07T14:01:43.997Z - - - - - ingest - - fedoraAdmin - 2010-09-16T16:15:28.762Z - Ingested from local file /Applications/MAMP/htdocs/f3/sites/default/modules/fedora_repository/content_models/islandora_herbCModel.xml - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-09-16T17:32:21.037Z - - - - - - - - - - - - - - - - - - - - - - - - - This DS-COMPOSITE-MODEL datastream is included as a starting point to - assist in the creation of a content model. The DS-COMPOSITE-MODEL - should define the datastreams that are required for any objects - conforming to this content model. - For more information about content models, see: - http://fedora-commons.org/confluence/x/dgBI. - For examples of completed content model objects, see the demonstration - objects included with your Fedora distribution, such as: - demo:CMImage, demo:UVA_STD_IMAGE, demo:DualResImageCollection, - demo:TEI_TO_PDFDOC, and demo:XML_TO_HTMLDOC. - For more information about the demonstration objects, see: - http://fedora-commons.org/confluence/x/AwFI. - - - - - - - - - - - - - Herbarium Content Model - islandora:herbCModel - - - - - - - - - - image/tiff - - - - - plugins/slide_viewer.php - ShowSlideStreamsInFieldSets - showJPG - - - - - - - image/tiff - - - - plugins/ImageManipulation.php - ImageManipulation - createJP2 - jp2 - JP2 - - - - - - - plugins/DemoFormBuilder.php - DemoFormBuilder - buildQDCForm - handleQDCForm - - - - - dc:title - textfield - The name given to the resource - true - - - - dc:creator - textfield - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - dc:subject - select - Subject - false - - - image - image - - - photograph - photograph - - - presentation - presentation - - - art - art - - - - - - dc:description - textarea - Description of the Image - true - - - - dc:publisher - textfield - An entity, (including persons, organizations, or services), responsible for making the resource available. - false - - - - dc:contributor - textfield - An entity responsible for contributing to the content of the resource such as a person, organization or service. - false - - - - dc:date - textfield - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - false - - - - dc:type - textfield - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - false - - - - dc:source - textfield - A reference to a resource from which the present resource is derived. - false - - - - dc:identifier - textfield - A unique reference to the resource; In this instance, the accession number or collection number. - false - - - - dc:language - select - The language of the intellectual content of the resource. - false - - - eng - English - - - fre - French - - - - - - dc:relation - textfield - Reference to a related resource. - false - - - - dc:rights - textarea - Information about intellectual property rights, copyright, and various property rights. - false - - - - - - - - - - - image/tiff - - - - - plugins/herb_viewer.php - HerbStreamsInFieldSets - showJPG - - - - - - - image/tiff - - - - plugins/ImageManipulation.php - ImageManipulation - createJP2 - jp2 - JP2 - - - - - - - plugins/DemoFormBuilder.php - DemoFormBuilder - buildQDCForm - handleQDCForm - - - - - dc:title - textfield - The name given to the resource - true - - - - dc:creator - textfield - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - dc:subject - select - Subject - false - - - image - image - - - photograph - photograph - - - presentation - presentation - - - art - art - - - - - - dc:description - textarea - Description of the Image - true - - - - dc:publisher - textfield - An entity, (including persons, organizations, or services), responsible for making the resource available. - false - - - - dc:contributor - textfield - An entity responsible for contributing to the content of the resource such as a person, organization or service. - false - - - - dc:date - textfield - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - false - - - - dc:type - textfield - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - false - - - - dc:source - textfield - A reference to a resource from which the present resource is derived. - false - - - - dc:identifier - textfield - A unique reference to the resource; In this instance, the accession number or collection number. - false - - - - dc:language - select - The language of the intellectual content of the resource. - false - - - eng - English - - - fre - French - - - - - - dc:relation - textfield - Reference to a related resource. - false - - - - dc:rights - textarea - Information about intellectual property rights, copyright, and various property rights. - false - - - - - - - - - - - image/tiff - - - - - plugins/herb_viewer.inc - HerbStreamsInFieldSets - showJPG - - - - - - - image/tiff - - - - plugins/ImageManipulation.inc - ImageManipulation - createJP2 - jp2 - JP2 - - - - - - - plugins/DemoFormBuilder.inc - DemoFormBuilder - buildQDCForm - handleQDCForm - - - - - dc:title - textfield - The name given to the resource - true - - - - dc:creator - textfield - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - dc:subject - select - Subject - false - - - image - image - - - photograph - photograph - - - presentation - presentation - - - art - art - - - - - - dc:description - textarea - Description of the Image - true - - - - dc:publisher - textfield - An entity, (including persons, organizations, or services), responsible for making the resource available. - false - - - - dc:contributor - textfield - An entity responsible for contributing to the content of the resource such as a person, organization or service. - false - - - - dc:date - textfield - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - false - - - - dc:type - textfield - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - false - - - - dc:source - textfield - A reference to a resource from which the present resource is derived. - false - - - - dc:identifier - textfield - A unique reference to the resource; In this instance, the accession number or collection number. - false - - - - dc:language - select - The language of the intellectual content of the resource. - false - - - eng - English - - - fre - French - - - - - - dc:relation - textfield - Reference to a related resource. - false - - - - dc:rights - textarea - Information about intellectual property rights, copyright, and various property rights. - false - - - - - - - - - - - image/tiff - - - image/tif - - - - - plugins/herb_viewer.inc - HerbStreamsInFieldSets - showJPG - - - - - - - image/tiff - - - image/tif - - - - plugins/ImageManipulation.inc - ImageManipulation - createJP2 - jp2 - JP2 - - - - - - - plugins/DemoFormBuilder.inc - DemoFormBuilder - buildQDCForm - handleQDCForm - - - - - dc:title - textfield - The name given to the resource - true - - - - dc:creator - textfield - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - dc:subject - select - Subject - false - - - image - image - - - photograph - photograph - - - presentation - presentation - - - art - art - - - - - - dc:description - textarea - Description of the Image - true - - - - dc:publisher - textfield - An entity, (including persons, organizations, or services), responsible for making the resource available. - false - - - - dc:contributor - textfield - An entity responsible for contributing to the content of the resource such as a person, organization or service. - false - - - - dc:date - textfield - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - false - - - - dc:type - textfield - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - false - - - - dc:source - textfield - A reference to a resource from which the present resource is derived. - false - - - - dc:identifier - textfield - A unique reference to the resource; In this instance, the accession number or collection number. - false - - - - dc:language - select - The language of the intellectual content of the resource. - false - - - eng - English - - - fre - French - - - - - - dc:relation - textfield - Reference to a related resource. - false - - - - dc:rights - textarea - Information about intellectual property rights, copyright, and various property rights. - false - - - - - - - - - - - image/tiff - image/tif - - - - - plugins/herb_viewer.inc - HerbStreamsInFieldSets - showJPG - - - - - - - image/tiff - - - image/tif - - - - plugins/ImageManipulation.inc - ImageManipulation - createJP2 - jp2 - JP2 - - - - - - - plugins/DemoFormBuilder.inc - DemoFormBuilder - buildQDCForm - handleQDCForm - - - - - dc:title - textfield - The name given to the resource - true - - - - dc:creator - textfield - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - dc:subject - select - Subject - false - - - image - image - - - photograph - photograph - - - presentation - presentation - - - art - art - - - - - - dc:description - textarea - Description of the Image - true - - - - dc:publisher - textfield - An entity, (including persons, organizations, or services), responsible for making the resource available. - false - - - - dc:contributor - textfield - An entity responsible for contributing to the content of the resource such as a person, organization or service. - false - - - - dc:date - textfield - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - false - - - - dc:type - textfield - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - false - - - - dc:source - textfield - A reference to a resource from which the present resource is derived. - false - - - - dc:identifier - textfield - A unique reference to the resource; In this instance, the accession number or collection number. - false - - - - dc:language - select - The language of the intellectual content of the resource. - false - - - eng - English - - - fre - French - - - - - - dc:relation - textfield - Reference to a related resource. - false - - - - dc:rights - textarea - Information about intellectual property rights, copyright, and various property rights. - false - - - - - - - - - - - image/tiff - image/tif - - - - - plugins/herb_viewer.inc - HerbStreamsInFieldSets - showJPG - - - - - - - - - - - - - image/tiff - - - image/tif - - - - plugins/ImageManipulation.inc - ImageManipulation - createJP2 - jp2 - JP2 - - - - - - - plugins/DemoFormBuilder.inc - DemoFormBuilder - buildQDCForm - handleQDCForm - - - - - dc:title - textfield - The name given to the resource - true - - - - dc:creator - textfield - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - dc:subject - select - Subject - false - - - image - image - - - photograph - photograph - - - presentation - presentation - - - art - art - - - - - - dc:description - textarea - Description of the Image - true - - - - dc:publisher - textfield - An entity, (including persons, organizations, or services), responsible for making the resource available. - false - - - - dc:contributor - textfield - An entity responsible for contributing to the content of the resource such as a person, organization or service. - false - - - - dc:date - textfield - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - false - - - - dc:type - textfield - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - false - - - - dc:source - textfield - A reference to a resource from which the present resource is derived. - false - - - - dc:identifier - textfield - A unique reference to the resource; In this instance, the accession number or collection number. - false - - - - dc:language - select - The language of the intellectual content of the resource. - false - - - eng - English - - - fre - French - - - - - - dc:relation - textfield - Reference to a related resource. - false - - - - dc:rights - textarea - Information about intellectual property rights, copyright, and various property rights. - false - - - - - - - - - - - image/tiff - image/tif - - - - - plugins/herb_viewer.inc - HerbStreamsInFieldSets - showJPG - - - - - - - - - - - - - image/tiff - - - image/tif - - - - plugins/ImageManipulation.inc - ImageManipulation - createJP2 - jp2 - JP2 - - - - - - - plugins/DarwinCore.inc - DarwinCore - buildDrupalForm - handleDarwinCoreForm - - - - - - - - - - image/tiff - image/tif - - - - - plugins/herb_viewer.inc - HerbStreamsInFieldSets - showJPG - - - - - - - - - - - - - image/tiff - - - image/tif - - - - plugins/ImageManipulation.inc - ImageManipulation - createJP2 - jp2 - JP2 - - - - - - - plugins/DarwinCore.inc - DarwinCore - buildDrupalForm - handleIngestForm - - - - - - - - - - image/tiff - image/tif - - - - - plugins/herb_viewer.inc - HerbStreamsInFieldSets - showJPG - - - - - - - - - - - - - image/tiff - - - image/tif - - - - plugins/ImageManipulation.inc - ImageManipulation - createJP2 - jp2 - JP2 - - - - - - - plugins/Herbarium.inc - Herbarium - buildDrupalForm - handleIngestForm - - - - - - - - - - image/tiff - image/tif - - - - - plugins/herbarium.inc - Herbarium - showFieldSets - - - - - - - - - - - - - image/tiff - - - image/tif - - - - plugins/ImageManipulation.inc - ImageManipulation - createJP2 - jp2 - JP2 - - - - - - - plugins/Herbarium.inc - Herbarium - buildDrupalForm - handleIngestForm - - - - - - - - - - image/tiff - image/tif - - - - - plugins/herbarium.inc - Herbarium - showFieldSets - - - - - - - - - - - - - image/tiff - - - image/tif - - - - plugins/ImageManipulation.inc - ImageManipulation - createJP2 - jp2 - JP2 - - - - - - - plugins/Herbarium.inc - Herbarium - buildDrupalForm - handleIngestForm - - - - - plugins/Herbarium.inc - Herbarium - buildDrupalForm - - - - - - - - - - image/tiff - image/tif - - - - - plugins/herbarium.inc - Herbarium - showFieldSets - - - - - - - - - - - - - image/tiff - - - image/tif - - - - plugins/ImageManipulation.inc - ImageManipulation - createJP2 - jp2 - JP2 - - - - - - - plugins/Herbarium.inc - Herbarium - buildDrupalForm - handleIngestForm - - - - - plugins/Herbarium.inc - Herbarium - buildDrupalForm - - - - - - - - - - image/tiff - image/tif - - - - - plugins/herbarium.inc - Herbarium - showFieldSets - - - - - - - - - - - - - image/tiff - - - image/tif - - - - plugins/ImageManipulation.inc - ImageManipulation - createJP2 - jp2 - JP2 - - - - - - - plugins/Herbarium.inc - Herbarium - buildDrupalForm - handleIngestForm - - - - - plugins/Herbarium.inc - Herbarium - buildEditMetadataForm - - - - - - - - - - image/tiff - image/tif - - - - - plugins/herbarium.inc - Herbarium - showFieldSets - - - - - - - - - - - - - image/tiff - - - image/tif - - - - plugins/ImageManipulation.inc - ImageManipulation - createJP2 - jp2 - JP2 - - - - - - - plugins/Herbarium.inc - Herbarium - buildDrupalForm - handleIngestForm - - - - - plugins/Herbarium.inc - Herbarium - buildEditMetadataForm - - - plugins/Herbarium.inc - Herbarium - handleEditMetadataForm - - - - - - - - - - image/tiff - image/tif - - - - - plugins/herbarium.inc - Herbarium - showFieldSets - - - - - - - - - - - - - image/tiff - - - image/tif - - - - plugins/ImageManipulation.inc - ImageManipulation - createJP2 - jp2 - JP2 - - - - - - - plugins/Herbarium.inc - Herbarium - buildDrupalForm - handleIngestForm - - - - - plugins/herbarium.inc - Herbarium - buildEditMetadataForm - - - plugins/herbarium.inc - Herbarium - handleEditMetadataForm - - - - - - - - - - image/tiff - image/tif - - - - - plugins/herbarium.inc - Herbarium - showFieldSets - - - - - - - - - - - - - image/tiff - - - image/tif - - - - plugins/ImageManipulation.inc - ImageManipulation - createJP2 - jp2 - JP2 - - - - - - - plugins/herbarium.inc - Herbarium - buildDrupalForm - handleIngestForm - - - - - plugins/herbarium.inc - Herbarium - buildEditMetadataForm - - - plugins/herbarium.inc - Herbarium - handleEditMetadataForm - - - - - - - - - - image/tiff - image/tif - - - - image/tiff - image/tif - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/content_models/islandora_jp2Sdep-slideCModel.xml b/content_models/islandora_jp2Sdep-slideCModel.xml deleted file mode 100644 index 47a14dc0..00000000 --- a/content_models/islandora_jp2Sdep-slideCModel.xml +++ /dev/null @@ -1,277 +0,0 @@ - - - - - - - - - - - - - - - -ingest - -fedoraAdmin -2009-11-27T18:25:48.654Z -Created with Admin GUI "New Object" command - - - -modifyDatastreamByValue -METHODMAP -fedoraAdmin -2009-11-27T18:30:03.064Z - - - - -modifyDatastreamByValue -DSINPUTSPEC -fedoraAdmin -2009-11-27T18:30:34.272Z - - - - -modifyDatastreamByValue -WSDL -fedoraAdmin -2009-11-27T18:31:33.967Z - - - - -modifyDatastreamByValue -RELS-EXT -fedoraAdmin -2009-11-27T18:36:14.648Z - - - - -ingest - -fedoraAdmin -2010-01-26T20:06:07.452Z -Ingested from local file /Users/aoneill/Desktop/tmp/islandora_jp2Sdep-slideCModel.xml - - - -modifyDatastreamByValue -RELS-EXT -fedoraAdmin -2010-03-05T16:47:23.192Z - - - - -modifyDatastreamByValue -RELS-EXT -fedoraAdmin -2010-03-11T20:58:05.234Z - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This METHODMAP datastream is included as a starting point to - assist in the creation of a service deployment. The METHODMAP - should define the the mapping of the WSDL to Fedora object methods. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This DSINPUTSPEC datastream is included as a starting point to - assist in the creation of a service deployment. The DSINPUTSPEC - should define the datastreams to be used by WSDL-defined methods. - - - - - - - - DC - text/xml - - - - - - - - - - - This WSDL datastream is included as a starting point to - assist in the creation of a service deployment. The WSDL - should define the services provided by this - service deployment. - For more information about service deployments, see: - http://fedora-commons.org/confluence/x/dgBI. - For examples of completed service deployment objects, see the demonstration - objects included with your Fedora distribution, such as: - demo:2, demo:13, demo:20, and demo:28. - For more information about the demonstration objects, see: - http://fedora-commons.org/confluence/x/AwFI. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - islandora:jp2Sdep-slideCModel - islandora:jp2Sdep-slideCModel - - - - - \ No newline at end of file diff --git a/content_models/islandora_largeimages.xml b/content_models/islandora_largeimages.xml deleted file mode 100644 index f78168d4..00000000 --- a/content_models/islandora_largeimages.xml +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - admin - 2010-12-20T16:02:16.800Z - Fedora Object Ingested - - - - addDatastream - RELS-EXT - admin - 2010-12-20T16:02:17.020Z - Ingested object RELS-EXT - - - - modifyDatastreamByValue - RELS-EXT - admin - 2010-12-20T16:02:17.091Z - Modified by Islandora API - - - - modifyDatastreamByValue - RELS-EXT - admin - 2010-12-20T16:02:17.142Z - Modified by Islandora API - - - - addDatastream - COLLECTION_POLICY - admin - 2010-12-20T16:02:17.213Z - Ingested object COLLECTION_POLICY - - - - ingest - - admin - 2010-12-20T16:08:27.075Z - Fedora Object Ingested - - - - addDatastream - TN - admin - 2010-12-20T16:08:27.131Z - Ingested object TN - - - - purgeDatastream - TN - fedoraAdmin - 2010-12-20T16:09:24.726Z - DatastreamPane generated this logMessage. . . . Purged datastream (ID=TN), versions ranging from 2010-12-20T12:08:27.131Z to 2010-12-20T12:08:27.131Z. This resulted in the permanent removal of 1 datastream version(s) (2010-12-20T12:08:27.131Z) and all associated audit records. - - - - modifyDatastreamByValue - COLLECTION_POLICY - fedoraAdmin - 2010-12-20T16:09:32.544Z - - - - - - - - - - - Large Images Collection - islandora:largeimages - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - islandora:slide - islandora:slideCModel - ISLANDORACM - - - islandora:map - islandora:mapCModel - ISLANDORACM - - - islandora:herb - islandora:herbCModel - ISLANDORACM - - - isMemberOfCollection - - dc.description - - dc.title - dc.title - - - dc.creator - dc.creator - - - dc.description - dc.description - - - dc.date - dc.date - - - dc.identifier - dc.identifier - - - dc.language - dc.language - - - dc.publisher - dc.publisher - - - dc.rights - dc.rights - - - dc.subject - dc.subject - - - dc.relation - dc.relation - - - dcterms.temporal - dcterms.temporal - - - dcterms.spatial - dcterms.spatial - - - fgs.DS.first.text - Full Text - - - - - - - - - - - - - - - dc.title - dc.creator - dc.description - dc.date - dc.identifier - dc.language - dc.publisher - dc.rights - dc.subject - dc.relation - dcterms.temporal - dcterms.spatial - Full Text - - isMemberOfCollection - - - - - diff --git a/content_models/islandora_mapCModel.xml b/content_models/islandora_mapCModel.xml deleted file mode 100644 index e1026ea7..00000000 --- a/content_models/islandora_mapCModel.xml +++ /dev/null @@ -1,366 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2010-05-25T12:52:58.656Z - Created with Admin GUI "New Object" command - - - - addDatastream - ISLANDORACM - fedoraAdmin - 2010-05-25T12:53:38.788Z - DatastreamsPane generated this logMessage. - - - - ingest - - fedoraAdmin - 2010-09-16T16:13:13.388Z - Ingested from local file /Users/aoneill/fedora_repository/content_models/islandora_mapCModel.xml - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-09-16T16:13:49.927Z - - - - - - - - - - - - - - - - - - - - - - - This DS-COMPOSITE-MODEL datastream is included as a starting point to - assist in the creation of a content model. The DS-COMPOSITE-MODEL - should define the datastreams that are required for any objects - conforming to this content model. - For more information about content models, see: - http://fedora-commons.org/confluence/x/dgBI. - For examples of completed content model objects, see the demonstration - objects included with your Fedora distribution, such as: - demo:CMImage, demo:UVA_STD_IMAGE, demo:DualResImageCollection, - demo:TEI_TO_PDFDOC, and demo:XML_TO_HTMLDOC. - For more information about the demonstration objects, see: - http://fedora-commons.org/confluence/x/AwFI. - - - - - - - - - - - - - Islandora Map Content Model - islandora:mapCModel - - - - - - - - - - image/tiff - image/tif - - - - - plugins/map_viewer.inc - ShowMapStreamsInFieldSets - showJPG - - - - - - - - - - - - image/tiff - - - image/tif - - - - plugins/ImageManipulation.inc - ImageManipulation - createJP2 - jp2 - JP2 - - - - - - - plugins/DemoFormBuilder.inc - DemoFormBuilder - buildQDCForm - handleQDCForm - - - - - dc:title - textfield - The name given to the resource - true - - - - dc:creator - textfield - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - dc:subject - select - Subject - false - - - image - image - - - photograph - photograph - - - presentation - presentation - - - art - art - - - - - - dc:description - textarea - Description of the Image - true - - - - dc:publisher - textfield - An entity, (including persons, organizations, or services), responsible for making the resource available. - false - - - - dc:contributor - textfield - An entity responsible for contributing to the content of the resource such as a person, organization or service. - false - - - - dc:date - textfield - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - false - - - - dc:type - textfield - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - false - - - - dc:source - textfield - A reference to a resource from which the present resource is derived. - false - - - - dc:identifier - textfield - A unique reference to the resource; In this instance, the accession number or collection number. - false - - - - dc:language - select - The language of the intellectual content of the resource. - false - - - eng - English - - - fre - French - - - - - - dc:relation - textfield - Reference to a related resource. - false - - - - dc:rights - textarea - Information about intellectual property rights, copyright, and various property rights. - false - - - - - - - - - - - image/tiff - image/tif - - - - image/tiff - image/tif - - - - - - - - - - - - - - - - - - - - The name given to the resource - - - An entity primarily responsible for making the content of the resource such as a person, organization or service. - - - Subject - - image - photograph - presentation - art - - - - Description of the Image - - - An entity, (including persons, organizations, or services), responsible for making the resource available. - - - An entity responsible for contributing to the content of the resource such as a person, organization or service. - - - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - - - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - - - A reference to a resource from which the present resource is derived. - - - A unique reference to the resource; In this instance, the accession number or collection number. - - - The language of the intellectual content of the resource. - - English - French - - - - Reference to a related resource. - - - Information about intellectual property rights, copyright, and various property rights. - - - - - - - - diff --git a/content_models/islandora_mods2htmlSdef.xml b/content_models/islandora_mods2htmlSdef.xml deleted file mode 100644 index 5eaae20a..00000000 --- a/content_models/islandora_mods2htmlSdef.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2010-03-12T14:57:03.509Z - Created with Admin GUI "New Object" command - - - - modifyDatastreamByValue - METHODMAP - fedoraAdmin - 2010-03-12T15:12:03.341Z - - - - - ingest - - fedoraAdmin - 2010-03-12T17:28:34.323Z - Ingested from local file /Users/aoneill/fedora_repository/content_models/islandora-mods2htmlSdef.xml - - - - ingest - - admin - 2010-05-25T13:17:13.492Z - Fedora Object Ingested - - - - - - - - - - - - - - - - - - - - - - This METHODMAP datastream is included as a starting point to - assist in the creation of a service definition. The METHODMAP - should define the methods and method parameters for this - service definition. - For more information about service definitions, see: - http://fedora-commons.org/confluence/x/dgBI. - For examples of completed service definition objects, see the demonstration - objects included with your Fedora distribution, such as: - demo:1, demo:12, demo: 19, and demo:27. - For more information about the demonstration objects, see: - http://fedora-commons.org/confluence/x/AwFI. - - - - - - - - - - - - - - - - - - MODS to HTML Disseminator - islandora:mods2htmlSdef - - - - - diff --git a/content_models/islandora_mods2htmlSdep.xml b/content_models/islandora_mods2htmlSdep.xml deleted file mode 100644 index f5fd2cd9..00000000 --- a/content_models/islandora_mods2htmlSdep.xml +++ /dev/null @@ -1,464 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2010-03-12T15:14:29.138Z - Created with Admin GUI "New Object" command - - - - addDatastream - XSL - fedoraAdmin - 2010-03-12T15:17:20.270Z - DatastreamsPane generated this logMessage. - - - - modifyDatastreamByValue - RELS-EXT - fedoraAdmin - 2010-03-12T15:18:27.234Z - - - - - modifyDatastreamByValue - METHODMAP - fedoraAdmin - 2010-03-12T15:21:44.430Z - - - - - modifyDatastreamByValue - DSINPUTSPEC - fedoraAdmin - 2010-03-12T15:23:21.361Z - - - - - modifyDatastreamByValue - WSDL - fedoraAdmin - 2010-03-12T15:27:58.299Z - - - - - ingest - - admin - 2010-05-25T13:17:13.612Z - Fedora Object Ingested - - - - modifyDatastreamByValue - RELS-EXT - fedoraAdmin - 2010-06-01T01:05:17.111Z - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This METHODMAP datastream is included as a starting point to - assist in the creation of a service deployment. The METHODMAP - should define the the mapping of the WSDL to Fedora object methods. - - - - - - - - - - - - - - - - - - - - - This DSINPUTSPEC datastream is included as a starting point to - assist in the creation of a service deployment. The DSINPUTSPEC - should define the datastreams to be used by WSDL-defined methods. - - - - - - - - MODS - text/xml - - - - XSL - text/xml - - - - - - - - - - - This WSDL datastream is included as a starting point to - assist in the creation of a service deployment. The WSDL - should define the services provided by this - service deployment. - For more information about service deployments, see: - http://fedora-commons.org/confluence/x/dgBI. - For examples of completed service deployment objects, see the demonstration - objects included with your Fedora distribution, such as: - demo:2, demo:13, demo:20, and demo:28. - For more information about the demonstration objects, see: - http://fedora-commons.org/confluence/x/AwFI. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MODS to HTML Disseminator Service Deployment - islandora:mods2htmlSdep - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - -

- - - -
- - - -

- - - - - - -

- - - - - -
-
-
- - - - - -

- - - - - - -

- - - -
- - - -

- - - - - - -

- - - - - -
-
-
- - - -

- - - - - - -

- - - - - -
- - - - - - - - - - - - - : - - - - - - - ( - - - - - - Edition - ) - - - ="", - - - () - -
-
-
-
-
diff --git a/content_models/islandora_qtCModel.xml b/content_models/islandora_qtCModel.xml deleted file mode 100644 index 0323fc31..00000000 --- a/content_models/islandora_qtCModel.xml +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - - - - - - Quicktime Content Model - islandora:qtCModel - - - - - - - - - - video/quicktime - video/mp4 - audio/mp3 - audio/x-aiff - - - - video/quicktime - video/mp4 - - audio/mp3 - audio/x-aiff - - - - - - - - - - - - - 92x92 - - - - - - - - - - - - - - - - - - - - - - The name given to the file - - - An entity primarily responsible for making the - content of the resource such as a person, organization or - service. - - - An entity primarily responsible for making the - content of the resource such as a person, organization or - service. - - home recording - meeting - presentation - sound - - - - Examples include an abstract, table of - contents, or free-text account of the content of the - resource. - - - An entity, (including persons, organizations, - or services), responsible for making the resource - available. - - - An entity responsible for contributing to the - content of the resource such as a person, organization or - service. - - - Temporal scope of the content if known. Date - format is YYYY-MM-DD (e.g. 1890,1910-10,or - 2007-10-23) - - - Genre of the content of the resource. Examples - include: home page, novel, poem, working paper, technical - report, essay, dictionary. - - none - video - event - image - interactive resource - model - party - physical object - place - service - software - sound - text - - - - A reference to a resource from which the - present resource is derived. - - - A unique reference to the resource; In this - instance, the accession number or collection - number. - - - The language of the intellectual content of - the resource. - - English - French - - - - Reference to a related resource. - - - Information about intellectual property - rights, copyright, and various property - rights. - - - - - - - - diff --git a/content_models/islandora_slideCModel.xml b/content_models/islandora_slideCModel.xml deleted file mode 100644 index 9d0386e3..00000000 --- a/content_models/islandora_slideCModel.xml +++ /dev/null @@ -1,1466 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2009-10-15T16:00:27.323Z - Created with Admin GUI "New Object" command - - - - addDatastream - ISLANDORACM - fedoraAdmin - 2009-10-15T16:01:56.633Z - DatastreamsPane generated this logMessage. - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2009-10-16T16:30:09.592Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2009-10-16T16:40:10.323Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2009-10-16T17:50:03.365Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2009-10-16T17:59:16.270Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2009-11-27T15:22:48.433Z - - - - - modifyDatastreamByValue - RELS-EXT - fedoraAdmin - 2009-11-27T15:47:29.716Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-01-12T20:39:20.430Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-01-13T17:59:36.652Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-01-13T19:08:21.266Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-01-13T19:56:37.843Z - - - - - ingest - - fedoraAdmin - 2010-01-26T20:06:21.726Z - Ingested from local file /Users/aoneill/Desktop/tmp/islandora_slideCModel.xml - - - - ingest - - aoneill - 2010-03-31T22:51:13.964Z - Fedora Object Ingested - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-03-31T22:54:03.479Z - - - - - ingest - - aoneill - 2010-04-01T18:17:22.725Z - Fedora Object Ingested - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-04-01T18:25:12.904Z - - - - - ingest - - admin - 2010-08-26T18:57:07.237Z - Fedora Object Ingested - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-09-16T16:01:27.415Z - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This DS-COMPOSITE-MODEL datastream is included as a starting point to - assist in the creation of a content model. The DS-COMPOSITE-MODEL - should define the datastreams that are required for any objects - conforming to this content model. - For more information about content models, see: - http://fedora-commons.org/confluence/x/dgBI. - For examples of completed content model objects, see the demonstration - objects included with your Fedora distribution, such as: - demo:CMImage, demo:UVA_STD_IMAGE, demo:DualResImageCollection, - demo:TEI_TO_PDFDOC, and demo:XML_TO_HTMLDOC. - For more information about the demonstration objects, see: - http://fedora-commons.org/confluence/x/AwFI. - - - - - - - - - - - - - Slide Content Model - islandora:slideCModel - - - - - - - - - - image/jpeg - - - - - plugins/image_rotator_tagger_block.inc - ShowILivesStreamsInFieldSets - showJPG - - - - image/jpeg - - - - - - - - - - - image/jpeg - - - - - plugins/image_rotator_tagger_block.inc - ShowILivesStreamsInFieldSets - showJPG - - - - - - - - - - - - image/jpeg - - - - - ilives/image_rotator_tagger_block.inc - ShowILivesStreamsInFieldSets - showJPG - - - - - - - - - - - - image/jpeg - - - - - plugins/slide_viewer.inc - ShowSlideStreamsInFieldSets - showJPG - - - - - - - - - - - - image/jpeg - - - - - plugins/slide_viewer.inc - ShowSlideStreamsInFieldSets - showJPG - - - - - plugins/ShowStreamsInFieldSets.inc - ShowStreamsInFieldSets - showQdc - - - - - - - - - - - - image/jpeg - - - - - plugins/slide_viewer.inc - ShowSlideStreamsInFieldSets - showJPG - - - - - - - - - - - - image/tiff - image/tif - - - - - plugins/slide_viewer.inc - ShowSlideStreamsInFieldSets - showJPG - - - - - - - image/jpeg - - - - plugins/ImageManipulation.inc - ImageManipulation - manipulateImage - jpg - MEDIUM_SIZE - - 160 - 120 - - - - plugins/ImageManipulation.inc - ImageManipulation - manipulateImage - jpg - TN - - 120 - 120 - - - - - - - - plugins/DemoFormBuilder.inc - DemoFormBuilder - buildQDCForm - handleQDCForm - - - - - dc:title - textfield - The name given to the resource - true - - - - dc:creator - textfield - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - dc:subject - select - Subject - false - - - image - image - - - photograph - photograph - - - presentation - presentation - - - art - art - - - - - - dc:description - textarea - Description of the Image - true - - - - dc:publisher - textfield - An entity, (including persons, organizations, or services), responsible for making the resource available. - false - - - - dc:contributor - textfield - An entity responsible for contributing to the content of the resource such as a person, organization or service. - false - - - - dc:date - textfield - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - false - - - - dc:type - textfield - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - false - - - - dc:source - textfield - A reference to a resource from which the present resource is derived. - false - - - - dc:identifier - textfield - A unique reference to the resource; In this instance, the accession number or collection number. - false - - - - dc:language - select - The language of the intellectual content of the resource. - false - - - eng - English - - - fre - French - - - - - - dc:relation - textfield - Reference to a related resource. - false - - - - dc:rights - textarea - Information about intellectual property rights, copyright, and various property rights. - false - - - - - - - - - - - image/tiff - - - - - plugins/slide_viewer.inc - ShowSlideStreamsInFieldSets - showJPG - - - - - - - image/tiff - - - - plugins/ImageManipulation.inc - ImageManipulation - createJP2 - jpg - JP2 - - - - - - - plugins/DemoFormBuilder.inc - DemoFormBuilder - buildQDCForm - handleQDCForm - - - - - dc:title - textfield - The name given to the resource - true - - - - dc:creator - textfield - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - dc:subject - select - Subject - false - - - image - image - - - photograph - photograph - - - presentation - presentation - - - art - art - - - - - - dc:description - textarea - Description of the Image - true - - - - dc:publisher - textfield - An entity, (including persons, organizations, or services), responsible for making the resource available. - false - - - - dc:contributor - textfield - An entity responsible for contributing to the content of the resource such as a person, organization or service. - false - - - - dc:date - textfield - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - false - - - - dc:type - textfield - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - false - - - - dc:source - textfield - A reference to a resource from which the present resource is derived. - false - - - - dc:identifier - textfield - A unique reference to the resource; In this instance, the accession number or collection number. - false - - - - dc:language - select - The language of the intellectual content of the resource. - false - - - eng - English - - - fre - French - - - - - - dc:relation - textfield - Reference to a related resource. - false - - - - dc:rights - textarea - Information about intellectual property rights, copyright, and various property rights. - false - - - - - - - - - - - image/tiff - - - - - plugins/slide_viewer.inc - ShowSlideStreamsInFieldSets - showJPG - - - - - - - image/tiff - - - - plugins/ImageManipulation.inc - ImageManipulation - createJP2 - jp2 - JP2 - - - plugins/ImageManipulation.inc - ImageManipulation - manipulateImage - jpg - TN - - 120 - 120 - - - - - - - - plugins/DemoFormBuilder.inc - DemoFormBuilder - buildQDCForm - handleQDCForm - - - - - dc:title - textfield - The name given to the resource - true - - - - dc:creator - textfield - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - dc:subject - select - Subject - false - - - image - image - - - photograph - photograph - - - presentation - presentation - - - art - art - - - - - - dc:description - textarea - Description of the Image - true - - - - dc:publisher - textfield - An entity, (including persons, organizations, or services), responsible for making the resource available. - false - - - - dc:contributor - textfield - An entity responsible for contributing to the content of the resource such as a person, organization or service. - false - - - - dc:date - textfield - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - false - - - - dc:type - textfield - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - false - - - - dc:source - textfield - A reference to a resource from which the present resource is derived. - false - - - - dc:identifier - textfield - A unique reference to the resource; In this instance, the accession number or collection number. - false - - - - dc:language - select - The language of the intellectual content of the resource. - false - - - eng - English - - - fre - French - - - - - - dc:relation - textfield - Reference to a related resource. - false - - - - dc:rights - textarea - Information about intellectual property rights, copyright, and various property rights. - false - - - - - - - - - - - image/tiff - - - - - plugins/slide_viewer.inc - ShowSlideStreamsInFieldSets - showJPG - - - - - - - image/tiff - - - - plugins/ImageManipulation.inc - ImageManipulation - createJP2 - jp2 - JP2 - - - - - - - plugins/DemoFormBuilder.inc - DemoFormBuilder - buildQDCForm - handleQDCForm - - - - - dc:title - textfield - The name given to the resource - true - - - - dc:creator - textfield - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - dc:subject - select - Subject - false - - - image - image - - - photograph - photograph - - - presentation - presentation - - - art - art - - - - - - dc:description - textarea - Description of the Image - true - - - - dc:publisher - textfield - An entity, (including persons, organizations, or services), responsible for making the resource available. - false - - - - dc:contributor - textfield - An entity responsible for contributing to the content of the resource such as a person, organization or service. - false - - - - dc:date - textfield - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - false - - - - dc:type - textfield - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - false - - - - dc:source - textfield - A reference to a resource from which the present resource is derived. - false - - - - dc:identifier - textfield - A unique reference to the resource; In this instance, the accession number or collection number. - false - - - - dc:language - select - The language of the intellectual content of the resource. - false - - - eng - English - - - fre - French - - - - - - dc:relation - textfield - Reference to a related resource. - false - - - - dc:rights - textarea - Information about intellectual property rights, copyright, and various property rights. - false - - - - - - - - - - - image/tiff - image/tif - - - - - plugins/slide_viewer.inc - ShowSlideStreamsInFieldSets - showJPG - - - - - - - image/tiff - - - - plugins/ImageManipulation.inc - ImageManipulation - createJP2 - jp2 - JP2 - - - - - - - plugins/DemoFormBuilder.inc - DemoFormBuilder - buildQDCForm - handleQDCForm - - - - - dc:title - textfield - The name given to the resource - true - - - - dc:creator - textfield - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - dc:subject - select - Subject - false - - - image - image - - - photograph - photograph - - - presentation - presentation - - - art - art - - - - - - dc:description - textarea - Description of the Image - true - - - - dc:publisher - textfield - An entity, (including persons, organizations, or services), responsible for making the resource available. - false - - - - dc:contributor - textfield - An entity responsible for contributing to the content of the resource such as a person, organization or service. - false - - - - dc:date - textfield - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - false - - - - dc:type - textfield - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - false - - - - dc:source - textfield - A reference to a resource from which the present resource is derived. - false - - - - dc:identifier - textfield - A unique reference to the resource; In this instance, the accession number or collection number. - false - - - - dc:language - select - The language of the intellectual content of the resource. - false - - - eng - English - - - fre - French - - - - - - dc:relation - textfield - Reference to a related resource. - false - - - - dc:rights - textarea - Information about intellectual property rights, copyright, and various property rights. - false - - - - - - - - - - - image/tiff - image/tif - - - - - plugins/slide_viewer.inc - ShowSlideStreamsInFieldSets - showJPG - - - - - - - image/tiff - - - image/tif - - - - plugins/ImageManipulation.inc - ImageManipulation - createJP2 - jp2 - JP2 - - - - - - - plugins/DemoFormBuilder.inc - DemoFormBuilder - buildQDCForm - handleQDCForm - - - - - dc:title - textfield - The name given to the resource - true - - - - dc:creator - textfield - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - dc:subject - select - Subject - false - - - image - image - - - photograph - photograph - - - presentation - presentation - - - art - art - - - - - - dc:description - textarea - Description of the Image - true - - - - dc:publisher - textfield - An entity, (including persons, organizations, or services), responsible for making the resource available. - false - - - - dc:contributor - textfield - An entity responsible for contributing to the content of the resource such as a person, organization or service. - false - - - - dc:date - textfield - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - false - - - - dc:type - textfield - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - false - - - - dc:source - textfield - A reference to a resource from which the present resource is derived. - false - - - - dc:identifier - textfield - A unique reference to the resource; In this instance, the accession number or collection number. - false - - - - dc:language - select - The language of the intellectual content of the resource. - false - - - eng - English - - - fre - French - - - - - - dc:relation - textfield - Reference to a related resource. - false - - - - dc:rights - textarea - Information about intellectual property rights, copyright, and various property rights. - false - - - - - - - - - - - image/tiff - image/tif - - - - image/tiff - image/tif - - - - - - - - - - - - - - - The name given to the resource - - - An entity primarily responsible for making the content of the resource such as a person, organization or service. - - - Subject - - image - photograph - presentation - art - - - - Description of the Image - - - An entity, (including persons, organizations, or services), responsible for making the resource available. - - - An entity responsible for contributing to the content of the resource such as a person, organization or service. - - - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - - - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - - - A reference to a resource from which the present resource is derived. - - - A unique reference to the resource; In this instance, the accession number or collection number. - - - The language of the intellectual content of the resource. - - English - French - - - - Reference to a related resource. - - - Information about intellectual property rights, copyright, and various property rights. - - - - - - - - diff --git a/content_models/islandora_viewerSdep-slideCModel.xml b/content_models/islandora_viewerSdep-slideCModel.xml deleted file mode 100644 index d45fddb8..00000000 --- a/content_models/islandora_viewerSdep-slideCModel.xml +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2009-11-27T17:57:45.462Z - Created with Admin GUI "New Object" command - - - - modifyDatastreamByValue - RELS-EXT - fedoraAdmin - 2009-11-27T18:02:20.095Z - - - - - modifyDatastreamByValue - METHODMAP - fedoraAdmin - 2009-11-27T18:17:31.165Z - - - - - modifyDatastreamByValue - DSINPUTSPEC - fedoraAdmin - 2009-11-27T18:20:50.036Z - - - - - modifyDatastreamByValue - WSDL - fedoraAdmin - 2009-11-27T18:22:44.560Z - - - - - modifyDatastreamByValue - WSDL - fedoraAdmin - 2009-11-27T18:37:33.153Z - - - - - modifyDatastreamByValue - RELS-EXT - fedoraAdmin - 2010-03-11T21:01:10.851Z - - - - - modifyDatastreamByValue - RELS-EXT - fedoraAdmin - 2010-05-14T20:05:44.278Z - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This METHODMAP datastream is included as a starting point to - assist in the creation of a service deployment. The METHODMAP - should define the the mapping of the WSDL to Fedora object methods. - - - - - - - - - - - - - - - - - - - - - - This DSINPUTSPEC datastream is included as a starting point to - assist in the creation of a service deployment. The DSINPUTSPEC - should define the datastreams to be used by WSDL-defined methods. - - - - - - - - DC - text/xml - - - - - - - - - - - This WSDL datastream is included as a starting point to - assist in the creation of a service deployment. The WSDL - should define the services provided by this - service deployment. - For more information about service deployments, see: - http://fedora-commons.org/confluence/x/dgBI. - For examples of completed service deployment objects, see the demonstration - objects included with your Fedora distribution, such as: - demo:2, demo:13, demo:20, and demo:28. - For more information about the demonstration objects, see: - http://fedora-commons.org/confluence/x/AwFI. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - viewerSdep-slideCModel - islandora:viewerSdep-slideCModel - - - - - diff --git a/example_collection_views/MHL-sparqltoHtml.xsl b/example_collection_views/MHL-sparqltoHtml.xsl index 2b3295fe..4a2904f6 100644 --- a/example_collection_views/MHL-sparqltoHtml.xsl +++ b/example_collection_views/MHL-sparqltoHtml.xsl @@ -1,196 +1,270 @@ - - - - - - - - - - - - - - - - - - + + +
-
+
+ -
-
- - - - - - - - - - - - - - - - - - - - - /fedora/repository//-/ - - - /fedora/repository/// - - - - - - - - - /fedora/repository//TN - -
- - - - - - -
-- - - /fedora/repository//-/ - + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + /fedora/repository/ + /-/ + + + + /fedora/repository/ + / + / + + + + + + + + + + + + /fedora/repository/ + /TN + + + +
+ + + + + + + +
-- + + + /fedora/repository/ + /-/ + + DETAILS - -- -
- - - - - - -
- - -   - - - - - - - - - - + -- + + + + + + + + + + +   + + + + + + + + + + - - + + - - - + + + - - - - - - - - - - - - - + + + + + + + + + + + + +
\ No newline at end of file diff --git a/example_collection_views/critter.xsl b/example_collection_views/critter.xsl index 294218ed..cbfcd81b 100644 --- a/example_collection_views/critter.xsl +++ b/example_collection_views/critter.xsl @@ -1,33 +1,96 @@ - + - + -
    -
  • Date Collected:
  • -
  • Type:
  • -
  • Phylum:
  • -
  • SubPhylum:
  • -
  • Class:
  • -
  • Order:
  • -
  • Family:
  • -
  • Genus:
  • -
  • Species:
  • +
      +
    • + Date Collected: + + +
    • +
    • + Type: + + +
    • +
    • + Phylum: + + +
    • +
    • + SubPhylum: + + +
    • +
    • + Class: + + +
    • +
    • + Order: + + +
    • +
    • + Family: + + +
    • +
    • + Genus: + + +
    • +
    • + Species: + + +
    • -
    +
-

Collection Location

-
    -
  • Site Name:
  • -
  • Country:
  • -
  • Region:
  • -
  • Latitude:
  • -
  • Longitude:
  • -
  • Depth: Feet
  • -
-

Description

-
+

Collection Location

+
    +
  • + Site Name: + + +
  • +
  • + Country: + + +
  • +
  • + Region: + + +
  • +
  • + Latitude: + + +
  • +
  • + Longitude: + + +
  • +
  • + Depth: + + + Feet +
  • +
+

Description

+
+ +
-
+
\ No newline at end of file diff --git a/example_collection_views/flv-sparqltoHtml.xsl b/example_collection_views/flv-sparqltoHtml.xsl index e591de97..7eebe2f3 100644 --- a/example_collection_views/flv-sparqltoHtml.xsl +++ b/example_collection_views/flv-sparqltoHtml.xsl @@ -1,65 +1,96 @@ - - - - - - - - - - - - - - - - - -
-
+
+ -
-
- - - - - - - - - - - - - - - - - - - - - /fedora/repository//-/ - - - /fedora/repository//OBJ/ - - - - - - - /fedora/repository//-/ - - - /fedora/repository//TN - - - -
- - - /fedora/repository//-/ - - - + + + + + +
+ + + + + + + + + + + + + + + + + + + + + /fedora/repository/ + /-/ + + + + /fedora/repository/ + /OBJ/ + + + + + + + + /fedora/repository/ + /-/ + + + + + /fedora/repository/ + /TN + + + + + + +
+ + + /fedora/repository/ + /-/ + + + + - - - - - - -
- - -   - - - - - - - - - - + + + + + + + + + +   + + + + + + + + + + - - + + - - - + + + - - - - - - - - - - - - - + + + + + + + + + + + + +
\ No newline at end of file diff --git a/example_collection_views/mlp-sparqltoHtml.xsl b/example_collection_views/mlp-sparqltoHtml.xsl index 63688c08..892d8ed2 100644 --- a/example_collection_views/mlp-sparqltoHtml.xsl +++ b/example_collection_views/mlp-sparqltoHtml.xsl @@ -1,193 +1,264 @@ - - - - - - - - - - - - - - - - - - + + +
-
+
+ -
-
- - - - - - - - - - - - - - - - - - - - - /fedora/repository//-/ - - - /fedora/repository/// - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + /fedora/repository/ + /-/ + + + + /fedora/repository/ + / + / + + + + + - - /fedora/repository//TN - -
+ + + /fedora/repository/ + /TN + + +
- + - -
-- - - /fedora/repository//-/ - + +
-- +
+ + /fedora/repository/ + /-/ + + DETAILS - -- -
- - - - - - -
- - -   - - - - - - - - - - + -- + + + + + + + + + + +   + + + + + + + + + + - - + + - - - + + + - - - - - - - - - - - - - + + + + + + + + + + + + +
\ No newline at end of file diff --git a/example_collection_views/refworks.xsl b/example_collection_views/refworks.xsl index 2ef0c8df..e021ef2b 100644 --- a/example_collection_views/refworks.xsl +++ b/example_collection_views/refworks.xsl @@ -1,92 +1,216 @@ - + - - -

General Information

- - - - - - - - - - - - - - - -
Periodical:
Abbreviation:
Volume:
Issue:
Publisher:
Place of Publication:
Edition:
Year:
Date:
Start Page:
Other Pages:
ISSN/ISBN:
Language:
UL:
-
- -

Titles

-
    - -
  • -
    -
-
- -
    -

    Secondary Titles

    - -
  • -
    -
-
- -

Authors

-
    - -
  • -
    -
-
+ + +

General Information

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Periodical: + + +
+ Abbreviation: + + +
+ Volume: + + +
+ Issue: + + +
+ Publisher: + + +
+ Place of Publication: + + +
+ Edition: + + +
+ Year: + + +
+ Date: + + +
+ Start Page: + + +
+ Other Pages: + + +
+ ISSN/ISBN: + + +
+ Language: + + +
+ UL: + + +
+
+ +

Titles

+
    + +
  • + +
  • +
    +
+
+ +
    +

    Secondary Titles

    + +
  • + +
  • +
    +
+
+ +

Authors

+
    + +
  • + +
  • +
    +
+
- -
    -

    Secondary Authors

    - -
  • -
    -
-
- -

Keywords

-
    - -
  • -
    -
-
- -

Abstract

- -
-
-
- -

Notes

- -
-
-
- - - - - http://articles.library.upei.ca:7888/godot/hold_tab.cgi?hold_tab_branch=PCU&issn=&date=&volume=&issue=&spage=&atitle=&stitle= - -
- - - -
+ +
    +

    Secondary Authors

    + +
  • + +
  • +
    +
+
+ +

Keywords

+
    + +
  • + +
  • +
    +
+
+ +

Abstract

+ +
+ +
+
+
+ +

Notes

+ +
+ +
+
+
+ + + + + http://articles.library.upei.ca:7888/godot/hold_tab.cgi?hold_tab_branch=PCU&issn= + &date= + &volume= + &issue= + &spage= + &atitle= + &stitle= + + +
+ + + +
\ No newline at end of file diff --git a/example_collection_views/riri-sparqltoHtml.xsl b/example_collection_views/riri-sparqltoHtml.xsl index 72907d1c..28f4e663 100644 --- a/example_collection_views/riri-sparqltoHtml.xsl +++ b/example_collection_views/riri-sparqltoHtml.xsl @@ -1,65 +1,96 @@ - - - - - - - - - - - - - - - - - -
-
+
+ -
-
- - - - - - - - - - - - - - - - - - - - - /fedora/repository//-/ - - - /fedora/repository//OBJ/.pdf - - - - - - - - - /fedora/repository//TN - - - -
- - - - - - -
-- - - /fedora/repository//-/ - + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + /fedora/repository/ + /-/ + + + + /fedora/repository/ + /OBJ/ + .pdf + + + + + + + + + + + /fedora/repository/ + /TN + + + + + + +
+ + + + + + + +
-- + + + /fedora/repository/ + /-/ + + DETAILS - -- -
- - - - - - -
- - -   - - - - - - - - - - + -- + + + + + + + + + + +   + + + + + + + + + + - - + + - - - + + + - - - - - - - - - - - - - + + + + + + + + + + + + +
\ No newline at end of file diff --git a/example_collection_views/sparqltoHtml.xsl b/example_collection_views/sparqltoHtml.xsl index 15e2e35e..7bb1f0d6 100644 --- a/example_collection_views/sparqltoHtml.xsl +++ b/example_collection_views/sparqltoHtml.xsl @@ -1,125 +1,190 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - + + + + +
-
+ + + /fedora/repository/ + /TN + + + + + + /fedora/repository/ + /-/ + + + + +
+ -
-
+ + + + +
+
\ No newline at end of file diff --git a/fedora_repository.info b/fedora_repository.info index 7c88f2c8..018910bf 100644 --- a/fedora_repository.info +++ b/fedora_repository.info @@ -1,8 +1,8 @@ -; $Id$ -name = Digital Repository +name = Islandora Repository dependencies[] = imageapi dependencies[] = tabs +dependencies[] = islandora_content_model_forms description = Shows a list of items in a fedora collection. -package = Fedora Repository -version = 6.x-$Format:%h$-dev +package = Islandora +version = 6.x-dev core = 6.x diff --git a/fedora_repository.install b/fedora_repository.install index 84016939..0840e2e4 100644 --- a/fedora_repository.install +++ b/fedora_repository.install @@ -1,5 +1,4 @@ collection settings are correct.', - array('@collection-settings' => $base_url.'/admin/settings/fedora_repository')); + // Test for Curl + $requirements['curl']['title'] = $t('PHP Curl extension library'); + if (!function_exists('curl_init')) { + $requirements['curl']['value'] = $t("Not installed"); + $requirements['curl']['severity'] = REQUIREMENT_ERROR; + $requirements['curl']['description'] = $t("Ensure that the PHP Curl extension is installed."); } else { - $requirements['fedora-repository']['value'] = t("Available"); - $requirements['fedora-repository']['severity'] = REQUIREMENT_OK; + $requirements['curl']['value'] = $t("Installed"); + $requirements['curl']['severity'] = REQUIREMENT_OK; } - // Check for ImageMagick - $requirements['fedora-imagemagick']['title'] = t("ImageMagick convert in \$PATH"); - $result = exec('convert'); - if (!$result) { - $requirements['fedora-imagemagick']['value'] = t('Not in $PATH'); - $requirements['fedora-imagemagick']['description'] = t('Islandora will not be able to create thumbnails. Ensure that ImageMagick is installed and the convert command is executable by the web server user.'); - $requirements['fedora-imagemagick']['severity'] = REQUIREMENT_WARNING; + // Test for DOM + $requirements['dom']['title'] = $t("PHP DOM XML extension library"); + if (!method_exists('DOMDocument', 'loadHTML')) { + $requirements['dom']['value'] = $t("Not installed"); + $requirements['dom']['severity'] = REQUIREMENT_ERROR; + $requirements['dom']['description'] = $t("Ensure that the PHP DOM XML extension is installed."); } else { - $requirements['fedora-imagemagick']['value'] = t("Available"); - $requirements['fedora-imagemagick']['severity'] = REQUIREMENT_OK; + $requirements['dom']['value'] = $t("Installed"); + $requirements['dom']['severity'] = REQUIREMENT_OK; } - $requirements['fedora-kakadu']['title'] = 'Kakadu kdu_compress in $PATH'; - $kdu_res = exec('kdu_compress -v'); - if (!$kdu_res) { - $requirements['fedora-kakadu']['value'] = ('Not in $PATH'); - $requirements['fedora-kakadu']['description'] = t('Islandora cannot convert TIFF image files to JPEG2000 format. Ensure Kakadu is installed and the kdu_compress command is executable by the web server user.'); - $requirements['fedora-kakadu']['severity'] = REQUIREMENT_WARNING; + // Test for XSLT + $requirements['xsl']['title'] = $t("PHP XSL extension library"); + if (!class_exists('XSLTProcessor')) { + $requirements['xslt']['value'] = $t("Not installed"); + $requirements['xslt']['severity'] = REQUIREMENT_ERROR; + $requirements['xslt']['description'] = $t("Ensure that the PHP XSL extension is installed."); } else { - $requirements['fedora-kakadu']['value'] = t("Available"); - $requirements['fedora-kakadu']['severity'] = REQUIREMENT_OK; + $requirements['xslt']['value'] = $t("Installed"); + $requirements['xslt']['severity'] = REQUIREMENT_OK; + } + } + elseif ($phase == 'runtime') { + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + + $requirements['fedora-repository']['title'] = $t("Fedora server"); + if (!fedora_available()) { + $requirements['fedora-repository']['value'] = $t("Not available"); + $requirements['fedora-repository']['severity'] = REQUIREMENT_ERROR; + $requirements['fedora-repository']['description'] = $t('Ensure that Fedora is running and that the collection settings are correct.', array('@collection-settings' => url('admin/settings/fedora_repository'))); + } + else { + $requirements['fedora-repository']['value'] = $t("Available"); + $requirements['fedora-repository']['severity'] = REQUIREMENT_OK; } } return $requirements; -} \ No newline at end of file +} diff --git a/fedora_repository.module b/fedora_repository.module index 307f2ec2..e83d91f5 100644 --- a/fedora_repository.module +++ b/fedora_repository.module @@ -1,18 +1,8 @@ createAdminForm(); } - - /** * drupal hook * calls the fedora_repositorys_admin form @@ -36,6 +24,10 @@ function fedora_repository_menu() { /** * drupal hook to show help + * + * @param type $path + * @param type $arg + * @return type */ function fedora_repository_help($path, $arg) { switch ($path) { @@ -46,6 +38,12 @@ function fedora_repository_help($path, $arg) { } } +/** + * fedora repository purge object + * @param type $pid + * @param type $name + * @return type + */ function fedora_repository_purge_object($pid = NULL, $name = NULL) { if (!user_access('purge objects and datastreams')) { drupal_set_message(t('You do not have access to add a datastream to this object.'), 'error'); @@ -55,16 +53,23 @@ function fedora_repository_purge_object($pid = NULL, $name = NULL) { drupal_set_message(t('You must specify an object pid to purge an object.'), 'error'); return ''; } - $output = t('Are you sure you wish to purge object %name %pid!
This cannot be undone
', - array( - '%name' => $name, - '%pid' => $pid) + $output = t('Are you sure you wish to purge object %name %pid!
This cannot be undone
', array( + '%name' => $name, + '%pid' => $pid) ); $output .= drupal_get_form('fedora_repository_purge_object_form', $pid); return $output; } +/** + * fedora repository collection view + * @global type $user + * @param type $pid + * @param type $collection + * @param type $pageNumber + * @return type + */ function fedora_repository_collection_view($pid = NULL, $collection = NULL, $pageNumber = NULL) { module_load_include('inc', 'fedora_repository', 'ObjectHelper'); global $user; @@ -75,7 +80,7 @@ function fedora_repository_collection_view($pid = NULL, $collection = NULL, $pag $objectHelper = new ObjectHelper(); if ($pid == NULL) { - $pid = variable_get('fedora_repository_pid', 'islandora:top'); + $pid = variable_get('fedora_repository_pid', 'islandora:root'); } $content = ''; @@ -88,6 +93,13 @@ function fedora_repository_collection_view($pid = NULL, $collection = NULL, $pag return $content; } +/** + * fedora repository ingest object + * @param type $collection_pid + * @param type $collection_label + * @param type $content_model + * @return type + */ function fedora_repository_ingest_object($collection_pid=NULL, $collection_label = NULL, $content_model = NULL) { module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); module_load_include('inc', 'fedora_repository', 'ObjectHelper'); @@ -96,12 +108,12 @@ function fedora_repository_ingest_object($collection_pid=NULL, $collection_label return ''; } - if (!validPid($collection_pid)) { - if (validPid(urldecode($collection_pid))) { + if (!valid_pid($collection_pid)) { + if (valid_pid(urldecode($collection_pid))) { $collection_pid = urldecode($collection_pid); } else { - drupal_set_message(t("This collection PID $collection_pid is not valid"), 'error'); + drupal_set_message(t("This collection PID @collection_pid is not valid", check_plain($collection_pid)), 'error'); return ' '; } } @@ -120,9 +132,26 @@ function fedora_repository_ingest_object($collection_pid=NULL, $collection_label return $output; } -function fedora_repository_ingest_form_submit($form, &$form_state) { - //only validate the form if the submit button was pressed (other buttons may be used for AHAH - if ($form_state['clicked_button']['#id'] == 'edit-submit') { +/** + * fedora repository ingest form submit + * @global type $base_url + * @global type $user + * @param array $form + * @param array $form_state + */ +function fedora_repository_ingest_form_submit(array $form, array &$form_state) { +//only validate the form if the submit button was pressed (other buttons may be used for AHAH + if ($form_state['ahah_submission']) { + $form_state['submitted'] = FALSE; + return; + } + //ddebug_backtrace(); + if ($form_state['storage']['xml'] && module_exists('islandora_content_model_forms')) { + module_load_include('inc', 'islandora_content_model_forms', 'IngestObjectMetadataForm'); + $xml_form = new IngestObjectMetadataForm(); + $xml_form->submit($form, $form_state); + } + elseif (strpos($form_state['clicked_button']['#id'], 'edit-submit') === 0) { global $base_url; module_load_include('inc', 'fedora_repository', 'CollectionClass'); module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); @@ -157,14 +186,24 @@ function fedora_repository_ingest_form_submit($form, &$form_state) { } if ($redirect) { - $form_state['redirect'] = ($err) ? ' ' : $base_url . "/fedora/repository/{$form_state['values']['collection_pid']}"; + $form_state['redirect'] = ($err) ? ' ' : url("fedora/repository/{$form_state['values']['collection_pid']}"); } } } +/** + * fedora repository ingest form validate + * @param type $form + * @param type $form_state + * @return type + */ function fedora_repository_ingest_form_validate($form, &$form_state) { - //only validate the form if the submit button was pressed (other buttons may be used for AHAH - if ($form_state['clicked_button']['#id'] == 'edit-submit') { +//only validate the form if the submit button was pressed (other buttons may be used for AHAH + if ($form_state['ahah_submission']) { + $form_state['submitted'] = FALSE; + return; + } + if (strpos($form_state['clicked_button']['#id'], 'edit-submit') === 0 && $form_state['ahah_submission'] != 1) { switch ($form_state['storage']['step']) { case 1: $form_state['storage']['step']++; @@ -172,8 +211,13 @@ function fedora_repository_ingest_form_validate($form, &$form_state) { break; case 2: - - // Get the uploaded file. +// XML based form. + if ($form_state['storage']['xml']) { + module_load_include('inc', 'xml_form_api', 'XMLForm'); + $xml_form = new XMLForm($form_state); + $xml_form->validate($form, $form_state); + } +// Get the uploaded file. $validators = array(); if (!empty($_FILES['files']['name']['ingest-file-location'])) { @@ -183,7 +227,7 @@ function fedora_repository_ingest_form_validate($form, &$form_state) { $form_state['values']['ingest-file-location'] = $fileObject->filepath; } - if (file_exists($form_state['values']['ingest-file-location'])) { + if (isset($form_state['values']['ingest-file-location']) && file_exists($form_state['values']['ingest-file-location'])) { module_load_include('inc', 'fedora_repository', 'ContentModel'); module_load_include('inc', 'fedora_repository', 'MimeClass'); @@ -200,15 +244,18 @@ function fedora_repository_ingest_form_validate($form, &$form_state) { if (!empty($file)) { if (!in_array($dformat, $allowedMimeTypes)) { - form_set_error('ingest-file-location', t('The uploaded file\'s mimetype (' . $dformat . ') is not associated with this Content Model. The allowed types are ' . - implode(' ', $allowedMimeTypes))); + form_set_error('ingest-file-location', + t('The uploaded file\'s mimetype') . + ' (' . $dformat . ') ' . + t('is not associated with this Content Model. The allowed types are') . + ' ' . implode(' ', $allowedMimeTypes)); file_delete($file); return; } elseif (!$cm->execIngestRules($file, $dformat)) { drupal_set_message(t('Error following Content Model Rules'), 'error'); foreach (ContentModel::$errors as $err) { - drupal_set_message($err, 'error'); + drupal_set_message(check_plain($err), 'error'); } } } @@ -220,18 +267,35 @@ function fedora_repository_ingest_form_validate($form, &$form_state) { } } +/** + * fedora repository ingest form + * @param type $form_state + * @param type $collection_pid + * @param type $collection_label + * @param type $content_model + * @return type + */ function fedora_repository_ingest_form(&$form_state, $collection_pid, $collection_label = NULL, $content_model = NULL) { module_load_include('inc', 'fedora_repository', 'formClass'); - // For the sake of easily maintaining the module in different core versions create our own form_values variable. +// For the sake of easily maintaining the module in different core versions create our own form_values variable. if (empty($form_state['storage']['step'])) { $form_state['storage']['step'] = 1; } $ingestForm = new formClass(); $form_state['storage']['content_model'] = $content_model; $form_state['storage']['collection_pid'] = $collection_pid; - return $ingestForm->createIngestForm($collection_pid, $collection_label, $form_state); + $form = $ingestForm->createIngestForm($collection_pid, $collection_label, $form_state); + return $form; } +/** + * fedora repository purge object form + * @global type $base_url + * @param type $form_state + * @param type $pid + * @param type $referrer + * @return type + */ function fedora_repository_purge_object_form(&$form_state, $pid, $referrer = NULL) { global $base_url; if (!user_access('purge objects and datastreams')) { @@ -251,7 +315,7 @@ function fedora_repository_purge_object_form(&$form_state, $pid, $referrer = NUL ); } if (!isset($form_state['storage']['confirm'])) { - // do your normal $form definition here +// do your normal $form definition here $form['submit'] = array( @@ -263,21 +327,27 @@ function fedora_repository_purge_object_form(&$form_state, $pid, $referrer = NUL if (!empty($collectionPid)) { $collectionPid = $_SESSION['fedora_collection']; } - //$form['#redirect'] = $referrer; +//$form['#rebuild'] = $false; return $form; } else { - // ALSO do $form definition here. Your final submit handler (after user clicks Yes, I Confirm) will only see $form_state info defined here. Form you create here passed as param1 to confirm_form +// ALSO do $form definition here. Your final submit handler (after user clicks Yes, I Confirm) will only see $form_state info defined here. Form you create here passed as param1 to confirm_form return confirm_form($form, 'Confirm Purge Object', $referrer, 'Are you sure you want to delete this object? This action cannot be undone.', 'Delete', 'Cancel'); //Had better luck leaving off last param 'name' } return $form; } +/** + * add stream + * @param type $collection_pid + * @param type $collectionName + * @return type + */ function add_stream($collection_pid=NULL, $collectionName=NULL) { module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); - if (!validPid($collection_pid)) { + if (!valid_pid($collection_pid)) { drupal_set_message(t("This PID is not valid!"), 'error'); return ' '; } @@ -294,6 +364,13 @@ function add_stream($collection_pid=NULL, $collectionName=NULL) { return $output; } +/** + * add stream form submit + * @global type $base_url + * @param type $form + * @param type $form_state + * @return type + */ function add_stream_form_submit($form, &$form_state) { global $base_url; if (!empty($form_state['submit']) && $form_state['submit'] == 'OK') { @@ -332,18 +409,30 @@ function add_stream_form_submit($form, &$form_state) { file_delete($file); } catch (exception $e) { - drupal_set_message(t($e->getMessage()), 'error'); + drupal_set_message(t('@message', array('@message' => check_plain($e->getMessage()))), 'error'); return; } $form_state['rebuild'] = TRUE; } +/** + * add stream form + * @param type $form_state + * @param type $pid + * @return type + */ function add_stream_form(&$form_state, $pid) { module_load_include('inc', 'fedora_repository', 'formClass'); $addDataStreamForm = new formClass(); return $addDataStreamForm->createAddDataStreamForm($pid, $form_state); } +/** + * add stream form validate + * @param type $form + * @param type $form_state + * @return type + */ function add_stream_form_validate($form, &$form_state) { if ($form_state['clicked_button']['#value'] == 'OK') { $form_state['rebuild'] = TRUE; @@ -356,7 +445,7 @@ function add_stream_form_validate($form, &$form_state) { return FALSE; } if (!(preg_match("/^[a-zA-Z]/", $dsid))) { - form_set_error('', t("Data stream ID ($dsid) has to start with a letter.")); + form_set_error('', t("Data stream ID (@dsid) has to start with a letter.", array('@dsid' => check_plain($dsid)))); return FALSE; } if (strlen($dsLabel) > 64) { @@ -368,20 +457,28 @@ function add_stream_form_validate($form, &$form_state) { return FALSE; } $validators = array( - // 'file_validate_is_image' => array(), - // 'file_validate_image_resolution' => array('85x85'), - // 'file_validate_size' => array(30 * 1024), +// 'file_validate_is_image' => array(), +// 'file_validate_image_resolution' => array('85x85'), +// 'file_validate_size' => array(30 * 1024), ); $fileObject = file_save_upload('add-stream-file-location', $validators); - // Move the uploaded file to Drupal's files directory. +// Move the uploaded file to Drupal's files directory. file_move($fileObject->filepath, 0, 'FILE_EXISTS_RENAME'); $form_state['values']['add-stream-file-location'] = $fileObject->filepath; - // TODO: Add error checking here. +// TODO: Add error checking here. $form_state['rebuild'] = FALSE; } +/** + * fedora repository purge stream + * @global type $user + * @param type $pid + * @param type $dsId + * @param type $name + * @return type + */ function fedora_repository_purge_stream($pid = NULL, $dsId = NULL, $name = NULL) { module_load_include('inc', 'fedora_repository', 'ObjectHelper'); global $user; @@ -394,14 +491,36 @@ function fedora_repository_purge_stream($pid = NULL, $dsId = NULL, $name = NULL) return ' '; } - $output = t('Are you sure you wish to purge this datastream %name
', - array( - '%name' => $name) + $output = t('Are you sure you wish to purge this datastream %name
', array( + '%name' => $name) ); $output .= drupal_get_form('fedora_repository_purge_stream_form', $pid, $dsId); return $output; } +function fedora_repository_purge_object_form_validate($form, &$form_state) { + module_load_include('inc', 'fedora_repository', 'api/fedora_collection'); + $pid = $form_state['values']['pid']; + + $objectHelper = new ObjectHelper(); + $contentModels = $objectHelper->get_content_models_list($pid); + foreach ($contentModels as $contentModel) { + if ($contentModel->pid == 'islandora:collectionCModel') { + $member_pids = get_related_items_as_array($pid, 'isMemberOfCollection'); + if (is_array($member_pids) && ! empty($member_pids)) { + form_set_error('new_collection_pid', t("Please purge all members of this collection before deleting the collection itself.")); + return; + } + } + } +} + +/** + * fedora repository purge object form submit + * @param type $form + * @param type $form_state + * @return type + */ function fedora_repository_purge_object_form_submit($form, &$form_state) { module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); $pid = $form_state['values']['pid']; @@ -410,7 +529,7 @@ function fedora_repository_purge_object_form_submit($form, &$form_state) { $form_state['rebuild'] = TRUE; // along with this } else { - // this is where you do your processing after they have pressed the confirm button +// this is where you do your processing after they have pressed the confirm button $params = array( "pid" => $pid, "logMessage" => "Purged", @@ -418,7 +537,7 @@ function fedora_repository_purge_object_form_submit($form, &$form_state) { ); try { $soapHelper = new ConnectionHelper(); - $client = $soapHelper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); + $client = $soapHelper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/wsdl?api=API-M')); $object = $client->__soapCall('purgeObject', array($params)); unset($form_state['storage']['confirm']); } catch (exception $e) { @@ -426,7 +545,7 @@ function fedora_repository_purge_object_form_submit($form, &$form_state) { drupal_set_message(t('Error: Insufficient permissions to purge object.'), 'error'); } else { - drupal_set_message(t($e->getMessage()), 'error'); + drupal_set_message(t('@message', array('@message' => check_plain($e->getMessage()))), 'error'); } return; } @@ -435,7 +554,7 @@ function fedora_repository_purge_object_form_submit($form, &$form_state) { } elseif (empty($collectionPid) && !empty($_SESSION['fedora_collection']) && $_SESSION['fedora_collection'] != $pid) { $collectionPid = $_SESSION['fedora_collection']; - + $form_state['redirect'] = "fedora/repository/$collectionPid/"; } else { @@ -444,6 +563,13 @@ function fedora_repository_purge_object_form_submit($form, &$form_state) { } } +/** + * fedora repository purge stream form + * @param type $form_state + * @param type $pid + * @param type $dsId + * @return type + */ function fedora_repository_purge_stream_form(&$form_state, $pid, $dsId) { $form['pid'] = array( '#type' => 'hidden', @@ -461,22 +587,35 @@ function fedora_repository_purge_stream_form(&$form_state, $pid, $dsId) { return $form; } +/** + * fedora repository purge stream form submit + * @global type $base_url + * @param type $form + * @param array $form_state + */ function fedora_repository_purge_stream_form_submit($form, &$form_state) { global $base_url; module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - //$client = getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); $pid = $form_state['values']['pid']; $item = new Fedora_Item($pid); $dsid = $form_state['values']['dsid']; try { $item->purge_datastream($dsid); } catch (exception $e) { - drupal_set_message(t($e->getMessage()), 'error'); + drupal_set_message(t('@message', array('@message' => check_plain($e->getMessage()))), 'error'); } $form_state['redirect'] = $base_url . "/fedora/repository/$pid"; } -function fedora_repository_replace_stream($pid, $dsId, $dsLabel, $collectionName = NULL) { +/** + * fedora repository replace stream + * @param type $pid + * @param type $dsId + * @param type $dsLabel + * @param type $collectionName + * @return type + */ +function fedora_repository_replace_stream($pid, $dsId, $dsLabel = '', $collectionName = NULL) { if ($pid == NULL || $dsId == NULL) { drupal_set_message(t('You must specify an pid and dsId to replace.'), 'error'); return ''; @@ -486,22 +625,34 @@ function fedora_repository_replace_stream($pid, $dsId, $dsLabel, $collectionName return $output; } +/** + * fedora repository replace stream form + * @param type $form_state + * @param type $pid + * @param type $dsId + * @param type $dsLabel + * @return type + */ function fedora_repository_replace_stream_form(&$form_state, $pid, $dsId, $dsLabel) { - //module_load_module_load_include('hp', ''Fedora_Repository'', 'config', 'fedora_repository', ''); module_load_include('inc', 'Fedora_Repository', 'formClass'); - //$client = getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); $replaceDataStreamForm = new formClass(); return $replaceDataStreamForm->createReplaceDataStreamForm($pid, $dsId, $dsLabel, $form_state); } +/** + * fedora repository replace stream form validate + * @param type $form + * @param type $form_state + * @return type + */ function fedora_repository_replace_stream_form_validate($form, &$form_state) { - // If a file was uploaded, process it. +// If a file was uploaded, process it. if (isset($_FILES['files']) && is_uploaded_file($_FILES['files']['tmp_name']['file'])) { - // attempt to save the uploaded file +// attempt to save the uploaded file $file = file_save_upload('file', array(), file_directory_path()); - // set error is file was not uploaded +// set error is file was not uploaded if (!$file) { form_set_error('file', 'Error uploading file.'); return; @@ -515,26 +666,32 @@ function fedora_repository_replace_stream_form_validate($form, &$form_state) { return; } - // set files to form_state, to process when form is submitted +// set files to form_state, to process when form is submitted $form_state['values']['file'] = $file; } } +/** + * fedora repository replace stream form submit + * @global type $base_url + * @param type $form + * @param array $form_state + */ function fedora_repository_replace_stream_form_submit($form, &$form_state) { global $base_url; $file = $form_state['values']['file']; $pid = $form_state['values']['pid']; $dsid = $form_state['values']['dsId']; $dsLabel = $form_state['values']['dsLabel']; - // Remove the original file extension from the label and add the new one - $indexOfDot = strrpos($dsLabel,'.');//use strrpos to get the last dot - if($indexOfDot !== FALSE){ +// Remove the original file extension from the label and add the new one + $indexOfDot = strrpos($dsLabel, '.'); //use strrpos to get the last dot + if ($indexOfDot !== FALSE) { $dsLabel = substr($dsLabel, 0, $indexOfDot); $dsLabel .= substr($file->filename, strrpos($file->filename, '.')); // Add the file extention to the end of the label.; } module_load_include('inc', 'Fedora_Repository', 'MimeClass'); module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - + $file_basename = basename($file->filepath); $file_directory = dirname($file->filepath); $streamUrl = $base_url . '/' . $file_directory . '/' . urlencode($file_basename); @@ -546,13 +703,31 @@ function fedora_repository_replace_stream_form_submit($form, &$form_state) { $dformat = $mimetype->getType($file->filepath); $item = new Fedora_Item($pid); - - $item->modify_datastream_by_reference($streamUrl, $dsid, $dsLabel, $dformat); - - $form_state['redirect'] = 'fedora/repository/' . $pid; + $info = $item->get_datastream_info($dsid); + if($info->datastream->controlGroup == 'M') { + $item->modify_datastream_by_reference($streamUrl, $dsid, $dsLabel, $dformat); + } elseif ($info->datastream->controlGroup == 'X') { + if($dformat == 'text/xml') { + $item->modify_datastream_by_value(file_get_contents($file->filepath), $dsid, $dsLabel, $dformat); + } + else { + drupal_set_message('File must be of mimetype text/xml in order to replace inline XML datastream.', 'error'); + } + } else { + drupal_set_message('Cannot replace Redirect or Managed Datastream.', 'error'); + } + + $form_state['redirect'] = 'fedora/repository/' . $pid; } +/** + * fedora repository edit qdc page + * @global type $user + * @param type $pid + * @param type $dsId + * @return type + */ function fedora_repository_edit_qdc_page($pid = NULL, $dsId = NULL) { module_load_include('inc', 'fedora_repository', 'ObjectHelper'); global $user; @@ -569,6 +744,14 @@ function fedora_repository_edit_qdc_page($pid = NULL, $dsId = NULL) { return $output; } +/** + * fedora repository edit qdc form + * @global type $user + * @param type $form_state + * @param type $pid + * @param type $dsId + * @return type + */ function fedora_repository_edit_qdc_form(&$form_state, $pid, $dsId = NULL) { module_load_include('inc', 'fedora_repository', 'ContentModel'); module_load_include('inc', 'fedora_repository', 'ObjectHelper'); @@ -585,30 +768,37 @@ function fedora_repository_edit_qdc_form(&$form_state, $pid, $dsId = NULL) { module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); $soapHelper = new ConnectionHelper(); $client = $soapHelper->getSoapClient(variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl')); - // Check if there is a custom edit metadata function defined in the content model. - - $breadcrumbs = array(); - $objectHelper = new ObjectHelper(); - $objectHelper->getBreadcrumbs($pid, $breadcrumbs); - drupal_set_breadcrumb(array_reverse($breadcrumbs)); - - + +// Check if there is a custom edit metadata function defined in the content model. $output = ''; if (($cm = ContentModel::loadFromObject($pid)) !== FALSE) { $output = $cm->buildEditMetadataForm($pid, $dsId); } if (empty($output)) { - // There is no custom function, so just load the standard QDC form. +// There is no custom function, so just load the standard QDC form. $metaDataForm = new formClass(); - //currently we only edit the dc metadata. If you defined a custom form with a custom handler you are sol for now. - return $metaDataForm->createMetaDataForm($pid, $dsId, $client); +//currently we only edit the dc metadata. If you defined a custom form with a custom handler you are sol for now. + return $metaDataForm->createMetaDataForm($pid, $dsId, $client, $form_state); } return $output; } +/** + * fedora repository edit qdc form validate + * @param type $form + * @param boolean $form_state + */ function fedora_repository_edit_qdc_form_validate($form, &$form_state) { - + if ($form_state['storage']['xml']) { + if ($form_state['storage']['step'] == 1) { + $form_state['storage']['step']++; + $form_state['rebuild'] = TRUE; + } + module_load_include('inc', 'xml_form_api', 'XMLForm'); + $xml_form = new XMLForm($form_state); + $xml_form->validate($form, $form_state); + } } /** @@ -621,28 +811,35 @@ function fedora_repository_edit_qdc_form_validate($form, &$form_state) { * @return */ function fedora_repository_edit_qdc_form_submit($form, &$form_state) { - module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); - global $base_url; - if (strstr($form_state['clicked_button']['#id'], 'edit-submit')) { + if ($form_state['storage']['xml']) { + module_load_include('inc', 'islandora_content_model_forms', 'EditObjectMetadataForm'); + $xml_form = new EditObjectMetadataForm(); + $xml_form->submit($form, $form_state); + } + else { + module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); + global $base_url; + if (strstr($form_state['clicked_button']['#id'], 'edit-submit')) { - //$client = getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); - $soap_helper = new ConnectionHelper(); - $client = $soap_helper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); + $soap_helper = new ConnectionHelper(); + $client = $soap_helper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/wsdl?api=API-M')); - // Check the content model for a custom edit metadata form submit function. - if (isset($form_state['values']['pid'])) { - module_load_include('inc', 'fedora_repository', 'ContentModel'); - if (($cm = ContentModel::loadFromObject($form_state['values']['pid'])) !== FALSE) { - return $cm->handleEditMetadataForm($form_state['values']['form_id'], $form_state, $client); + // Check the content model for a custom edit metadata form submit function. + if (isset($form_state['values']['pid'])) { + module_load_include('inc', 'fedora_repository', 'ContentModel'); + if (($cm = ContentModel::loadFromObject($form_state['values']['pid'])) !== FALSE) { + return $cm->handleEditMetadataForm($form_state['values']['form_id'], $form_state, $client); + } } - } - module_load_include('inc', 'fedora_repository', 'formClass'); - $metaDataForm = new formClass(); - $return_value = $metaDataForm->updateMetaData($form_state['values']['form_id'], $form_state['values'], $client); - $form_state['redirect'] = $base_url . '/fedora/repository/' . $form_state['values']['pid']; + module_load_include('inc', 'fedora_repository', 'formClass'); + $metaDataForm = new formClass(); + $return_value = $metaDataForm->updateMetaData($form_state['values']['form_id'], $form_state['values'], $client); + $form_state['storage'] = NULL; + $form_state['redirect'] = $base_url . '/fedora/repository/' . $form_state['values']['pid']; - return $return_value; + return $return_value; + } } } @@ -667,9 +864,12 @@ function fedora_repository_perm() { * drupal hook * determines if a user has access to what they are asking for * - * + * @param type $op + * @param type $node + * @param type $account + * @return type */ -function fedora_repository_access($op, $node, $account) { +function fedora_repository_access($op, $node = NULL, $account = NULL) { module_load_include('inc', 'fedora_repository', 'ObjectHelper'); $objectHelper = new ObjectHelper(); return $objectHelper->fedora_repository_access($op, $node, $account); @@ -682,13 +882,14 @@ function fedora_repository_access($op, $node, $account) { * @param $dsID String */ function makeObject($pid, $dsID) { + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); - if (!validPid($pid)) { + if (!valid_pid($pid)) { drupal_set_message(t("Invalid PID!"), 'error'); return ' '; } - if (!validDsid($dsID)) { + if (!valid_dsid($dsID)) { drupal_set_message(t("Invalid dsID!"), 'error'); return ' '; } @@ -714,34 +915,53 @@ function makeObject($pid, $dsID) { * Sends an ITQL query to the Fedora Resource index (can only communicate with Kowari or mulgara) * Reads the pid and datastream id as url parameters. Queries the collection object for the query * if there is no query datastream falls back to the query shipped with the module. - * @return String + * + * @global type $user + * @param type $pid + * @param type $dsId + * @param type $collection + * @param type $page_number + * @param type $limit + * @return type */ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NULL, $page_number = NULL, $limit = NULL) { module_load_include('inc', 'fedora_repository', 'ObjectHelper'); module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); global $user; - if (!fedora_available()) { - drupal_set_message('The Fedora repository server is currently unavailable. Please contact the site administrator.', 'warning', FALSE); + drupal_set_message(t('The Fedora repository server is currently unavailable. Please contact the site administrator.'), 'warning', FALSE); return ''; } - - if ($pid &!validPid($pid)) { + if (!risearch_available()) { + drupal_set_message(t('The Fedora resource index search is currently unavailable. Please contact the site administrator.'), 'warning', FALSE); + return ''; + } + + if ($pid == NULL) { + $pid = variable_get('fedora_repository_pid', 'islandora:root'); + } + + $item = new fedora_item($pid); + if (!$item->exists()) { + drupal_not_found(); + exit(); + } + + if ($pid & !valid_pid($pid)) { drupal_set_message(t("Invalid PID!"), 'error'); return ' '; } - if ($dsId & !validDsid($dsId)) { + if ($dsId & !valid_dsid($dsId)) { drupal_set_message(t("Invalid dsID!"), 'error'); return ' '; } if (!fedora_repository_access(OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { - //drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied"), 'error'); - if (user_access('access administration pages')) { - drupal_set_message(t("PIDs may be added to allowed namespaces, or all namespace restrictions removed !here", array('!here' => l('here', 'admin/settings/fedora_repository'))), 'warning'); + drupal_set_message(t("PIDs may be added to allowed namespaces, or all namespace restrictions removed @here", array('@here' => l('here', 'admin/settings/fedora_repository'))), 'warning'); } drupal_access_denied(); exit; @@ -750,7 +970,7 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU $objectHelper = new ObjectHelper(); if ($pid == NULL) { - $pid = variable_get('fedora_repository_pid', 'islandora:top'); + $pid = variable_get('fedora_repository_pid', 'islandora:root'); } $headers = module_invoke_all('file_download', "/fedora/repository/$pid"); if (in_array(-1, $headers)) { @@ -759,7 +979,7 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU return ' '; } if ($dsId != NULL && $dsId != '-') { //if we have a dsID return the stream otherwise query for a collection of objects - //probably should check pid as well here. +//probably should check pid as well here. return makeObject($pid, $dsId); } @@ -767,29 +987,19 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU module_load_include('inc', 'fedora_repository', 'CollectionClass'); $collectionClass = new CollectionClass(); - //if(!isset($pageNumber)){ - // $pageNumber=0; - //} - //if(!isset($limit)){ - // $limit=20; - //} - module_load_include('inc', 'fedora_repository', 'ContentModel'); - module_load_include('inc', 'fedora_repository', 'plugins/fedoraObject'); + module_load_include('inc', 'fedora_repository', 'plugins/FedoraObjectDetailedContent'); $breadcrumbs = array(); $objectHelper->getBreadcrumbs($pid, $breadcrumbs); drupal_set_breadcrumb(array_reverse($breadcrumbs)); $offset = $limit * $page_number; - //$results = $collectionClass->getRelatedObjects($pid, $limit, $offset, NULL); //updated so we can do paging in query not in xslt - //$results = $collectionClass->getRelatedItems($pid, NULL); $content_models = $objectHelper->get_content_models_list($pid); - // Each content model may return either a tabset array or plain HTML. If it's HTML, stick it in a tab. +// Each content model may return either a tabset array or plain HTML. If it's HTML, stick it in a tab. $cmodels_tabs = array( '#type' => 'tabset', ); foreach ($content_models as $content_model) { - //$content_model_fieldsets = $objectHelper->createExtraFieldsets($pid, $content_model, $pageNumber); $content_model_fieldset = $content_model->displayExtraFieldset($pid, $page_number); if (is_array($content_model_fieldset)) { $cmodels_tabs = array_merge($cmodels_tabs, $content_model_fieldset); @@ -802,20 +1012,37 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU ); } } - // Add a 'manage object' tab for all objects, where detailed list of content is shown. - $obj = new FedoraObject($pid); - $object_details = $obj->showFieldSets(); - $cmodels_tabs = array_merge($cmodels_tabs, $object_details); +// Add a 'manage object' tab for all objects, where detailed list of content is shown. + $obj = new FedoraObjectDetailedContent($pid); - //$content .= $objectHelper - //$content .= $objectHelper->parseContent($results, $pid, $dsId, $collection, $pageNumber); - //the below is for islandlives we should be able to do this in the xslt though - //$css=$path.'/stylesheets/container-large.css'; - //drupal_add_css($css); + //can disable showing the object details tab in admin UI + if (variable_get('fedora_repository_show_object_details_tab', TRUE)) { + $object_details = $obj->showFieldSets(); + if ($object_details['fedora_object_details']['#selected'] == TRUE) { + foreach ($cmodels_tabs as &$cmodel_tab) { + if (is_array($cmodel_tab)) { + $cmodel_tab['#selected'] = FALSE; + } + } + } + } + else { + $object_details = array(); + } + + $hook_tabs = module_invoke_all('islandora_tabs', $content_models, $pid); + $cmodels_tabs = array_merge($cmodels_tabs, $object_details, $hook_tabs); + return tabs_render($cmodels_tabs); } +/** + * fedora repository urlencode string + * FIXME: URL-encoding is not the same as HTML/XML encoding... + * @param type $str + * @return type + */ function fedora_repository_urlencode_string($str) { return htmlentities($str); } @@ -824,6 +1051,12 @@ function fedora_repository_urlencode_string($str) { * Uses makeobject to get a stream. Sets the Content Disposition in the header so it suggests a filename * and sends it as an attachment. This should prompt for a download of the object. * + * @global type $user + * @param type $pid + * @param type $dsId + * @param type $label + * @param type $version + * @return type */ function fedora_object_as_attachment($pid, $dsId, $label=NULL, $version=NULL) { global $user; @@ -838,27 +1071,43 @@ function fedora_object_as_attachment($pid, $dsId, $label=NULL, $version=NULL) { $objectHelper->makeObject($pid, $dsId, 1, $label, FALSE, $version); } +/** + * repository page + * @param type $pid + * @param type $dsId + * @param type $collection + * @param type $pageNumber + * @return type + */ function repository_page($pid = NULL, $dsId = NULL, $collection = NULL, $pageNumber = NULL) { - //do security check at fedora_repository_get_items function as it has to be called there in case - //someone trys to come in a back door. +//do security check at fedora_repository_get_items function as it has to be called there in case +//someone trys to come in a back door. return fedora_repository_get_items($pid, $dsId, $collection, $pageNumber); } +/** + * repository service + * @global type $user + * @param type $pid + * @param type $servicePid + * @param type $serviceMethod + * @return type + */ function repository_service($pid = NULL, $servicePid = NULL, $serviceMethod = NULL) { module_load_include('inc', 'fedora_repository', 'api/fedora_item'); module_load_include('inc', 'fedora_repository', 'ObjectHelper'); global $user; if (!fedora_repository_access(OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { - //drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied"), 'error'); +//drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied"), 'error'); drupal_access_denied(); if (user_access('access administration pages')) { - drupal_set_message(t("PIDs may be added to allowed namespaces, or all namespace restrictions removed !here", array('!here' => l('here', 'admin/settings/fedora_repository'))), 'error'); + drupal_set_message(t("PIDs may be added to allowed namespaces, or all namespace restrictions removed @here", array('@here' => l('here', 'admin/settings/fedora_repository'))), 'error'); } return ' '; } if ($pid == NULL) { - $pid = variable_get('fedora_repository_pid', 'islandora:top'); + $pid = variable_get('fedora_repository_pid', 'islandora:root'); } $headers = module_invoke_all('file_download', "/fedora/repository/$pid"); if (in_array(-1, $headers)) { @@ -869,7 +1118,7 @@ function repository_service($pid = NULL, $servicePid = NULL, $serviceMethod = NU $item = new Fedora_Item($pid); - if ($item !== false) { + if ($item !== FALSE) { echo $item->get_dissemination($servicePid, $serviceMethod); } @@ -886,6 +1135,9 @@ function repository_service($pid = NULL, $servicePid = NULL, $serviceMethod = NU * RI index to get a list of results without authorization but to view any * datastreams users must be authorized. * + * @param type $op + * @param type $keys + * @return array */ function fedora_repository_search($op = 'search', $keys = NULL) { module_load_include('inc', 'fedora_repository', 'ObjectHelper'); @@ -898,7 +1150,7 @@ function fedora_repository_search($op = 'search', $keys = NULL) { } case 'search': if (user_access('view fedora collection')) { - //demo search string ?operation=gfindObjects&indexName=DemoOnLucene&query=fgs.DS.first.text%3Achristmas&hitPageStart=11&hitPageSize=10 +//demo search string ?operation=gfindObjects&indexName=DemoOnLucene&query=fgs.DS.first.text%3Achristmas&hitPageStart=11&hitPageSize=10 $resultData = NULL; $numberOfHitsPerPage = NULL; $index = strpos($keys, '.'); @@ -927,7 +1179,7 @@ function fedora_repository_search($op = 'search', $keys = NULL) { $xmlDoc->load($path . '/searchTerms.xml'); $nodeList = $xmlDoc->getElementsByTagName('default'); if (!$type) { - //$type = 'dc.description'; +//$type = 'dc.description'; $type = $nodeList->item(0)->nodeValue; } $nodeList = $xmlDoc->getElementsByTagName('number_of_results'); @@ -942,12 +1194,12 @@ function fedora_repository_search($op = 'search', $keys = NULL) { else { $searchQuery = $keys; } - //$searchQuery.=" AND (PID:vre OR PID:vre:ref OR PID:demo OR PID:changeme)"; +//$searchQuery.=" AND (PID:vre OR PID:vre:ref OR PID:demo OR PID:changeme)"; $searchUrl = variable_get('fedora_fgsearch_url', 'http://localhost:8080/fedoragsearch/rest'); $searchString = '?operation=gfindObjects&indexName=' . $indexName . '&restXslt=copyXml&query=' . $searchQuery; $searchString .= '&hitPageSize=' . $numberOfHitsPerPage . '&hitPageStart=' . $startPage; - //$searchString = htmlentities(urlencode($searchString)); +//$searchString = htmlentities(urlencode($searchString)); $searchUrl .= $searchString; $objectHelper = new ObjectHelper(); $resultData = do_curl($searchUrl); @@ -966,6 +1218,9 @@ function fedora_repository_search($op = 'search', $keys = NULL) { /** * Implementation of hook_search_page(). * Display the search results + * + * @param type $resultData + * @return array */ function fedora_repository_search_page($resultData) { $path = drupal_get_path('module', 'fedora_repository'); @@ -988,11 +1243,11 @@ function fedora_repository_search_page($resultData) { return $out; } - //inject into xsl stylesheet +//inject into xsl stylesheet $proc->setParameter('', 'searchToken', drupal_get_token('search_form')); //token generated by Drupal, keeps tack of what tab etc we are on $proc->setParameter('', 'searchUrl', url('search') . '/fedora_repository'); //needed in our xsl $proc->setParameter('', 'objectsPage', base_path()); - $proc->setParameter('', 'allowedPidNameSpaces', variable_get('fedora_pids_allowed', 'default: demo: changeme: Islandora: ilives: ')); + $proc->setParameter('', 'allowedPidNameSpaces', variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: ')); $proc->registerPHPFunctions(); $xsl = new DomDocument(); if ($isRestricted) { @@ -1040,9 +1295,13 @@ function fedora_repository_search_page($resultData) { /** * Implementation of hook_form_alter(). * allows the advanced search form in drupal + * + * @param type $form + * @param type $form_state + * @param type $form_id */ function fedora_repository_form_alter(&$form, &$form_state, $form_id) { - // Advanced node search form +// Advanced node search form module_load_include('inc', 'fedora_repository', 'SearchClass'); $path = drupal_get_path('module', 'fedora_repository'); if ($form_id == 'search_form' && arg(1) == 'fedora_repository' && user_access('use advanced search')) { @@ -1056,7 +1315,7 @@ function fedora_repository_form_alter(&$form, &$form_state, $form_id) { $default_value = substr($default_value, $index + 1); } $form['basic']['inline']['keys']['#default_value'] = $default_value; - // Keyword boxes: +// Keyword boxes: $form['advanced'] = array( '#type' => 'fieldset', '#title' => t('Advanced search'), @@ -1094,9 +1353,11 @@ function fedora_repository_form_alter(&$form, &$form_state, $form_id) { /** * Implementation of hook_search_validate() * + * @param type $form + * @param type $form_state */ function fedora_repository_search_validate($form, &$form_state) { - // Initialise using any existing basic search keywords. +// Initialise using any existing basic search keywords. $keys = $form_state['values']['processed_keys']; if (isset($form_state['values']['type'])) { @@ -1111,64 +1372,10 @@ function fedora_repository_search_validate($form, &$form_state) { } } -function fedora_repository_block($op = 'list', $delta = 0, $edit = array()) { - // The $op parameter determines what piece of information is being requested. - switch ($op) { - case 'list': - // If $op is "list", we just need to return a list of block descriptions. - // This is used to provide a list of possible blocks to the administrator, - // end users will not see these descriptions. - $blocks[0] = array( - 'info' => t('Repository advanced search block'), - ); - return $blocks; - case 'configure': - // If $op is "configure", we need to provide the administrator with a - // configuration form. The $delta parameter tells us which block is being - // configured. In this example, we'll allow the administrator to customize - // the text of the first block. - $form = array(); - switch ($delta) { - case 0: - // All we need to provide is a text field, Drupal will take care of - // the other block configuration options and the save button. - $form['fedora_repository_advanced_block_repeat'] = array( - '#type' => 'textfield', - '#title' => t('Number of times to repeat search fields'), - '#size' => 5, - '#description' => t('The number of times you would like the search blocks to be repeated'), - '#default_value' => variable_get('fedora_repository_advanced_block_repeat', t('3')), - ); - break; - } - return $form; - case 'save': - // If $op is "save", we need to save settings from the configuration form. - // Since the first block is the only one that allows configuration, we - // need to check $delta to make sure we only save it. - switch ($delta) { - case 0: - // Have Drupal save the string to the database. - variable_set('fedora_repository_advanced_block_repeat', $edit['fedora_repository_advanced_block_repeat']); - break; - } - case 'view': default: - // If $op is "view", then we need to generate the block for display - // purposes. The $delta parameter tells us which block is being requested. - switch ($delta) { - case 0: - // The subject is displayed at the top of the block. Note that it - // should be passed through t() for translation. - $block['subject'] = t('Repository Advanced Search'); - // The content of the block is typically generated by calling a custom - // function. - $block['content'] = drupal_get_form('fedora_repository_mnpl_advanced_search_form'); - break; - } - return $block; - } -} - +/** + * fedora repository theme + * @return type + */ function fedora_repository_theme() { return array( 'fedora_repository_mnpl_advanced_search_form' => array( @@ -1180,7 +1387,6 @@ function fedora_repository_theme() { 'arguments' => array( 'element' => NULL ), - 'fedora_repository_solution_packs_list' => array( 'arguments' => array( 'solution_packs' => NULL, @@ -1192,6 +1398,11 @@ function fedora_repository_theme() { /** * Get a list of terms from a lucene index + * + * @param type $field + * @param type $startTerm + * @param type $displayName + * @return type */ function fedora_repository_list_terms($field, $startTerm = NULL, $displayName = NULL) { module_load_include('inc', 'fedora_repository', 'SearchClass'); @@ -1199,18 +1410,33 @@ function fedora_repository_list_terms($field, $startTerm = NULL, $displayName = return $searchClass->getTerms($field, $startTerm, $displayName); } +/** + * fedora repository mnpl advanced search form + * @return type + */ function fedora_repository_mnpl_advanced_search_form() { module_load_include('inc', 'fedora_repository', 'SearchClass'); $searchClass = new SearchClass(); return $searchClass->build_advanced_search_form(); } +/** + * theme fedora repository mnpl advanced search form + * @param type $form + * @return type + */ function theme_fedora_repository_mnpl_advanced_search_form($form) { module_load_include('inc', 'fedora_repository', 'SearchClass'); $advanced_search_form = new SearchClass(); return $advanced_search_form->theme_advanced_search_form($form); } +/** + * fedora repository mnpl advanced search + * @param type $query + * @param type $startPage + * @return type + */ function fedora_repository_mnpl_advanced_search($query, $startPage = 1) { module_load_include('inc', 'fedora_repository', 'SearchClass'); $searchClass = new SearchClass(); @@ -1218,6 +1444,11 @@ function fedora_repository_mnpl_advanced_search($query, $startPage = 1) { return $searchClass->custom_search($query, $startPage); } +/** + * fedora repository mnpl_advanced search form submit + * @param type $form + * @param type $form_state + */ function fedora_repository_mnpl_advanced_search_form_submit($form, &$form_state) { $type_id = $form_state['values']['type']; $repeat = variable_get('fedora_repository_advanced_block_repeat', t('3')); @@ -1236,11 +1467,19 @@ function fedora_repository_mnpl_advanced_search_form_submit($form, &$form_state) drupal_goto("fedora/repository/mnpl_advanced_search/$searchString"); } +/** + * fedora repository install demo page + * @return type + */ function fedora_repository_install_demos_page() { $output = drupal_get_form('fedora_repository_demo_objects_form'); return $output; } +/** + * fedora repository demo objects form + * @return string + */ function fedora_repository_demo_objects_form() { module_load_include('inc', 'fedora_repository', 'ObjectHelper'); module_load_include('inc', 'fedora_repository', 'api/fedora_item'); @@ -1253,7 +1492,7 @@ function fedora_repository_demo_objects_form() { '#description' => t('Install demo image and document collections and content models.'), ); $demo_objects = array(); - // Check if the top-level islandora collection exists. If not, display a button to ingest. +// Check if the top-level islandora collection exists. If not, display a button to ingest. $form['install_demos']['demo_collections'] = array( '#type' => 'checkboxes', @@ -1263,10 +1502,10 @@ function fedora_repository_demo_objects_form() { ); foreach (array( - 'islandora:collectionCModel' => 'Islandora default content models', - 'islandora:top' => 'Islandora top-level collection', - 'islandora:demos' => 'Islandora demos collection', - 'islandora:largeimages' => 'Sample large image content model (requires Djatoka and Kakadu.)', +'islandora:collectionCModel' => 'Islandora default content models', + 'islandora:root' => 'Islandora top-level collection', + 'islandora:demos' => 'Islandora demos collection', + 'islandora:largeimages' => 'Sample large image content model (requires Djatoka and Kakadu.)', ) as $available_demo => $available_demo_desc) { try { @@ -1276,7 +1515,7 @@ function fedora_repository_demo_objects_form() { } if (empty($demo_objects[$available_demo]->objectProfile)) { - //The demo objects collection does not exist in the repository, display a button to ingest them. +//The demo objects collection does not exist in the repository, display a button to ingest them. $form['install_demos']['demo_collections']['#options'][$available_demo] = $available_demo_desc; } else { @@ -1284,7 +1523,7 @@ function fedora_repository_demo_objects_form() { } } - // Check if the SmileyStuff collectoin exists, and if it has a COLLECTION_VIEW datastream. If it doesn't then we can add it. +// Check if the SmileyStuff collectoin exists, and if it has a COLLECTION_VIEW datastream. If it doesn't then we can add it. $smiley_stuff = new Fedora_Item('demo:SmileyStuff'); if (!empty($smiley_stuff->objectProfile)) { @@ -1328,6 +1567,12 @@ function fedora_repository_demo_objects_form() { return $form; } +/** + * fedora repository demo objects form submit + * @global type $base_url + * @param type $form + * @param type $form_state + */ function fedora_repository_demo_objects_form_submit($form, &$form_state) { module_load_include('inc', 'fedora_repository', 'api/fedora_item'); module_load_include('inc', 'fedora_repository', 'api/dublin_core'); @@ -1340,60 +1585,60 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) { $collectioncm->add_relationship('hasModel', 'fedora-system:ContentModel-3.0', FEDORA_MODEL_URI); $collectioncm->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/content_models/COLLECTIONCM.xml', 'ISLANDORACM', 'Islandora Content Model.xml', 'application/xml', 'X'); } catch (exception $e) { - + } try { $strictpdfcm = Fedora_Item::ingest_new_item('islandora:strict_pdf', 'A', 'Strict PDF Content Model'); $strictpdfcm->add_relationship('hasModel', 'fedora-system:ContentModel-3.0', FEDORA_MODEL_URI); $strictpdfcm->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/content_models/STRICT_PDFCM.xml', 'ISLANDORACM', 'Islandora Content Model.xml', 'application/xml', 'X'); } catch (exception $e) { - + } - // Install a collection object that points to all content model objects +// Install a collection object that points to all content model objects try { $cmodel_collection_xml = Fedora_Item::create_object_FOXML('islandora:ContentModelCollection'); $cmodel_collection = Fedora_Item::ingest_from_FOXML($cmodel_collection_xml); - //$dc = new Dublin_Core(new Fedora_Item('islandora:ContentModelCollection')); +//$dc = new Dublin_Core(new Fedora_Item('islandora:ContentModelCollection')); $dc = new Dublin_Core($cmodel_collection); $dc->set_element('dc:title', array('Installed Content Model')); $dc->save(); $cmodel_collection->add_datastream_from_string('select $object $title from <#ri> - where ($object $title + where ($object $title and ($object or $object ) and $object ) order by $title', 'QUERY', 'Content Model Collection Query', 'text/plain'); - $cmodel_collection->add_relationship('isMemberOfCollection', 'islandora:top'); + $cmodel_collection->add_relationship('isMemberOfCollection', 'islandora:root'); $cmodel_collection->add_relationship('hasModel', 'islandora:collectionCModel', FEDORA_MODEL_URI); $cmodel_collection->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/collection_views/simple_list_view.xml', 'COLLECTION_VIEW', 'Collection View', 'text/xml', 'X'); $cmodel_collection->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/contentModel.jpg', 'TN', 'Thumbnail', 'image/jpg', 'M'); - drupal_set_message("Successfully installed islandora:ContentModelCollection.", 'message'); + drupal_set_message(t("Successfully installed islandora:ContentModelCollection.", array('@base_url' => check_plain($base_url))), 'message'); } catch (exception $e) { - + } } - if (!empty($form_state['values']['demo_collections']['islandora:top'])) { - $new_item = Fedora_Item::ingest_new_item('islandora:top', 'A', 'Islandora Top-level Collection'); + if (!empty($form_state['values']['demo_collections']['islandora:root'])) { + $new_item = Fedora_Item::ingest_new_item('islandora:root', 'A', 'Islandora Top-level Collection'); $new_item->add_relationship('hasModel', 'islandora:collectionCModel', FEDORA_MODEL_URI); $cp = $new_item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/collection_policies/COLLECTION-COLLECTION POLICY.xml', 'COLLECTION_POLICY', 'Collection Policy', 'text/xml', 'X'); try { $tn = $new_item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/Gnome-emblem-photos.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); - drupal_set_message("Successfully installed islandora:top.", 'message'); + drupal_set_message(t("Successfully installed islandora:root.", array('@base_url' => check_plain($base_url))), 'message'); } catch (exception $e) { - + } } if (!empty($form_state['values']['demo_collections']['islandora:demos'])) { $new_item = fedora_item::ingest_new_item('islandora:demos', 'A', 'Islandora Demo Collection'); - $new_item->add_relationship('isMemberOfCollection', 'islandora:top'); + $new_item->add_relationship('isMemberOfCollection', 'islandora:root'); $new_item->add_relationship('hasModel', 'islandora:collectionCModel', FEDORA_MODEL_URI); $cp = $new_item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/collection_policies/COLLECTION-COLLECTION POLICY.xml', 'COLLECTION_POLICY', 'Collection Policy', 'text/xml', 'X'); - // $cv = $new_item->add_datastream_from_file( drupal_get_path('module', 'fedora_repository') . '/collection_views/COLLECTION_VIEW.xml', 'COLLECTION_VIEW', 'Collection View.xml', 'text/xml', 'X'); +// $cv = $new_item->add_datastream_from_file( drupal_get_path('module', 'fedora_repository') . '/collection_views/COLLECTION_VIEW.xml', 'COLLECTION_VIEW', 'Collection View.xml', 'text/xml', 'X'); $tn = $new_item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/Gnome-emblem-photos.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); try { $new_item = Fedora_Item::ingest_new_item('islandora:pdf_collection', 'A', 'PDF Collection'); @@ -1401,9 +1646,9 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) { $new_item->add_relationship('hasModel', 'islandora:collectionCModel', FEDORA_MODEL_URI); $cp = $new_item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/collection_policies/PDF-COLLECTION POLICY.xml', 'COLLECTION_POLICY', 'Collection Policy', 'text/xml', 'X'); $tn = $new_item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/Crystal_Clear_mimetype_pdf.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); - drupal_set_message("Successfully installed islandora:demos.", 'message'); + drupal_set_message(t("Successfully installed islandora:demos.", array('@base_url' => check_plain($base_url))), 'message'); } catch (exception $e) { - + } } @@ -1413,19 +1658,19 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) { $smiley_stuff->add_relationship('isMemberOfCollection', 'info:fedora/islandora:demos'); $tn = $smiley_stuff->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/smileytn.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); $cp = $smiley_stuff->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/collection_policies/JPG-COLLECTION POLICY.xml', 'COLLECTION_POLICY', 'Collection Policy.xml', 'application/xml', 'X'); - + $cm = new Fedora_Item('demo:DualResImage'); try { $cmstream = $cm->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/content_models/STANDARD JPG.xml', 'ISLANDORACM', 'Content Model.xml', 'application/xml', 'X'); } catch (exception $e) { - + } $dual_res_image_collection_cmodel = new Fedora_Item('demo:DualResImageCollection'); try { $cmstream = $dual_res_image_collection_cmodel->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/content_models/COLLECTIONCM.xml', 'ISLANDORACM', 'Islandora Content Model.xml', 'application/xml', 'X'); - drupal_set_message("Successfully installed demo:SmileyStuff collection view.", 'message'); + drupal_set_message(t("Successfully installed demo:SmileyStuff collection view.", array('@base_url' => check_plain($base_url))), 'message'); } catch (exception $e) { - + } } @@ -1442,189 +1687,62 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) { try { $item = Fedora_Item::ingest_from_FOXML_file(drupal_get_path('module', 'fedora_repository') . '/content_models/islandora_largeimages.xml'); $tn = $item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/Gnome-emblem-photos.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); - drupal_set_message("Successfully installed islandora:largeimages.", 'message'); + drupal_set_message(t("Successfully installed islandora:largeimages.", array('@base_url' => check_plain($base_url))), 'message'); } catch (exception $e) { $error .= " - Problem ingesting islandora:largeimages collection"; } } if (!empty($error)) { - drupal_set_message('Some problems occurred: ' . $error); + drupal_set_message(t('Some problems occurred: @error', array('@error' => $error))); } } } - +/** + * fedora repository required fedora objects + * @return type + */ function fedora_repository_required_fedora_objects() { - // array( 'path-to-foxml-file', 'pid', 'dsid', 'path-to-datastream-file', int dsversion, boolean required) +// array( 'path-to-foxml-file', 'pid', 'dsid', 'path-to-datastream-file', int dsversion, boolean required) $module_path = drupal_get_path('module', 'fedora_repository'); - return array ( + return array( 'fedora_repository' => array( 'module' => 'fedora_repository', 'title' => 'Islandora Core', - 'objects' => array ( - array ( + 'objects' => array( + array( 'pid' => 'islandora:collectionCModel', 'label' => 'Islandora Collection Content Model', 'dsid' => 'ISLANDORACM', - 'datastream_file' => "$module_path/content_models/COLLECTIONCM.xml", + 'datastream_file' => "./$module_path/content_models/COLLECTIONCM.xml", 'dsversion' => 2, 'cmodel' => 'fedora-system:ContentModel-3.0', ), - array ( - 'pid' => 'islandora:strict_pdf', - 'label' => 'Islandora strict PDF content model', - 'dsid' => 'ISLANDORACM', - 'datastream_file' => "$module_path/content_models/STRICT_PDFCM.xml", - 'cmodel' => 'fedora-system:ContentModel-3.0', - ), array( - 'pid' => 'islandora:top', + 'pid' => 'islandora:root', 'label' => 'Islandora Top-level Collection', 'cmodel' => 'islandora:collectionCModel', - 'datastreams' => array ( - array ( - 'dsid' => 'COLLECTION_POLICY', - 'datastream_file' => "$module_path/collection_policies/COLLECTION-COLLECTION POLICY.xml", - ), - array ( - 'dsid' => 'TN', - 'datastream_file' => "$module_path/images/Gnome-emblem-photos.png", - 'mimetype' => 'image/png', - ), - ), - ), - array ( - 'pid' => 'islandora:ContentModelCollection', - 'label' => 'Collection of installed content models', - 'cmodel' => 'islandora:collectionCModel', - 'parent' => 'islandora:top', - 'datastreams' => array ( - array ( - 'dsid' => 'COLLECTION_VIEW', - 'datastream_file' => "$module_path/collection_views/simple_list_view.xml", - ), - array ( - 'dsid' => 'TN', - 'datastream_file' => "$module_path/images/contentModel.jpg", - 'mimetype' => 'image/jpeg', - ), - array ( - 'dsid' => 'QUERY', - 'datastream_file' => "$module_path/collection_views/cmodel_collection_query.txt", - 'mimetype' => 'text/plain', - ), - ), - ), - array ( - 'pid' => 'islandora:demos', - 'label' => 'Islandora demos collection', - 'cmodel' => 'islandora:collectionCModel', - 'parent' => 'islandora:top', - 'datastreams' => array ( - array ( - 'dsid' => 'TN', - 'datastream_file' => "$module_path/images/Gnome-emblem-photos.png", - 'mimetype' => 'image/png', - ), - array ( - 'dsid' => 'COLLECTION_POLICY', - 'datastream_file' => "$module_path/collection_policies/COLLECTION-COLLECTION POLICY.xml", - ), - ), - ), - array ( - 'pid' => 'islandora:pdf_collection', - 'label' => 'Islandora Demo PDF Collection', - 'cmodel' => 'islandora:collectionCModel', - 'parent' => 'islandora:demos', - 'datastreams' => array ( - array ( - 'dsid' => 'TN', - 'datastream_file' => "$module_path/images/Crystal_Clear_mimetype_pdf.png", - 'mimetype' => 'image/png', - ), - array ( - 'dsid' => 'COLLECTION_POLICY', - 'datastream_file' => "$module_path/collection_policies/PDF-COLLECTION POLICY.xml", - ), - ), - ), - array ( - 'pid' => 'demo:DualResImage', - 'foxml_file' => "$module_path/content_models/demo_DualResImage.xml", - 'datastreams' => array( - array ( - 'dsid' => 'ISLANDORACM', - 'datastream_file' => "$module_path/content_models/STANDARD JPG.xml", - ), - ), - ), - array ( - 'pid' => 'demo:DualResImageCollection', - 'foxml_file' => "$module_path/content_models/demo_DualResImageCollection.xml", 'datastreams' => array( array( - 'dsid' => 'ISLANDORACM', - 'datastream_file' => "$module_path/content_models/COLLECTIONCM.xml", - ), - ), - ), - array ( - 'pid' => 'demo:DualResolution', - 'foxml_file' => "$module_path/content_models/demo_DualResolution.xml", - ), - array ( - 'pid' => 'demo:DualResImageImpl', - 'foxml_file' => "$module_path/content_models/demo_DualResImageImpl.xml", - ), - array ( - 'pid' => 'demo:CollectionImpl', - 'foxml_file' => "$module_path/content_models/demo_CollectionImpl.xml", - ), - array ( - 'pid' => 'demo:Collection', - 'foxml_file' => "$module_path/content_models/demo_Collection.xml", - ), - array ( - 'pid' => 'islandora:demo_image_collection', - 'label' => 'Demo Image Collection', - 'cmodel' => 'demo:DualResImageCollection', - 'parent' => 'islandora:demos', - 'datastreams' => array ( - array ( 'dsid' => 'COLLECTION_POLICY', - 'datastream_file' => "$module_path/collection_policies/JPG-COLLECTION POLICY.xml", + 'datastream_file' => "./$module_path/collection_policies/COLLECTION-COLLECTION POLICY.xml", ), - array ( + array( 'dsid' => 'TN', - 'datastream_file' => "$module_path/images/Gnome-emblem-photos.png", + 'datastream_file' => "./$module_path/images/Gnome-emblem-photos.png", 'mimetype' => 'image/png', ), - array ( - 'dsid' => 'COLLECTION_VIEW', - 'datastream_file' => "$module_path/collection_views/standard_jpeg_collection_view.xml", - ), - array ( - 'dsid' => 'QUERY', - 'datastream_file' => "$module_path/collection_views/standard_jpeg_collection_query.txt", - 'mimetype' => 'text/plain', - ), - array ( - 'dsid' => 'DC', - 'datastream_file' => "$module_path/collection_views/demo_image_collection_dc_record.xml", - ), - ), + ), ), ), ), ); } -/* +/** * Functions to create a time selector form element type. */ - function fedora_repository_elements() { $type['fedora_repository_time'] = array( "#input" => TRUE, @@ -1634,9 +1752,14 @@ function fedora_repository_elements() { return $type; } +/** + * fedora repository expand time + * @param type $element + * @return string + */ function fedora_repository_expand_time($element) { - // Default to current time, check default_value but set value so that if - // default value is present it will override value +// Default to current time, check default_value but set value so that if +// default value is present it will override value if (empty($element['#default_value'])) { $element['#value'] = array( 'hour' => intval(format_date(time(), 'custom', 'h')), @@ -1672,11 +1795,21 @@ function fedora_repository_expand_time($element) { return $element; } +/** + * fedora repository time + * @param type $element + * @return type + */ function fedora_repository_time($element) { $output = '
' . $element['#children'] . '
'; return theme('form_element', $element, $output); } +/** + * theme fedora repository time + * @param type $element + * @return type + */ function theme_fedora_repository_time($element) { $output = '
' . $element['#children'] . '
'; return theme('form_element', $element, $output); @@ -1684,27 +1817,35 @@ function theme_fedora_repository_time($element) { /* Export (basket) functionality */ +/** + * fedora repository remove item from basket + * @param type $pid + */ function fedora_repository_remove_item_from_basket($pid) { module_load_include('inc', 'fedora_repository', 'ObjectHelper'); $pids = empty($_SESSION['basket']['processed']) ? array() : $_SESSION['basket']['processed']; $objectHelper = new ObjectHelper(); - // getting child PIDs if any +// getting child PIDs if any $cpids = $objectHelper->get_child_pids(array($pid)); if (array_key_exists($pid, $pids)) { - // remove item from basket +// remove item from basket unset($_SESSION['basket']['processed'][$pid]); } if (!empty($cpids)) { // there are children foreach ($cpids as $child_pid => $value) { - // remove child item from basket recursively +// remove child item from basket recursively fedora_repository_remove_item_from_basket($child_pid); } } } +/** + * fedora repository basket + * @return type + */ function fedora_repository_basket() { $pids = _fedora_repository_get_basket_pids(); $output = drupal_get_form('fedora_repository_basket_form', $pids); @@ -1761,6 +1902,11 @@ function fedora_repository_basket_form($form_state, $pids) { return $form; } +/** + * theme fedora repository basket form + * @param type $form + * @return string + */ function theme_fedora_repository_basket_form($form) { $header = array( theme('table_select_header_cell'), @@ -1791,10 +1937,22 @@ function theme_fedora_repository_basket_form($form) { return $output; } +/** + * fedora repository basket form validate + * @param type $form + * @param type $form_state + */ function fedora_repository_basket_form_validate($form, &$form_state) { } +/** + * fedora repository basket form submit + * @global type $user + * @param type $form + * @param type $form_state + * @return type + */ function fedora_repository_basket_form_submit($form, &$form_state) { if ($form_state['values']['op'] == $form_state['values']['remove_submit']) { $pids = $form_state['clicked_button']['#post']['remove']; @@ -1831,7 +1989,7 @@ function fedora_repository_basket_form_submit($form, &$form_state) { $foxml_dir = $export_dir . '/foxml'; if (!file_exists($foxml_dir) && !@mkdir($foxml_dir, 0775, TRUE)) { - drupal_set_message(t("Failed to create foxml dir %dir. Check that export dir exsits and has correct permissions", array('%dir' => $foxml_dir)), 'error'); + drupal_set_message(t("Failed to create foxml dir @dir. Check that export dir exsits and has correct permissions", array('@dir' => $foxml_dir)), 'error'); return FALSE; } @@ -1840,7 +1998,7 @@ function fedora_repository_basket_form_submit($form, &$form_state) { $objects_dir = $export_dir . '/objects/' . $pid; if (!file_exists($objects_dir) && !@mkdir($objects_dir, 0775, TRUE)) { - drupal_set_message(t("Failed to create objects dir %dir. Check that export dir exsits and has correct permissions", array('%dir' => $objects_dir)), 'error'); + drupal_set_message(t("Failed to create objects dir @dir. Check that export dir exsits and has correct permissions", array('@dir' => $objects_dir)), 'error'); return FALSE; } @@ -1852,7 +2010,7 @@ function fedora_repository_basket_form_submit($form, &$form_state) { $msg .= ":
" . implode("
", $log); drupal_set_message($msg, $success ? 'info' : 'error'); - //_fedora_repository_empty_basket(); +//_fedora_repository_empty_basket(); } else { drupal_set_message(t("No objects selected or basket empty"), 'error'); @@ -1861,13 +2019,14 @@ function fedora_repository_basket_form_submit($form, &$form_state) { return; } -/* +/** * Get all pids saved to the basket. + * + * @return type */ - function _fedora_repository_get_basket_pids() { - // Set empty defaults if basket elements are missing +// Set empty defaults if basket elements are missing $_SESSION['basket'] = isset($_SESSION['basket']) ? $_SESSION['basket'] : array('processed' => array(), 'unprocessed' => array()); $_SESSION['basket']['processed'] = isset($_SESSION['basket']['processed']) ? $_SESSION['basket']['processed'] : array(); $_SESSION['basket']['unprocessed'] = isset($_SESSION['basket']['unprocessed']) ? $_SESSION['basket']['unprocessed'] : array(); @@ -1877,7 +2036,7 @@ function _fedora_repository_get_basket_pids() { module_load_include('inc', 'fedora_repository', 'ObjectHelper'); $ob = new ObjectHelper(); foreach ($_SESSION['basket']['unprocessed'] as $pid) { - // Check if the pid already exists in the tree +// Check if the pid already exists in the tree if (array_key_exists($pid, $pids)) { continue; } @@ -1892,13 +2051,22 @@ function _fedora_repository_get_basket_pids() { return $pids; } +/** + * fedora repository empty basket + */ function _fedora_repository_empty_basket() { unset($_SESSION['basket']); } +/** + * fedora repository add to basket + * @param type $pid + * @param type $warn + * @param type $searchResultsFlag + */ function fedora_repository_add_to_basket($pid, $warn = TRUE, $searchResultsFlag = FALSE) { if ($warn && _is_added_to_basket($pid)) { - drupal_set_message("Object already in basket"); + drupal_set_message(t("Object already in basket")); } if (!isset($_SESSION['basket'])) { @@ -1914,6 +2082,11 @@ function fedora_repository_add_to_basket($pid, $warn = TRUE, $searchResultsFlag } } +/** + * fedora repository remove from basket + * @param type $pid + * @return type + */ function fedora_repository_remove_from_basket($pid) { if (isset($_SESSION['basket']['unprocessed'][$pid])) { unset($_SESSION['basket']['unprocessed'][$pid]); @@ -1925,6 +2098,12 @@ function fedora_repository_remove_from_basket($pid) { return; } +/** + * theme add to basket link + * @param type $pid + * @param type $type + * @return type + */ function theme_add_to_basket_link($pid, $type = 'object') { $object = t($type); $path = drupal_urlencode($pid); @@ -1939,20 +2118,29 @@ function theme_add_to_basket_link($pid, $type = 'object') { */ if (!_is_added_to_basket($pid)) { return l( - theme('image', drupal_get_path('module', 'Fedora_Repository') . '/images/' . $save, t("Add to basket"), t("Add this @object to my basket", array('@object' => $object))), - "fedora/repository/addToBasket/" . $path, - array('html' => TRUE) + theme('image', drupal_get_path('module', 'Fedora_Repository') . '/images/' . $save, t("Add to basket"), t("Add this @object to my basket", array('@object' => $object))), "fedora/repository/addToBasket/" . $path, array('html' => TRUE) ); } return theme('image', drupal_get_path('module', 'Fedora_Repository') . '/images/' . $saved, t("In basket"), t("This @object is already in your basket", array('@object' => $object))); } +/** + * is added to basket + * @param type $pid + * @param type $account + * @return type + */ function _is_added_to_basket($pid, $account = NULL) { return isset($_SESSION['basket']['unprocessed'][$pid]) || isset($_SESSION['basket']['processed'][$pid]); // return db_result(db_query("SELECT uid FROM {repository_basket} WHERE uid = %d AND pid = '%s'", $account->uid, $pid)); } +/** + * fedora repository display schema + * @param type $file + * @return type + */ function fedora_repository_display_schema($file) { $path = drupal_get_path('module', 'fedora_repository'); if (strtolower(substr($file, -3)) == 'xsd' && file_exists($path . '/' . $file)) { @@ -1964,54 +2152,78 @@ function fedora_repository_display_schema($file) { return; } - +/** + * fedora repository batch reingest object + * @param type $object + * @param type $context + * @return type + */ function fedora_repository_batch_reingest_object($object, &$context) { + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + if (!empty($object) && is_array($object)) { $pid = $object['pid']; - if (!validPid($pid)) { + if (!valid_pid($pid)) { return NULL; } + // Does the object exist? If so, purge it. + //dd("About to test existence of PID: $pid"); $item = new Fedora_Item($pid); if ($item->exists()) { + //dd(' Found'); $item->purge(t('Remove during re-install batch job')); + //dd(' Purged'); } - // Ingest the object from the source file. + $new_item = NULL; //Need to have this a couple places... (After trying from FOXML and later for individual DSs) + $datastreams = array(); //Seems like this might be getting messed up due to scope? + +// Ingest the object from the source file. if (!empty($object['foxml_file'])) { $foxml_file = $object['foxml_file']; $new_item = Fedora_Item::ingest_from_FOXML_file($foxml_file); if ($new_item->exists()) { - // Batch operation was successful. - $context['message'][] = "$new_item->pid installed."; +// Batch operation was successful; can still add additional DSs, though + $context['message'][] = t('%pid installed.', array('%pid' => $new_item->pid)); } } + if (!empty($object['dsid']) && !empty($object['datastream_file'])) { - $datastreams = array ( - array ( - 'dsid' => $object['dsid'], - 'datastream_file' => $object['datastream_file'], - ) + $datastreams[] = array( + 'dsid' => $object['dsid'], + 'datastream_file' => $object['datastream_file'], ); } elseif (!empty($object['datastreams'])) { $datastreams = $object['datastreams']; } - - if (!empty($datastreams) && is_array($datastreams)) { - $label = !empty($object['label']) ? $object['label'] : ''; - if (empty($object['foxml_file']) && !defined($new_item)) { - $new_item = Fedora_Item::ingest_new_item($object['pid'], 'A', $label); - } + + $label = !empty($object['label']) ? $object['label'] : ''; + if (!isset($new_item)) { + //dd(' Not found, creating'); + $new_item = Fedora_Item::ingest_new_item($pid, 'A', $label); + //dd(' Created'); + } + elseif (!empty($label)) { + $new_item->modify_object($label); + } + + if (isset($new_item)) { if (!empty($object['cmodel'])) { - $new_item->add_relationship('hasModel', $object['cmodel'], FEDORA_MODEL_URI); + //dd(' relating to cmodel'); + $new_item->add_relationship('hasModel', $object['cmodel'], FEDORA_MODEL_URI); + //dd(' related to cmodel'); } if (!empty($object['parent'])) { + //dd(' adding parent'); $new_item->add_relationship('isMemberOfCollection', $object['parent']); + //dd(' parent added'); } - foreach($datastreams as $ds) { + foreach ((array)$datastreams as $ds) { + //dd("trying to add ds: {$ds['dsid']}"); if ($ds['dsid'] == 'DC') { $new_item->modify_datastream_by_value(file_get_contents($ds['datastream_file']), $ds['dsid'], $ds['label'], 'text/xml'); } @@ -2035,35 +2247,36 @@ function fedora_repository_batch_reingest_object($object, &$context) { */ function fedora_repository_get_islandora_datastream_version($item = NULL, $dsid = NULL, $datastream_file = NULL) { $return = NULL; - if (isset($item)) { + if (!empty($item) && !empty($dsid)) { $doc = simplexml_load_string($item->get_datastream_dissemination($dsid)); - } elseif (isset($datastream_file)) { + } + elseif (!empty($datastream_file)) { $doc = simplexml_load_file($datastream_file); } - if (!empty($doc)) { - $attrs = $doc->attributes(); - foreach($attrs as $name => $value) { - if ($name == 'version') { - $return = (int) $value; - break; - } - } + if (!empty($doc) && $version = (int)$doc->attributes()->version) { + $return = $version; } + return $return; } - + +/** + * theme fedora repository solution pack list + * @param type $solution_packs + * @return string + */ function theme_fedora_repository_solution_packs_list($solution_packs) { module_load_include('inc', 'fedora_repository', 'api/fedora_item'); module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); $output = ''; $header = array(); $rows = array(); - - - - - drupal_add_css(drupal_get_path('module', 'update') .'/update.css'); + + + + + drupal_add_css(drupal_get_path('module', 'update') . '/update.css'); return $output; } diff --git a/fedora_repository.solutionpacks.inc b/fedora_repository.solutionpacks.inc index ad49ce86..b6c40412 100644 --- a/fedora_repository.solutionpacks.inc +++ b/fedora_repository.solutionpacks.inc @@ -1,7 +1,7 @@ 'hidden', '#value' => $solution_pack_module, ); if (!$form_state['submitted']) { - $form['soluction_pack_name'] = array( + $form['solution_pack_name'] = array( '#type' => 'markup', '#value' => t($solution_pack_name), '#prefix' => '

', @@ -75,7 +77,6 @@ function fedora_repository_solution_pack_form(&$form_state, $solution_pack_modul $table_header = array('PID', 'Status'); $table_rows = array(); - foreach ($objects as $object) { $datastreams = NULL; if (isset($object['pid'])) { @@ -87,7 +88,8 @@ function fedora_repository_solution_pack_form(&$form_state, $solution_pack_modul if (!$item->exists()) { $object_status = 'Missing'; $needs_install = TRUE; - } else { + } + else { if (isset($object['dsid']) && isset($object['datastream_file']) && isset($object['dsversion'])) { $datastreams = array( array( @@ -96,7 +98,8 @@ function fedora_repository_solution_pack_form(&$form_state, $solution_pack_modul 'dsversion' => $object['dsversion'], ), ); - } elseif (!empty($object['datastreams'])) { + } + elseif (!empty($object['datastreams'])) { $datastreams = $object['datastreams']; } if (!empty($datastreams) && is_array($datastreams)) { @@ -107,10 +110,11 @@ function fedora_repository_solution_pack_form(&$form_state, $solution_pack_modul $object_status = 'Missing datastream'; break; } - if (isset($ds['dsversion'])) { + elseif (isset($ds['dsversion'])) { // Check if the datastream is versioned and needs updating. $installed_version = fedora_repository_get_islandora_datastream_version($item, $ds['dsid']); $available_version = fedora_repository_get_islandora_datastream_version(NULL, NULL, $ds['datastream_file']); + if ($available_version > $installed_version) { $needs_update = TRUE; $object_status = 'Out of date'; @@ -118,7 +122,7 @@ function fedora_repository_solution_pack_form(&$form_state, $solution_pack_modul } } } - } + } } array_push($table_row, $object_status); $table_rows[] = $table_row; @@ -137,12 +141,16 @@ function fedora_repository_solution_pack_form(&$form_state, $solution_pack_modul ); if (!$needs_install && !$needs_update) { $form['install_status']['#value'] = theme_image('misc/watchdog-ok.png') . t('All required objects are installed and up-to-date.'); - } else { + $submit_button_text = t("Force Reinstallation of Fedora Objects"); + + } + else { $form['install_status']['#value'] = theme_image('misc/watchdog-warning.png') . t('Some objects must be re-ingested. See Objects list for details.'); + $submit_button_text = t("Install Fedora Objects"); + } $form['submit'] = array( - '#value' => t('Install'), - '#disabled' => !$needs_install && !$needs_update, + '#value' => $submit_button_text, '#type' => 'submit', '#name' => $solution_pack_module, ); @@ -156,7 +164,11 @@ function fedora_repository_solution_pack_form(&$form_state, $solution_pack_modul function fedora_repository_solution_pack_form_submit($form, &$form_state) { $what = $form_state; $module_name = $form_state['values']['solution_pack_module']; - $solution_pack_info = call_user_func($module_name . '_required_fedora_objects'); + + // This should be replaced with module_invoke + //$solution_pack_info = call_user_func($module_name . '_required_fedora_objects'); + $solution_pack_info = module_invoke($module_name, 'required_fedora_objects'); + $batch = array( 'title' => t('Installing / updating solution pack objects'), 'file' => drupal_get_path('module', 'fedora_repository') . '/fedora_repository.module', @@ -170,3 +182,29 @@ function fedora_repository_solution_pack_form_submit($form, &$form_state) { } batch_set($batch); } + +function solution_pack_add_form($form_name, $form_xml) { + $result = db_result(db_query('Select name from {xml_forms} where name = "%s"', $form_name)); + if (!$result) { + $object = new stdClass(); + $object->name = $form_name; + $object->form = $form_xml; + $result = drupal_write_record('xml_forms', $object); + drupal_set_message(t("Added @name", array("@name" => $form_name))); + } +} + +function solution_pack_add_form_association($content_model, $form_name) { + $result = db_result(db_query('Select content_model from {islandora_content_model_forms} where content_model = "%s" and form_name = "%s"', + $content_model, $form_name)); + if (!$result) { + $object = new stdClass(); + $object->content_model = $content_model; + $object->form_name = $form_name; + $object->dsid = 'MODS'; + $object->title_field = "['titleInfo']['title']"; + $object->transform = 'mods_to_dc.xsl'; + $result = drupal_write_record('islandora_content_model_forms', $object); + drupal_set_message(t("Added association between @cm and @name", array("@cm" => $content_model, "@name"=>$form_name))); + } +} diff --git a/formClass.inc b/formClass.inc index dc369357..713f1fcb 100644 --- a/formClass.inc +++ b/formClass.inc @@ -1,796 +1,868 @@ - t('Fedora collection list'), - 'description' => t('Enter the Fedora Collection information here'), - 'page callback' => 'drupal_get_form', - 'page arguments' => array('fedora_repository_admin'), - 'access arguments' => array('administer site configuration'), - 'type' => MENU_NORMAL_ITEM, - ); - $items['admin/settings/fedora_repository/collection'] = array( - 'title' => t('Collection list'), - 'description' => t('Enter the Fedora collection information here.'), - 'access arguments' => array('administer site configuration'), - 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => 0, - ); - - $items['admin/settings/fedora_repository/demoobjects'] = array( - 'title' => t('Solution Packs'), - 'description' => t('Install content models and collections required by installed solution packs.'), - 'page callback' => 'fedora_repository_solution_packs_page', - 'access arguments' => array('add fedora datastreams'), - 'file' => 'fedora_repository.solutionpacks.inc', - 'type' => MENU_LOCAL_TASK, - ); - - $items['islandoracm.xsd'] = array( - 'title' => t('Islandoracm XML Schema Definition'), - 'page callback' => 'fedora_repository_display_schema', - 'page arguments' => array('islandoracm.xsd'), - 'type' => MENU_CALLBACK, - 'access arguments' => array('view fedora collection'), - ); - - $items['collection_policy.xsd'] = array( - 'title' => t('Islandoracm XML Schema Definition'), - 'page callback' => 'fedora_repository_display_schema', - 'page arguments' => array('collection_policy.xsd'), - 'type' => MENU_CALLBACK, - 'access arguments' => array('view fedora collection'), - ); - - $items['fedora'] = array( - 'page callback' => 'repository_page', - 'type' => MENU_CALLBACK, - 'access arguments' => array('view fedora collection'), - ); - $repository_title = variable_get('fedora_repository_title', 'Digital repository'); - if (trim($repository_title) != '') { - $respository_title = t($repository_title); - } - else { - $repository_title = NULL; - } - $items['fedora/repository'] = array( - 'title' => $repository_title, - 'page callback' => 'repository_page', - 'type' => MENU_NORMAL_ITEM, - 'access arguments' => array('view fedora collection'), - // 'access' => TRUE - ); - - $items['fedora/repository/service'] = array( - 'page callback' => 'repository_service', - 'type' => MENU_CALLBACK, - 'access arguments' => array('view fedora collection'), - ); - - $items['fedora/repository/object_download'] = array( - 'title' => t('Download object'), - 'page callback' => 'fedora_object_as_attachment', - 'type' => MENU_CALLBACK, - 'access arguments' => array('view fedora collection') - ); - $items['fedora/repository/editmetadata'] = array( - 'title' => t('Edit metadata'), - 'page callback' => 'fedora_repository_edit_qdc_page', - // 'page arguments' => array(1), - //'type' => MENU_LOCAL_TASK, - 'type' => MENU_CALLBACK, - 'access arguments' => array('edit fedora meta data') - ); - $items['fedora/repository/purgeStream'] = array( - 'title' => t('Purge data stream'), - 'page callback' => 'fedora_repository_purge_stream', - 'type' => MENU_CALLBACK, - 'access arguments' => array('purge objects and datastreams') - ); - $items['fedora/repository/replaceStream'] = array( - 'title' => t('Replace Stream'), - 'page callback' => 'fedora_repository_replace_stream', -// 'callback arguments' => array(3, 4), - 'type' => MENU_CALLBACK, -// 'access callback' => 'fedora_repository_user_access', - 'access arguments' => array('add fedora datastreams'), - ); - $items['fedora/repository/purgeObject'] = array( - 'title' => t('Purge object'), - 'page callback' => 'fedora_repository_purge_object', - // 'type' => MENU_LOCAL_TASK, - 'type' => MENU_CALLBACK, - 'access arguments' => array('purge objects and datastreams') - ); - $items['fedora/repository/addStream'] = array( - 'title' => t('Add stream'), - 'page callback' => 'add_stream', - // 'type' => MENU_LOCAL_TASK, - 'type' => MENU_CALLBACK, - 'access arguments' => array('add fedora datastreams') - ); - - $items['fedora/repository/collection'] = array( - 'title' => t('Collection view'), - 'page callback' => 'fedora_collection_view', - 'type' => MENU_CALLBACK, - 'access argruments' => array('view fedora collection') - ); - //new for mnpl****************************************** - $items['fedora/repository/mnpl_advanced_search'] = array( - 'title' => t('Repository advanced search'), - 'page callback' => 'fedora_repository_mnpl_advanced_search', - 'type' => MENU_CALLBACK, - 'access arguments' => array('view fedora collection') - ); - $items['fedora/ingestObject'] = array( - 'title' => t('Ingest object'), - 'page callback' => 'fedora_repository_ingest_object', - 'type' => MENU_CALLBACK, - 'access arguments' => array('add fedora datastreams') - ); - - $items['fedora/repository/list_terms'] = array( - 'title' => t('List terms'), - 'page callback' => 'fedora_repository_list_terms', - 'type' => MENU_CALLBACK, - 'access arguments' => array('view fedora collection') - ); - - $items['fedora/tagging/add_tag/js'] = array( - 'page callback' => 'fedora_tagging_add_tag_js', - 'access arguments' => array('edit tags datastream'), - 'type' => MENU_CALLBACK, - ); - - - /* Export functionality */ - $items['fedora/basket'] = array( - 'title' => t('Fedora Basket'), - 'description' => t('View and download objects added to your basket'), - 'page callback' => 'fedora_repository_basket', - 'access arguments' => array('view fedora collection'), - 'type' => MENU_CALLBACK, - ); - - $items['fedora/repository/addToBasket'] = array( - 'page callback' => 'fedora_repository_add_to_basket', - 'type' => MENU_CALLBACK, - 'access arguments' => array('view fedora collection'), - ); - - $items['fedora/repository/removeFromBasket'] = array( - 'page callback' => 'fedora_repository_remove_from_basket', - 'type' => MENU_CALLBACK, - 'access arguments' => array('view fedora collection'), - ); - - $items['fedora/repository/add_search_results_to_basket'] = array( - 'page callback' => 'fedora_repository_add_search_results_to_basket', - 'type' => MENU_CALLBACK, - 'access arguments' => array('view fedora collection'), - ); - - return $items; - } - - function createAdminForm() { - if (!user_access('administer site configuration')) { - drupal_set_message(t('You must be a site administrator to edit the Fedora collecitons list.'), 'error'); - return; - } - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - $form = array(); - $form['fedora_repository_name'] = array( - '#type' => 'textfield', - '#title' => t('Default collection name'), - '#default_value' => variable_get('fedora_repository_name', 'Islandora demos collection'), - '#description' => t('The Name of the collection to grab the list of items from'), - '#required' => TRUE, - '#weight' => -2 - ); - $form['fedora_repository_pid'] = array( - '#type' => 'textfield', - '#title' => t('Default collection PID'), - '#default_value' => variable_get('fedora_repository_pid', 'islandora:top'), - '#description' => t('The PID of the collection object to grab the list of items from'), - '#required' => TRUE, - '#weight' => -2 - ); - - $form['fedora_collection_model_pid'] = array( - '#type' => 'textfield', - '#title' => t('Default Collection Model PID'), - '#default_value' => variable_get('fedora_collection_model_pid', 'islandora:collectionCModel'), - '#description' => t('The PID of the default Collection Model Object'), - '#required' => TRUE, - '#weight' => -2 - ); - - $form['fedora_content_model_collection_pid'] = array( - '#type' => 'textfield', - '#title' => t('Default Content Model Collection PID'), - '#default_value' => variable_get('fedora_content_model_collection_pid', 'islandora:ContentModelCollection'), - '#description' => t('The PID of the Content Model Collection Object'), - '#required' => TRUE, - '#weight' => -2 - ); - - - $form['fedora_repository_url'] = array( - '#type' => 'textfield', - '#title' => t('Fedora RISearch URL'), - '#default_value' => variable_get('fedora_repository_url', - 'http://localhost:8080/fedora/risearch'), - '#description' => t('The url of the Fedora server'), '#required' => TRUE, - '#weight' => 0 - ); - $form['fedora_fgsearch_url'] = array( - '#type' => 'textfield', - '#title' => t('Fedora Lucene search URL'), - '#default_value' => variable_get('fedora_fgsearch_url', 'http://localhost:8080/fedoragsearch/rest'), - '#description' => t('The url of the Lucene Fedora server'), - '#required' => TRUE, - '#weight' => 0 - ); - $form['fedora_index_name'] = array( - '#type' => 'textfield', - '#title' => t('Fedora Lucene index name'), - '#default_value' => variable_get('fedora_index_name', 'BasicIndex'), - '#description' => t('The name of the Lucene index to search'), - '#required' => TRUE, - '#weight' => 0 - ); - $form['fedora_soap_url'] = array( - '#type' => 'textfield', - '#title' => t('Fedora SOAP Url'), - '#default_value' => variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl'), - '#description' => t('The URL to use for SOAP connections'), - '#required' => TRUE, - '#weight' => 0, - '#suffix' => '

' . (fedora_available() ? '' . t('Successfully connected to Fedora server at !fedora_soap_url', array('!fedora_soap_url' => variable_get('fedora_soap_url', ''))) : ' ' . t('Unable to connect to Fedora server at !fedora_soap_url

', array('!fedora_soap_url' => variable_get('fedora_soap_url', '')))), - ); - $form['fedora_base_url'] = array( - '#type' => 'textfield', - '#title' => t('Fedora base URL'), - '#default_value' => variable_get('fedora_base_url', 'http://localhost:8080/fedora'), - '#description' => t('The URL to use for REST-type connections'), - '#required' => TRUE, - '#weight' => 0, - ); - - $form['fedora_soap_manage_url'] = array( - '#type' => 'textfield', - '#title' => t('Fedora SOAP management URL'), - '#default_value' => variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl'), '#description' => t('The URL to use for SOAP API-M connections'), - '#required' => TRUE, - '#weight' => 0 - ); - - $form['fedora_solr_search_url'] = array( - '#type' => 'textfield', - '#title' => t('Fedora Solr search URL'), - '#default_value' => variable_get('fedora_solr_search_url', 'http://localhost:8080/solr'), '#description' => t('The URL to use for Solr searching'), - '#required' => TRUE, - '#weight' => 0 - ); - -// will allow admin user to remove namepsace restrictions if not explicitly disallowed in settings.php - if (variable_get('allow_open_namespace', TRUE)) { - $form['fedora_namespace'] = array( - '#type' => 'fieldset', - ); - - $form['fedora_namespace']['fedora_namespace_restriction_enforced'] = array( - '#weight' => -1, - '#type' => 'radios', - '#title' => t('Enforce namespace restrictions'), - '#options' => array( - TRUE => t('Enabled'), - FALSE => t('Disabled') - ), - '#description' => t('Allow administrator to restrict user\'s access to the PID namepaces listed below'), - '#default_value' => variable_get('fedora_namespace_restriction_enforced', TRUE) - ); - - $form['fedora_namespace']['fedora_pids_allowed'] = array( - '#type' => 'textfield', - '#title' => t('PID namespaces allowed in this Drupal install'), - '#default_value' => variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: '), - '#description' => t('A space separated list PID namespaces that users are permitted to access from this Drupal installation.
This could be more than a simple namespace ie demo:mydemos.'), - '#weight' => 0 - ); - } - else { - $form['fedora_pids_allowed'] = array( - '#type' => 'textfield', - '#title' => t('PID namespaces allowed in this Drupal install'), - '#default_value' => variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: '), - '#description' => t('A space separated list PID namespaces that users are permitted to access from this Drupal installation.
This could be more than a simple namespace ie demo:mydemos.'), - '#weight' => 0 - ); - } - $form['fedora_repository_title'] = array( - '#type' => 'textfield', - '#title' => t('Fedora Repository Title'), - '#default_value' => variable_get('fedora_repository_title', 'Digital Repository'), - '#description' => t('The title displayed when viewing collections and objects in /fedora/repository. Leave blank to display no title. Note that the menus must be rebuilt after changing this variable.'), - ); - - $form['fedora_object_display_title'] = array( - '#type' => 'select', - '#title' => t('Display Object Title Behaviour'), - '#default_value' => variable_get('fedora_object_display_title', ObjectHelper::$DISPLAY_ALWAYS), - '#options' => array(ObjectHelper::$DISPLAY_ALWAYS => t('Always'), ObjectHelper::$DISPLAY_NEVER => t('Never'), ObjectHelper::$DISPLAY_NO_MODEL_OUTPUT => t('Only if no Content Model display output.')), - '#description' => t('Determines when to display the object (or collection) title when viewing an object/collection page.'), - ); - - $form['fedora_object_display_description'] = array( - '#type' => 'select', - '#title' => t('Display Object Description Behaviour'), - '#default_value' => variable_get('fedora_object_display_description', ObjectHelper::$DISPLAY_ALWAYS), - '#options' => array(ObjectHelper::$DISPLAY_ALWAYS => t('Always'), ObjectHelper::$DISPLAY_NEVER => t('Never'), ObjectHelper::$DISPLAY_NO_MODEL_OUTPUT => t('Only if no Content Model display output.')), - '#description' => t('Determines when to display the default object (or collection) description fieldset when viewing an object/collection page.'), - ); - - $form['fedora_object_restrict_datastreams'] = array( - '#type' => 'checkbox', - '#title' => t('Restrict Access to Fedora Object Datastreams'), - '#default_value' => variable_get('fedora_object_restrict_datastreams', FALSE), - '#description' => t('When enabled, restricts access to fedora object datastreams that are not listed in the Islandora Content Model for the object (unless the user is an administrator).'), - ); - - $form['fedora_collection_display_list'] = array( - '#type' => 'select', - '#title' => t('Display Collection List Behaviour'), - '#default_value' => variable_get('fedora_collection_display_list', ObjectHelper::$DISPLAY_ALWAYS), - '#options' => array(ObjectHelper::$DISPLAY_ALWAYS => t('Always'), ObjectHelper::$DISPLAY_NEVER => t('Never'), ObjectHelper::$DISPLAY_NO_MODEL_OUTPUT => t('Only if no Content Model display output.')), - '#description' => t('Determines when to display the list of objects when viewing a collection page.'), - ); - - //Export functionality - $form['module']['export_area'] = array( - '#type' => 'textfield', - '#title' => t('Export area'), - '#default_value' => variable_get('export_area', file_directory_path() . '/fedora_export_area'), - '#description' => t("Path to the export area. It must be accessible by druapl (i.e. apache user)."), - '#required' => TRUE, - ); - - $form['#attributes'] = array('enctype' => "multipart/form-data"); - - - return system_settings_form($form); - } - - function updateMetaData($form_id, $form_values, $client) { - // ====================================== - // = begin creation of foxml dom object = - // ====================================== - $dom = new DomDocument("1.0", "UTF-8"); - $dom->formatOutput = TRUE; - - ///begin writing qdc - - $oai = $dom->createElement("oai_dc:dc"); - $oai->setAttribute('xmlns:oai_dc', "http://www.openarchives.org/OAI/2.0/oai_dc/"); - $oai->setAttribute('xmlns:dc', "http://purl.org/dc/elements/1.1/"); - $oai->setAttribute('xmlns:dcterms', "http://purl.org/dc/terms/"); - $oai->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); - - // DC elements - $previousElement = NULL; // Used in case we have to nest elements for qualified dublin core. - foreach ($form_values as $key => $value) { - $index = strrpos($key, '-'); - $key = substr($key, 0, $index); - $test = substr($key, 0, 2); - if ($test == 'dc' || $test == 'ap') { // Don't try to process other form values. - try { - if (!strcmp(substr($key, 0, 4), 'app_')) { - $key = substr($key, 4); - $previousElement->appendChild($dom->createElement($key, $value)); - } - else { - $previousElement = $dom->createElement($key, $value); - $oai->appendChild($previousElement); - } - } catch (exception $e) { - drupal_set_message(t($e->getMessage()), 'error'); - continue; - } - } - } - - $dom->appendChild($oai); - - if (!$client) { - return; - } - - $pid = $form_values['pid']; - $dsId = $form_values['dsid']; - $params = array( - "pid" => $pid, - "dsID" => $dsId, - "altIDs" => "", - "dsLabel" => "Qualified Dublin Core", - "MIMEType" => "text/xml", - "formatURI" => "URL", - "dsContent" => $dom->saveXML(), "checksumType" => "DISABLED", "checksum" => "none", - "logMessage" => "datastream_modified", "force" => "TRUE"); - try { - $object = $client->__soapCall('ModifyDatastreamByValue', array($params)); - } catch (exception $e) { - drupal_set_message(t("Error updating metadata ") . $e->getMessage(), 'error'); - } - } - - // queries the collection object for a childsecurity datastream and if found parses it - // to determine if this user is allowed to ingest in this collection - // we assume if they are able to modify objects in the collection they can ingest as well. - function can_ingest_here($collection_pid) { - module_load_include('inc', 'fedora_repository', 'SecurityClass'); - $securityClass = new SecurityClass(); - return $securityClass->canIngestHere($collection_pid); - } - - /** - * Create a multi step form (wizard) for ingesting objects into Fedora - */ - function createIngestForm($collection_pid, $collection_label, &$form_state) { - global $user; - module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); - // drupal_add_js("function _imce_ingest_ImceFinish(path, w, h, s, imceWin) {imceWin.close(); document.getElementById('edit-ingest-file-location').value = path;}",'inline','header'); - - if (!user_access('ingest new fedora objects')) { - drupal_set_message(t('You do not have permission to ingest.'), 'error'); - return ''; - } - if (empty($form_state['storage']['step'])) { - // we are coming in without a step, so default to step 1 - $form_state['storage']['step'] = 1; - } - //this uses drupal's permissions at this point no xacml yet. xacml decisions are made by fedora - if (!$this->can_ingest_here($collection_pid)) { - drupal_set_message(t('You do not have premission to ingest here.')); - return ''; - } - - if ($collection_pid == NULL) { - drupal_set_message(t('You must specify an collection object pid to ingest an object.'), 'error'); - return FALSE; - } - if (($cp = CollectionPolicy::loadFromCollection($collection_pid)) === FALSE) { - drupal_set_message(t('Unable to load collection policy \'' . $collection_pid . '\'.')); - return FALSE; - } - - - $contentModels = $cp->getContentModels(); - - if (!$contentModels) { - drupal_set_message(t('No content models associated with this collection: !collection_label. Please contact your administrator.', array('!collection_label' => $collection_label)), 'error'); - return FALSE; - } - $modelsForForm = array(); - foreach ($contentModels as $contentModel) { - $identifier = $contentModel->getIdentifier(); - $name = $contentModel->name; - $modelsForForm["$identifier"] = "$name"; - } - - switch ($form_state['storage']['step']) { - case 1: - $form['indicator'] = array( - '#type' => 'fieldset', - '#title' => t('Ingest digital object into collection_pid !collection_label Step #1', array('collection_pid' => $collection_pid, '!collection_label' => $collection_label)) - ); - - $form['indicator']['models'] = array(// content models available - '#type' => 'select', - '#title' => t('Content models available'), - '#options' => $modelsForForm, - //'#description' => t('Content models available in this collection. A content model defines what is allowed in a collection and what to do with a file when it is uploaded (An example may creating a thumbnail from an image.).') - '#description' => t('Content models define datastream composition, relationships between this and other content models, and the mandatory behaviors associated with each digital object.
Additional information may be found here. ') - ); - break; - - case 2: - module_load_include('inc', 'fedora_repository', 'MimeClass'); // Why this include? --Zac, 2010-09-17 - $contentModelPid = ContentModel::getPidFromIdentifier($form_state['values']['models']); - $contentModelDsid = ContentModel::getDSIDFromIdentifier($form_state['values']['models']); - - if (($cm = ContentModel::loadFromModel($contentModelPid, $contentModelDsid)) !== FALSE) { - $form = $cm->buildIngestForm($form, $form_state); - if ($form === FALSE) { - - drupal_set_message(t("Error Building Ingest Form."), 'error'); - foreach (ContentModel::$errors as $err) { - drupal_set_message($err, 'error'); - } - } - } - - break; - } - - $form['collection_pid'] = array( - '#type' => 'hidden', - '#value' => $collection_pid - ); - - if ($form_state['storage']['step'] < 2) { - $button_name = t('Next'); - } - else { - $prefix = t('Please be patient. Once you click next there may be a number of files created. Depending on your content model this could take a few minutes to process.
'); - $button_name = t('Ingest'); - } - - $form['submit'] = array( - '#type' => 'submit', - '#submit' => array('fedora_repository_ingest_form_submit'), - '#value' => $button_name - ); - - return $form; - } - - // this function may not be being used - function createAddDataStreamForm($pid, &$form_state) { - //dump_vars($form_state); - // Populate the list of datastream IDs. - - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - module_load_include('inc', 'fedora_repository', 'ContentModel'); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - - $obj_helper = new ObjectHelper(); - $content_models = $obj_helper->get_content_models_list($pid); - $available_dsids = array(); - if (!empty($content_models)) { - foreach ($content_models as $content_model) { - - - $newElements = $content_model->listDatastreams(); - if (!empty($newElements)) { - $available_dsids = array_merge($available_dsids, $newElements); - } - - } - } - - $item = new Fedora_Item($pid); - $used_datastreams = $item->get_datastreams_list_as_SimpleXML(); - $used_datastream_ids = array(); - foreach ($used_datastreams->datastreamDef as $used_datastream) { - array_push($used_datastream_ids, $used_datastream->ID); - } - $unused_dsids = array(); - - if ($form_state['submitted'] && $form_state['clicked_button']['#value'] != 'OK') { - $form['add_datastream_label'] = array( - '#value' => t('

The datastream has been uploaded.

'), - '#weight' => -10, - ); - $form['#redirect'] = "fedora/repository/$pid/"; - $form['submit'] = array( - '#type' => 'submit', - '#value' => t('OK') - ); - return $form; - } - if (!empty($available_dsids)) { - $unused_dsids = array_diff($available_dsids, $used_datastream_ids); - if (empty($unused_dsids)) { - return; - } - } - - $form['add_datastream_label'] = array( - '#value' => t('

Add Datastream:

'), - '#weight' => -10, - ); - - $form['pid'] = array( - '#type' => 'hidden', - '#value' => "$pid" - ); - - $form['stream_label'] = array( - '#title' => 'Datastream Label', - '#required' => 'TRUE', - '#description' => t('A Human readable label'), - '#type' => 'textfield' - ); - - $form['#attributes']['enctype'] = 'multipart/form-data'; - $form['add-stream-file-location'] = array( - '#type' => 'file', - '#title' => t('Upload Document'), - '#size' => 48, - // '#required'=>'TRUE', - '#description' => t('The file to upload.') - ); - $form['#redirect'] = "fedora/repository/$pid/"; - $form['submit'] = array( - '#type' => 'submit', - '#value' => t('Add Datastream') - ); - - if (!empty($unused_dsids)) { - $dsidsForForm = array(); - foreach ($unused_dsids as $dsid){ - $dsidsForForm[$dsid]=$dsid; - } - $form['stream_id'] = array( - '#type' => 'select', - '#title' => t('Datastream ID'), - '#default_value' => variable_get('feed_item_length', 'teaser'), - '#weight' => '-1', - '#description' => t('Datastream IDs defined by the content model.'), - ); - $form['stream_id']['#options'] = array_combine($unused_dsids, $unused_dsids); - } - else { - $form['stream_id'] = array( - '#title' => 'Datastream ID', - '#required' => 'TRUE', - '#description' => t('An ID for this stream that is unique to this object. Must start with a letter and contain only alphanumeric characters and dashes and underscores.'), - '#type' => 'textfield', - '#weight' => -1, - ); - } - return $form; - } - - /** - * Creates a drupal form to edit either the QDC or DC datastream - */ - function createMetaDataForm($pid, $dsId = NULL, $client) { - if (!isset($dsId)) { - $dsId = 'QDC'; - } - - //$client = getSoapClient(variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl')); - $params = array('pid' => "$pid", 'dsID' => "$dsId", 'asOfDateTime' => ""); - try { - $object = $client->__soapCAll('getDatastreamDissemination', array('parameters' => $params)); - } catch (Exception $e) { - return array(); - } - - $content = $object->dissemination->stream; - $content = trim($content); - $doc = new DOMDocument(); - if (!$doc->loadXML($content)) { - echo "error loading xml"; - } - - $oai_dc = $doc->getElementsByTagName('dc'); - - $dcItems = $oai_dc->item(0)->getElementsByTagName('*'); - $form = array(); - for ($i = 0; $i < $dcItems->length; $i++) { - $name = $dcItems->item($i)->nodeName; - if ($name == 'dc:description') { - $form["$name" . '-' . "$i"] = array( - '#title' => $name, - '#type' => 'textarea', - '#default_value' => $dcItems->item($i)->nodeValue, - '#description' => 'Dublin Core ' . substr($dcItems->item($i)->nodeName, 3) - ); - } - elseif ($name == 'dc:title') { - $form["$name" . '-' . "$i"] = array( - '#title' => $name, - '#type' => 'textfield', - '#required' => 'TRUE', - '#default_value' => $dcItems->item($i)->nodeValue, - '#description' => 'Dublin Core ' . substr($dcItems->item($i)->nodeName, 3) - ); - } - else { - if ($oai_dc->item(0)->nodeName != $dcItems->item($i)->parentNode->nodeName) { - $description = strstr($name, ':'); - $form['app_' . "$name" . '-' . "$i"] = array( - '#title' => $name, - '#type' => 'textfield', - '#default_value' => $dcItems->item($i)->nodeValue, - '#description' => 'Dublin Core ' . substr($description, 1) - ); - } - else { - $field_type = 'textfield'; - $value = $dcItems->item($i)->nodeValue; - if ($name == 'dc:coverage') { - $value = ''; - } - if ($name == 'dc:rights') { - $field_type = 'textarea'; - } - $description = strstr($name, ':'); - $form["$name" . '-' . "$i"] = array( - '#title' => $name, - '#type' => $field_type, - '#default_value' => $value, - '#description' => 'Dublin Core ' . substr($description, 1) - ); - } - } - } - - $form['pid'] = array( - '#type' => 'hidden', - '#value' => "$pid" - ); - $form['dsid'] = array( - '#type' => 'hidden', - '#value' => "$dsId" - ); - $form['submit'] = array( - '#type' => 'submit', - '#value' => t('Update Metadata'), - ); - - return $form; - } - - /** - * Creates a form for replacing datastream - */ - function createReplaceDataStreamForm($pid, $dsId, $dsLabel, &$form_state) { - $form = array(); - - $form['#attributes']['enctype'] = 'multipart/form-data'; - $form['file'] = array( - '#type' => 'file', - '#title' => t('Upload Document'), - '#description' => t('The file to upload.') - ); - - $form['pid'] = array( - '#type' => 'value', - '#value' => $pid, - ); - - $form['dsId'] = array( - '#type' => 'value', - '#value' => $dsId, - ); - - $form['dsLabel'] = array( - '#type' => 'value', - '#value' => $dsLabel, - ); - - $form['submit'] = array( - '#type' => 'submit', - '#value' => t('Replace Datastream') - ); - - return $form; - } - -} \ No newline at end of file + t('Islandora Configuration'), + 'description' => t("Configure Islandora's interaction with Fedora"), + 'page callback' => 'drupal_get_form', + 'page arguments' => array('fedora_repository_admin'), + 'access arguments' => array('administer site configuration'), + 'type' => MENU_NORMAL_ITEM, + ); + $items['admin/settings/fedora_repository/collection'] = array( + 'title' => t('Collection list'), + 'description' => t('Enter the Islandora collection information here.'), + 'access arguments' => array('administer site configuration'), + 'type' => MENU_DEFAULT_LOCAL_TASK, + 'weight' => 0, + ); + + $items['admin/settings/fedora_repository/demoobjects'] = array( + 'title' => t('Solution Packs'), + 'description' => t('Install content models and collections required by installed solution packs.'), + 'page callback' => 'fedora_repository_solution_packs_page', + 'access arguments' => array('add fedora datastreams'), + 'file' => 'fedora_repository.solutionpacks.inc', + 'type' => MENU_LOCAL_TASK, + ); + $items['islandoracm.xsd'] = array( + 'title' => t('Islandora Content Model XML Schema Definition'), + 'page callback' => 'fedora_repository_display_schema', + 'page arguments' => array('islandoracm.xsd'), + 'type' => MENU_CALLBACK, + 'access arguments' => array('view fedora collection'), + ); + + $items['collection_policy.xsd'] = array( + 'title' => t('Islandora Content Model XML Schema Definition'), + 'page callback' => 'fedora_repository_display_schema', + 'page arguments' => array('collection_policy.xsd'), + 'type' => MENU_CALLBACK, + 'access arguments' => array('view fedora collection'), + ); + + $items['fedora'] = array( + 'page callback' => 'repository_page', + 'type' => MENU_CALLBACK, + 'access arguments' => array('view fedora collection'), + ); + $items['fedora/repository'] = array( + 'title' => 'Digital Repository', + 'page callback' => 'repository_page', + 'type' => MENU_NORMAL_ITEM, + 'access arguments' => array('view fedora collection'), + ); + + $items['fedora/repository/service'] = array( + 'page callback' => 'repository_service', + 'type' => MENU_CALLBACK, + 'access arguments' => array('view fedora collection'), + ); + + $items['fedora/repository/object_download'] = array( + 'title' => t('Download object'), + 'page callback' => 'fedora_object_as_attachment', + 'type' => MENU_CALLBACK, + 'access arguments' => array('view fedora collection') + ); + + $items['fedora/repository/editmetadata'] = array( + 'title' => t('Edit metadata'), + 'page callback' => 'fedora_repository_edit_qdc_page', + 'type' => MENU_CALLBACK, + 'access arguments' => array('edit fedora meta data') + ); + + $items['fedora/repository/purgeStream'] = array( + 'title' => t('Purge data stream'), + 'page callback' => 'fedora_repository_purge_stream', + 'type' => MENU_CALLBACK, + 'access arguments' => array('purge objects and datastreams') + ); + + $items['fedora/repository/replaceStream'] = array( + 'title' => t('Replace Stream'), + 'page callback' => 'fedora_repository_replace_stream', + 'type' => MENU_CALLBACK, + 'access arguments' => array('add fedora datastreams'), + ); + + $items['fedora/repository/purgeObject'] = array( + 'title' => t('Purge object'), + 'page callback' => 'fedora_repository_purge_object', + 'type' => MENU_CALLBACK, + 'access arguments' => array('purge objects and datastreams') + ); + + $items['fedora/repository/addStream'] = array( + 'title' => t('Add stream'), + 'page callback' => 'add_stream', + 'type' => MENU_CALLBACK, + 'access arguments' => array('add fedora datastreams') + ); + + $items['fedora/repository/collection'] = array( + 'title' => t('Collection view'), + 'page callback' => 'fedora_collection_view', + 'type' => MENU_CALLBACK, + 'access argruments' => array('view fedora collection'), + ); + + //new for mnpl****************************************** + $items['fedora/repository/mnpl_advanced_search'] = array( + 'title' => t('Repository advanced search'), + 'page callback' => 'fedora_repository_mnpl_advanced_search', + 'type' => MENU_CALLBACK, + 'access arguments' => array('view fedora collection') + ); + + $items['fedora/ingestObject'] = array( + 'title' => t('Ingest object'), + 'page callback' => 'fedora_repository_ingest_object', + 'type' => MENU_CALLBACK, + 'access arguments' => array('add fedora datastreams') + ); + + $items['fedora/repository/list_terms'] = array( + 'title' => t('List terms'), + 'page callback' => 'fedora_repository_list_terms', + 'type' => MENU_CALLBACK, + 'access arguments' => array('view fedora collection') + ); + + /* Export functionality */ + $items['fedora/basket'] = array( + 'title' => t('Fedora Basket'), + 'description' => t('View and download objects added to your basket'), + 'page callback' => 'fedora_repository_basket', + 'access arguments' => array('view fedora collection'), + 'type' => MENU_CALLBACK, + ); + + $items['fedora/repository/addToBasket'] = array( + 'page callback' => 'fedora_repository_add_to_basket', + 'type' => MENU_CALLBACK, + 'access arguments' => array('view fedora collection'), + ); + + $items['fedora/repository/removeFromBasket'] = array( + 'page callback' => 'fedora_repository_remove_from_basket', + 'type' => MENU_CALLBACK, + 'access arguments' => array('view fedora collection'), + ); + + $items['fedora/repository/add_search_results_to_basket'] = array( + 'page callback' => 'fedora_repository_add_search_results_to_basket', + 'type' => MENU_CALLBACK, + 'access arguments' => array('view fedora collection'), + ); + + return $items; + } + + /** + * Create admin form + * @return array + */ + function createAdminForm() { + if (!user_access('administer site configuration')) { + drupal_set_message(t('You must be a site administrator to edit the Fedora collections list.'), 'error'); + return; + } + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + $form = array(); + $form['fedora_repository_pid'] = array( + '#type' => 'textfield', + '#title' => t('Root Collection PID'), + '#default_value' => variable_get('fedora_repository_pid', 'islandora:root'), + '#description' => t('The PID of the Root Collection Object'), + '#required' => TRUE, + '#weight' => -18 + ); + + $form['fedora_base_url'] = array( + '#type' => 'textfield', + '#title' => t('Fedora base URL'), + '#default_value' => variable_get('fedora_base_url', 'http://localhost:8080/fedora'), + '#description' => t('The URL to use for REST-type connections'), + '#required' => TRUE, + '#weight' => -16, + ); + + + $form['fedora_repository_url'] = array( + '#type' => 'textfield', + '#title' => t('Fedora RISearch URL'), + '#default_value' => variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'), + '#description' => t('The url of the Fedora server'), '#required' => TRUE, + '#weight' => -14 + ); + + $form['fedora_soap_url'] = array( + '#type' => 'textfield', + '#title' => t('Fedora SOAP Url'), + '#default_value' => variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl'), + '#description' => t('The URL to use for SOAP connections'), + '#required' => TRUE, + '#weight' => -12, + '#suffix' => '

' . ( + fedora_available() ? + theme('image', 'misc/watchdog-ok.png') . t('Successfully connected to Fedora server at @fedora_soap_url', array('@fedora_soap_url' => variable_get('fedora_soap_url', ''))) : + theme('image', 'misc/watchdog-error.png') . t('Unable to connect to Fedora server at @fedora_soap_url', array('@fedora_soap_url' => variable_get('fedora_soap_url', '')))) . '

', + ); + + $form['fedora_soap_manage_url'] = array( + '#type' => 'textfield', + '#title' => t('Fedora SOAP management URL'), + '#default_value' => variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/wsdl?api=API-M'), '#description' => t('The URL to use for SOAP API-M connections'), + '#required' => TRUE, + '#weight' => -10 + ); + +// will allow admin user to remove namepsace restrictions if not explicitly disallowed in settings.php + if (variable_get('allow_open_namespace', TRUE)) { + $form['fedora_namespace'] = array( + '#type' => 'fieldset', + ); + + $form['fedora_namespace']['fedora_namespace_restriction_enforced'] = array( + '#weight' => -1, + '#type' => 'radios', + '#title' => t('Enforce namespace restrictions'), + '#options' => array( + TRUE => t('Enabled'), + FALSE => t('Disabled') + ), + '#description' => t('Allow administrator to restrict user\'s access to the PID namepaces listed below'), + '#default_value' => variable_get('fedora_namespace_restriction_enforced', TRUE) + ); + + $form['fedora_namespace']['fedora_pids_allowed'] = array( + '#type' => 'textfield', + '#title' => t('PID namespaces allowed in this Drupal install'), + '#default_value' => variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: '), + '#description' => t('A space separated list of PID namespaces that users are permitted to access from this Drupal installation.
This could be more than a simple namespace ie demo:mydemos.'), + '#weight' => 0 + ); + } + else { + $form['fedora_pids_allowed'] = array( + '#type' => 'textfield', + '#title' => t('PID namespaces allowed in this Drupal install'), + '#default_value' => variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: '), + '#description' => t('A space separated list of PID namespaces that users are permitted to access from this Drupal installation.
This could be more than a simple namespace ie demo:mydemos.'), + '#weight' => 0 + ); + } + + //have tabs options (like disable) + $form['tabs'] = array( + '#type' => 'fieldset', + '#title' => t('Tabs Configuration'), + '#description' => t('Configure the tabs avaialble when viewing Fedora objects.'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + //when checked show object details tab + $form['tabs']['fedora_repository_show_object_details_tab'] = array( + '#type' => 'checkbox', + '#title' => t('Show Object Details Tab'), + '#default_value' => variable_get('fedora_repository_show_object_details_tab', TRUE), + '#description' => t("When enabled, the 'Object Details' tab will be visible to users with the correct permissions when viewing an object in the repository"), + ); + + $form['advanced'] = array( + '#type' => 'fieldset', + '#title' => t('Advanced configuration options'), + '#description' => t('Advanced configuration. Under normal circumstances these will not be touched'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + $form['advanced']['fedora_object_display_title'] = array( + '#type' => 'select', + '#title' => t('Display Object Title Behaviour'), + '#default_value' => variable_get('fedora_object_display_title', ObjectHelper::$DISPLAY_ALWAYS), + '#options' => array(ObjectHelper::$DISPLAY_ALWAYS => t('Always'), ObjectHelper::$DISPLAY_NEVER => t('Never'), ObjectHelper::$DISPLAY_NO_MODEL_OUTPUT => t('Only if no Content Model display output.')), + '#description' => t('Determines when to display the object (or collection) title when viewing an object/collection page.'), + ); + + $form['advanced']['fedora_object_display_description'] = array( + '#type' => 'select', + '#title' => t('Display Object Description Behaviour'), + '#default_value' => variable_get('fedora_object_display_description', ObjectHelper::$DISPLAY_ALWAYS), + '#options' => array(ObjectHelper::$DISPLAY_ALWAYS => t('Always'), ObjectHelper::$DISPLAY_NEVER => t('Never'), ObjectHelper::$DISPLAY_NO_MODEL_OUTPUT => t('Only if no Content Model display output.')), + '#description' => t('Determines when to display the default object (or collection) description fieldset when viewing an object/collection page.'), + ); + + $form['advanced']['fedora_object_restrict_datastreams'] = array( + '#type' => 'checkbox', + '#title' => t('Restrict Access to Fedora Object Datastreams'), + '#default_value' => variable_get('fedora_object_restrict_datastreams', FALSE), + '#description' => t('When enabled, restricts access to fedora object datastreams that are not listed in the Islandora Content Model for the object (unless the user is an administrator).'), + ); + + $form['advanced']['fedora_collection_display_list'] = array( + '#type' => 'select', + '#title' => t('Display Collection List Behaviour'), + '#default_value' => variable_get('fedora_collection_display_list', ObjectHelper::$DISPLAY_ALWAYS), + '#options' => array(ObjectHelper::$DISPLAY_ALWAYS => t('Always'), ObjectHelper::$DISPLAY_NEVER => t('Never'), ObjectHelper::$DISPLAY_NO_MODEL_OUTPUT => t('Only if no Content Model display output.')), + '#description' => t('Determines when to display the list of objects when viewing a collection page.'), + ); + + //Export functionality + $form['advanced']['module']['export_area'] = array( + '#type' => 'textfield', + '#title' => t('Export area'), + '#default_value' => variable_get('export_area', file_directory_path() . '/fedora_export_area'), + '#description' => t("Path to the export area. It must be accessible by druapl (i.e. apache user)."), + '#required' => TRUE, + ); + + $form['#attributes'] = array('enctype' => "multipart/form-data"); + + + return system_settings_form($form); + } + + /** + * Update Metadata + * @param type $form_id + * @param type $form_values + * @param type $client + * @return type + */ + function updateMetaData($form_id, $form_values, $client) { + // ====================================== + // = begin creation of foxml dom object = + // ====================================== + $dom = new DomDocument("1.0", "UTF-8"); + $dom->formatOutput = TRUE; + + ///begin writing qdc + + $oai = $dom->createElement("oai_dc:dc"); + $oai->setAttribute('xmlns:oai_dc', "http://www.openarchives.org/OAI/2.0/oai_dc/"); + $oai->setAttribute('xmlns:dc', "http://purl.org/dc/elements/1.1/"); + $oai->setAttribute('xmlns:dcterms', "http://purl.org/dc/terms/"); + $oai->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); + + // DC elements + $previousElement = NULL; // Used in case we have to nest elements for qualified dublin core. + + $label = null; + foreach ($form_values as $key => $value) { + //echo ($key); + if ($key == 'dc:title-0') { + $label = $value; + } + $index = strrpos($key, '-'); + $key = substr($key, 0, $index); + $test = substr($key, 0, 2); + if ($test == 'dc' || $test == 'ap') { // Don't try to process other form values. + try { + if (!strcmp(substr($key, 0, 4), 'app_')) { + $key = substr($key, 4); + $previousElement->appendChild($dom->createElement($key, $value)); + } + else { + $previousElement = $dom->createElement($key, $value); + $oai->appendChild($previousElement); + } + } catch (exception $e) { + drupal_set_message(t($e->getMessage()), 'error'); + continue; + } + } + } + + // Save the title + if ( $label != null ) + { + $object = new Fedora_Item($form_values['pid']); + $object->modify_object($label); + } + + $dom->appendChild($oai); + + if (!$client) { + return; + } + + $pid = $form_values['pid']; + $dsId = $form_values['dsid']; + $params = array( + "pid" => $pid, + "dsID" => $dsId, + "altIDs" => "", + "dsLabel" => "Qualified Dublin Core", + "MIMEType" => "text/xml", + "formatURI" => "URL", + "dsContent" => $dom->saveXML(), "checksumType" => "DISABLED", "checksum" => "none", + "logMessage" => "datastream_modified", "force" => "TRUE"); + try { + $object = $client->__soapCall('ModifyDatastreamByValue', array($params)); + } catch (exception $e) { + drupal_set_message(t("Error updating metadata") . " " . $e->getMessage(), 'error'); + } + } + + /** + * queries the collection object for a childsecurity datastream and if found parses it + * to determine if this user is allowed to ingest in this collection + * we assume if they are able to modify objects in the collection they can ingest as well. + * @param type $collection_pid + * @return type + */ + function can_ingest_here($collection_pid) { + module_load_include('inc', 'fedora_repository', 'SecurityClass'); + $securityClass = new SecurityClass(); + return $securityClass->canIngestHere($collection_pid); + } + + /** + * Drupal's permissions at this point no xacml yet. xacml decisions are made by fedora + * @param type $collection_pid + * @return type + */ + function canShowIngestForm($collection_pid) { + if (!user_access('ingest new fedora objects')) { + drupal_set_message(t('You do not have permission to ingest.'), 'error'); + return FALSE; + } + module_load_include('inc', 'fedora_repository', 'SecurityClass'); + $security_class = new SecurityClass(); + if (!$security_class->canIngestHere($collection_pid)) { + // Queries the collection object for a child security datastream and if found parses it + // to determine if this user is allowed to ingest in this collection + // we assume if they are able to modify objects in the collection they can ingest as well. + drupal_set_message(t('You do not have premission to ingest here.')); + return FALSE; + } + if ($collection_pid == NULL) { + drupal_set_message(t('You must specify an collection object pid to ingest an object.'), 'error'); + return FALSE; + } + return TRUE; + } + + /** + * Creates the first page of the ingest form for editing QDC. + * + * @param string $collection_pid + * @param string $collection_label + * @param array $form_state + * + * @return array + */ + function createQDCIngestFormPageOne($collection_pid, $collection_label, array &$form_state) { + if (($collection_policy = CollectionPolicy::loadFromCollection($collection_pid)) === FALSE) { + drupal_set_message(t('Unable to load collection policy \'' . $collection_pid . '\'.')); + return FALSE; + } + if (!($content_models = $collection_policy->getContentModels())) { + drupal_set_message(t('No content models associated with this collection: !collection_label. Please contact your administrator.', array('!collection_label' => $collection_label)), 'error'); + return FALSE; + } + $potential_models = array(); + foreach ($content_models as $content_model) { + $identifier = $content_model->getIdentifier(); + $name = $content_model->name; + $potential_models["$identifier"] = "$name"; + } + $identifier = key($potential_models); + $selected_model = isset($form_state['values']['models']) ? $form_state['values']['models'] : $identifier; + return array( + 'indicator' => array( + '#type' => 'fieldset', + '#title' => t('Ingest digital object into collection_pid !collection_label Step #1', array('collection_pid' => $collection_pid, '!collection_label' => $collection_label)), + 'models' => array( + '#type' => 'select', + '#title' => t('Content models available'), + '#options' => $potential_models, + '#default_value' => $selected_model, + '#description' => t('Content models define datastream composition, relationships between this and other content models, and the mandatory behaviors associated with each digital object.
Additional information may be found here.'), + ), + ), + 'collection_pid' => array( + '#type' => 'hidden', + '#value' => $collection_pid + ), + 'submit' => array( + '#type' => 'submit', + '#submit' => array('fedora_repository_ingest_form_submit'), + '#value' => t('Next') + ), + ); + } + + /** + * Create the second page of the ingest form for editing QDC + * + * @param string $collection_pid + * @param string $collection_label + * @param array $form_state + * + * @return array + */ + function createQDCIngestFormPageTwo($collection_pid, $collection_label, array &$form_state) { + module_load_include('inc', 'fedora_repository', 'ContentModel'); + $form = array(); + $content_model_pid = ContentModel::getPidFromIdentifier($form_state['values']['models']); + $content_model_dsid = ContentModel::getDSIDFromIdentifier($form_state['values']['models']); + if (($content_model = ContentModel::loadFromModel($content_model_pid, $content_model_dsid)) !== FALSE) { + $form = $content_model->buildIngestForm($form, $form_state); + if ($form === FALSE) { + drupal_set_message(t("Error Building Ingest Form."), 'error'); + foreach (ContentModel::$errors as $error) { + drupal_set_message($error, 'error'); + } + } + $form['collection_pid'] = array( + '#type' => 'hidden', + '#value' => $collection_pid + ); + $form['submit'] = array( + '#type' => 'submit', + '#submit' => array('fedora_repository_ingest_form_submit'), + '#value' => t('Ingest') + ); + } + return $form; + } + + /** + * Create the QDC Ingest Form. + * + * @param type $collection_pid + * @param type $collection_label + * @param array $form_state + * + * @return array + */ + function createQDCIngestForm($collection_pid, $collection_label, array &$form_state) { + module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); + $form_state['storage']['step'] = empty($form_state['storage']['step']) ? 1 : $form_state['storage']['step']; + if ($form_state['storage']['step'] == 1) { + return $this->createQDCIngestFormPageOne($collection_pid, $collection_label, $form_state); + } + else { + return $this->createQDCIngestFormPageTwo($collection_pid, $collection_label, $form_state); + } + } + + /** + * Create a multi step form (wizard) for ingesting objects into Fedora + * + * @param string $collection_pid + * @param string $collection_label + * @param array $form_state + * + * @return array + */ + function createIngestForm($collection_pid, $collection_label, array &$form_state) { + if (!$this->canShowIngestForm($collection_pid)) { + return FALSE; + } + + drupal_set_title($collection_label); + if (module_exists('islandora_content_model_forms')) { + module_load_include('inc', 'islandora_content_model_forms', 'IngestObjectMetadataForm'); + try { + $form = new IngestObjectMetadataForm(); + return $form->create($collection_pid, $collection_label, $form_state); + } catch (Exception $e) { + //dd('An error occured; reverting to QDC form...'); + $form_state['storage']['xml'] = FALSE; // An error occured revert back to the QDC Form. + } + } + return $this->createQDCIngestForm($collection_pid, $collection_label, $form_state); + } + + /** + * this function may not be being used + * @param type $pid + * @param type $form_state + * @return string + */ + function createAddDataStreamForm($pid, &$form_state) { + //dump_vars($form_state); + // Populate the list of datastream IDs. + + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'ContentModel'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + + $obj_helper = new ObjectHelper(); + $content_models = $obj_helper->get_content_models_list($pid); + $available_dsids = array(); + if (!empty($content_models)) { + foreach ($content_models as $content_model) { + + + $newElements = $content_model->listDatastreams(); + if (!empty($newElements)) { + $available_dsids = array_merge($available_dsids, $newElements); + } + } + } + + $item = new Fedora_Item($pid); + $used_datastreams = $item->get_datastreams_list_as_SimpleXML(); + $used_datastream_ids = array(); + foreach ($used_datastreams->datastreamDef as $used_datastream) { + array_push($used_datastream_ids, $used_datastream->ID); + } + $unused_dsids = array(); + + if ($form_state['submitted'] && $form_state['clicked_button']['#value'] != 'OK') { + $form['add_datastream_label'] = array( + '#value' => t('

The datastream has been uploaded.

'), + '#weight' => -10, + ); + $form['#redirect'] = "fedora/repository/$pid/"; + $form['submit'] = array( + '#type' => 'submit', + '#value' => t('OK') + ); + return $form; + } + if (!empty($available_dsids)) { + $unused_dsids = array_diff($available_dsids, $used_datastream_ids); + if (empty($unused_dsids)) { + return; + } + } + + $form['add_datastream_label'] = array( + '#value' => t('

Add Datastream:

'), + '#weight' => -10, + ); + + $form['pid'] = array( + '#type' => 'hidden', + '#value' => "$pid" + ); + + $form['stream_label'] = array( + '#title' => 'Datastream Label', + '#required' => 'TRUE', + '#description' => t('A Human readable label'), + '#type' => 'textfield' + ); + + $form['#attributes']['enctype'] = 'multipart/form-data'; + $form['add-stream-file-location'] = array( + '#type' => 'file', + '#title' => t('Upload Document'), + '#size' => 48, + // '#required'=>'TRUE', + '#description' => t('The file to upload.') + ); + $form['#redirect'] = "fedora/repository/$pid/"; + $form['submit'] = array( + '#type' => 'submit', + '#value' => t('Add Datastream') + ); + + if (!empty($unused_dsids)) { + $dsidsForForm = array(); + foreach ($unused_dsids as $dsid) { + $dsidsForForm[$dsid] = $dsid; + } + $form['stream_id'] = array( + '#type' => 'select', + '#title' => t('Datastream ID'), + '#default_value' => variable_get('feed_item_length', 'teaser'), + '#weight' => '-1', + '#description' => t('Datastream IDs defined by the content model.'), + ); + $form['stream_id']['#options'] = array_combine($unused_dsids, $unused_dsids); + } + else { + $form['stream_id'] = array( + '#title' => 'Datastream ID', + '#required' => 'TRUE', + '#description' => t('An ID for this stream that is unique to this object. Must start with a letter and contain only alphanumeric characters and dashes and underscores.'), + '#type' => 'textfield', + '#weight' => -1, + ); + } + return $form; + } + + /** + * Create QDC Edit form. + * + * @param string $pid + * @param string $dsid + * @param object $client + * @param array $form_state + * + * @return string + */ + function createQDCEditForm($pid, $dsid, $client, &$form_state) { + $dsid = empty($dsid) ? 'QDC' : $dsid; + try { + $params = array('pid' => "$pid", 'dsID' => "$dsid", 'asOfDateTime' => ""); + $object = $client->__soapCall('getDatastreamDissemination', array('parameters' => $params)); + } catch (Exception $e) { + return array(); + } + $content = $object->dissemination->stream; + $content = trim($content); + $doc = new DOMDocument(); + if (!$doc->loadXML($content)) { + echo "error loading xml"; + } + $oai_dc = $doc->getElementsByTagName('dc'); + $dcItems = $oai_dc->item(0)->getElementsByTagName('*'); + $form = array(); + for ($i = 0; $i < $dcItems->length; $i++) { + $name = $dcItems->item($i)->nodeName; + if ($name == 'dc:description') { + $form["$name" . '-' . "$i"] = array( + '#title' => $name, + '#type' => 'textarea', + '#default_value' => $dcItems->item($i)->nodeValue, + '#description' => 'Dublin Core ' . substr($dcItems->item($i)->nodeName, 3) + ); + } + elseif ($name == 'dc:title') { + $form["$name" . '-' . "$i"] = array( + '#title' => $name, + '#type' => 'textfield', + '#required' => 'TRUE', + '#default_value' => $dcItems->item($i)->nodeValue, + '#description' => 'Dublin Core ' . substr($dcItems->item($i)->nodeName, 3) + ); + } + else { + if ($oai_dc->item(0)->nodeName != $dcItems->item($i)->parentNode->nodeName) { + $description = strstr($name, ':'); + $form['app_' . "$name" . '-' . "$i"] = array( + '#title' => $name, + '#type' => 'textfield', + '#default_value' => $dcItems->item($i)->nodeValue, + '#description' => 'Dublin Core ' . substr($description, 1) + ); + } + else { + $field_type = 'textfield'; + $value = $dcItems->item($i)->nodeValue; + if ($name == 'dc:coverage') { + $value = ''; + } + if ($name == 'dc:rights') { + $field_type = 'textarea'; + } + $description = strstr($name, ':'); + $form["$name" . '-' . "$i"] = array( + '#title' => $name, + '#type' => $field_type, + '#default_value' => $value, + '#description' => 'Dublin Core ' . substr($description, 1) + ); + } + } + } + $form['pid'] = array( + '#type' => 'hidden', + '#value' => "$pid" + ); + $form['dsid'] = array( + '#type' => 'hidden', + '#value' => "$dsid" + ); + $form['submit'] = array( + '#type' => 'submit', + '#value' => t('Update Metadata'), + ); + return $form; + } + + /** + * Creates a drupal form to edit either the QDC or DC datastream + * @param type $pid + * @param type $dsid + * @param type $client + * @param boolean $form_state + * @return type + */ + function createMetaDataForm($pid, $dsid, $client, &$form_state) { + if (module_exists('islandora_content_model_forms')) { + module_load_include('inc', 'islandora_content_model_forms', 'EditObjectMetadataForm'); + try { + $form = new EditObjectMetadataForm($form_state); + return $form->create($pid, $client, $form_state); + } catch (Exception $e) { + $form_state['storage']['xml'] = FALSE; // An error occured revert back to the QDC Form. + } + } + return $this->createQDCEditForm($pid, $dsid, $client, $form_state); + } + + /** + * Creates a form for replacing datastream + * @param type $pid + * @param type $dsId + * @param type $dsLabel + * @param type $form_state + * @return type + */ + function createReplaceDataStreamForm($pid, $dsId, $dsLabel, &$form_state) { + $form = array(); + + $form['#attributes']['enctype'] = 'multipart/form-data'; + $form['file'] = array( + '#type' => 'file', + '#title' => t('Upload Document'), + '#description' => t('The file to upload.') + ); + + $form['pid'] = array( + '#type' => 'value', + '#value' => $pid, + ); + + $form['dsId'] = array( + '#type' => 'value', + '#value' => $dsId, + ); + + $form['dsLabel'] = array( + '#type' => 'value', + '#value' => $dsLabel, + ); + + $form['submit'] = array( + '#type' => 'submit', + '#value' => t('Replace Datastream') + ); + + return $form; + } + +} diff --git a/form_elements/css/copyright.css b/form_elements/css/copyright.css deleted file mode 100644 index cc663232..00000000 --- a/form_elements/css/copyright.css +++ /dev/null @@ -1,7 +0,0 @@ -.cc_preview -{ - width: 250px; - overflow: none; - border: 0px solid black; - float: right; -} \ No newline at end of file diff --git a/form_elements/css/filechooser.css b/form_elements/css/filechooser.css deleted file mode 100644 index f8b48594..00000000 --- a/form_elements/css/filechooser.css +++ /dev/null @@ -1,93 +0,0 @@ -.carousel .jCarouselLite { - border: 1px solid black; - float: left; - background-color: #dfdfdf; - - /* - position: relative; - visibility: hidden; - left: -5000px;*/ - - width: 680px; - height: 200px; - -} - -.carousel li -{ - cursor:pointer; -} - -.carousel li.selected -{ - background-color: #999; -} - -.carousel li div -{ - margin: 0 0 10px 10px; - font-size: 80%; -} - -.carousel li img.thumbnail -{ - width: 150px; - height: 118px; - margin: 10px 10px 0 10px; -} - -.carousel li div.textplaceholder -{ - width: 128px; - height: 128px; - margin: 10px 10px 0 10px; - background-image: url('../images/txt.png'); - background-repeat:no-repeat; -} - -.carousel li div.videoplaceholder -{ - width: 128px; - height: 128px; - margin: 10px 10px 0 10px; - background-image: url('../images/sound.png'); - background-repeat:no-repeat; -} - -.carousel li div.audioplaceholder -{ - width: 128px; - height: 128px; - margin: 10px 10px 0 10px; - background-image: url('../images/video.png'); - background-repeat:no-repeat; -} - -.carousel li div.imageplaceholder -{ - width: 128px; - height: 128px; - margin: 10px 10px 0 10px; - background-image: url('../images/image.png'); - background-repeat:no-repeat; -} - -.carousel li div.applicationplaceholder -{ - width: 128px; - height: 128px; - margin: 10px 10px 0 10px; - background-image: url('../images/application.png'); - background-repeat:no-repeat; -} - - -.carousel li.loading -{ - font-size: 150%; - margin: auto; - margin-top: 50px; - text-align: center; - - width: 250px; -} diff --git a/form_elements/css/list.css b/form_elements/css/list.css deleted file mode 100644 index 8e52d5ce..00000000 --- a/form_elements/css/list.css +++ /dev/null @@ -1,25 +0,0 @@ -.tagEditor -{ - margin: 4px 0; - padding: 0; -} - -.tagEditor li -{ - display: inline; - background-image: url('../images/minus_small.png'); - background-color: #efe; - background-position: right center; - background-repeat: no-repeat; - list-style-type: none; - padding: 0 18px 0 6px; - margin: 0 4px; - cursor: pointer; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; -} - -.tagEditor li:hover -{ - background-color: #eee; -} \ No newline at end of file diff --git a/form_elements/css/people.css b/form_elements/css/people.css deleted file mode 100644 index 06b54ad0..00000000 --- a/form_elements/css/people.css +++ /dev/null @@ -1,137 +0,0 @@ -/* $Id: ife-people-admin.css,v 1.1.2.7 2009/03/20 17:51:03 pasqualle Exp $ */ - -/* Admin form */ - -#ife-peoplelist-table -{ - margin-top: 15px; - width: 100%; -} - -#ife-peoplelist-table .form-item { - margin-bottom: 5px; -} -#ife-peoplelist-table .form-item .description { - margin-top: 3px; -} -#ife-peoplelist-table .ife-person-name { - width: auto; - height: 125px; -} - -#ife-peoplelist-table .ife-person-name label{ - font-weight: bold; - float: left; - clear: left; - width: 125px; -} - - -#ife-peoplelist-table .ife-person-role { - width: 150px; - padding-right: 50px; -} - -#ife-peoplelist-table .ife-person-remove { - width: 100px; -} - -#ife-peoplelist-table .description { - white-space: normal; -} - - -#ife-peoplelist-table .ife-person-content .form-item .form-text { - width: 150px; -} -#ife-peoplelist-table .ife-person-view-content input.form-submit { - display: none; -} -#ife-peoplelist-table .ife-person-content { - display: none; -} - -#ife-peoplelist-table .ife-person-remove label, -#add-more-people-button label, -#add-more-conf-button label, -#add-more-org-button label { - font-weight: bold; - float: left; - clear: left; - width: auto; -} - -#add-more-org-button, -#add-more-conf-button, -#add-more-people-button { - width: 150px; - display: block; - margin-top: 20px; - float: right; -} - - -.add-person, .add-conf, .add-org, -#ife-peoplelist-table .delete-person { - display: block; - overflow: hidden; - width: 32px; - height: 32px; - padding: 0; - margin: 0; - border: 0; - text-indent: -9999px; - cursor: pointer; /* hand-shaped cursor */ - cursor: hand; /* for IE 5.x */ -} - -.add-person { - background: transparent url(../images/add_user.png) no-repeat 0 0; -} -.delete-person { - background: transparent url(../images/editdelete.png) no-repeat 0 0; -} - -.add-org { - background: transparent url(../images/add_group.png) no-repeat 0 0; -} -.add-conf { - background: transparent url(../images/groupevent.png) no-repeat 0 0; -} - -/* QT style selection form */ - -div.ife-people-preview { - border: none; - width: 280px; - height: 80px; -} - -#ife-people-settings .ife-people-styles .form-item { - width: 280px; - float: left; - margin: 0 10px 10px 0; - border: 1px solid #ccc; - background-color: #fff; -} -#ife-people-settings .ife-people-styles .form-item .option { - display: block; - background-color: #bfe3ff; - font: bold 12px/18px verdana; - color: #0a5793; -} -#ife-people-settings .ife-people-styles .form-item .option:hover { - background-color: #aadaff; - cursor: pointer; - color: #003863; -} -#ife-people-settings .ife-people-styles .form-item .option .form-radio { - margin-right: 5px; - float: left; - height: 15px; - margin-top: 2px; -} -#ife-people-settings .ife-people_wrapper { - margin: 5px; - font: bold 12px/170% Verdana; -} diff --git a/form_elements/css/sticky.css b/form_elements/css/sticky.css deleted file mode 100644 index a58588c9..00000000 --- a/form_elements/css/sticky.css +++ /dev/null @@ -1,18 +0,0 @@ - -input.sticky { -height: 18px; -padding-left: 15px; -background: url(../images/pushpin.png) top left no-repeat; - filter:alpha(opacity=50); - -moz-opacity:0.5; - -khtml-opacity:0.5; - opacity:0.5; -} - -input.sticky:checked { - background-image: url(../images/pushpin.png); - filter:alpha(opacity=100); - -moz-opacity:1; - -khtml-opacity:1; - opacity:1; -} \ No newline at end of file diff --git a/form_elements/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png b/form_elements/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png deleted file mode 100644 index 954e22db..00000000 Binary files a/form_elements/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png and /dev/null differ diff --git a/form_elements/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png b/form_elements/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png deleted file mode 100644 index 64ece570..00000000 Binary files a/form_elements/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png and /dev/null differ diff --git a/form_elements/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png b/form_elements/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png deleted file mode 100644 index abdc0108..00000000 Binary files a/form_elements/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png and /dev/null differ diff --git a/form_elements/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png b/form_elements/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png deleted file mode 100644 index 9b383f4d..00000000 Binary files a/form_elements/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png and /dev/null differ diff --git a/form_elements/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png b/form_elements/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png deleted file mode 100644 index a23baad2..00000000 Binary files a/form_elements/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png and /dev/null differ diff --git a/form_elements/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png b/form_elements/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png deleted file mode 100644 index 42ccba26..00000000 Binary files a/form_elements/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png and /dev/null differ diff --git a/form_elements/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png b/form_elements/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png deleted file mode 100644 index 39d5824d..00000000 Binary files a/form_elements/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png and /dev/null differ diff --git a/form_elements/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png b/form_elements/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png deleted file mode 100644 index f1273672..00000000 Binary files a/form_elements/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png and /dev/null differ diff --git a/form_elements/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png b/form_elements/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png deleted file mode 100644 index 359397ac..00000000 Binary files a/form_elements/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png and /dev/null differ diff --git a/form_elements/css/ui-lightness/images/ui-icons_222222_256x240.png b/form_elements/css/ui-lightness/images/ui-icons_222222_256x240.png deleted file mode 100644 index b273ff11..00000000 Binary files a/form_elements/css/ui-lightness/images/ui-icons_222222_256x240.png and /dev/null differ diff --git a/form_elements/css/ui-lightness/images/ui-icons_228ef1_256x240.png b/form_elements/css/ui-lightness/images/ui-icons_228ef1_256x240.png deleted file mode 100644 index a641a371..00000000 Binary files a/form_elements/css/ui-lightness/images/ui-icons_228ef1_256x240.png and /dev/null differ diff --git a/form_elements/css/ui-lightness/images/ui-icons_ef8c08_256x240.png b/form_elements/css/ui-lightness/images/ui-icons_ef8c08_256x240.png deleted file mode 100644 index 85e63e9f..00000000 Binary files a/form_elements/css/ui-lightness/images/ui-icons_ef8c08_256x240.png and /dev/null differ diff --git a/form_elements/css/ui-lightness/images/ui-icons_ffd27a_256x240.png b/form_elements/css/ui-lightness/images/ui-icons_ffd27a_256x240.png deleted file mode 100644 index e117effa..00000000 Binary files a/form_elements/css/ui-lightness/images/ui-icons_ffd27a_256x240.png and /dev/null differ diff --git a/form_elements/css/ui-lightness/images/ui-icons_ffffff_256x240.png b/form_elements/css/ui-lightness/images/ui-icons_ffffff_256x240.png deleted file mode 100644 index 42f8f992..00000000 Binary files a/form_elements/css/ui-lightness/images/ui-icons_ffffff_256x240.png and /dev/null differ diff --git a/form_elements/css/ui-lightness/jquery-ui-1.8.4.custom.css b/form_elements/css/ui-lightness/jquery-ui-1.8.4.custom.css deleted file mode 100644 index 11ede670..00000000 --- a/form_elements/css/ui-lightness/jquery-ui-1.8.4.custom.css +++ /dev/null @@ -1,572 +0,0 @@ -/* - * jQuery UI CSS Framework @VERSION - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Theming/API - */ - -/* Layout helpers -----------------------------------*/ -.ui-helper-hidden { display: none; } -.ui-helper-hidden-accessible { position: absolute; left: -99999999px; } -.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } -.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } -.ui-helper-clearfix { display: inline-block; } -/* required comment for clearfix to work in Opera \*/ -* html .ui-helper-clearfix { height:1%; } -.ui-helper-clearfix { display:block; } -/* end clearfix */ -.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } - - -/* Interaction Cues -----------------------------------*/ -.ui-state-disabled { cursor: default !important; } - - -/* Icons -----------------------------------*/ - -/* states and images */ -.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } - - -/* Misc visuals -----------------------------------*/ - -/* Overlays */ -.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } - - -/* - * jQuery UI CSS Framework @VERSION - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Theming/API - * - * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px - */ - - -/* Component containers -----------------------------------*/ -.ui-widget { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1.1em; } -.ui-widget .ui-widget { font-size: 1em; } -.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1em; } -.ui-widget-content { border: 1px solid #dddddd; background: #eeeeee url(images/ui-bg_highlight-soft_100_eeeeee_1x100.png) 50% top repeat-x; color: #333333; } -.ui-widget-content a { color: #333333; } -.ui-widget-header { border: 1px solid #e78f08; background: #f6a828 url(images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; } -.ui-widget-header a { color: #ffffff; } - -/* Interaction states -----------------------------------*/ -.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #f6f6f6 url(images/ui-bg_glass_100_f6f6f6_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1c94c4; } -.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; } -.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #fbcb09; background: #fdf5ce url(images/ui-bg_glass_100_fdf5ce_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #c77405; } -.ui-state-hover a, .ui-state-hover a:hover { color: #c77405; text-decoration: none; } -.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #fbd850; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #eb8f00; } -.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #eb8f00; text-decoration: none; } -.ui-widget :active { outline: none; } - -/* Interaction Cues -----------------------------------*/ -.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fed22f; background: #ffe45c url(images/ui-bg_highlight-soft_75_ffe45c_1x100.png) 50% top repeat-x; color: #363636; } -.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; } -.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #b81900 url(images/ui-bg_diagonals-thick_18_b81900_40x40.png) 50% 50% repeat; color: #ffffff; } -.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; } -.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; } -.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } -.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } -.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } - -/* Icons -----------------------------------*/ - -/* states and images */ -.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); } -.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } -.ui-widget-header .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); } -.ui-state-default .ui-icon { background-image: url(images/ui-icons_ef8c08_256x240.png); } -.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); } -.ui-state-active .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); } -.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_228ef1_256x240.png); } -.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffd27a_256x240.png); } - -/* positioning */ -.ui-icon-carat-1-n { background-position: 0 0; } -.ui-icon-carat-1-ne { background-position: -16px 0; } -.ui-icon-carat-1-e { background-position: -32px 0; } -.ui-icon-carat-1-se { background-position: -48px 0; } -.ui-icon-carat-1-s { background-position: -64px 0; } -.ui-icon-carat-1-sw { background-position: -80px 0; } -.ui-icon-carat-1-w { background-position: -96px 0; } -.ui-icon-carat-1-nw { background-position: -112px 0; } -.ui-icon-carat-2-n-s { background-position: -128px 0; } -.ui-icon-carat-2-e-w { background-position: -144px 0; } -.ui-icon-triangle-1-n { background-position: 0 -16px; } -.ui-icon-triangle-1-ne { background-position: -16px -16px; } -.ui-icon-triangle-1-e { background-position: -32px -16px; } -.ui-icon-triangle-1-se { background-position: -48px -16px; } -.ui-icon-triangle-1-s { background-position: -64px -16px; } -.ui-icon-triangle-1-sw { background-position: -80px -16px; } -.ui-icon-triangle-1-w { background-position: -96px -16px; } -.ui-icon-triangle-1-nw { background-position: -112px -16px; } -.ui-icon-triangle-2-n-s { background-position: -128px -16px; } -.ui-icon-triangle-2-e-w { background-position: -144px -16px; } -.ui-icon-arrow-1-n { background-position: 0 -32px; } -.ui-icon-arrow-1-ne { background-position: -16px -32px; } -.ui-icon-arrow-1-e { background-position: -32px -32px; } -.ui-icon-arrow-1-se { background-position: -48px -32px; } -.ui-icon-arrow-1-s { background-position: -64px -32px; } -.ui-icon-arrow-1-sw { background-position: -80px -32px; } -.ui-icon-arrow-1-w { background-position: -96px -32px; } -.ui-icon-arrow-1-nw { background-position: -112px -32px; } -.ui-icon-arrow-2-n-s { background-position: -128px -32px; } -.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } -.ui-icon-arrow-2-e-w { background-position: -160px -32px; } -.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } -.ui-icon-arrowstop-1-n { background-position: -192px -32px; } -.ui-icon-arrowstop-1-e { background-position: -208px -32px; } -.ui-icon-arrowstop-1-s { background-position: -224px -32px; } -.ui-icon-arrowstop-1-w { background-position: -240px -32px; } -.ui-icon-arrowthick-1-n { background-position: 0 -48px; } -.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } -.ui-icon-arrowthick-1-e { background-position: -32px -48px; } -.ui-icon-arrowthick-1-se { background-position: -48px -48px; } -.ui-icon-arrowthick-1-s { background-position: -64px -48px; } -.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } -.ui-icon-arrowthick-1-w { background-position: -96px -48px; } -.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } -.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } -.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } -.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } -.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } -.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } -.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } -.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } -.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } -.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } -.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } -.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } -.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } -.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } -.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } -.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } -.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } -.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } -.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } -.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } -.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } -.ui-icon-arrow-4 { background-position: 0 -80px; } -.ui-icon-arrow-4-diag { background-position: -16px -80px; } -.ui-icon-extlink { background-position: -32px -80px; } -.ui-icon-newwin { background-position: -48px -80px; } -.ui-icon-refresh { background-position: -64px -80px; } -.ui-icon-shuffle { background-position: -80px -80px; } -.ui-icon-transfer-e-w { background-position: -96px -80px; } -.ui-icon-transferthick-e-w { background-position: -112px -80px; } -.ui-icon-folder-collapsed { background-position: 0 -96px; } -.ui-icon-folder-open { background-position: -16px -96px; } -.ui-icon-document { background-position: -32px -96px; } -.ui-icon-document-b { background-position: -48px -96px; } -.ui-icon-note { background-position: -64px -96px; } -.ui-icon-mail-closed { background-position: -80px -96px; } -.ui-icon-mail-open { background-position: -96px -96px; } -.ui-icon-suitcase { background-position: -112px -96px; } -.ui-icon-comment { background-position: -128px -96px; } -.ui-icon-person { background-position: -144px -96px; } -.ui-icon-print { background-position: -160px -96px; } -.ui-icon-trash { background-position: -176px -96px; } -.ui-icon-locked { background-position: -192px -96px; } -.ui-icon-unlocked { background-position: -208px -96px; } -.ui-icon-bookmark { background-position: -224px -96px; } -.ui-icon-tag { background-position: -240px -96px; } -.ui-icon-home { background-position: 0 -112px; } -.ui-icon-flag { background-position: -16px -112px; } -.ui-icon-calendar { background-position: -32px -112px; } -.ui-icon-cart { background-position: -48px -112px; } -.ui-icon-pencil { background-position: -64px -112px; } -.ui-icon-clock { background-position: -80px -112px; } -.ui-icon-disk { background-position: -96px -112px; } -.ui-icon-calculator { background-position: -112px -112px; } -.ui-icon-zoomin { background-position: -128px -112px; } -.ui-icon-zoomout { background-position: -144px -112px; } -.ui-icon-search { background-position: -160px -112px; } -.ui-icon-wrench { background-position: -176px -112px; } -.ui-icon-gear { background-position: -192px -112px; } -.ui-icon-heart { background-position: -208px -112px; } -.ui-icon-star { background-position: -224px -112px; } -.ui-icon-link { background-position: -240px -112px; } -.ui-icon-cancel { background-position: 0 -128px; } -.ui-icon-plus { background-position: -16px -128px; } -.ui-icon-plusthick { background-position: -32px -128px; } -.ui-icon-minus { background-position: -48px -128px; } -.ui-icon-minusthick { background-position: -64px -128px; } -.ui-icon-close { background-position: -80px -128px; } -.ui-icon-closethick { background-position: -96px -128px; } -.ui-icon-key { background-position: -112px -128px; } -.ui-icon-lightbulb { background-position: -128px -128px; } -.ui-icon-scissors { background-position: -144px -128px; } -.ui-icon-clipboard { background-position: -160px -128px; } -.ui-icon-copy { background-position: -176px -128px; } -.ui-icon-contact { background-position: -192px -128px; } -.ui-icon-image { background-position: -208px -128px; } -.ui-icon-video { background-position: -224px -128px; } -.ui-icon-script { background-position: -240px -128px; } -.ui-icon-alert { background-position: 0 -144px; } -.ui-icon-info { background-position: -16px -144px; } -.ui-icon-notice { background-position: -32px -144px; } -.ui-icon-help { background-position: -48px -144px; } -.ui-icon-check { background-position: -64px -144px; } -.ui-icon-bullet { background-position: -80px -144px; } -.ui-icon-radio-off { background-position: -96px -144px; } -.ui-icon-radio-on { background-position: -112px -144px; } -.ui-icon-pin-w { background-position: -128px -144px; } -.ui-icon-pin-s { background-position: -144px -144px; } -.ui-icon-play { background-position: 0 -160px; } -.ui-icon-pause { background-position: -16px -160px; } -.ui-icon-seek-next { background-position: -32px -160px; } -.ui-icon-seek-prev { background-position: -48px -160px; } -.ui-icon-seek-end { background-position: -64px -160px; } -.ui-icon-seek-start { background-position: -80px -160px; } -/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ -.ui-icon-seek-first { background-position: -80px -160px; } -.ui-icon-stop { background-position: -96px -160px; } -.ui-icon-eject { background-position: -112px -160px; } -.ui-icon-volume-off { background-position: -128px -160px; } -.ui-icon-volume-on { background-position: -144px -160px; } -.ui-icon-power { background-position: 0 -176px; } -.ui-icon-signal-diag { background-position: -16px -176px; } -.ui-icon-signal { background-position: -32px -176px; } -.ui-icon-battery-0 { background-position: -48px -176px; } -.ui-icon-battery-1 { background-position: -64px -176px; } -.ui-icon-battery-2 { background-position: -80px -176px; } -.ui-icon-battery-3 { background-position: -96px -176px; } -.ui-icon-circle-plus { background-position: 0 -192px; } -.ui-icon-circle-minus { background-position: -16px -192px; } -.ui-icon-circle-close { background-position: -32px -192px; } -.ui-icon-circle-triangle-e { background-position: -48px -192px; } -.ui-icon-circle-triangle-s { background-position: -64px -192px; } -.ui-icon-circle-triangle-w { background-position: -80px -192px; } -.ui-icon-circle-triangle-n { background-position: -96px -192px; } -.ui-icon-circle-arrow-e { background-position: -112px -192px; } -.ui-icon-circle-arrow-s { background-position: -128px -192px; } -.ui-icon-circle-arrow-w { background-position: -144px -192px; } -.ui-icon-circle-arrow-n { background-position: -160px -192px; } -.ui-icon-circle-zoomin { background-position: -176px -192px; } -.ui-icon-circle-zoomout { background-position: -192px -192px; } -.ui-icon-circle-check { background-position: -208px -192px; } -.ui-icon-circlesmall-plus { background-position: 0 -208px; } -.ui-icon-circlesmall-minus { background-position: -16px -208px; } -.ui-icon-circlesmall-close { background-position: -32px -208px; } -.ui-icon-squaresmall-plus { background-position: -48px -208px; } -.ui-icon-squaresmall-minus { background-position: -64px -208px; } -.ui-icon-squaresmall-close { background-position: -80px -208px; } -.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } -.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } -.ui-icon-grip-solid-vertical { background-position: -32px -224px; } -.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } -.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } -.ui-icon-grip-diagonal-se { background-position: -80px -224px; } - - -/* Misc visuals -----------------------------------*/ - -/* Corner radius */ -.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; } -.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } -.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } -.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } -.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } -.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } -.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } -.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } -.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } - -/* Overlays */ -.ui-widget-overlay { background: #666666 url(images/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat; opacity: .50;filter:Alpha(Opacity=50); } -.ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(images/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }/* - * jQuery UI Resizable @VERSION - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Resizable#theming - */ -.ui-resizable { position: relative;} -.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;} -.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } -.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } -.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } -.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } -.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } -.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } -.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } -.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } -.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* - * jQuery UI Selectable @VERSION - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Selectable#theming - */ -.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } -/* - * jQuery UI Accordion @VERSION - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Accordion#theming - */ -/* IE/Win - Fix animation bug - #4615 */ -.ui-accordion { width: 100%; } -.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; } -.ui-accordion .ui-accordion-li-fix { display: inline; } -.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; } -.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; } -.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; } -.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } -.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; } -.ui-accordion .ui-accordion-content-active { display: block; }/* - * jQuery UI Autocomplete @VERSION - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Autocomplete#theming - */ -.ui-autocomplete { position: absolute; cursor: default; } - -/* workarounds */ -* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ - -/* - * jQuery UI Menu @VERSION - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Menu#theming - */ -.ui-menu { - list-style:none; - padding: 2px; - margin: 0; - display:block; - float: left; -} -.ui-menu .ui-menu { - margin-top: -3px; -} -.ui-menu .ui-menu-item { - margin:0; - padding: 0; - zoom: 1; - float: left; - clear: left; - width: 100%; -} -.ui-menu .ui-menu-item a { - text-decoration:none; - display:block; - padding:.2em .4em; - line-height:1.5; - zoom:1; -} -.ui-menu .ui-menu-item a.ui-state-hover, -.ui-menu .ui-menu-item a.ui-state-active { - font-weight: normal; - margin: -1px; -} -/* - * jQuery UI Button @VERSION - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Button#theming - */ -.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */ -.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */ -button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */ -.ui-button-icons-only { width: 3.4em; } -button.ui-button-icons-only { width: 3.7em; } - -/*button text element */ -.ui-button .ui-button-text { display: block; line-height: 1.4; } -.ui-button-text-only .ui-button-text { padding: .4em 1em; } -.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } -.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; } -.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; } -.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; } -/* no icon support for input elements, provide padding by default */ -input.ui-button { padding: .4em 1em; } - -/*button icon element(s) */ -.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } -.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; } -.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; } -.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } -.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } - -/*button sets*/ -.ui-buttonset { margin-right: 7px; } -.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; } - -/* workarounds */ -button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ -/* - * jQuery UI Dialog @VERSION - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Dialog#theming - */ -.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; } -.ui-dialog .ui-dialog-titlebar { padding: .5em 1em .3em; position: relative; } -.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .2em 0; } -.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } -.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } -.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } -.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } -.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } -.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } -.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } -.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } -.ui-draggable .ui-dialog-titlebar { cursor: move; } -/* - * jQuery UI Slider @VERSION - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Slider#theming - */ -.ui-slider { position: relative; text-align: left; } -.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } -.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } - -.ui-slider-horizontal { height: .8em; } -.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } -.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } -.ui-slider-horizontal .ui-slider-range-min { left: 0; } -.ui-slider-horizontal .ui-slider-range-max { right: 0; } - -.ui-slider-vertical { width: .8em; height: 100px; } -.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } -.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } -.ui-slider-vertical .ui-slider-range-min { bottom: 0; } -.ui-slider-vertical .ui-slider-range-max { top: 0; }/* - * jQuery UI Tabs @VERSION - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Tabs#theming - */ -.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ -.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } -.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; } -.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } -.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; } -.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } -.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ -.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } -.ui-tabs .ui-tabs-hide { display: none !important; } -/* - * jQuery UI Datepicker @VERSION - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Datepicker#theming - */ -.ui-datepicker { width: 17em; padding: .2em .2em 0; } -.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } -.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } -.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } -.ui-datepicker .ui-datepicker-prev { left:2px; } -.ui-datepicker .ui-datepicker-next { right:2px; } -.ui-datepicker .ui-datepicker-prev-hover { left:1px; } -.ui-datepicker .ui-datepicker-next-hover { right:1px; } -.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } -.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } -.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; } -.ui-datepicker select.ui-datepicker-month-year {width: 100%;} -.ui-datepicker select.ui-datepicker-month, -.ui-datepicker select.ui-datepicker-year { width: 49%;} -.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; } -.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } -.ui-datepicker td { border: 0; padding: 1px; } -.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } -.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } -.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } -.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; } - -/* with multiple calendars */ -.ui-datepicker.ui-datepicker-multi { width:auto; } -.ui-datepicker-multi .ui-datepicker-group { float:left; } -.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; } -.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; } -.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; } -.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; } -.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } -.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } -.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } -.ui-datepicker-row-break { clear:both; width:100%; } - -/* RTL support */ -.ui-datepicker-rtl { direction: rtl; } -.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } -.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } -.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } -.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } -.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } -.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } -.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } -.ui-datepicker-rtl .ui-datepicker-group { float:right; } -.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } -.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } - -/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */ -.ui-datepicker-cover { - display: none; /*sorry for IE5*/ - display/**/: block; /*sorry for IE5*/ - position: absolute; /*must have*/ - z-index: -1; /*must have*/ - filter: mask(); /*must have*/ - top: -4px; /*must have*/ - left: -4px; /*must have*/ - width: 200px; /*must have*/ - height: 200px; /*must have*/ -}/* - * jQuery UI Progressbar @VERSION - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Progressbar#theming - */ -.ui-progressbar { height:2em; text-align: left; } -.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } \ No newline at end of file diff --git a/form_elements/images/add_group.png b/form_elements/images/add_group.png deleted file mode 100755 index a45447d7..00000000 Binary files a/form_elements/images/add_group.png and /dev/null differ diff --git a/form_elements/images/add_user.png b/form_elements/images/add_user.png deleted file mode 100755 index 5172ecda..00000000 Binary files a/form_elements/images/add_user.png and /dev/null differ diff --git a/form_elements/images/ajax-loader.gif b/form_elements/images/ajax-loader.gif deleted file mode 100644 index 6f846765..00000000 Binary files a/form_elements/images/ajax-loader.gif and /dev/null differ diff --git a/form_elements/images/application.png b/form_elements/images/application.png deleted file mode 100644 index f8d868d0..00000000 Binary files a/form_elements/images/application.png and /dev/null differ diff --git a/form_elements/images/date.png b/form_elements/images/date.png deleted file mode 100755 index 228bcbbd..00000000 Binary files a/form_elements/images/date.png and /dev/null differ diff --git a/form_elements/images/editdelete.png b/form_elements/images/editdelete.png deleted file mode 100755 index 33fef226..00000000 Binary files a/form_elements/images/editdelete.png and /dev/null differ diff --git a/form_elements/images/groupevent.png b/form_elements/images/groupevent.png deleted file mode 100755 index 481304a6..00000000 Binary files a/form_elements/images/groupevent.png and /dev/null differ diff --git a/form_elements/images/image.png b/form_elements/images/image.png deleted file mode 100644 index add1d30b..00000000 Binary files a/form_elements/images/image.png and /dev/null differ diff --git a/form_elements/images/lgpl-3.0.txt b/form_elements/images/lgpl-3.0.txt deleted file mode 100644 index da6e70b9..00000000 --- a/form_elements/images/lgpl-3.0.txt +++ /dev/null @@ -1,168 +0,0 @@ -Icons from the Crystal Project -http://www.everaldo.com/crystal - - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/form_elements/images/minus_small.png b/form_elements/images/minus_small.png deleted file mode 100644 index bdb868c5..00000000 Binary files a/form_elements/images/minus_small.png and /dev/null differ diff --git a/form_elements/images/pushpin.png b/form_elements/images/pushpin.png deleted file mode 100644 index 93c875c2..00000000 Binary files a/form_elements/images/pushpin.png and /dev/null differ diff --git a/form_elements/images/sound.png b/form_elements/images/sound.png deleted file mode 100644 index 0de3d1b1..00000000 Binary files a/form_elements/images/sound.png and /dev/null differ diff --git a/form_elements/images/txt.png b/form_elements/images/txt.png deleted file mode 100644 index 98f026c7..00000000 Binary files a/form_elements/images/txt.png and /dev/null differ diff --git a/form_elements/images/video.png b/form_elements/images/video.png deleted file mode 100644 index dbfd3f8f..00000000 Binary files a/form_elements/images/video.png and /dev/null differ diff --git a/form_elements/includes/autocomplete.inc b/form_elements/includes/autocomplete.inc deleted file mode 100644 index 90ead4cc..00000000 --- a/form_elements/includes/autocomplete.inc +++ /dev/null @@ -1,234 +0,0 @@ -escape($string); - $query = 'name_personal_t:'.$string.'* OR name_organization_t:'.$string.'* OR name_conference_t:'.$string.'*'; - - $additionalParams = array( - 'facet' => 'false', - 'qt' => $requestHandler, - ); - - try { - $results = $solr->search($query, 0, 10,$additionalParams); - }catch (Exception $e) { - drupal_set_message(t('error searching ').$e->getMessage()); - } - if(empty($results)){ - drupal_set_message(t('Error searching solr index. Is the solr search block configured properly?'),'error'); - return ' '; - } - - header('content-type: text/plain'); - $matches = array(); - - foreach($results->response->docs as $doc) { - - $item = new fedora_item($doc->id); - - $mods = $item->get_datastream_dissemination('MODS'); - if (trim($mods) != '') { - $modsDom = new DomDocument(); - $modsDom->loadXML($mods); - - $xpath = new DOMXPath($modsDom); - $xpath->registerNamespace("php", "http://php.net/xpath"); - $xpath->registerPHPFunctions(); -// echo $mods; - $nodeList = $xpath->evaluate('/mods:mods/mods:name'); - foreach ($nodeList as $node) { - - $type=$node->getAttribute('type'); - $title=null; - $name =null; - $given=null; - $family=null; - $date = null; - $nameParts = $node->getElementsByTagName('namePart'); - foreach ($nameParts as $part) { - switch ($part->getAttribute('type')) { - case 'given': $given = $part->nodeValue; break; - case 'family': $family = $part->nodeValue; break; - case 'termsOfAddress': $title= $part->nodeValue; break; - case 'date': $date = $part->nodeValue; break; - default: $name = $part->nodeValue; break; - } - } - - if ($name == null && isset($given) && isset($family)) { - $name = (isset($title)?$title.' ':'').$family.', '.$given; - } - - $role =null; - $roleTerm = $node->getElementsByTagName('roleTerm'); - if ($roleTerm->length > 0) { - $role=$roleTerm->item(0)->nodeValue; - } - - if (strpos(strtolower($name),$string)!==FALSE) { - $display = $name; - $matches[json_encode(array('type'=>trim($type),'name'=>trim($name),'role'=>trim($role),'date'=>trim($date)))]= $display.' - '.$role.' '.$date; - } - } - } - } - drupal_json($matches); exit(); - -} - -function ife_autocomplete_marcrelator($collection, $string='') { - $moduleRoot = drupal_get_path('module', 'islandora_form_elements'); - - if ($string == '') { - $string = $collection; - $collection = FALSE; - } - - $string=ucfirst(trim($string)); - - $dom = DOMDocument::load ( $moduleRoot .'/xml/relators.rdf' ); - $rootEl = $dom->getElementsByTagName('RDF'); - if ($rootEl->length > 0) { - $rootEl=$rootEl->item(0); - - $xpath = new DOMXPath($dom); - $xpath->registerNamespace ( 'skos' , $rootEl->getAttribute('xmlns:skos') ); - $xpath->registerNamespace ( 'rdf' , $rootEl->getAttribute('xmlns:rdf') ); - - - $result = $xpath->query('/rdf:RDF/rdf:Description[starts-with(skos:prefLabel, "'. $string .'")]'); - - $terms = array(); - foreach ($result as $term) { - $termVal =$term->getElementsByTagName('prefLabel')->item(0)->nodeValue; - $termVal = preg_replace('/\s+/', ' ', $termVal); - $terms[$term->getElementsByTagName('notation')->item(0)->nodeValue]= $termVal; - } - echo drupal_json($terms); - } - - -} - -function ife_autocomplete_gacs($collection, $string='') { - $moduleRoot = drupal_get_path('module', 'islandora_form_elements'); - - if ($string == '') { - $string = $collection; - $collection = FALSE; - } - - $string=ucwords(trim($string)); - - $dom = DOMDocument::load ( $moduleRoot .'/xml/gacs.xml' ); - $rootEl = $dom->getElementsByTagName('codelist'); - if ($rootEl->length > 0) { - $rootEl=$rootEl->item(0); - - $xpath = new DOMXPath($dom); - $xpath->registerNamespace ( 'a' , $rootEl->getAttribute('xmlns') ); - - $result = $xpath->query('/a:codelist/a:gacs/a:gac[starts-with(a:name, "'. $string .'")]'); - - $gacs = array(); - foreach ($result as $gac) { - $gacs[$gac->getElementsByTagName('name')->item(0)->nodeValue]= $gac->getElementsByTagName('name')->item(0)->nodeValue; - } - echo drupal_json($gacs); - } - - -} - -function ife_autocomplete_language($collection, $string='') { - $moduleRoot=drupal_get_path('module', 'islandora_form_elements'); - - if ($string == '') { - $string = $collection; - $collection = FALSE; - } - - $string=ucwords(trim($string)); - - $dom = DOMDocument::load ( $moduleRoot .'/xml/languages.xml' ); - $rootEl = $dom->getElementsByTagName('codelist'); - if ($rootEl->length > 0) { - $rootEl=$rootEl->item(0); - - $xpath = new DOMXPath($dom); - $xpath->registerNamespace ( 'a' , $rootEl->getAttribute('xmlns') ); - - $result = $xpath->query('/a:codelist/a:languages/a:language[starts-with(a:name, "'. $string .'")]'); - - $languages = array(); - foreach ($result as $lang) { - $languages[$lang->getElementsByTagName('name')->item(0)->nodeValue]= $lang->getElementsByTagName('name')->item(0)->nodeValue; - } - echo drupal_json($languages); - } - - -} - -function ife_autocomplete($field, $collection, $string='') { - - if ($string == '') { - $string=$collection; $collection=FALSE; - } - - module_load_include('php', 'islandora_solr_search', 'Solr/Service'); - $host = variable_get('islandora_solr_search_block_host', 'localhost'); - $port = variable_get('islandora_solr_search_block_port', '8080'); - $appName = variable_get('islandora_solr_search_block_app_name', 'solr'); - $solr = new Apache_Solr_Service($host, $port, '/'. $appName .'/'); - - $additionalParams = array( - 'fl' => $field - ); - - $query = $field .':'. $solr->escape(strtolower(trim($string))) .'*'; - - if ($collection != FALSE) { - $query .= ' AND related_item_identifier_t:'. $solr->escape($collection); - } - - try { - $results = $solr->search($query, 0, 10, $additionalParams); - } - catch (Exception $e) { - drupal_set_message(t('error searching ') . $e->getMessage()); - } - - $docs = $results->response->docs; - $values = array(); - if ($docs != NULL) { - foreach ($docs as $doc) { - $resfield=$doc->getField($field); - - if (is_array($resfield['value'])) { - foreach ($resfield['value'] as $val) { - if (preg_match('/^'.strtolower($string).'/i',$val)) { - $values[$val]=$val; - } - } - } else { - $values[$resfield['value']]=$resfield['value']; - } - } - } - - return drupal_json($values); -} diff --git a/form_elements/includes/creative_commons.inc b/form_elements/includes/creative_commons.inc deleted file mode 100644 index 7213cb74..00000000 --- a/form_elements/includes/creative_commons.inc +++ /dev/null @@ -1,117 +0,0 @@ - 'International', - 'ar' => 'Argentina', - 'au' => 'Australia', - 'at' => 'Austria', - 'be' => 'Belgium', - 'br' => 'Brazil', - 'bg' => 'Bulgaria', - 'ca' => 'Canada', - 'cl' => 'Chile', - 'cn' => 'ChinaMainland', - 'co' => 'Colombia', - 'hr' => 'Croatia', - 'cz' => 'CzechRepublic', - 'dk' => 'Denmark', - 'ec' => 'Ecuador', - 'fi' => 'Finland', - 'fr' => 'France', - 'de' => 'Germany', - 'gr' => 'Greece', - 'gt' => 'Guatemala', - 'hk' => 'HongKong', - 'hu' => 'Hungary', - 'in' => 'India', - 'il' => 'Israel', - 'it' => 'Italy', - 'jp' => 'Japan', - 'kr' => 'Korea', - 'lu' => 'Luxembourg', - 'mk' => 'Macedonia', - 'my' => 'Malaysia', - 'mt' => 'Malta', - 'mx' => 'Mexico', - 'nl' => 'Netherlands', - 'nz' => 'NewZealand', - 'no' => 'Norway', - 'pe' => 'Peru', - 'ph' => 'Philippines', - 'pl' => 'Poland', - 'pt' => 'Portugal', - 'pr' => 'PuertoRico', - 'ro' => 'Romania', - 'rs' => 'Serbia', - 'sg' => 'Singapore', - 'si' => 'Slovenia', - 'za' => 'SouthAfrica', - 'es' => 'Spain', - 'se' => 'Sweden', - 'ch' => 'Switzerland', - 'tw' => 'Taiwan', - 'th' => 'Thailand', - 'uk' => 'UK:England&Wales', - 'scotland' => 'UK:Scotland', - 'us' => 'UnitedStates', - 'vn' => 'Vietnam'); - - public static $cc_versions = array( - ''=>'3.0', - 'ar'=>'2.5', - 'au'=>'3.0', - 'at'=>'3.0', - 'be'=>'2.0', - 'br'=>'3.0', - 'bg'=>'2.5', - 'ca'=>'2.5', - 'cl'=>'2.0', - 'cn'=>'2.5', - 'co'=>'2.5', - 'hr'=>'3.0', - 'cz'=>'3.0', - 'dk'=>'2.5', - 'ec'=>'3.0', - 'fi'=>'1.0', - 'fr'=>'2.0', - 'de'=>'3.0', - 'gr'=>'3.0', - 'gt'=>'3.0', - 'hk'=>'3.0', - 'hu'=>'2.5', - 'in'=>'2.5', - 'il'=>'2.5', - 'it'=>'2.5', - 'jp'=>'2.0', - 'kr'=>'2.0', - 'lu'=>'3.0', - 'mk'=>'2.5', - 'my'=>'2.5', - 'mt'=>'2.5', - 'mx'=>'2.5', - 'nl'=>'3.0', - 'nz'=>'3.0', - 'no'=>'3.0', - 'pe'=>'2.5', - 'ph'=>'3.0', - 'pl'=>'3.0', - 'pt'=>'2.5', - 'pr'=>'3.0', - 'ro'=>'3.0', - 'rs'=>'3.0', - 'sg'=>'3.0', - 'si'=>'2.5', - 'za'=>'2.5', - 'es'=>'3.0', - 'se'=>'2.5', - 'ch'=>'2.5', - 'tw'=>'3.0', - 'th'=>'3.0', - 'uk'=>'2.0', - 'scotland'=>'2.5', - 'us'=>'3.0', - 'vn'=>'3.0'); - - } \ No newline at end of file diff --git a/form_elements/includes/filechooser.inc b/form_elements/includes/filechooser.inc deleted file mode 100644 index 6bd077fa..00000000 --- a/form_elements/includes/filechooser.inc +++ /dev/null @@ -1,138 +0,0 @@ - -
-
    -
  • Generating File Previews...
    (this could take a minute or two.)
    Loading
  • -
-
-
- - - '; - return theme('form_element', $element, $output); -} - - - -function ife_filechooser_get_thumbnail($cp_pid, $cm_pid, $file) { - module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); - module_load_include('inc', 'fedora_repository', 'ContentModel'); - module_load_include('inc', 'fedora_repository', 'MimeClass'); - - $mimeClass = new MimeClass(); - - $cm = ContentModel::loadFromModel($cm_pid); - $cp = CollectionPolicy::loadFromCollection($cp_pid); - $path=$cp->getStagingArea() .'/'; - - if ($cm !== FALSE && $cp !== FALSE) { - if (is_file($path . $file)) { - - $mime=$mimeClass->getType($path . $file); - - $allowed_types = $cm->getMimetypes(); - - if (in_array($mime, $allowed_types)) { - - $thumbnail = ''; - //executes ingest rules with the "preview" parameter set. - if ($cm->execIngestRules($path . $file, $mime, TRUE) && isset($_SESSION['fedora_ingest_files']['TN']) && file_exists($_SESSION['fedora_ingest_files']['TN'])) { - $thumbnail=$_SESSION['fedora_ingest_files']['TN']; - } - - $thumbmime=$mimeClass->getType($thumbnail); - - header('Pragma: no-cache'); - header('Content-Type: '. $thumbmime); - echo file_get_contents($thumbnail); - exit(); - } - } - - } - -} -function ife_filechooser_cmp($a,$b) -{ - return strcmp($a['name'],$b['name']); -} - -function ife_filechooser_generate_thumbnails($cp_pid, $cm_pid) { - module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); - module_load_include('inc', 'fedora_repository', 'ContentModel'); - module_load_include('inc', 'fedora_repository', 'MimeClass'); - - $cm = ContentModel::loadFromModel($cm_pid); - $cp = CollectionPolicy::loadFromCollection($cp_pid); - - if ($cm === FALSE || $cp === FALSE) { - echo '[]'; exit(); - } - - $mimeClass = new MimeClass(); - $path=$cp->getStagingArea() .'/'; - $start=isset($_GET['start'])?intval($_GET['start']):0; - $end=isset($_GET['end'])?intval($_GET['end']):50; - $thumbnails = array(); - $files = array(); - if ($cm !== FALSE && $cp !== FALSE) { - $allowed_types = $cm->getMimetypes(); - if (file_exists($path) && is_dir($path)) { - $dir = opendir($path); - for ($i=$start; $i < $end && ($file = readdir($dir)) !== FALSE;) { - if (is_file($path . $file)) { - $mime=$mimeClass->getType($path . $file); - if (in_array($mime, $allowed_types)) { - - $thumbnail = FALSE; - //executes ingest rules with the "preview" parameter set. - if ($cm->execIngestRules($path . $file, $mime, TRUE) && isset($_SESSION['fedora_ingest_files']['TN']) && file_exists($_SESSION['fedora_ingest_files']['TN'])) { - $thumbnail=$_SESSION['fedora_ingest_files']['TN']; - unset($_SESSION['fedora_ingest_files']['TN']); - } - - $res_array = getimagesize($path .'/'. $file); - $res = ''; - if (is_array($res_array)) { - $res = $res_array[0] .'x'. $res_array[1]; - } - - $size = filesize($path .'/'. $file); - $labels = array('kB', 'MB', 'GB', 'TB'); - $label = 'B'; - while ($size > 1024) { - $size=$size/1024; - $label=array_shift($labels); - } - $size = round($size, 2) .' '. $label; - - $files[] = array('name' => $file, 'mime' => $mime, 'size' => $size, 'resolution' => $res, 'thumb' => ($thumbnail != FALSE)); - $i++; - } - } - } - } - } - usort($files,'ife_filechooser_cmp'); - echo json_encode($files); - -} diff --git a/form_elements/includes/people.inc b/form_elements/includes/people.inc deleted file mode 100644 index 43cf52ad..00000000 --- a/form_elements/includes/people.inc +++ /dev/null @@ -1,288 +0,0 @@ - 0) { - foreach ($children as $key) { - $post = _dummy_post_info($form[$key], $post, $key); - } - } - if ($key!='' && isset($form['#required']) && $form['#required'] == TRUE && trim($post[$key]) == '') { - $post[$key] = 'not empty'; - } - - return $post; -} - -function _ife_find_people_element($form, &$keys = array()) { - if (isset($form['#type']) && $form['#type'] == 'people') { - return $form['people']; - } - - $children = element_children($form); - foreach ($children as $key) { - $found = _ife_find_people_element($form[$key], $keys); - if ($found !== FALSE) { - $keys[] = $key; - return $found; - } - } - - return FALSE; - -} - -function ife_people_ahah() { - - if (!isset($_POST['form_build_id'])) - return; - - $form_state = array('storage' => NULL, 'submitted' => FALSE); - $form_build_id = $_POST['form_build_id']; - $form = form_get_cache($form_build_id, $form_state); - - $args = $form['#parameters']; - $form_id = array_shift($args); - $form['#post'] = $_POST; - $form['#redirect'] = FALSE; - $form['#programmed'] = FALSE; - - $_POST = _dummy_post_info($form, $_POST); - $form_state['post'] = $_POST; - $form['#post'] = $_POST; - drupal_process_form($form_id, $form, $form_state); - - //ob_start(); echo '
'; echo $_POST['form_build_id']."\n"; var_dump($form_state);   echo '
'; $dump = ob_get_contents(); ob_end_clean(); - - $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id); - $qt_form = _ife_find_people_element($form); - - unset($qt_form['#prefix'], $qt_form['#suffix']); // Prevent duplicate wrappers. - $javascript = drupal_add_js(NULL, NULL, 'header'); - drupal_json(array( - 'status' => TRUE, - 'data' => $dump . theme('status_messages') . drupal_render($qt_form), - 'settings' => call_user_func_array('array_merge_recursive', $javascript['setting']), - )); -} - -/** - * Submit handler for the "Remove Person" button. - */ -function ife_remove_person_submit($form, &$form_state) { - - // Get the tab delta for the clicked button. - $delta = $form_state['clicked_button']['#parents'][2]; - - $keys=array(); - $qt_form = _ife_find_people_element($form, $keys); - - $peopleVals = &$form_state['values']; - while (count($keys) > 0) { - $key = array_pop($keys); - if (isset($peopleVals[$key])) { - $peopleVals = &$peopleVals[$key]; - } - } - - $people = array(); - $i = 0; - foreach ($peopleVals['people'] as $key => $val) { - if ($key != $delta) { - $people[] = $val; - } - $i++; - } - -// ob_start(); var_dump($form_state['clicked_button']['#parents'][1]); var_dump($people); $dump = ob_get_contents(); ob_end_clean(); -// watchdog('people_field','
'.$dump.'
',array(),WATCHDOG_NOTICE); - - unset($form_state['submit_handlers']); - form_execute_handlers('submit', $form, $form_state); - $form_state['storage']['people'] = $people; - $form_state['rebuild'] = TRUE; -} - - -/** - * Submit handler for the "Add Person" button. - */ -function ife_add_person_submit($form, &$form_state) { - $people = array(); - $keys = array(); - $qt_form = _ife_find_people_element($form, $keys); - $peopleVals = &$form_state['values']; - - while (count($keys) > 0) { - $key = array_pop($keys); - if (isset($peopleVals[$key])) { - $peopleVals = &$peopleVals[$key]; - } - } - if (!is_array($peopleVals['people'])) - $peopleVals['people'] = array(); - - foreach ($peopleVals['people'] as $val) { - $people[] = $val; - } - - //only add new person if we are not adding from repository. - $elName = isset($qt_form['entity0']['#parents'][0])?$qt_form['entity0']['#parents'][0]:null; - if ($elName == null || !isset($form_state['clicked_button']['#post'][$elName]['add_from_repository']) || trim($form_state['clicked_button']['#post'][$elName]['add_from_repository']) == '') { - $people[] = array('name' => '', 'date'=>'', 'role' => '', 'subject' => ''); - } - unset($form_state['submit_handlers']); - form_execute_handlers('submit', $form, $form_state); - $form_state['storage']['people'] = $people; - $form_state['rebuild'] = TRUE; -} - - - -/** - * Submit handler for the "Add Person" button. - */ -function ife_add_org_submit($form, &$form_state) { - $people = array(); - $keys = array(); - $qt_form = _ife_find_people_element($form, $keys); - $peopleVals = &$form_state['values']; - - while (count($keys) > 0) { - $key = array_pop($keys); - if (isset($peopleVals[$key])) { - $peopleVals = &$peopleVals[$key]; - } - } - - if (!is_array($peopleVals['people'])) - $peopleVals['people'] = array(); - - foreach ($peopleVals['people'] as $val) { - $people[]=$val; - } - $people[] = array('role' => '', 'organization' => ''); - - unset($form_state['submit_handlers']); - form_execute_handlers('submit', $form, $form_state); - $form_state['storage']['people'] = $people; - //$form_state['rebuild'] = TRUE; -} - - - -/** - * Submit handler for the "Add Person" button. - */ -function ife_add_conf_submit($form, &$form_state) { - $people = array(); - $keys=array(); - $qt_form = _ife_find_people_element($form, $keys); - $peopleVals = &$form_state['values']; - while (count($keys) > 0) { - $key = array_pop($keys); - if (isset($peopleVals[$key])) { - $peopleVals=&$peopleVals[$key]; - } - } - if (!is_array($peopleVals['people'])) - $peopleVals['people'] = array(); - - foreach ($peopleVals['people'] as $val) { - $people[] = $val; - } - - $people[] = array('role' => '', 'conference' => '', 'subject' => ''); - - unset($form_state['submit_handlers']); - form_execute_handlers('submit', $form, $form_state); - $form_state['storage']['people'] = $people; - //$form_state['rebuild'] = TRUE; -} - - - -function theme_people($element) { - drupal_add_js(drupal_get_path('module', 'islandora_form_elements') .'/js/people_ahah.js'); - if (!empty($element['#collapsible'])) { - drupal_add_js('misc/collapse.js'); - - if (!isset($element['#attributes']['class'])) { - $element['#attributes']['class'] = ''; - } - - $element['#attributes']['class'] .= ' collapsible'; - if (!empty($element['#collapsed'])) { - $element['#attributes']['class'] .= ' collapsed'; - } - } - return ''. ($element['#title'] ? ''. $element['#title'] .'' : '') . (isset($element['#description']) && $element['#description'] ? '
'. $element['#description'] .'
' : '') . (!empty($element['#children']) ? $element['#children'] : '') . "\n"; -} - - -function theme_people_items($form) { - $rows = array(); - $headers = array( - t('Entity Name'), - t('Role'), - t('Operations'), - ); - - foreach (element_children($form) as $key) { - if (isset($form[$key]['organization'])) { - $form[$key]['weight']['#attributes']['class'] = 'ife-people-weight'; - // Build the table row. - $row = array( - 'data' => array( - array('data' => drupal_render($form[$key]['organization']), 'class' => 'ife-person-name container-inline'), - array('data' => drupal_render($form[$key]['role']).drupal_render($form[$key]['subject']), 'class' => 'ife-person-role'), - array('data' => drupal_render($form[$key]['remove']), 'class' => 'ife-person-remove'), - ), - ); - } - elseif (isset($form[$key]['conference'])) { - $form[$key]['weight']['#attributes']['class'] = 'ife-people-weight'; - // Build the table row. - $row = array( - 'data' => array( - array('data' => drupal_render($form[$key]['conference']).'
'. drupal_render($form[$key]['date']), 'class' => 'ife-person-name container-inline' ), - array('data' => drupal_render($form[$key]['role']).drupal_render($form[$key]['subject']), 'class' => 'ife-person-role'), - array('data' => drupal_render($form[$key]['remove']), 'class' => 'ife-person-remove'), - ), - ); - } - else { - $form[$key]['weight']['#attributes']['class'] = 'ife-people-weight'; - // Build the table row. - $row = array( - 'data' => array( - array('data' => drupal_render($form[$key]['name']) .'
'. drupal_render($form[$key]['date']), 'class' => 'ife-person-name container-inline'), - array('data' => drupal_render($form[$key]['role']).drupal_render($form[$key]['subject']), 'class' => 'ife-person-role'), - array('data' => drupal_render($form[$key]['remove']), 'class' => 'ife-person-remove'), - ), - ); - } - - // Add additional attributes to the row, such as a class for this row. - if (isset($form[$key]['#attributes'])) { - $row = array_merge($row, $form[$key]['#attributes']); - } - $rows[] = $row; - } - - $output = theme('table', $headers, $rows, array('id' => 'ife-peoplelist-table')); - $output .= drupal_render($form); - - // Add our JS file, which has some Drupal core JS overrides, and ensures ahah behaviours get re-attached - drupal_add_css(drupal_get_path('module', 'islandora_form_elements') .'/css/people.css'); - return $output; -} - - diff --git a/form_elements/islandora_form_elements.info b/form_elements/islandora_form_elements.info deleted file mode 100644 index 70485b53..00000000 --- a/form_elements/islandora_form_elements.info +++ /dev/null @@ -1,7 +0,0 @@ -; $Id$ -name = Islandora Form Elements -dependencies[] = fedora_repository -description = Adds a set of form elements that extend/modify the drupal form elements available to the Ingest forms. -package = Fedora Repository -version = 6.1dev -core = 6.x diff --git a/form_elements/islandora_form_elements.module b/form_elements/islandora_form_elements.module deleted file mode 100644 index 094eff67..00000000 --- a/form_elements/islandora_form_elements.module +++ /dev/null @@ -1,1046 +0,0 @@ - TRUE, - '#process' => array('ife_fieldset_process'), - ); - - $type['textfield'] = array( - '#input' => TRUE, - '#sticky' => FALSE, - '#process' => array('ife_sticky_textfield_process'), - ); - - $type['textarea'] = array( - '#input'=> TRUE, - '#sticky ' => FALSE, - '#process' => array('ife_sticky_textarea_process'), - ); - - $type['select'] = array( - '#input'=> TRUE, - '#sticky ' => FALSE, - '#process' => array('ife_sticky_select_process'), - ); - - $type['list'] = array( - '#input'=>TRUE, - '#element_validate' => array('ife_list_validate'), - '#process' => array('ife_list_process'), - '#sticky' => FALSE, - ); - - $type['other_select'] = array( - '#input'=>TRUE, - '#process' => array('ife_other_select_process'), - ); - - - $type['copyright'] = array( - '#input' => TRUE, - '#process' => array('ife_copyright_process'), - '#element_validate' => array('ife_copyright_validate'), - ); - - - $type['filechooser'] = array( - '#input' => TRUE, - '#path' => '', - '#model' => '', - '#collection'=>'', - '#process' => array('ife_filechooser_process'), - '#element_validate' => array('ife_filechooser_validate'), - ); - - $type['person'] = array( - '#input' => TRUE, - '#process' => array('ife_person_process'), - '#default_value' => array('name'=>'', 'date'=>'', 'subject'=>'', 'role' => ''), - ); - - $type['organization'] = array( - '#input' => TRUE, - '#process' => array('ife_org_process'), - '#default_value' => array( 'organization' => '', 'date'=>'', 'subject'=>'', 'role' => ''), - ); - - $type['conference'] = array( - '#input' => TRUE, - '#process' => array('ife_conf_process'), - '#default_value' => array( 'conference' => '', 'date'=>'', 'subject'=>'', 'role' => ''), - ); - - $type['people'] = array( - '#input' => TRUE, - '#process' => array('ife_people_process'), - ); - - $type['datepicker'] = array( - '#input' => TRUE, - '#process' => array('ife_datepicker_process'), - ); - - return $type; -} - -function ife_fieldset_process($element,$edit,&$form_state) -{ -// echo 'fieldset process '. $element['#collapsible'].'
'; - - if (isset($element['#collapsed']) && ife_fieldset_children_has_value($element)) - { - unset($element['#collapsed']); - } - return $element; -} - -function ife_fieldset_children_has_value($el) -{ - $ret = false; - - - if ((isset($el['#default_value']) && !is_array($el['#default_value']) && trim($el['#default_value']) != '') || - (isset($el['#value']) && trim($el['#value']) != '')) - { - $ret = true; - } else - { - foreach (element_children($el) as $key) - { - - if (!$ret) - { - $ret = (isset($_POST[$key]) && (is_array($_POST[$key]) || trim($_POST[$key]) != '')) || ife_fieldset_children_has_value($el[$key]); - } - } - } - - return $ret; -} - - -function ife_people_process($element,$edit,&$form_state) -{ - - $element['#tree'] = TRUE; - $element['#prefix'] = '
'; - $element['#suffix'] = '
'; - - $element['people'] = array( - '#tree' => TRUE, - '#prefix' => '
', - '#suffix' => '
', - '#theme' => 'people_items', - ); - - if (isset($form_state['post'][$element['#name']]['add_from_repository']) && trim($form_state['post'][$element['#name']]['add_from_repository']) != '') { - - $people= array(); - if (isset($form_state['storage']['people']) && !empty($form_state['storage']['people'])) { - foreach ($form_state['storage']['people'] as $ent) { - if ( trim($ent['name']) != '' || trim($ent['organization']) != '' || trim($ent['conference']) != '' || trim($ent['role']) != '' || trim($ent['date']) != '') { - $people[]=$ent; - } - } - } - - - $json = json_decode($form_state['post'][$element['#name']]['add_from_repository']); - $form_state['post'][$element['#name']]['add_from_repository'] = ''; // clear so that if the form is processed multiple times, it does not add twice. - $person=array(); - - - switch ($json->type) - { - case 'personal': - $person['name']=$json->name; - $person['role']=$json->role; - $person['subject']=$json->subject; - $person['date']=$json->date; - break; - case 'organization': - $person['organization'] = $json->name; - $person['role'] = $json->role; - $person['subject']=$json->subject; - break; - case 'conference': - $person['conference'] = $json->name; - $person['role'] = $json->role; - $person['date'] = $json->date; - $person['subject']=$json->subject; - break; - } - - $people[]=$person; - - $form_state['storage']['people']=$people; - - } else if (!isset($form_state['storage']['people']) || empty($form_state['storage']['people'])) - { - if ( (!isset($form_state['clicked_button']) || count($form_state['clicked_button']) == 0) && isset($element['#default_value']) && is_array($element['#default_value']) ) { - $form_state['storage']['people']=$element['#default_value']; - if (count($element['#default_value']) > 0) { - $element['#collapsed'] = FALSE; - } - - } else { - $form_state['storage']['people']=array( array('name'=>'', 'role'=>'', 'date'=>'', 'subject' => '')); - } - } - - $i=0; - foreach ($form_state['storage']['people'] as $person) - { - - $person['delta'] = $i; - $type='person'; - if (isset($person['organization'])) - { - $type='organization'; - } else if (isset($person['conference'])) - { - $type='conference'; - } - - $element['people']['entity'.$i] = array('#type'=>$type, '#default_value'=>$person); - $i++; - } - - $element['add_from_repository'] = array( - '#type' => 'textfield', - '#autocomplete_path' => 'autocomplete_person/', - '#weight' => 4, - '#size' => 30, - '#value' => '', - '#title'=> t('Add entity from repository'), - '#description'=>t('To add an existing entity, simply start typing the name of the person, organization or conference and select the desired name from the resulting dropdown list.') - ); - - $element['add_person'] = array( - '#type' => 'submit', - '#prefix' => '
', - '#suffix' => '
', - '#value' => t('Add Person'), - '#attributes' => array('class' => 'add-person', 'title' => t('Click here to add a person.')), - '#weight' => 3, - '#submit' => array('ife_add_person_submit'), // If no javascript action. - '#ahah' => array( - 'path' => 'ife/people_ahah', - 'wrapper' => 'ife-people', - 'method' => 'replace', - 'effect' => 'fade', - ), - ); - -$element['add_organization'] = array( - '#type' => 'submit', - '#prefix' => '
', - '#suffix' => '
', - '#value' => t('Add Organization'), - '#attributes' => array('class' => 'add-org', 'title' => t('Click here to add an organization.')), - '#weight' => 2, - '#submit' => array('ife_add_org_submit'), // If no javascript action. - '#ahah' => array( - 'path' => 'ife/people_ahah', - 'wrapper' => 'ife-people', - 'method' => 'replace', - 'effect' => 'fade', - ), - ); - - $element['add_conference'] = array( - '#type' => 'submit', - '#prefix' => '
', - '#suffix' => '
', - '#value' => t('Add Conference'), - '#attributes' => array('class' => 'add-conf', 'title' => t('Click here to add a conference.')), - '#weight' => 1, - '#submit' => array('ife_add_conf_submit'), // If no javascript action. - '#ahah' => array( - 'path' => 'ife/people_ahah', - 'wrapper' => 'ife-people', - 'method' => 'replace', - 'effect' => 'fade', - ), - ); - return $element; -} - -function ife_person_process($element) -{ - $element['#tree'] = TRUE; - - if (!isset($element['#value'])) - { - $element['#value'] = array('name'=>''); - } - - - $element['name'] = array( - '#type' => 'textfield', - '#title'=> t('Name(s)'), - '#size' => 30, - '#value' => $element['#value']['name'], - '#description' => t('Please enter last name first, followed by a comma and first name.'), - ); - - - $element['date'] = array( - '#type' => 'datepicker', - '#title' => t('Date'), - '#size'=> 30, - '#value' => $element['#value']['date'], - '#description' => '
'.t('Use this field to express birth/death dates. You may use the date chooser, but the field is free-form') - ); - - $element['role'] = array( - '#type' => 'textfield', - '#size'=>30, - '#description'=>t('The role that this person plays with regards to the object.'), - '#value' => $element['#value']['role'], - '#autocomplete_path' => 'autocomplete_marcrelator/', - ); - - $element['subject'] = array( - '#type' => 'checkbox', - '#size'=>30, - '#description'=>t('If checked, this person will be listed as a subject term. If selected, role field does not apply.'), - '#title' => t('Subject'), - '#value' => $element['#value']['subject'], - ); - - - $element['remove'] = array( - '#type' => 'submit', - '#prefix' => '
', - '#suffix' => '
', - '#value' => 'remove_'. $element['#default_value']['delta'], - '#submit' => array('ife_remove_person_submit'), - '#attributes' => array('class' => 'delete-person', 'title' => t('Click here to delete this Person.')), - '#ahah' => array( - 'path' => 'ife/people_ahah', - 'wrapper' => 'ife-people', - 'method' => 'replace', - 'effect' => 'fade', - ), - ); - return $element; -} - - -function ife_org_process($element) -{ - $element['#tree'] = TRUE; - - if (!isset($element['#value'])) - { - $element['#value'] = array('name'=>''); - } - - - - $element['role'] = array( - '#type' => 'textfield', - '#size'=>30, - '#description'=>t('The role that this organization plays with regards to the object.'), - '#value' => $element['#value']['role'], - '#autocomplete_path' => 'autocomplete_marcrelator/', - ); - - $element['subject'] = array( - '#type' => 'checkbox', - '#size'=>30, - '#description'=>t('If checked, this organization will be listed as a subject term. If selected, role field does not apply.'), - '#title' => t('Subject'), - '#value' => $element['#value']['subject'], - ); - - $element['organization'] = array( - '#type' => 'textfield', - '#title' => t('Organization'), - '#size' => 30, - '#value' => $element['#value']['organization'], - ); - - - $element['remove'] = array( - '#type' => 'submit', - '#prefix' => '
', - '#suffix' => '
', - '#value' => 'remove_'. $element['#default_value']['delta'], - '#submit' => array('ife_remove_person_submit'), - '#attributes' => array('class' => 'delete-person', 'title' => t('Click here to delete this Person.')), - '#ahah' => array( - 'path' => 'ife/people_ahah', - 'wrapper' => 'ife-people', - 'method' => 'replace', - 'effect' => 'fade', - ), - ); - return $element; -} - - -function ife_conf_process($element) -{ - $element['#tree'] = TRUE; - - if (!isset($element['#value'])) - { - $element['#value'] = array('name'=>''); - } - - - $element['role'] = array( - '#type' => 'textfield', - '#size'=>30, - '#description'=>t('The role that this conference plays with regards to the object.'), - '#value' => $element['#value']['role'], - '#autocomplete_path' => 'autocomplete_marcrelator/', - ); - - $element['subject'] = array( - '#type' => 'checkbox', - '#size'=>30, - '#description'=>t('If checked, this conference will be listed as a subject term. If selected, role field does not apply.'), - '#title' => t('Subject'), - '#value' => $element['#value']['subject'], - ); - - $element['conference'] = array( - '#type' => 'textfield', - '#title' => t('Conference'), - '#size' => 30, - '#value' => $element['#value']['conference'], - ); - - - $element['date'] = array( - '#type' => 'datepicker', - '#title' => t('Date'), - '#size'=> 30, - '#value' => $element['#value']['date'] - ); - - $element['remove'] = array( - '#type' => 'submit', - '#prefix' => '
', - '#suffix' => '
', - '#value' => 'remove_'. $element['#default_value']['delta'], - '#submit' => array('ife_remove_person_submit'), - '#attributes' => array('class' => 'delete-person', 'title' => t('Click here to delete this Person.')), - '#ahah' => array( - 'path' => 'ife/people_ahah', - 'wrapper' => 'ife-people', - 'method' => 'replace', - 'effect' => 'fade', - ), - ); - return $element; -} - -/** - * Our process callback to expand the control. - */ -function ife_sticky_textfield_process($element,$edit,&$form_state) -{ - - - if (isset($element['#sticky']) && $element['#sticky'] == TRUE) - { - $element['#type'] = 'sticky_textfield'; - $stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky'; - - if (isset($element['#post'][$stickyName]) && strtolower($element['#post'][$stickyName]) == 'on') - { - $form_state['storage'][$element['#name']]=$element['#value']; - } elseif (isset($form_state['storage'][$element['#name']])) - { - $element['#value'] = $form_state['storage'][$element['#name']]; - $element['#sticky_on'] = TRUE; - } - } - - return $element; -} - -/** - * Our process callback to expand the control. - */ -function ife_datepicker_process($element,$edit,&$form_state) -{ - - - if (isset($element['#sticky']) && $element['#sticky'] == TRUE) - { - $stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky'; - - if (isset($element['#post'][$stickyName]) && strtolower($element['#post'][$stickyName]) == 'on') - { - $form_state['storage'][$element['#name']]=$element['#value']; - } elseif (isset($form_state['storage'][$element['#name']])) - { - $element['#value'] = $form_state['storage'][$element['#name']]; - $element['#sticky_on'] = TRUE; - } - } - - return $element; -} - - - -/** - * Our process callback to expand the control. - */ -function ife_sticky_textarea_process($element,$edit,&$form_state) -{ - - - if (isset($element['#sticky']) && $element['#sticky'] == TRUE) - { - $element['#type'] = 'sticky_textarea'; - $stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky'; - - if (isset($element['#post'][$stickyName]) && strtolower($element['#post'][$stickyName]) == 'on') - { - $form_state['storage'][$element['#name']]=$element['#value']; - } elseif (isset($form_state['storage'][$element['#name']])) - { - $element['#value'] = $form_state['storage'][$element['#name']]; - $element['#sticky_on'] = TRUE; - } - } - - return $element; -} - - -/** - * Our process callback to expand the control. - */ -function ife_sticky_select_process($element,$edit,&$form_state) -{ - - - if (isset($element['#sticky']) && $element['#sticky'] == TRUE) - { - $element['#type'] = 'sticky_select'; - $stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky'; - - if (isset($element['#post'][$stickyName]) && strtolower($element['#post'][$stickyName]) == 'on') - { - $form_state['storage'][$element['#name']]=$element['#value']; - } elseif (isset($form_state['storage'][$element['#name']])) - { - $element['#value'] = $form_state['storage'][$element['#name']]; - $element['#sticky_on'] = TRUE; - } - } - - return $element; -} - -/** - * Our process callback to expand the control. - */ -function ife_copyright_process($element,$edit,&$form_state) { - - module_load_include('inc','islandora_form_elements','includes/creative_commons'); - - if (isset($element['#sticky']) && $element['#sticky'] == TRUE) - { - $stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky'; - - if (isset($element['#post'][$stickyName]) && strtolower($element['#post'][$stickyName]) == 'on') - { - $form_state['storage'][$element['#name']]=$element['#value']; - } elseif (isset($form_state['storage'][$element['#name']])) - { - $element['#value'] = $form_state['storage'][$element['#name']]; - $element['#sticky_on'] = TRUE; - } - } - - if ($element['#sticky']) { - $path=drupal_get_path('module','islandora_form_elements'); - drupal_add_css($path.'/css/sticky.css'); - $stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky'; - $sticky = (isset($element['#sticky']) && $element['#sticky'] == TRUE?'
':''); - } - - $element['#tree'] = TRUE; - - if (isset($element['#value']) && !is_array($element['#value'])) { - $matches=array(); - if (preg_match('/by-*([a-z]+)-*([a-z]+)\/([\d\.]+)\/([a-z]*)/',$element['#value'],$matches)) { - $element['#value'] = array('cc_commercial' => $matches[1], 'cc_modifications' => $matches[2], 'cc_jurisdiction' => $matches[4]); - } else - $element['#value'] = array('cc_commercial' => '', 'cc_modifications' => '', 'cc_jurisdiction' => ''); - } else if (!isset($element['#value'])) { - $element['#value'] = array('cc_commercial' => '', 'cc_modifications' => '', 'cc_jurisdiction' => ''); - } - - $element['cc'] = array('#type' => 'fieldset', '#title'=>$element['#title'], '#description' => $sticky.'
preview
' , '#collapsible' => TRUE); - - $element['cc']['cc_enable'] = array( - '#type' => 'checkbox', - '#title' => t('Use a CreativeCommons.org Licence'), - '#attributes' => array('class' => 'cc_enable'), - '#default_value' => TRUE, - ); - - $element['cc']['cc_commercial'] = array( - '#type' => 'select', - '#title' => t('Allow commercial uses of your work?'), - '#options' => array( ''=>'Yes', 'nc'=>'No'), - '#attributes' => array('class' => 'cc_field cc_commercial'), - '#default_value' => $element['#value']['cc_commercial'], - ); - $element['cc']['cc_modifications'] = array( - '#type' => 'select', - '#title' => t('Allow modifications of your work?'), - '#options' => array( ''=>'Yes', 'sa'=>'Yes, as long as others share alike', 'nd'=>'No'), - '#attributes' => array('class' => 'cc_field cc_modifications'), - '#default_value' => $element['#value']['cc_modifications'], - ); - - $element['cc']['cc_jurisdiction'] = array( - '#type' => 'select', - '#title' => t('Jurisdiction of your license'), - '#options' => CreativeCommons::$cc_jurisdiction_vals, - '#default_value' => $element['#value']['cc_jurisdiction'], - '#attributes' => array('class' => 'cc_field cc_jurisdiction'), - ); - - $element['#title'] = ''; - - return $element; - -} - - -/** - * Our process callback to expand the control. - */ -function ife_list_process($element,$edit,&$form_state) -{ - if (is_array($element['#default_value'])) { - $element['#default_value']=join('; ',$element['#default_value']); - } - - if (is_array($element['#value'])) { - $element['#value']=join('; ',$element['#value']); - } - - if (isset($element['#sticky']) && $element['#sticky'] == TRUE) - { - $stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky'; - - if (isset($element['#post'][$stickyName]) && strtolower($element['#post'][$stickyName]) == 'on') - { - $form_state['storage'][$element['#name']]=$element['#value']; - } elseif (isset($form_state['storage'][$element['#name']])) - { - $element['#value'] = $form_state['storage'][$element['#name']]; - $element['#sticky_on'] = TRUE; - } - } - - return $element; -} - -/** - * Implementation of hook_theme(). - * - * This lets us tell Drupal about our theme functions and their arguments. - */ -function islandora_form_elements_theme() { - return array( - 'sticky_textfield' => array( - 'arguments' => array('element'), - ), - - 'sticky_textarea' => array( - 'arguments' => array('element'), - ), - - 'sticky_select' => array( - 'arguments' => array('element'), - ), - - 'filechooser' => array( - 'arguments' => array('element'), - 'file' => 'includes/filechooser.inc' - ), - 'list' => array( - 'arguments' => array('element'), - ), - 'other_select' => array( - 'arguments' => array('element'), - ), - - 'people' => array( - 'arguments' => array('element'), - 'file'=> 'includes/people.inc', - ), - 'people_items' => array( - 'arguments' => array('form' => NULL), - 'file'=> 'includes/people.inc', - ), - 'datepicker' => array( - 'arguments' => array('element'), - ), - 'copyright' => array( - 'arguments' => array('element'), - ), - ); -} - - -function ife_other_select_process($element,$edit,&$form_state) -{ - if (isset($element['#value']) && trim($element['#value']) != '' && !isset($element['#options'][$element['#value']])) - { - $element['#options'][$element['#value']]=$element['#value']; - } - return $element; -} - -function theme_copyright($element) -{ - $path=drupal_get_path('module','islandora_form_elements'); - drupal_add_js($path.'/js/copyright.js'); - drupal_add_css($path.'/css/copyright.css'); - - return theme('form_element', $element, $element['#children']); -} - -function theme_other_select($element) -{ - $path=drupal_get_path('module','islandora_form_elements'); - drupal_add_js($path.'/js/otherselect.js'); - $select = ''; - $size = $element['#size'] ? ' size="'. $element['#size'] .'"' : ''; - _form_set_class($element, array('otherSelect')); - return theme('form_element', $element, ''); -} - -function theme_list($element) -{ - $path=drupal_get_path('module','islandora_form_elements'); - drupal_add_js($path.'/js/jquery.tag.editor-min.js'); - drupal_add_js('$(document).ready(function () { $(\'#'.$element['#id'].'\').tagEditor({ separator: \';\', confirmRemoval: false, completeOnBlur: true }); }); ', 'inline'); - drupal_add_css($path.'/css/list.css'); - $output .= ''; - - //return theme('theme_form_element', $element, '
' . $element['#children'] . '
'); - - $size = empty($element['#size']) ? 'size="25"' : ' size="'. $element['#size'] .'"'; - $maxlength = empty($element['#maxlength']) ? '' : ' maxlength="'. $element['#maxlength'] .'"'; - $class = array('form-text','listElement'); - $extra = ''; - $output='
'; - - if ($element['#autocomplete_path'] && menu_valid_path(array('link_path' => $element['#autocomplete_path']))) { - drupal_add_js('misc/autocomplete.js'); - $class[] = 'form-autocomplete'; - $extra = ''; - } - _form_set_class($element, $class); - - if (isset($element['#field_prefix'])) { - $output .= ''. $element['#field_prefix'] .' '; - } - - $output .= ''; - - if (isset($element['#field_suffix'])) { - $output .= ' '. $element['#field_suffix'] .''; - } - - $path=drupal_get_path('module','islandora_form_elements'); - drupal_add_css($path.'/css/sticky.css'); - $stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky'; - $sticky = (isset($element['#sticky']) && $element['#sticky'] == TRUE?'
':''); - - - return theme('form_element', $element, $output . $sticky ) . $extra; - - -} - - -/** - * Format a sticky textarea. - * - * @param $element - * An associative array containing the properties of the element. - * Properties used: title, value, description, rows, cols, required, attributes - * @return - * A themed HTML string representing the textarea. - * - * @ingroup themeable - */ -function theme_sticky_textarea($element) { - $class = array('form-textarea'); - - - // Add teaser behavior (must come before resizable) - if (!empty($element['#teaser'])) { - drupal_add_js('misc/teaser.js'); - // Note: arrays are merged in drupal_get_js(). - drupal_add_js(array('teaserCheckbox' => array($element['#id'] => $element['#teaser_checkbox'])), 'setting'); - drupal_add_js(array('teaser' => array($element['#id'] => $element['#teaser'])), 'setting'); - $class[] = 'teaser'; - } - - // Add resizable behavior - if ($element['#resizable'] !== FALSE) { - drupal_add_js('misc/textarea.js'); - $class[] = 'resizable'; - } - - $path=drupal_get_path('module','islandora_form_elements'); - drupal_add_css($path.'/css/sticky.css'); - $stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky'; - $sticky = (isset($element['#sticky']) && $element['#sticky'] == TRUE?'
':''); - - - _form_set_class($element, $class); - return theme('form_element', $element, ''.$sticky); -} - - - -/** - * Format a sticky select. - * - * @param $element - * An associative array containing the properties of the element. - * Properties used: title, value, description, rows, cols, required, attributes - * @return - * A themed HTML string representing the textarea. - * - * @ingroup themeable - */ -function theme_sticky_select($element) { - $path=drupal_get_path('module','islandora_form_elements'); - drupal_add_css($path.'/css/sticky.css'); - $stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky'; - $sticky = (isset($element['#sticky']) && $element['#sticky'] == TRUE?'
':''); - - - $select = ''; - $size = $element['#size'] ? ' size="'. $element['#size'] .'"' : ''; - _form_set_class($element, array('form-select')); - $multiple = $element['#multiple']; - return theme('form_element', $element, ''.$sticky); -} - - -/** - * Theme function to format the output. - * - * We use the container-inline class so that all three of the HTML elements - * are placed next to each other, rather than on separate lines. - */ -function theme_datepicker($element) { - global $base_url; - $path=drupal_get_path('module','islandora_form_elements'); - drupal_add_js($path.'/js/jquery.ui.core.js'); - drupal_add_js($path.'/js/jquery.ui.widget.js'); - drupal_add_js($path.'/js/jquery.ui.datepicker.js'); - drupal_add_css($path.'/css/ui-lightness/jquery-ui-1.8.4.custom.css'); - $js = '$(document).ready(function () { $(\'#'.$element['#id'].'\').datepicker({ buttonImage: \''.$base_url.'/'.$path.'/images/date.png\', constrainInput: false, showOn: \'button\', changeMonth: true, changeYear: true }); });'; - - $size = empty($element['#size']) ? '' : ' size="'. $element['#size'] .'"'; - $maxlength = empty($element['#maxlength']) ? '' : ' maxlength="'. $element['#maxlength'] .'"'; - $class = array('form-text','datepicker'); - $extra = ''; - $output= ''; - $output.='
'; - - if ($element['#autocomplete_path'] && menu_valid_path(array('link_path' => $element['#autocomplete_path']))) { - drupal_add_js('misc/autocomplete.js'); - $class[] = 'form-autocomplete'; - $extra = ''; - } - _form_set_class($element, $class); - - if (isset($element['#field_prefix'])) { - $output .= ''. $element['#field_prefix'] .' '; - } - - $output .= ''; - - if (isset($element['#field_suffix'])) { - $output .= ' '. $element['#field_suffix'] .''; - } - - $path=drupal_get_path('module','islandora_form_elements'); - drupal_add_css($path.'/css/sticky.css'); - $stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky'; - $sticky = (isset($element['#sticky']) && $element['#sticky'] == TRUE?'
':''); - - - - return theme('form_element', $element, $output.$sticky ) . $extra; - -} - - - -/** - * Theme function to format the output. - * - * We use the container-inline class so that all three of the HTML elements - * are placed next to each other, rather than on separate lines. - */ -function theme_sticky_textfield($element) { - - //echo '
'; var_dump($element); echo '
'; - - //return theme('theme_form_element', $element, '
' . $element['#children'] . '
'); - $size = empty($element['#size']) ? '' : ' size="'. $element['#size'] .'"'; - $maxlength = empty($element['#maxlength']) ? '' : ' maxlength="'. $element['#maxlength'] .'"'; - $class = array('form-text'); - $extra = ''; - $output='
'; - - if ($element['#autocomplete_path'] && menu_valid_path(array('link_path' => $element['#autocomplete_path']))) { - drupal_add_js('misc/autocomplete.js'); - $class[] = 'form-autocomplete'; - $extra = ''; - } - _form_set_class($element, $class); - - if (isset($element['#field_prefix'])) { - $output .= ''. $element['#field_prefix'] .' '; - } - - $output .= ''; - - if (isset($element['#field_suffix'])) { - $output .= ' '. $element['#field_suffix'] .''; - } - - $path=drupal_get_path('module','islandora_form_elements'); - drupal_add_css($path.'/css/sticky.css'); - $stickyName = preg_replace('/\]/','',array_pop(preg_split('/\[/',$element['#name']))).'-sticky'; - $sticky = (isset($element['#sticky']) && $element['#sticky'] == TRUE?'
':''); - - - - return theme('form_element', $element, $output . $sticky) . $extra; - -} - -function ife_filechooser_validate($element,&$form_state) -{ - module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); - $cp = CollectionPolicy::loadFromCollection($form_state['storage']['collection_pid']); - if ($cp !== false) - { - $form_state['values'][$element['#name']] =$cp->getStagingArea().'/'.$element['#value']; - } -} - -function ife_filechooser_process($element, $edit, &$form_state) -{ - $element['#model_pid']=$form_state['values']['models']; - - return $element; -} - -function islandora_form_elements_menu() -{ - - module_load_include('inc','fedora_repository','ObjectHelper'); - - $items=array(); - - $items['ife/people_ahah'] = array( - 'page callback' => 'ife_people_ahah', - 'type' => MENU_CALLBACK, - 'access arguments' => array(ObjectHelper::$INGEST_FEDORA_OBJECTS), - 'file' => 'includes/people.inc', - ); - - $items['autocomplete_marcrelator/%'] = array( - 'title' => 'autocomplete', - 'page callback' => 'ife_autocomplete_marcrelator', - 'page arguments'=> array(1), - 'type' => MENU_CALLBACK, - 'access arguments' => array(ObjectHelper::$INGEST_FEDORA_OBJECTS), - 'file'=> 'includes/autocomplete.inc' - ); - - $items['autocomplete_gacs/%'] = array( - 'title' => 'autocomplete', - 'page callback' => 'ife_autocomplete_gacs', - 'page arguments'=> array(1), - 'type' => MENU_CALLBACK, - 'access arguments' => array(ObjectHelper::$INGEST_FEDORA_OBJECTS), - 'file'=> 'includes/autocomplete.inc' - ); - - $items['autocomplete_language/%'] = array( - 'title' => 'autocomplete', - 'page callback' => 'ife_autocomplete_language', - 'page arguments'=> array(1), - 'type' => MENU_CALLBACK, - 'access arguments' => array(ObjectHelper::$INGEST_FEDORA_OBJECTS), - 'file'=> 'includes/autocomplete.inc' - ); - - $items['autocomplete_person/%'] = array( - 'title' => 'autocomplete', - 'page callback' => 'ife_autocomplete_person', - 'page arguments'=> array(1), - 'type' => MENU_CALLBACK, - 'access arguments' => array(ObjectHelper::$INGEST_FEDORA_OBJECTS), - 'file'=> 'includes/autocomplete.inc' - ); - - $items['autocomplete/%/%'] = array( - 'title' => 'autocomplete', - 'page callback' => 'ife_autocomplete', - 'page arguments'=> array(1,2), - 'type' => MENU_CALLBACK, - 'access arguments' => array(ObjectHelper::$INGEST_FEDORA_OBJECTS), - 'file'=> 'includes/autocomplete.inc', - ); - - - $items['filechooser/getThumbnail/%/%/%'] = array( - 'title' => 'getThumbnail', - 'page callback' => 'ife_filechooser_get_thumbnail', - 'page arguments'=> array(2,3,4), - 'type' => MENU_CALLBACK, - 'access arguments' => array(ObjectHelper::$INGEST_FEDORA_OBJECTS), - 'file' => 'includes/filechooser.inc' - ); - - $items['filechooser/generatePreview/%/%'] = array( - 'title' => 'generatePreview', - 'page callback' => 'ife_filechooser_generate_thumbnails', - 'page arguments'=> array(2,3), - 'type' => MENU_CALLBACK, - 'access arguments' => array(ObjectHelper::$INGEST_FEDORA_OBJECTS), - 'file' => 'includes/filechooser.inc' - ); - - - - return $items; -} - diff --git a/form_elements/js/copyright.js b/form_elements/js/copyright.js deleted file mode 100644 index 6c9ed082..00000000 --- a/form_elements/js/copyright.js +++ /dev/null @@ -1,48 +0,0 @@ -$(document).ready(function () { - - var cc_versions = new Array(); cc_versions[""]="3.0"; cc_versions["ar"]="2.5"; cc_versions["au"]="3.0"; cc_versions["at"]="3.0"; cc_versions["be"]="2.0"; cc_versions["br"]="3.0"; cc_versions["bg"]="2.5"; cc_versions["ca"]="2.5"; cc_versions["cl"]="2.0"; cc_versions["cn"]="2.5"; cc_versions["co"]="2.5"; cc_versions["hr"]="3.0"; cc_versions["cz"]="3.0"; cc_versions["dk"]="2.5"; cc_versions["ec"]="3.0"; cc_versions["fi"]="1.0"; cc_versions["fr"]="2.0"; cc_versions["de"]="3.0"; cc_versions["gr"]="3.0"; cc_versions["gt"]="3.0"; cc_versions["hk"]="3.0"; cc_versions["hu"]="2.5"; cc_versions["in"]="2.5"; cc_versions["il"]="2.5"; cc_versions["it"]="2.5"; cc_versions["jp"]="2.0"; cc_versions["kr"]="2.0"; cc_versions["lu"]="3.0"; cc_versions["mk"]="2.5"; cc_versions["my"]="2.5"; cc_versions["mt"]="2.5"; cc_versions["mx"]="2.5"; cc_versions["nl"]="3.0"; cc_versions["nz"]="3.0"; cc_versions["no"]="3.0"; cc_versions["pe"]="2.5"; cc_versions["ph"]="3.0"; cc_versions["pl"]="3.0"; cc_versions["pt"]="2.5"; cc_versions["pr"]="3.0"; cc_versions["ro"]="3.0"; cc_versions["rs"]="3.0"; cc_versions["sg"]="3.0"; cc_versions["si"]="2.5"; cc_versions["za"]="2.5"; cc_versions["es"]="3.0"; cc_versions["se"]="2.5"; cc_versions["ch"]="2.5"; cc_versions["tw"]="3.0"; cc_versions["th"]="3.0"; cc_versions["uk"]="2.0"; cc_versions["scotland"]="2.5"; cc_versions["us"]="3.0"; cc_versions["vn"]="3.0"; - - function updateCCPreview() - { - - var commercial = $('.cc_commercial').val(); - var modification = $('.cc_modifications').val(); - var jurisdiction= $('.cc_jurisdiction').val(); - var jurisdiction_name = jurisdiction; - var version = cc_versions[jurisdiction_name]; - - var params=""; - - if (commercial != '') - params+="-"+commercial; - if (modification != '') - params+="-"+modification; - - - if (jurisdiction != null) - jurisdiction+="/"; - else - { - jurisdiction = ""; - jurisdiction_name = ""; - } - - var html = "\"Creative
This work is licensed under a Creative Commons License."; - - $('.cc_preview').html(html); - } - - $('.cc_enable').change(function () { - $('.cc_field').attr('disabled', !$(this).attr('checked')); - if ($(this).attr('checked')) - updateCCPreview(); - else - $('.cc_preview').html(''); - }); - - $('.cc_field').change(function () { - updateCCPreview(); - }); - - updateCCPreview(); -}); \ No newline at end of file diff --git a/form_elements/js/filechooser.js b/form_elements/js/filechooser.js deleted file mode 100644 index 7a9625ef..00000000 --- a/form_elements/js/filechooser.js +++ /dev/null @@ -1,89 +0,0 @@ -var files = new Array(); -var selectedFile = null; -var visibleFiles=4; - -$(document).ready(function () { - - var selectedValue = false; - var selectedIndex = 0; - var cp_pid; - var cm_pid; - var start=0; - var end = 50; - - if ($('#fileField').attr('value') != '') - { - selectedValue = $('#fileField').attr('value'); - } - - cp_pid = $('#edit-collection-pid').attr('value'); - cm_pid = $('#model_pid').attr('value'); - $.getJSON("/filechooser/generatePreview/"+cp_pid+"/"+cm_pid+"?start="+start+"&end="+end,function (data) - { - - $('#fileList').html(''); - if (data.length == 0) - { - $('#fileList').append('
No files found in staging area.
'); - - } else - { - $.each(data, function(i, item) - { - var html; - files[i]=item.name; - var selected= ""; - if (selectedValue == item.name) - { - selected='class="selected"'; - selectedFile='file'+i; - selectedIndex=i - (i%visibleFiles); - } - - if (item.thumb) - { - html='
  • '+item.name+'
    '+item.mime+'
    '+item.size+'  '+item.resolution+'
  • '; - } else - { - var type=item.mime.split('/',1).shift(); - html='
  •  
    '+item.name+'
    '+item.mime+'
    '+item.size+'
  • '; - } - - $('#fileList').append(html); - }); - - $('#fileList li div').breakly(15); - - } - - - $(".carousel .jCarouselLite").jCarouselLite({ - btnNext: ".carousel .next", - btnPrev: ".carousel .prev", - mouseWheel: true, - circular: false, - speed: 750, - visible: visibleFiles, - scroll: visibleFiles, - initial: selectedIndex - }); - - $(".carousel li").click(function() { - - if (selectedFile != this.id) - { - $('#fileField').attr('value',files[this.id.split('file',2).pop()]); - $("#"+(this.id)).addClass('selected'); - if (selectedFile != null) - { - $("#"+selectedFile).removeClass('selected'); - } - selectedFile=this.id; - } - }) - - }); - -}); - - diff --git a/form_elements/js/jcarousellite_1.0.1.js b/form_elements/js/jcarousellite_1.0.1.js deleted file mode 100644 index d51bca66..00000000 --- a/form_elements/js/jcarousellite_1.0.1.js +++ /dev/null @@ -1,343 +0,0 @@ -/** - * jCarouselLite - jQuery plugin to navigate images/any content in a carousel style widget. - * @requires jQuery v1.2 or above - * - * http://gmarwaha.com/jquery/jcarousellite/ - * - * Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com) - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * Version: 1.0.1 - * Note: Requires jquery 1.2 or above from version 1.0.1 - */ - -/** - * Creates a carousel-style navigation widget for images/any-content from a simple HTML markup. - * - * The HTML markup that is used to build the carousel can be as simple as... - * - * - * - * As you can see, this snippet is nothing but a simple div containing an unordered list of images. - * You don't need any special "class" attribute, or a special "css" file for this plugin. - * I am using a class attribute just for the sake of explanation here. - * - * To navigate the elements of the carousel, you need some kind of navigation buttons. - * For example, you will need a "previous" button to go backward, and a "next" button to go forward. - * This need not be part of the carousel "div" itself. It can be any element in your page. - * Lets assume that the following elements in your document can be used as next, and prev buttons... - * - * - * - * - * Now, all you need to do is call the carousel component on the div element that represents it, and pass in the - * navigation buttons as options. - * - * $(".carousel").jCarouselLite({ - * btnNext: ".next", - * btnPrev: ".prev" - * }); - * - * That's it, you would have now converted your raw div, into a magnificient carousel. - * - * There are quite a few other options that you can use to customize it though. - * Each will be explained with an example below. - * - * @param an options object - You can specify all the options shown below as an options object param. - * - * @option btnPrev, btnNext : string - no defaults - * @example - * $(".carousel").jCarouselLite({ - * btnNext: ".next", - * btnPrev: ".prev" - * }); - * @desc Creates a basic carousel. Clicking "btnPrev" navigates backwards and "btnNext" navigates forward. - * - * @option btnGo - array - no defaults - * @example - * $(".carousel").jCarouselLite({ - * btnNext: ".next", - * btnPrev: ".prev", - * btnGo: [".0", ".1", ".2"] - * }); - * @desc If you don't want next and previous buttons for navigation, instead you prefer custom navigation based on - * the item number within the carousel, you can use this option. Just supply an array of selectors for each element - * in the carousel. The index of the array represents the index of the element. What i mean is, if the - * first element in the array is ".0", it means that when the element represented by ".0" is clicked, the carousel - * will slide to the first element and so on and so forth. This feature is very powerful. For example, i made a tabbed - * interface out of it by making my navigation elements styled like tabs in css. As the carousel is capable of holding - * any content, not just images, you can have a very simple tabbed navigation in minutes without using any other plugin. - * The best part is that, the tab will "slide" based on the provided effect. :-) - * - * @option mouseWheel : boolean - default is false - * @example - * $(".carousel").jCarouselLite({ - * mouseWheel: true - * }); - * @desc The carousel can also be navigated using the mouse wheel interface of a scroll mouse instead of using buttons. - * To get this feature working, you have to do 2 things. First, you have to include the mouse-wheel plugin from brandon. - * Second, you will have to set the option "mouseWheel" to true. That's it, now you will be able to navigate your carousel - * using the mouse wheel. Using buttons and mouseWheel or not mutually exclusive. You can still have buttons for navigation - * as well. They complement each other. To use both together, just supply the options required for both as shown below. - * @example - * $(".carousel").jCarouselLite({ - * btnNext: ".next", - * btnPrev: ".prev", - * mouseWheel: true - * }); - * - * @option auto : number - default is null, meaning autoscroll is disabled by default - * @example - * $(".carousel").jCarouselLite({ - * auto: 800, - * speed: 500 - * }); - * @desc You can make your carousel auto-navigate itself by specfying a millisecond value in this option. - * The value you specify is the amount of time between 2 slides. The default is null, and that disables auto scrolling. - * Specify this value and magically your carousel will start auto scrolling. - * - * @option speed : number - 200 is default - * @example - * $(".carousel").jCarouselLite({ - * btnNext: ".next", - * btnPrev: ".prev", - * speed: 800 - * }); - * @desc Specifying a speed will slow-down or speed-up the sliding speed of your carousel. Try it out with - * different speeds like 800, 600, 1500 etc. Providing 0, will remove the slide effect. - * - * @option easing : string - no easing effects by default. - * @example - * $(".carousel").jCarouselLite({ - * btnNext: ".next", - * btnPrev: ".prev", - * easing: "bounceout" - * }); - * @desc You can specify any easing effect. Note: You need easing plugin for that. Once specified, - * the carousel will slide based on the provided easing effect. - * - * @option vertical : boolean - default is false - * @example - * $(".carousel").jCarouselLite({ - * btnNext: ".next", - * btnPrev: ".prev", - * vertical: true - * }); - * @desc Determines the direction of the carousel. true, means the carousel will display vertically. The next and - * prev buttons will slide the items vertically as well. The default is false, which means that the carousel will - * display horizontally. The next and prev items will slide the items from left-right in this case. - * - * @option circular : boolean - default is true - * @example - * $(".carousel").jCarouselLite({ - * btnNext: ".next", - * btnPrev: ".prev", - * circular: false - * }); - * @desc Setting it to true enables circular navigation. This means, if you click "next" after you reach the last - * element, you will automatically slide to the first element and vice versa. If you set circular to false, then - * if you click on the "next" button after you reach the last element, you will stay in the last element itself - * and similarly for "previous" button and first element. - * - * @option visible : number - default is 3 - * @example - * $(".carousel").jCarouselLite({ - * btnNext: ".next", - * btnPrev: ".prev", - * visible: 4 - * }); - * @desc This specifies the number of items visible at all times within the carousel. The default is 3. - * You are even free to experiment with real numbers. Eg: "3.5" will have 3 items fully visible and the - * last item half visible. This gives you the effect of showing the user that there are more images to the right. - * - * @option start : number - default is 0 - * @example - * $(".carousel").jCarouselLite({ - * btnNext: ".next", - * btnPrev: ".prev", - * start: 2 - * }); - * @desc You can specify from which item the carousel should start. Remember, the first item in the carousel - * has a start of 0, and so on. - * - * @option scrool : number - default is 1 - * @example - * $(".carousel").jCarouselLite({ - * btnNext: ".next", - * btnPrev: ".prev", - * scroll: 2 - * }); - * @desc The number of items that should scroll/slide when you click the next/prev navigation buttons. By - * default, only one item is scrolled, but you may set it to any number. Eg: setting it to "2" will scroll - * 2 items when you click the next or previous buttons. - * - * @option beforeStart, afterEnd : function - callbacks - * @example - * $(".carousel").jCarouselLite({ - * btnNext: ".next", - * btnPrev: ".prev", - * beforeStart: function(a) { - * alert("Before animation starts:" + a); - * }, - * afterEnd: function(a) { - * alert("After animation ends:" + a); - * } - * }); - * @desc If you wanted to do some logic in your page before the slide starts and after the slide ends, you can - * register these 2 callbacks. The functions will be passed an argument that represents an array of elements that - * are visible at the time of callback. - * - * - * @cat Plugins/Image Gallery - * @author Ganeshji Marwaha/ganeshread@gmail.com - */ - -(function($) { // Compliant with jquery.noConflict() -$.fn.jCarouselLite = function(o) { - o = $.extend({ - btnPrev: null, - btnNext: null, - btnGo: null, - mouseWheel: false, - auto: null, - - speed: 200, - easing: null, - - vertical: false, - circular: true, - visible: 3, - start: 0, - scroll: 1, - - beforeStart: null, - afterEnd: null - }, o || {}); - - return this.each(function() { // Returns the element collection. Chainable. - - var running = false, animCss=o.vertical?"top":"left", sizeCss=o.vertical?"height":"width"; - var div = $(this), ul = $("ul", div), tLi = $("li", ul), tl = tLi.size(), v = o.visible; - - if(o.circular) { - ul.prepend(tLi.slice(tl-v-1+1).clone()) - .append(tLi.slice(0,v).clone()); - o.start += v; - } - - var li = $("li", ul), itemLength = li.size(), curr = o.start; - div.css("visibility", "visible"); - - li.css({overflow: "hidden", float: o.vertical ? "none" : "left"}); - ul.css({margin: "0", padding: "0", position: "relative", "list-style-type": "none", "z-index": "1"}); - div.css({overflow: "hidden", position: "relative", "z-index": "2", left: "0px"}); - - var liSize = o.vertical ? height(li) : width(li); // Full li size(incl margin)-Used for animation - var ulSize = liSize * itemLength; // size of full ul(total length, not just for the visible items) - var divSize = liSize * v; // size of entire div(total length for just the visible items) - - li.css({width: li.width(), height: li.height()}); - ul.css(sizeCss, ulSize+"px").css(animCss, -(curr*liSize)); - - div.css(sizeCss, divSize+"px"); // Width of the DIV. length of visible images - - if(o.btnPrev) - $(o.btnPrev).click(function() { - return go(curr-o.scroll); - }); - - if(o.btnNext) - $(o.btnNext).click(function() { - return go(curr+o.scroll); - }); - - if(o.btnGo) - $.each(o.btnGo, function(i, val) { - $(val).click(function() { - return go(o.circular ? o.visible+i : i); - }); - }); - if(o.initial && o.initial >= o.visible) - go(o.circular ? o.visible+o.initial : o.initial); - - if(o.mouseWheel && div.mousewheel) - div.mousewheel(function(e, d) { - return d>0 ? go(curr-o.scroll) : go(curr+o.scroll); - }); - - if(o.auto) - setInterval(function() { - go(curr+o.scroll); - }, o.auto+o.speed); - - function vis() { - return li.slice(curr).slice(0,v); - }; - - function go(to) { - if(!running) { - - if(o.beforeStart) - o.beforeStart.call(this, vis()); - - if(o.circular) { // If circular we are in first or last, then goto the other end - if(to<=o.start-v-1) { // If first, then goto last - ul.css(animCss, -((itemLength-(v*2))*liSize)+"px"); - // If "scroll" > 1, then the "to" might not be equal to the condition; it can be lesser depending on the number of elements. - curr = to==o.start-v-1 ? itemLength-(v*2)-1 : itemLength-(v*2)-o.scroll; - } else if(to>=itemLength-v+1) { // If last, then goto first - ul.css(animCss, -( (v) * liSize ) + "px" ); - // If "scroll" > 1, then the "to" might not be equal to the condition; it can be greater depending on the number of elements. - curr = to==itemLength-v+1 ? v+1 : v+o.scroll; - } else curr = to; - } else { // If non-circular and to points to first or last, we just return. - if(to<0 || to>itemLength-v) return; - else curr = to; - } // If neither overrides it, the curr will still be "to" and we can proceed. - - running = true; - - ul.animate( - animCss == "left" ? { left: -(curr*liSize) } : { top: -(curr*liSize) } , o.speed, o.easing, - function() { - if(o.afterEnd) - o.afterEnd.call(this, vis()); - running = false; - } - ); - // Disable buttons when the carousel reaches the last/first, and enable when not - if(!o.circular) { - $(o.btnPrev + "," + o.btnNext).removeClass("disabled"); - $( (curr-o.scroll<0 && o.btnPrev) - || - (curr+o.scroll > itemLength-v && o.btnNext) - || - [] - ).addClass("disabled"); - } - - } - return false; - }; - }); -}; - -function css(el, prop) { - return parseInt($.css(el[0], prop)) || 0; -}; -function width(el) { - return el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight'); -}; -function height(el) { - return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom'); -}; - -})(jQuery); \ No newline at end of file diff --git a/form_elements/js/jquery.breakly-1.0.js b/form_elements/js/jquery.breakly-1.0.js deleted file mode 100644 index e025a34d..00000000 --- a/form_elements/js/jquery.breakly-1.0.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * jQuery Breakly plugin - Breaks your texts. Gently. - * This plugin can be used to give the browser an "hint" on when (and eventually how) break - * some long texts that are wrapped in a container with an explicitely defined width. - * It works adding a "special" unicode character after the given number of characters. - * By default the plugin inserts U+200B (the zero width space), but you can specify any - * other character as the second parameter - * - * @name jquery-breakly-1.0.js - * @author Claudio Cicali - http://claudio.cicali.name - * @version 1.0 - * @date December 22, 2009 - * @category jQuery plugin - * @copyright (c) 2009 Claudio Cicali ( http://claudio.cicali.name ) - * @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US - * @examples - * $('h3').breakly(3); // "breaks" any h3 text (and any h3's children text too) inserting a \U+200B after every 3 characters - * $('h3').breakly(3, 0x202f); // Same as above, but inserts a "NARROW NO-BREAK SPACE" (just for the fun of it) - - * Visit http://lab.web20.it/breakly/example.html - * List of Unicode spaces: http://www.cs.tut.fi/~jkorpela/chars/spaces.html - */ -$.fn.breakly = function(chopAt, spaceCode) { - spaceCode |= 8203; // U+200B ZERO WIDTH SPACE - var zw = String.fromCharCode(spaceCode), re = new RegExp(/\B/), orig, idx, chopped, ch; - function breakly(node) { - if (3 == node.nodeType && (orig = node.nodeValue).length > chopAt) { - idx = 0; - chopped=[]; - for (var i=0; i < orig.length; i++) { - ch = orig.substr(i,1); - chopped.push(ch); - if (null != ch.match(re)) { - idx=0; - continue; - } - if (++idx == chopAt) { - ch = orig.substr(i+1,1); // look ahead - if (ch && null == ch.match(re)) { - chopped.push(zw); - idx=0; - } - } - } - node.nodeValue = chopped.join(''); - } else { - for (var i=0; i < node.childNodes.length; i++) { - breakly(node.childNodes[i]); - } - } - } - - return this.each(function() { - breakly(this); - }) -} - - diff --git a/form_elements/js/jquery.easing.1.1.js b/form_elements/js/jquery.easing.1.1.js deleted file mode 100644 index f2ae8730..00000000 --- a/form_elements/js/jquery.easing.1.1.js +++ /dev/null @@ -1,105 +0,0 @@ -/* - * jQuery Easing v1.1 - http://gsgd.co.uk/sandbox/jquery.easing.php - * - * Uses the built in easing capabilities added in jQuery 1.1 - * to offer multiple easing options - * - * Copyright (c) 2007 George Smith - * Licensed under the MIT License: - * http://www.opensource.org/licenses/mit-license.php - */ - -jQuery.easing = { - easein: function(x, t, b, c, d) { - return c*(t/=d)*t + b; // in - }, - easeinout: function(x, t, b, c, d) { - if (t < d/2) return 2*c*t*t/(d*d) + b; - var ts = t - d/2; - return -2*c*ts*ts/(d*d) + 2*c*ts/d + c/2 + b; - }, - easeout: function(x, t, b, c, d) { - return -c*t*t/(d*d) + 2*c*t/d + b; - }, - expoin: function(x, t, b, c, d) { - var flip = 1; - if (c < 0) { - flip *= -1; - c *= -1; - } - return flip * (Math.exp(Math.log(c)/d * t)) + b; - }, - expoout: function(x, t, b, c, d) { - var flip = 1; - if (c < 0) { - flip *= -1; - c *= -1; - } - return flip * (-Math.exp(-Math.log(c)/d * (t-d)) + c + 1) + b; - }, - expoinout: function(x, t, b, c, d) { - var flip = 1; - if (c < 0) { - flip *= -1; - c *= -1; - } - if (t < d/2) return flip * (Math.exp(Math.log(c/2)/(d/2) * t)) + b; - return flip * (-Math.exp(-2*Math.log(c/2)/d * (t-d)) + c + 1) + b; - }, - bouncein: function(x, t, b, c, d) { - return c - jQuery.easing['bounceout'](x, d-t, 0, c, d) + b; - }, - bounceout: function(x, t, b, c, d) { - if ((t/=d) < (1/2.75)) { - return c*(7.5625*t*t) + b; - } else if (t < (2/2.75)) { - return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; - } else if (t < (2.5/2.75)) { - return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; - } else { - return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; - } - }, - bounceinout: function(x, t, b, c, d) { - if (t < d/2) return jQuery.easing['bouncein'] (x, t*2, 0, c, d) * .5 + b; - return jQuery.easing['bounceout'] (x, t*2-d,0, c, d) * .5 + c*.5 + b; - }, - elasin: function(x, t, b, c, d) { - var s=1.70158;var p=0;var a=c; - if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; - if (a < Math.abs(c)) { a=c; var s=p/4; } - else var s = p/(2*Math.PI) * Math.asin (c/a); - return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; - }, - elasout: function(x, t, b, c, d) { - var s=1.70158;var p=0;var a=c; - if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; - if (a < Math.abs(c)) { a=c; var s=p/4; } - else var s = p/(2*Math.PI) * Math.asin (c/a); - return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; - }, - elasinout: function(x, t, b, c, d) { - var s=1.70158;var p=0;var a=c; - if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); - if (a < Math.abs(c)) { a=c; var s=p/4; } - else var s = p/(2*Math.PI) * Math.asin (c/a); - if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; - return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; - }, - backin: function(x, t, b, c, d) { - var s=1.70158; - return c*(t/=d)*t*((s+1)*t - s) + b; - }, - backout: function(x, t, b, c, d) { - var s=1.70158; - return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; - }, - backinout: function(x, t, b, c, d) { - var s=1.70158; - if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; - return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; - }, - linear: function(x, t, b, c, d) { - return c*t/d + b; //linear - } -}; \ No newline at end of file diff --git a/form_elements/js/jquery.loadImages.1.0.1.js b/form_elements/js/jquery.loadImages.1.0.1.js deleted file mode 100644 index b2594ba3..00000000 --- a/form_elements/js/jquery.loadImages.1.0.1.js +++ /dev/null @@ -1,33 +0,0 @@ -(function($){ - //cache needed for overagressive garbage collectors. - var cache = []; - //images can either be an array of paths to images or a single image. - $.loadImages = function(images, ids, callback){ - - //convert to array if needed so rest of script works - if (!(images instanceof Array)) { - images = [images]; - } - - if (!(images instanceof Array)) { - ids = [ids]; - } - - var imagesLength = images.length; - var loadedCounter = 0; - - for (var i=0; i < imagesLength; i++) { - var cacheImage = document.createElement('img'); - //set the onload method before the src is called otherwise will fail to be called in IE - cacheImage.onload = function(){ - loadedCounter++; - if ($.isFunction(callback)) { - callback(this); - } - } - cacheImage.src = images[i]; - cacheImage.id = '#'+ids[i]; - cache.push(cacheImage); - } - } -})(jQuery) diff --git a/form_elements/js/jquery.loadImages.1.0.1.min.js b/form_elements/js/jquery.loadImages.1.0.1.min.js deleted file mode 100644 index b697758e..00000000 --- a/form_elements/js/jquery.loadImages.1.0.1.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(c){var h=[];c.loadImages=function(a,d){a instanceof Array||(a=[a]);for(var e=a.length,f=0,g=e;g--;){var b=document.createElement("img");b.onload=function(){f++;f>=e&&c.isFunction(d)&&d()};b.src=a[g];h.push(b)}}})(jQuery); \ No newline at end of file diff --git a/form_elements/js/jquery.loadImages.1.0.1.zip b/form_elements/js/jquery.loadImages.1.0.1.zip deleted file mode 100644 index 1444833d..00000000 Binary files a/form_elements/js/jquery.loadImages.1.0.1.zip and /dev/null differ diff --git a/form_elements/js/jquery.mousewheel.min.js b/form_elements/js/jquery.mousewheel.min.js deleted file mode 100644 index 05ebb0a9..00000000 --- a/form_elements/js/jquery.mousewheel.min.js +++ /dev/null @@ -1,11 +0,0 @@ -/* Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net) - * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) - * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. - * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. - * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. - * - * Version: 3.0.2 - * - * Requires: 1.2.2+ - */ -(function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}});function b(f){var d=[].slice.call(arguments,1),g=0,e=true;f=c.event.fix(f||window.event);f.type="mousewheel";if(f.wheelDelta){g=f.wheelDelta/120}if(f.detail){g=-f.detail/3}d.unshift(f,g);return c.event.handle.apply(this,d)}})(jQuery); \ No newline at end of file diff --git a/form_elements/js/jquery.tag.editor-min.js b/form_elements/js/jquery.tag.editor-min.js deleted file mode 100644 index b111631d..00000000 --- a/form_elements/js/jquery.tag.editor-min.js +++ /dev/null @@ -1,8 +0,0 @@ -/* -@inital author: Karl-Johan Sjögren / http://blog.crazybeavers.se/ -@contributor: Joost Elfering / http://yopefonic.wordpress.com/ -@url: http://blog.crazybeavers.se/wp-content/demos/jquery.tag.editor/ -@license: Creative Commons License - ShareAlike http://creativecommons.org/licenses/by-sa/3.0/ -@version: 1.4.1 -*/ -(function(jQuery) { jQuery.fn.tagEditor = function(options) { var defaults = { separator: ",", items: [], className: "tagEditor", confirmRemoval: false, confirmRemovalText: "Do you really want to remove the tag?", completeOnSeparator: false, completeOnBlur: false, tagsBeforeField: false, initialParse: true, imageTag: false, imageTagUrl: "", continuousOutputBuild: false }; options = jQuery.extend(defaults, options); var listBase, textBase = this, hiddenText; var itemBase = []; return this.each(function() { function addTag(tag) { tag = jQuery.trim(tag); for (var i = 0; i < itemBase.length; i++) { if (itemBase[i].toLowerCase() == tag.toLowerCase()) { return false; } } var item = jQuery(document.createElement("li")); item.text(tag); item.attr("title", "Remove tag"); if (options.imageTag) { item.append(''); } item.click(function() { if (options.confirmRemoval) { if (!confirm(options.confirmRemovalText)) { return; } } item.remove(); parse(); }); listBase.append(item); return true; } function resetTags() { itemBase = []; listBase.html(""); textBase.val(""); hiddenText.val(""); for (var i = 0; i < options.items.length; i++) { addTag(jQuery.trim(options.items[i])); } parse(); } function buildArray() { itemBase = []; var items = jQuery("li", listBase); for (var i = 0; i < items.length; i++) { itemBase.push(jQuery.trim(jQuery(items[i]).text())); } if (options.continuousOutputBuild) { hiddenText.val(itemBase.join(options.separator)); } } function parse() { var items = textBase.val().split(options.separator); for (var i = 0; i < items.length; i++) { var trimmedItem = jQuery.trim(items[i]); if (trimmedItem.length > 0) { addTag(trimmedItem); } } textBase.val(""); buildArray(); } function handleKeys(ev) { var keyCode = (ev.which) ? ev.which : ev.keyCode; if (options.completeOnSeparator) { if (String.fromCharCode(keyCode) == options.separator) { parse(); return false; } } switch (keyCode) { case 13: if (jQuery.trim(textBase.val()) != "") { parse(); return false; } return true; default: return true; } } jQuery.fn.extend({ tagEditorGetTags: function() { return itemBase.join(options.separator); }, tagEditorResetTags: function() { resetTags(); }, tagEditorAddTag: function(tag) { return addTag(tag); } }); hiddenText = jQuery(document.createElement("input")); hiddenText.attr("type", "hidden"); if (options.continuousOutputBuild) { hiddenText.attr("name", textBase.attr("name")); textBase.attr("name", textBase.attr("name") + "_old"); } textBase.after(hiddenText); listBase = jQuery(document.createElement("ul")); listBase.attr("class", options.className); if (options.tagsBeforeField) { jQuery(this).before(listBase); } else { jQuery(this).after(listBase); } for (var i = 0; i < options.items.length; i++) { addTag(jQuery.trim(options.items[i])); } if (options.initialParse) { parse(); } if (options.completeOnBlur) { jQuery(this).blur(parse); } buildArray(); jQuery(this).keypress(handleKeys); var form = jQuery(this).parents("form"); if (!options.continuousOutputBuild) { form.submit(function() { parse(); hiddenText.val(itemBase.join(options.separator)); hiddenText.attr("id", textBase.attr("id")); hiddenText.attr("name", textBase.attr("name")); textBase.attr("id", textBase.attr("id") + "_old"); textBase.attr("name", textBase.attr("name") + "_old"); }); } }); }; })(jQuery); \ No newline at end of file diff --git a/form_elements/js/jquery.tag.editor.js b/form_elements/js/jquery.tag.editor.js deleted file mode 100644 index d34837ae..00000000 --- a/form_elements/js/jquery.tag.editor.js +++ /dev/null @@ -1,214 +0,0 @@ -/* -@inital author: Karl-Johan Sjögren / http://blog.crazybeavers.se/ -@contributor: Joost Elfering / http://yopefonic.wordpress.com/ -@url: http://blog.crazybeavers.se/wp-content/demos/jquery.tag.editor/ -@license: Creative Commons License - ShareAlike http://creativecommons.org/licenses/by-sa/3.0/ -@version: 1.4.1 -@changelog -1.4.1 -Karl-Johan Sjögren --Removed all references to $ to make sure that it is compatible even when using other libraries that bind to $ --Reorganized the code and cleaned it up to pass the JSLint-test to make sure that it works when minified --Switched minifier to YUI Compressor since Packer broke the script (even though it passes JSLint) -1.4 -Karl-Johan Sjögren --Normalized the string chars in the script to ' --Added a minified version of the script to the package using http://base2.googlecode.com/svn/trunk/src/apps/packer/packer.html -Joost Elfering --Major change in extension of the object --Moved getTags to tagEditorGetTags for naming convention --Changed tagEditor so that it can be called without arguments --Changed call for getTags to $(object).tagEditorGetTags() --Changed addTag to return a true or false value as a success indicator --Added resetTags method to clear the input and set the default given tags as start --Added tagEditorResetTags as API for resetTags: $(object).tagEditorResetTags() --Added tagEditorAddTag as API for addTag: $(object).tagEditorAddTag('string') --Added continuousOutputBuild option to allow continuous building for dynamic forms --Added tagsBeforeField option to switch places between tags added and the input field --Added imageTag option to add and image to the list for styling purposes --Added imageTagUrl option to define custom image for styling purposes -1.3 --Any string already in the textbox when enabling the tag editor is now parsed as tags --Added initialParse to stop the initial parsing --Added confirmRemovalText as an option to better support different localizations --Added the getTags method. --Fixed completeOnBlur that wasn't working -1.2 --Fixed bug with completeOnSeparator for Firefox --Fixed so that pressing return on an empty editor would submit the form -1.1 --Initial public release --Added the completeOnSeparator and completeOnBlur options -*/ -(function(jQuery) { - jQuery.fn.tagEditor = function(options) { - var defaults = { - separator: ',', - items: [], - className: 'tagEditor', - confirmRemoval: false, - confirmRemovalText: 'Do you really want to remove the tag?', - completeOnSeparator: false, - completeOnBlur: false, - tagsBeforeField: false, - initialParse: true, - imageTag: false, - imageTagUrl: '', - continuousOutputBuild: false - }; - - options = jQuery.extend(defaults, options); - - var listBase, textBase = this, hiddenText; - var itemBase = []; - - return this.each(function() { - function addTag(tag) { - tag = jQuery.trim(tag); - for (var i = 0; i < itemBase.length; i++) { - if (itemBase[i].toLowerCase() == tag.toLowerCase()) { - return false; - } - } - - var item = jQuery(document.createElement('li')); - item.text(tag); - item.attr('title', 'Remove tag'); - if (options.imageTag) { - item.append(''); - } - - item.click(function() { - if (options.confirmRemoval) { - if (!confirm(options.confirmRemovalText)) { - return; - } - } - - item.remove(); - parse(); - }); - - listBase.append(item); - return true; - } - - function resetTags() { - itemBase = []; - listBase.html(''); - textBase.val(''); - hiddenText.val(''); - for (var i = 0; i < options.items.length; i++) { - addTag(jQuery.trim(options.items[i])); - } - parse(); - } - - function buildArray() { - itemBase = []; - var items = jQuery('li', listBase); - - for (var i = 0; i < items.length; i++) { - itemBase.push(jQuery.trim(jQuery(items[i]).text())); - } - - if (options.continuousOutputBuild) { - hiddenText.val(itemBase.join(options.separator)); - } - } - - function parse() { - var items = textBase.val().split(options.separator); - - for (var i = 0; i < items.length; i++) { - var trimmedItem = jQuery.trim(items[i]); - if (trimmedItem.length > 0) { - addTag(trimmedItem); - } - } - - textBase.val(''); - buildArray(); - } - - function handleKeys(ev) { - var keyCode = (ev.which) ? ev.which : ev.keyCode; - - if (options.completeOnSeparator) { - if (String.fromCharCode(keyCode) == options.separator) { - parse(); - return false; - } - } - - switch (keyCode) { - case 13: - if (jQuery.trim(textBase.val()) != '') { - parse(); - return false; - } - return true; - default: - return true; - } - } - - jQuery.fn.extend({ - tagEditorGetTags: function() { - return itemBase.join(options.separator); - }, - tagEditorResetTags: function() { - resetTags(); - }, - tagEditorAddTag: function(tag) { - return addTag(tag); - } - }); - - hiddenText = jQuery(document.createElement('input')); - hiddenText.attr('type', 'hidden'); - if (options.continuousOutputBuild) { - hiddenText.attr('name', textBase.attr('name')); - textBase.attr('name', textBase.attr('name') + '_old'); - } - textBase.after(hiddenText); - - listBase = jQuery(document.createElement('ul')); - listBase.attr('class', options.className); - if (options.tagsBeforeField) { - jQuery(this).before(listBase); - } else { - jQuery(this).after(listBase); - } - - for (var i = 0; i < options.items.length; i++) { - addTag(jQuery.trim(options.items[i])); - } - - if (options.initialParse) { - parse(); - } - - if (options.completeOnBlur) { - jQuery(this).blur(parse); - } - - buildArray(); - jQuery(this).keypress(handleKeys); - - var form = jQuery(this).parents('form'); - - if (!options.continuousOutputBuild) { - form.submit(function() { - parse(); - hiddenText.val(itemBase.join(options.separator)); - hiddenText.attr('id', textBase.attr('id')); - hiddenText.attr("name", textBase.attr('name')); - textBase.attr('id', textBase.attr('id') + '_old'); - textBase.attr('name', textBase.attr('name') + '_old'); - - }); - } - }); - }; -})(jQuery); \ No newline at end of file diff --git a/form_elements/js/jquery.ui.core.js b/form_elements/js/jquery.ui.core.js deleted file mode 100644 index 7067cddf..00000000 --- a/form_elements/js/jquery.ui.core.js +++ /dev/null @@ -1,281 +0,0 @@ -/*! - * jQuery UI 1.8.4 - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI - */ -(function( $, undefined ) { - -// prevent duplicate loading -// this is only a problem because we proxy existing functions -// and we don't want to double proxy them -$.ui = $.ui || {}; -if ( $.ui.version ) { - return; -} - -//Helper functions and ui object -$.extend( $.ui, { - version: "1.8.4", - - // $.ui.plugin is deprecated. Use the proxy pattern instead. - plugin: { - add: function( module, option, set ) { - var proto = $.ui[ module ].prototype; - for ( var i in set ) { - proto.plugins[ i ] = proto.plugins[ i ] || []; - proto.plugins[ i ].push( [ option, set[ i ] ] ); - } - }, - call: function( instance, name, args ) { - var set = instance.plugins[ name ]; - if ( !set || !instance.element[ 0 ].parentNode ) { - return; - } - - for ( var i = 0; i < set.length; i++ ) { - if ( instance.options[ set[ i ][ 0 ] ] ) { - set[ i ][ 1 ].apply( instance.element, args ); - } - } - } - }, - - contains: function( a, b ) { - return document.compareDocumentPosition ? - a.compareDocumentPosition( b ) & 16 : - a !== b && a.contains( b ); - }, - - hasScroll: function( el, a ) { - - //If overflow is hidden, the element might have extra content, but the user wants to hide it - if ( $( el ).css( "overflow" ) === "hidden") { - return false; - } - - var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", - has = false; - - if ( el[ scroll ] > 0 ) { - return true; - } - - // TODO: determine which cases actually cause this to happen - // if the element doesn't have the scroll set, see if it's possible to - // set the scroll - el[ scroll ] = 1; - has = ( el[ scroll ] > 0 ); - el[ scroll ] = 0; - return has; - }, - - isOverAxis: function( x, reference, size ) { - //Determines when x coordinate is over "b" element axis - return ( x > reference ) && ( x < ( reference + size ) ); - }, - - isOver: function( y, x, top, left, height, width ) { - //Determines when x, y coordinates is over "b" element - return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width ); - }, - - keyCode: { - ALT: 18, - BACKSPACE: 8, - CAPS_LOCK: 20, - COMMA: 188, - COMMAND: 91, - COMMAND_LEFT: 91, // COMMAND - COMMAND_RIGHT: 93, - CONTROL: 17, - DELETE: 46, - DOWN: 40, - END: 35, - ENTER: 13, - ESCAPE: 27, - HOME: 36, - INSERT: 45, - LEFT: 37, - MENU: 93, // COMMAND_RIGHT - NUMPAD_ADD: 107, - NUMPAD_DECIMAL: 110, - NUMPAD_DIVIDE: 111, - NUMPAD_ENTER: 108, - NUMPAD_MULTIPLY: 106, - NUMPAD_SUBTRACT: 109, - PAGE_DOWN: 34, - PAGE_UP: 33, - PERIOD: 190, - RIGHT: 39, - SHIFT: 16, - SPACE: 32, - TAB: 9, - UP: 38, - WINDOWS: 91 // COMMAND - } -}); - -//jQuery plugins -$.fn.extend({ - _focus: $.fn.focus, - focus: function( delay, fn ) { - return typeof delay === "number" ? - this.each(function() { - var elem = this; - setTimeout(function() { - $( elem ).focus(); - if ( fn ) { - fn.call( elem ); - } - }, delay ); - }) : - this._focus.apply( this, arguments ); - }, - - enableSelection: function() { - return this - .attr( "unselectable", "off" ) - .css( "MozUserSelect", "" ); - }, - - disableSelection: function() { - return this - .attr( "unselectable", "on" ) - .css( "MozUserSelect", "none" ); - }, - - scrollParent: function() { - var scrollParent; - if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) { - scrollParent = this.parents().filter(function() { - return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1)); - }).eq(0); - } else { - scrollParent = this.parents().filter(function() { - return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1)); - }).eq(0); - } - - return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent; - }, - - zIndex: function( zIndex ) { - if ( zIndex !== undefined ) { - return this.css( "zIndex", zIndex ); - } - - if ( this.length ) { - var elem = $( this[ 0 ] ), position, value; - while ( elem.length && elem[ 0 ] !== document ) { - // Ignore z-index if position is set to a value where z-index is ignored by the browser - // This makes behavior of this function consistent across browsers - // WebKit always returns auto if the element is positioned - position = elem.css( "position" ); - if ( position === "absolute" || position === "relative" || position === "fixed" ) { - // IE returns 0 when zIndex is not specified - // other browsers return a string - // we ignore the case of nested elements with an explicit value of 0 - //
    - value = parseInt( elem.css( "zIndex" ) ); - if ( !isNaN( value ) && value != 0 ) { - return value; - } - } - elem = elem.parent(); - } - } - - return 0; - } -}); - -$.each( [ "Width", "Height" ], function( i, name ) { - var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], - type = name.toLowerCase(), - orig = { - innerWidth: $.fn.innerWidth, - innerHeight: $.fn.innerHeight, - outerWidth: $.fn.outerWidth, - outerHeight: $.fn.outerHeight - }; - - function reduce( elem, size, border, margin ) { - $.each( side, function() { - size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0; - if ( border ) { - size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0; - } - if ( margin ) { - size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0; - } - }); - return size; - } - - $.fn[ "inner" + name ] = function( size ) { - if ( size === undefined ) { - return orig[ "inner" + name ].call( this ); - } - - return this.each(function() { - $.style( this, type, reduce( this, size ) + "px" ); - }); - }; - - $.fn[ "outer" + name] = function( size, margin ) { - if ( typeof size !== "number" ) { - return orig[ "outer" + name ].call( this, size ); - } - - return this.each(function() { - $.style( this, type, reduce( this, size, true, margin ) + "px" ); - }); - }; -}); - -//Additional selectors -function visible( element ) { - return !$( element ).parents().andSelf().filter(function() { - return $.curCSS( this, "visibility" ) === "hidden" || - $.expr.filters.hidden( this ); - }).length; -} - -$.extend( $.expr[ ":" ], { - data: function( elem, i, match ) { - return !!$.data( elem, match[ 3 ] ); - }, - - focusable: function( element ) { - var nodeName = element.nodeName.toLowerCase(), - tabIndex = $.attr( element, "tabindex" ); - if ( "area" === nodeName ) { - var map = element.parentNode, - mapName = map.name, - img; - if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { - return false; - } - img = $( "img[usemap=#" + mapName + "]" )[0]; - return !!img && visible( img ); - } - return ( /input|select|textarea|button|object/.test( nodeName ) - ? !element.disabled - : "a" == nodeName - ? element.href || !isNaN( tabIndex ) - : !isNaN( tabIndex )) - // the element and all of its ancestors must be visible - && visible( element ); - }, - - tabbable: function( element ) { - var tabIndex = $.attr( element, "tabindex" ); - return ( isNaN( tabIndex ) || tabIndex >= 0 ) && $( element ).is( ":focusable" ); - } -}); - -})( jQuery ); diff --git a/form_elements/js/jquery.ui.datepicker.js b/form_elements/js/jquery.ui.datepicker.js deleted file mode 100644 index 8937b0f3..00000000 --- a/form_elements/js/jquery.ui.datepicker.js +++ /dev/null @@ -1,1732 +0,0 @@ -/* - * jQuery UI Datepicker 1.8.4 - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Datepicker - * - * Depends: - * jquery.ui.core.js - */ -(function( $, undefined ) { - -$.extend($.ui, { datepicker: { version: "1.8.4" } }); - -var PROP_NAME = 'datepicker'; -var dpuuid = new Date().getTime(); - -/* Date picker manager. - Use the singleton instance of this class, $.datepicker, to interact with the date picker. - Settings for (groups of) date pickers are maintained in an instance object, - allowing multiple different settings on the same page. */ - -function Datepicker() { - this.debug = false; // Change this to true to start debugging - this._curInst = null; // The current instance in use - this._keyEvent = false; // If the last event was a key event - this._disabledInputs = []; // List of date picker inputs that have been disabled - this._datepickerShowing = false; // True if the popup picker is showing , false if not - this._inDialog = false; // True if showing within a "dialog", false if not - this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division - this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class - this._appendClass = 'ui-datepicker-append'; // The name of the append marker class - this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class - this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class - this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class - this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class - this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class - this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class - this.regional = []; // Available regional settings, indexed by language code - this.regional[''] = { // Default regional settings - closeText: 'Done', // Display text for close link - prevText: 'Prev', // Display text for previous month link - nextText: 'Next', // Display text for next month link - currentText: 'Today', // Display text for current month link - monthNames: ['January','February','March','April','May','June', - 'July','August','September','October','November','December'], // Names of months for drop-down and formatting - monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting - dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting - dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting - dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday - weekHeader: 'Wk', // Column header for week of the year - dateFormat: 'mm/dd/yy', // See format options on parseDate - firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... - isRTL: false, // True if right-to-left language, false if left-to-right - showMonthAfterYear: false, // True if the year select precedes month, false for month then year - yearSuffix: '' // Additional text to append to the year in the month headers - }; - this._defaults = { // Global defaults for all the date picker instances - showOn: 'focus', // 'focus' for popup on focus, - // 'button' for trigger button, or 'both' for either - showAnim: 'fadeIn', // Name of jQuery animation for popup - showOptions: {}, // Options for enhanced animations - defaultDate: null, // Used when field is blank: actual date, - // +/-number for offset from today, null for today - appendText: '', // Display text following the input box, e.g. showing the format - buttonText: '...', // Text for trigger button - buttonImage: '', // URL for trigger button image - buttonImageOnly: false, // True if the image appears alone, false if it appears on a button - hideIfNoPrevNext: false, // True to hide next/previous month links - // if not applicable, false to just disable them - navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links - gotoCurrent: false, // True if today link goes back to current selection instead - changeMonth: false, // True if month can be selected directly, false if only prev/next - changeYear: false, // True if year can be selected directly, false if only prev/next - yearRange: 'c-10:c+10', // Range of years to display in drop-down, - // either relative to today's year (-nn:+nn), relative to currently displayed year - // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) - showOtherMonths: false, // True to show dates in other months, false to leave blank - selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable - showWeek: false, // True to show week of the year, false to not show it - calculateWeek: this.iso8601Week, // How to calculate the week of the year, - // takes a Date and returns the number of the week for it - shortYearCutoff: '+10', // Short year values < this are in the current century, - // > this are in the previous century, - // string value starting with '+' for current year + value - minDate: null, // The earliest selectable date, or null for no limit - maxDate: null, // The latest selectable date, or null for no limit - duration: 'fast', // Duration of display/closure - beforeShowDay: null, // Function that takes a date and returns an array with - // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '', - // [2] = cell title (optional), e.g. $.datepicker.noWeekends - beforeShow: null, // Function that takes an input field and - // returns a set of custom settings for the date picker - onSelect: null, // Define a callback function when a date is selected - onChangeMonthYear: null, // Define a callback function when the month or year is changed - onClose: null, // Define a callback function when the datepicker is closed - numberOfMonths: 1, // Number of months to show at a time - showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) - stepMonths: 1, // Number of months to step back/forward - stepBigMonths: 12, // Number of months to step back/forward for the big links - altField: '', // Selector for an alternate field to store selected dates into - altFormat: '', // The date format to use for the alternate field - constrainInput: true, // The input is constrained by the current date format - showButtonPanel: false, // True to show button panel, false to not show it - autoSize: false // True to size the input for the date format, false to leave as is - }; - $.extend(this._defaults, this.regional['']); - this.dpDiv = $('
    '); -} - -$.extend(Datepicker.prototype, { - /* Class name added to elements to indicate already configured with a date picker. */ - markerClassName: 'hasDatepicker', - - /* Debug logging (if enabled). */ - log: function () { - if (this.debug) - console.log.apply('', arguments); - }, - - // TODO rename to "widget" when switching to widget factory - _widgetDatepicker: function() { - return this.dpDiv; - }, - - /* Override the default settings for all instances of the date picker. - @param settings object - the new settings to use as defaults (anonymous object) - @return the manager object */ - setDefaults: function(settings) { - extendRemove(this._defaults, settings || {}); - return this; - }, - - /* Attach the date picker to a jQuery selection. - @param target element - the target input field or division or span - @param settings object - the new settings to use for this date picker instance (anonymous) */ - _attachDatepicker: function(target, settings) { - // check for settings on the control itself - in namespace 'date:' - var inlineSettings = null; - for (var attrName in this._defaults) { - var attrValue = target.getAttribute('date:' + attrName); - if (attrValue) { - inlineSettings = inlineSettings || {}; - try { - inlineSettings[attrName] = eval(attrValue); - } catch (err) { - inlineSettings[attrName] = attrValue; - } - } - } - var nodeName = target.nodeName.toLowerCase(); - var inline = (nodeName == 'div' || nodeName == 'span'); - if (!target.id) { - this.uuid += 1; - target.id = 'dp' + this.uuid; - } - var inst = this._newInst($(target), inline); - inst.settings = $.extend({}, settings || {}, inlineSettings || {}); - if (nodeName == 'input') { - this._connectDatepicker(target, inst); - } else if (inline) { - this._inlineDatepicker(target, inst); - } - }, - - /* Create a new instance object. */ - _newInst: function(target, inline) { - var id = target[0].id.replace(/([^A-Za-z0-9_])/g, '\\\\$1'); // escape jQuery meta chars - return {id: id, input: target, // associated target - selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection - drawMonth: 0, drawYear: 0, // month being drawn - inline: inline, // is datepicker inline or not - dpDiv: (!inline ? this.dpDiv : // presentation div - $('
    '))}; - }, - - /* Attach the date picker to an input field. */ - _connectDatepicker: function(target, inst) { - var input = $(target); - inst.append = $([]); - inst.trigger = $([]); - if (input.hasClass(this.markerClassName)) - return; - this._attachments(input, inst); - input.addClass(this.markerClassName).keydown(this._doKeyDown). - keypress(this._doKeyPress).keyup(this._doKeyUp). - bind("setData.datepicker", function(event, key, value) { - inst.settings[key] = value; - }).bind("getData.datepicker", function(event, key) { - return this._get(inst, key); - }); - this._autoSize(inst); - $.data(target, PROP_NAME, inst); - }, - - /* Make attachments based on settings. */ - _attachments: function(input, inst) { - var appendText = this._get(inst, 'appendText'); - var isRTL = this._get(inst, 'isRTL'); - if (inst.append) - inst.append.remove(); - if (appendText) { - inst.append = $('' + appendText + ''); - input[isRTL ? 'before' : 'after'](inst.append); - } - input.unbind('focus', this._showDatepicker); - if (inst.trigger) - inst.trigger.remove(); - var showOn = this._get(inst, 'showOn'); - if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field - input.focus(this._showDatepicker); - if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked - var buttonText = this._get(inst, 'buttonText'); - var buttonImage = this._get(inst, 'buttonImage'); - inst.trigger = $(this._get(inst, 'buttonImageOnly') ? - $('').addClass(this._triggerClass). - attr({ src: buttonImage, alt: buttonText, title: buttonText }) : - $('').addClass(this._triggerClass). - html(buttonImage == '' ? buttonText : $('').attr( - { src:buttonImage, alt:buttonText, title:buttonText }))); - input[isRTL ? 'before' : 'after'](inst.trigger); - inst.trigger.click(function() { - if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0]) - $.datepicker._hideDatepicker(); - else - $.datepicker._showDatepicker(input[0]); - return false; - }); - } - }, - - /* Apply the maximum length for the date format. */ - _autoSize: function(inst) { - if (this._get(inst, 'autoSize') && !inst.inline) { - var date = new Date(2009, 12 - 1, 20); // Ensure double digits - var dateFormat = this._get(inst, 'dateFormat'); - if (dateFormat.match(/[DM]/)) { - var findMax = function(names) { - var max = 0; - var maxI = 0; - for (var i = 0; i < names.length; i++) { - if (names[i].length > max) { - max = names[i].length; - maxI = i; - } - } - return maxI; - }; - date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ? - 'monthNames' : 'monthNamesShort')))); - date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ? - 'dayNames' : 'dayNamesShort'))) + 20 - date.getDay()); - } - inst.input.attr('size', this._formatDate(inst, date).length); - } - }, - - /* Attach an inline date picker to a div. */ - _inlineDatepicker: function(target, inst) { - var divSpan = $(target); - if (divSpan.hasClass(this.markerClassName)) - return; - divSpan.addClass(this.markerClassName).append(inst.dpDiv). - bind("setData.datepicker", function(event, key, value){ - inst.settings[key] = value; - }).bind("getData.datepicker", function(event, key){ - return this._get(inst, key); - }); - $.data(target, PROP_NAME, inst); - this._setDate(inst, this._getDefaultDate(inst), true); - this._updateDatepicker(inst); - this._updateAlternate(inst); - }, - - /* Pop-up the date picker in a "dialog" box. - @param input element - ignored - @param date string or Date - the initial date to display - @param onSelect function - the function to call when a date is selected - @param settings object - update the dialog date picker instance's settings (anonymous object) - @param pos int[2] - coordinates for the dialog's position within the screen or - event - with x/y coordinates or - leave empty for default (screen centre) - @return the manager object */ - _dialogDatepicker: function(input, date, onSelect, settings, pos) { - var inst = this._dialogInst; // internal instance - if (!inst) { - this.uuid += 1; - var id = 'dp' + this.uuid; - this._dialogInput = $(''); - this._dialogInput.keydown(this._doKeyDown); - $('body').append(this._dialogInput); - inst = this._dialogInst = this._newInst(this._dialogInput, false); - inst.settings = {}; - $.data(this._dialogInput[0], PROP_NAME, inst); - } - extendRemove(inst.settings, settings || {}); - date = (date && date.constructor == Date ? this._formatDate(inst, date) : date); - this._dialogInput.val(date); - - this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null); - if (!this._pos) { - var browserWidth = document.documentElement.clientWidth; - var browserHeight = document.documentElement.clientHeight; - var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; - var scrollY = document.documentElement.scrollTop || document.body.scrollTop; - this._pos = // should use actual width/height below - [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY]; - } - - // move input on screen for focus, but hidden behind dialog - this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px'); - inst.settings.onSelect = onSelect; - this._inDialog = true; - this.dpDiv.addClass(this._dialogClass); - this._showDatepicker(this._dialogInput[0]); - if ($.blockUI) - $.blockUI(this.dpDiv); - $.data(this._dialogInput[0], PROP_NAME, inst); - return this; - }, - - /* Detach a datepicker from its control. - @param target element - the target input field or division or span */ - _destroyDatepicker: function(target) { - var $target = $(target); - var inst = $.data(target, PROP_NAME); - if (!$target.hasClass(this.markerClassName)) { - return; - } - var nodeName = target.nodeName.toLowerCase(); - $.removeData(target, PROP_NAME); - if (nodeName == 'input') { - inst.append.remove(); - inst.trigger.remove(); - $target.removeClass(this.markerClassName). - unbind('focus', this._showDatepicker). - unbind('keydown', this._doKeyDown). - unbind('keypress', this._doKeyPress). - unbind('keyup', this._doKeyUp); - } else if (nodeName == 'div' || nodeName == 'span') - $target.removeClass(this.markerClassName).empty(); - }, - - /* Enable the date picker to a jQuery selection. - @param target element - the target input field or division or span */ - _enableDatepicker: function(target) { - var $target = $(target); - var inst = $.data(target, PROP_NAME); - if (!$target.hasClass(this.markerClassName)) { - return; - } - var nodeName = target.nodeName.toLowerCase(); - if (nodeName == 'input') { - target.disabled = false; - inst.trigger.filter('button'). - each(function() { this.disabled = false; }).end(). - filter('img').css({opacity: '1.0', cursor: ''}); - } - else if (nodeName == 'div' || nodeName == 'span') { - var inline = $target.children('.' + this._inlineClass); - inline.children().removeClass('ui-state-disabled'); - } - this._disabledInputs = $.map(this._disabledInputs, - function(value) { return (value == target ? null : value); }); // delete entry - }, - - /* Disable the date picker to a jQuery selection. - @param target element - the target input field or division or span */ - _disableDatepicker: function(target) { - var $target = $(target); - var inst = $.data(target, PROP_NAME); - if (!$target.hasClass(this.markerClassName)) { - return; - } - var nodeName = target.nodeName.toLowerCase(); - if (nodeName == 'input') { - target.disabled = true; - inst.trigger.filter('button'). - each(function() { this.disabled = true; }).end(). - filter('img').css({opacity: '0.5', cursor: 'default'}); - } - else if (nodeName == 'div' || nodeName == 'span') { - var inline = $target.children('.' + this._inlineClass); - inline.children().addClass('ui-state-disabled'); - } - this._disabledInputs = $.map(this._disabledInputs, - function(value) { return (value == target ? null : value); }); // delete entry - this._disabledInputs[this._disabledInputs.length] = target; - }, - - /* Is the first field in a jQuery collection disabled as a datepicker? - @param target element - the target input field or division or span - @return boolean - true if disabled, false if enabled */ - _isDisabledDatepicker: function(target) { - if (!target) { - return false; - } - for (var i = 0; i < this._disabledInputs.length; i++) { - if (this._disabledInputs[i] == target) - return true; - } - return false; - }, - - /* Retrieve the instance data for the target control. - @param target element - the target input field or division or span - @return object - the associated instance data - @throws error if a jQuery problem getting data */ - _getInst: function(target) { - try { - return $.data(target, PROP_NAME); - } - catch (err) { - throw 'Missing instance data for this datepicker'; - } - }, - - /* Update or retrieve the settings for a date picker attached to an input field or division. - @param target element - the target input field or division or span - @param name object - the new settings to update or - string - the name of the setting to change or retrieve, - when retrieving also 'all' for all instance settings or - 'defaults' for all global defaults - @param value any - the new value for the setting - (omit if above is an object or to retrieve a value) */ - _optionDatepicker: function(target, name, value) { - var inst = this._getInst(target); - if (arguments.length == 2 && typeof name == 'string') { - return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) : - (inst ? (name == 'all' ? $.extend({}, inst.settings) : - this._get(inst, name)) : null)); - } - var settings = name || {}; - if (typeof name == 'string') { - settings = {}; - settings[name] = value; - } - if (inst) { - if (this._curInst == inst) { - this._hideDatepicker(); - } - var date = this._getDateDatepicker(target, true); - extendRemove(inst.settings, settings); - this._attachments($(target), inst); - this._autoSize(inst); - this._setDateDatepicker(target, date); - this._updateDatepicker(inst); - } - }, - - // change method deprecated - _changeDatepicker: function(target, name, value) { - this._optionDatepicker(target, name, value); - }, - - /* Redraw the date picker attached to an input field or division. - @param target element - the target input field or division or span */ - _refreshDatepicker: function(target) { - var inst = this._getInst(target); - if (inst) { - this._updateDatepicker(inst); - } - }, - - /* Set the dates for a jQuery selection. - @param target element - the target input field or division or span - @param date Date - the new date */ - _setDateDatepicker: function(target, date) { - var inst = this._getInst(target); - if (inst) { - this._setDate(inst, date); - this._updateDatepicker(inst); - this._updateAlternate(inst); - } - }, - - /* Get the date(s) for the first entry in a jQuery selection. - @param target element - the target input field or division or span - @param noDefault boolean - true if no default date is to be used - @return Date - the current date */ - _getDateDatepicker: function(target, noDefault) { - var inst = this._getInst(target); - if (inst && !inst.inline) - this._setDateFromField(inst, noDefault); - return (inst ? this._getDate(inst) : null); - }, - - /* Handle keystrokes. */ - _doKeyDown: function(event) { - var inst = $.datepicker._getInst(event.target); - var handled = true; - var isRTL = inst.dpDiv.is('.ui-datepicker-rtl'); - inst._keyEvent = true; - if ($.datepicker._datepickerShowing) - switch (event.keyCode) { - case 9: $.datepicker._hideDatepicker(); - handled = false; - break; // hide on tab out - case 13: var sel = $('td.' + $.datepicker._dayOverClass, inst.dpDiv). - add($('td.' + $.datepicker._currentClass, inst.dpDiv)); - if (sel[0]) - $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); - else - $.datepicker._hideDatepicker(); - return false; // don't submit the form - break; // select the value on enter - case 27: $.datepicker._hideDatepicker(); - break; // hide on escape - case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ? - -$.datepicker._get(inst, 'stepBigMonths') : - -$.datepicker._get(inst, 'stepMonths')), 'M'); - break; // previous month/year on page up/+ ctrl - case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ? - +$.datepicker._get(inst, 'stepBigMonths') : - +$.datepicker._get(inst, 'stepMonths')), 'M'); - break; // next month/year on page down/+ ctrl - case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target); - handled = event.ctrlKey || event.metaKey; - break; // clear on ctrl or command +end - case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target); - handled = event.ctrlKey || event.metaKey; - break; // current on ctrl or command +home - case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D'); - handled = event.ctrlKey || event.metaKey; - // -1 day on ctrl or command +left - if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ? - -$.datepicker._get(inst, 'stepBigMonths') : - -$.datepicker._get(inst, 'stepMonths')), 'M'); - // next month/year on alt +left on Mac - break; - case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D'); - handled = event.ctrlKey || event.metaKey; - break; // -1 week on ctrl or command +up - case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D'); - handled = event.ctrlKey || event.metaKey; - // +1 day on ctrl or command +right - if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ? - +$.datepicker._get(inst, 'stepBigMonths') : - +$.datepicker._get(inst, 'stepMonths')), 'M'); - // next month/year on alt +right - break; - case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D'); - handled = event.ctrlKey || event.metaKey; - break; // +1 week on ctrl or command +down - default: handled = false; - } - else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home - $.datepicker._showDatepicker(this); - else { - handled = false; - } - if (handled) { - event.preventDefault(); - event.stopPropagation(); - } - }, - - /* Filter entered characters - based on date format. */ - _doKeyPress: function(event) { - var inst = $.datepicker._getInst(event.target); - if ($.datepicker._get(inst, 'constrainInput')) { - var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')); - var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode); - return event.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1); - } - }, - - /* Synchronise manual entry and field/alternate field. */ - _doKeyUp: function(event) { - var inst = $.datepicker._getInst(event.target); - if (inst.input.val() != inst.lastVal) { - try { - var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'), - (inst.input ? inst.input.val() : null), - $.datepicker._getFormatConfig(inst)); - if (date) { // only if valid - $.datepicker._setDateFromField(inst); - $.datepicker._updateAlternate(inst); - $.datepicker._updateDatepicker(inst); - } - } - catch (event) { - $.datepicker.log(event); - } - } - return true; - }, - - /* Pop-up the date picker for a given input field. - @param input element - the input field attached to the date picker or - event - if triggered by focus */ - _showDatepicker: function(input) { - input = input.target || input; - if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger - input = $('input', input.parentNode)[0]; - if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here - return; - var inst = $.datepicker._getInst(input); - if ($.datepicker._curInst && $.datepicker._curInst != inst) { - $.datepicker._curInst.dpDiv.stop(true, true); - } - var beforeShow = $.datepicker._get(inst, 'beforeShow'); - extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {})); - inst.lastVal = null; - $.datepicker._lastInput = input; - $.datepicker._setDateFromField(inst); - if ($.datepicker._inDialog) // hide cursor - input.value = ''; - if (!$.datepicker._pos) { // position below input - $.datepicker._pos = $.datepicker._findPos(input); - $.datepicker._pos[1] += input.offsetHeight; // add the height - } - var isFixed = false; - $(input).parents().each(function() { - isFixed |= $(this).css('position') == 'fixed'; - return !isFixed; - }); - if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled - $.datepicker._pos[0] -= document.documentElement.scrollLeft; - $.datepicker._pos[1] -= document.documentElement.scrollTop; - } - var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]}; - $.datepicker._pos = null; - // determine sizing offscreen - inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'}); - $.datepicker._updateDatepicker(inst); - // fix width for dynamic number of date pickers - // and adjust position before showing - offset = $.datepicker._checkOffset(inst, offset, isFixed); - inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ? - 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none', - left: offset.left + 'px', top: offset.top + 'px'}); - if (!inst.inline) { - var showAnim = $.datepicker._get(inst, 'showAnim'); - var duration = $.datepicker._get(inst, 'duration'); - var postProcess = function() { - $.datepicker._datepickerShowing = true; - var borders = $.datepicker._getBorders(inst.dpDiv); - inst.dpDiv.find('iframe.ui-datepicker-cover'). // IE6- only - css({left: -borders[0], top: -borders[1], - width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()}); - }; - inst.dpDiv.zIndex($(input).zIndex()+1); - if ($.effects && $.effects[showAnim]) - inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); - else - inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess); - if (!showAnim || !duration) - postProcess(); - if (inst.input.is(':visible') && !inst.input.is(':disabled')) - inst.input.focus(); - $.datepicker._curInst = inst; - } - }, - - /* Generate the date picker content. */ - _updateDatepicker: function(inst) { - var self = this; - var borders = $.datepicker._getBorders(inst.dpDiv); - inst.dpDiv.empty().append(this._generateHTML(inst)) - .find('iframe.ui-datepicker-cover') // IE6- only - .css({left: -borders[0], top: -borders[1], - width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()}) - .end() - .find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a') - .bind('mouseout', function(){ - $(this).removeClass('ui-state-hover'); - if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover'); - if(this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover'); - }) - .bind('mouseover', function(){ - if (!self._isDisabledDatepicker( inst.inline ? inst.dpDiv.parent()[0] : inst.input[0])) { - $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover'); - $(this).addClass('ui-state-hover'); - if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover'); - if(this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover'); - } - }) - .end() - .find('.' + this._dayOverClass + ' a') - .trigger('mouseover') - .end(); - var numMonths = this._getNumberOfMonths(inst); - var cols = numMonths[1]; - var width = 17; - if (cols > 1) - inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em'); - else - inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width(''); - inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') + - 'Class']('ui-datepicker-multi'); - inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') + - 'Class']('ui-datepicker-rtl'); - if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input && - inst.input.is(':visible') && !inst.input.is(':disabled')) - inst.input.focus(); - }, - - /* Retrieve the size of left and top borders for an element. - @param elem (jQuery object) the element of interest - @return (number[2]) the left and top borders */ - _getBorders: function(elem) { - var convert = function(value) { - return {thin: 1, medium: 2, thick: 3}[value] || value; - }; - return [parseFloat(convert(elem.css('border-left-width'))), - parseFloat(convert(elem.css('border-top-width')))]; - }, - - /* Check positioning to remain on screen. */ - _checkOffset: function(inst, offset, isFixed) { - var dpWidth = inst.dpDiv.outerWidth(); - var dpHeight = inst.dpDiv.outerHeight(); - var inputWidth = inst.input ? inst.input.outerWidth() : 0; - var inputHeight = inst.input ? inst.input.outerHeight() : 0; - var viewWidth = document.documentElement.clientWidth + $(document).scrollLeft(); - var viewHeight = document.documentElement.clientHeight + $(document).scrollTop(); - - offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0); - offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0; - offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; - - // now check if datepicker is showing outside window viewport - move to a better place if so. - offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? - Math.abs(offset.left + dpWidth - viewWidth) : 0); - offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? - Math.abs(dpHeight + inputHeight) : 0); - - return offset; - }, - - /* Find an object's position on the screen. */ - _findPos: function(obj) { - var inst = this._getInst(obj); - var isRTL = this._get(inst, 'isRTL'); - while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) { - obj = obj[isRTL ? 'previousSibling' : 'nextSibling']; - } - var position = $(obj).offset(); - return [position.left, position.top]; - }, - - /* Hide the date picker from view. - @param input element - the input field attached to the date picker */ - _hideDatepicker: function(input) { - var inst = this._curInst; - if (!inst || (input && inst != $.data(input, PROP_NAME))) - return; - if (this._datepickerShowing) { - var showAnim = this._get(inst, 'showAnim'); - var duration = this._get(inst, 'duration'); - var postProcess = function() { - $.datepicker._tidyDialog(inst); - this._curInst = null; - }; - if ($.effects && $.effects[showAnim]) - inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); - else - inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' : - (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess); - if (!showAnim) - postProcess(); - var onClose = this._get(inst, 'onClose'); - if (onClose) - onClose.apply((inst.input ? inst.input[0] : null), - [(inst.input ? inst.input.val() : ''), inst]); // trigger custom callback - this._datepickerShowing = false; - this._lastInput = null; - if (this._inDialog) { - this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' }); - if ($.blockUI) { - $.unblockUI(); - $('body').append(this.dpDiv); - } - } - this._inDialog = false; - } - }, - - /* Tidy up after a dialog display. */ - _tidyDialog: function(inst) { - inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar'); - }, - - /* Close date picker if clicked elsewhere. */ - _checkExternalClick: function(event) { - if (!$.datepicker._curInst) - return; - var $target = $(event.target); - if ($target[0].id != $.datepicker._mainDivId && - $target.parents('#' + $.datepicker._mainDivId).length == 0 && - !$target.hasClass($.datepicker.markerClassName) && - !$target.hasClass($.datepicker._triggerClass) && - $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI)) - $.datepicker._hideDatepicker(); - }, - - /* Adjust one of the date sub-fields. */ - _adjustDate: function(id, offset, period) { - var target = $(id); - var inst = this._getInst(target[0]); - if (this._isDisabledDatepicker(target[0])) { - return; - } - this._adjustInstDate(inst, offset + - (period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning - period); - this._updateDatepicker(inst); - }, - - /* Action for current link. */ - _gotoToday: function(id) { - var target = $(id); - var inst = this._getInst(target[0]); - if (this._get(inst, 'gotoCurrent') && inst.currentDay) { - inst.selectedDay = inst.currentDay; - inst.drawMonth = inst.selectedMonth = inst.currentMonth; - inst.drawYear = inst.selectedYear = inst.currentYear; - } - else { - var date = new Date(); - inst.selectedDay = date.getDate(); - inst.drawMonth = inst.selectedMonth = date.getMonth(); - inst.drawYear = inst.selectedYear = date.getFullYear(); - } - this._notifyChange(inst); - this._adjustDate(target); - }, - - /* Action for selecting a new month/year. */ - _selectMonthYear: function(id, select, period) { - var target = $(id); - var inst = this._getInst(target[0]); - inst._selectingMonthYear = false; - inst['selected' + (period == 'M' ? 'Month' : 'Year')] = - inst['draw' + (period == 'M' ? 'Month' : 'Year')] = - parseInt(select.options[select.selectedIndex].value,10); - this._notifyChange(inst); - this._adjustDate(target); - }, - - /* Restore input focus after not changing month/year. */ - _clickMonthYear: function(id) { - var target = $(id); - var inst = this._getInst(target[0]); - if (inst.input && inst._selectingMonthYear) { - setTimeout(function() { - inst.input.focus(); - }, 0); - } - inst._selectingMonthYear = !inst._selectingMonthYear; - }, - - /* Action for selecting a day. */ - _selectDay: function(id, month, year, td) { - var target = $(id); - if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) { - return; - } - var inst = this._getInst(target[0]); - inst.selectedDay = inst.currentDay = $('a', td).html(); - inst.selectedMonth = inst.currentMonth = month; - inst.selectedYear = inst.currentYear = year; - this._selectDate(id, this._formatDate(inst, - inst.currentDay, inst.currentMonth, inst.currentYear)); - }, - - /* Erase the input field and hide the date picker. */ - _clearDate: function(id) { - var target = $(id); - var inst = this._getInst(target[0]); - this._selectDate(target, ''); - }, - - /* Update the input field with the selected date. */ - _selectDate: function(id, dateStr) { - var target = $(id); - var inst = this._getInst(target[0]); - dateStr = (dateStr != null ? dateStr : this._formatDate(inst)); - if (inst.input) - inst.input.val(inst.input.val()+dateStr); - this._updateAlternate(inst); - var onSelect = this._get(inst, 'onSelect'); - if (onSelect) - onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback - else if (inst.input) - inst.input.trigger('change'); // fire the change event - if (inst.inline) - this._updateDatepicker(inst); - else { - this._hideDatepicker(); - this._lastInput = inst.input[0]; - if (typeof(inst.input[0]) != 'object') - inst.input.focus(); // restore focus - this._lastInput = null; - } - }, - - /* Update any alternate field to synchronise with the main field. */ - _updateAlternate: function(inst) { - var altField = this._get(inst, 'altField'); - if (altField) { // update alternate field too - var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat'); - var date = this._getDate(inst); - var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); - $(altField).each(function() { $(this).val(dateStr); }); - } - }, - - /* Set as beforeShowDay function to prevent selection of weekends. - @param date Date - the date to customise - @return [boolean, string] - is this date selectable?, what is its CSS class? */ - noWeekends: function(date) { - var day = date.getDay(); - return [(day > 0 && day < 6), '']; - }, - - /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. - @param date Date - the date to get the week for - @return number - the number of the week within the year that contains this date */ - iso8601Week: function(date) { - var checkDate = new Date(date.getTime()); - // Find Thursday of this week starting on Monday - checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); - var time = checkDate.getTime(); - checkDate.setMonth(0); // Compare with Jan 1 - checkDate.setDate(1); - return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; - }, - - /* Parse a string value into a date object. - See formatDate below for the possible formats. - - @param format string - the expected format of the date - @param value string - the date in the above format - @param settings Object - attributes include: - shortYearCutoff number - the cutoff year for determining the century (optional) - dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) - dayNames string[7] - names of the days from Sunday (optional) - monthNamesShort string[12] - abbreviated names of the months (optional) - monthNames string[12] - names of the months (optional) - @return Date - the extracted date value or null if value is blank */ - parseDate: function (format, value, settings) { - if (format == null || value == null) - throw 'Invalid arguments'; - value = (typeof value == 'object' ? value.toString() : value + ''); - if (value == '') - return null; - var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff; - var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; - var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; - var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; - var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; - var year = -1; - var month = -1; - var day = -1; - var doy = -1; - var literal = false; - // Check whether a format character is doubled - var lookAhead = function(match) { - var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); - if (matches) - iFormat++; - return matches; - }; - // Extract a number from the string value - var getNumber = function(match) { - lookAhead(match); - var size = (match == '@' ? 14 : (match == '!' ? 20 : - (match == 'y' ? 4 : (match == 'o' ? 3 : 2)))); - var digits = new RegExp('^\\d{1,' + size + '}'); - var num = value.substring(iValue).match(digits); - if (!num) - throw 'Missing number at position ' + iValue; - iValue += num[0].length; - return parseInt(num[0], 10); - }; - // Extract a name from the string value and convert to an index - var getName = function(match, shortNames, longNames) { - var names = (lookAhead(match) ? longNames : shortNames); - for (var i = 0; i < names.length; i++) { - if (value.substr(iValue, names[i].length) == names[i]) { - iValue += names[i].length; - return i + 1; - } - } - throw 'Unknown name at position ' + iValue; - }; - // Confirm that a literal character matches the string value - var checkLiteral = function() { - if (value.charAt(iValue) != format.charAt(iFormat)) - throw 'Unexpected literal at position ' + iValue; - iValue++; - }; - var iValue = 0; - for (var iFormat = 0; iFormat < format.length; iFormat++) { - if (literal) - if (format.charAt(iFormat) == "'" && !lookAhead("'")) - literal = false; - else - checkLiteral(); - else - switch (format.charAt(iFormat)) { - case 'd': - day = getNumber('d'); - break; - case 'D': - getName('D', dayNamesShort, dayNames); - break; - case 'o': - doy = getNumber('o'); - break; - case 'm': - month = getNumber('m'); - break; - case 'M': - month = getName('M', monthNamesShort, monthNames); - break; - case 'y': - year = getNumber('y'); - break; - case '@': - var date = new Date(getNumber('@')); - year = date.getFullYear(); - month = date.getMonth() + 1; - day = date.getDate(); - break; - case '!': - var date = new Date((getNumber('!') - this._ticksTo1970) / 10000); - year = date.getFullYear(); - month = date.getMonth() + 1; - day = date.getDate(); - break; - case "'": - if (lookAhead("'")) - checkLiteral(); - else - literal = true; - break; - default: - checkLiteral(); - } - } - if (year == -1) - year = new Date().getFullYear(); - else if (year < 100) - year += new Date().getFullYear() - new Date().getFullYear() % 100 + - (year <= shortYearCutoff ? 0 : -100); - if (doy > -1) { - month = 1; - day = doy; - do { - var dim = this._getDaysInMonth(year, month - 1); - if (day <= dim) - break; - month++; - day -= dim; - } while (true); - } - var date = this._daylightSavingAdjust(new Date(year, month - 1, day)); - if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day) - throw 'Invalid date'; // E.g. 31/02/* - return date; - }, - - /* Standard date formats. */ - ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601) - COOKIE: 'D, dd M yy', - ISO_8601: 'yy-mm-dd', - RFC_822: 'D, d M y', - RFC_850: 'DD, dd-M-y', - RFC_1036: 'D, d M y', - RFC_1123: 'D, d M yy', - RFC_2822: 'D, d M yy', - RSS: 'D, d M y', // RFC 822 - TICKS: '!', - TIMESTAMP: '@', - W3C: 'yy-mm-dd', // ISO 8601 - - _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + - Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000), - - /* Format a date object into a string value. - The format can be combinations of the following: - d - day of month (no leading zero) - dd - day of month (two digit) - o - day of year (no leading zeros) - oo - day of year (three digit) - D - day name short - DD - day name long - m - month of year (no leading zero) - mm - month of year (two digit) - M - month name short - MM - month name long - y - year (two digit) - yy - year (four digit) - @ - Unix timestamp (ms since 01/01/1970) - ! - Windows ticks (100ns since 01/01/0001) - '...' - literal text - '' - single quote - - @param format string - the desired format of the date - @param date Date - the date value to format - @param settings Object - attributes include: - dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) - dayNames string[7] - names of the days from Sunday (optional) - monthNamesShort string[12] - abbreviated names of the months (optional) - monthNames string[12] - names of the months (optional) - @return string - the date in the above format */ - formatDate: function (format, date, settings) { - if (!date) - return ''; - var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; - var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; - var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; - var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; - // Check whether a format character is doubled - var lookAhead = function(match) { - var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); - if (matches) - iFormat++; - return matches; - }; - // Format a number, with leading zero if necessary - var formatNumber = function(match, value, len) { - var num = '' + value; - if (lookAhead(match)) - while (num.length < len) - num = '0' + num; - return num; - }; - // Format a name, short or long as requested - var formatName = function(match, value, shortNames, longNames) { - return (lookAhead(match) ? longNames[value] : shortNames[value]); - }; - var output = ''; - var literal = false; - if (date) - for (var iFormat = 0; iFormat < format.length; iFormat++) { - if (literal) - if (format.charAt(iFormat) == "'" && !lookAhead("'")) - literal = false; - else - output += format.charAt(iFormat); - else - switch (format.charAt(iFormat)) { - case 'd': - output += formatNumber('d', date.getDate(), 2); - break; - case 'D': - output += formatName('D', date.getDay(), dayNamesShort, dayNames); - break; - case 'o': - output += formatNumber('o', - (date.getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000, 3); - break; - case 'm': - output += formatNumber('m', date.getMonth() + 1, 2); - break; - case 'M': - output += formatName('M', date.getMonth(), monthNamesShort, monthNames); - break; - case 'y': - output += (lookAhead('y') ? date.getFullYear() : - (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100); - break; - case '@': - output += date.getTime(); - break; - case '!': - output += date.getTime() * 10000 + this._ticksTo1970; - break; - case "'": - if (lookAhead("'")) - output += "'"; - else - literal = true; - break; - default: - output += format.charAt(iFormat); - } - } - return output; - }, - - /* Extract all possible characters from the date format. */ - _possibleChars: function (format) { - var chars = ''; - var literal = false; - // Check whether a format character is doubled - var lookAhead = function(match) { - var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); - if (matches) - iFormat++; - return matches; - }; - for (var iFormat = 0; iFormat < format.length; iFormat++) - if (literal) - if (format.charAt(iFormat) == "'" && !lookAhead("'")) - literal = false; - else - chars += format.charAt(iFormat); - else - switch (format.charAt(iFormat)) { - case 'd': case 'm': case 'y': case '@': - chars += '0123456789'; - break; - case 'D': case 'M': - return null; // Accept anything - case "'": - if (lookAhead("'")) - chars += "'"; - else - literal = true; - break; - default: - chars += format.charAt(iFormat); - } - return chars; - }, - - /* Get a setting value, defaulting if necessary. */ - _get: function(inst, name) { - return inst.settings[name] !== undefined ? - inst.settings[name] : this._defaults[name]; - }, - - /* Parse existing date and initialise date picker. */ - _setDateFromField: function(inst, noDefault) { - if (inst.input.val() == inst.lastVal) { - return; - } - var dateFormat = this._get(inst, 'dateFormat'); - var dates = inst.lastVal = inst.input ? inst.input.val() : null; - var date, defaultDate; - date = defaultDate = this._getDefaultDate(inst); - var settings = this._getFormatConfig(inst); - try { - date = this.parseDate(dateFormat, dates, settings) || defaultDate; - } catch (event) { - this.log(event); - dates = (noDefault ? '' : dates); - } - inst.selectedDay = date.getDate(); - inst.drawMonth = inst.selectedMonth = date.getMonth(); - inst.drawYear = inst.selectedYear = date.getFullYear(); - inst.currentDay = (dates ? date.getDate() : 0); - inst.currentMonth = (dates ? date.getMonth() : 0); - inst.currentYear = (dates ? date.getFullYear() : 0); - this._adjustInstDate(inst); - }, - - /* Retrieve the default date shown on opening. */ - _getDefaultDate: function(inst) { - return this._restrictMinMax(inst, - this._determineDate(inst, this._get(inst, 'defaultDate'), new Date())); - }, - - /* A date may be specified as an exact value or a relative one. */ - _determineDate: function(inst, date, defaultDate) { - var offsetNumeric = function(offset) { - var date = new Date(); - date.setDate(date.getDate() + offset); - return date; - }; - var offsetString = function(offset) { - try { - return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'), - offset, $.datepicker._getFormatConfig(inst)); - } - catch (e) { - // Ignore - } - var date = (offset.toLowerCase().match(/^c/) ? - $.datepicker._getDate(inst) : null) || new Date(); - var year = date.getFullYear(); - var month = date.getMonth(); - var day = date.getDate(); - var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g; - var matches = pattern.exec(offset); - while (matches) { - switch (matches[2] || 'd') { - case 'd' : case 'D' : - day += parseInt(matches[1],10); break; - case 'w' : case 'W' : - day += parseInt(matches[1],10) * 7; break; - case 'm' : case 'M' : - month += parseInt(matches[1],10); - day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); - break; - case 'y': case 'Y' : - year += parseInt(matches[1],10); - day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); - break; - } - matches = pattern.exec(offset); - } - return new Date(year, month, day); - }; - date = (date == null ? defaultDate : (typeof date == 'string' ? offsetString(date) : - (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : date))); - date = (date && date.toString() == 'Invalid Date' ? defaultDate : date); - if (date) { - date.setHours(0); - date.setMinutes(0); - date.setSeconds(0); - date.setMilliseconds(0); - } - return this._daylightSavingAdjust(date); - }, - - /* Handle switch to/from daylight saving. - Hours may be non-zero on daylight saving cut-over: - > 12 when midnight changeover, but then cannot generate - midnight datetime, so jump to 1AM, otherwise reset. - @param date (Date) the date to check - @return (Date) the corrected date */ - _daylightSavingAdjust: function(date) { - if (!date) return null; - date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); - return date; - }, - - /* Set the date(s) directly. */ - _setDate: function(inst, date, noChange) { - var clear = !(date); - var origMonth = inst.selectedMonth; - var origYear = inst.selectedYear; - date = this._restrictMinMax(inst, this._determineDate(inst, date, new Date())); - inst.selectedDay = inst.currentDay = date.getDate(); - inst.drawMonth = inst.selectedMonth = inst.currentMonth = date.getMonth(); - inst.drawYear = inst.selectedYear = inst.currentYear = date.getFullYear(); - if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange) - this._notifyChange(inst); - this._adjustInstDate(inst); - if (inst.input) { - inst.input.val(clear ? '' : this._formatDate(inst)); - } - }, - - /* Retrieve the date(s) directly. */ - _getDate: function(inst) { - var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null : - this._daylightSavingAdjust(new Date( - inst.currentYear, inst.currentMonth, inst.currentDay))); - return startDate; - }, - - /* Generate the HTML for the current state of the date picker. */ - _generateHTML: function(inst) { - var today = new Date(); - today = this._daylightSavingAdjust( - new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time - var isRTL = this._get(inst, 'isRTL'); - var showButtonPanel = this._get(inst, 'showButtonPanel'); - var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext'); - var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat'); - var numMonths = this._getNumberOfMonths(inst); - var showCurrentAtPos = this._get(inst, 'showCurrentAtPos'); - var stepMonths = this._get(inst, 'stepMonths'); - var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1); - var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : - new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); - var minDate = this._getMinMaxDate(inst, 'min'); - var maxDate = this._getMinMaxDate(inst, 'max'); - var drawMonth = inst.drawMonth - showCurrentAtPos; - var drawYear = inst.drawYear; - if (drawMonth < 0) { - drawMonth += 12; - drawYear--; - } - if (maxDate) { - var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), - maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate())); - maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); - while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) { - drawMonth--; - if (drawMonth < 0) { - drawMonth = 11; - drawYear--; - } - } - } - inst.drawMonth = drawMonth; - inst.drawYear = drawYear; - var prevText = this._get(inst, 'prevText'); - prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, - this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), - this._getFormatConfig(inst))); - var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? - '' + prevText + '' : - (hideIfNoPrevNext ? '' : '' + prevText + '')); - var nextText = this._get(inst, 'nextText'); - nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, - this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), - this._getFormatConfig(inst))); - var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? - '' + nextText + '' : - (hideIfNoPrevNext ? '' : '' + nextText + '')); - var currentText = this._get(inst, 'currentText'); - var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today); - currentText = (!navigationAsDateFormat ? currentText : - this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); - var controls = (!inst.inline ? '' : ''); - var buttonPanel = (showButtonPanel) ? '
    ' + (isRTL ? controls : '') + - (this._isInRange(inst, gotoDate) ? '' : '') + (isRTL ? '' : controls) + '
    ' : ''; - var firstDay = parseInt(this._get(inst, 'firstDay'),10); - firstDay = (isNaN(firstDay) ? 0 : firstDay); - var showWeek = this._get(inst, 'showWeek'); - var dayNames = this._get(inst, 'dayNames'); - var dayNamesShort = this._get(inst, 'dayNamesShort'); - var dayNamesMin = this._get(inst, 'dayNamesMin'); - var monthNames = this._get(inst, 'monthNames'); - var monthNamesShort = this._get(inst, 'monthNamesShort'); - var beforeShowDay = this._get(inst, 'beforeShowDay'); - var showOtherMonths = this._get(inst, 'showOtherMonths'); - var selectOtherMonths = this._get(inst, 'selectOtherMonths'); - var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week; - var defaultDate = this._getDefaultDate(inst); - var html = ''; - for (var row = 0; row < numMonths[0]; row++) { - var group = ''; - for (var col = 0; col < numMonths[1]; col++) { - var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); - var cornerClass = ' ui-corner-all'; - var calender = ''; - if (isMultiMonth) { - calender += '
    '; - } - calender += '
    ' + - (/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') + - (/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') + - this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, - row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers - '
    ' + - ''; - var thead = (showWeek ? '' : ''); - for (var dow = 0; dow < 7; dow++) { // days of the week - var day = (dow + firstDay) % 7; - thead += '= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' + - '' + dayNamesMin[day] + ''; - } - calender += thead + ''; - var daysInMonth = this._getDaysInMonth(drawYear, drawMonth); - if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth) - inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); - var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; - var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); // calculate the number of rows to generate - var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); - for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows - calender += ''; - var tbody = (!showWeek ? '' : ''); - for (var dow = 0; dow < 7; dow++) { // create date picker days - var daySettings = (beforeShowDay ? - beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']); - var otherMonth = (printDate.getMonth() != drawMonth); - var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] || - (minDate && printDate < minDate) || (maxDate && printDate > maxDate); - tbody += ''; // display selectable date - printDate.setDate(printDate.getDate() + 1); - printDate = this._daylightSavingAdjust(printDate); - } - calender += tbody + ''; - } - drawMonth++; - if (drawMonth > 11) { - drawMonth = 0; - drawYear++; - } - calender += '
    ' + this._get(inst, 'weekHeader') + '
    ' + - this._get(inst, 'calculateWeek')(printDate) + '' + // actions - (otherMonth && !showOtherMonths ? ' ' : // display for other months - (unselectable ? '' + printDate.getDate() + '' : '' + printDate.getDate() + '')) + '
    ' + (isMultiMonth ? '
    ' + - ((numMonths[0] > 0 && col == numMonths[1]-1) ? '
    ' : '') : ''); - group += calender; - } - html += group; - } - html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ? - '' : ''); - inst._keyEvent = false; - return html; - }, - - /* Generate the month and year header. */ - _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, - secondary, monthNames, monthNamesShort) { - var changeMonth = this._get(inst, 'changeMonth'); - var changeYear = this._get(inst, 'changeYear'); - var showMonthAfterYear = this._get(inst, 'showMonthAfterYear'); - var html = '
    '; - var monthHtml = ''; - // month selection - if (secondary || !changeMonth) - monthHtml += '' + monthNames[drawMonth] + ''; - else { - var inMinYear = (minDate && minDate.getFullYear() == drawYear); - var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear); - monthHtml += ''; - } - if (!showMonthAfterYear) - html += monthHtml + (secondary || !(changeMonth && changeYear) ? ' ' : ''); - // year selection - if (secondary || !changeYear) - html += '' + drawYear + ''; - else { - // determine range of years to display - var years = this._get(inst, 'yearRange').split(':'); - var thisYear = new Date().getFullYear(); - var determineYear = function(value) { - var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) : - (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) : - parseInt(value, 10))); - return (isNaN(year) ? thisYear : year); - }; - var year = determineYear(years[0]); - var endYear = Math.max(year, determineYear(years[1] || '')); - year = (minDate ? Math.max(year, minDate.getFullYear()) : year); - endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); - html += ''; - } - html += this._get(inst, 'yearSuffix'); - if (showMonthAfterYear) - html += (secondary || !(changeMonth && changeYear) ? ' ' : '') + monthHtml; - html += '
    '; // Close datepicker_header - return html; - }, - - /* Adjust one of the date sub-fields. */ - _adjustInstDate: function(inst, offset, period) { - var year = inst.drawYear + (period == 'Y' ? offset : 0); - var month = inst.drawMonth + (period == 'M' ? offset : 0); - var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + - (period == 'D' ? offset : 0); - var date = this._restrictMinMax(inst, - this._daylightSavingAdjust(new Date(year, month, day))); - inst.selectedDay = date.getDate(); - inst.drawMonth = inst.selectedMonth = date.getMonth(); - inst.drawYear = inst.selectedYear = date.getFullYear(); - if (period == 'M' || period == 'Y') - this._notifyChange(inst); - }, - - /* Ensure a date is within any min/max bounds. */ - _restrictMinMax: function(inst, date) { - var minDate = this._getMinMaxDate(inst, 'min'); - var maxDate = this._getMinMaxDate(inst, 'max'); - date = (minDate && date < minDate ? minDate : date); - date = (maxDate && date > maxDate ? maxDate : date); - return date; - }, - - /* Notify change of month/year. */ - _notifyChange: function(inst) { - var onChange = this._get(inst, 'onChangeMonthYear'); - if (onChange) - onChange.apply((inst.input ? inst.input[0] : null), - [inst.selectedYear, inst.selectedMonth + 1, inst]); - }, - - /* Determine the number of months to show. */ - _getNumberOfMonths: function(inst) { - var numMonths = this._get(inst, 'numberOfMonths'); - return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths)); - }, - - /* Determine the current maximum date - ensure no time components are set. */ - _getMinMaxDate: function(inst, minMax) { - return this._determineDate(inst, this._get(inst, minMax + 'Date'), null); - }, - - /* Find the number of days in a given month. */ - _getDaysInMonth: function(year, month) { - return 32 - new Date(year, month, 32).getDate(); - }, - - /* Find the day of the week of the first of a month. */ - _getFirstDayOfMonth: function(year, month) { - return new Date(year, month, 1).getDay(); - }, - - /* Determines if we should allow a "next/prev" month display change. */ - _canAdjustMonth: function(inst, offset, curYear, curMonth) { - var numMonths = this._getNumberOfMonths(inst); - var date = this._daylightSavingAdjust(new Date(curYear, - curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); - if (offset < 0) - date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); - return this._isInRange(inst, date); - }, - - /* Is the given date in the accepted range? */ - _isInRange: function(inst, date) { - var minDate = this._getMinMaxDate(inst, 'min'); - var maxDate = this._getMinMaxDate(inst, 'max'); - return ((!minDate || date.getTime() >= minDate.getTime()) && - (!maxDate || date.getTime() <= maxDate.getTime())); - }, - - /* Provide the configuration settings for formatting/parsing. */ - _getFormatConfig: function(inst) { - var shortYearCutoff = this._get(inst, 'shortYearCutoff'); - shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : - new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); - return {shortYearCutoff: shortYearCutoff, - dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'), - monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')}; - }, - - /* Format the given date for display. */ - _formatDate: function(inst, day, month, year) { - if (!day) { - inst.currentDay = inst.selectedDay; - inst.currentMonth = inst.selectedMonth; - inst.currentYear = inst.selectedYear; - } - var date = (day ? (typeof day == 'object' ? day : - this._daylightSavingAdjust(new Date(year, month, day))) : - this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); - return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst)); - } -}); - -/* jQuery extend now ignores nulls! */ -function extendRemove(target, props) { - $.extend(target, props); - for (var name in props) - if (props[name] == null || props[name] == undefined) - target[name] = props[name]; - return target; -}; - -/* Determine whether an object is an array. */ -function isArray(a) { - return (a && (($.browser.safari && typeof a == 'object' && a.length) || - (a.constructor && a.constructor.toString().match(/\Array\(\)/)))); -}; - -/* Invoke the datepicker functionality. - @param options string - a command, optionally followed by additional parameters or - Object - settings for attaching new datepicker functionality - @return jQuery object */ -$.fn.datepicker = function(options){ - - /* Initialise the date picker. */ - if (!$.datepicker.initialized) { - $(document).mousedown($.datepicker._checkExternalClick). - find('body').append($.datepicker.dpDiv); - $.datepicker.initialized = true; - } - - var otherArgs = Array.prototype.slice.call(arguments, 1); - if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget')) - return $.datepicker['_' + options + 'Datepicker']. - apply($.datepicker, [this[0]].concat(otherArgs)); - if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string') - return $.datepicker['_' + options + 'Datepicker']. - apply($.datepicker, [this[0]].concat(otherArgs)); - return this.each(function() { - typeof options == 'string' ? - $.datepicker['_' + options + 'Datepicker']. - apply($.datepicker, [this].concat(otherArgs)) : - $.datepicker._attachDatepicker(this, options); - }); -}; - -$.datepicker = new Datepicker(); // singleton instance -$.datepicker.initialized = false; -$.datepicker.uuid = new Date().getTime(); -$.datepicker.version = "1.8.4"; - -// Workaround for #4055 -// Add another global to avoid noConflict issues with inline event handlers -window['DP_jQuery_' + dpuuid] = $; - -})(jQuery); diff --git a/form_elements/js/jquery.ui.widget.js b/form_elements/js/jquery.ui.widget.js deleted file mode 100644 index 85e9293b..00000000 --- a/form_elements/js/jquery.ui.widget.js +++ /dev/null @@ -1,237 +0,0 @@ -/*! - * jQuery UI Widget 1.8.4 - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Widget - */ -(function( $, undefined ) { - -var _remove = $.fn.remove; - -$.fn.remove = function( selector, keepData ) { - return this.each(function() { - if ( !keepData ) { - if ( !selector || $.filter( selector, [ this ] ).length ) { - $( "*", this ).add( [ this ] ).each(function() { - $( this ).triggerHandler( "remove" ); - }); - } - } - return _remove.call( $(this), selector, keepData ); - }); -}; - -$.widget = function( name, base, prototype ) { - var namespace = name.split( "." )[ 0 ], - fullName; - name = name.split( "." )[ 1 ]; - fullName = namespace + "-" + name; - - if ( !prototype ) { - prototype = base; - base = $.Widget; - } - - // create selector for plugin - $.expr[ ":" ][ fullName ] = function( elem ) { - return !!$.data( elem, name ); - }; - - $[ namespace ] = $[ namespace ] || {}; - $[ namespace ][ name ] = function( options, element ) { - // allow instantiation without initializing for simple inheritance - if ( arguments.length ) { - this._createWidget( options, element ); - } - }; - - var basePrototype = new base(); - // we need to make the options hash a property directly on the new instance - // otherwise we'll modify the options hash on the prototype that we're - // inheriting from -// $.each( basePrototype, function( key, val ) { -// if ( $.isPlainObject(val) ) { -// basePrototype[ key ] = $.extend( {}, val ); -// } -// }); - basePrototype.options = $.extend( true, {}, basePrototype.options ); - $[ namespace ][ name ].prototype = $.extend( true, basePrototype, { - namespace: namespace, - widgetName: name, - widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name, - widgetBaseClass: fullName - }, prototype ); - - $.widget.bridge( name, $[ namespace ][ name ] ); -}; - -$.widget.bridge = function( name, object ) { - $.fn[ name ] = function( options ) { - var isMethodCall = typeof options === "string", - args = Array.prototype.slice.call( arguments, 1 ), - returnValue = this; - - // allow multiple hashes to be passed on init - options = !isMethodCall && args.length ? - $.extend.apply( null, [ true, options ].concat(args) ) : - options; - - // prevent calls to internal methods - if ( isMethodCall && options.substring( 0, 1 ) === "_" ) { - return returnValue; - } - - if ( isMethodCall ) { - this.each(function() { - var instance = $.data( this, name ), - methodValue = instance && $.isFunction( instance[options] ) ? - instance[ options ].apply( instance, args ) : - instance; - if ( methodValue !== instance && methodValue !== undefined ) { - returnValue = methodValue; - return false; - } - }); - } else { - this.each(function() { - var instance = $.data( this, name ); - if ( instance ) { - if ( options ) { - instance.option( options ); - } - instance._init(); - } else { - $.data( this, name, new object( options, this ) ); - } - }); - } - - return returnValue; - }; -}; - -$.Widget = function( options, element ) { - // allow instantiation without initializing for simple inheritance - if ( arguments.length ) { - this._createWidget( options, element ); - } -}; - -$.Widget.prototype = { - widgetName: "widget", - widgetEventPrefix: "", - options: { - disabled: false - }, - _createWidget: function( options, element ) { - // $.widget.bridge stores the plugin instance, but we do it anyway - // so that it's stored even before the _create function runs - $.data( element, this.widgetName, this ); - this.element = $( element ); - this.options = $.extend( true, {}, - this.options, - $.metadata && $.metadata.get( element )[ this.widgetName ], - options ); - - var self = this; - this.element.bind( "remove." + this.widgetName, function() { - self.destroy(); - }); - - this._create(); - this._init(); - }, - _create: function() {}, - _init: function() {}, - - destroy: function() { - this.element - .unbind( "." + this.widgetName ) - .removeData( this.widgetName ); - this.widget() - .unbind( "." + this.widgetName ) - .removeAttr( "aria-disabled" ) - .removeClass( - this.widgetBaseClass + "-disabled " + - "ui-state-disabled" ); - }, - - widget: function() { - return this.element; - }, - - option: function( key, value ) { - var options = key, - self = this; - - if ( arguments.length === 0 ) { - // don't return a reference to the internal hash - return $.extend( {}, self.options ); - } - - if (typeof key === "string" ) { - if ( value === undefined ) { - return this.options[ key ]; - } - options = {}; - options[ key ] = value; - } - - $.each( options, function( key, value ) { - self._setOption( key, value ); - }); - - return self; - }, - _setOption: function( key, value ) { - this.options[ key ] = value; - - if ( key === "disabled" ) { - this.widget() - [ value ? "addClass" : "removeClass"]( - this.widgetBaseClass + "-disabled" + " " + - "ui-state-disabled" ) - .attr( "aria-disabled", value ); - } - - return this; - }, - - enable: function() { - return this._setOption( "disabled", false ); - }, - disable: function() { - return this._setOption( "disabled", true ); - }, - - _trigger: function( type, event, data ) { - var callback = this.options[ type ]; - - event = $.Event( event ); - event.type = ( type === this.widgetEventPrefix ? - type : - this.widgetEventPrefix + type ).toLowerCase(); - data = data || {}; - - // copy original event properties over to the new event - // this would happen if we could call $.event.fix instead of $.Event - // but we don't have a way to force an event to be fixed multiple times - if ( event.originalEvent ) { - for ( var i = $.event.props.length, prop; i; ) { - prop = $.event.props[ --i ]; - event[ prop ] = event.originalEvent[ prop ]; - } - } - - this.element.trigger( event, data ); - - return !( $.isFunction(callback) && - callback.call( this.element[0], event, data ) === false || - event.isDefaultPrevented() ); - } -}; - -})( jQuery ); diff --git a/form_elements/js/otherselect.js b/form_elements/js/otherselect.js deleted file mode 100644 index a138aba7..00000000 --- a/form_elements/js/otherselect.js +++ /dev/null @@ -1,30 +0,0 @@ -$(document).ready(function () { - $('.otherSelect').each(function (index) - { - var name = $(this).attr('name').replace(/[\[\]]+/g,'-'); - $(this).attr('id',name); - - $('#'+name+' option:last').after(''); - $(this).after(''); - - $(this).removeAttr('name'); - - - $(this).change(function () - { - - if ($(this).val() == 'other') - { - $('#'+$(this).attr('id')+'_field').val(''); - $('#'+$(this).attr('id')+'_other').show('fast'); - } else - { - $('#'+$(this).attr('id')+'_field').val($(this).val()); - $('#'+$(this).attr('id')+'_other').hide('fast'); - } - }); - - }); - }); - - \ No newline at end of file diff --git a/form_elements/js/people_ahah.js b/form_elements/js/people_ahah.js deleted file mode 100755 index 0c545ba3..00000000 --- a/form_elements/js/people_ahah.js +++ /dev/null @@ -1,92 +0,0 @@ - -(function($) { - -if (Drupal.jsEnabled) { - $(document).ready(function() { - $('#edit-mods-people-add-from-repository').blur(function () { - if ($('#edit-mods-people-add-from-repository').val() != '') { - $('#edit-mods-people-add-person').mousedown(); - } - }); - - if (Drupal.ahah != undefined) { - -/** - * Override of Drupal.ahah.prototype.success. The only difference is that we - * allow for new Drupal.settings. - */ -Drupal.ahah.prototype.success = function (response, status) { - $('#edit-mods-people-add-from-repository').val(''); - - var wrapper = $(this.wrapper); - var form = $(this.element).parents('form'); - // Manually insert HTML into the jQuery object, using $() directly crashes - // Safari with long string lengths. http://dev.jquery.com/ticket/1152 - var new_content = $('
    ').html(response.data); - - // Restore the previous action and target to the form. - form.attr('action', this.form_action); - this.form_target ? form.attr('target', this.form_target) : form.removeAttr('target'); - this.form_encattr ? form.attr('target', this.form_encattr) : form.removeAttr('encattr'); - - // Remove the progress element. - if (this.progress.element) { - $(this.progress.element).remove(); - } - if (this.progress.object) { - this.progress.object.stopMonitoring(); - } - $(this.element).removeClass('progress-disabled').attr('disabled', false); - - // Add the new content to the page. - Drupal.freezeHeight(); - if (this.method == 'replace') { - wrapper.empty().append(new_content); - } - else { - wrapper[this.method](new_content); - } - - $('.datepicker').datepicker({ buttonImage: '/misc/date.png', constrainInput: false, showOn: 'button', changeMonth: true, changeYear: true }); - - // Immediately hide the new content if we're using any effects. - if (this.showEffect != 'show') { - new_content.hide(); - } - - // Determine what effect use and what content will receive the effect, then - // show the new content. For browser compatibility, Safari is excluded from - // using effects on table rows. - if (($.browser.safari && $("tr.ahah-new-content", new_content).size() > 0)) { - new_content.show(); - } - else if ($('.ahah-new-content', new_content).size() > 0) { - $('.ahah-new-content', new_content).hide(); - new_content.show(); - $(".ahah-new-content", new_content)[this.showEffect](this.showSpeed); - } - else if (this.showEffect != 'show') { - new_content[this.showEffect](this.showSpeed); - } - - // Merge in new and changed settings, if any. - if (response.settings) { - $.extend(Drupal.settings, response.settings); - } - - // Attach all javascript behaviors to the new content, if it was successfully - // added to the page, this if statement allows #ahah[wrapper] to be optional. - if (new_content.parents('html').length > 0) { - Drupal.attachBehaviors(new_content); - } - - Drupal.unfreezeHeight(); -}; - - } - - - }); -} - -})(jQuery); diff --git a/form_elements/js/tageditor_1-4-1.zip b/form_elements/js/tageditor_1-4-1.zip deleted file mode 100644 index 6264ff55..00000000 Binary files a/form_elements/js/tageditor_1-4-1.zip and /dev/null differ diff --git a/form_elements/xml/gacs.xml b/form_elements/xml/gacs.xml deleted file mode 100644 index dc9f4db7..00000000 --- a/form_elements/xml/gacs.xml +++ /dev/null @@ -1,5562 +0,0 @@ - - - - - - - - marcgac - MARC Code List for Geographic Areas - Network Development and MARC Standards Office - info:lc/vocabulary/gacs - - - info:lc/vocabulary/gacs/a-af - Afghanistan - a-af - - - info:lc/vocabulary/gacs/f - Africa - f - - Islamic countries - - - Sahel - - - - info:lc/vocabulary/gacs/fc - Africa, Central - fc - - Central Africa - - - - info:lc/vocabulary/gacs/fe - Africa, Eastern - fe - - Africa, East - - British East Africa - - - East Africa - - - - Eastern Africa - - - - info:lc/vocabulary/gacs/fq - Africa, French-speaking Equatorial - fq - - Chad, Lake - - - Africa, Equatorial - - - French Equatorial Africa - - - French-speaking Equatorial Africa - - - - info:lc/vocabulary/gacs/ff - Africa, North - ff - - Africa, Northwest - - Northwest Africa - - - - Islamic Empire - - - Rome - - Roman Empire - - - - North Africa - - - - info:lc/vocabulary/gacs/fh - Africa, Northeast - fh - - Africa, Italian East - - - East African Horn - - - Italian East Africa - - - Northeast Africa - - - - info:lc/vocabulary/gacs/fs - Africa, Southern - fs - - Southern Africa - - - - info:lc/vocabulary/gacs/fb - Africa, Sub-Saharan - fb - - Sub-Saharan Africa - - - - info:lc/vocabulary/gacs/fw - Africa, West - fw - - Africa, French-speaking West - - French-speaking West Africa - - - French West Africa - - - - Africa, Northwest - - Northwest Africa - - - - Ghana (Empire) - - - Mali (Empire) - - - British West Africa - - - West Africa - - - - info:lc/vocabulary/gacs/n-us-al - Alabama - n-us-al - - - info:lc/vocabulary/gacs/n-us-ak - Alaska - n-us-ak - - - info:lc/vocabulary/gacs/e-aa - Albania - e-aa - - People's Socialist Republic of Albania - - - - info:lc/vocabulary/gacs/n-cn-ab - Alberta - n-cn-ab - - - info:lc/vocabulary/gacs/f-ae - Algeria - f-ae - - People's Democratic Republic of Algeria - - - - info:lc/vocabulary/gacs/ea - Alps - ea - - - info:lc/vocabulary/gacs/sa - Amazon River - sa - - - info:lc/vocabulary/gacs/poas - American Samoa - poas - - Samoa, American - - - - info:lc/vocabulary/gacs/aa - Amur River (China and Russia) - aa - - Hei Ho (China and Russia) - - - Heilong Jiang (China and Russia) - - - Reka Amur (China and Russia) - - - Sakhalin Ula (China and Russia) - - - - info:lc/vocabulary/gacs/sn - Andes - sn - - Andean Area - - - - info:lc/vocabulary/gacs/e-an - Andorra - e-an - - - info:lc/vocabulary/gacs/f-ao - Angola - f-ao - - Kongo Kingdom - - Congo (Kingdom) - - - - People's Republic of Angola - - - Portuguese West Africa - - - West Africa, Portuguese - - - - info:lc/vocabulary/gacs/nwxa - Anguilla - nwxa - - Coded [nwxi] (Saint Kitts and Nevis) before Mar. 1988 - - - Saint Kitts-Nevis-Anguilla - - St. Christopher-Nevis-Anguilla - - - - - info:lc/vocabulary/gacs/a-cc-an - Anhui Sheng (China) - a-cc-an - - Anhwei Province (China) - - - - info:lc/vocabulary/gacs/t - Antarctic Ocean - t - - - info:lc/vocabulary/gacs/t - Antarctica - t - - Coded also [t-ay] (Antarctica) before Mar. 1988 - - - Polar regions - - - South Shetland Islands (Antarctica) - - Coded [lsfk] (Falkland Islands) before Mar. 1998 - - - - Antarctic regions - - - South Pole - - - - info:lc/vocabulary/gacs/nwaq - Antigua and Barbuda - nwaq - - Antigua - - - Barbuda - - Coded [nwbc] (Barbuda) before Mar. 1988 - - - - - info:lc/vocabulary/gacs/nwla - Antilles, Lesser - nwla - - West Indies, French - - French West Indies - - - - Lesser Antilles - - - - info:lc/vocabulary/gacs/n-usa - Appalachian Mountains - n-usa - - Appalachian Mountains, Southern - - - Appalachian Region - - - Blue Ridge Mountains - - - - info:lc/vocabulary/gacs/ma - Arab countries - ma - - Arabic countries - - - - info:lc/vocabulary/gacs/ar - Arabian Peninsula - ar - - Persian Gulf States - - - Arabia - - - - info:lc/vocabulary/gacs/au - Arabian Sea - au - - Oman, Gulf of - - Gulf of Oman - - - - - info:lc/vocabulary/gacs/r - Arctic Ocean - r - - Barents Sea - - - Beaufort Sea - - - - info:lc/vocabulary/gacs/r - Arctic regions - r - - Polar regions - - - Northeast Passage - - - Northwest Passage - - - North Pole - - - - info:lc/vocabulary/gacs/s-ag - Argentina - s-ag - - - info:lc/vocabulary/gacs/n-us-az - Arizona - n-us-az - - - info:lc/vocabulary/gacs/n-us-ar - Arkansas - n-us-ar - - Ozark Mountains - - - - info:lc/vocabulary/gacs/a-ai - Armenia (Republic) - a-ai - - Coded [e-ur-ai] (Armenia (Republic)) before June 1998 - - - Armenia - - - Transcaucasia - - Coded [e-ur-ai] (Armenia (Republic)), [e-ur-aj] (Azerbaijan), [e-ur-gs] (Georgia - (Republic)) before June 1998] - - - - Armenian S.S.R. - - - - info:lc/vocabulary/gacs/nwaw - Aruba - nwaw - - Coded [nwco] (Curaçao) before Sept. 2002 - - - - info:lc/vocabulary/gacs/lsai - Ascension Island (Atlantic Ocean) - lsai - - - info:lc/vocabulary/gacs/u-ac - Ashmore and Cartier Islands - u-ac - - - info:lc/vocabulary/gacs/a - Asia - a - - Islamic countries - - - Orient - - East - - - - - info:lc/vocabulary/gacs/ac - Asia, Central - ac - - Central Asia - - - Soviet Central Asia - - - - info:lc/vocabulary/gacs/l - Atlantic Ocean - l - - Islands of the Atlantic - - - - info:lc/vocabulary/gacs/fa - Atlas Mountains - fa - - - info:lc/vocabulary/gacs/u - Australasia - u - - - info:lc/vocabulary/gacs/u-at - Australia - u-at - - Norfolk Island - - - - info:lc/vocabulary/gacs/u-at-ac - Australian Capital Territory - u-at-ac - - Coded [u-at-ne] (New South Wales) before Sept. 2002 - - - A.C.T. - - - Federal Capital Territory - - - - info:lc/vocabulary/gacs/e-au - Austria - e-au - - Pannonia - - - - info:lc/vocabulary/gacs/a-aj - Azerbaijan - a-aj - - Coded [e-ur-aj] (Azerbaijan) before June 1998 - - - Transcaucasia - - Coded [e-ur-ai] (Armenia (Republic)), [e-ur-aj] (Azerbaijan), [e-ur-gs] (Georgia - (Republic)) before June 1998] - - - - Azerbaijan S.S.R. - - - - info:lc/vocabulary/gacs/lnaz - Azores - lnaz - - Açores - - - - info:lc/vocabulary/gacs/nwbf - Bahamas - nwbf - - - info:lc/vocabulary/gacs/a-ba - Bahrain - a-ba - - Bahrein - - - - info:lc/vocabulary/gacs/ed - Balkan Peninsula - ed - - Europe, Southeastern - - - Southeastern Europe - - - - info:lc/vocabulary/gacs/eb - Baltic States - eb - - - info:lc/vocabulary/gacs/a-bg - Bangladesh - a-bg - - East Pakistan (Pakistan) - - - - info:lc/vocabulary/gacs/nwbb - Barbados - nwbb - - - info:lc/vocabulary/gacs/a-cc-pe - Beijing (China) - a-cc-pe - - Peiping (China) - - - Peking (China) - - - - info:lc/vocabulary/gacs/e-bw - Belarus - e-bw - - Coded [e-ur-bw] (Belarus) before June 1998 - - - Kievan Rus - - Coded [e-ur] (Soviet Union) before June 1998 - - - - Belorussian S.S.R. - - - Byelorussian S.S.R. - - - White Russia - - - - info:lc/vocabulary/gacs/e-be - Belgium - e-be - - - info:lc/vocabulary/gacs/ncbh - Belize - ncbh - - British Honduras - - - - info:lc/vocabulary/gacs/el - Benelux countries - el - - Low countries - - - - info:lc/vocabulary/gacs/ab - Bengal, Bay of - ab - - Bay of Bengal - - - - info:lc/vocabulary/gacs/f-dm - Benin - f-dm - - Dahomey - - - People's Republic of Benin - - - - info:lc/vocabulary/gacs/lnbm - Bermuda Islands - lnbm - - - info:lc/vocabulary/gacs/a-bt - Bhutan - a-bt - - - info:lc/vocabulary/gacs/mb - Black Sea - mb - - - info:lc/vocabulary/gacs/a-ccp - Bo Hai (China) - a-ccp - - Bohai (China : Gulf) - - - Chihli, Gulf of (China) - - - Po Gulf (China) - - - Po Hai (China) - - - - info:lc/vocabulary/gacs/s-bo - Bolivia - s-bo - - - info:lc/vocabulary/gacs/nwbn - Bonaire (Netherlands Antilles) - nwbn - - Coded [nwco] (Curaçao) before Sept. 200 - - - - info:lc/vocabulary/gacs/a-bn - Borneo - a-bn - - - info:lc/vocabulary/gacs/e-bn - Bosnia and Hercegovina - e-bn - - Coded [e-yu] (Yugoslavia) before Oct. 1992 - - - - info:lc/vocabulary/gacs/f-bs - Botswana - f-bs - - Bechuanaland - - - - info:lc/vocabulary/gacs/lsbv - Bouvet Island - lsbv - - - info:lc/vocabulary/gacs/s-bl - Brazil - s-bl - - - info:lc/vocabulary/gacs/n-cn-bc - British Columbia - n-cn-bc - - Canada, Western - - Western Canada - - - - Northwest, Pacific - - Northwest (U.S.) - - - Pacific Northwest - - - - - info:lc/vocabulary/gacs/i-bi - British Indian Ocean Territory - i-bi - - Diego Garcia (British Indian Ocean Territory) - - - Chagos Islands - - - Indian Ocean Territory, British - - - - info:lc/vocabulary/gacs/nwvb - British Virgin Islands - nwvb - - Virgin Islands - - Coded [nwvr] (Virgin Islands) before Mar. 1988 - - - - Virgin Islands, British - - - Virgin Islands (Great Britain) - - - Virgin Islands (Presidency) - - - - info:lc/vocabulary/gacs/a-bx - Brunei - a-bx - - - info:lc/vocabulary/gacs/e-bu - Bulgaria - e-bu - - Macedonia - - - Macedonia (Bulgaria) - - - People's Republic of Bulgaria - - - - info:lc/vocabulary/gacs/f-uv - Burkina Faso - f-uv - - Upper Volta - - - - info:lc/vocabulary/gacs/a-br - Burma - a-br - - Shan States - - - Myanmar - - - - info:lc/vocabulary/gacs/f-bd - Burundi - f-bd - - Ruanda-Urundi - - - German East Africa - - - - info:lc/vocabulary/gacs/n-us-ca - California - n-us-ca - - Pacific States - - - - info:lc/vocabulary/gacs/a-cb - Cambodia - a-cb - - Kampuchea - - - Khmer Republic - - - - info:lc/vocabulary/gacs/f-cm - Cameroon - f-cm - - Adamawa (Emirate) - - - Cameroons, French - - - Cameroons, Southern - - - Cameroun - - - French Cameroons - - - Southern Cameroons - - - - info:lc/vocabulary/gacs/n-cn - Canada - n-cn - - Canada, Eastern - - Eastern Canada - - - - Canada, Northern - - Northern Canada - - - - Northwest, Canadian - - Canadian Northwest - - - West (Canada) - - - - Saint Lawrence River - - - - info:lc/vocabulary/gacs/nccz - Canal Zone - nccz - - Panama Canal Zone - - - - info:lc/vocabulary/gacs/lnca - Canary Islands - lnca - - - info:lc/vocabulary/gacs/lncv - Cape Verde - lncv - - Cabo Verde - - - Republic of Cape Verde - - - - info:lc/vocabulary/gacs/cc - Caribbean Area - cc - - Spanish Main - - - Caribbean Sea Region - - - Circumcaribbean - - Coded [cr] (Circumcaribbean) before Mar. 1988 - - - - - info:lc/vocabulary/gacs/cc - Caribbean Sea - cc - - - info:lc/vocabulary/gacs/poci - Caroline Islands - poci - - - info:lc/vocabulary/gacs/ak - Caspian Sea - ak - - - info:lc/vocabulary/gacs/e-urk - Caucasus - e-urk - - - info:lc/vocabulary/gacs/e-urr - Caucasus, Northern (Russia) - e-urr - - North Caucasus (Russia) - - - Northern Caucasus (Russia) - - - - info:lc/vocabulary/gacs/nwcj - Cayman Islands - nwcj - - - info:lc/vocabulary/gacs/f-cx - Central African Republic - f-cx - - Central African Empire - - - Ubangi Shari - - - - info:lc/vocabulary/gacs/nc - Central America - nc - - America, Central - - - Middle America - - Coded [cm] (Middle America) before Mar. 1988 - - - - - info:lc/vocabulary/gacs/u-atc - Central Australia - u-atc - - Coded [u-at] (Australia) before September 2005 - - - Australia, Central - - - - info:lc/vocabulary/gacs/e-urc - Central Chernozem Region (Russia) - e-urc - - Central Black Earth Region (Russia) - - - Central Black Soil Region (Russia) - - - - info:lc/vocabulary/gacs/f-cd - Chad - f-cd - - Tibesti Mountains - - - - info:lc/vocabulary/gacs/s-cl - Chile - s-cl - - - info:lc/vocabulary/gacs/a-cc - China - a-cc - - Manchuria (China) - - - Mainland China - - - People's Republic of China - - - - info:lc/vocabulary/gacs/a-cc-cq - Chongqing (China) - a-cc-cq - - Coded [a-cc-sz] (Szechuan Province (China)) before Sept. 2000 - - - Ch'ung-ch'ing shih (China) - - - Chungking (China) - - - - info:lc/vocabulary/gacs/i-xa - Christmas Island (Indian Ocean) - i-xa - - - info:lc/vocabulary/gacs/i-xb - Cocos (Keeling) Islands - i-xb - - Keeling Islands - - - - info:lc/vocabulary/gacs/q - Cold regions - q - - - info:lc/vocabulary/gacs/s-ck - Colombia - s-ck - - - info:lc/vocabulary/gacs/n-us-co - Colorado - n-us-co - - - info:lc/vocabulary/gacs/b - Commonwealth countries - b - - British Commonwealth countries - - - British Dominions - - - Commonwealth nations - - - - info:lc/vocabulary/gacs/i-cq - Comoros - i-cq - - Comoro Islands - - - Îles Comores - - - - info:lc/vocabulary/gacs/f-cf - Congo (Brazzaville) - f-cf - - Kongo Kingdom - - Congo (Kingdom) - - - - Brazzaville - - - French Congo - - - Middle Congo - - - - info:lc/vocabulary/gacs/f-cg - Congo (Democratic Republic) - f-cg - - Kongo Kingdom - - Congo (Kingdom) - - - - Belgian Congo - - - Congo (Kinshasa) - - - Congo (Leopoldville) - - - Zaire - - - - info:lc/vocabulary/gacs/fg - Congo River - fg - - - info:lc/vocabulary/gacs/n-us-ct - Connecticut - n-us-ct - - - info:lc/vocabulary/gacs/pocw - Cook Islands - pocw - - - info:lc/vocabulary/gacs/u-cs - Coral Sea Islands - u-cs - - - info:lc/vocabulary/gacs/nccr - Costa Rica - nccr - - - info:lc/vocabulary/gacs/f-iv - Côte d'Ivoire - f-iv - - Ivory Coast - - - - info:lc/vocabulary/gacs/e-ci - Croatia - e-ci - - Coded [e-yu] (Yugoslavia) before Oct. 1992] - - - People's Republic of Croatia - - - - info:lc/vocabulary/gacs/nwcu - Cuba - nwcu - - - info:lc/vocabulary/gacs/nwco - Curaçao (Netherlands Antilles) - nwco - - - info:lc/vocabulary/gacs/a-cy - Cyprus - a-cy - - - info:lc/vocabulary/gacs/e-xr - Czech Republic [e-xr] - e-xr - - Coded [e-cs] (Czechoslovakia) before May 1993 - - - Czech Socialist Republic (Czechoslovakia) - - - - info:lc/vocabulary/gacs/e-cs - Czechoslovakia - e-cs - - Includes the Czech Republic and Slovakia treated collectively - - - - info:lc/vocabulary/gacs/eo - Danube River - eo - - - info:lc/vocabulary/gacs/zd - Deep space - zd - - - info:lc/vocabulary/gacs/n-us-de - Delaware - n-us-de - - - info:lc/vocabulary/gacs/e-dk - Denmark - e-dk - - - info:lc/vocabulary/gacs/dd - Developed countries - dd - - Advanced countries - - - Economically advanced countries - - - First World - - - Industrialized countries - - - - info:lc/vocabulary/gacs/d - Developing countries - d - - Emerging nations - - - Third World - - - Underdeveloped areas - - - - info:lc/vocabulary/gacs/f-ft - Djibouti - f-ft - - Afars and Issas, French Territory of the - - - French Somaliland - - - French Territory of the Afars and Issas - - - Somaliland, French - - - - info:lc/vocabulary/gacs/nwdq - Dominica - nwdq - - - info:lc/vocabulary/gacs/nwdr - Dominican Republic - nwdr - - - info:lc/vocabulary/gacs/x - Earth - x - - - info:lc/vocabulary/gacs/n-usr - East (U.S.) - n-usr - - - info:lc/vocabulary/gacs/ae - East Asia - ae - - Asia, East - - - East (Far East) - - - Far East - - - - info:lc/vocabulary/gacs/an - East China Sea - an - - - info:lc/vocabulary/gacs/a-em - East Timor - a-em - - Coded [a-pt] (Portuguese Timor) before April 21, 1980; coded [a-io] (Indonesia) from - 1980-Sept. 2002] - - - Lesser Sunda Islands (Indonesia and East Timor) - - Sunda Islands, Lesser (Indonesia and East Timor) - - - - Timor Island - - - Portuguese Timor - - - Timor, East - - - Timor, Portuguese - - - Timor Timur - - - - info:lc/vocabulary/gacs/poea - Easter Island - poea - - Isla de Pascua - - - Pascua Island - - - - info:lc/vocabulary/gacs/u-ate - Eastern Australia - u-ate - - Coded [u-at] (Australia) before September 2005 - - - Australia, Eastern - - - - info:lc/vocabulary/gacs/xa - Eastern Hemisphere - xa - - - info:lc/vocabulary/gacs/s-ec - Ecuador - s-ec - - - info:lc/vocabulary/gacs/f-ua - Egypt - f-ua - - United Arab Republic - - - - info:lc/vocabulary/gacs/nces - El Salvador - nces - - Salvador - - - - info:lc/vocabulary/gacs/e-uk-en - England - e-uk-en - - Brownsea Island (England) - - - Isle of Wight (England) - - Wight, Isle of - - - - - info:lc/vocabulary/gacs/f-eg - Equatorial Guinea - f-eg - - Fernando Po (Equatorial Guinea) - - Bioco (Equatorial Guinea) - - - Bioko (Equatorial Guinea) - - - Macias Nguema (Equatorial Guinea) - - - - Guinea, Equatorial - - - Guinea, Spanish - - - Río Muni - - - Spanish Guinea - - - - info:lc/vocabulary/gacs/f-ea - Eritrea - f-ea - - Coded [f-et] (Ethiopia) before Nov. 1993 - - - - info:lc/vocabulary/gacs/e-er - Estonia - e-er - - Coded [e-ur-er] (Estonia) before June 1998 - - - - info:lc/vocabulary/gacs/f-et - Ethiopia - f-et - - Abyssinia - - - - info:lc/vocabulary/gacs/me - Eurasia - me - - Asia and Europe (treated collectively) - - - Europe and Asia (treated collectively) - - - - info:lc/vocabulary/gacs/e - Europe - e - - European Economic Community countries - - - European Union countries - - - Holy Roman Empire - - - Rome - - Roman Empire - - - - - info:lc/vocabulary/gacs/ec - Europe, Central - ec - - Central Europe - - - Europe, East Central - - Coded [et] (Europe, East Central) before Mar. 1988 - - - - - info:lc/vocabulary/gacs/ee - Europe, Eastern - ee - - Carpathian Mountains - - - Communist countries - - Coded [v] (Communist countries) before June 1998 - - - - Eastern Europe - - - Europe, East Central - - Coded [et] (Europe, East Central) before Mar. 1988 - - - - - info:lc/vocabulary/gacs/en - Europe, Northern - en - - Northern Europe - - - - info:lc/vocabulary/gacs/es - Europe, Southern - es - - Southern Europe - - - - info:lc/vocabulary/gacs/ew - Europe, Western - ew - - Western Europe - - - - info:lc/vocabulary/gacs/lsfk - Falkland Islands - lsfk - - South Orkney Islands - - - Malvinas Islands - - - - info:lc/vocabulary/gacs/lnfa - Faroe Islands - lnfa - - Faeroe Islands - - - - info:lc/vocabulary/gacs/pofj - Fiji - pofj - - - info:lc/vocabulary/gacs/e-fi - Finland - e-fi - - Lapland - - - - info:lc/vocabulary/gacs/e-fr - France - e-fr - - Corsica (France) - - - - info:lc/vocabulary/gacs/h - French Community - h - - Communauté francaise - - - French Union - - - - info:lc/vocabulary/gacs/s-fg - French Guiana - s-fg - - Guiana, French - - - - info:lc/vocabulary/gacs/pofp - French Polynesia - pofp - - Austral Islands (French Polynesia) - - Tubuai Islands (French Polynesia) - - - - Gambier Islands (French Polynesia) - - - Marquesas Islands (French Polynesia) - - Archipel des Marquises (French Polynesia) - - - Îles Marquises de Mendoça (French Polynesia) - - - Islas Marquesas de Mendoza (French Polynesia) - - - Mendaña (French Polynesia) - - - - Society Islands (French Polynesia) - - - Tuamotu Archipelago (French Polynesia) - - - Oceania, French - - - Polynesia, French - - - - info:lc/vocabulary/gacs/a-cc-fu - Fujian Sheng (China) - a-cc-fu - - Fukien Province (China) - - - - info:lc/vocabulary/gacs/f-go - Gabon - f-go - - - info:lc/vocabulary/gacs/pogg - Galapagos Islands - pogg - - - info:lc/vocabulary/gacs/f-gm - Gambia - f-gm - - - info:lc/vocabulary/gacs/a-cc-ka - Gansu Sheng (China) [a-cc-ka] - a-cc-ka - - Kansu Province (China) - - - - info:lc/vocabulary/gacs/awgz - Gaza Strip - awgz - - Palestine - - - - info:lc/vocabulary/gacs/n-us-ga - Georgia - n-us-ga - - - info:lc/vocabulary/gacs/a-gs - Georgia (Republic) - a-gs - - Coded [e-ur-gs] (Georgia (Republic)) before June 1998 - - - Transcaucasia - - Coded [e-ur-ai] (Armenia (Republic)), [e-ur-aj] (Azerbaijan), [e-ur-gs] (Georgia - (Republic)) before June 1998] - - - - Georgia (Soviet Union) - - - Georgian S.S.R. - - - - info:lc/vocabulary/gacs/e-gx - Germany - e-gx - - For Germany as a whole regardless of time period; includes Germany (East) and Germany - (West) as a whole between 1949 and 1990] - - - Berlin (Germany) - - Coded [e-gx] (Germany) for Berlin as a whole; [e-ge] (Germany (East)) for East - Berlin; or [e-gw] (Germany (West)) for West Berlin before Jan. 1991] - - - East Berlin - - - West Berlin - - - - Germany, Northern - - Northern Germany - - - - Prussia (Germany) - - - Germany, Southern - - Southern Germany - - - - - info:lc/vocabulary/gacs/e-ge - Germany (East) - e-ge - - For the eastern part of Germany before 1949 or after 1990 and for the German - Democratic Republic between 1949-1990] - - - Democratic German Republic - - - East Germany - - - German Democratic Republic - - - Germany, Eastern - - - - info:lc/vocabulary/gacs/e-gw - Germany (West) - e-gw - - For the western part of Germany before 1949 or after 1990 and for the Federal Republic - of Germany between 1949-1990 - - - Federal German Republic - - - German Federal Republic - - - Germany, Western - - - West Germany - - - - info:lc/vocabulary/gacs/f-gh - Ghana - f-gh - - Togoland - - - Togoland (British) - - British Togoland - - - - Ashanti - - - Gold Coast - - - - info:lc/vocabulary/gacs/e-gi - Gibraltar - e-gi - - Gibraltar, Strait of - - Strait of Gibraltar - - - - - info:lc/vocabulary/gacs/e-uk - Great Britain - e-uk - - British Isles - - - United Kingdom - - - - info:lc/vocabulary/gacs/e-uk-ui - Great Britain Miscellaneous Island Dependencies - e-uk-ui - - Alderney (Channel Islands) - - - Calf of Man (Isle of Man) - - - Channel Islands - - - Guernsey (Channel Islands) - - - Isle of Man - - Man, Isle of - - - - Jersey (Channel Islands) - - - Island Dependencies of Great Britain - - - United Kingdom Miscellaneous Island Dependencies - - - - info:lc/vocabulary/gacs/nl - Great Lakes (North America) - nl - - - info:lc/vocabulary/gacs/np - Great Plains - np - - - info:lc/vocabulary/gacs/fr - Great Rift Valley - fr - - Rift Valley - - - - info:lc/vocabulary/gacs/e-gr - Greece - e-gr - - Aegean Islands (Greece and Turkey) - - Islands of the Aegean - - - - Aegean Sea - - - Crete (Greece) - - - Dodekanesos (Greece) - - - Macedonia - - - Macedonia (Greece) - - - - info:lc/vocabulary/gacs/n-gl - Greenland - n-gl - - - info:lc/vocabulary/gacs/nwgd - Grenada - nwgd - - Grenadines (Saint Vincent and the Grenadines and Grenada) - - - - info:lc/vocabulary/gacs/nwgp - Guadeloupe - nwgp - - Marie-Galante (Guadeloupe) - - - Saint-Barthélemy - - Coded [nwsb] (Saint-Barthelemy) before Mar. 1988 - - - Saint Bartholomew - - - Saint Barts - - - St. Barthélémy - - - - - info:lc/vocabulary/gacs/pogu - Guam - pogu - - - info:lc/vocabulary/gacs/a-cc-kn - Guangdong Sheng (China) - a-cc-kn - - Kwangtung Province (China) - - - - info:lc/vocabulary/gacs/a-cc-kc - Guangxi Zhuangzu Zizhiqu (China) - a-cc-kc - - Kuang-hsi Chuang tsu tzu chih ch'ü (China) - - - Kwangsi Chuang Autonomous Region - - - - info:lc/vocabulary/gacs/ncgt - Guatemala - ncgt - - - info:lc/vocabulary/gacs/f-gv - Guinea - f-gv - - French Guinea - - - Guinea, French - - - Guinée - - - Republique de Guinée - - - - info:lc/vocabulary/gacs/f-pg - Guinea-Bissau - f-pg - - Guinea, Portuguese - - - Portuguese Guinea - - - - info:lc/vocabulary/gacs/a-cc-kw - Guizhou Sheng (China) - a-cc-kw - - Kweichow Province (China) - - - - info:lc/vocabulary/gacs/s-gy - Guyana - s-gy - - British Guiana - - - Guiana, British - - - - info:lc/vocabulary/gacs/a-cc-ha - Hainan Sheng (China) - a-cc-ha - - Coded [a-cc-kn] (Kwangtung Province (China)) before June 1998 - - - Hainan Island (China) - - - Hainan Province (China) - - - - info:lc/vocabulary/gacs/nwht - Haiti - nwht - - - info:lc/vocabulary/gacs/n-us-hi - Hawaii - n-us-hi - - Sunbelt States - - - - info:lc/vocabulary/gacs/i-hm - Heard and McDonald Islands - i-hm - - Heard Island (Heard and McDonald Islands) - - - McDonald Island (Heard and McDonald Islands) - - - - info:lc/vocabulary/gacs/a-cc-hp - Hebei Sheng (China) - a-cc-hp - - Ho-pei sheng (China) - - - Hopeh Province (China) - - - - info:lc/vocabulary/gacs/a-cc-he - Heilongjiang Sheng (China) - a-cc-he - - Heilungkiang Province (China) - - - - info:lc/vocabulary/gacs/a-cc-ho - Henan Sheng (China) - a-cc-ho - - Honan Province (China) - - - - info:lc/vocabulary/gacs/ah - Himalaya Mountains - ah - - - info:lc/vocabulary/gacs/nwhi - Hispaniola - nwhi - - - info:lc/vocabulary/gacs/ncho - Honduras - ncho - - - info:lc/vocabulary/gacs/a-cc-hk - Hong Kong (China) - a-cc-hk - - Coded [a-hk] (Hong Kong) before June 1998 - - - Hong Kong - - - Hong Kong (China : Special Administrative Region) - - - - info:lc/vocabulary/gacs/a-cc-hh - Hubei Sheng (China) - a-cc-hh - - Hu-pei (China) - - - Hupeh Province (China) - - - - info:lc/vocabulary/gacs/n-cnh - Hudson Bay - n-cnh - - - info:lc/vocabulary/gacs/a-cc-hu - Hunan Sheng (China) - a-cc-hu - - Hunan Province (China) - - - - info:lc/vocabulary/gacs/e-hu - Hungary - e-hu - - Pannonia - - - - info:lc/vocabulary/gacs/e-ic - Iceland - e-ic - - - info:lc/vocabulary/gacs/n-us-id - Idaho - n-us-id - - - info:lc/vocabulary/gacs/n-us-il - Illinois - n-us-il - - - info:lc/vocabulary/gacs/a-ii - India - a-ii - - Andaman and Nicobar Islands (India) - - - French India - - India, French - - - - Jammu and Kashmir (India) - - Kashmir - - - Kashmir and Jammu (India) - - - - Lakshadweep (India) - - Laccadive, Minicoy, and Amindivi Islands (India) - - - - Sikkim (India) - - Coded [a-sk] (Sikkim) before Mar. 1988 - - - - - info:lc/vocabulary/gacs/i - Indian Ocean - i - - Islands of the Indian Ocean - - - Timor Sea - - - - info:lc/vocabulary/gacs/n-us-in - Indiana - n-us-in - - - info:lc/vocabulary/gacs/ai - Indochina - ai - - French Indochina - - - - info:lc/vocabulary/gacs/a-io - Indonesia - a-io - - Celebes (Indonesia) - - Sulawesi (Indonesia) - - - - Java (Indonesia) - - - Kalimantan Barat (Indonesia) - - - Lesser Sunda Islands (Indonesia and East Timor) - - - Madura Island (Indonesia) - - - Maluku (Indonesia) - - Moluccas (Indonesia) - - - - Papua (Indonesia) - - Irian Barat (Indonesia) - - - Irian Jaya (Indonesia) - - - West Irian - - - West New Guinea - - - - Sunda Islands, Lesser (Indonesia and East Timor) - - - Sumatra (Indonesia) - - - Timor Island - - - Dutch East Indies - - - Netherlands East Indies - - - - info:lc/vocabulary/gacs/a-cc-im - Inner Mongolia (China) - a-cc-im - - Mongolia (Inner Mongolia) - - - - info:lc/vocabulary/gacs/m - Intercontinental areas (Eastern Hemisphere) - m - - - info:lc/vocabulary/gacs/c - Intercontinental areas (Western Hemisphere) - c - - - info:lc/vocabulary/gacs/n-us-ia - Iowa - n-us-ia - - - info:lc/vocabulary/gacs/a-ir - Iran - a-ir - - Armenia - - - Persia - - - - info:lc/vocabulary/gacs/a-iq - Iraq - a-iq - - Babylonia - - - - info:lc/vocabulary/gacs/e-ie - Ireland - e-ie - - Aran Islands (Ireland) - - - British Isles - - - Eire - - - Ireland (Eire) - - - Irish Republic - - - Republic of Ireland - - - - info:lc/vocabulary/gacs/a-is - Israel - a-is - - Jerusalem - - - Palestine - - - - info:lc/vocabulary/gacs/e-it - Italy - e-it - - Sardinia (Italy) - - - Sicily (Italy) - - - - info:lc/vocabulary/gacs/nwjm - Jamaica - nwjm - - - info:lc/vocabulary/gacs/lnjn - Jan Mayen Island - lnjn - - - info:lc/vocabulary/gacs/a-ja - Japan - a-ja - - Okinawa Island (Japan) - - Coded [a-ok] (Okinawa) before 1984] - - - - Ryukyu Islands - - - Ryukyu Islands, Southern - - Coded [pory] (Ryukyu Islands, Southern) before 1984 - - - - - info:lc/vocabulary/gacs/a-cc-ku - Jiangsu Sheng (China) - a-cc-ku - - Kiangsu Province (China) - - - - info:lc/vocabulary/gacs/a-cc-ki - Jiangxi Sheng (China) - a-cc-ki - - Kiangsi Province (China) - - - - info:lc/vocabulary/gacs/a-cc-kr - Jilin Sheng (China) - a-cc-kr - - Kirin Province (China) - - - - info:lc/vocabulary/gacs/poji - Johnston Island - poji - - - info:lc/vocabulary/gacs/a-jo - Jordan - a-jo - - Transjordan - - - - info:lc/vocabulary/gacs/zju - Jupiter (Planet) - zju - - - info:lc/vocabulary/gacs/n-us-ks - Kansas - n-us-ks - - - info:lc/vocabulary/gacs/a-kz - Kazakhstan - a-kz - - Coded [e-ur-kz] (Kazakhstan) before June 1998 - - - Kazakh S.S.R. - - - Kazakstan - - - - info:lc/vocabulary/gacs/n-us-ky - Kentucky - n-us-ky - - - info:lc/vocabulary/gacs/f-ke - Kenya - f-ke - - East Africa Protectorate - - - - info:lc/vocabulary/gacs/poki - Kermadec Islands - poki - - - info:lc/vocabulary/gacs/pokb - Kiribati - pokb - - Coded [pogn] (Gilbert and Ellice Islands) or [poln] (Line Islands) before Mar. - 1988 - - - Banaba (Kiribati) - - Ocean Island (Kiribati) - - - - Canton and Enderbury Islands - - Coded [pocp] (Canton and Enderbury Islands) before Mar. 1988 - - - Enderbury and Canton Islands - - - - Gilbert and Ellice Islands Colony - - Coded [pogn] (Gilbert and Ellice Islands) before Mar. 1988 - - - - Kiritimati (Kiribati) - - Christmas Island (Pacific Ocean) - - - - Phoenix Islands (Kiribati) - - - Gilbert Islands - - - - info:lc/vocabulary/gacs/a-kr - Korea - a-kr - - - info:lc/vocabulary/gacs/a-kn - Korea (North) - a-kn - - Korean People's Republic - - - North Korea - - - - info:lc/vocabulary/gacs/a-ko - Korea (South) - a-ko - - Korea (Republic) - - - South Korea - - - - info:lc/vocabulary/gacs/e-kv - Kosovo - e-kv - - Coded [e-rb] (Serbia) before May 2008 and [e-yu] (Serbia and Montenegro) before April - 2007 - - - - info:lc/vocabulary/gacs/a-cck - Kunlun Mountains (China and India) - a-cck - - Kwenlun Mountains - - - - info:lc/vocabulary/gacs/a-ku - Kuwait - a-ku - - - info:lc/vocabulary/gacs/a-kg - Kyrgyzstan - a-kg - - Coded [e-ur-kg] (Kyrgystan) before June 1998 - - - Kirghiz S.S.R. - - - - info:lc/vocabulary/gacs/nl - Lake States - nl - - Great Lakes States - - - - info:lc/vocabulary/gacs/a-ls - Laos - a-ls - - - info:lc/vocabulary/gacs/cl - Latin America - cl - - Neotropics - - - - info:lc/vocabulary/gacs/e-lv - Latvia - e-lv - - Coded [e-ur-lv] (Latvia) before June 1998 - - - - info:lc/vocabulary/gacs/a-le - Lebanon - a-le - - - info:lc/vocabulary/gacs/nwli - Leeward Islands (West Indies) - nwli - - - info:lc/vocabulary/gacs/f-lo - Lesotho - f-lo - - Basutoland - - - - info:lc/vocabulary/gacs/a-cc-lp - Liaoning Sheng (China) - a-cc-lp - - Liaoning Province (China) - - - - info:lc/vocabulary/gacs/f-lb - Liberia - f-lb - - - info:lc/vocabulary/gacs/f-ly - Libya - f-ly - - Tibesti Mountains - - - - info:lc/vocabulary/gacs/e-lh - Liechtenstein - e-lh - - - info:lc/vocabulary/gacs/poln - Line Islands - poln - - - info:lc/vocabulary/gacs/e-li - Lithuania - e-li - - Coded [e-ur-li] (Lithuania) before March 1998 - - - - info:lc/vocabulary/gacs/n-us-la - Louisiana - n-us-la - - - info:lc/vocabulary/gacs/e-lu - Luxembourg - e-lu - - - info:lc/vocabulary/gacs/a-cc-mh - Macau (China : Special Administrative Region) - a-cc-mh - - Coded [a-mh] (Macao) before May 29, 2000 - - - Macao - - - - info:lc/vocabulary/gacs/e-xn - Macedonia (Republic)] - e-xn - - Coded [e-yu] (Yugoslavia) before Oct. 1992 - - - Macedonia - - - - info:lc/vocabulary/gacs/f-mg - Madagascar - f-mg - - Malagasy Republic - - - - info:lc/vocabulary/gacs/lnma - Madeira Islands - lnma - - Selvagens Islands (Madeira Islands) - - Salvage Islands (Madeira Islands) - - - Salvages (Madeira Islands) - - - - - info:lc/vocabulary/gacs/n-us-me - Maine - n-us-me - - - info:lc/vocabulary/gacs/f-mw - Malawi - f-mw - - Rhodesia and Nyasaland - - Federation of Rhodesia and Nyasaland - - - - Nyasaland - - - - info:lc/vocabulary/gacs/am - Malaya - am - - Malay Peninsula - - - - info:lc/vocabulary/gacs/a-my - Malaysia - a-my - - Sabah - - British North Borneo - - - North Borneo - - - - Sarawak - - - Straits Settlements - - - - info:lc/vocabulary/gacs/i-xc - Maldives - i-xc - - - info:lc/vocabulary/gacs/f-ml - Mali - f-ml - - Songhai Empire - - - French Sudan - - - Sudan, French - - - - info:lc/vocabulary/gacs/e-mm - Malta - e-mm - - - info:lc/vocabulary/gacs/n-cn-mb - Manitoba - n-cn-mb - - - info:lc/vocabulary/gacs/poxd - Mariana Islands - poxd - - Commonwealth of the Northern Mariana Islands - - - Northern Mariana Islands - - - - info:lc/vocabulary/gacs/n-cnm - Maritime Provinces - n-cnm - - - info:lc/vocabulary/gacs/zma - Mars (Planet) - zma - - Red Planet - - - - info:lc/vocabulary/gacs/poxe - Marshall Islands - poxe - - Bikini Atoll (Marshall Islands) - - - - info:lc/vocabulary/gacs/nwmq - Martinique - nwmq - - - info:lc/vocabulary/gacs/n-us-md - Maryland - n-us-md - - Chesapeake Bay (Md. and Va.) - - - Washington Region - - - - info:lc/vocabulary/gacs/n-us-m - Massachusetts - n-us-m - - - info:lc/vocabulary/gacs/f-mu - Mauritania - f-mu - - - info:lc/vocabulary/gacs/i-mf - Mauritius - i-mf - - - info:lc/vocabulary/gacs/i-my - Mayotte - i-my - - Coded [i-cq] (Comoros) before Mar. 1988 - - - - info:lc/vocabulary/gacs/mm - Mediterranean Region - mm - - Byzantine Empire - - - - info:lc/vocabulary/gacs/mm - Mediterranean Sea - mm - - Adriatic Sea - - - Gibraltar, Strait of - - Strait of Gibraltar - - - - Islands of the Mediterranean - - - - info:lc/vocabulary/gacs/ag - Mekong River - ag - - Dza-chu - - - Lan-ts'ang Chiang - - - Lancang Jiang - - - Song Tíên Giang - - - - info:lc/vocabulary/gacs/pome - Melanesia - pome - - - info:lc/vocabulary/gacs/zme - Mercury (Planet) - zme - - - info:lc/vocabulary/gacs/n-mx - Mexico - n-mx - - Colorado River (Colo.-Mexico) - - - Colorado River Delta (Mexico) - - - Middle America - - Coded [cm] (Middle America) before Mar. 1988 - - - - - info:lc/vocabulary/gacs/nm - Mexico, Gulf of - nm - - Gulf of Mexico - - - - info:lc/vocabulary/gacs/n-us-mi - Michigan - n-us-mi - - - info:lc/vocabulary/gacs/pott - Micronesia - pott - - - info:lc/vocabulary/gacs/pomi - Micronesia (Federated States) - pomi - - Coded [pott] (Micronesia) before Mar. 1988 - - - Chuuk (Micronesia) - - Truk (Micronesia) - - - - Kosrae (Micronesia) - - Kusaie (Micronesia) - - - - Pohnpei (Micronesia) - - Ponape (Micronesia) - - - - Yap (Micronesia) - - - Federated States of Micronesia - - - - info:lc/vocabulary/gacs/n-usl - Middle Atlantic States - n-usl - - Middle States - - - - info:lc/vocabulary/gacs/aw - Middle East - aw - - Islamic Empire - - - Latin Orient - - - Rome - - Roman Empire - - - - Asia, Southwestern - - - Asia, Western - - - East (Near East) - - - Eastern Mediterranean - - - Levant - - - Mediterranean Region, Eastern - - - Mideast - - - Near East - - - - info:lc/vocabulary/gacs/n-usc - Middle West - n-usc - - Northwest, Old - - - Midwest - - - North Central States - - - - info:lc/vocabulary/gacs/poxf - Midway Islands - poxf - - - info:lc/vocabulary/gacs/n-us-mn - Minnesota - n-us-mn - - - info:lc/vocabulary/gacs/n-us-ms - Mississippi - n-us-ms - - - info:lc/vocabulary/gacs/n-usm - Mississippi River - n-usm - - - info:lc/vocabulary/gacs/n-us-mo - Missouri - n-us-mo - - Ozark Mountains - - - - info:lc/vocabulary/gacs/n-uss - Missouri River - n-uss - - - info:lc/vocabulary/gacs/e-mv - Moldova - e-mv - - Coded [e-ur-mv] (Moldova) before June 1998 - - - Moldavia - - - Moldavian S.S.R. - - - - info:lc/vocabulary/gacs/e-mc - Monaco - e-mc - - - info:lc/vocabulary/gacs/a-mp - Mongolia - a-mp - - Mongolian People's Republic - - - Outer Mongolia - - - - info:lc/vocabulary/gacs/n-us-mt - Montana - n-us-mt - - - info:lc/vocabulary/gacs/e-mo - Montenegro - e-mo - - Coded [e-yu] (Yugoslavia) before April 2007 - - - - info:lc/vocabulary/gacs/nwmj - Montserrat - nwmj - - - info:lc/vocabulary/gacs/zmo - Moon - zmo - - - info:lc/vocabulary/gacs/f-mr - Morocco - f-mr - - Ifni - - Coded [f-if] (Ifni) before Mar. 1988 - - - - Tangier (Morocco) - - - French Morocco - - - - info:lc/vocabulary/gacs/f-mz - Mozambique - f-mz - - East Africa, Portuguese German East Africa - - - People's Republic of Mozambique - - - Portuguese East Africa - - - - info:lc/vocabulary/gacs/f-sx - Namibia - f-sx - - Africa, Southwest - - - South-West Africa - - - - info:lc/vocabulary/gacs/ponu - Nauru - ponu - - Pleasant Island - - - - info:lc/vocabulary/gacs/n-us-nb - Nebraska - n-us-nb - - - info:lc/vocabulary/gacs/a-np - Nepal - a-np - - - info:lc/vocabulary/gacs/zne - Neptune (Planet) - zne - - - info:lc/vocabulary/gacs/e-ne - Netherlands - e-ne - - Holland - - - - info:lc/vocabulary/gacs/nwna - Netherlands Antilles - nwna - - Dutch West Indies - - - Netherlands West Indies - - - West Indies, Dutch - - - - info:lc/vocabulary/gacs/n-us-nv - Nevada - n-us-nv - - - info:lc/vocabulary/gacs/n-cn-nk - New Brunswick - n-cn-nk - - - info:lc/vocabulary/gacs/ponl - New Caledonia - ponl - - Loyalty Islands (New Caledonia) - - - - info:lc/vocabulary/gacs/n-usn - New England - n-usn - - - info:lc/vocabulary/gacs/a-nw - New Guinea - a-nw - - New Guinea Island - - - - info:lc/vocabulary/gacs/n-us-nh - New Hampshire - n-us-nh - - - info:lc/vocabulary/gacs/n-us-nj - New Jersey - n-us-nj - - - info:lc/vocabulary/gacs/n-us-nm - New Mexico - n-us-nm - - - info:lc/vocabulary/gacs/u-at-ne - New South Wales - u-at-ne - - - info:lc/vocabulary/gacs/n-us-ny - New York (State) - n-us-ny - - - info:lc/vocabulary/gacs/u-nz - New Zealand - u-nz - - - info:lc/vocabulary/gacs/n-cn-nf - Newfoundland and Labrador - n-cn-nf - - Labrador (N.L.) - - - - info:lc/vocabulary/gacs/ncnq - Nicaragua - ncnq - - - info:lc/vocabulary/gacs/f-ng - Niger - f-ng - - Songhai Empire - - - Tibesti Mountains - - - - info:lc/vocabulary/gacs/fi - Niger River - fi - - - info:lc/vocabulary/gacs/f-nr - Nigeria - f-nr - - Adamawa (Emirate) - - - Songhai Empire - - - Biafra - - Coded [f-by] (Biafra) before Mar. 1988 - - - - - info:lc/vocabulary/gacs/fl - Nile River - fl - - - info:lc/vocabulary/gacs/a-cc-nn - Ningxia Huizu Zizhiqu (China) - a-cc-nn - - Ninghsia Province (China) - - - Ningsia Hui Autonomous Region (China) - - - - info:lc/vocabulary/gacs/poxh - Niue - poxh - - - info:lc/vocabulary/gacs/n - North America - n - - America - - - New France - - - Pacific Coast (North America) - - - - info:lc/vocabulary/gacs/ln - North Atlantic Ocean - ln - - Baltic Sea - - - Bermuda Triangle - - - English Channel - - - Fundy, Bay of - - Bay of Fundy - - - - Georges Bank - - - Irish Sea - - - North Sea - - - Norwegian Sea - - - Skagerrak (Denmark and Norway) - - - - info:lc/vocabulary/gacs/n-us-nc - North Carolina - n-us-nc - - - info:lc/vocabulary/gacs/n-us-nd - North Dakota - n-us-nd - - - info:lc/vocabulary/gacs/pn - North Pacific Ocean - pn - - Alaska, Gulf of (Alaska) - - Gulf of Alaska (Alaska) - - - - Bering Sea - - - Philippine Sea - - - Pacific Ocean, North - - - - info:lc/vocabulary/gacs/n-use - Northeastern States - n-use - - Northeast (U.S.) - - - - info:lc/vocabulary/gacs/u-atn - Northern Australia - u-atn - - Coded [u-at] (Australia) before September 2005 - - - Australia, Northern - - - - info:lc/vocabulary/gacs/xb - Northern Hemisphere - xb - - - info:lc/vocabulary/gacs/e-uk-ni - Northern Ireland - e-uk-ni - - Ireland, Northern - - - - info:lc/vocabulary/gacs/u-at-no - Northern Territory - u-at-no - - Carpentaria, Gulf of (N.T. and Qld.) - - Coded [ps] (South Pacific Ocean) before June 1998 - - - Gulf of Carpentaria (N.T. and Qld.) - - - - - info:lc/vocabulary/gacs/n-cn-nt - Northwest Territories - n-cn-nt - - - info:lc/vocabulary/gacs/e-no - Norway - e-no - - Lapland - - - - info:lc/vocabulary/gacs/n-cn-ns - Nova Scotia - n-cn-ns - - - info:lc/vocabulary/gacs/n-cn-nu - Nunavut - n-cn-nu - - - info:lc/vocabulary/gacs/po - Oceania - po - - Oceanica - - - - info:lc/vocabulary/gacs/n-us-oh - Ohio - n-us-oh - - - info:lc/vocabulary/gacs/n-uso - Ohio River - n-uso - - - info:lc/vocabulary/gacs/n-us-ok - Oklahoma - n-us-ok - - Indian Territory - - - Ozark Mountains - - - - info:lc/vocabulary/gacs/a-mk - Oman - a-mk - - Arabia, Southern - - - Muscat and Oman - - - - info:lc/vocabulary/gacs/n-cn-on - Ontario - n-cn-on - - - info:lc/vocabulary/gacs/n-us-or - Oregon - n-us-or - - Pacific States - - - - info:lc/vocabulary/gacs/zo - Outer space - zo - - Space, Outer - - - - info:lc/vocabulary/gacs/p - Pacific Ocean - p - - Pacific Area - - - - info:lc/vocabulary/gacs/a-pk - Pakistan - a-pk - - Azad Kashmir - - Azad Jammu and Kashmir - - - Kashmir - - - - West Pakistan - - - - info:lc/vocabulary/gacs/popl - Palau - popl - - Coded [poci] (Caroline Islands) before Mar. 1988 - - - Belau - - - Pelew - - - Republic of Palau - - - - info:lc/vocabulary/gacs/ncpn - Panama - ncpn - - - info:lc/vocabulary/gacs/a-pp - Papua New Guinea - a-pp - - Admiralty Islands (Papua New Guinea) - - - Bismarck Archipelago (Papua New Guinea) - - - Bougainville Island (Papua New Guinea) - - - D'Entrecasteaux Islands (Papua New Guinea) - - - Louisiade Archipelago (Papua New Guinea) - - - New Britain Island (Papua New Guinea) - - - New Guinea (Territory) - - - New Ireland Island (Papua New Guinea) - - - Papua - - - Trobriand Islands (Papua New Guinea) - - - Woodlark Islands (Papua New Guinea) - - - - info:lc/vocabulary/gacs/aopf - Paracel Islands - aopf - - Hoàng Sa - - - Hsi-sha Islands - - - Xisha Islands - - - - info:lc/vocabulary/gacs/s-py - Paraguay - s-py - - - info:lc/vocabulary/gacs/n-us-pa - Pennsylvania - n-us-pa - - - info:lc/vocabulary/gacs/ap - Persian Gulf - ap - - - info:lc/vocabulary/gacs/s-pe - Peru - s-pe - - - info:lc/vocabulary/gacs/a-ph - Philippines - a-ph - - Eastern Samar (Philippines) - - - Luzon (Philippines) - - - Mindanao Island (Philippines) - - - Negros Island (Philippines) - - - Northern Samar (Philippines) - - - Panay Island (Philippines) - - - Samar (Philippines) - - - Philippine Islands - - - - info:lc/vocabulary/gacs/popc - Pitcairn Island - popc - - - info:lc/vocabulary/gacs/zpl - Pluto (Planet) - zpl - - - info:lc/vocabulary/gacs/e-pl - Poland - e-pl - - - info:lc/vocabulary/gacs/pops - Polynesia - pops - - - info:lc/vocabulary/gacs/e-po - Portugal - e-po - - Iberian Peninsula - - Coded [ei] (Iberian Peninsula) before Mar. 1988 - - - - - info:lc/vocabulary/gacs/n-cnp - Prairie Provinces - n-cnp - - Canada, Western - - Western Canada - - - - - info:lc/vocabulary/gacs/n-cn-pi - Prince Edward Island - n-cn-pi - - - info:lc/vocabulary/gacs/nwpr - Puerto Rico - nwpr - - - info:lc/vocabulary/gacs/ep - Pyrenees - ep - - Pirineos - - - - info:lc/vocabulary/gacs/a-qa - Qatar - a-qa - - - info:lc/vocabulary/gacs/a-cc-ts - Qinghai Sheng (China) - a-cc-ts - - Tsinghai Province (China) - - - - info:lc/vocabulary/gacs/n-cn-qu - Québec (Province) - n-cn-qu - - - info:lc/vocabulary/gacs/u-at-qn - Queensland - u-at-qn - - Carpentaria, Gulf of (N.T. and Qld.) - - Coded [ps] (South Pacific Ocean) before June 1998 - - - Gulf of Carpentaria (N.T. and Qld.) - - - - Great Barrier Reef (Qld.) - - - Torres Strait Islands (Qld.) - - - - info:lc/vocabulary/gacs/mr - Red Sea - mr - - Aden, Gulf of - - Gulf of Aden - - - - Aqaba, Gulf of - - Gulf of Aqaba - - - - - info:lc/vocabulary/gacs/i-re - Réunion - i-re - - - info:lc/vocabulary/gacs/er - Rhine River - er - - - info:lc/vocabulary/gacs/n-us-ri - Rhode Island - n-us-ri - - - info:lc/vocabulary/gacs/su - Rio de la Plata (Argentina and Uruguay) - su - - La Plata River (Argentina and Uruguay) - - - Plata, Rio de la (Argentina and Uruguay) - - - Plate River (Argentina and Uruguay) - - - - info:lc/vocabulary/gacs/nr - Rocky Mountains - nr - - - info:lc/vocabulary/gacs/e-rm - Romania - e-rm - - Moldavia - - - Rumania - - - - info:lc/vocabulary/gacs/e-ru - Russia (Federation) - e-ru - - Coded [e-ur-ru] (Russia (Federation)) before June 1998 - - - Kievan Rus - - Coded [e-ur] (Soviet Union) before June 1998 - - - Kuril Islands (Russia) - - Coded [e-ur-ru] (Russia Federation) before June 1998 - - - Chishima-retto (Russia) - - - Kurile Islands (Russia) - - - Kuril'skie ostrova (Russia) - - - Non-Chernozem Region (Russia) - - Coded [e-ur-ru] (Russia Federation) before June 1998 - - - Non-Black Earth Region (Russia) - - - - Russia, Northern - - Coded [e-ur-ru] (Russia (Federation)) before June 1998 - - - Northern Russia - - - Northern Soviet Union - - - Soviet Union, Northern - - - - Sakha (Russia) - - Àkutskaíà A.S.S.R. (Russia) - - - Yakutia (Russia) - - - - Volgo-Viatskii Region (Russia) - - Coded [e-urv] (Volgo-Viatskii Region, RSFSR) before Mar. 1988 - - - - R.S.F.S.R. - - - Russian Republic - - - Russian S.F.S.R. - - - Russian Soviet Federated Socialist Republic - - - - info:lc/vocabulary/gacs/e-urf - Russian Far East (Russia) - e-urf - - Far East (Russia) - - - Far Eastern Region (Russia) - - - Soviet Far East (Russia) - - Coded [e-uro] (Soviet Central Asia) before 1994 - - - - - info:lc/vocabulary/gacs/f-rw - Rwanda - f-rw - - Ruanda-Urundi - - - German East Africa - - - - info:lc/vocabulary/gacs/nwsd - Saba (Netherlands Antilles) - nwsd - - - info:lc/vocabulary/gacs/fd - Sahara - fd - - Sahara Desert - - - - info:lc/vocabulary/gacs/lsxj - Saint Helena - lsxj - - St. Helena - - - - info:lc/vocabulary/gacs/nwxi - Saint Kitts and Nevis - nwxi - - Nevis - - - Saint Kitts - - - Saint Kitts-Nevis-Anguilla - - St. Christopher-Nevis-Anguilla - - - - Saint Christopher and Nevis - - - - info:lc/vocabulary/gacs/nwxk - Saint Lucia - nwxk - - St. Lucia - - - - info:lc/vocabulary/gacs/nwst - Saint Martin (West Indies) - nwst - - Sint Maarten (West Indies) - - - St. Martin (West Indies) - - - - info:lc/vocabulary/gacs/n-xl - Saint Pierre and Miquelon - n-xl - - Miquelon - - - Iles Saint-Pierre et Miquelon - - - St. Pierre and Miquelon - - - - info:lc/vocabulary/gacs/nwxm - Saint Vincent and the Grenadines - nwxm - - Grenadines (Saint Vincent and the Grenadines and Grenada) - - - Saint Vincent - - St. Vincent - - - - - info:lc/vocabulary/gacs/pows - Samoa - pows - - Western Samoa - - - - info:lc/vocabulary/gacs/posh - Samoan Islands - posh - - Samoa (Islands) - - - - info:lc/vocabulary/gacs/e-sm - San Marino - e-sm - - - info:lc/vocabulary/gacs/f-sf - Sao Tome and Principe - f-sf - - São Thomé e Pr¡ncipe - - - - info:lc/vocabulary/gacs/n-cn-sn - Saskatchewan - n-cn-sn - - - info:lc/vocabulary/gacs/zsa - Saturn (Planet) - zsa - - - info:lc/vocabulary/gacs/a-su - Saudi Arabia - a-su - - - info:lc/vocabulary/gacs/ev - Scandinavia - ev - - - info:lc/vocabulary/gacs/e-uk-st - Scotland - e-uk-st - - Shetland (Scotland) - - - Orkney (Scotland) - - - - info:lc/vocabulary/gacs/f-sg - Senegal - f-sg - - - info:lc/vocabulary/gacs/e-rb - Serbia - e-rb - - Coded [e-yu] (Yugoslavia) before April 2007 - - - - info:lc/vocabulary/gacs/i-se - Seychelles - i-se - - - info:lc/vocabulary/gacs/a-cc-ss - Shaanxi Sheng (China) - a-cc-ss - - Shensi Province (China) - - - - info:lc/vocabulary/gacs/a-cc-sp - Shandong Sheng (China) - a-cc-sp - - Shantung Province (China) - - - - info:lc/vocabulary/gacs/a-cc-sm - Shanghai (China) - a-cc-sm - - - info:lc/vocabulary/gacs/a-cc-sh - Shanxi Sheng (China) - a-cc-sh - - Shansi Province (China) - - - - info:lc/vocabulary/gacs/e-urs - Siberia (Russia) - e-urs - - Siberia, Northeastern (Russia) - - - Siberia, Northwestern (Russia) - - - - info:lc/vocabulary/gacs/e-ure - Siberia, Eastern (Russia) - e-ure - - East Siberian Region (Russia) - - - Eastern Siberia (Russia) - - - - info:lc/vocabulary/gacs/e-urw - Siberia, Western (Russia) - e-urw - - Western Siberia (Russia) - - - - info:lc/vocabulary/gacs/a-cc-sz - Sichuan Sheng (China) - a-cc-sz - - Szechwan Province (China) - - - - info:lc/vocabulary/gacs/f-sl - Sierra Leone - f-sl - - - info:lc/vocabulary/gacs/a-si - Singapore - a-si - - Straits Settlements - - - - info:lc/vocabulary/gacs/nweu - Sint Eustatius (Netherlands Antilles) - nweu - - Saint Eustatius (Netherlands Antilles) - - - St. Eustatius (Netherlands Antilles) - - - Statia (Netherlands Antilles) - - - - info:lc/vocabulary/gacs/e-xo - Slovakia - e-xo - - Coded [e-cs] (Czechoslovakia) before May 1993 - - - Slovak Socialist Republic (Czechoslovakia) - - - - info:lc/vocabulary/gacs/e-xv - Slovenia - e-xv - - Coded [e-yu] (Yugoslavia) before Oct. 1992 - - - - info:lc/vocabulary/gacs/zs - Solar system - zs - - - info:lc/vocabulary/gacs/pobp - Solomon Islands - pobp - - Coded also [posn] (Solomon Islands) before Mar. 1988 - - - Guadalcanal (Solomon Islands) - - - Santa Cruz Islands (Solomon Islands) - - Coded [posc] (Santa Cruz Islands) before Mar. 1988 - - - - British Solomon Islands - - - - info:lc/vocabulary/gacs/f-so - Somalia - f-so - - British Somaliland - - - Italian Somaliland - - - Somali Republic - - - - info:lc/vocabulary/gacs/f-sa - South Africa - f-sa - - Bophuthatswana (South Africa) - - - Homelands (South Africa) - - - Prince Edward Islands - - Froides, Îles - - - Îles Froides - - - - Africa, South - - - Union of South Africa - - - - info:lc/vocabulary/gacs/s - South America - s - - America - - - - info:lc/vocabulary/gacs/az - South Asia - az - - East Indies - - Indies, East - - - - Asia, South - - - - info:lc/vocabulary/gacs/ls - South Atlantic Ocean - ls - - Guinea, Gulf of - - Gulf of Guinea - - - - - info:lc/vocabulary/gacs/u-at-sa - South Australia - u-at-sa - - - info:lc/vocabulary/gacs/n-us-sc - South Carolina - n-us-sc - - - info:lc/vocabulary/gacs/ao - South China Sea - ao - - Islands of the South China Sea - - - - info:lc/vocabulary/gacs/n-us-sd - South Dakota - n-us-sd - - - info:lc/vocabulary/gacs/lsxs - South Georgia and South Sandwich Islands - lsxs - - Coded [lsfk] (Falkland Islands) before Oct. 1992 - - - Sandwich Islands, South - - Coded [lsfk] (Falkland Islands) before Oct. 1992 - - - - South Sandwich Islands - - Coded [lsfk] (Falkland Islands) before Oct. 1992 - - - - - info:lc/vocabulary/gacs/ps - South Pacific Ocean - ps - - Arafura Sea - - - Pacific Ocean, South - - - - info:lc/vocabulary/gacs/as - Southeast Asia - as - - East Indies - - Indies, East - - - - Malay Archipelagon - - - Asia, Southeastern - - - Southeastern Asia - - - - info:lc/vocabulary/gacs/xc - Southern Hemisphere - xc - - - info:lc/vocabulary/gacs/n-usu - Southern States - n-usu - - Confederate States of America - - - Cumberland Mountains - - - Gulf States - - - South Atlantic States - - Atlantic States, South - - - - Southwest, Old - - - Southwestern States - - - Sunbelt States - - - - info:lc/vocabulary/gacs/n-ust - Southwest, New - n-ust - - Southwestern States - - - Sunbelt States - - - - info:lc/vocabulary/gacs/e-ur - Soviet Union - e-ur - - Communist countries - - Coded [v] (Communist countries) before June 1998 - - - - Russia - - Russian Empire - - - - Soviet Union, Southern - - Southern Soviet Union - - - - Soviet Union, Western - - Western Soviet Union - - - - Commonwealth of Independent States countries - - - Former Soviet republics - - - U.S.S.R. - - - - info:lc/vocabulary/gacs/e-urn - Soviet Union, Northwestern - e-urn - - Northwestern Soviet Union - - - - info:lc/vocabulary/gacs/e-sp - Spain - e-sp - - Balearic Islands (Spain) - - - Iberian Peninsula - - Coded [ei] (Iberian Peninsula) before Mar. 1988 - - - - Islamic Empire - - - - info:lc/vocabulary/gacs/f-sh - Spanish North Africa - f-sh - - Ceuta (Spain) - - - Melilla (Spain) - - - Spanish Territories in Northern Morocco - - - - info:lc/vocabulary/gacs/aoxp - Spratly Islands - aoxp - - Nansha Islands - - - Shinnan Islands - - - - info:lc/vocabulary/gacs/a-ce - Sri Lanka - a-ce - - Ceylon - - - - info:lc/vocabulary/gacs/f-sj - Sudan - f-sj - - Anglo-Egyptian Sudan - - - - info:lc/vocabulary/gacs/fn - Sudan (Region) - fn - - - info:lc/vocabulary/gacs/fu - Suez Canal (Egypt) - fu - - - info:lc/vocabulary/gacs/zsu - Sun - zsu - - - info:lc/vocabulary/gacs/s-sr - Suriname - s-sr - - Dutch Guiana - - - Guiana, Dutch - - - Surinam - - - - info:lc/vocabulary/gacs/lnsb - Svalbard (Norway) - lnsb - - Bear Island (Norway) - - Bjørnøya (Norway) - - - - Spitsbergen Island (Norway) - - West Spitsbergen (Norway) - - - - - info:lc/vocabulary/gacs/nwsv - Swan Islands (Honduras) - nwsv - - - info:lc/vocabulary/gacs/f-sq - Swaziland - f-sq - - - info:lc/vocabulary/gacs/e-sw - Sweden - e-sw - - Lapland - - - - info:lc/vocabulary/gacs/e-sz - Switzerland - e-sz - - - info:lc/vocabulary/gacs/a-sy - Syria - a-sy - - United Arab Republic - - - - info:lc/vocabulary/gacs/a-ch - Taiwan - a-ch - - Pescadores Islands - - - Pratas Islands - - - Formosa - - - - info:lc/vocabulary/gacs/a-ta - Tajikistan - a-ta - - Coded [e-ur-ta] (Tajikistan) before June 1998 - - - Tadzik Soviet Socialist Republic - - - Tajik S.S.R. - - - - info:lc/vocabulary/gacs/f-tz - Tanzania - f-tz - - Pemba Island (Tanzania) - - Huthera (Tanzania) - - - - Tanganyika - - - Zanzibar - - - German East Africa - - - - info:lc/vocabulary/gacs/u-at-tm - Tasmania - u-at-tm - - - info:lc/vocabulary/gacs/n-us-tn - Tennessee - n-us-tn - - - info:lc/vocabulary/gacs/i-fs - Terres australes et antarctiques françaises - i-fs - - Kerguelen Islands - - Desolation Islands - - - Îles Kerguélen - - - - French Southern and Antarctic Lands - - - French Southern Indian Ocean Islands - - - Indian Ocean Islands, French - - - T.A.A.F. - - - - info:lc/vocabulary/gacs/n-us-tx - Texas - n-us-tx - - - info:lc/vocabulary/gacs/a-th - Thailand - a-th - - Malay Peninsula - - - Siam - - - - info:lc/vocabulary/gacs/af - Thailand, Gulf of - af - - Gulf of Thailand - - - Siam, Gulf of - - - - info:lc/vocabulary/gacs/a-cc-tn - Tianjin (China) - a-cc-tn - - Tientsin (China) - - - - info:lc/vocabulary/gacs/a-cc-ti - Tibet (China) - a-cc-ti - - Tibetan Autonomous Region (China) - - - - info:lc/vocabulary/gacs/at - Tien Shan - at - - Thian Shan - - - Tian Shan - - - Tien Mountains - - - - info:lc/vocabulary/gacs/f-tg - Togo - f-tg - - Togoland - - - French Togoland - - - Togoland (French) - - - - info:lc/vocabulary/gacs/potl - Tokelau - potl - - Union Islands - - - - info:lc/vocabulary/gacs/poto - Tonga - poto - - Friendly Islands - - - Tonga Islands - - - - info:lc/vocabulary/gacs/nwtr - Trinidad and Tobago - nwtr - - Tobago - - - Trinidad - - - - info:lc/vocabulary/gacs/lstd - Tristan da Cunha - lstd - - - info:lc/vocabulary/gacs/w - Tropics - w - - Equator - - - - info:lc/vocabulary/gacs/f-ti - Tunisia - f-ti - - - info:lc/vocabulary/gacs/a-tu - Turkey - a-tu - - Aegean Islands (Greece and Turkey) - - Islands of the Aegean - - - - Aegean Sea - - - Armenia - - - Asia Minor - - - - info:lc/vocabulary/gacs/a-tk - Turkmenistan - a-tk - - Coded [e-ur-tk] (Turkmenistan) before June 1998 - - - Turkmen S.S.R. - - - - info:lc/vocabulary/gacs/nwtc - Turks and Caicos Islands - nwtc - - Caicos Islands - - - - info:lc/vocabulary/gacs/potv - Tuvalu - potv - - Coded [pogn] (Gilbert and Ellice Islands) before Mar. 1988 - - - Gilbert and Ellice Islands Colony - - Coded [pogn] (Gilbert and Ellice Islands) before Mar. 1988 - - - - Ellice Islands - - - - info:lc/vocabulary/gacs/f-ug - Uganda - f-ug - - - info:lc/vocabulary/gacs/e-un - Ukraine - e-un - - Coded [e-ur-un] (Ukraine) before June 1998 - - - Kievan Rus - - Coded [e-ur] (Soviet Union) before June 1998 - - - - - info:lc/vocabulary/gacs/a-ts - United Arab Emirates - a-ts - - Abū Ẓaby (United Arab Emirates: Emirate) - - Abu Dhabi (United Arab Emirates : Emirate) - - - - Dubayy (United Arab Emirates : Emirate) - - Dubai - - - - Trucial States - - - - info:lc/vocabulary/gacs/n-us - United States - n-us - - Atlantic Coast (U.S.) - - - Atlantic States - - - Saint Lawrence River - - - Snowbelt States - - Frostbelt (U.S.) - - - - - info:lc/vocabulary/gacs/nwuc - United States Miscellaneous Caribbean Islands - nwuc - - Caribbean Island Dependencies of the United States - - - Island Dependencies of the United States in the Caribbean - - - - info:lc/vocabulary/gacs/poup - United States Miscellaneous Pacific Islands - poup - - Includes American Samoa, Guam, Pacific Islands (Trust Territory) treated - collectively - - - Pacific Islands (Trust Territory) - - Pacific Islands (Ter.) - - - Trust Territory of the Pacific Islands - - - - Island Dependencies of the United States in the Pacific - - - Pacific Island Dependencies of the United States - - - - info:lc/vocabulary/gacs/e-uru - Ural Mountains (Russia) - e-uru - - - info:lc/vocabulary/gacs/zur - Uranus (Planet) - zur - - - info:lc/vocabulary/gacs/s-uy - Uruguay - s-uy - - - info:lc/vocabulary/gacs/n-us-ut - Utah - n-us-ut - - - info:lc/vocabulary/gacs/a-uz - Uzbekistan - a-uz - - Coded [e-ur-uz] (Uzbekistan) before June 1998 - - - Uzbek S.S.R. - - - - info:lc/vocabulary/gacs/ponn - Vanuatu - ponn - - Banks Islands (Vanuatu) - - - New Hebrides - - - Republic of Vanuatu - - - - info:lc/vocabulary/gacs/e-vc - Vatican City - e-vc - - Holy See - - - - info:lc/vocabulary/gacs/s-ve - Venezuela - s-ve - - - info:lc/vocabulary/gacs/zve - Venus (Planet) - zve - - - info:lc/vocabulary/gacs/n-us-vt - Vermont - n-us-vt - - - info:lc/vocabulary/gacs/u-at-vi - Victoria - u-at-vi - - - info:lc/vocabulary/gacs/a-vt - Vietnam - a-vt - - Vietnam (Democratic Republic) - - Coded [a-vn] (Vietnam, North) before Mar. 1988 - - - North Vietnam - - - Vietnam, North - - - - Vietnam (Republic) - - Coded [a-vs] (Viet Nam, South) before Mar. 1988 - - - South Vietnam - - - Vietnam, South - - - - - info:lc/vocabulary/gacs/nwvi - Virgin Islands of the United States - nwvi - - Virgin Islands - - Coded [nwvr] (Virgin Islands) before Mar. 1988 - - - - Virgin Islands (American) - - - Virgin Islands (Danish) - - - - info:lc/vocabulary/gacs/n-us-va - Virginia - n-us-va - - Chesapeake Bay (Md. and Va.) - - - Washington Region - - - - info:lc/vocabulary/gacs/e-urp - Volga River (Russia) - e-urp - - - info:lc/vocabulary/gacs/fv - Volta River (Ghana) - fv - - - info:lc/vocabulary/gacs/powk - Wake Island - powk - - - info:lc/vocabulary/gacs/e-uk-wl - Wales - e-uk-wl - - - info:lc/vocabulary/gacs/powf - Wallis and Futuna Islands - powf - - Futuna Islands (Wallis and Futuna Islands) - - - Uvea Island (Wallis and Futuna Islands) - - - - info:lc/vocabulary/gacs/n-us-dc - Washington (D.C.) - n-us-dc - - Washington Region - - - District of Columbia - - - - info:lc/vocabulary/gacs/n-us-wa - Washington (State) - n-us-wa - - Pacific States - - - - info:lc/vocabulary/gacs/n-usp - West (U.S.) - n-usp - - Colorado River (Colo.-Mexico) - - - Great Basin - - - Northwest, Pacific - - Northwest (U.S.) - - - Pacific Northwest - - - - Northwestern States - - - Far West (U.S.) - - - Pacific and Mountain States - - - Western States (U.S.) - - - - info:lc/vocabulary/gacs/awba - West Bank - awba - - Coded [a-is] (Israel) and/or [a-jo] (Jordan) before Mar. 1988 - - - Jerusalem - - - Palestine - - - Judaea and Samaria - - - West Bank of the Jordan River - - - - info:lc/vocabulary/gacs/nw - West Indies - nw - - Antilles, Greater - - Coded [nwga] (Greater Antilles) before Mar. 1988 - - - - Greater Antilles - - Coded [nwga] (Greater Antilles) before Mar. 1988 - - - - Indies, West - - - - info:lc/vocabulary/gacs/n-us-wv - West Virginia - n-us-wv - - - info:lc/vocabulary/gacs/u-at-we - Western Australia - u-at-we - - Australia, Western - - - - info:lc/vocabulary/gacs/xd - Western Hemisphere - xd - - - info:lc/vocabulary/gacs/f-ss - Western Sahara - f-ss - - Spanish Sahara - - - - info:lc/vocabulary/gacs/nwwi - Windward Islands (West Indies) [nwwi] - nwwi - - - info:lc/vocabulary/gacs/n-us-wi - Wisconsin - n-us-wi - - - info:lc/vocabulary/gacs/n-us-wy - Wyoming - n-us-wy - - - info:lc/vocabulary/gacs/a-ccs - Xi River (China) - a-ccs - - Hsi Chiang (China) - - - Si Kiang (China) - - - Si River (China) - - - West River (China) - - - - info:lc/vocabulary/gacs/a-cc-su - Xinjiang Uygur Zizhiqu (China) - a-cc-su - - Hsin-chiang-wei-wy-erh tzu chin chü (China) - - - Sinkiang Uighur Autonomous Region (China) - - - - info:lc/vocabulary/gacs/a-ccg - Yangtze River (China) - a-ccg - - Chang Chiang (China) - - - Long River (China) - - - - info:lc/vocabulary/gacs/a-ccy - Yellow River (China) - a-ccy - - Hoang Ho (China) - - - Huang Ho (China) - - - Hwang Ho (China) - - - - info:lc/vocabulary/gacs/ay - Yellow Sea - ay - - Huang Hai - - - Kwang Sea - - - - info:lc/vocabulary/gacs/a-ye - Yemen (Republic) - a-ye - - Aden - - Coded [a-ys] (Yemen (People's Democratic Republic) before Oct. 1992] - - - - Aden (Protectorate) - - Coded [a-ys] (Yemen (People's Democratic Republic) before Oct. 1992 - - - - Arabia, Southern - - - Federation of South Arabia - - South Arabia, Federation of - - - - Socotra (Yemen) - - Coded [i-xo] (Socotra Island) before Mar. 1988; Coded [a-ys] (Yemen (People's - Democratic Republic) before Oct. 1992 - - - Sokotra (Yemen) - - - - Arab Republic of Yemen - - - People's Democratic Republic of Yemen - - - Southern Yemen - - - Yemen (Arab Republic) - - - Yemen (People's Democratic Republic) - - Coded [a-ys] (Yemen (People's Democratic Republic) before Oct. 1992 - - - - - info:lc/vocabulary/gacs/e-yu - Yugoslavia - e-yu - - Pannonia - - - Former Yugoslav republics - - - - info:lc/vocabulary/gacs/n-cn-yk - Yukon Territory - n-cn-yk - - - info:lc/vocabulary/gacs/a-cc-yu - Yunnan Sheng (China) - a-cc-yu - - Yunnan Province (China) - - - - info:lc/vocabulary/gacs/fz - Zambezi River - fz - - Rio Zambezi - - - - info:lc/vocabulary/gacs/f-za - Zambia - f-za - - Rhodesia - - - Rhodesia and Nyasaland - - Federation of Rhodesia and Nyasaland - - - - Northern Rhodesia - - - - info:lc/vocabulary/gacs/a-cc-ch - Zhejiang Sheng (China) - a-cc-ch - - Chekiang Province (China) - - - - info:lc/vocabulary/gacs/f-rh - Zimbabwe - f-rh - - Rhodesia - - - Rhodesia and Nyasaland - - Federation of Rhodesia and Nyasaland - - - - Rhodesia, Southern - - - Southern Rhodesia - - - - diff --git a/form_elements/xml/languages.xml b/form_elements/xml/languages.xml deleted file mode 100644 index ef5e8eb3..00000000 --- a/form_elements/xml/languages.xml +++ /dev/null @@ -1,19575 +0,0 @@ - - - - - - - iso639-2b - MARC Code List for Languages - Network Development and MARC Standards Office, Library of Congress - info:lc/vocabulary/languages - - - - info:lc/vocabulary/languages/abk - Abkhaz - abk - - - info:lc/vocabulary/languages/ace - Achinese - ace - - Atjeh - - - - info:lc/vocabulary/languages/ach - Acoli - ach - - Acholi - - - Gang - - - Lwo - - - Shuli - - - - info:lc/vocabulary/languages/ada - Adangme - ada - - Dangme - - - - info:lc/vocabulary/languages/ady - Adygei - ady - - Circassian, Lower - - - Circassian, West - - - Kiakh - - - Kjax - - - Lower Circassian - - - West Circassian - - - - info:lc/vocabulary/languages/aar - Afar - aar - - Adaiel - - - Danakil - - - - info:lc/vocabulary/languages/afh - Afrihili (Artificial language) - afh - - - info:lc/vocabulary/languages/afr - Afrikaans - afr - - Afrikander - - - Cape Dutch - - - - info:lc/vocabulary/languages/afa - Afroasiatic (Other) - afa - - Angas - - Karan - - - Karang (Nigeria) - - - Ngas - - - - Bidiyo - - - Daba (Cameroon and Nigeria) - - - Dangaleat - - - Day (Chad) - - Dari (Chad) - - - Sara Dai - - - - Gabri - - - Gamo (Ethiopia) - - Gemu - - - - Glavda - - - Goemai - - Ankwe - - - Gamai (Nigeria) - - - Kemai - - - - Gude - - - Guruntum-Mbaaru - - Gurdung - - - Guruntum - - - - Hedi - - Hdi - - - - Huba - - Chobba - - - Kilba - - - - Jongor - - Dionkor - - - Djongor - - - - Kamwe - - Higi - - - Higgi - - - Hiji - - - Vacamwe - - - - Kanakuru - - Dera - - - - Kapsiki - - Kamsiki - - - Psikye - - - Ptsake - - - - Kera - - - Mada (Cameroon) - - - Mafa - - Matakam - - - Natakan - - - - Male (Ethiopia) - - Maale - - - - Masa (Chadic) - - Banaa - - - Banana (Masa) - - - Masana - - - Massa - - - Walai - - - - Miya - - - Musgu - - Masa - - - - Nancere - - - Ngizim - - Gwazum - - - Kirdiwat - - - Nugzum - - - Walu - - - - Paduko - - Podoko - - - - Ron - - Chala - - - Run - - - - Saya - - Sayanci - - - Sayara - - - Sayawa - - - Seiyara - - - Seya - - - Seyawa - - - - Southern Mofu - - Mofu, Southern - - - Mofu-Gudur - - - - Tera - - - Tumak - - Maga - - - Sara Toumak - - - Toumak - - - - Tupuri - - Ndore - - - Tuburi - - - - Uldeme - - Mizlime - - - Ouldémé - - - Udlam - - - Uzlam - - - Uzan - - - Wuzlam - - - - Wandala - - Mandara - - - - Yemsa - - Janjero - - - - Zaar - - Vigzar - - - Vikzar - - - - Zulgo - - Zelgwa - - - - - info:lc/vocabulary/languages/ain - Ainu - ain - - - info:lc/vocabulary/languages/aka - Akan - aka - - Twi-Fante - - - - info:lc/vocabulary/languages/akk - Akkadian - akk - - Assyro-Babylonian - - - Babylonian - - - - info:lc/vocabulary/languages/alb - Albanian - alb - - Calabrian Albanian - - Albanian, Calabrian - - - - - info:lc/vocabulary/languages/ale - Aleut - ale - - Eleuth - - - - info:lc/vocabulary/languages/alg - Algonquian (Other) - alg - - Abenaki - - Abnaki - - - - Algonquin - - Algonkin - - - - Atakapa - - - Atikamekw - - Attikamekw - - - Tête-de-Boule - - - - Fox - - - Illinois - - - Kickapoo - - - Mahican - - - Massachuset - - Natick - - - Niantic - - - Nonantum - - - - Menominee - - - Miami (Ind. and Okla.) - - - Mohegan - - Pequot - - - - Montagnais - - Innu (Montagnais) - - - Montagnais Innu - - - Montagnar - - - Montagnard - - - Montagnie - - - Mountainee - - - - Naskapi - - Nascapee - - - Naskapee - - - - Passamaquoddy - - Etchemin - - - Malecite - - - - Penobscot - - - Potawatomi - - - Powhatan - - - Quileute - - - Roanoak - - - Shawnee - - - Wampanoag - - - Yurok - - - - info:lc/vocabulary/languages/ajm - Aljamía - ajm - - - info:lc/vocabulary/languages/alt - Altai - alt - - Oirat (Turkic) - - - Southern Altai - - - - info:lc/vocabulary/languages/tut - Altaic (Other) - tut - - Turko-Tataric (Other) - - - Bulgaro-Turkic - - Turko-Bulgarian - - - (Altaic (Other)) - - - - Dagur - - Daghur - - - Daur - - - - Dolgan - - - Even - - Lamut - - - - Evenki - - O-wen-k`o - - - Tungus - - - - Gagauz - - - Greek Tatar - - Urum - - - - Karaim - - - Karakhanid - - Khakani - - - Qarakhanid - - - - Khakass - - Xakas - - - Xaqas - - - - Khalaj - - - Khitan - - Kitan - - - Liao - - - - Khorezmian Turkic - - Khwarezmian Turkic - - - - Kipchak - - Coman - - - Cuman - - - Falven - - - Kuman - - - Polovtsi - - - Walwen - - - - Moghol - - Mogol - - - - Mongolian, Middle (13th-16th centuries) - - Middle Mongolian (13th-16th centuries) - - - - Mongour - - Tu - - - - Nanai - - Goldi - - - - Northern Altai - - Altai, Northern - - - - Olcha - - Ulcha - - - - Old Turkic - - Turkic, Old - - - - Oroch - - - Oroqen - - Orochon - - - - Salar - - - Shor - - - Sibo - - Xive - - - - Teleut - - - Turkish, Old (to 1500) - - Anatolian Turkish, Old - - - Old Anatolian Turkish - - - Old Ottoman Turkish - - - Old Turkish - - - Ottoman Turkish, Old - - - - Udekhe - - - Western Yugur - - Yugur, Western - - - - - info:lc/vocabulary/languages/amh - Amharic - amh - - Amarigna - - - Amarinya - - - - info:lc/vocabulary/languages/anp - Angika - anp - - Anga - - - - info:lc/vocabulary/languages/apa - Apache languages - apa - - Chiricahua - - - Mescalero - - - White Mountain Apache - - - - info:lc/vocabulary/languages/ara - Arabic - ara - - Hassaniyya - - - - info:lc/vocabulary/languages/arg - Aragonese - arg - - Altoaragonés - - - Aragoieraz - - - Aragonés - - - Fabla Aragonesa - - - High Aragonese - - - Patués - - - Spanish, Aragonese - - - - info:lc/vocabulary/languages/arc - Aramaic - arc - - Aramean - - - Biblical Aramaic - - - Chaldaic - - - Chaldean (Aramaic) - - - Chaldee - - - - info:lc/vocabulary/languages/arp - Arapaho - arp - - - info:lc/vocabulary/languages/arw - Arawak - arw - - Loko (Arawakan) - - - Lokono - - - - info:lc/vocabulary/languages/arm - Armenian - arm - - Khayasa - - Hayasa - - - Khaiass - - - - - info:lc/vocabulary/languages/rup - Aromanian - rup - - Macedo-Romanian - - - - info:lc/vocabulary/languages/art - Artificial (Other) - art - - Ande (Artificial language) - - - Babm - - - Balaibalan - - Bâl-i bîlen - - - Bala-i-balan - - - Balabalan - - - Bâleybelen - - - Bali belen - - - Bâlibîlen - - - - Enochian - - - Europanto - - - Glosa (Artificial language) - - - International auxiliari linguo (Artificial language) - - INTAL (Artificial language) - - - - Loglan (Artificial language) - - - Neo (Artificial language) - - - Novial (Artificial language) - - - Tsolyáni (Artificial language) - - - Vela (Artificial language) - - - - info:lc/vocabulary/languages/asm - Assamese - asm - - Kāmrūpī - - - Rābhāmija - - Rābhāmiz - - - - - info:lc/vocabulary/languages/ath - Athapascan (Other) - ath - - Ahtena - - - Carrier - - Takulli - - - - Chilcotin - - Tsilkotin - - - - Dena'ina - - Tanaina - - - - Kaska - - - Kiowa Apache - - - Koyukon - - - Sarsi - - - Sekani-Beaver - - - Southern Tutchone - - Tutchone, Southern - - - - Tagish - - - Tahltan - - - Tanacross - - - Tsattine - - - Upper Tanana - - Tanana, Upper - - - - Upper Umpqua - - - - info:lc/vocabulary/languages/aus - Australian languages - aus - - Adnyamathanha - - Atynyamatana - - - Wailpi - - - - Alawa - - Galawa - - - - Alyawarra - - Iliaura - - - - Anindilyakwa - - Andilyaugwa - - - - Awabakal - - - Bandjalang - - Minyung - - - - Bidjara - - Pitjara - - - - Biri (Australia) - - Birri (Australia) - - - - Burarra - - Bara (Australia) - - - Jikai - - - Tchikai - - - - Butchulla - - - Darling River dialects - - Bagandji dialects - - - - Dhungutti - - Daingatti - - - Dyangadi - - - Thangatti - - - - Djaru - - Jaroo - - - Tjaru - - - - Djinang - - Jandjinung - - - Yandjinung - - - - Djingili - - Jingulu - - - Tjingili - - - - Eastern Arrernte - - Aranda, Eastern - - - Arrernte, Eastern - - - - Garawa - - Karawa (Australia) - - - Korrawa - - - Kurrawar - - - Leearrawa - - - - Gidabal - - Kitabul - - - - Gubbi-Gubbi - - Kabi Kabi - - - - Gugada - - Kukota - - - - Gumatj - - Gomadj - - - Kainyao - - - Komaits - - - Kumait - - - - Gungabula - - Kongabula - - - - Gunian - - Gooniyandi - - - - Gunwinggu - - - Gupapuyngu - - - Guugu Yimithirr - - - Iwaidja - - Jiwadja - - - Yiwadja - - - - Kala Lagaw Ya - - Mabuiaq - - - - Kalkatungu - - Galgadung - - - - Kattang - - Kutthung - - - - Kitja - - Gidja - - - Kija - - - - Kuku-Yalanji - - Gugu Yalanji - - - Koko Jelandji - - - - Kuuku Ya'u - - Koko Ya'o - - - - Kwini - - Belaa - - - Cuini - - - Goonan - - - Gunin - - - Gwiini - - - Gwini - - - Kunan (Kwini) - - - Kwini/Belaa - - - Wunambal (Kwini) - - - - Malgana - - Maldjana - - - Maljanna - - - Malkana - - - - Mandjildjara - - Mantjiltjara - - - - Mangarayi - - Manggarai (Australia) - - - Mungerry - - - - Maranunggu - - - Martu Wangka - - - Murrinhpatha - - - Nakara - - - Narangga - - Narungga - - - - Narrinyeri - - - Ngaanyatjarra - - - Ngandi - - - Ngarinyin - - Ungarinjin - - - Wungarinjin - - - - Ngarla - - - Ngarluma - - - Nukunu - - Nugunu - - - - Nunggubuyu - - Wubuy - - - - Pintupi - - Bindubi - - - - Pitjantjatjara - - - Proto Mirndi - - - Ritharrngu - - - Tharrkari - - Dhargari - - - - Tiwi (Australia) - - - Umpila - - - Walmajarri - - - Wandarang - - Andarang - - - Nawariyi - - - - Wanʼguri - - Wonguri - - - - Warlpiri - - Elpira - - - Ilpara - - - Ngaliya - - - Ngardilpa - - - Wailbri - - - Walbiri - - - Waljbiri - - - Walmama - - - Walpiri - - - Warnayaka - - - Warrmarla - - - - Warumungu - - - Western Arrernte - - Aranda, Western - - - Arrernte, Western - - - - Western Desert - - - Wik-Munkan - - Munggan - - - - Wik-Ngathan - - Wik-Ngathana - - - - Worora - - - Wunambal - - Jeidji - - - Jeithi - - - Unambal - - - Wumnabal - - - Wunambullu - - - Yeidji - - - Yeithi - - - - Yandruwandha - - - Yanyuwa - - - Yawuru - - Jaudjibara - - - Jawadjag - - - Jawdjibaia - - - Jawdjibara - - - Winjawindjagu - - - Yaudijbaia - - - Yaudjibara - - - Yawjibara - - - - Yidiny - - - Yindjibarndi - - Jindjibandji - - - - Yinhawangka - - Inawonga - - - - Yualyai - - Euahlayi - - - Jualjai - - - Ualari - - - Uollaroi - - - Wallaroi - - - Yerraleroi - - - Yowalri - - - Yuwaalaraay - - - - Yugambeh - - - - info:lc/vocabulary/languages/map - Austronesian (Other) - map - - Malayo-Polynesian (Other) - - - Adzera - - Acira - - - Atsera - - - Atzera - - - - Ajie - - Houailou - - - Wailu - - - - Ambrym - - - Amis - - Ami - - - - Anesu - - Canala - - - Kanala - - - Xaracuu - - - Yaracuu - - - - Apma - - - Areare - - - Arop-Lokep - - Lokep - - - Lokewe - - - - Arosi - - - Atayal - - Tayal - - - - Bajau - - Badjo - - - Bayo - - - Luaan - - - Orang Laut (Indonesia) - - - Sama (Indonesia) - - - Turije̕ne̕ - - - - Bakumpai - - - Balaesang - - Balaisang - - - Pajo - - - - Banjar Hulu - - Hulu - - - - Barangas - - Alalak - - - - Bareë - - - Begak - - - Berawan - - - Biliau - - - Bimanese - - - Bolaang Mongondow - - - Buang - - - Bugotu - - Mahaga - - - - Bukar Sadong - - Sadong - - - Serian - - - Tebakang - - - - Bunama - - - Bunun - - - Buol - - Bual - - - Bwuolo - - - Dia - - - - Bwaidoga - - - Bwatoo - - - Camuhi - - Cemuhi - - - Tyamuhi - - - Wagap - - - - Carolinian - - - Daa - - Pekawa - - - - Dawawa - - - Dehu - - Drehu - - - Lifu - - - Miny - - - - Dobel - - Kobroor - - - - Dobu - - - Dumbea - - Drubea - - - - Dusun - - Kadazan - - - - East Makian - - Inner Makian - - - Makian, East - - - Makian, Inner - - - Taba - - - - East Uvean - - Uvean, East - - - Wallisian - - - - Enggano - - Etaka - - - - Enim - - - Eromanga - - Sie - - - Sye - - - - Favorlang - - Babuza - - - - Futuna-Aniwa - - Erronan - - - West Futuna - - - - Gapapaiwa - - Manape - - - - Gedaged - - Graged - - - - Gumasi - - - Halia - - - Ham - - Dami - - - - Hote - - - Iai (Loyalty Islands) - - - Iamalele - - Yamalele - - - - Ida'an - - - Iduna - - - Irahutu - - - Kaidipang - - - Kaili - - Ledo' - - - Palu - - - - Kaiwa (Papua New Guinea) - - Iwal - - - - Kambera - - - Kapingamarangi - - - Kara (Papua New Guinea) - - Kara-Lemakot - - - Lemakot - - - Lemusmus - - - - Katingan - - - Kaulong - - - Kayan (Borneo) - - - Kayu Agung - - - Kemak - - Ema - - - - Kerinci - - Kinchai - - - Korintje - - - - Kiput - - - Kiriwinian - - Kilivila - - - Trobriand - - - - Koluwawa - - - Komodo - - - Kubu - - - Kuni - - - Kurada - - Auhelawa - - - Cauhelawa - - - Nuakata - - - - Kutai - - Tenggarong - - - - Kwara'ae - - Fiu - - - - Lamenu - - Lamen - - - Lewo (Lamenu) - - - Varmali - - - - Lampung - - Api - - - Lampong - - - - Lau - - - Lavongai - - Dang (Papua New Guinea) - - - Lavangai - - - New Hanover - - - Tungag - - - Tungak - - - - Lembak Bilide - - - Lenakel - - - Lewo - - Varsu - - - - - Lindrou - - - Lundayeh - - Lun Daya - - - Lun Daye - - - Lun Dayho - - - Lundaya - - - Southern Murut - - - - Manam - - - Mandak - - Lelet - - - - Mandara (Papua New Guinea) - - Madara - - - Tabar - - - - Mangap - - Mbula (Mangap) - - - - Manggarai (Indonesia) - - - Mangseng - - - Marquesan - - - Mekeo - - - Mele-Fila - - Fila - - - - Mentawai - - - Mokilese - - - Mori - - Aikoa - - - - Mortlockese - - Mortlock (Micronesia) - - - Nomoi - - - - Motu - - - Mouk - - - Mukawa - - Kapikapi - - - - Muna - - Mina (Indonesia) - - - Wuna - - - - Nakanai - - Lakalai - - - - Nali - - Yiru - - - - Napu - - Bara (Indonesia) - - - - Nemi - - - Nengone - - - Ngada - - - Ngaju - - Biadju - - - Ngaju Dayak - - - - Ngatik - - - Nguna - - - Notsi - - Nochi - - - - Nuaulu - - - Nukuoro - - - Numfor - - Mafor - - - Noemfoor - - - Nufor - - - - Paiwan - - - Pala - - - Paranan - - Palanan - - - - Pasir (Lawangan) - - - Pazeh - - Bazai - - - - Petats - - - Pileni - - - Puluwat - - - Puyuma - - Kadas language (Puyuma) - - - Panapanayan - - - Pelam - - - Pilam - - - Piyuma - - - Pyuma - - - Tipun - - - - Ramoaaina - - Malu (Papua New Guinea) - - - - Rejang (Sumatra, Indonesia) - - Redjang (Sumatra, Indonesia) - - - - Rennellese - - Bellonese - - - Munggava - - - - Roti - - Rottinese - - - - Rotuman - - - Rukai - - Drukai - - - - Rungus - - Dusun Dayak - - - Melobong Rungus - - - Memagun - - - Memogun - - - Momogun - - - Roongas - - - Rungus Dusun - - - - Saaroa - - La'alua - - - La'arua - - - Pachien - - - Paichien - - - Rarua - - - Saarua - - - Saroa - - - Shishaban - - - Sisyaban - - - - Sangen - - - Sangil - - Sangiré - - - - Sangir (Indonesia and Philippines) - - Sangihe - - - - Saposa - - - Sawu - - Havunese - - - Hawu - - - Sabu - - - Savu - - - - Sedik - - Sazek - - - Seedik - - - Shedekka - - - - Semendo - - - Serawai - - - Sigi - - Idja - - - - Sikka - - - Siladang - - - Sinagoro - - - Sio - - - Sissano - - - Sobei - - - Sokop - - - Sonsorol-Tobi - - Tobi - - - - Suau - - - Sumba - - - Sumbawa - - Semana - - - Soembawa - - - - Sursurunga - - - Suwawa - - Bunda (Indonesia) - - - - Tagal Murut - - Murut Tahol - - - Semambu - - - Semembu - - - Sumambu - - - Sumambu-Tagal - - - Sumambuq - - - - Tagula - - Sudest - - - - Takuu - - Mortlock (Papua New Guinea) - - - Nahoa - - - Taku - - - Taʻu - - - Tauu - - - - Talaud - - Talaoed - - - - Tamuan - - - Tanga (Tanga Islands) - - - Tavara (Papua New Guinea) - - Kehelala - - - Tawala - - - - Tawoyan - - - Teop - - Tiop - - - - Tidore - - - Tikopia - - - Timor - - Atoni - - - Timorese - - - - Timugon - - - Tinputz - - Timputs - - - Vasuii - - - Wasoi - - - - Tolai - - Blanche Bay - - - Gunantuna - - - Kuanua - - - New Britain - - - Raluana - - - Tinata Tuna - - - Tuna - - - - Tolaki - - Kendari - - - Toolaki - - - - Tombulu - - Toumbulu - - - - Tondano - - Tolou - - - Tolour - - - - Tonsea - - - Toraja - - Toradja - - - - Toraja Sa'dan - - Sadan (Indonesia) - - - Saqdab Toraja - - - South Toraja - - - Tae' - - - - Tuamotuan - - Paumotu - - - - Tubetube - - - Ulithi - - - Uma - - Pipikoro - - - - Urak Lawoi̕ - - Chāo Lē - - - Orak Lawoi' - - - Orang Laut (Thailand and Malaysia) - - - - Uripiv - - - Wampar - - - Wandamen - - Windesi - - - Wondama - - - - Wewewa - - Sumba, West - - - Waidjewa - - - West Sumba - - - - Woleaian - - Uleai - - - Woleai - - - - Wolio - - - Yabim - - Jabêm - - - - Yamdena - - Jamdena - - - - - info:lc/vocabulary/languages/ava - Avaric - ava - - - info:lc/vocabulary/languages/ave - Avestan - ave - - Avesta - - - Bactrian, Old (Avestan) - - - Old Bactrian (Avestan) - - - Zend - - - - info:lc/vocabulary/languages/awa - Awadhi - awa - - - info:lc/vocabulary/languages/aym - Aymara - aym - - Aimara - - - - info:lc/vocabulary/languages/aze - Azerbaijani - aze - - Azari - - - Azeri - - - Afshar - - - - info:lc/vocabulary/languages/ast - Bable - ast - - Asturian - - - - info:lc/vocabulary/languages/ban - Balinese - ban - - - info:lc/vocabulary/languages/bat - Baltic (Other) - bat - - Curonian - - - Proto-Baltic - - - Prussian - - Old Prussian - - - - - info:lc/vocabulary/languages/bal - Baluchi - bal - - Balochi - - - Beloutchi - - - Biluchi - - - - info:lc/vocabulary/languages/bam - Bambara - bam - - Bamana (Mandekan) - - - Bamanankan - - - - info:lc/vocabulary/languages/bai - Bamileke languages - bai - - Bandjoun - - Bamileke-Jo - - - - Fe'fe' - - Bafang - - - Bamileke-Fe'fe' - - - Bana (Bamileke) - - - Fa (Bamileke) - - - Fan (Bamileke) - - - Fanwe (Bamileke) - - - Fe'e fe'e - - - Fotouni - - - Kuu - - - Nufi - - - - Ngyemboon - - Nguemba (Bamileke) - - - - Yemba - - - - info:lc/vocabulary/languages/bad - Banda languages - bad - - Banda (Central Africa) - - - Linda - - - - info:lc/vocabulary/languages/bnt - Bantu (Other) - bnt - - Abo (Cameroon) - - Abaw - - - Bo (Cameroon) - - - Bon (Cameroon) - - - - Aka (Central African Republic) - - - Asu - - Athu - - - Chasu - - - Pare - - - - Bafia - - - Bakundu - - Kundu - - - - Bati - - - Bekwil - - Bakwele - - - Bakwil - - - Bekwel - - - Bekwie - - - Bekwyel - - - Kwele - - - Okpele - - - - Bembe (Congo (Brazzaville)) - - KiBembe - - - Mbembe - - - - Benga - - - Bobangi - - Rebu - - - - Bolia - - Bulia - - - - Boma (Congo) - - Buma (Congo) - - - - Bomitaba - - Mbomitaba - - - Mitaba - - - - Bondei - - Bonde - - - Boondei - - - Kibondei - - - Wabondei - - - - Bube - - Bubi (Equatorial Guinea) - - - Fernandian - - - - Bubi (Gabon) - - Pove - - - - Budu - - - Bukusu - - Lubukusu - - - - Bulu - - Boulou - - - - Camtho - - Iscamtho - - - Isicamtho - - - Shalambombo - - - Tsotsitaal (Camtho) - - - - Chaga - - Djaga - - - Dschagga - - - Jagga - - - Tschagga - - - - Chokwe - - Cibokwe - - - Cokwe - - - Jok - - - Katchokue - - - Kioko - - - Quioco - - - Tutchokue - - - - Chopi - - Lenge - - - - Comorian - - - Diriku - - Mbogedo - - - Rugciriku - - - Rumanyo - - - Shimbogedu - - - - Doko (Congo) - - - Duruma - - - Embu - - - Enahara - - Emathipane - - - Enaharra - - - Maharra - - - Nahara - - - Naharra - - - - Fipa - - - Fuliru - - - Ganguela - - Ngangela - - - - Geviya - - Avias - - - Eviya - - - Viya - - - - Giryama - - - Gisu - - Lugisu - - - Lumasaaba - - - Masaba - - - - Gungu - - Lugungu - - - Rugungu - - - - Gusii - - Ekegusii - - - Kisii - - - - Gweno - - Kigweno - - - - Gwere - - - Ha - - - Haya - - Luhaya - - - Lusiba - - - Ruhaya - - - Ziba - - - - Hehe - - - Hunde - - - Ikizu - - Ikiizo - - - Ikikizo - - - Ikikizu - - - Kiikizu - - - - Ila - - - Jita - - Echijita - - - Ecijita - - - Kijita - - - - Kahe - - Kikahe - - - - Kako - - Kaka (Northwest Bantu) - - - Yaka (Cameroon and Central African Republic) - - - - Kalanga (Botswana and Zimbabwe) - - - Kaonde - - Luba-Kaonde - - - - Kare - - Akare - - - Bakare - - - - Kele (Gabon) - - - Kete - - - Kom (Cameroon) - - Nkom - - - - Kombe - - - Komo (Congo) - - Kumu - - - - Koonzime - - Djimu - - - Dzimou - - - Konzime - - - Kooncimo - - - Koozhime - - - Koozime - - - Nzime - - - Zimu - - - - Kuria - - Ekiguria - - - Igikuria - - - Ikikuria - - - Kikoria - - - Kikouria - - - Kikuria - - - Kikuria cha juu - - - Kikuria cha Mashariki - - - Koria - - - Kurya - - - Kurye - - - Tende (Kuria) - - - - Kwangali - - - Kwese - - Kwezo - - - - Kwiri - - Mokpwe - - - - Lala - - - Lega - - - Lenje - - Bwine-Mukuni - - - Ci-Renje - - - - Logooli - - Ragoli - - - - Lomwe (Malawi) - - - Lucazi - - Ponda - - - - Luvale - - - Luyana - - - Luyia - - Oluluyia - - - - Maka (Cameroon) - - Makaa (Cameroon) - - - Mekaa - - - - Makhuwa - - Central Makhuwa - - - Emakhuwa - - - Emakua - - - Macua - - - Makhuwa-Makhuwana - - - Makhuwwa of Nampula - - - Makoane language - - - Makua (Mozambique) - - - Maquoua (Makhuwa) - - - - Makonde - - Chimakonde - - - Konde (Yao group) - - - - Makwe - - Kimakwe - - - Macue - - - Maraba (Makwe) - - - Palma - - - - Mashami - - Kimashami - - - Machambe - - - Machame - - - Madschame - - - - Mbala (Bandundu, Congo) - - - Mbo (Cameroon) - - - Mbosi - - - Mbukushu - - Goba - - - Mambukush - - - Mpukush - - - Thimbukushu - - - - Mbunda (Angola and Zambia) - - - Meru - - Kimeru - - - - Mijikenda languages - - Nika languages - - - Nyika languages - - - - Mituku - - - Mkaaʼ - - Bakaka - - - - Mochi - - Kimochi - - - Kimoshi - - - Moshi (Tanzania) - - - Mosi (Tanzania) - - - Old Moshi - - - - Mpiemo - - Bimu - - - Mbimou - - - Mbimu - - - Mbyemo - - - Mpo - - - Mpyemo - - - - Mpongwe - - Pongwe - - - - Mpur (Congo) - - - Nambya - - - Nande - - Nandi (Congo) - - - - Ndau - - Chindau - - - Shona, Southeastern - - - - Ndumu - - - Ngonde - - Ikinyi-Kiusa - - - Kiusa - - - Konde (Nyakyusa) - - - Mombe - - - Nkonde - - - Nyakyusa - - - Sochile - - - - Ngul - - Engwî - - - Ingul - - - Kingóli - - - Ngoli - - - Nguli - - - Ngulu (Congo (Democratic Republic)) - - - Ngwi (Congo (Democratic Republic)) - - - - Nsenga - - - Ntomba - - - Nyaneka - - Lunyaneka - - - Olunyaneka - - - - Nyanga - - - Nyole (Uganda) - - Lunyole (Uganda) - - - Nyule - - - Nyuli - - - - Nyungwe - - Tete - - - - Nzebi - - Bandzabi - - - Indzèbi - - - Injebi - - - Ndjabi - - - Ndjebi - - - Ndjevi - - - Njabi - - - Njevi - - - Nzabi - - - Yinzabi - - - - Pangwa - - - Pelende - - - Pende - - Kipende - - - Pindi (Pende) - - - - Pokomo - - - Punu - - Bapounou - - - Pounou - - - - Rangi - - Irangi - - - Kilangi - - - Kirangi - - - Langi (Tanzania) - - - - Ronga - - Landim - - - Shironga - - - Xironga - - - - Ruri - - Ciruuri - - - Kiruri - - - Ruuri - - - - Ruund - - Chiluwunda - - - Lunda, Northern - - - Luwunda - - - Muatiamvua - - - Northern Lunda - - - Uruund - - - - Saamia - - Luhya (Saamia) - - - Luluyia (Saamia) - - - Lusaamia - - - Luyia (Saamia) - - - Ólusaamya - - - Olusamia - - - Samia - - - Samya - - - - Sakata - - - Salampasu - - Chisalampasu - - - - Sanga - - Luba, Southern - - - Southern Luba - - - - Sena - - - Shambala - - - Shi - - Mashi - - - Nyabungu - - - - Shimaore - - Mahorais - - - - Simbiti - - Kisimbiti - - - - Songye - - Songe - - - - Subiya - - ciIkuhane - - - Ikuhane - - - Soubiya - - - - Suku (Congo) - - - Sumbwa - - Kisumbwa - - - Shisumbwa - - - Sisumbwa - - - Sisuumbwa - - - - Taita - - Sagalla - - - Teita - - - - Talinga-Bwisi - - Bwisi-Talinga - - - Kitalinga - - - - Teke - - Balali - - - Ilali - - - Itio - - - Lali - - - - Tembo (Sud-Kivu, Congo) - - KiTembo - - - - Temi - - Gitemi - - - Kisonjo - - - Sonjo - - - Sonyo - - - Wasonjo - - - Watemi - - - - Tetela - - - Tharaka - - Saraka - - - - Tiene - - Ketiine - - - Kitiene - - - Kitiini - - - Tende (Congo (Democratic Republic)) - - - - Tiriki - - - Tonga (Inhambane) - - Gitonga - - - - Tonga (Zambezi) - - - Tooro - - Toro - - - - Tsogo - - Apindji - - - Mitsogo - - - - Tswa - - Kitswa - - - Shitswa - - - Tshwa - - - Xitswa - - - - Tunen - - Banen - - - - Yaka (Congo and Angola) - - Iaka - - - - Yanzi - - - Yombe (Congo and Angola) - - - Zanaki - - Iki-Zanaki - - - IkiZanaki - - - - Zigula - - Kizigula - - - Seguha - - - Wayombo - - - Wazegua - - - Wazigua - - - Zeguha - - - Zegura - - - Zigoua - - - Zigua - - - Zigwa - - - - Zinza - - Dzinda - - - Dzindza - - - Echidzindza - - - Echijinja - - - Eciinja - - - Ecizinza - - - Jinja - - - Kizinza - - - Luzinza - - - Zinja - - - - - info:lc/vocabulary/languages/bas - Basa - bas - - - info:lc/vocabulary/languages/bak - Bashkir - bak - - - info:lc/vocabulary/languages/baq - Basque - baq - - Euskara - - - - info:lc/vocabulary/languages/btk - Batak - btk - - Batta (Sumatra) - - - Alas - - - Angkola - - - Dairi Pakpak - - Pakpak - - - - Karo-Batak - - - Mandailing - - Batak Mandailing - - - - Simelungun - - - Toba-Batak - - - - info:lc/vocabulary/languages/bej - Beja - bej - - Bedawiye - - - Bedja - - - Bishári - - - - info:lc/vocabulary/languages/bel - Belarusian - bel - - Belorussian - - - Byelorussian - - - Russian, White - - - White Russian - - - - info:lc/vocabulary/languages/bem - Bemba - bem - - - info:lc/vocabulary/languages/ben - Bengali - ben - - Banga-Bhasa - - - Bangala - - - Bangla - - - Sylheti - - Sylhet - - - Sylhetti Bangla - - - - - info:lc/vocabulary/languages/ber - Berber (Other) - ber - - Mzab - - Mozabite - - - - Rif - - Northern Shilha - - - Shilha, Northern - - - Tarifit - - - - Shilha - - Chleuh - - - Sölha - - - Tachelhait - - - Tashelhiyt - - - - Tamazight - - - - info:lc/vocabulary/languages/bho - Bhojpuri - bho - - Bajpuri - - - Bhojapuri - - - Bhozpuri - - - Bihari (Bhojpuri) - - - Deswali (Bhojpuri) - - - Khotla - - - Piscimas - - - Sadani - - Chota Nagpuri - - - Chotar Nagpuri - - - Dikku Kaji - - - Dikkukaji - - - Nagpuri (Bhojpuri) - - - Nagpuriā - - - Napuria - - - Sadan - - - Sadari - - - Sadati - - - Sadhan - - - Sadhana - - - Sadharan - - - Sadna - - - Sadri - - - Sadrik - - - Santri - - - Siddri - - - Sradri - - - - Western Standard Bhojpuri - - Benarsi - - - Bhojpuri, Western Standard - - - Purbi - - - - - info:lc/vocabulary/languages/bih - Bihari (Other) - bih - - Behari - - - Bajjika - - - Kudmali - - Bedia - - - Dharua - - - Khotta (Kurmali) - - - Kurma - - - Kurmali - - - Kurmali Thar - - - Kurmik - - - Kurni - - - Kurumali - - - - - info:lc/vocabulary/languages/bik - Bikol - bik - - Vikol - - - - info:lc/vocabulary/languages/byn - Bilin - byn - - - info:lc/vocabulary/languages/bis - Bislama - bis - - Beach-la-mar - - - Bêche-de-mer - - - Bichelamar - - - - info:lc/vocabulary/languages/zbl - Blissymbolics - zbl - - - info:lc/vocabulary/languages/bos - Bosnian - bos - - - info:lc/vocabulary/languages/bra - Braj - bra - - Braj bhākhā - - - Braj bhāshā - - - Pingal - - - - info:lc/vocabulary/languages/bre - Breton - bre - - Armoric - - - - info:lc/vocabulary/languages/bug - Bugis - bug - - Buginese - - - - info:lc/vocabulary/languages/bul - Bulgarian - bul - - - info:lc/vocabulary/languages/bua - Buriat - bua - - Buryat - - - Mongolian, Northern - - - Northern Mongolian - - - - info:lc/vocabulary/languages/bur - Burmese - bur - - - info:lc/vocabulary/languages/cad - Caddo - cad - - - info:lc/vocabulary/languages/car - Carib - car - - Galibi - - - - info:lc/vocabulary/languages/cat - Catalan - cat - - Majorcan Catalan - - Catalan, Majorcan - - - - Valencian Catalan - - Catalan, Valencian - - - - - info:lc/vocabulary/languages/cau - Caucasian (Other) - cau - - Abazin - - - Bats - - Bac - - - Tsova-Tush - - - Tush - - - - Bezhta - - - Botlikh - - - Budukh - - - Chamalal - - - Dido - - Tsez - - - - Ginukh - - Ginukhtsy - - - Ginux - - - Hinukh - - - Hinux - - - - Hunzib - - Gunzib - - - - Kubachi - - - Lak - - - Laz - - Chan - - - Chanuri - - - Chanzan - - - Laze - - - Lazian - - - Lazuri - - - Zan - - - - Mingrelian - - - Svan - - - Tabasaran - - - Tsakhur - - - Ubykh - - Oubykh - - - - Udi - - - - info:lc/vocabulary/languages/ceb - Cebuano - ceb - - Binisaya - - - Bisayan - - - Sebuano - - - Sinugboanon - - - Sugbuanon - - - Sugbuhanon - - - Visayan - - - - info:lc/vocabulary/languages/cel - Celtic (Other) - cel - - Celtiberian - - Celti-Iberian - - - Celto-Iberian - - - - Gaulish - - Gallic - - - - Proto-Celtic - - Common Celtic - - - - Welsh, Middle (ca. 1100-1400) - - Middle Welsh (ca. 1100-1400) - - - - Welsh, Old (to 1100) - - Old Welsh (to 1100) - - - - - info:lc/vocabulary/languages/cai - Central American Indian (Other) - cai - - Use for the other languages of Central America and Mexico, as well as for the - languages of the Azteco-Tanoan language phylum. - - - Amuzgo - - Amishgo - - - - Boruca - - Brunka - - - Burunca - - - - Bribri - - - Cabecar - - - Cahita - - - Cahuilla - - Coahuila - - - Kawia (Shoshone) - - - - Chatino - - - Chiapanec - - - Chinantecan languages - - - Chocho - - - Chontal - - Tequistlateca - - - - Cochimi - - - Comanche - - - Cora - - Chora - - - Nayarita - - - - Cuicatec - - - Cuitlateco - - Teco (Cuitlateco) - - - - Cupeño - - - Eudeve - - Batuco - - - Dohema - - - Hegue - - - - Garifuna - - Black Carib - - - Carib, Black - - - - Guarijío - - Huarijío - - - Warijío - - - - Guatuso - - Maléku Jaíka - - - - Guaymi - - - Hopi - - Moki - - - - Huave - - - Huichol - - Guichola - - - - Ixcateco - - - Jicaque - - Tol - - - Torrupan - - - Xicaque - - - - Kawaiisu - - - Kiowa - - Kayowe - - - - Lenca - - - Mangue - - Choluteca - - - - Matagalpa - - Cacaopera - - - - Mayo (Piman) - - - Mazateco - - - Miskito - - Mosquito - - - - Mixe - - Ayook - - - - Mixtec - - - Opata - - - Panamint - - Coso - - - Koso - - - Tümpisa - - - - Pima - - - Popoloca - - - Rama - - - Seri - - - Serrano - - Maarrenga'twich - - - - Shoshoni - - - Sierra Popoluca - - Highland Popoluca - - - Popoluca, Highland - - - Popoluca of Vera Cruz - - - - Southern Paiute - - Paiute, Southern - - - - Sumo - - - Tarahumara - - Rarámuri - - - - Tarascan - - Michoacana - - - Phurhembe - - - Purepecha - - - - Tepehuan - - O'dam - - - - Terraba - - Teribe - - - Tirribi - - - - Tewa - - - Tlapanec - - Chocho (Tlapanec) - - - Tiapaneco - - - - Tohono O'odham - - Papago - - - - Totonac - - - Trique - - - Ulva - - Woolwa - - - Wulwa - - - - Ute - - - Yaqui - - - Zoque - - Soke - - - - - info:lc/vocabulary/languages/chg - Chagatai - chg - - Dschagatai - - - Jagataic - - - Old Uzbek - - - Tschagatai - - - Uzbek, Old - - - - info:lc/vocabulary/languages/cmc - Chamic languages - cmc - - Cham - - Čam - - - - Haroi - - - Jarai - - - Rade - - Ede - - - Rhade - - - - Roglai - - - - info:lc/vocabulary/languages/cha - Chamorro - cha - - Tjamoro - - - - info:lc/vocabulary/languages/che - Chechen - che - - Tchetchen - - - - info:lc/vocabulary/languages/chr - Cherokee - chr - - - info:lc/vocabulary/languages/chy - Cheyenne - chy - - - info:lc/vocabulary/languages/chb - Chibcha - chb - - - info:lc/vocabulary/languages/chi - Chinese - chi - - Cantonese - - - Mandarin - - - - info:lc/vocabulary/languages/chn - Chinook jargon - chn - - Chinook pidgin - - - - info:lc/vocabulary/languages/chp - Chipewyan - chp - - Dene (Chipewyan) - - - Montagnais (Athapascan) - - - - info:lc/vocabulary/languages/cho - Choctaw - cho - - Chahta - - - - info:lc/vocabulary/languages/chu - Church Slavic - chu - - Bulgarian, Old (to 1100) - - - Old Bulgarian (to 1100) - - - Old Church Slavic - - - Old Slovenian - - - Slavonic, Old Church - - - Slovenian, Old - - - - info:lc/vocabulary/languages/chk - Chuukese - chk - - Truk - - - - info:lc/vocabulary/languages/chv - Chuvash - chv - - - info:lc/vocabulary/languages/cop - Coptic - cop - - - info:lc/vocabulary/languages/cor - Cornish - cor - - - info:lc/vocabulary/languages/cos - Corsican - cos - - Corse - - - Corsi - - - Corso - - - Corsu - - - - info:lc/vocabulary/languages/cre - Cree - cre - - Cris - - - Knistenaux - - - Maskegon - - - - info:lc/vocabulary/languages/mus - Creek - mus - - Maskoki - - - Muscogee - - - - info:lc/vocabulary/languages/crp - Creoles and Pidgins (Other) - crp - - Pidgins - - - Ambonese Malay - - Malay, Ambonese - - - - Betawi - - Batawi - - - Jakarta Malay - - - Malay, Jakarta - - - - Chabacano - - Chavacano - - - Zamboangueño - - - - Fanakalo - - Fanagalo - - - Pidgin Kaffir - - - - Kituba (Congo (Democratic Republic)) - - Kibulamatadi - - - Kikongo Commercial - - - Kikongo-Kutuba - - - Kikongo Simplifié - - - Kikongo ya Leta - - - Kikwango - - - Kileta - - - - Naga Pidgin - - Nagamese - - - - San Basilio del Palenque Spanish Creole - - Palenquero (Colombia) - - - Spanish Creole, San Basilio del Palenque - - - - Unami jargon - - - - info:lc/vocabulary/languages/cpe - Creoles and Pidgins, English-based (Other) - cpe - - Bamyili Creole - - - Djuka - - Aucaans - - - Aukan - - - Djoeka - - - Ndjuka - - - - English-based Creoles and Pidgins (Other) - - - Fitzroy Valley Kriol - - - Hawaiian Pidgin English - - - Jamaican Creole - - - Krio - - Aku (Creole) - - - - Kriol - - - Pijin - - Neo-Solomonic - - - Solomons Pidgin - - - - Pidgin English - - - Saramaccan - - - Sea Islands Creole - - Geechee - - - Gullah - - - - - info:lc/vocabulary/languages/cpf - Creoles and Pidgins, French-based (Other) - cpf - - French-based Creoles and Pidgins (Other) - - - Dominican French Creole - - French Creole, Dominican - - - - Louisiana French Creole - - French Creole, Louisiana - - - - Mauritian French Creole - - French Creole, Mauritian - - - - Michif - - Cree, French - - - French Cree - - - Mitchif - - - - Reunionese French Creole - - French Creole, Reunionese - - - - Seychellois French Creole - - French Creole, Seychellois - - - - - info:lc/vocabulary/languages/cpp - Creoles and Pidgins, Portuguese-based (Other) - cpp - - Portuguese-based Creoles and Pidgins (Other) - - - Annobon - - Ambu - - - - Cape Verde Creole - - Brava Island Creole - - - - Crioulo - - - Indo-Portuguese - - Ceylon Portuguese - - - - - info:lc/vocabulary/languages/crh - Crimean Tatar - crh - - Crimean Turkish - - - Tatar, Crimean - - - Turkish, Crimean - - - - info:lc/vocabulary/languages/hrv - Croatian - hrv - - - info:lc/vocabulary/languages/scr - Croatian - scr - - - info:lc/vocabulary/languages/cus - Cushitic (Other) - cus - - Alaba - - Alaaba - - - Allaaba - - - Halaba - - - - Burji - - - Dasenech - - Geleb - - - Marille - - - - Gedeo - - Darasa - - - Derasa - - - - Hadiya - - - Iraqw - - - Kambata - - - Qebena - - K'abena - - - Kebena - - - Qabena - - - Womba - - - Wombi Afoo - - - Wombisanat - - - - Rendille - - - Tunni - - - - info:lc/vocabulary/languages/cze - Czech - cze - - Bohemian - - - - info:lc/vocabulary/languages/dak - Dakota - dak - - Sioux - - - Assiniboine - - - Lakota - - Teton - - - - Santee - - - Yankton - - - - info:lc/vocabulary/languages/dan - Danish - dan - - - info:lc/vocabulary/languages/dar - Dargwa - dar - - Darghi - - - Dargin - - - - info:lc/vocabulary/languages/day - Dayak - day - - Bidayuh - - - Bideyu - - - Dajak - - - Dyak - - - Kendayan - - - Land Dayak - - - Biatah - - - - info:lc/vocabulary/languages/del - Delaware - del - - Lenape - - - Lenni Lenape - - - Munsee - - Minsi - - - - - info:lc/vocabulary/languages/din - Dinka - din - - Denca - - - - info:lc/vocabulary/languages/div - Divehi - div - - Dhivehi - - - Maldivian - - - - info:lc/vocabulary/languages/doi - Dogri - doi - - Dhogaryali - - - Dogari - - - Dogra - - - Dogri Jammu - - - Dogri-Kangri - - - Dogri Pahari - - - Dongari - - - Hindi Dogri - - - Tokkaru - - - Kangri - - Kangari - - - Kangra - - - - - info:lc/vocabulary/languages/dgr - Dogrib - dgr - - Thlingchadinne - - - - info:lc/vocabulary/languages/dra - Dravidian (Other) - dra - - Abujhmaria - - - Alu Kurumba - - - Brahui - - Berouhi - - - Birohi - - - Brohki - - - - Gadaba (Dravidian) - - Gadba (Dravidian) - - - Gudwa (Dravidian) - - - Gutob (Dravidian) - - - Konekor Gadaba - - - Ollari - - - Salur - - - - Kodagu - - Coorg - - - Kodava - - - Kurg - - - - Kolami - - - Kota (India) - - - Kui - - Kandh - - - - Kuvi - - - Malto - - - Pengo - - - Toda (India) - - Tuda (India) - - - - Tulu - - - - info:lc/vocabulary/languages/dua - Duala - dua - - Douala - - - - info:lc/vocabulary/languages/dut - Dutch - dut - - Flemish - - - Netherlandic - - - - info:lc/vocabulary/languages/dum - Dutch, Middle (ca. 1050-1350) - dum - - Diets - - - Middle Dutch - - - - info:lc/vocabulary/languages/dyu - Dyula - dyu - - Dioula - - - Diula - - - Jula - - - - info:lc/vocabulary/languages/dzo - Dzongkha - dzo - - Bhotia of Bhutan - - - Bhutanese - - - - info:lc/vocabulary/languages/frs - East Frisian - frs - - Frisian, East - - - - info:lc/vocabulary/languages/bin - Edo - bin - - Bini - - - - info:lc/vocabulary/languages/efi - Efik - efi - - Calabar - - - Ibibio - - - - info:lc/vocabulary/languages/egy - Egyptian - egy - - Demotic - - - Hieratic - - - Hieroglyphics (Egyptian) - - - - info:lc/vocabulary/languages/eka - Ekajuk - eka - - - info:lc/vocabulary/languages/elx - Elamite - elx - - Amardic - - - Anzanic - - - Susian - - - - info:lc/vocabulary/languages/eng - English - eng - - - info:lc/vocabulary/languages/enm - English, Middle (1100-1500) - enm - - Middle English - - - - info:lc/vocabulary/languages/ang - English, Old (ca. 450-1100) - ang - - Anglo-Saxon - - - Old English - - - West Saxon - - - - info:lc/vocabulary/languages/myv - Erzya - myv - - - info:lc/vocabulary/languages/esk - Eskimo languages - esk - - - info:lc/vocabulary/languages/epo - Esperanto - epo - - - info:lc/vocabulary/languages/esp - Esperanto - esp - - - info:lc/vocabulary/languages/est - Estonian - est - - Seto - - Setu - - - - Võro - - Võru - - - Werro - - - - - info:lc/vocabulary/languages/gez - Ethiopic - gez - - Geez - - - - info:lc/vocabulary/languages/eth - Ethiopic - eth - - - info:lc/vocabulary/languages/ewe - Ewe - ewe - - - info:lc/vocabulary/languages/ewo - Ewondo - ewo - - Jaunde - - - Yaounde - - - Yaunde - - - - info:lc/vocabulary/languages/fan - Fang - fan - - Fan (Bantu) - - - - info:lc/vocabulary/languages/fat - Fanti - fat - - - info:lc/vocabulary/languages/fao - Faroese - fao - - Faeroese - - - - info:lc/vocabulary/languages/far - Faroese - far - - - info:lc/vocabulary/languages/fij - Fijian - fij - - Viti - - - - info:lc/vocabulary/languages/fil - Filipino - fil - - - info:lc/vocabulary/languages/fin - Finnish - fin - - - info:lc/vocabulary/languages/fiu - Finno-Ugrian (Other) - fiu - - Ingrian - - Izhorskii - - - - Khanty - - Ostiak - - - Xanty - - - - Livonian - - - Ludic - - Lydi - - - - Mansi - - Vogul - - - - Mordvin - - Mordva - - - Mordvinian - - - - Veps - - - - info:lc/vocabulary/languages/fon - Fon - fon - - Dahoman - - - Djedji - - - Jeji - - - - info:lc/vocabulary/languages/fre - French - fre - - Allevard French - - French, Allevard - - - - Judeo-French - - Western Loez - - - Zarphatic - - - - Morvan French - - French, Morvan - - - - Poitevin French - - French, Poitevin - - - - Saintongeais French - - French, Saintongeais - - - - - info:lc/vocabulary/languages/frm - French, Middle (ca. 1300-1600) - frm - - Middle French - - - - info:lc/vocabulary/languages/fro - French, Old (ca. 842-1300) - fro - - Old French - - - - info:lc/vocabulary/languages/fry - Frisian - fry - - Friesian - - - West Frisian - - - Stadsfries - - Stadfries - - - Stedsk - - - Town Frisian - - - - - info:lc/vocabulary/languages/fri - Frisian - fri - - - info:lc/vocabulary/languages/fur - Friulian - fur - - - info:lc/vocabulary/languages/ful - Fula - ful - - Adamawa - - - Fulah - - - Fulani - - - Fulbe - - - Fulfulde - - - Peul - - - Poul - - - Bororo (West Africa) - - - Pular - - Poular - - - Toucouleur - - - Tukolor - - - - - info:lc/vocabulary/languages/gaa - - gaa - - Acra - - - Incran - - - - info:lc/vocabulary/languages/glg - Galician - glg - - Gallegan - - - - info:lc/vocabulary/languages/gag - Galician - gag - - - info:lc/vocabulary/languages/lug - Ganda - lug - - Luganda - - - - info:lc/vocabulary/languages/gay - Gayo - gay - - - info:lc/vocabulary/languages/gba - Gbaya - gba - - Baya - - - Gbeya - - - - info:lc/vocabulary/languages/geo - Georgian - geo - - Ingilo - - - - info:lc/vocabulary/languages/ger - German - ger - - Hochdeutsch - - - Alemannic - - Alamannic - - - Alemannisch - - - Allemannic - - - Allemannisch - - - Alsatian - - - Schwyzerdütsch - - - - Cimbrian - - Tzimbro - - - Zimbrisch - - - - - info:lc/vocabulary/languages/gmh - German, Middle High (ca. 1050-1500) - gmh - - Middle High German - - - - info:lc/vocabulary/languages/goh - German, Old High (ca. 750-1050) - goh - - Old High German - - - - info:lc/vocabulary/languages/gem - Germanic (Other) - gem - - Danish, Old (to 1500) - - Old Danish - - - - Dutch, Old (to 1050) - - Franconian, Old Low - - - Old Dutch - - - Old Low Franconian - - - - Frisian, Old (to 1500) - - Old Frisian - - - - Lombard - - - Old Saxon - - Low German, Old (ca. 850-1050) - - - Old Low German (ca. 850-1050) - - - Saxon, Old - - - - Pennsylvania German - - - Swedish, Old (to 1550) - - Old Swedish - - - - Walser - - - - info:lc/vocabulary/languages/gil - Gilbertese - gil - - Arorai - - - I-Kiribati - - - Kiribatese - - - - info:lc/vocabulary/languages/gon - Gondi - gon - - - info:lc/vocabulary/languages/gor - Gorontalo - gor - - - info:lc/vocabulary/languages/got - Gothic - got - - - info:lc/vocabulary/languages/grb - Grebo - grb - - Gdebo - - - Gedebo - - - Krebo - - - - info:lc/vocabulary/languages/grc - Greek, Ancient (to 1453) - grc - - Ancient Greek - - - Biblical Greek - - - Byzantine Greek - - - Classical Greek - - - Greek, Biblical - - - Greek, Byzantine - - - Greek, Classical - - - Greek, Hellenistic - - - Greek, Medieval - - - Greek, Patristic - - - Greek (Koine) - - - Hellenistic Greek - - - Koine (Greek) - - - Medieval Greek - - - Patristic Greek - - - Aeolic Greek - - Greek, Aeolic - - - - Attic Greek - - Greek, Attic - - - - Doric Greek - - Greek, Doric - - - - Ionic Greek - - Greek, Ionic - - - - - info:lc/vocabulary/languages/gre - Greek, Modern (1453- ) - gre - - East Cretan Greek - - Cretan Greek, East - - - Greek, East Cretan - - - - - info:lc/vocabulary/languages/grn - Guarani - grn - - Chiriguano - - Aba - - - Camba - - - Tembeta - - - - Chiripá - - Tsiripa - - - - Mbya - - - - info:lc/vocabulary/languages/gua - Guarani - gua - - - info:lc/vocabulary/languages/guj - Gujarati - guj - - Dhodia - - Dhobi - - - Dhoḍiyā - - - Dhore - - - Dhowari - - - Doria - - - - Gamit - - Gamati - - - Gāmīta - - - Gamta - - - Gavit - - - - Halari - - - Parsi-Gujarati - - - Saurashtri - - Patanuli - - - Patnuli - - - Saurashtra - - - Saurastra - - - Sawrashtra - - - Sourashtra - - - Sowrashtra - - - - Sidi - - - - info:lc/vocabulary/languages/gwi - Gwich'in - gwi - - Kutchin - - - Loucheux - - - Takudh - - - Tukudh - - - - info:lc/vocabulary/languages/hai - Haida - hai - - Skittagetan - - - - info:lc/vocabulary/languages/hat - Haitian French Creole - hat - - French Creole, Haitian - - - - info:lc/vocabulary/languages/hau - Hausa - hau - - - info:lc/vocabulary/languages/haw - Hawaiian - haw - - - info:lc/vocabulary/languages/heb - Hebrew - heb - - Ancient Hebrew - - - - info:lc/vocabulary/languages/her - Herero - her - - Himba - - Chimba - - - Cimba - - - Dhimba - - - Simba - - - Tjimba - - - - - info:lc/vocabulary/languages/hil - Hiligaynon - hil - - Ilongo - - - Panayan - - - - info:lc/vocabulary/languages/hin - Hindi - hin - - Badayuni - - - Bagheli - - Bagelkhandi - - - Bhugelkhud - - - Ganggai - - - Kawathi - - - Kenat - - - Kevat Boli - - - Kevati - - - Kewani - - - Kewat - - - Kewati - - - Kewot - - - Mandal - - - Mannadi - - - Riwai - - - - Bangaru - - Hariani - - - Jatu - - - - Bundeli - - Bundelkhandi - - - - Chattisgarhi - - Chhattisgarhi - - - Khalṭāhī - - - Khatahi - - - Laria - - - - Deswali - - - Kanauji - - Bhakha - - - Braj Kanauji - - - Kannaujī - - - - Khari Boli - - Kauravī - - - Khaṛībolī - - - Kourvi - - - - Marari - - - Pawari - - - Powari - - Povārī - - - - - info:lc/vocabulary/languages/hmo - Hiri Motu - hmo - - Police Motu - - - - info:lc/vocabulary/languages/hit - Hittite - hit - - - info:lc/vocabulary/languages/hmn - Hmong - hmn - - Humung - - - Meo - - - Miao - - - Mong - - - Hmong Njua - - Black Flowery Miao - - - Blue Miao - - - Green Hmong - - - Green Miao - - - Green Mong - - - Hmong Leng - - - Moob Ntsuab - - - Tak Meo - - - - She - - Ho Ne - - - Ho Nte - - - Huo Nte - - - She Yao - - - - White Hmong - - Hmong, White - - - Hmong Daw - - - Hmoob Dawb - - - Miao, White - - - White Miao - - - - - info:lc/vocabulary/languages/hun - Hungarian - hun - - Magyar - - - - info:lc/vocabulary/languages/hup - Hupa - hup - - - info:lc/vocabulary/languages/iba - Iban - iba - - Sea Dyak - - - - info:lc/vocabulary/languages/ice - Icelandic - ice - - - info:lc/vocabulary/languages/ido - Ido - ido - - - info:lc/vocabulary/languages/ibo - Igbo - ibo - - Ibo - - - - info:lc/vocabulary/languages/ijo - Ijo - ijo - - Djo - - - Dzo - - - Ejo - - - Ido (African) - - - Iyo (Nigeria) - - - Izo - - - Izon - - - Ojo - - - Oru - - - Udzo - - - Uzo - - - Ibani - - Bonny - - - Ubani - - - - Nembe - - Nimbi - - - - - info:lc/vocabulary/languages/ilo - Iloko - ilo - - Ilocano - - - - info:lc/vocabulary/languages/smn - Inari Sami - smn - - Finnish Lapp - - - Lapp, Finnish - - - Sami, Inari - - - - info:lc/vocabulary/languages/inc - Indic (Other) - inc - - Adiwasi Garasia - - Adivasi Garasia - - - Ādivāsī Garāsiyā - - - Adiwasi Girasia - - - Adiwasi Gujarati - - - Garasia Adivasi - - - - Ahirani - - Ahiri - - - - Apabhraṃśa - - Apabhramsha - - - - Avahattha - - - Bashgali - - Bashgal - - - Bashgari - - - Kamtoz - - - Katai - - - Kati - - - - Bhili - - - Bote-Majhi - - Bote-Mahi - - - Kushar - - - Pakhe-Bote - - - - Chakma - - - Changari - - - Chinali - - Chana (India) - - - Channali - - - Chinal - - - Dagi - - - Harijan - - - Shipi - - - - Danuwar Rai - - Denwar - - - Dhanvar - - - Dhanwar - - - Donwar - - - - Darai - - - Dehawali - - Dehavali - - - Dehwali - - - - Domaaki - - Bericho - - - Dom - - - Doma - - - Dumaki - - - - Dungra Bhil - - Dungari Bhili - - - Dungri Bhili - - - - Fiji Hindi - - Hindi, Fiji - - - - Garasiya - - Garahaiya - - - Girasia - - - - Garhwali - - Gadhavali - - - Gadhawala - - - Gadwahi - - - Gashwali - - - Girwali - - - Godauli - - - Gorwali - - - Gurvali - - - Pahari Garhwali - - - - Halbi - - Bastari - - - - Hindustani - - - Indus Kohistani - - Khili - - - Kohistani, Indus - - - Kohiste - - - Mair - - - Maiya - - - Maiyan - - - Maiyon - - - Shuthun - - - - Kalami - - Bashgharik - - - Bashkarik - - - Dir Kohistani - - - Diri (Kalami) - - - Dirwali - - - Gaawro - - - Garwa - - - Garwi - - - Gawri - - - Gowri - - - Kalam Kohistani - - - Kalami Kohistani - - - Kohistana - - - Kohistani, Dir - - - Kohistani, Kalam - - - Kohistani, Kalami - - - - Khandesi - - Dhed Gujari - - - Khandeshi - - - Khandish - - - - Khowar - - - Kumaoni - - Kamaoni - - - Kumau - - - Kumauni - - - Kumawani - - - Kumgoni - - - Kumman - - - Kunayaoni - - - - Kupia - - Valmiki - - - - Mawchi - - Mauchi - - - Māvacī - - - Mavchi - - - Mawachi - - - Mawchi Bhil - - - Mowchi - - - - Memoni - - - Parya - - Tajuzbeki - - - - Rajbangsi - - Kamtapuri - - - Rajbanshi - - - Rajbansi - - - Rajbongshi - - - - Rathvi - - Rāthavi - - - Rathwi - - - - Shina - - Sheena - - - Sina - - - - Suriname Hindustani - - Aili-Gaili - - - Hindustani, Suriname - - - Surinam Hindustani - - - Sarnami Hindi - - - - Tharu - - - Vaagri Boli - - - Veddah (Sinhalese) - - - Waigali - - Kalaṣa-alā - - - Vaigalī - - - Wai - - - Wai-alā - - - Waigelī - - - - Wotapuri-Katarqalai - - Katarqalai - - - - - info:lc/vocabulary/languages/ine - Indo-European (Other) - ine - - Carian - - - Dacian - - Daco-Mysian - - - North Thracian - - - - Luwian - - Luian - - - Lûish - - - Luvian - - - - Lycian - - - Lydian - - - Macedonian (Ancient) - - - Messapic - - Iapygian - - - Messapian - - - - Palaic - - Balaic - - - Palâ (Palaic) - - - Palaite - - - Palawi - - - - Phrygian - - - Proto-Indo-European - - Proto-Aryan - - - Protoindoeuropean - - - - Thracian - - - Tokharian - - Kuchean - - - Tocharian - - - Tocharish - - - Turfanish - - - - Venetic - - - Yuezhi - - Yüeh-chih - - - - - info:lc/vocabulary/languages/ind - Indonesian - ind - - Bahasa Indonesia - - - - info:lc/vocabulary/languages/inh - Ingush - inh - - - info:lc/vocabulary/languages/ina - Interlingua (International Auxiliary Language Association) - ina - - - info:lc/vocabulary/languages/int - Interlingua (International Auxiliary Language Association) - int - - - info:lc/vocabulary/languages/ile - Interlingue - ile - - Occidental - - - - info:lc/vocabulary/languages/iku - Inuktitut - iku - - Inuit - - - Inuvialuktun - - - Kopagmiut - - Chiglit - - - Siglit - - - - - info:lc/vocabulary/languages/ipk - Inupiaq - ipk - - Inuit - - - - info:lc/vocabulary/languages/ira - Iranian (Other) - ira - - Bactrian - - - Badzhuv - - Badschu - - - Badžū - - - Bāǰūī - - - - Bakhtiari - - Bakhtiyārī - - - Baxtīarī - - - Lori - - - Lori-ye Khaveri - - - Lur (Bakhtiari) - - - Luri (Bakhtiari) - - - - Bartang - - Bartangi - - - - Ephthalite - - Hephthalite - - - - Gilaki - - Gelaki - - - Gilan - - - - Gorani - - Awromani - - - Gurani - - - Hawramani - - - Hawrami - - - Hewrami - - - Howrami - - - Macho - - - - Hazaragi - - Azargi - - - Hazara - - - Hezareh - - - Hezareʼi - - - Khazara - - - Khezare - - - - Ishkashmi - - - Judeo-Tat - - Bik - - - Dzhuhuric - - - Hebrew Tat - - - Hebrew Tati - - - Jew-Tatish - - - Jewish Tat - - - Judeo-Tatic - - - - Khorezmi - - Choresmian - - - Khwarezmian - - - - Khuf - - Chuf - - - - Laki (Iran) - - Alaki - - - Leki - - - - Māzandarānī - - Mazanderani - - - Tabri - - - - Median - - Medic - - - - Munji - - Mundzhan - - - Munjani - - - - Natanzi - - Naṭanz - - - - Ormuri - - Baraks - - - Bargista - - - - Parthian - - - Roshan - - Rochani - - - Ruschan - - - - Sarikoli - - Sarykoli - - - - Sarmatian - - - Shughni - - Shugnan-Rushan - - - - Sivandi - - Sivendi - - - - Talysh - - - Tat - - - Wakhi - - - Yaghnobi - - Neo-Sogdian - - - Yaghnabi - - - Yaghnubi - - - Yagnabi - - - Yagnob - - - Yagnobi - - - Yagnubi - - - - Yazghulami - - - Zebaki - - Sanglici - - - - - info:lc/vocabulary/languages/gle - Irish - gle - - Erse (Irish) - - - Gaelic (Irish) - - - Irish Gaelic - - - - info:lc/vocabulary/languages/iri - Irish - iri - - - info:lc/vocabulary/languages/mga - Irish, Middle (ca. 1100-1550) - mga - - Middle Irish - - - - info:lc/vocabulary/languages/sga - Irish, Old (to 1100) - sga - - Old Irish - - - - info:lc/vocabulary/languages/iro - Iroquoian (Other) - iro - - Cayuga - - - Iroquois - - - Oneida - - - Onondaga - - - Seneca - - - Tuscarora - - - Wyandot - - Huron - - - - - info:lc/vocabulary/languages/ita - Italian - ita - - Judeo-Italian - - - Milanese - - - Modena Italian - - Italian, Modena - - - - Romagnol - - - Venetian Italian - - Italian, Venetian - - - - - info:lc/vocabulary/languages/jpn - Japanese - jpn - - Use for related Japanese languages and dialects - - - - info:lc/vocabulary/languages/jav - Javanese - jav - - - info:lc/vocabulary/languages/jrb - Judeo-Arabic - jrb - - - info:lc/vocabulary/languages/jpr - Judeo-Persian - jpr - - Judeo-Tajik - - - - info:lc/vocabulary/languages/kbd - Kabardian - kbd - - Cabardan - - - Circassian, East - - - Circassian, Upper - - - East Circassian - - - Qabardian - - - Upper Circassian - - - - info:lc/vocabulary/languages/kab - Kabyle - kab - - - info:lc/vocabulary/languages/kac - Kachin - kac - - Chingpaw - - - Jingpho - - - - info:lc/vocabulary/languages/kal - Kalâtdlisut - kal - - Ammassalimiut - - East Greenlandic - - - Greenlandic, East - - - Tunumiisut - - - - Greenlandic - - - Inuit - - - Kalaallisut - - - - info:lc/vocabulary/languages/kam - Kamba - kam - - - info:lc/vocabulary/languages/kan - Kannada - kan - - Canarese - - - Kanarese - - - Havyaka - - - - info:lc/vocabulary/languages/kau - Kanuri - kau - - Bornu - - - - info:lc/vocabulary/languages/krc - Karachay-Balkar - krc - - Balkar - - - - info:lc/vocabulary/languages/kaa - Kara-Kalpak - kaa - - Karakalpak - - - Qaraqalpaq - - - - info:lc/vocabulary/languages/krl - Karelian - krl - - Carelian - - - - info:lc/vocabulary/languages/kar - Karen languages - kar - - Kayah - - Karen, Red - - - Red Karen - - - - Pwo Karen - - - Sgaw Karen - - - Taungthu - - Pa-o - - - - - info:lc/vocabulary/languages/kas - Kashmiri - kas - - - info:lc/vocabulary/languages/csb - Kashubian - csb - - Cashubian - - - - info:lc/vocabulary/languages/kaw - Kawi - kaw - - Javanese, Old - - - Old Javanese - - - - info:lc/vocabulary/languages/kaz - Kazakh - kaz - - Kirghiz-Kaissak - - - - info:lc/vocabulary/languages/kha - Khasi - kha - - - info:lc/vocabulary/languages/khm - Khmer - khm - - Cambodian - - - Central Khmer - - - - info:lc/vocabulary/languages/cam - Khmer - cam - - - info:lc/vocabulary/languages/khi - Khoisan (Other) - khi - - Ju/'hoan - - !Xũ (!Kung) - - - Zjuc'hôa - - - Žu/'hõasi - - - - Khoikhoi - - Hottentot - - - - Korana - - - Nama - - - Nharo - - Naro - - - - San languages - - Bushman languages - - - - !Xõ - - Gxon - - - Hua-owani - - - !Kõ (Botswana and Namibia) - - - Koon - - - Magong - - - !Xong (Botswana and Namibia) - - - - - info:lc/vocabulary/languages/kho - Khotanese - kho - - Khotan-Saka - - - Khotanese-Sakan - - - Khotani - - - Khotansaka - - - Middle Khotanese - - - North Aryan - - - Old Khotanese - - - Saka - - - Sakan - - - - info:lc/vocabulary/languages/kik - Kikuyu - kik - - Gikuyu - - - - info:lc/vocabulary/languages/kmb - Kimbundu - kmb - - Angola - - - Bunda - - - Mbundu (Luanda Province, Angola) - - - Nbundu - - - Quimbundo (Luanda Province, Angola) - - - - info:lc/vocabulary/languages/kin - Kinyarwanda - kin - - Nyaruanda - - - Ruanda - - - Runyarwanda - - - Rwanda - - - Rufumbira - - - - info:lc/vocabulary/languages/tlh - Klingon (Artificial language) - tlh - - - info:lc/vocabulary/languages/kom - Komi - kom - - Syryenian - - - Zyrian - - - Komi-Permyak - - Permiak - - - - - info:lc/vocabulary/languages/kon - Kongo - kon - - Congo - - - Kikongo - - - Kituba (Congo (Brazzaville)) - - Kikoongo (Kituba (Congo (Brazzaville))) - - - Munukutuba - - - - Laadi - - Kilari - - - - Manyanga - - Kimanyanga - - - Kisi-Ngóombe - - - Manianga - - - - Ntaandu - - Kintaandu - - - Kisantu - - - Santu - - - - Vili - - Civili - - - Fiot - - - Fiote - - - Ki-vili - - - Ki-vumbu - - - Kivili - - - Kivumbu - - - Loango - - - Lu-wumbu - - - Luwumbu - - - Tsivili - - - - Zombo - - - - info:lc/vocabulary/languages/kok - Konkani - kok - - Concani - - - Komkani - - - Koṅkṇi - - - Agri - - Agari - - - - Chitapavani - - Chitpavani - - - Citpāvanī - - - - Jhāḍī - - - Kudali - - Malvani - - - - - info:lc/vocabulary/languages/kut - Kootenai - kut - - Kutenai - - - - info:lc/vocabulary/languages/kor - Korean - kor - - Use for related Korean languages and dialects - - - - info:lc/vocabulary/languages/kos - Kosraean - kos - - Kosrae - - - Kusaie - - - Kusaiean - - - - info:lc/vocabulary/languages/kpe - Kpelle - kpe - - Guerzé - - - - info:lc/vocabulary/languages/kro - Kru (Other) - kro - - Bete - - - Dadjriwalé - - Dadjrignoa - - - Dagli - - - Dajriwali - - - - Dida - - Wawi - - - - Godié - - Go (Côte d'Ivoire) - - - Godia - - - Godye - - - - Kru - - - Kuwaa - - Belle - - - Belleh - - - Kowaao - - - Kwaa - - - - Neyo - - Gwibwen - - - Néouolé - - - Néyau - - - Niyo - - - Towi - - - - Ngere - - Gere - - - Guéré - - - - Nyabwa - - Niaboua - - - - Tchien - - Gien - - - Kien - - - Tie - - - - Tepo - - Kroumen - - - Tewi - - - - Wobe - - Ouobe - - - - - info:lc/vocabulary/languages/kua - Kuanyama - kua - - Cuanhama - - - Kwanyama - - - Ovambo (Kuanyama) - - - - info:lc/vocabulary/languages/kum - Kumyk - kum - - - info:lc/vocabulary/languages/kur - Kurdish - kur - - Kurmanji - - - Mukri - - - - info:lc/vocabulary/languages/kru - Kurukh - kru - - Kurux - - - Oraon - - - Uraon - - - - info:lc/vocabulary/languages/kus - Kusaie - kus - - - info:lc/vocabulary/languages/kir - Kyrgyz - kir - - Kara-Kirghiz - - - Kirghiz - - - - info:lc/vocabulary/languages/lad - Ladino - lad - - Judeo-Spanish - - - Judesmo - - - Ḥakétia - - Ḥakétie - - - Haketiya - - - Ḥakitía - - - Haquetía - - - Haquetiya - - - - - info:lc/vocabulary/languages/lah - Lahndā - lah - - Jaṭkī - - - Lahndi - - - Panjabi, Western - - - Western Panjabi - - - Hindkōo - - - Khetrānī - - - Pōṭhwārī - - - Siraiki - - Bahawalpuri - - - Lahnda, Southern - - - Multani - - - Mutani - - - Panjabi, Southern - - - Reasati - - - Riasati - - - Saraiki - - - Southern Lahnda - - - Southern Panjabi - - - - Sirāikī Hindkī - - Siraiki Lahndi - - - - Sirāikī Sindhī - - Sindhi, Siraiki - - - - - info:lc/vocabulary/languages/lam - Lamba (Zambia and Congo) - lam - - - info:lc/vocabulary/languages/lao - Lao - lao - - - info:lc/vocabulary/languages/lat - Latin - lat - - Latin, Vulgar - - - Vulgar Latin - - - - info:lc/vocabulary/languages/lav - Latvian - lav - - Lettish - - - Latgalian - - East Latvian - - - High Latvian - - - Letgalian - - - - - info:lc/vocabulary/languages/lez - Lezgian - lez - - - info:lc/vocabulary/languages/lim - Limburgish - lim - - Limburger - - - - info:lc/vocabulary/languages/lin - Lingala - lin - - Bangala (Congo) - - - Mangala (Congo) - - - Ngala (Congo) - - - - info:lc/vocabulary/languages/lit - Lithuanian - lit - - - info:lc/vocabulary/languages/jbo - Lojban (Artificial language) - jbo - - - info:lc/vocabulary/languages/nds - Low German - nds - - German, Low - - - Low Saxon - - - Plattdeutsch - - - Plautdietsch - - - Saxon, Low - - - - info:lc/vocabulary/languages/dsb - Lower Sorbian - dsb - - Sorbian, Lower - - - - info:lc/vocabulary/languages/loz - Lozi - loz - - Kololo - - - Rozi - - - Sikololo - - - - info:lc/vocabulary/languages/lub - Luba-Katanga - lub - - Chiluba - - - Katanga - - - - info:lc/vocabulary/languages/lua - Luba-Lulua - lua - - Ciluba - - - Kalebwe (Luba-Lulua) - - - Luba, Western - - - Luba-Kasai - - - Western Luba - - - - info:lc/vocabulary/languages/lui - Luiseño - lui - - - info:lc/vocabulary/languages/smj - Lule Sami - smj - - Lapp, Swedish - - - Sami, Lule - - - Swedish Lapp - - - - info:lc/vocabulary/languages/lun - Lunda - lun - - - info:lc/vocabulary/languages/luo - Luo (Kenya and Tanzania) - luo - - Dho Luo - - - Gaya - - - Jo Luo - - - Kavirondo, Nilotic - - - Nife - - - Nilotic Kavirondo - - - Nyife - - - Wagaya - - - - info:lc/vocabulary/languages/lus - Lushai - lus - - Dulien - - - Mizo - - - Sailau - - - - info:lc/vocabulary/languages/ltz - Luxembourgish - ltz - - Letzebuergesch - - - Letzeburgesch - - - Luxembourgeois - - - Luxemburgian - - - - info:lc/vocabulary/languages/mac - Macedonian - mac - - Bǎlgarski (Macedonian) - - - Balgàrtzki (Macedonian) - - - Bolgàrtski (Macedonian) - - - Bulgàrtski (Macedonian) - - - Dópia - - - Entópia - - - Macedonian Slavic - - - Makedoniski - - - Makedonski - - - Slavic (Macedonian) - - - Slaviká (Macedonian) - - - Slavomacedonian - - - - info:lc/vocabulary/languages/mad - Madurese - mad - - - info:lc/vocabulary/languages/mag - Magahi - mag - - Bihari (Magahi) - - - Magadhi - - - Magaya - - - Maghadi - - - Maghai - - - Maghaya - - - Maghori - - - Magi (India) - - - Magodhi - - - Megahi - - - - info:lc/vocabulary/languages/mai - Maithili - mai - - Apabhramsa (Maithili) - - - Bihari (Maithili) - - - Maitili - - - Maitli - - - Methli - - - Tirahutia - - - Tirhuti - - - Tirhutia - - - Khotta (Maithili) - - Eastern Maithili - - - Khoratha - - - - - info:lc/vocabulary/languages/mak - Makasar - mak - - Macassarese - - - - info:lc/vocabulary/languages/mlg - Malagasy - mlg - - Hova - - - Madagascan - - - Malgache - - - Merina - - - Bara (Madagascar) - - - Betsileo - - - Masikoro - - - Sakalava - - - Tsimihety - - - - info:lc/vocabulary/languages/mla - Malagasy - mla - - - info:lc/vocabulary/languages/may - Malay - may - - Palembang Malay - - - - info:lc/vocabulary/languages/mal - Malayalam - mal - - Malabar - - - Moplah - - - - info:lc/vocabulary/languages/mlt - Maltese - mlt - - - info:lc/vocabulary/languages/mnc - Manchu - mnc - - - info:lc/vocabulary/languages/mdr - Mandar - mdr - - Andian - - - - info:lc/vocabulary/languages/man - Mandingo - man - - Malinka - - - Mandeka - - - Maninka - - - Meninka - - - - info:lc/vocabulary/languages/mni - Manipuri - mni - - Meithei - - - - info:lc/vocabulary/languages/mno - Manobo languages - mno - - Agusan Manobo - - - Ata Manobo - - - Binukid Manobo - - Binokid - - - Bukidnon - - - - Cotabato Manobo - - - Dibabawon - - Debabaon - - - Dibabaon - - - Mandaya - - - - Higaonon - - - Ilianen Manobo - - - Kagayanen - - Cagayano Cillo - - - - Manuvu - - Bagobo, Upper - - - Upper Bagobo - - - - MatigSalug - - - Sarangani Manobo - - Culamanes - - - Kulaman - - - - Western Bukidnon Manobo - - Bukidnon Manobo, Western - - - Central Manobo - - - Central Mindanao Manobo - - - - - info:lc/vocabulary/languages/glv - Manx - glv - - Manx Gaelic - - - - info:lc/vocabulary/languages/max - Manx - max - - - info:lc/vocabulary/languages/mao - Maori - mao - - South Island Maori - - Maori, South Island - - - - - info:lc/vocabulary/languages/arn - Mapuche - arn - - Araucanian - - - Mapudungun - - - - info:lc/vocabulary/languages/mar - Marathi - mar - - Mahratta - - - Mahratti - - - Murathee - - - Are - - Ade Basha - - - Aray - - - Arrey - - - Arya - - - Kalika Arya Bhasha - - - - Koshti (Marathi) - - Kosti (Marathi) - - - - Kunabi - - - Varhadi Nagpuri - - Berar Marathi - - - Berari - - - Dhanagari - - - Kumbhari - - - Madhya Pradesh Marathi - - - Nagpuri (Varhadi Nagpuri) - - - Nagpuri-Varhadi - - - Varhadi-Nagpuri Marathi - - - - - info:lc/vocabulary/languages/chm - Mari - chm - - Cheremissian - - - - info:lc/vocabulary/languages/mah - Marshallese - mah - - Ebon - - - - info:lc/vocabulary/languages/mwr - Marwari - mwr - - Bikaneri - - - Dingal - - - Mewari - - Mevadi - - - Mewa - - - Mewadi - - - - Shekhawati - - Sekhavati - - - - - info:lc/vocabulary/languages/mas - Massai - mas - - Maa (Kenya and Tanzania) - - - Masai - - - - info:lc/vocabulary/languages/myn - Mayan languages - myn - - Achi - - Cubulco Achi - - - Rabinal Achi - - - - Akatek - - Acateco - - - Kanjobal, Western - - - San Miguel Acatán Kanjobal - - - Western Kanjobal - - - - Awakateko - - Aguacatec - - - - Cakchikel - - Kacchiquel - - - - Chol - - - Chontal of Tabasco - - - Chorti - - - Chuj - - - Huastec - - Guastec - - - Wastek - - - - Itzá - - - Ixil - - - Jacalteca - - Jakalteka - - - - Kanjobal - - Conob - - - - Kekchi - - Cacchi - - - Ghec-chi - - - Quekchi - - - - Lacandon - - - Mam - - Zaklohpakap - - - - Maya - - Yucatecan - - - - Mochó - - Motozintlec - - - - Mopan - - Manche - - - - Pokomam - - Pocomam - - - Poqomam - - - - Pokonchi - - - Quiché - - Kiché - - - Utlateca - - - - Tectiteco - - Teco (Mayan) - - - - Tojolabal - - Chañabal - - - - Tzeltal - - Celdal - - - Tseltal - - - Zendal - - - - Tzotzil - - Chamula - - - Querene - - - Zotzil - - - - Tzutuhil - - Zutuhil - - - - Uspanteca - - - - info:lc/vocabulary/languages/men - Mende - men - - - info:lc/vocabulary/languages/mic - Micmac - mic - - - info:lc/vocabulary/languages/min - Minangkabau - min - - Menangkabau - - - - info:lc/vocabulary/languages/mwl - Mirandese - mwl - - - info:lc/vocabulary/languages/mis - Miscellaneous languages - mis - - Andamanese - - - Burushaski - - Boorishki - - - Khajuna - - - - Chukchi - - Tchuktchi - - - Tuski - - - - Etruscan - - - Gilyak - - Guiliak - - - Nivkh - - - - Hattic - - Hattian - - - Khattic - - - Khattili - - - Khattish - - - Proto-Hittite - - - - - Hurrian - - Mitani - - - Subarian - - - - Iberian - - - Indus script - - - Jarawa (India) - - - Kamchadal - - Itelmes - - - - Ket - - Yenisei-Ostiak - - - - Koryak - - - Manipravalam (Malayalam) - - - Mysian - - - Nancowry - - - Nenets - - Jurak - - - Yurak - - - - Nganasan - - Tavgi - - - - Nicobarese - - - Palan - - Pallan - - - - Shelta - - - Urartian - - Chaldean (Urartian) - - - Khaldian - - - Urartaean - - - Urartic - - - Vannic - - - - Yugh - - Sym-Ketish - - - - Yukaghir - - Jukaghir - - - - - info:lc/vocabulary/languages/moh - Mohawk - moh - - - info:lc/vocabulary/languages/mdf - Moksha - mdf - - - info:lc/vocabulary/languages/mol - Moldavian - mol - - - info:lc/vocabulary/languages/mkh - Mon-Khmer (Other) - mkh - - Bahnar - - - Blang - - Bulang - - - Plang - - - Pulang - - - Samtao - - - - Chrau - - - Cua - - Bong Miew - - - Kor - - - Traw - - - - Eastern Mnong - - Mnong, Eastern - - - - Hrê - - Davak - - - - Jah Hut - - Eastern Sakai - - - Sakai, Eastern - - - - Jeh - - Die - - - Yeh - - - - Katu - - Attouat - - - Khat - - - Ta River Van Kieu - - - Teu - - - Thap - - - - Khmu' - - Kamhmu - - - Phouteng - - - - Koho - - - Kui (Mon-Khmer) - - Khmer, Old (Kui) - - - Kuay - - - Kuy - - - Old Khmer (Kui) - - - Suai - - - Suay - - - - Laven - - Loven - - - - Lawa (Thailand) - - La-oop - - - Lava - - - Lavua - - - Luwa - - - - Mah Meri - - Besisi - - - Cellate - - - - Mon - - Peguan - - - Talaing - - - - Muong - - - Northern Khmer - - Khmer, Northern - - - - Nyah Kur - - Chao Bon - - - Niakuol - - - - Pacoh - - Bo - - - River Van Kieu - - - - Rengao - - - Sedang - - - Semai - - Central Sakai - - - Sakai, Central - - - Senoi - - - - Semang - - Kensiu - - - Ngok Pa - - - - Senoic languages - - Aslian languages, Central - - - Central Aslian languages - - - Sakai languages - - - - Srê - - - Stieng - - - Temiar - - Northern Sakai - - - Sakai, Northern - - - - Wa - - - - info:lc/vocabulary/languages/lol - Mongo-Nkundu - lol - - Lolo (Congo) - - - Lomongo - - - Lonkundu - - - Mongo - - - Nkundu - - - - info:lc/vocabulary/languages/mon - Mongolian - mon - - Mongol - - - Chahar - - Čakhar - - - - Dariganga - - Dar'ganga - - - Dariġangġ-a - - - Darigangga - - - - Khalkha - - - Ordos - - - - info:lc/vocabulary/languages/mos - Mooré - mos - - Mole - - - Moré - - - Moshi - - - Mossi - - - Yana (Burkina Faso and Togo) - - - - info:lc/vocabulary/languages/mul - Multiple languages - mul - - - info:lc/vocabulary/languages/mun - Munda (Other) - mun - - Asuri - - - Bhumij - - - Ho - - - Kharia - - - Korwa - - Korava (Munda) - - - - Kurku - - Bondeya - - - Bopchi - - - Kirku - - - Korakū - - - Korki - - - Korku - - - Kuri (India) - - - - Mundari - - Kohl - - - - Nihali - - Nahali - - - - Sora - - Sabara - - - Saora - - - Savara - - - Sawara - - - - - info:lc/vocabulary/languages/nah - Nahuatl - nah - - Aztec - - - Mexican - - - Pipil - - Nahuat - - - - - info:lc/vocabulary/languages/nau - Nauru - nau - - - info:lc/vocabulary/languages/nav - Navajo - nav - - - info:lc/vocabulary/languages/nbl - Ndebele (South Africa) - nbl - - Ndzundza - - - Nrebele (South Africa) - - - Transvaal Ndebele - - - - info:lc/vocabulary/languages/nde - Ndebele (Zimbabwe) - nde - - Nrebele (Zimbabwe) - - - Sindebele - - - Tebele - - - - info:lc/vocabulary/languages/ndo - Ndonga - ndo - - Ambo (Angola and Namibia) - - - Oshindonga - - - Oshiwambo - - - Ovambo (Ndonga) - - - - info:lc/vocabulary/languages/nap - Neapolitan Italian - nap - - - info:lc/vocabulary/languages/nep - Nepali - nep - - Gorkhali - - - Gurkhali - - - Khas - - - Naipali - - - Nepalese - - - Parbate - - - Parbatiya - - - Purbutti - - - Baitadi - - - Kumali - - - Parvati - - Parbati - - - - - info:lc/vocabulary/languages/new - Newari - new - - - info:lc/vocabulary/languages/nwc - Newari, Old - nwc - - Old Newari - - - - info:lc/vocabulary/languages/nia - Nias - nia - - - info:lc/vocabulary/languages/nic - Niger-Kordofanian (Other) - nic - - Niger-Congo (Other) - - - Abidji - - Adidji - - - Ari (Côte d'Ivoire) - - - - Abua - - - Ahanta - - - Aja (Benin and Togo) - - Adja - - - - Alladian - - Aladian - - - Aladyã - - - Aladyan - - - Alagia - - - Alagian - - - Alagya - - - Alajan - - - Alladyan - - - Allagia - - - Allagian language - - - - Anufo - - Chakosi - - - - Anyang - - Denya - - - Nyang (Cameroon) - - - - Anyi - - Agni - - - - Attie - - Akye - - - Kurobu - - - - Avikam - - - Awutu - - - Babungo - - Ngo - - - - Bafut - - - Baka (Cameroon and Gabon) - - - Balanta-Ganja - - Alante (Senegal) - - - Balanda (Senegal) - - - Balant (Senegal) - - - Balante (Senegal) - - - Balãt - - - Ballante (Senegal) - - - Belante (Senegal) - - - Brassa (Senegal) - - - Bulanda (Senegal) - - - Fca - - - Fjaa - - - Fraase - - - - Balanta-Kentohe - - Alante (Balanta-Kentohe) - - - Balanda (Balanta-Kentohe) - - - Balant (Balanta-Kentohe) - - - Balanta - - - Balante (Balanta-Kentohe) - - - Ballante (Balanta-Kentohe) - - - Belante (Balanta-Kentohe) - - - Brassa (Balanta-Kentohe) - - - Bulanda (Balanta-Kentohe) - - - Frase - - - - Bamun - - - Bandial - - Banjaal - - - Eegima - - - Eegimaa - - - - Bariba - - Bargu - - - Berba (Benin and Nigeria) - - - - Bassari - - Ayan - - - Biyan - - - Wo - - - - Baule - - Baoulé - - - - Bedik - - Budik - - - Tenda - - - - Bekwarra - - - Bena (Nigeria) - - Binna - - - Buna (Bena) - - - Ebina (Bena) - - - Ebuna (Bena) - - - Gbinna - - - Yangeru - - - Yongor - - - Yungur (Bena) - - - - Benue-Congo languages - - - Biali - - Berba (Benin and Burkina Faso) - - - Bieri - - - - Bijago - - Bidyogo - - - - Birifor - - - Birom - - Berom - - - Bouroum - - - Burum (Nigeria) - - - Kibo - - - Kibyen - - - Shosho - - - - Blowo - - Blo - - - Dan-blo - - - Western Dan - - - - Bobo Fing - - Black Bobo - - - Bulse - - - Finng - - - - Boomu - - Bomu - - - - Bozo - - Sorko - - - Sorogo - - - - Brissa - - Anufo (Côte d'Ivoire) - - - - Bua languages - - Boua languages - - - - Buli - - Builsa - - - Bulea - - - Bulugu - - - Guresha - - - Kanjaga - - - - Busa - - Boko - - - - Bwamu - - Bobo Wule - - - Bouamou - - - - Cross River Mbembe - - Ekokoma - - - Ifunubwa - - - Oderiga - - - Ofunobwam - - - Okam - - - Wakande - - - - Dagaare - - - Dagbani - - Dagomba - - - - Dan (Côte d'Ivoire) - - Gio - - - Yacouba - - - - Degema - - Atala - - - Udekama - - - - Diola - - Dyola - - - Yola - - - - Djimini - - Dyimini - - - Gimini - - - Jimini - - - Jinmini - - - - Dogon - - Habe - - - Tombo - - - - Ebira - - Egbira - - - Igbira - - - - Eggon - - - Ejagham - - Central Ekoi - - - Ekwe - - - Ezam - - - - Ekpeye - - - Engenni - - Egene - - - Ngene - - - - Esuulaalu - - - Etsako - - Afenmai - - - Iyekhee - - - Kukuruku - - - Yekhee - - - - Fali (Cameroon) - - Falli - - - - Falor - - Palor - - - - Farefare - - Frafra - - - Gurenne - - - Gurne - - - Gurune - - - Nankani - - - Nankanse - - - Ninkare - - - - Gbagyi - - - Gbandi - - Bandi - - - - Gen-Gbe - - Gẽ - - - Mina (Benin and Togo) - - - - Gikyode - - Chode - - - Kyode - - - - Gonja - - Guang - - - - Gua - - Gwa (Ghana) - - - - Gun-Gbe - - Alada - - - Egun - - - - Gurma - - Gourmantché - - - Gulmance - - - - Guyuk - - - Gweetaawu - - Dan-gouéta - - - Eastern Dan - - - Gouéta - - - Gwétaawo - - - - Hanga (Ghana) - - Anga (Ghana) - - - - Hõne - - Jukun of Gwana - - - - Idoma - - Oturkpo - - - - Igede - - - Igo - - Ahlon - - - Anlo - - - - Ikwere - - Oratta-Ikwerri - - - - Indenie - - Ndenie - - - Ndenye - - - Ndinian - - - Ndyenye - - - - Itsekiri - - Isekiri - - - - Izere - - Jarawa (Nigeria) - - - - Izi - - - Jju - - Ju (Benue-Congo) - - - Kaje - - - - Jowulu - - Jo - - - Samogho (Jowulu) - - - Samoighokan - - - - Jukun - - Kurorofa - - - - Kaansa - - Gã (Burkina Faso) - - - Gan (Burkina Faso) - - - Gane (Burkina Faso) - - - Kaan (Burkina Faso) - - - Kaanse - - - Kãasa (Burkina Faso) - - - Kan (Burkina Faso) - - - - Kabiye - - Kabre - - - Kabye - - - - Kagoro (Mali) - - - Kagoro (Nigeria) - - Gworok - - - - Karang (Cameroon) - - - Kasem - - Kasena - - - Kasim - - - Kassem - - - Kassene - - - - Kassonke - - Khassonke - - - - Kissi - - Kisi (West Africa) - - - - Konkomba - - - Konni - - Koma (Ghana) - - - - Kposo - - Akposo - - - Ikposo - - - - Krahn - - Kran - - - Northern Krahn - - - Western Krahn - - - - Krongo - - Kadumodi - - - Kurungu - - - - Kulango - - Koulango - - - Kpelego - - - Nabe - - - Ngwala - - - Nkurange - - - Zazere - - - - Kuo (Cameroon and Chad) - - Ko (Cameroon and Chad) - - - Koh - - - - Kuranko - - Koranko - - - - Kurumba - - Deforo - - - Foulse - - - Fulse - - - Koromfe - - - Kouroumba - - - Kurumfe - - - Lilse - - - - Kusaal - - Kusasi - - - - Kwanja - - - Kweni - - Gouro - - - - Lefana - - Bouem - - - Buem - - - Bwem - - - - Ligbi - - - Limba - - - Limbum - - Llimbumi - - - Ndzungle - - - Njungene - - - Nsugni - - - Wimbum - - - Zungle - - - - Lobi - - - Loko - - Landogo - - - - Loma - - Baru - - - Buzi - - - Lorma - - - - Longuda - - Nunguda - - - - Lorhon - - Loghon - - - - Lyele - - Lele (Burkina Faso) - - - - Mamara - - Bamana (Senufo) - - - Mianka - - - Minianka - - - Minyanka - - - - Mambila - - Lagubi - - - Nor - - - Tagbo - - - Torbi - - - - Mampruli - - - Mandjak - - - Mankanya - - Bola (Portuguese Guinea) - - - Brame - - - Bulama - - - - Mankon - - - Mano - - - Mayogo - - - Mbili - - - Mbum - - Mbam - - - - Mi Gangam - - Dye - - - Gangam - - - Ngangan - - - - Migili - - Koro Lafia - - - - Mo (Côte d'Ivoire and Ghana) - - Buru (Côte d'Ivoire and Ghana) - - - Deg - - - Mmfo - - - - Moba - - - Muana - - - Mumuye - - - Mundang - - Moundang - - - - Mungaka - - Bali (Cameroon) - - - Ngaaka - - - - Nafaanra - - - Nawuri - - - Nchumburu - - - Ndogo-Sere languages - - - Ngbaka - - - Ngbaka ma'bo - - Bwaka - - - Ngbaka limba - - - - Nirere - - - Ninzo - - Akiza - - - Amar Tita - - - Ancha - - - Fadan Wate - - - Gbhu D Amar Randfa - - - Hate (Ninzo) - - - Incha - - - Kwasu - - - Ninzam - - - Nunzo - - - Sambe - - - - Nkonya - - - Nomaante - - - Noon - - - Noone - - Noni - - - - Northern Bullom - - Bullom, Northern - - - - Nunuma - - Nibulu - - - Nouni - - - - Nupe - - Nope - - - - Ogbronuagum - - - Oku - - Bvukoo - - - Ebkuo - - - Ekpwo - - - Kuo (Oku) - - - Ukfwo - - - Uku (Oku) - - - - Oron - - - Pinyin - - - Safaliba - - Safalaba - - - Safalba - - - Safali - - - - Samo (West Africa) - - Goe - - - Matya - - - Maya (Burkina Faso) - - - Samogo-Sane - - - San (Eastern Mande) - - - Sane - - - - Sanwi - - - Sembla - - Sambla - - - Samogho-Senku - - - Samogo-Senku - - - Seeku - - - Sembila - - - Senku - - - Southern Samo (Western Mande) - - - - Senari - - Senufo - - - - Senya - - - Sherbro - - Bullom, Southern - - - Southern Bullom - - - - Sissala - - - Somba - - Betammadibe - - - Ditammari - - - Tamaba - - - - Tagbana - - - Tampulma - - Tamprusi - - - - Téén - - - Tem - - Cotocoli - - - Kotokoli - - - Tim - - - - Tigon Mbembe - - Akonto - - - Akwanto - - - Noale - - - Tigim - - - Tigon - - - Tigong - - - Tigum - - - Tigun - - - Tikun - - - Tukun - - - - Tikar - - - Tobote - - Basari (Togo and Ghana) - - - - Tofingbe - - - Toma (Burkina Faso) - - Makaa (Burkina Faso) - - - Nyaana - - - - Tura - - Toura - - - - Tusia - - Toussia - - - - Tuwunro - - - Tyembara - - - Ukaan - - Aika - - - Anyaran - - - Auga - - - Ikan - - - Kakumo - - - - Urhobo - - - Vagala - - Kira - - - Konosarola - - - Siti - - - - Vige - - - Winyé - - Kõ (Burkina Faso) - - - Kols - - - Kolsi - - - - Yakö - - Kö (Yakö) - - - Lukö - - - - Yom - - Kpilakpila - - - Pila - - - Pilapila - - - - - info:lc/vocabulary/languages/ssa - Nilo-Saharan (Other) - ssa - - Sub-Saharan African (Other) - - - Adhola - - Dhopadhola - - - Ludama - - - - Alur - - Aloro - - - Alua - - - Alulu - - - Aluru - - - Dho Alur - - - Jo Alur - - - Lur (Alur) - - - Luri (Alur) - - - - Anuak - - Yambo - - - - Aringa - - Low Lugbara - - - - Bagirmi - - Barma - - - - Baka - - Tara Baaka - - - - Bari - - Dzilio - - - - Birri (Central African Republic) - - Abiri - - - Ambili - - - Biri (Central African Republic) - - - Bviri - - - Viri language - - - - Bongo - - - Bongo-Bagirmi languages - - - Bor (Lwo) - - Belanda - - - - Dazaga - - Dasa - - - Dasaga - - - Daza (Nilo-Saharan) - - - Dazagada - - - Dazza - - - Dazzaga - - - Tebu (Dazaga) - - - Tibbu (Dazaga) - - - Toubou (Dazaga) - - - Tubu (Dazaga) - - - - Fur - - - Gambai - - Kabba Laka - - - Ngambai - - - Sara Gambai - - - - Ingassana - - Gaam - - - Ingessana - - - Kamanidi - - - Mamidza - - - Memedja - - - Metabi - - - Muntabi - - - Tabi (Ingassana) - - - - Jur Modo - - Jur (Jur Modo) - - - Modo - - - - Kaba (Central Sudanic) - - - Kalenjin - - - Kara (Central African Republic and Sudan) - - Fer - - - Gula (Central African Republic and Sudan) - - - Yama - - - Yamegi - - - - Karamojong - - Akarimojong - - - - Kenga - - - Kipsikis - - - Kreish - - - Kùláál - - Gula (Lake Iro, Chad) - - - - Kunama - - Cunama - - - - Lango (Uganda) - - - Lendu - - - Lese - - - Logo - - Logo Kuli - - - Logoti - - - - Lotuko - - Latuka - - - - Lugbara - - Logbara - - - Logbware - - - Luguaret - - - Lugware - - - - Lwo (Sudan) - - Dhe Lwo - - - Dyur - - - Giur - - - Jo Lwo - - - Jur (Lwo (Sudan)) - - - Luo (Sudan) - - - - Maban - - Meban - - - - Maʾdi (Uganda and Sudan) - - Madi-ti (Uganda and Sudan) - - - - Majingai - - Midjinngay - - - Moggingain - - - Sara-Majingai - - - - Mamvu - - Momvu - - - Monvu - - - Tengo - - - - Mangbetu - - Monbuttu - - - - Mbai (Moissala) - - Moissala Mbai - - - Sara Mbai (Moissala) - - - - Moru - - - Murle - - Beir - - - - Nandi - - - Nara - - Barea - - - Baria - - - Barya - - - Higir - - - Kolkotta - - - Koyta - - - Mogoreb - - - Morda - - - Nera - - - Nere - - - Santora - - - - Ngama - - Sara Ngama - - - - Ngiti - - Druna - - - Lendu, Southern - - - Ndruna - - - Southern Lendu - - - - Nuer - - Abigar - - - Nath - - - - Päri (Sudan) - - - Proto-Eastern Sudanic - - - Sabaot - - - Samburu - - Burkeneji - - - Lokop - - - Nkutuk - - - Sambur - - - Sampur - - - - Sara - - Majingai-Ngama - - - - Suk - - Pokot - - - - Tedaga - - Tebou - - - Tebu (Tedaga) - - - Teda - - - Tedagada - - - Tibbu (Tedaga) - - - Tibu - - - Toda (Africa) - - - Todaga - - - Todga - - - Toubou (Tedaga) - - - Tubu - - - Tuda (Africa) - - - Tuduga - - - - Teso - - Ateso - - - Iteso - - - - Toposa - - Abo (Sudan) - - - Akeroa - - - Dabossa - - - Huma (Sudan) - - - Kare (Sudan) - - - Khumi (Sudan) - - - Taposa - - - - Turkana - - - Uduk - - - Yulu - - - Zaghawa - - Beri-aa - - - Berri - - - Kebadi - - - Merida - - - Soghaua - - - Zeghawa - - - - - info:lc/vocabulary/languages/niu - Niuean - niu - - - info:lc/vocabulary/languages/nqo - N'Ko - nqo - - - info:lc/vocabulary/languages/nog - Nogai - nog - - - info:lc/vocabulary/languages/zxx - No linguistic content - zxx - - - info:lc/vocabulary/languages/nai - North American Indian (Other) - nai - - Use for the other languages of North America north of Mexico excluding the - languages of the Azteco-Tanoan language phylum. - - - Alabama - - - Arikara - - - Atsugewi - - - Beothuk - - - Chickasaw - - - Chimariko - - - Chitimacha - - Chetimacha - - - Shetimasha - - - - Chumash - - - Coahuilteco - - Tejano - - - - Cocopa - - - Coos - - Kaus - - - Kwokwoos - - - - Eastern Pomo - - Pomo, Eastern - - - - Eyak - - Ugalachmut - - - - Hualapai - - Jaguallapai - - - Mataveke-paya - - - Walapai - - - - Karok - - - Keres - - - Kiliwa - - Yukaliwa - - - - Konomihu - - - Kuitsh - - Lower Umpqua - - - Umpqua, Lower - - - - Kumiai - - Campo - - - Cochimi (Diegueño) - - - Comeya - - - Cuchimí - - - Diegueño - - - Digueño - - - Iipay - - - Kamia - - - Kamiai - - - Kamiyahi - - - Kamiyai - - - Ki-Miai - - - Ko'al - - - Ku'ahl - - - Kumeyaai - - - Kumeyaay - - - Kumia - - - Kw'aal - - - Quemayá - - - Tiipay - - - Tipai - - - - Maidu - - Pujunan - - - - Mikasuki - - Mekusuky - - - - Miwok languages - - Mewan - - - Moquelumnan - - - - Mutsun - - - Nez Percé - - Numipu - - - Sahaptin - - - - Northern Sierra Miwok - - Miwok, Northern Sierra - - - - Ohlone - - Costanoan - - - - Paipai - - - Pawnee - - - Southeastern Pomo - - Pomo, Southeastern - - - - Timucua - - - Tlakluit - - Echeloot - - - Wishram - - - - Tonkawa - - - Tunica - - Tonican - - - Yoron - - - Yuron - - - - Wappo - - - Wichita - - - Wikchamni - - Wükchamni - - - - Wintu - - - Wiyot - - - Yahi - - - Yakama - - Yakima - - - - Yuchi - - Uchee - - - - Yuki - - - - info:lc/vocabulary/languages/frr - North Frisian - frr - - Frisian, North - - - - info:lc/vocabulary/languages/sme - Northern Sami - sme - - Sami, Northern - - - - info:lc/vocabulary/languages/nso - Northern Sotho - nso - - Pedi - - - Sepedi - - - Sotho, Northern - - - Transvaal Sotho - - - Pai (South Africa) - - Eastern Sotho - - - - - info:lc/vocabulary/languages/nor - Norwegian - nor - - Bokmål - - - Dano-Norwegian - - - Riksmål - - - Trøndersk - - Trønder - - - Trøndesk - - - Trøndsk - - - - - info:lc/vocabulary/languages/nob - Norwegian (Bokmål) - nob - - Bokmål - - - Dano-Norwegian - - - Riksmål - - - - info:lc/vocabulary/languages/nno - Norwegian (Nynorsk) - nno - - Landsmaal - - - Landsmål - - - Nynorsk - - - - info:lc/vocabulary/languages/nub - Nubian languages - nub - - Dilling - - Delen - - - Warkimbe - - - - Dongola-Kenuz - - Kenuz - - - - Mahas-Fiyadikka - - Fadicca - - - Fiadidja - - - Fiyadikka - - - Nobiin - - - - Midob - - - Old Nubian (to 1300) - - Nubian, Old - - - - - info:lc/vocabulary/languages/nym - Nyamwezi - nym - - - info:lc/vocabulary/languages/nya - Nyanja - nya - - Chinyanja - - - Nyassa - - - Chewa - - Cewa - - - - - info:lc/vocabulary/languages/nyn - Nyankole - nyn - - Lunyankole - - - Nkole - - - Runyankore - - - - info:lc/vocabulary/languages/nyo - Nyoro - nyo - - Lunyoro - - - Urunyoro - - - - info:lc/vocabulary/languages/nzi - Nzima - nzi - - Nsima - - - Nzema - - - Zema - - - - info:lc/vocabulary/languages/oci - Occitan (post-1500) - oci - - Langue d'oc (post-1500) - - - Provençal, Modern (post-1500) - - - Béarnais (post-1500) - - - Gascon (post-1500) - - - - info:lc/vocabulary/languages/lan - Occitan (post 1500) - lan - - - info:lc/vocabulary/languages/xal - Oirat - xal - - Kalmyk - - Calmuck - - - - Oyrat - - - - info:lc/vocabulary/languages/oji - Ojibwa - oji - - Anishinabe - - - Chippewa - - - Otchipwe - - - Salteaux - - - Saulteaux - - - Ottawa - - - - info:lc/vocabulary/languages/non - Old Norse - non - - Altnordish - - - Icelandic, Old (to 1550) - - - Norse, Old - - - Norse, Western - - - Norwegian, Old (to 1350) - - - Old Icelandic (to 1550) - - - Old Norwegian (to 1350) - - - Western Norse - - - - info:lc/vocabulary/languages/peo - Old Persian (ca. 600-400 B.C.) - peo - - Persian, Old (ca. 600-400 B.C.) - - - - info:lc/vocabulary/languages/ori - Oriya - ori - - Uriya - - - Adiwasi Oriya - - Adibasi Oriyā - - - Ādivāsi Oriyā - - - Desai - - - Kotia - - - Kotia Oriya - - - Kotiya - - - Tribal Oriya - - - - Bhatri - - Basturia - - - Bhatra - - - Bhattra - - - Bhattri - - - Bhottada - - - Bhottara - - - - Sambalpuri - - - - info:lc/vocabulary/languages/orm - Oromo - orm - - Afan - - - Galla - - - Gallinya - - - Boran - - - Orma - - Uardai - - - Warday - - - - - info:lc/vocabulary/languages/gal - Oromo - gal - - - info:lc/vocabulary/languages/osa - Osage - osa - - - info:lc/vocabulary/languages/oss - Ossetic - oss - - Āsī - - - Oseti - - - Osi - - - Ūsatī - - - - info:lc/vocabulary/languages/oto - Otomian languages - oto - - Chichimeca-Jonaz - - - Matlatzinca - - Pirinda - - - - Mazahua - - - Ocuiltec - - Atzinca - - - Maclatzinca - - - Tlahuica - - - - Otomi - - Hñahñu - - - Othomi - - - - Pame - - Chichimeca Pame - - - - - info:lc/vocabulary/languages/pal - Pahlavi - pal - - Huzvaresh - - - Middle Persian (Pahlavi) - - - Parsi - - - Pazend - - - Pehlevi - - - Persian, Middle (Pahlavi) - - - - info:lc/vocabulary/languages/pau - Palauan - pau - - Pelew - - - - info:lc/vocabulary/languages/pli - Pali - pli - - - info:lc/vocabulary/languages/pam - Pampanga - pam - - Kapampangan - - - - info:lc/vocabulary/languages/pag - Pangasinan - pag - - - info:lc/vocabulary/languages/pan - Panjabi - pan - - Eastern Panjabi - - - Punjabi - - - - info:lc/vocabulary/languages/pap - Papiamento - pap - - - info:lc/vocabulary/languages/paa - Papuan (Other) - paa - - Abau - - Green River - - - - Abulas - - Ambulas - - - Maprik - - - - Agarabe - - - Alamblak - - - Ama (Papua New Guinea) - - Sawiyanu - - - - Amele - - - Ampale - - Ampeeli - - - Safeyoka - - - - Aneme Wake - - Abia - - - Musa, Upper - - - Upper Musa - - - - Anggor - - Bibriari - - - Senagi - - - Watapor - - - - Ankave - - Angave - - - - Aomie - - Omie - - - - Asaro - - Dano - - - Upper Asaro - - - - Asmat - - - Au - - - Auyana - - - Awa (Eastern Highlands Province, Papua New Guinea) - - - Bahinemo - - Gahom - - - Wogu - - - - Baining - - Kakat - - - Makakat - - - Maqaqet - - - Qaqet - - - - Barai - - - Baruya - - - Bauzi - - Baudi - - - Bauri - - - Pauwi - - - - Benabena - - Bena (Papua New Guinea) - - - Bena-bena - - - - Berik - - - Biangai - - Baingai - - - - Bimin - - - Binumarien - - - Bisorio - - Gadio - - - Iniai - - - - Blagar - - Belagar - - - Tarang - - - - Bom - - Anjam - - - Bogadjim - - - Lalok - - - - Buin - - Rugara - - - Telei - - - - Bunak - - Buna' (Indonesia) - - - Bunake - - - Bunaq - - - - Burum (Papua New Guinea) - - Bulum - - - - Chuave - - Tjuave - - - - Daga - - Dimuga - - - Nawp - - - - Daribi - - Elu - - - Karimui - - - Makarub - - - Mikaru - - - - Dedua - - - Duna - - Yuna - - - - Eipo - - - Enga - - Tsaga - - - - Ese - - Managalasi - - - Managulasi - - - - Faiwol - - Fegolmin - - - - Fasu - - - Folopa - - - Fore - - - Gadsup - - - Gahuku - - - Galela - - - Gimi - - - Gogodala - - - Golin - - - Gope - - Era River - - - Kope - - - - Gresi - - Glesi - - - Gresik - - - Klesi - - - - Guhu-Samane - - Mid-Waria - - - - Gwahatike - - - Gwedena - - Umanakaina - - - - Halopa - - Botelkude - - - Nobonob - - - Nupanob - - - - Huli - - - Iatmul - - Big Sepik - - - - Inanwatan - - Suabo - - - - Inoke - - Yate (Papua New Guinea) - - - - Irumu - - - Iwam - - - Iyo (Papua New Guinea) - - Bure (Papua New Guinea) - - - Nabu - - - Naho - - - Nahu - - - Ndo (Papua New Guinea) - - - - Kalabra - - - Kalam - - Karam - - - - Kaluli - - - Kamano - - Kafe - - - - Kamasau - - - Kamtuk - - Kemtuik - - - - Kanite - - Kemiju Jate - - - - Kapauku - - Ekagi - - - - Kasua - - - Kâte - - - Kelon - - Kalong - - - Kelong - - - Klon - - - Kolon - - - - Ketengban - - Oktengban - - - - Kewa - - - Kobon - - - Komba - - - Komunku - - - Kongara - - - Korape - - Kwarafe - - - Okeina - - - - Kosena - - - Kovai - - Alngubin - - - Kobai - - - Kowai - - - Umboi - - - - Kunimaipa - - - Kwerba - - - Lambau - - - Lunambe - - - Mai Brat - - Mey Brat - - - - Manambu - - - Mape - - - Meax - - - Medlpa - - Hagen - - - Moglei - - - - Menya - - Menyama - - - Menye - - - - Mianmin - - - Migabac - - Migaba' - - - - Monumbo - - - Mountain Arapesh - - Arapesh, Mountain - - - Bukiyup - - - - Mountain Koiari - - Koiali, Mountain - - - - Mpur (Indonesia) - - Amberbaken - - - - Mugil - - Bargam - - - Saker - - - - Nabak - - Wain - - - - Nankina - - - Narak - - Gandja - - - Kandawo - - - Kol (Papua New Guinea) - - - - Nasioi - - - Nek - - - Nii - - Ek Nii - - - - Notu - - Ewage - - - - Oksapmin - - - Olo - - Orlei - - - - Ono - - - Orokaiva - - - Orokolo - - - Orya - - Oria - - - Uria - - - - Pay - - - Pinai-Hagahai - - - Purari - - Eurika - - - Evora - - - Iai (Papua New Guinea) - - - Iare - - - Kaimare - - - Kaura (Papua New Guinea) - - - Kipaia - - - Koriki - - - Maipua - - - Namau - - - - Rawa - - Karo-Rawa - - - - Rotokas - - - Saberi - - Isirawa - - - Okwasar - - - - Sahu - - - Samo (Western Province, Papua New Guinea) - - Supei - - - - Sawos - - Tshwosh - - - - Selepet - - - Sentani - - - Siane - - - Siroi - - Pasa - - - Suroi - - - - Siwai - - Motuna - - - - Sona (Papua New Guinea) - - Kanasi - - - - Suena - - Yarawe - - - Yema - - - - Sulka - - - Tabla - - Tanahmerah (Northeast Irian Jaya) - - - - Tairora - - - Tani - - Miami (Papua New Guinea) - - - Miani - - - Suaru - - - - Tauya - - Inafosa - - - - Telefol - - - Tepera - - - Ternate - - - Tewa (Papuan) - - Teiwa - - - - Tifal - - - Timbe - - - Toaripi - - Motumotu - - - - Tobelo - - - Urii - - - Usarufa - - Usurufa - - - Uturupa - - - - Waffa - - - Wantoat - - - Washkuk - - Kwoma - - - - Wasi - - - Were - - - West Makian - - Desite - - - Makian, West - - - Titinec - - - - Wiru - - - Woisika - - - Yabiyufa - - Jafijufa - - - - Yagaria - - Frigano Jate - - - Kami (Papua New Guinea) - - - - Yangoru - - - Yareba - - - Yau - - - Yessan-Mayo - - Mayo (New Guinea) - - - - Yongkom - - - Yopno - - Yupna - - - - Yui - - Salt-Yui - - - - - info:lc/vocabulary/languages/per - Persian - per - - Farsi - - - Dari - - Kabuli - - - Kabuli-Persian - - - Khorasani - - - - - info:lc/vocabulary/languages/phi - Philippine (Other) - phi - - Abaknon - - Capul - - - Inabaknon - - - Kapul - - - Sama Abaknon - - - - Agta - - Cagayan Agta, Central - - - Central Cagayan Agta - - - - Agutaynon - - - Aklanon - - - Alangan - - - Amganad Ifugao - - Ifugao, Amganad - - - - Atta - - Northern Cagayan Negrito - - - - Ayangan Ifugao - - Ifugao, Ayangan - - - - Bagobo - - - Balangao - - - Balangingì - - Baangingi' - - - Bangingi - - - Northern Sinama - - - Sama Bangingì - - - Sea Samal - - - Sinama, Northern - - - - Banton - - Bantuanon - - - - Batad Ifugao - - Ifugao, Batad - - - - Bilaan - - - Bolinao - - Binubolinao - - - - Bontoc - - Finontok - - - - Botolan Sambal - - Aeta Negrito - - - Sambal Botolan - - - Sambali Botolan - - - - Caluyanun - - - Central Bontoc - - Bontoc, Central - - - - Central Subanen - - Sindangan Subanun - - - Subanen, Central - - - Subanun, Sindangan - - - - Cuyunon - - Kuyonon - - - - Dumagat (Casiguran) - - Agta (Casiguran) - - - Casiguran Agta - - - Casiguran Dumagat - - - - Dumagat (Umirey) - - Agta (Umirey) - - - Dingalan Dumagat - - - Umirey Agta - - - Umirey Dumagat - - - - Eastern Bontoc - - Bontoc, Eastern - - - - Eastern Ifugao - - Ifugao, Eastern - - - - Gaddang - - - Ibaloi - - Benguet Igorot - - - Nabaloi - - - - Ibanag - - - Ifugao - - - Ilongot - - - Isinay - - Inmeas - - - - Isneg - - Apayao - - - - Itawis - - - Itbayat - - - Ivatan - - - Jama Mapun - - Cagayanon - - - Mapun - - - Pullon Mapun - - - Sama Mapun - - - - Ivatan - - Batan - - - Ibatan - - - - Kalamian - - Calamian - - - - Kalinga languages - - - Kankanay - - Cancanai - - - Lepanto-Igorot - - - - Kinaray-a - - Antiqueno - - - Binukidnon - - - Hamtiknon - - - Hinaraya - - - Karay-a - - - - Lower Tanudan Kalinga - - Kalinga, Lower Tanudan - - - Tanudan Kalinga, Lower - - - - Magindanao - - Moro - - - - Mamanwa - - - Mangyan - - Iraya - - - - Mansaka - - - Maranao - - Moro - - - - Masbateno - - Minasbate - - - - Mayoyao Ifugao - - Ifugao, Mayoyao - - - - Melebuganon - - Milebuganon - - - Molbog - - - - Northern Kankanay - - Bontoc, Western - - - Kankanay, Northern - - - Sagada-Igorot - - - Western Bontoc - - - - Palawano - - - Pangutaran Sama - - Sama Pangutaran - - - - Sama Sibutu - - Sibutu Sama - - - Southern Sama - - - - Sambali - - Zambal - - - - Southern Bontoc - - Barlig Bontoc - - - Bontoc, Southern - - - Kadaklan Barlig Bontoc - - - - Southern Subanen - - Lapuyan Subanen - - - Margosatubig Subanun - - - Subanen, Southern - - - - Subanun - - Subano - - - - Sulod - - Mundu (Philippines) - - - - Sulu - - Joloano - - - Moro - - - Sooloo - - - - Tagakaolo - - Kalagan, Tagakaolo - - - - Tagbanua - - Aborlan Tagbanwa - - - Apurahuano - - - - Tausug - - - Tboli - - Tagabili - - - Tiboli - - - - Tina Sambal - - - Tiruray - - Teduray - - - - Tuwali - - - Western Subanon - - Siocan Subanon - - - Subanon, Western - - - - Yakan - - - - info:lc/vocabulary/languages/phn - Phoenician - phn - - Punic - - - - info:lc/vocabulary/languages/pon - Pohnpeian - pon - - Ponape - - - Ponapean - - - - info:lc/vocabulary/languages/pol - Polish - pol - - - info:lc/vocabulary/languages/por - Portuguese - por - - - info:lc/vocabulary/languages/pra - Prakrit languages - pra - - Gandhari Prakrit - - Gandhari - - - - Magadhi Prakrit - - - Maharashtri - - - Śaurasēnī - - - - info:lc/vocabulary/languages/pro - Provençal (to 1500) - pro - - Occitan, Old (to 1500) - - - Old Occitan (to 1500) - - - Old Provençal (to 1500) - - - - info:lc/vocabulary/languages/pus - Pushto - pus - - Afghan - - - Pakhto - - - Pakkhto - - - Pashto - - - Pashtu - - - Pukhtu - - - Pukkhto - - - Pukshto - - - Pushtu - - - Wanetsi - - Vanechi - - - Waneci - - - Wanesi - - - Wenetsi - - - - - info:lc/vocabulary/languages/que - Quechua - que - - Inca - - - Kechua - - - Quichua - - - Runasimi - - - Huanca - - Wanka - - - - Ingano - - Inga - - - - - info:lc/vocabulary/languages/roh - Raeto-Romance - roh - - Rhaeto-Romance - - - Romansh - - - Rumansh - - - - info:lc/vocabulary/languages/raj - Rajasthani - raj - - Bagri - - Bagari - - - Bahgri - - - Baorias - - - - Gujuri - - Gojari - - - Gojri - - - Gujar - - - Gujari - - - Gujer - - - Gujjari - - - Gujri (Gujuri) - - - - Harauti - - - Jaipurī - - Dhundhari - - - - Lambadi - - Banjara - - - Labhani - - - Lamani - - - Lambani - - - - Malvi - - Malavi - - - Mallow - - - Malwi - - - Ujjaini (Malvi) - - - - Nimadi - - Nemadi - - - Nimari - - - - Sondwari - - Sondhavāṛī - - - Sondhwadi - - - Sondhwari - - - Soudhwari - - - - Wagdi - - Vāgaḍī - - - Vāgarī - - - Vagdi - - - Vaged - - - Vageri - - - Vagi - - - Vagri - - - Wagadi - - - Waghari - - - Wagholi - - - - - info:lc/vocabulary/languages/rap - Rapanui - rap - - - info:lc/vocabulary/languages/rar - Rarotongan - rar - - Cook Islands Maori - - - Maori, Cook Islands - - - Manihiki Rarotongan - - Rarotongan, Manihiki - - - - - info:lc/vocabulary/languages/roa - Romance (Other) - roa - - Anglo-Norman - - Anglo-French - - - Norman-French - - - - Cajun French - - Acadian (Louisiana) - - - French, Cajun - - - Louisiana Acadian - - - Louisiana French - - - - Franco-Venetian - - Franco-Italian - - - - Italian, Old (to 1300) - - Old Italian - - - - Ladin - - - Portuñol - - Bayano - - - Brasilero - - - Brasilero - - - Brazilero - - - Fronteiriço - - - Fronterizo - - - Portanhol - - - Portunhol - - - - Spanish, Old (to 1500) - - Old Spanish - - - - - info:lc/vocabulary/languages/rom - Romani - rom - - Gipsy - - - Gypsy - - - Romany - - - Rommany - - - Caló (Romani) - - - Kalderash - - Coppersmith - - - Kaldaraš - - - Kalderaš - - - Kelderaš - - - Kelderashícko - - - - Lovari - - - Nuri - - - Spoitori - - Spoitari - - - - - info:lc/vocabulary/languages/rum - Romanian - rum - - Rumanian - - - Boyash - - - Moldovan - - Moldavian - - - Moldovean - - - Moldovian - - - - - info:lc/vocabulary/languages/run - Rundi - run - - Kirundi - - - - info:lc/vocabulary/languages/rus - Russian - rus - - - info:lc/vocabulary/languages/sal - Salishan languages - sal - - Bella Coola - - - Colville - - - Comox - - Komuk - - - - Cowlitz - - - Kalispel - - Pend d'Oreille - - - - Lillooet - - - Ntlakyapamuk - - Netlakapamuk - - - Thompson - - - - Okanagan - - Okinagan - - - - Quinault - - - Salish - - - Sechelt - - Seshelt - - - - Shuswap - - - Squawmish - - Skwamish - - - - Stalo - - Halkomelem - - - - - info:lc/vocabulary/languages/sam - Samaritan Aramaic - sam - - - info:lc/vocabulary/languages/smi - Sami - smi - - Lapp - - - - info:lc/vocabulary/languages/lap - Sami - lap - - - info:lc/vocabulary/languages/smo - Samoan - smo - - - info:lc/vocabulary/languages/sao - Samoan - sao - - - info:lc/vocabulary/languages/sad - Sandawe - sad - - Kissandaui - - - Wassandaui - - - - info:lc/vocabulary/languages/sag - Sango (Ubangi Creole) - sag - - - info:lc/vocabulary/languages/san - Sanskrit - san - - Sanscrit - - - Buddhist Hybrid Sanskrit - - Hybrid Sanskrit, Buddhist - - - - Epigraphical Hybrid Sanskrit - - Hybrid Sanskrit, Epigraphical - - - - Vedic - - Indic, Old - - - Old Indic - - - Vedic Sanskrit - - - - - info:lc/vocabulary/languages/sat - Santali - sat - - Sonthal - - - - info:lc/vocabulary/languages/srd - Sardinian - srd - - - info:lc/vocabulary/languages/sas - Sasak - sas - - - info:lc/vocabulary/languages/sco - Scots - sco - - Lallans - - - Lowland Scots - - - Scots (English) - - - Scottish (Germanic) - - - - info:lc/vocabulary/languages/gla - Scottish Gaelic - gla - - Erse (Scottish Gaelic) - - - Gaelic (Scots) - - - Scots Gaelic - - - - info:lc/vocabulary/languages/gae - Scottish Gaelix - gae - - - info:lc/vocabulary/languages/sel - Selkup - sel - - Ostiak Samoyed - - - - info:lc/vocabulary/languages/sem - Semitic (Other) - sem - - Ammonite - - - Canaanite - - - Eblaite - - Paleocanaanite - - - - Gurage languages - - - Harari - - Adari - - - Ararge - - - - Inor - - Ennemor - - - - Jibbali - - - Mahri - - Mehri - - - - Mandean - - - Sabaean - - - South Arabic - - Arabic, South - - - - Wolane - - Olane - - - Walane - - - Welene - - - Weleni - - - - Zay - - Gelilla - - - Lak'i (Ethiopia) - - - Laqi - - - Zai - - - Zway - - - - - info:lc/vocabulary/languages/srp - Serbian - srp - - - info:lc/vocabulary/languages/scc - Serbian - scc - - - info:lc/vocabulary/languages/srr - Serer - srr - - - info:lc/vocabulary/languages/shn - Shan - shn - - - info:lc/vocabulary/languages/sna - Shona - sna - - China (Africa) - - - Mashona - - - Karanga - - - Zezuru - - Central Shona - - - - - info:lc/vocabulary/languages/sho - Shona - sho - - - info:lc/vocabulary/languages/iii - Sichuan Yi - iii - - Yi, Sichuan - - - - info:lc/vocabulary/languages/scn - Sicilian Italian - scn - - Italian, Sicilian - - - - info:lc/vocabulary/languages/sid - Sidamo - sid - - - info:lc/vocabulary/languages/sgn - Sign languages - sgn - - American Sign Language - - Ameslan - - - - Australasian Signed English - - - Austrian Sign Language - - ÖGS (Sign language) - - - Österreichische Gebärdensprache - - - - British Sign Language - - - Czech Sign Language - - Český znakový jazyk - - - - Danish Sign Language - - DSL (Danish Sign Language) - - - - French Belgian Sign Language - - Belgian French Sign Language - - - Langue des signes Belge Francophone - - - Langue des signes française Belgique - - - LSFB (Sign language) - - - - Icelandic Sign Language - - ISL (Icelandic Sign Language) - - - - Jordanian Sign Language - - JSL (Sign Language) - - - Lughat al-Ishāra al-Urdunia - - - - Mauritian Sign Language - - - Quebec Sign Language - - Langue des signes québécoise - - - - - info:lc/vocabulary/languages/bla - Siksika - bla - - Blackfoot - - - - info:lc/vocabulary/languages/snd - Sindhi - snd - - Kachchhi - - Kacchī - - - Kutchi - - - - - info:lc/vocabulary/languages/sin - Sinhalese - sin - - Cingalese - - - Singhala - - - Singhalese - - - Sinhala - - - - info:lc/vocabulary/languages/snh - Sinhalese - snh - - - info:lc/vocabulary/languages/sit - Sino-Tibetan (Other) - sit - - Abor - - Adi - - - Miri - - - Miśing - - - - Achang - - A-ch‘ang - - - Atsang - - - - Angami - - - Ao - - Chungli - - - Hatigorria - - - Mongsen - - - Zungi - - - Zwingi - - - - Apatani - - Aka - - - Apa Tanang - - - Hruso - - - - Arakanese - - Maghi - - - Rakhaing - - - - Bai (China) - - Min-chia - - - Pai (China) - - - - Balti - - Baltistani - - - Bhotia of Baltistan - - - Sbalti - - - - Bantawa - - Bontawa - - - Kirāta Rāī - - - - Baram - - - Belhariya - - Athpagari - - - Athpahariya - - - Athpare (Belhariya) - - - Athpariya (Belhariya) - - - Belhare - - - Belhāreor - - - - Bodo - - Bara (India and Nepal) - - - Boro (India and Nepal) - - - Kachari, Plains - - - Mech - - - Plains Kachari - - - - Chamling - - Camling - - - - Chang - - Mojung - - - - Chepang - - - Chinbon - - - Chino - - Jino - - - - Chothe Naga - - Chawte - - - Chothe - - - Chowte - - - - Dafla - - Nisi - - - - Dänjong-kä - - Bhotic of Sikkim - - - Dé-jong ké - - - Sikkim Bhotia - - - Sikkimese - - - - Deori - - Chutia - - - Chutiya - - - Dari (India) - - - Deori Chutiya - - - Deuri - - - Dewri - - - Drori - - - - Dhimal - - - Digaro - - Taraon - - - Taying - - - - Dimasa - - Cachari - - - Hill Kachari - - - Kachari - - - - Dungan - - - Gallong - - - Garo - - - Gurung - - - Haka Chin - - Baungshè - - - Chin, Haka - - - Lai - - - - Jero - - - Kabui - - - Kaw - - Akha - - - Ekaw - - - - Khaling - - - Khiamniungan - - - Kok Borok - - Mrung - - - Tipura - - - Tripuri - - - - Konyak - - Kanyak - - - - Kuki - - - Kusunda - - - Ladakhi - - - Lahu - - Muhso - - - - Laizo (Burma) - - - Lepcha - - Rong - - - - Limbu - - - Lisu - - Yawyin - - - - Lopa - - - Magar - - - Miju - - - Mikir - - Karbi - - - - Mishmi - - - Moklum - - - Monpa - - - Mün Chin - - Chinbok - - - - Naga languages - - - Naxi - - Moso - - - - Nocte - - Borduaria - - - Mohongia - - - Paniduaria - - - - Padam - - - Paite - - - Pānkhū - - Paang (Pānkhū) - - - Pāṃkhoẏā - - - Pang Khua - - - Pang (Pānkhū) - - - Pangkhu - - - Pangkhua - - - Pankho - - - Panko - - - Pankua - - - - Rabha - - - Rawang - - - Rongmei - - - Sampang - - Sāmpāṅ Rāī - - - Sampang Rai - - - Sampange Rai - - - Sangpang Gîn - - - Sangpang Gun - - - Sangpang Kha - - - Sangpang - - - - Singpho - - - Sunwar - - - Tamang - - Murmi - - - - Tamu - - - Tangkhul - - Thankhul - - - - Tangsa - - Tengsa - - - - Tangut - - Hsi-hsia - - - Si-hia - - - Xixia - - - - Tenyidie - - - Thādo - - - Thakali - - - Thami - - - Thulung - - - Tiddim Chin - - Chin, Tiddim - - - Kamhau - - - Sokte - - - - Tshangla - - Canglo Monba - - - Cangluo Menba - - - Cangluo Monba - - - Central Monpa - - - Dirang - - - Dungsam - - - Memba - - - Menba (Tshangla) - - - Monba - - - Monpa (Tshangla) - - - Motuo - - - Motuo Menba - - - Sangla - - - Sarchapkkha - - - Schachop - - - Shachobiikha - - - Shachopkha - - - Sharchagpakha - - - Sharchhop-kha - - - Sharchopkha - - - Tashigang - - - Tsangla - - - Tsangla Monba - - - Tsanglo (Tshangla) - - - Tshalingpa (Tshangla) - - - - Vaiphei - - Bhaipei - - - Veiphei - - - - Wambule - - - Wayu - - Hayu - - - Vayu - - - Wayo - - - - Yao (Southeast Asia) - - Mien - - - - Yi - - Lolo (China) - - - Nosu - - - - Zang Zung - - Zhang-Zhung - - - - - info:lc/vocabulary/languages/sio - Siouan (Other) - sio - - Biloxi - - - Chiwere - - - Crow - - - Dhegiha - - Cegiha - - - - Hidatsa - - Grosventres (Hidatsa) - - - - Mandan - - - Ofo - - Ofogoula - - - - Omaha - - - Oto - - Watoto - - - - Tutelo - - - Winnebago - - Hocak - - - - Woccon - - - - info:lc/vocabulary/languages/sms - Skolt Sami - sms - - Lapp, Russian - - - Russian Lapp - - - Sami, Skolt - - - - info:lc/vocabulary/languages/den - Slavey - den - - Dené (Slavey) - - - Dené Tha - - - Ethchaottine - - - Mackenzian - - - North Slavey - - - Slave - - - Slavi - - - South Slavey - - - Kawchottine - - Hare - - - Peaux-de-Lièvre - - - - - info:lc/vocabulary/languages/sla - Slavic (Other) - sla - - Belarusian, Old (to 1700) - - Old Belarusian - - - - Čakavian - - - Carpatho-Rusyn - - Rusyn - - - - Czech, Old (to 1500) - - Old Czech - - - - Polabian - - - Russian, Old (to 1300) - - East Slavic - - - Old East Slavic - - - Old Russian - - - - Ukrainian, Old (ca. 1300-1700) - - Old Ukrainian - - - - - info:lc/vocabulary/languages/slo - Slovak - slo - - - info:lc/vocabulary/languages/slv - Slovenian - slv - - Windic (Slovenian) - - - - info:lc/vocabulary/languages/sog - Sogdian - sog - - - info:lc/vocabulary/languages/som - Somali - som - - - info:lc/vocabulary/languages/son - Songhai - son - - Dendi - - Dandawa - - - - Zarma - - Djerma - - - Dyerma - - - Zerma - - - - - info:lc/vocabulary/languages/snk - Soninke - snk - - Sarakole - - - - info:lc/vocabulary/languages/wen - Sorbian (Other) - wen - - Wendic (Other) - - - - info:lc/vocabulary/languages/sot - Sotho - sot - - Sesuto - - - Southern Sotho - - - Suto - - - - info:lc/vocabulary/languages/sso - Sotho - sso - - - info:lc/vocabulary/languages/sai - South American Indian (Other) - sai - - Achagua - - - Achuar - - Achuale - - - Achuara Jivaro - - - Jivaro, Achuara - - - - Aguaruna - - - Alacaluf - - Kawesqar - - - - Amahuaca - - Sayaco - - - - Amuesha - - Lorenzo - - - - Andoque - - - Apalai - - - Apinagé - - Apinajé - - - Apinayé - - - - Arabela - - Chiripuno - - - - Araona - - - Arecuna - - - Arekena - - Guarequena - - - Uarequena - - - Warekena - - - - Bakairi - - Bacairi - - - - Baniwa - - - Barasana del Norte - - Bara (Colombia) - - - Northern Barasano - - - - Barasana del Sur - - Bara (Colombia) - - - Southern Barasano - - - - Bora - - Boro (South America) - - - - Bororo (Brazil) - - - Cacua - - Macú de cubeo - - - Macú de desano - - - Macú de guanano - - - - Caduveo - - Kadiweu - - - - Caingua - - Cayua - - - Kaingua - - - Kaiwa (Brazil) - - - - Callahuaya - - Callawalla - - - Callawaya - - - Kallawaya - - - Qollahuaya - - - - Campa - - Ande - - - Asheninca - - - - Camsa - - Coche - - - Kamentzá - - - Kamsa - - - Sebondoy - - - Sibondoy - - - - Canamari (Tucanoan) - - Kanamari (Tucanoan) - - - - Cañari - - - Candoshi - - Kandoshi - - - Morato - - - Murato - - - Shapra - - - - Canella - - Kanela - - - - Capanahua - - - Caquinte - - - Caraja - - Karaja - - - - Carapana (Tucanoan) - - Karapana (Tucanoan) - - - Möchda (Tucanoan) - - - - Cashibo - - Comabo - - - - Cashinawa - - Kashinawa - - - Sheminawa - - - - Catio - - Embena, Northern - - - Epera, Northern - - - Katio - - - Northern Epera - - - - Cauqui - - Jacaru - - - Jaqaru - - - - Cavineño - - - Cayapa - - - Cayapo - - Kayapo - - - - Chacobo - - - Chamacoco - - - Chamí - - Embera Chamí - - - - Chamicuro - - - Chana (Uruguay) - - Čaná - - - Layuna - - - Tšaná - - - Tsaná-Bequá - - - Tschaná - - - Yaro - - - - Chayahuita - - Chawi - - - - Chimane - - Nawazi-Moñtji - - - Tsimane - - - - Chipaya - - Puquina (Chipaya) - - - - Chiquito - - - Cholon - - - Chontaquiro - - Chuntaquiro - - - Piro (Arawakan) - - - Simirenchi - - - - Choroti - - Yofuaha - - - - Chulupí - - Ashluslay - - - Nivacle - - - - Cocama - - Kokama - - - Ucayale - - - - Cofán - - A'i - - - Kofán - - - - Colorado - - Tsacela - - - Yumba - - - - Coreguaje - - Caqueta - - - - Cuaiquer - - Coaiker - - - Koaiker - - - - Cubeo - - - Cuiba - - Cuiva - - - - Culina - - - Cumana - - - Cuna - - Kuna - - - - Damana - - Arosario - - - Guamaca - - - Malayo - - - Maracasero - - - Sanja - - - Wiwa - - - - Desana - - Wira - - - - Emerillon - - Mereo - - - Teco (Tupi) - - - - Epena Saija - - Saija - - - Saixa - - - - Ese Ejja - - Chama (Tacanan) - - - Guacanahua - - - Guarayo (Tacanan) - - - Huarayo (Tacanan) - - - Tiatinagua - - - - Fulnio - - Carnijo - - - Iate - - - Yahthe - - - Yate (Brazil) - - - - Gavião (Pará, Brazil) - - - Goajiro - - Guajira - - - Wayunaiki - - - Wayuu - - - - Guahibo - - Wa-jibi - - - - Guanano - - Anano - - - Kotiria - - - Uanana - - - Wanana - - - - Guarayo - - - Guayabero - - Jiw - - - - Guayaki - - Ache - - - Guaiaqui - - - Guayaki-Ache - - - Guoyagui - - - - Hixkaryana - - - Huambisa - - Ssimaku - - - Wambisa - - - - Huao - - Waorani - - - - Ica - - Arhuaco - - - Aruaco - - - Bintukua - - - Ika (Chibchan) - - - Ike - - - - Ipurina - - Apurina - - - Hypurina - - - Jupurina - - - Kangütü - - - Kankiti - - - - Iquito - - - Itonama - - Machoto - - - - Jaminaua - - Nishinahua - - - Yaminahua - - - - Jaruára - - Jarawara - - - - Jupda - - Hupde Maku - - - Macú de tucano - - - - Kagaba - - Cagaba - - - - Kaingang - - Caingang - - - Taven - - - - Kariri - - Cariri - - - Kiriri - - - - Karitiana - - Caritiana - - - - Lengua - - - Lule - - - Maca - - Maka (Paraguay) - - - - Machiguenga - - - Macuna - - Buhágana - - - - Macusi - - Makushi - - - - Mamaindê - - Tamainde - - - - Masacali - - Machacali - - - Mashakali - - - Maxakali - - - - Mascoi - - Emok - - - Machicui - - - Toba-Emok - - - - Mashco - - Amarakaeri - - - Harakmbet - - - - Mataco - - - Maue - - Andira - - - Arapium - - - Maragua - - - Satere - - - - Mayoruna - - Matses - - - - Moguex - - Cuambia - - - Guambiano - - - - Mojo - - Ignaciano - - - Moxo - - - - Moro (South America) - - Ayoré - - - Ayoweo - - - - Moseten - - - Motilon - - Bari (Venezuela) - - - Yupe - - - - Muinane - - - Munduruku - - - Münkü - - - Murui - - Huitoto, Murui - - - - Nambicuara - - Nhambicuara - - - - Nomatsiguenga - - Pangoa - - - - Ocaina - - - Orejón - - Coto (Tucanoan) - - - Mai Huna - - - Payagua - - - - Paez - - - Palicur - - - Pamoa - - Juna - - - Oa - - - Tatutapuyo - - - - Panare - - - Panobo - - - Paraujano - - Añún - - - - Paressi - - Ariti - - - - Patamona - - Paramuni - - - - Pemón - - - Piapoco - - - Piaroa - - - Pilaga - - - Piratapuyo - - - Puinave - - - Puquina - - - Purupuru - - Paumari - - - - Resigero - - - Rikbaktsa - - Aripaktsa - - - Canoeiro - - - - Saliva - - Saliba (Colombia and Venezuela) - - - - Sanapaná - - Lanapsua - - - Quiativis - - - Quilyacmoc - - - Saapa - - - Sanam - - - - Secoya - - - Sharanahua - - Chandinahua - - - Marinahua - - - - Shipibo-Conibo - - Conibo - - - Sipibo - - - - Shuar - - Jibaro, Shuar - - - Jivaro, Shuar - - - Xivaro, Shuar - - - - Sicuane - - Sikuani - - - - Sioni - - Siona - - - - Siriano - - Chiranga - - - - Tacana (Bolivia) - - - Tanimuca-Retuama - - Letuana - - - Retuara - - - Ufaina - - - Yahuna - - - - Tapirapé - - - Tariana - - - Tenetehara - - Asurini - - - Guajajara - - - Tembe - - - - Tenharim - - - Toba (Indian) - - - Trio - - Tiriyo - - - - Tucano - - Dagsexe - - - Dase - - - Tukano - - - - Tucuna - - Ticuna - - - - Tunebo - - Pedrazá - - - Tame - - - - Tuyuca - - Dochkafuara - - - Tejuka - - - - Urarina - - Itucale - - - Shimacu - - - Simacu - - - - Uru - - Puquina (Uru) - - - - Urubu - - - Vilela - - - Waiwai - - Uaiuai - - - - Warao - - Guarauno - - - Warrau - - - - Waunana - - Chanco - - - Chocama - - - Noanama - - - - Wayampi - - Guayapi - - - Oiampi - - - Waiapi - - - Wayapi - - - - Witoto - - Huitoto - - - - Xavante - - Acuan-Shavante - - - Akwẽ-Shavante - - - Chavante Acuan - - - Oti - - - Shavante Akwe - - - - Yagua - - Yegua - - - - Yahgan - - Jagane - - - - Yanomamo - - - Yaruro - - Hapotein - - - Llaruro - - - Pumé - - - Yuapin - - - - Yecuana - - Maquiritare - - - - Yucuna - - Matapi - - - - Yunca - - Chimu - - - Mochica - - - - Yupa - - - Yuruti - - - Zoró - - - - info:lc/vocabulary/languages/sma - Southern Sami - sma - - Sami, Southern - - - - info:lc/vocabulary/languages/spa - Spanish - spa - - Castilian - - - Chicano - - - Cheso - - - - info:lc/vocabulary/languages/srn - Sranan - srn - - Taki-Taki - - - - info:lc/vocabulary/languages/suk - Sukuma - suk - - Gwe (Tanzania) - - - Kesukuma - - - Kisukuma - - - Suku (Tanzania) - - - - info:lc/vocabulary/languages/sux - Sumerian - sux - - - info:lc/vocabulary/languages/sun - Sundanese - sun - - - info:lc/vocabulary/languages/sus - Susu - sus - - Soso - - - - info:lc/vocabulary/languages/swa - Swahili - swa - - Kae - - - Kingwana - - - - info:lc/vocabulary/languages/ssw - Swazi - ssw - - Siswati - - - - info:lc/vocabulary/languages/swz - Swazi - swz - - - info:lc/vocabulary/languages/swe - Swedish - swe - - - info:lc/vocabulary/languages/gsw - Swiss German - gsw - - German, Swiss - - - - info:lc/vocabulary/languages/syc - Syriac - syc - - Classifical Syriac - - - - info:lc/vocabulary/languages/syr - Syriac, Modern - syr - - Neo-Syriac - - - - info:lc/vocabulary/languages/tgl - Tagalog - tgl - - Filipino (Tagalog) - - - Pilipino - - - - info:lc/vocabulary/languages/tag - Tagalog - tag - - - info:lc/vocabulary/languages/tah - Tahitian - tah - - - info:lc/vocabulary/languages/tai - Tai (Other) - tai - - Ahom - - - Be - - Ongbe - - - - Black Tai - - Tai, Black - - - Tai Dam - - - Tai Noir - - - - Bouyei - - Buyi (China and Vietnam) - - - Dioi (China and Vietnam) - - - Giáy - - - Nhang - - - Puyi - - - Yay - - - - Cao Lan - - - Dong (China) - - Gam (China) - - - Kam (China) - - - Tong (China) - - - T‘ung - - - - Khün - - Hkun - - - Tai Khün - - - - - - Lue - - - Pai-i - - - Tai Lü - - - - Lungming - - - Northern Thai - - Kammyang - - - Lanna Thai - - - Lao, Western - - - Myang - - - Phayap - - - Thai, Northern - - - Western Lao - - - Yuan - - - - Southern Thai - - Pak Thai - - - Thai, Southern - - - - Tai Nüa - - Dai Na - - - Dehong Dai - - - Shan, Yunnanese - - - Tay Nüa - - - Te-hung Tai - - - Yunnanese Shan - - - - Tay-Nung - - - Tho - - - White Tai - - Tai, White - - - - Ya - - Tai Chung - - - Tai Ya - - - - - info:lc/vocabulary/languages/tgk - Tajik - tgk - - Tadjik - - - Tadzhik - - - - info:lc/vocabulary/languages/taj - Tajik - taj - - - info:lc/vocabulary/languages/tmh - Tamashek - tmh - - Amazigh - - - Kidal - - - Kidal Tamasheq - - - Tăhăggart - - - Tahaggart Tamahaq - - - Tahoua - - - Tahoua Tamajeq - - - Tajag - - - Tamachek - - - Tamahaq - - - Tamajaq - - - Tamajeq - - - Tamashekin - - - Tamasheq - - - Tamashiqt - - - Tawallammat Tamajaq - - - Tawarek - - - Tayart Tamajeq - - - Temajaq - - - Tewellemet - - - Timbuktu - - - Tomacheck - - - Tomachek - - - Touareg - - - Touarègue - - - Tourage - - - Toureg - - - Tuareg - - - - info:lc/vocabulary/languages/tam - Tamil - tam - - - info:lc/vocabulary/languages/tat - Tatar - tat - - - info:lc/vocabulary/languages/tar - Tatar - tar - - - info:lc/vocabulary/languages/tel - Telugu - tel - - Andhra - - - Gentoo - - - Telegu - - - - info:lc/vocabulary/languages/tem - Temne - tem - - Timne - - - - info:lc/vocabulary/languages/ter - Terena - ter - - - info:lc/vocabulary/languages/tet - Tetum - tet - - Belu - - - - info:lc/vocabulary/languages/tha - Thai - tha - - Siamese - - - - info:lc/vocabulary/languages/tib - Tibetan - tib - - Bhotanta - - - Helambu Sherpa - - Hyolmo - - - Yohlmo - - - - Kagate - - - Khams Tibetan - - Kam - - - Kang (Tibetan) - - - Kham (China) - - - Khamba (Tibetan) - - - Khampa - - - Khams - - - Khams Bhotia - - - Khams-Yal - - - - Sherpa - - Sharpa - - - - - info:lc/vocabulary/languages/tig - Tigré - tig - - - info:lc/vocabulary/languages/tir - Tigrinya - tir - - Tigriña - - - Tña - - - - info:lc/vocabulary/languages/tiv - Tiv - tiv - - - info:lc/vocabulary/languages/tli - Tlingit - tli - - Koluschan - - - Tongass - - - - info:lc/vocabulary/languages/tpi - Tok Pisin - tpi - - Neo-Melanesian - - - Pisin - - - - info:lc/vocabulary/languages/tkl - Tokelauan - tkl - - - info:lc/vocabulary/languages/tog - Tonga (Nyasa) - tog - - - info:lc/vocabulary/languages/ton - Tongan - ton - - Tonga (Tonga Islands) - - - - info:lc/vocabulary/languages/tru - Truk - tru - - - info:lc/vocabulary/languages/tsi - Tsimshian - tsi - - Zimshīan - - - - info:lc/vocabulary/languages/tso - Tsonga - tso - - Changana - - - Gwamba - - - Shangaan - - - Thonga - - - Tonga (Tsonga) - - - Xitsonga - - - - info:lc/vocabulary/languages/tsn - Tswana - tsn - - Bechuana - - - Chuana - - - Coana - - - Cuana - - - Cwana - - - Sechuana - - - Setswana - - - - info:lc/vocabulary/languages/tsw - Tswana - tsw - - - info:lc/vocabulary/languages/tum - Tumbuka - tum - - Tamboka - - - - info:lc/vocabulary/languages/tup - Tupi languages - tup - - Parintintin - - - Tupi - - Ñeengatú - - - - - info:lc/vocabulary/languages/tur - Turkish - tur - - - info:lc/vocabulary/languages/ota - Turkish, Ottoman - ota - - Osmanli - - - Ottoman Turkish - - - - info:lc/vocabulary/languages/tuk - Turkmen - tuk - - Turkoman - - - - info:lc/vocabulary/languages/tvl - Tuvaluan - tvl - - Ellicean - - - - info:lc/vocabulary/languages/tyv - Tuvinian - tyv - - Soyot - - - Tannu-Tuva - - - Tuba - - - Uriankhai - - - - info:lc/vocabulary/languages/twi - Twi - twi - - Akuapem - - - Ashanti - - - Chwee - - - Odschi - - - Tshi - - - - info:lc/vocabulary/languages/udm - Udmurt - udm - - Votiak - - - Votyak - - - - info:lc/vocabulary/languages/uga - Ugaritic - uga - - - info:lc/vocabulary/languages/uig - Uighur - uig - - Eastern Turki - - - Kashgar-Yarkend - - - Turki, Eastern - - - Uigur - - - Uyghur - - - Wighor - - - Yarkend - - - - info:lc/vocabulary/languages/ukr - Ukrainian - ukr - - - info:lc/vocabulary/languages/umb - Umbundu - umb - - Benguela - - - Mbundu (Benguela Province, Angola) - - - Ovimbundu - - - Quimbundo (Benguela Province, Angola) - - - South Mbundu - - - - info:lc/vocabulary/languages/und - Undetermined - und - - - info:lc/vocabulary/languages/hsb - Upper Sorbian - hsb - - High Sorbian - - - Sorbian, Upper - - - - info:lc/vocabulary/languages/urd - Urdu - urd - - Bihari (Urdu) - - - Gujri (Urdu) - - - Gurjari - - - Islami - - - Moorish (India) - - - Undri - - - Urudu - - - Dakhini - - Dakani - - - Dakhani - - - Dakhini Hindi - - - Dakhini Hindustani - - - Dakhini Urdu - - - Dakhni - - - Dakini - - - Dakkani - - - Dakkhani - - - Deccan - - - Dehlavi - - - Gujari (Dakhini) - - - Hindavi - - - - - info:lc/vocabulary/languages/uzb - Uzbek - uzb - - - info:lc/vocabulary/languages/vai - Vai - vai - - Vei - - - - info:lc/vocabulary/languages/ven - Venda - ven - - Tshivenda - - - Wenda - - - - info:lc/vocabulary/languages/vie - Vietnamese - vie - - Annamese - - - - info:lc/vocabulary/languages/vol - Volapük - vol - - - info:lc/vocabulary/languages/vot - Votic - vot - - Vatjan - - - Vote - - - Votian - - - Votish - - - - info:lc/vocabulary/languages/wak - Wakashan languages - wak - - Bella Bella - - - Haisla - - - Heiltsuk - - Haeltzuk - - - - Kwakiutl - - - Nitinat - - - Nootka - - Aht - - - Noutka - - - Nutka - - - Nuuchahnulth - - - - - info:lc/vocabulary/languages/wln - Walloon - wln - - - info:lc/vocabulary/languages/war - Waray - war - - Leytean - - - Samar-Leyte - - - Samaron - - - - info:lc/vocabulary/languages/was - Washoe - was - - Washo - - - Washoan - - - - info:lc/vocabulary/languages/wel - Welsh - wel - - Cymric - - - - info:lc/vocabulary/languages/him - Western Pahari languages - him - - Himachali - - - Pahadi - - - Pahari, Western - - - Bhadrawahi - - Baderwali - - - Badrohi - - - Bahi - - - Bhadarwahi - - - Bhaderbhai Jamu - - - Bhaderwali Pahari - - - Bhadrava - - - Bhadravāhī - - - Bhadri - - - - Bhalesi - - - Bilaspuri - - Bilāsapurī - - - Bilaspuri Pahari - - - Kahalurī - - - Khalūrī - - - Kehloori - - - Kehloori Pahari - - - Kehluri - - - Pacchmi - - - - Chambeali - - Cameali - - - Chamaya - - - Chambiali - - - Chambiyali - - - Chamiyali - - - Chamiyali Pahari - - - Chamya - - - - Gaddi - - Bharmauri - - - Bharmauri Bhadi - - - Bharmouri - - - Brahmauri - - - Gaddhi - - - Gaddyalali - - - Gaddyali - - - Gadhi - - - Gadhiali - - - Gadi - - - Gadiali - - - Gadiyali - - - Pahari Bharmauri - - - Panchi - - - Panchi Brahmauri Rajput - - - - Jaunsari - - Gaunsari - - - Jansauri - - - Jaunsauri - - - Pahari (Jaunsari) - - - - Kullu Pahari - - Kauli - - - Kullui - - - Kulu - - - Kulu Boli - - - Kulu Pahari - - - Kuluhi - - - Kului - - - Kulvi - - - Kulwali - - - Pahari Kullu - - - Pahari (Kullu Pahari) - - - Phari Kulu - - - - Mandeali - - Himachali (Mandeali) - - - Mandi (Mandeali) - - - Mandiali - - - Pahari Mandiyali - - - - Sirmauri - - Himachali (Sirmauri) - - - Pahari (Sirmauri) - - - Sirmouri - - - Sirmuri - - - - - info:lc/vocabulary/languages/wal - Wolayta - wal - - Ometo - - - Uallamo - - - Walamo - - - - info:lc/vocabulary/languages/wol - Wolof - wol - - Jaloof - - - Jolof - - - Ouolof - - - Volof - - - Yolof - - - Lebou - - - - info:lc/vocabulary/languages/xho - Xhosa - xho - - isiXhosa - - - Kafir - - - Xosa - - - - info:lc/vocabulary/languages/sah - Yakut - sah - - Jakut - - - Sakha - - - - info:lc/vocabulary/languages/yao - Yao (Africa) - yao - - Adjaua - - - Ajawa - - - Ayo - - - Chi-yao - - - Ciyao - - - Djao - - - Hiao - - - Wayao - - - - info:lc/vocabulary/languages/yap - Yapese - yap - - - info:lc/vocabulary/languages/yid - Yiddish - yid - - German Hebrew - - - Jewish - - - Judeo-German - - - - info:lc/vocabulary/languages/yor - Yoruba - yor - - Aku - - - Eyo - - - Nago - - - Yariba - - - - info:lc/vocabulary/languages/ypk - Yupik languages - ypk - - Eskimo languages, Western - - - Western Eskimo languages - - - Central Yupik - - Eskimo, West Alaska - - - West Alaska Eskimo - - - - Cup´ig - - - Pacific Gulf Yupik - - Aleut (Eskimo) - - - Eskimo, South Alaska - - - Sugpiak Eskimo - - - Suk (Eskimo) - - - - Sirinek - - - Yuit - - Asiatic Eskimo - - - Eskimo, Asiatic - - - Saint Lawrence Island Yupik - - - Siberian Yupik - - - - - info:lc/vocabulary/languages/znd - Zande languages - znd - - Nzakara - - Sakara - - - - Zande - - Azande - - - - - info:lc/vocabulary/languages/zap - Zapotec - zap - - - info:lc/vocabulary/languages/zza - Zaza - zza - - Dimili - - - Dimli - - - Kirdki - - - Kirmanjki - - - Zazaki - - - - info:lc/vocabulary/languages/zen - Zenaga - zen - - Senhadja - - - - info:lc/vocabulary/languages/zha - Zhuang - zha - - Chuang - - - - info:lc/vocabulary/languages/zul - Zulu - zul - - - info:lc/vocabulary/languages/zun - Zuni - zun - - - diff --git a/form_elements/xml/relators.rdf b/form_elements/xml/relators.rdf deleted file mode 100644 index 66df3d04..00000000 --- a/form_elements/xml/relators.rdf +++ /dev/null @@ -1,4297 +0,0 @@ - - - - - MARC Code List for Relators - - <div class="relatorsAbout" title="About the Relator Codes:" datatype="rdf:XMLLiteral" property="rdfs:comment">Relator terms and their associated codes designate the relationship between a name and a bibliographic resource. The relator codes are three-character lowercase alphabetic strings that serve as identifiers. Either the term or the code may be used as controlled values.</div> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Actor - act - Use for a person or organization who - principally exhibits acting skills in a musical or - dramatic presentation or entertainment. - - stable - - - - - - - Adapter - adp - Use for a person or organization who 1) - reworks a musical composition, usually for a - different medium, or 2) rewrites novels or stories - for motion pictures or other audiovisual - medium. - - stable - - - - - - - Analyst - anl - Use for a person or organization that - reviews, examines and interprets data or information - in a specific area. - - stable - - - - - - Animator - anm - Use for a person or organization who draws - the two-dimensional figures, manipulates the three - dimensional objects and/or also programs the - computer to move objects and images for the purpose - of animated film processing. Animation cameras, - stands, celluloid screens, transparencies and inks - are some of the tools of the animator. - - stable - - - - - - - Annotator - ann - Use for a person who writes manuscript - annotations on a printed item. - - stable - - - - - - - Applicant - app - Use for a person or organization - responsible for the submission of an application or - who is named as eligible for the results of the - processing of the application (e.g., bestowing of - rights, reward, title, position). - - stable - - - - - - Architect - arc - Use for a person or organization who - designs structures or oversees their - construction. - - stable - - - - - - - Arranger - arr - Use for a person or organization who - transcribes a musical composition, usually for a - different medium from that of the original; in an - arrangement the musical substance remains - essentially unchanged. - - stable - - - - - - - Art copyist - acp - Use for a person (e.g., a painter or - sculptor) who makes copies of works of visual - art. - - stable - - - - - - Artist - art - Use for a person (e.g., a painter) or - organization who conceives, and perhaps also - implements, an original graphic design or work of - art, if specific codes (e.g., [egr], [etr]) are not - desired. For book illustrators, prefer Illustrator - [ill]. - - stable - Graphic technician - Relator term "Graphic technician" (coded [grt]) used before March 1988 only. - - - - - - - Artistic director - ard - Use for a person responsible for - controlling the development of the artistic style of - an entire production, including the choice of works - to be presented and selection of senior production - staff. - - stable - - - - - - Assignee - asg - Use for a person or organization to whom a - license for printing or publishing has been - transferred. - - stable - - - - - - Associated name - asn - Use for a person or organization - associated with or found in an item or collection, - which cannot be determined to be that of a Former - owner [fmo] or other designated relator indicative - of provenance. - - stable - - - - - - Attributed name - att - Use for an author, artist, etc., relating - him/her to a work for which there is or once was - substantial authority for designating that person as - author, creator, etc. of the work. - - stable - Supposed name - - - - - - Auctioneer - auc - Use for a person or organization in charge - of the estimation and public auctioning of goods, - particularly books, artistic works, - etc. - - stable - - - - - - Author - aut - Use for a person or organization chiefly - responsible for the intellectual or artistic content - of a work, usually printed text. This term may also - be used when more than one person or body bears such - responsibility. - - stable - Joint author - - - - - - - Author in quotations or text - extracts - aqt - Use for a person or organization whose - work is largely quoted or extracted in works to - which he or she did not contribute directly. Such - quotations are found particularly in exhibition - catalogs, collections of photographs, - etc. - - stable - - - - - - - Author of afterword, colophon, - etc. - aft - Use for a person or organization - responsible for an afterword, postface, colophon, - etc. but who is not the chief author of a - work. - - stable - - - - - - - Author of dialog - aud - Use for a person or organization - responsible for the dialog or spoken commentary for - a screenplay or sound recording. - - stable - - - - - - - Author of introduction, etc. - aui - Use for a person or organization - responsible for an introduction, preface, foreword, - or other critical introductory matter, but who is - not the chief author. - - stable - - - - - - - Author of screenplay, etc. - aus - Use for a person or organization - responsible for a motion picture screenplay, dialog, - spoken commentary, etc. - - stable - - - - - - - Bibliographic antecedent - ant - Use for a person or organization - responsible for a work upon which the work - represented by the catalog record is based. This may - be appropriate for adaptations, sequels, - continuations, indexes, etc. - - stable - - - - - - Binder - bnd - Use for a person or organization - responsible for the binding of printed or manuscript - materials. - - stable - - - - - - Binding designer - bdd - Use for a person or organization - responsible for the binding design of a book, - including the type of binding, the type of materials - used, and any decorative aspects of the binding. - - stable - Designer of binding - - - - - - Blurb writer - blw - Use for the named entity responsible for writing a commendation - or testimonial for a work, which appears on or within the publication - itself, frequently on the back or dust jacket of print publications or - on advertising material for all media. - - stable - - - - - - Book designer - bkd - Use for a person or organization - responsible for the entire graphic design of a book, - including arrangement of type and illustration, - choice of materials, and process used. - - stable - Designer of book - - - - - - Book producer - bkp - Use for a person or organization - responsible for the production of books and other - print media, if specific codes (e.g., [bkd], [egr], - [tyd], [prt]) are not desired. - - stable - Producer of book - - - - - - Bookjacket designer - bjd - Use for a person or organization - responsible for the design of flexible covers - designed for or published with a book, including the - type of materials used, and any decorative aspects - of the bookjacket. - - stable - Designer of bookjacket - - - - - - Bookplate designer - bpd - Use for a person or organization - responsible for the design of a book owner's - identification label that is most commonly pasted to - the inside front cover of a book. - - stable - Designer of bookplate - - - - - - Bookseller - bsl - Use for a person or organization who makes - books and other bibliographic materials available - for purchase. Interest in the materials is primarily - lucrative. - - stable - - - - - - Calligrapher - cll - Use for a person or organization who - writes in an artistic hand, usually as a copyist and - or engrosser. - - stable - - - - - - - Cartographer - ctg - Use for a person or organization - responsible for the creation of maps and other - cartographic materials. - - stable - - - - - - - Censor - cns - Use for a censor, bowdlerizer, expurgator, - etc., official or private. - - stable - Bowdlerizer - Expurgator - - - - - - Choreographer - chr - Use for a person or organization who - composes or arranges dances or other movements - (e.g., "master of swords") for a musical or dramatic - presentation or entertainment. - - stable - - - - - - - Cinematographer - cng - Use for a person or organization who is in - charge of the images captured for a motion picture - film. The cinematographer works under the - supervision of a director, and may also be referred - to as director of photography. Do not confuse with - videographer. - - stable - - - - - - - Client - cli - Use for a person or organization for whom - another person or organization is - acting. - - stable - - - - - - Collaborator - clb - Use for a person or organization that - takes a limited part in the elaboration of a work of - another person or organization that brings - complements (e.g., appendices, notes) to the - work. - - stable - - - - - - - Collector - col - Use for a person or organization who has - brought together material from various sources that - has been arranged, described, and cataloged as a - collection. A collector is neither the creator of - the material nor a person to whom manuscripts in the - collection may have been addressed. - - stable - - - - - - Collotyper - clt - Use for a person or organization - responsible for the production of photographic - prints from film or other colloid that has - ink-receptive and ink-repellent - surfaces. - - stable - - - - - - - Colorist - clr - Use for the named entity responsible for applying color to - drawings, prints, photographs, maps, moving images, etc. - - stable - - - - - - Commentator - cmm - Use for a person or organization who - provides interpretation, analysis, or a discussion - of the subject matter on a recording, motion - picture, or other audiovisual medium. - - stable - - - - - - - Commentator for written text - cwt - Use for a person or organization - responsible for the commentary or explanatory notes - about a text. For the writer of manuscript - annotations in a printed book, use Annotator - [ann]. - - stable - - - - - - - Compiler - com - Use for a person or organization who - produces a work or publication by selecting and - putting together material from the works of various - persons or bodies. - - stable - - - - - - - Complainant - cpl - Use for the party who applies to the - courts for redress, usually in an equity - proceeding. - - stable - - - - - - Complainant-appellant - cpt - Use for a complainant who takes an appeal - from one court or jurisdiction to another to reverse - the judgment, usually in an equity - proceeding. - - stable - - - - - - Complainant-appellee - cpe - Use for a complainant against whom an - appeal is taken from one court or jurisdiction to - another to reverse the judgment, usually in an - equity proceeding. - - stable - - - - - - Composer - cmp - Use for a person or organization who - creates a musical work, usually a piece of music in - manuscript or printed form. - - stable - - - - - - - Compositor - cmt - Use for a person or organization - responsible for the creation of metal slug, or molds - made of other materials, used to produce the text - and images in printed matter. - - stable - Typesetter - - - - - - Conceptor - ccp - Use for a person or organization - responsible for the original idea on which a work is - based, this includes the scientific author of an - audio-visual item and the conceptor of an - advertisement. - - stable - - - - - - - Conductor - cnd - Use for a person who directs a performing - group (orchestra, chorus, opera, etc.) in a musical - or dramatic presentation or - entertainment. - - stable - - - - - - - Conservator - con - Use for the named entity responsible for documenting, - preserving, or treating printed or manuscript material, works of art, - artifacts, or other media. - - stable - Preservationist - - - - - - Consultant - csl - Use for a person or organization relevant - to a resource, who is called upon for professional - advice or services in a specialized field of - knowledge or training. - - stable - - - - - - - Consultant to a project - csp - Use for a person or organization relevant - to a resource, who is engaged specifically to - provide an intellectual overview of a strategic or - operational task and by analysis, specification, or - instruction, to create or propose a cost-effective - course of action or solution. - - stable - - - - - - - Contestant - cos - Use for the party who opposes, resists, or - disputes, in a court of law, a claim, decision, - result, etc. - - stable - - - - - - Contestant-appellant - cot - Use for a contestant who takes an appeal - from one court of law or jurisdiction to another to - reverse the judgment. - - stable - - - - - - Contestant-appellee - coe - Use for a contestant against whom an - appeal is taken from one court of law or - jurisdiction to another to reverse the - judgment. - - stable - - - - - - Contestee - cts - Use for the party defending a claim, - decision, result, etc. being opposed, resisted, or - disputed in a court of law. - - stable - - - - - - Contestee-appellant - ctt - Use for a contestee who takes an appeal - from one court or jurisdiction to another to reverse - the judgment. - - stable - - - - - - Contestee-appellee - cte - Use for a contestee against whom an appeal - is taken from one court or jurisdiction to another - to reverse the judgment. - - stable - - - - - - Contractor - ctr - Use for a person or organization relevant - to a resource, who enters into a contract with - another person or organization to perform a specific - task. - - stable - - - - - - - Contributor - ctb - Use for a person or organization one whose - work has been contributed to a larger work, such as - an anthology, serial publication, or other - compilation of individual works. Do not use if the - sole function in relation to a work is as author, - editor, compiler or translator. - - stable - - - - - - - Copyright claimant - cpc - Use for a person or organization listed as - a copyright owner at the time of registration. - Copyright can be granted or later transferred to - another person or organization, at which time the - claimant becomes the copyright holder. - - stable - - - - - - Copyright holder - cph - Use for a person or organization to whom - copy and legal rights have been granted or - transferred for the intellectual content of a work. - The copyright holder, although not necessarily the - creator of the work, usually has the exclusive right - to benefit financially from the sale and use of the - work to which the associated copyright protection - applies. - - stable - - - - - - Corrector - crr - Use for a person or organization who is a - corrector of manuscripts, such as the scriptorium - official who corrected the work of a scribe. For - printed matter, use Proofreader [pfr]. - - stable - - - - - - Correspondent - crp - Use for a person or organization who was - either the writer or recipient of a letter or other - communication. - - stable - - - - - - - Costume designer - cst - Use for a person or organization who - designs or makes costumes, fixes hair, etc., for a - musical or dramatic presentation or - entertainment. - - stable - - - - - - - Cover designer - cov - Use for a person or organization - responsible for the graphic design of a book cover, - album cover, slipcase, box, container, etc. For a - person or organization responsible for the graphic - design of an entire book, use Book designer; for - book jackets, use Bookjacket designer. - - stable - Designer of cover - - - - - - Creator - cre - Use for a person or organization - responsible for the intellectual or artistic content - of a work. - - stable - - - - - - - - Curator of an exhibition - cur - Use for a person or organization - responsible for conceiving and organizing an - exhibition. - - stable - - - - - - - Dancer - dnc - Use for a person or organization who - principally exhibits dancing skills in a musical or - dramatic presentation or entertainment. - - stable - - - - - - - Data contributor - dtc - Use for a person or organization that - submits data for inclusion in a database or other - collection of data. - - stable - - - - - - Data manager - dtm - Use for a person or organization - responsible for managing databases or other data - sources. - - stable - - - - - - Dedicatee - dte - Use for a person or organization to whom a - book, manuscript, etc., is dedicated (not the - recipient of a gift). - - stable - - - - - - Dedicator - dto - Use for the author of a dedication, which - may be a formal statement or in epistolary or verse - form. - - stable - - - - - - Defendant - dfd - Use for the party defending or denying - allegations made in a suit and against whom relief - or recovery is sought in the courts, usually in a - legal action. - - stable - - - - - - Defendant-appellant - dft - Use for a defendant who takes an appeal - from one court or jurisdiction to another to reverse - the judgment, usually in a legal - action. - - stable - - - - - - Defendant-appellee - dfe - Use for a defendant against whom an appeal - is taken from one court or jurisdiction to another - to reverse the judgment, usually in a legal - action. - - stable - - - - - - Degree grantor - dgg - Use for the organization granting a degree - for which the thesis or dissertation described was - presented. - - stable - - - - - - Delineator - dln - Use for a person or organization executing - technical drawings from others' - designs. - - stable - - - - - - - Depicted - dpc - Use for an entity depicted or portrayed in - a work, particularly in a work of art. - - stable - - - - - - - Depositor - dpt - Use for a person or organization placing - material in the physical custody of a library or - repository without transferring the legal - title. - - stable - - - - - - Designer - dsr - Use for a person or organization - responsible for the design if more specific codes - (e.g., [bkd], [tyd]) are not desired. - - stable - - - - - - - Director - drt - Use for a person or organization who is - responsible for the general management of a work or - who supervises the production of a performance for - stage, screen, or sound recording. - - stable - - - - - - - Dissertant - dis - Use for a person who presents a thesis for - a university or higher-level educational - degree. - - stable - - - - - - - Distribution place - dbp - Use for the name of a place from which a resource, - e.g., a serial, is distributed. - - stable - - - - - - Distributor - dst - Use for a person or organization that has - exclusive or shared marketing rights for an - item. - - stable - - - - - - - Donor - dnr - Use for a person or organization who is - the donor of a book, manuscript, etc., to its - present owner. Donors to previous owners are - designated as Former owner[fmo] or Inscriber - [ins]. - - stable - - - - - - Draftsman - drm - Use for a person or organization who - prepares artistic or technical drawings. - - stable - Technical draftsman - - - - - - - Dubious author - dub - Use for a person or organization to which - authorship has been dubiously or incorrectly - ascribed. - - stable - - - - - - Editor - edt - Use for a person or organization who - prepares for publication a work not primarily - his/her own, such as by elucidating text, adding - introductory or other critical matter, or - technically directing an editorial - staff. - - stable - - - - - - - Electrician - elg - Use for a person responsible for setting - up a lighting rig and focusing the lights for a - production, and running the lighting at a - performance. - - stable - Chief electrician - House electrician - Master electrician - - - - - - Electrotyper - elt - Use for a person or organization who - creates a duplicate printing surface by pressure - molding and electrodepositing of metal that is then - backed up with lead for printing. - - stable - - - - - - Engineer - eng - Use for a person or organization that is - responsible for technical planning and design, - particularly with construction. - - stable - - - - - - - Engraver - egr - Use for a person or organization who cuts - letters, figures, etc. on a surface, such as a - wooden or metal plate, for printing. - - stable - - - - - - - Etcher - etr - Use for a person or organization who - produces text or images for printing by subjecting - metal, glass, or some other surface to acid or the - corrosive action of some other - substance. - - stable - - - - - - - Event place - evp - Use for the name of the place where an event such - as a conference or a concert took place. - - stable - - - - - - Expert - exp - Use for a person or organization in charge - of the description and appraisal of the value of - goods, particularly rare items, works of art, etc. - - stable - Appraiser - - - - - - Facsimilist - fac - Use for a person or organization that - executed the facsimile. - - stable - Copier - - - - - - - Field director - fld - Use for a person or organization that - manages or supervises the work done to collect raw - data or do research in an actual setting or - environment (typically applies to the natural and - social sciences). - - stable - - - - - - Film editor - flm - Use for a person or organization who is an - editor of a motion picture film. This term is used - regardless of the medium upon which the motion - picture is produced or manufactured (e.g., acetate - film, video tape). - - stable - Motion picture editor - - - - - - - First party - fpy - Use for a person or organization who is - identified as the only party or the party of the - first part. In the case of transfer of right, this - is the assignor, transferor, licensor, grantor, etc. - Multiple parties can be named jointly as the first - party - - stable - - - - - - Forger - frg - Use for a person or organization who makes - or imitates something of value or importance, - especially with the intent to defraud. - - stable - Copier - Counterfeiter - - - - - - - Former owner - fmo - Use for a person or organization who owned - an item at any time in the past. Includes those to - whom the material was once presented. A person or - organization giving the item to the present owner is - designated as Donor [dnr]. - - stable - - - - - - Funder - fnd - Use for a person or organization that - furnished financial support for the production of - the work. - - stable - - - - - - Geographic information - specialist - gis - Use for a person responsible for - geographic information system (GIS) development and - integration with global positioning system data.. - - - stable - Geospatial information specialist - - - - - - Honoree - hnr - Use for a person or organization in memory - or honor of whom a book, manuscript, etc. is - donated. - - stable - Memorial - - - - - - Host - hst - Use for a person who is invited or - regularly leads a program (often broadcast) that - includes other guests, performers, etc. (e.g., talk - show host). - - stable - - - - - - - Illuminator - ilu - Use for a person or organization - responsible for the decoration of a work (especially - manuscript material) with precious metals or color, - usually with elaborate designs and - motifs. - - stable - - - - - - - Illustrator - ill - Use for a person or organization who - conceives, and perhaps also implements, a design or - illustration, usually to accompany a written - text. - - stable - - - - - - - Inscriber - ins - Use for a person who signs a presentation - statement. - - stable - - - - - - Instrumentalist - itr - Use for a person or organization who - principally plays an instrument in a musical or - dramatic presentation or entertainment. - - stable - - - - - - - Interviewee - ive - Use for a person or organization who is - interviewed at a consultation or meeting, usually by - a reporter, pollster, or some other information - gathering agent. - - stable - - - - - - - Interviewer - ivr - Use for a person or organization who acts - as a reporter, pollster, or other information - gathering agent in a consultation or meeting - involving one or more individuals. - - stable - - - - - - - Inventor - inv - Use for a person or organization who first - produces a particular useful item, or develops a new - process for obtaining a known item or - result. - - stable - - - - - - - Laboratory - lbr - Use for an institution that provides - scientific analyses of material - samples. - - stable - - - - - - Laboratory director - ldr - Use for a person or organization that - manages or supervises work done in a controlled - setting or environment. - - stable - Lab director - - - - - - Lead - led - Use to indicate that a person or - organization takes primary responsibility for a - particular activity or endeavor. Use with another - relator term or code to show the greater importance - this person or organization has regarding that - particular role. If more than one relator is - assigned to a heading, use the Lead relator only if - it applies to all the relators. - - stable - - - - - - Landscape architect - lsa - Use for a person or organization whose - work involves coordinating the arrangement of - existing and proposed land features and - structures. - - stable - - - - - - - Lender - len - Use for a person or organization - permitting the temporary use of a book, manuscript, - etc., such as for photocopying or - microfilming. - - stable - - - - - - Libelant - lil - Use for the party who files a libel in an - ecclesiastical or admiralty case. - - stable - - - - - - Libelant-appellant - lit - Use for a libelant who takes an appeal - from one ecclesiastical court or admiralty to - another to reverse the judgment. - - stable - - - - - - Libelant-appellee - lie - Use for a libelant against whom an appeal - is taken from one ecclesiastical court or admiralty - to another to reverse the judgment. - - stable - - - - - - Libelee - lel - Use for a party against whom a libel has - been filed in an ecclesiastical court or - admiralty. - - stable - - - - - - Libelee-appellant - let - Use for a libelee who takes an appeal from - one ecclesiastical court or admiralty to another to - reverse the judgment. - - stable - - - - - - Libelee-appellee - lee - Use for a libelee against whom an appeal - is taken from one ecclesiastical court or admiralty - to another to reverse the judgment. - - stable - - - - - - Librettist - lbt - Use for a person or organization who is a - writer of the text of an opera, oratorio, - etc. - - stable - - - - - - - Licensee - lse - Use for a person or organization who is an - original recipient of the right to print or - publish. - - stable - - - - - - Licensor - lso - Use for person or organization who is a - signer of the license, imprimatur, etc. - - stable - Imprimatur - - - - - - Lighting designer - lgd - Use for a person or organization who - designs the lighting scheme for a theatrical - presentation, entertainment, motion picture, etc. - - - stable - - - - - - - Lithographer - ltg - Use for a person or organization who - prepares the stone or plate for lithographic - printing, including a graphic artist creating a - design directly on the surface from which printing - will be done. - - stable - - - - - - - Lyricist - lyr - Use for a person or organization who is - the a writer of the text of a song. - - stable - - - - - - - Manufacturer - mfr - Use for a person or organization that - makes an artifactual work (an object made or - modified by one or more persons). Examples of - artifactual works include vases, cannons or pieces - of furniture. - - stable - - - - - - - Marbler - mrb - Use for the named entity responsible for marbling paper, cloth, - leather, etc. used in construction of a resource. - - stable - - - - - - Markup editor - mrk - Use for a person or organization - performing the coding of SGML, HTML, or XML markup - of metadata, text, etc. - - stable - - - - - - Metadata contact - mdc - Use for a person or organization primarily - responsible for compiling and maintaining the - original description of a metadata set (e.g., - geospatial metadata set). - - stable - - - - - - Metal-engraver - mte - Use for a person or organization - responsible for decorations, illustrations, letters, - etc. cut on a metal surface for printing or - decoration. - - stable - - - - - - - Moderator - mod - Use for a person who leads a program - (often broadcast) where topics are discussed, - usually with participation of experts in fields - related to the discussion. - - stable - - - - - - - Monitor - mon - Use for a person or organization that - supervises compliance with the contract and is - responsible for the report and controls its - distribution. Sometimes referred to as the grantee, - or controlling agency. - - stable - - - - - - Music copyist - mcp - Use for a person who transcribes or copies - musical notation. - - stable - - - - - - Musical director - msd - Use for a person responsible for basic - music decisions about a production, including - coordinating the work of the composer, the sound - editor, and sound mixers, selecting musicians, and - organizing and/or conducting sound for rehearsals - and performances. - - stable - - - - - - Musician - mus - Use for a person or organization who - performs music or contributes to the musical content - of a work when it is not possible or desirable to - identify the function more precisely. - - stable - - - - - - - Narrator - nrt - Use for a person who is a speaker relating - the particulars of an act, occurrence, or course of - events. - - stable - - - - - - - Opponent - opn - Use for a person or organization - responsible for opposing a thesis or - dissertation. - - stable - - - - - - Organizer of meeting - orm - Use for a person or organization - responsible for organizing a meeting for which an - item is the report or proceedings. - - stable - - - - - - - Originator - org - Use for a person or organization - performing the work, i.e., the name of a person or - organization associated with the intellectual - content of the work. This category does not include - the publisher or personal affiliation, or sponsor - except where it is also the corporate author. - Includes a person designated in the work as - investigator or principal investigator. - - stable - Principal investigator - - - - - - - Other - oth - Use for relator codes from other lists - which have no equivalent in the MARC list or for - terms which have not been assigned a - code. - - stable - - - - - - Owner - own - Use for a person or organization that - currently owns an item or collection. - - stable - - - - - - Papermaker - ppm - Use for a person or organization - responsible for the production of paper, usually - from wood, cloth, or other fibrous - material. - - stable - - - - - - Patent applicant - pta - Use for a person or organization that - applied for a patent. - - stable - - - - - - Patent holder - pth - Use for a person or organization that was - granted the patent referred to by the item. - - stable - Patentee - - - - - - Patron - pat - Use for a person or organization - responsible for commissioning a work. Usually a - patron means or influence to support the work of - artists, writers, etc. This includes those who - commission and pay for individual - works. - - stable - - - - - - Performer - prf - Use for a person or organization who - exhibits musical or acting skills in a musical or - dramatic presentation or entertainment, if specific - codes for those functions ([act], [dnc], [itr], - [voc], etc.) are not used. If specific codes are - used, [prf] is used for a person whose principal - skill is not known or specified. - - stable - - - - - - - Permitting agency - pma - Use for an authority (usually a government - agency) that issues permits under which work is - accomplished. - - stable - - - - - - Photographer - pht - Use for a person or organization - responsible for taking photographs, whether they are - used in their original form or as - reproductions. - - stable - - - - - - - Plaintiff - ptf - Use for the party who complains or sues in - court in a personal action, usually in a legal - proceeding. - - stable - - - - - - Plaintiff-appellant - ptt - Use for a plaintiff who takes an appeal - from one court or jurisdiction to another to reverse - the judgment, usually in a legal - proceeding. - - stable - - - - - - Plaintiff-appellee - pte - Use for a plaintiff against whom an appeal - is taken from one court or jurisdiction to another - to reverse the judgment, usually in a legal - proceeding. - - stable - - - - - - Platemaker - plt - Use for a person or organization - responsible for the production of plates, usually - for the production of printed images and/or - text. - - stable - - - - - - - Printer - prt - Use for a person or organization who - prints texts, whether from type or - plates. - - stable - - - - - - Printer of plates - pop - Use for a person or organization who - prints illustrations from plates. - - stable - Plates, Printer of - - - - - - Printmaker - prm - Use for a person or organization who makes - a relief, intaglio, or planographic printing - surface. - - stable - - - - - - - Process contact - prc - Use for a person or organization primarily - responsible for performing or initiating a process, - such as is done with the collection of metadata - sets. - - stable - - - - - - Producer - pro - Use for a person or organization - responsible for the making of a motion picture, - including business aspects, management of the - productions, and the commercial success of the - work. - - stable - - - - - - - Production manager - pmm - Use for a person responsible for all - technical and business matters in a - production. - - stable - - - - - - Production personnel - prd - Use for a person or organization - associated with the production (props, lighting, - special effects, etc.) of a musical or dramatic - presentation or entertainment. - - stable - - - - - - - Programmer - prg - Use for a person or organization - responsible for the creation and/or maintenance of - computer program design documents, source code, and - machine-executable digital files and supporting - documentation. - - stable - - - - - - - Project director - pdr - Use for a person or organization with - primary responsibility for all essential aspects of - a project, or that manages a very large project that - demands senior level responsibility, or that has - overall responsibility for managing projects, or - provides overall direction to a project manager. - - stable - - - - - - Proofreader - pfr - Use for a person who corrects printed - matter. For manuscripts, use Corrector - [crr]. - - stable - - - - - - Publication place - pup - Use for the name of the place where a resource is published. - - stable - - - - - - Publisher - pbl - Use for a person or organization that - makes printed matter, often text, but also printed - music, artwork, etc. available to the - public. - - stable - - - - - - - Publishing director - pbd - Use for a person or organization who - presides over the elaboration of a collective work - to ensure its coherence or continuity. This includes - editors-in-chief, literary editors, editors of - series, etc. - - stable - - - - - - Puppeteer - ppt - Use for a person or organization who - manipulates, controls, or directs puppets or - marionettes in a musical or dramatic presentation or - entertainment. - - stable - - - - - - - Recipient - rcp - Use for a person or organization to whom - correspondence is addressed. - - stable - - - - - - Recording engineer - rce - Use for a person or organization who - supervises the technical aspects of a sound or video - recording session. - - stable - - - - - - - Redactor - red - Use for a person or organization who - writes or develops the framework for an item without - being intellectually responsible for its - content. - - stable - - - - - - Renderer - ren - Use for a person or organization who - prepares drawings of architectural designs (i.e., - renderings) in accurate, representational - perspective to show what the project will look like - when completed. - - stable - - - - - - - Reporter - rpt - Use for a person or organization who - writes or presents reports of news or current events - on air or in print. - - stable - - - - - - - Repository - rps - Use for an agency that hosts data or - material culture objects and provides services to - promote long term, consistent and shared use of - those data or objects. - - stable - - - - - - Research team head - rth - Use for a person who directed or managed a - research project. - - stable - - - - - - - Research team member - rtm - Use for a person who participated in a - research project but whose role did not involve - direction or management of it. - - stable - - - - - - - Researcher - res - Use for a person or organization - responsible for performing research. - - stable - Performer of research - - - - - - - Respondent - rsp - Use for the party who makes an answer to - the courts pursuant to an application for redress, - usually in an equity proceeding. - - stable - - - - - - Respondent-appellant - rst - Use for a respondent who takes an appeal - from one court or jurisdiction to another to reverse - the judgment, usually in an equity - proceeding. - - stable - - - - - - Respondent-appellee - rse - Use for a respondent against whom an - appeal is taken from one court or jurisdiction to - another to reverse the judgment, usually in an - equity proceeding. - - stable - - - - - - Responsible party - rpy - Use for a person or organization legally - responsible for the content of the published - material. - - stable - - - - - - - Restager - rsg - Use for a person or organization , other - than the original choreographer or director, - responsible for restaging a choreographic or - dramatic work and who contributes minimal new - content. - - stable - - - - - - - Reviewer - rev - Use for a person or organization - responsible for the review of a book, motion - picture, performance, etc. - - stable - - - - - - - Rubricator - rbr - Use for a person or organization - responsible for parts of a work, often headings or - opening parts of a manuscript, that appear in a - distinctive color, usually red - - stable - - - - - - Scenarist - sce - Use for a person or organization who is - the author of a motion picture - screenplay. - - stable - - - - - - - Scientific advisor - sad - Use for a person or organization who - brings scientific, pedagogical, or historical - competence to the conception and realization on a - work, particularly in the case of audio-visual - items. - - stable - - - - - - - Scribe - scr - Use for a person who is an amanuensis and - for a writer of manuscripts proper. For a person who - makes pen-facsimiles, use Facsimilist - [fac]. - - stable - - - - - - - Sculptor - scl - Use for a person or organization who - models or carves figures that are three-dimensional - representations. - - stable - - - - - - - Second party - spy - Use for a person or organization who is - identified as the party of the second part. In the - case of transfer of right, this is the assignee, - transferee, licensee, grantee, etc. Multiple parties - can be named jointly as the second - party - - stable - - - - - - Secretary - sec - Use for a person or organization who is a - recorder, redactor, or other person responsible for - expressing the views of a - organization.> - - stable - - - - - - - Set designer - std - Use for a person or organization who - translates the rough sketches of the art director - into actual architectural structures for a - theatrical presentation, entertainment, motion - picture, etc. Set designers draw the detailed guides - and specifications for building the - set. - - stable - - - - - - - Signer - sgn - Use for a person whose signature appears - without a presentation or other statement indicative - of provenance. When there is a presentation - statement, use Inscriber [ins]. - - stable - - - - - - Singer - sng - Use for a person or organization who uses - his/her/their voice with or without instrumental - accompaniment to produce music. A performance may or - may not include actual words. - - stable - - - - - - - Sound designer - sds - Use for a person who produces and - reproduces the sound score (both live and recorded), - the installation of microphones, the setting of - sound levels, and the coordination of sources of - sound for a production. - - stable - - - - - - Speaker - spk - Use for a person who participates in a - program (often broadcast) and makes a formalized - contribution or presentation generally prepared in - advance. - - stable - - - - - - - Sponsor - spn - Use for a person or organization that - issued a contract or under the auspices of which a - work has been written, printed, published, - etc. - - stable - - - - - - Stage manager - stm - Use for a person who is in charge of - everything that occurs on a performance stage, and - who acts as chief of all crews and assistant to a - director during rehearsals. - - stable - - - - - - Standards body - stn - Use for an organization responsible for - the development or enforcement of a - standard. - - stable - - - - - - - Stereotyper - str - Use for a person or organization who - creates a new plate for printing by molding or - copying another printing surface. - - stable - - - - - - Storyteller - stl - Use for a person relaying a story with - creative and/or theatrical - interpretation. - - stable - - - - - - - Supporting host - sht - Use for a person or organization that - supports (by allocating facilities, staff, or other - resources) a project, program, meeting, event, data - objects, material culture objects, or other entities - capable of support. - - stable - Host, Supporting - - - - - - Surveyor - srv - Use for a person or organization who does - measurements of tracts of land, etc. to determine - location, forms, and boundaries. - - stable - - - - - - - Teacher - tch - Use for a person who, in the context of a - resource, gives instruction in an intellectual - subject or demonstrates while teaching physical - skills. - - stable - Instructor - - - - - - - Technical director - tcd - Use for a person who is ultimately in - charge of scenery, props, lights and sound for a - production. - - stable - - - - - - Thesis advisor - ths - Use for a person under whose supervision a - degree candidate develops and presents a thesis, - mémoire, or text of a dissertation. - - stable - Promoter - - - - - - Transcriber - trc - Use for a person who prepares a - handwritten or typewritten copy from original - material, including from dictated or orally recorded - material. For makers of pen-facsimiles, use - Facsimilist [fac]. - - stable - - - - - - - Translator - trl - Use for a person or organization who - renders a text from one language into another, or - from an older form of a language into the modern - form. - - stable - - - - - - - Type designer - tyd - Use for a person or organization who - designed the type face used in a particular item. - - stable - Designer of type - - - - - - Typographer - tyg - Use for a person or organization primarily - responsible for choice and arrangement of type used - in an item. If the typographer is also responsible - for other aspects of the graphic design of a book - (e.g., Book designer [bkd]), codes for both - functions may be needed. - - stable - - - - - - University place - uvp - Use for the name of a place where a university that is associated - with a resource is located, for example, a university where an academic - dissertation or thesis was presented. - - stable - - - - - - Videographer - vdg - Use for a person or organization in charge - of a video production, e.g. the video recording of a - stage production as opposed to a commercial motion - picture. The videographer may be the camera operator - or may supervise one or more camera operators. Do - not confuse with cinematographer. - - stable - - - - - - - Vocalist - voc - Use for a person or organization who - principally exhibits singing skills in a musical or - dramatic presentation or entertainment. - - stable - - - - - - - Witness - wit - Use for a person who verifies the - truthfulness of an event or action. - - stable - Deponent - Eyewitness - Observer - Onlooker - Testifier - - - - - - Wood-engraver - wde - Use for a person or organization who makes - prints by cutting the image in relief on the - end-grain of a wood block. - - stable - - - - - - - Woodcutter - wdc - Use for a person or organization who makes - prints by cutting the image in relief on the plank - side of a wood block. - - stable - - - - - - - Writer of accompanying material - wam - Use for a person or organization who - writes significant material which accompanies a - sound recording or other audiovisual - material. - - stable - - - - - Actor - - - - - Adapter - - - - - Analyst - - - - - Animator - - - - - Annotator - - - - - Applicant - - - - - Architect - - - - - Arranger - - - - - Art copyist - - - - - Artist - - - - - Artistic director - - - - - Assignee - - - - - Associated name - - - - - Attributed name - - - - - Auctioneer - - - - - Author - - - - - Author in quotations or text - extracts - - - - - Author of afterword, colophon, - etc. - - - - - Author of dialog - - - - - Author of introduction, etc. - - - - - Author of screenplay, etc. - - - - - Bibliographic antecedent - - - - - Binder - - - - - Binding designer - - - - - Blurb writer - - - - - Book designer - - - - - Book producer - - - - - Bookjacket designer - - - - - Bookplate designer - - - - - Bookseller - - - - - Calligrapher - - - - - Cartographer - - - - - Censor - - - - - Choreographer - - - - - Cinematographer - - - - - Client - - - - - Collaborator - - - - - Collector - - - - - Collotyper - - - - - Colorist - - - - - Commentator - - - - - Commentator for written text - - - - - Compiler - - - - - Complainant - - - - - Complainant-appellant - - - - - Complainant-appellee - - - - - Composer - - - - - Compositor - - - - - Conceptor - - - - - Conductor - - - - - Conservator - - - - - Consultant - - - - - Consultant to a project - - - - - Contestant - - - - - Contestant-appellant - - - - - Contestant-appellee - - - - - Contestee - - - - - Contestee-appellant - - - - - Contestee-appellee - - - - - Contractor - - - - - Contributor - - - - - Copyright claimant - - - - - Copyright holder - - - - - Corrector - - - - - Correspondent - - - - - Costume designer - - - - - Cover designer - - - - - Creator - - - - - Curator of an exhibition - - - - - Dancer - - - - - Data contributor - - - - - Data manager - - - - - Dedicatee - - - - - Dedicator - - - - - Defendant - - - - - Defendant-appellant - - - - - Defendant-appellee - - - - - Degree grantor - - - - - Delineator - - - - - Depicted - - - - - Depositor - - - - - Designer - - - - - Director - - - - - Dissertant - - - - - Distribution place - - - - - Distributor - - - - - Donor - - - - - Draftsman - - - - - Dubious author - - - - - Editor - - - - - Electrician - - - - - Electrotyper - - - - - Engineer - - - - - Engraver - - - - - Etcher - - - - - Event place - - - - - Expert - - - - - Facsimilist - - - - - Field director - - - - - Film editor - - - - - First party - - - - - Forger - - - - - Former owner - - - - - Funder - - - - - Geographic information - specialist - - - - - Honoree - - - - - Host - - - - - Illuminator - - - - - Illustrator - - - - - Inscriber - - - - - Instrumentalist - - - - - Interviewee - - - - - Interviewer - - - - - Inventor - - - - - Laboratory - - - - - Laboratory director - - - - - Lead - - - - - Landscape architect - - - - - Lender - - - - - Libelant - - - - - Libelant-appellant - - - - - Libelant-appellee - - - - - Libelee - - - - - Libelee-appellant - - - - - Libelee-appellee - - - - - Librettist - - - - - Licensee - - - - - Licensor - - - - - Lighting designer - - - - - Lithographer - - - - - Lyricist - - - - - Manufacturer - - - - - Marbler - - - - - Markup editor - - - - - Metadata contact - - - - - Metal-engraver - - - - - Moderator - - - - - Monitor - - - - - Music copyist - - - - - Musical director - - - - - Musician - - - - - Narrator - - - - - Opponent - - - - - Organizer of meeting - - - - - Originator - - - - - Other - - - - - Owner - - - - - Papermaker - - - - - Patent applicant - - - - - Patent holder - - - - - Patron - - - - - Performer - - - - - Permitting agency - - - - - Photographer - - - - - Plaintiff - - - - - Plaintiff-appellant - - - - - Plaintiff-appellee - - - - - Platemaker - - - - - Printer - - - - - Printer of plates - - - - - Printmaker - - - - - Process contact - - - - - Producer - - - - - Production manager - - - - - Production personnel - - - - - Programmer - - - - - Project director - - - - - Proofreader - - - - - Publication place - - - - - Publisher - - - - - Publishing director - - - - - Puppeteer - - - - - Recipient - - - - - Recording engineer - - - - - Redactor - - - - - Renderer - - - - - Reporter - - - - - Repository - - - - - Research team head - - - - - Research team member - - - - - Researcher - - - - - Respondent - - - - - Respondent-appellant - - - - - Respondent-appellee - - - - - Responsible party - - - - - Restager - - - - - Reviewer - - - - - Rubricator - - - - - Scenarist - - - - - Scientific advisor - - - - - Scribe - - - - - Sculptor - - - - - Second party - - - - - Secretary - - - - - Set designer - - - - - Signer - - - - - Singer - - - - - Sound designer - - - - - Speaker - - - - - Sponsor - - - - - Stage manager - - - - - Standards body - - - - - Stereotyper - - - - - Storyteller - - - - - Supporting host - - - - - Surveyor - - - - - Teacher - - - - - Technical director - - - - - Thesis advisor - - - - - Transcriber - - - - - Translator - - - - - Type designer - - - - - Typographer - - - - - University place - - - - - Videographer - - - - - Vocalist - - - - - Witness - - - - - Wood-engraver - - - - - Woodcutter - - - - - Writer of accompanying material - - - diff --git a/ilives/book.inc b/ilives/book.inc deleted file mode 100644 index 52524a9a..00000000 --- a/ilives/book.inc +++ /dev/null @@ -1,334 +0,0 @@ -pid = $pid; - $this->item = new Fedora_Item($pid); - } - } - - public function buildDrupalForm($form = array(), $ingest_form = array(), &$form_state = array()) { - $mods_save = ''; - if (isset($form_state['mods_save'])) { - $mods_save = $form_state['mods_save']; - } - - // Set #cache to true to create the $form_state cache - $form['#cache'] = TRUE; - - // Give the user an option to enter a custom PID - $form['custom_pid'] = array( - '#type' => 'textfield', - '#title' => 'Custom PID', - '#description' => 'If you want to manually specify the PID for the new object, enter it here. ' . - 'Leave it blank for an automatically-generated PID.', - ); - - // Prompt the user to enter a record ID to be looked up in Evergreen. - $form['unapi_url'] = array( - '#type' => 'textfield', - '#title' => 'Catalogue item URL', - ); - $form['unapi_url_submit'] = array( - '#type' => 'submit', - '#value' => t('Retrieve MODS record'), - '#submit' => array('fedora_ilives_retrieve_unapi_submit'), - '#ahah' => array( - 'path' => 'fedora/ilives/retrieve_unapi/js', // path we defined in hook_menu - 'wrapper' => 'mods-wrapper', // the HTML that wraps the element that needs to be replaced - 'method' => 'replace', // the method we're going to use: a replace operation - //'effect' => 'fade', // the effect used when replacing the element (try fade!) - ), - '#suffix' => '
    ', - ); - drupal_add_js('', 'inline'); - // We define a
    wrapper. Everything in it will be replaced. - $form['mods'] = array( - '#tree' => TRUE, - '#prefix' => '
    ', - '#suffix' => '
    ', - ); - $form['mods']['mods_record'] = array( - '#type' => 'textarea', - '#title' => 'MODS Record to Import', - '#rows' => 20, - ); - - if (!empty($mods_save)) { - $form['mods']['mods_record']['#value'] = $mods_save['mods']['mods_record']; - } - return $form; - } - - public function buildEditMetadataForm($form = array()) { - - $form['submit'] = array( - '#type' => 'submit', - '#weight' => 10, - '#value' => 'Update' - ); - $form['pid'] = array( - '#type' => 'hidden', - '#value' => $this->pid, - ); - $form['dsid'] = array( - '#type' => 'hidden', - '#value' => "DARWIN_CORE", - ); - - return $this->buildDrupalForm($form); - } - - public function handleEditMetadataForm($form_id, $form_values) { - /* - * Process the metadata form - * Update the datastreams - */ - - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - module_load_include('inc', 'fedora_repository', 'plugins/DarwinCore'); - module_load_include('inc', 'fedora_repository', 'MimeClass'); - global $user; - $mimetype = new MimeClass(); - $dwc = new DarwinCore($this->item); - $dwc->handleForm($form_values); - $this->item->purge_datastream('DARWIN_CORE'); - $this->item->add_datastream_from_string($dwc->darwinCoreXML, 'DARWIN_CORE', - 'Darwin Core Metadata', 'text/xml', 'X'); - return TRUE; - } - - public function handleIngestForm($form_values, &$form_state) { - /* - * process the metadata form - * Create fedora object - * Add the datastreams - */ - module_load_include('inc', 'fedora_repository', 'MimeClass'); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - if ($form_state['clicked_button']['#value'] == 'Retrieve MODS record') { - return; - } - - $mods_list_doc = new DomDocument(); - $mods_list_doc->loadXML($form_values['mods']['mods_record']); - $mods_item_doc = new DomDocument(); - $mods_item = $mods_list_doc->getElementsByTagNameNS('http://www.loc.gov/mods/v3', 'mods')->item(0); - $new_mods_item = $mods_item_doc->importNode($mods_item, TRUE); - $mods_item_doc->appendChild($new_mods_item); - - $title_info = $mods_item_doc->getElementsByTagNameNS('http://www.loc.gov/mods/v3', 'titleInfo')->item(0); - $title = ''; - foreach (array('nonSort', 'title') as $title_field) { - $title .= $title_info->getElementsByTagNameNS('http://www.loc.gov/mods/v3', $title_field)->item(0)->nodeValue . ' '; - } - $title = trim($title); - $mods_text = $mods_item_doc->saveXML(); - global $user; - $mimetype = new MimeClass(); - - $new_item = Fedora_Item::ingest_new_item(!empty($form_values['custom_pid']) ? $form_values['custom_pid'] : $form_values['pid'], 'A', $title, - $user->name); - - $new_item->add_datastream_from_string($mods_text, 'MODS', - 'MODS Metadata', 'text/xml', 'X'); - - $dc = transform_mods_to_dc($mods_text); - if ($dc) { - // Add the PID to a dc:identifier field. - $dc_doc = simplexml_load_string($dc); - $dc_doc->registerXPathNamespace('oai_dc', 'http://www.openarchives.org/OAI/2.0/oai_dc/'); - $dc_item = $dc_doc->xpath('//oai_dc:dc'); - foreach ($dc_item as $node) { - $node->addChild('dc:identifier', $new_item->pid, 'http://purl.org/dc/elements/1.1/'); - } - $new_item->modify_datastream_by_value($dc_doc->saveXML(), 'DC', 'Dublin Core XML Metadata', 'text/xml'); - } - $new_item->add_relationship('hasModel', $form_values['content_model_pid'], FEDORA_MODEL_URI); - $new_item->add_relationship(!empty($form_values['relationship']) ? $form_values['relationship'] : 'isMemberOfCollection', $form_values['collection_pid']); - drupal_set_message(t("Item !pid created successfully.", array('!pid' => l($new_item->pid, 'fedora/repository/' . $new_item->pid))), "status"); - } - - public function buildAddPagesForm($form = array()) { - - } - - public function showFieldSets() { - module_load_include('inc', 'fedora_repository', 'plugins/tagging_form'); - module_load_include('inc', 'fedora_repository', 'plugins/DarwinCore'); - module_load_include('module', 'fedora_ilives'); - global $base_url; - $show_purge_tab = (!empty($_POST['form_id']) && ($_POST['form_id'] == 'fedora_ilives_purge_pages_form')); - $first_page = new Fedora_Item($this->pid . '-001'); - $hasPage = $first_page->exists(); - $tabset = array(); - - global $user; - $qs = ''; - if ($user->uid != 0) { - $qs = '?uid=' . base64_encode($user->name . ':' . $user->pass); - } - - $viewer_url = variable_get('fedora_base_url', '') . '/get/' . $this->pid . '/ilives:viewerSdef/getViewer' . $qs; - $html = ''; - - $tabset['first_tab'] = array( - // #type and #title are the minimum requirements. - '#type' => 'tabpage', - '#title' => t('Description'), - // This will be the content of the tab. - '#content' => fedora_ilives_create_book_view($this->pid), - ); - - if ($hasPage) { - $tabset['second_tab'] = array( - '#type' => 'tabpage', - '#title' => t('Read'), - '#content' => $html - ); - } - - if (!$hasPage && user_access('ingest new fedora objects')) { - $tabset['third_tab'] = array( - '#type' => 'tabpage', - '#title' => t('Add pages'), - '#content' => drupal_get_form('book_add_pages_form', $this->pid), - ); - } - if ($hasPage && user_access('purge objects and datastreams')) { - $tabset['fourth_tab'] = array( - '#type' => 'tabpage', - '#title' => t('Purge all pages'), - '#selected' => $show_purge_tab, - '#content' => drupal_get_form('fedora_ilives_purge_pages_form', $this->pid), - ); - } - return $tabset; - } - -} - -function book_add_pages_form(&$form_state, $pid, $page_cmodel = 'ilives:pageCModel', $relation = 'isMemberOf') { - $form['pid'] = array( - '#type' => 'hidden', - '#value' => $pid, - ); - $form['page_cmodel'] = array( - '#type' => 'hidden', - '#value' => $page_cmodel, - ); - $form['relation'] = array( - '#type' => 'hidden', - '#value' => $relation, - ); - $form['tiff_dir'] = array( - '#type' => 'textfield', - '#title' => t('TIFF folder'), - '#required' => TRUE, - '#description' => t('Path to a web-accessible folder contining the book\'s page images in TIFF format on this server.'), - ); - - $form['submit'] = array( - '#type' => 'submit', - '#weight' => 10, - '#value' => 'Ingest Pages' - ); - return $form; -} - -function book_add_pages_form_validate($form, &$form_state) { - if ($form_state['values']['tiff_dir'] == '') { - form_set_error('', t('You must select a name for this group of settings.')); - } -} - -function book_add_pages_form_submit($form, &$form_state) { - $pid = $form_state['values']['pid']; - if (!empty($form_state['values']['tiff_dir'])) { - $file_list = array(); - if ($tiff_dir = opendir($form_state['values']['tiff_dir'])) { - while (FALSE !== ($file_name = readdir($tiff_dir))) { - $ext = strrchr($file_name, '.'); - if ($ext == '.tif' || $ext == '.tiff') { - array_push($file_list, $form_state['values']['tiff_dir'] . '/' . $file_name); - } - } - closedir($tiff_dir); - sort($file_list); - ilives_create_page_objects($pid, $file_list, $form_state['values']['page_cmodel'], $form_state['values']['relation']); - } - } -} - -/** - * Create a page object for each element in $image_list as a child object of $pid - */ -function ilives_create_page_objects($pid, $image_list = array(), $page_cmodel = 'ilives:pageCModel', $relation = 'isMemberOfCollection') { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - $book = new Fedora_Item($pid); - if (!$book->exists()) { - return FALSE; - } - - - $page_pids = array(); - $batch = array( - 'title' => 'Creating page objects', - 'operations' => array(), - 'file' => drupal_get_path('module', 'fedora_ilives') . '/book.inc', - ); - $page_num = 1; - $book_title = $book->objectProfile->objLabel; - foreach ($image_list as $image_path) { - $batch['operations'][] = array('ilives_add_single_page_object', array($pid, $image_path, $page_num, "$book_title - Page " . sprintf("%03d", $page_num), $page_cmodel, $relation)); - $page_num++; - } - batch_set($batch); - $objectHelper = new ObjectHelper; - $dc_xml = $objectHelper->getStream($pid, 'DC'); - $xml = new DOMDocument(); - $xml->loadXML($dc_xml); - $root = $xml->documentElement; - $typeNode = $xml->createElement('dc:type', 'ingested'); - $typeNode = $xml->createElementNS("http://purl.org/dc/elements/1.1/", 'dc:type', 'ingested'); - $root->appendChild($typeNode); - $book->modify_datastream_by_value($xml->saveXML(), 'DC', 'Dublin core', 'text/xml', TRUE, "Added Type of Ingest", FALSE); -} - -function ilives_add_single_page_object($book_pid, $page_file, $page_num = 1, $page_title = NULL, $page_cmodel = 'ilives:pageCModel', $relation = 'isMemberOfCollection') { - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - $page_item = Fedora_Item::ingest_new_item("$book_pid-" . sprintf("%03d", $page_num), 'A', $page_title); - $page_item->add_relationship('hasModel', $page_cmodel, FEDORA_MODEL_URI); - $page_item->add_relationship($relation, $book_pid); - $page_item->add_datastream_from_file($page_file, 'TIFF', 'Archival TIFF', 'image/tiff', 'M'); -} - -function transform_mods_to_dc($mods) { - $xp = new XsltProcessor(); - // create a DOM document and load the XSL stylesheet - $xsl = new DomDocument; - $xsl->load(drupal_get_path('module', 'fedora_ilives') . '/xsl/MODS3-22simpleDC.xsl'); - - // import the XSL styelsheet into the XSLT process - $xp->importStylesheet($xsl); - - // create a DOM document and load the XML datat - $xml_doc = new DomDocument; - $xml_doc->loadXML($mods); - - // transform the XML into HTML using the XSL file - if ($dc = $xp->transformToXML($xml_doc)) { - return $dc; - } - else { - return FALSE; - } -} diff --git a/ilives/fedora_ilives.info b/ilives/fedora_ilives.info deleted file mode 100644 index 763adfdc..00000000 --- a/ilives/fedora_ilives.info +++ /dev/null @@ -1,7 +0,0 @@ -; $Id$ -name = Islandora Book -description = Provides book interface -package = Fedora Repository -dependencies[] = fedora_repository -version = 6.1dev -core = 6.x diff --git a/ilives/fedora_ilives.install b/ilives/fedora_ilives.install deleted file mode 100644 index 3c8c6575..00000000 --- a/ilives/fedora_ilives.install +++ /dev/null @@ -1,13 +0,0 @@ - t('Book view'), - 'page callback' => 'fedora_ilives_create_book_view', - 'type' => MENU_CALLBACK, - 'access arguments' => array('view fedora collection'), - ); - $items['fedora/ilives_book_viewer'] = array( - 'title' => t('Book viewer'), - 'page callback' => 'fedora_ilives_book_viewer', - 'type' => MENU_CALLBACK, - 'access arguments' => array('view fedora collection'), - ); - $items['fedora/ilives_book_search'] = array( - 'title' => t('Book viewer'), - 'page callback' => 'fedora_ilives_book_search', - 'type' => MENU_CALLBACK, - 'access arguments' => array('view fedora collection'), - ); - $items['fedora/ilives_page_search'] = array( - 'title' => t('Book viewer'), - 'page callback' => 'fedora_ilives_page_search', - 'type' => MENU_CALLBACK, - 'access arguments' => array('view fedora collection'), - ); - // This block defines the path and the corresponding callback function. - $items['fedora/ilives/retrieve_unapi/js'] = array( - 'page callback' => 'fedora_ilives_button_retrieve_unapi_ahah', // the AHAH callback function - 'access arguments' => array('add fedora datastreams'), - 'type' => MENU_CALLBACK, - ); - return $items; -} - -//function fedora_ilives_book_search($query) { -//} -//function fedora_ilives_page_search($query) { -//} - -function fedora_ilives_block($op = 'list', $delta = 0, $edit = array()) { - // The $op parameter determines what piece of information is being requested. - switch ($op) { - case 'list': - // If $op is "list", we just need to return a list of block descriptions. - // This is used to provide a list of possible blocks to the administrator, - // end users will not see these descriptions. - $blocks[0] = array( - 'info' => t('Book search block'), - ); - $blocks[1] = array( - 'info' => t('Image rotator and tagger'), - ); - $blocks[2] = array( - 'info' => t('Simple book search block'), - ); - - return $blocks; - case 'configure': - // If $op is "configure", we need to provide the administrator with a - // configuration form. The $delta parameter tells us which block is being - // configured. In this example, we'll allow the administrator to customize - // the text of the first block. - // If $op is "configure", we need to provide the administrator with a - // configuration form. The $delta parameter tells us which block is being - // configured. In this example, we'll allow the administrator to customize - // the text of the first block. - $form = array(); - switch ($delta) { - case 0: - // All we need to provide is a text field, Drupal will take care of - // the other block configuration options and the save button. - $form['fedora_ilives_book_search_block_repeat'] = array( - '#type' => 'textfield', - '#title' => t('Number of times to repeat search fields'), - '#size' => 5, - '#description' => t('The number of times you would like the search blocks to be repeated'), - '#default_value' => variable_get('fedora_ilives_book_search_block_repeat', t('3')), - ); - break; - case 1: - // This is the image rotator block. - $form['fedora_ilives_image_rotator_block_query'] = array( - '#type' => 'textarea', - '#title' => t('ITQL Query'), - '#description' => t('The ITQL query to return a list of images.'), - '#default_value' => variable_get('fedora_ilives_image_rotator_tagger_block_query', 'select $object $title from <#ri> -where $object -and $object -and $object $title'), - ); - break; - case 2: - // All we need to provide is a text field, Drupal will take care of - // the other block configuration options and the save button. - $form['fedora_ilives_simple_book_search_block_title'] = array( - '#type' => 'textfield', - '#title' => t('Title'), - '#size' => 15, - '#description' => t('The title of the block'), - '#default_value' => variable_get('fedora_ilives_simple_book_search_block_title', t('Title')), - ); - break; - } - - return $form; - case 'save': - // If $op is "save", we need to save settings from the configuration form. - // Since the first block is the only one that allows configuration, we - // need to check $delta to make sure we only save it. - switch ($delta) { - case 0: - // Have Drupal save the string to the database. - variable_set('fedora_ilives_book_search_block_repeat', $edit['fedora_ilives_book_search_block_repeat']); - break; - case 1: - variable_set('fedora_ilives_image_rotator_tagger_block_query', $edit['fedora_ilives_image_rotator_block_query']); - break; - case 2: - // Have Drupal save the string to the database. - variable_set('fedora_ilives_simple_book_search_block_title', $edit['fedora_ilives_simple_book_search_block_title']); - break; - } - return; - case 'view': default: - // If $op is "view", then we need to generate the block for display - // purposes. The $delta parameter tells us which block is being requested. - switch ($delta) { - case 0: - // The subject is displayed at the top of the block. Note that it - // should be passed through t() for translation. - $block['subject'] = t('Book advanced search'); - // The content of the block is typically generated by calling a custom - // function. - $block['content'] = drupal_get_form('fedora_ilives_book_search_form'); - break; - case 1: - module_load_include('inc', 'fedora_ilives', 'image_rotator_tagger_block'); - $block['subject'] = t('Random repository image'); - $block['content'] = _fedora_image_rotator_tagger_block_content(); - break; - case 2: - // The subject is displayed at the top of the block. Note that it - // should be passed through t() for translation. - $block['subject'] = t('Simple Book Search'); - // The content of the block is typically generated by calling a custom - // function. - $block['content'] = drupal_get_form('fedora_ilives_simple_book_search_form'); - break; - } - - return $block; - } -} - -function fedora_ilives_book_viewer($pid) { - global $user; - $qs = ''; - if ($user->uid != 0) { -// $qs = '?uid=' . base64_encode($user->name . ':' . $user->sid); - $qs = '?uid=' . base64_encode($user->name . ':' . $user->pass); - } - - $viewer_url = variable_get('fedora_base_url', '') . '/get/' . $pid . '/ilives:viewerSdef/getViewer' . $qs; - $html = ''; - $fieldset = array( - '#title' => t('Viewer - ') . $pid, - '#collapsible' => TRUE, - '#collapsed' => FALSE, - '#value' => $html); - drupal_add_css(path_to_theme() . '/header-viewer.css', 'theme'); - return theme('fieldset', $fieldset); -} - -//loads an xslt for the main book page uses mods for most of the display. if there is a $query parameter -// it will execute it against the book. -function fedora_ilives_create_book_view($pid, $query = NULL) { - global $user; - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - $path = drupal_get_path('module', 'Fedora_Repository'); - $objectHelper = new ObjectHelper; - $xml = $objectHelper->getStream($pid, 'MODS'); - $dc_xml = $objectHelper->getStream($pid, 'DC'); - if (!$dc_xml) { - drupal_set_message(t('Object does not exist.'), 'error'); - return ''; - } - $simpleDCxml = simplexml_load_string($dc_xml); - $types = $simpleDCxml->xpath('//dc:type'); - $ingested = 'false'; - if (!empty($types)) { - foreach ($types as $type) { - if ($type == 'ingested') { - $ingested = 'true'; - } - } - } - - if (!isset($pid)) { - drupal_set_message(t('Error getting book view, no identifier specified.')); - return; - } - $proc = NULL; - try { - $proc = new XsltProcessor(); - } catch (Exception $e) { - drupal_set_message(t('Error loading Book View XSLT: $e', array('!e' => $e->getMessage()))); - return; - } - - //inject into xsl stylesheet - $proc->setParameter('', 'userID', $user->uid); - $proc->setParameter('', 'objectsPage', base_path()); - $proc->setParameter('', 'pid', $pid); - $proc->setParameter('', 'ingested', $ingested); - $xsl = new DomDocument(); - $test = $xsl->load($path . '/ilives/xsl/book_view.xsl'); - if (!isset($test)) { - drupal_set_message(t('Error loading search results XSLT.')); - return t('Error loading search results XSLT.'); - } - - $input = new DomDocument(); - $didLoadOk = $input->loadXML($xml); - $output = NULL; - if (!isset($didLoadOk)) { - drupal_set_message(t('Error loading Book View XML.')); - return t('Error loading Book View XML.'); - } - else { - $xsl = $proc->importStylesheet($xsl); - $newdom = $proc->transformToDoc($input); - $output .= $newdom->saveXML(); - } - if (isset($query)) { - module_load_include('inc', 'fedora_repository', 'SearchClass'); - $searchClass = new SearchClass(); - $pageQuery = convert_query_to_page_query($query, $pid); - $output .= '
    ' . $searchClass->custom_search($pageQuery, $startPage, '/ilives/xsl/pageResults.xsl', 500) . '
    '; //limit results to 500 pages of a book since there is no paging if we enable paging in xslt this can be changed - //return $output."
    used this query to find this page $query and new query = $pageQuery
    "; - - return $output; - } - else { - return $output; - } -} - -function convert_query_to_page_query($query, $pid) { - $newQuery = substr($query, 0, strlen($query) - 23); - $pid = str_replace(':', '?', $pid); - $newQuery = $newQuery . " AND PID:$pid* AND dc.type:Text"; - //$newQuery=htmlentities(urlencode($newQuery)); - return $newQuery; -} - -/** - * Custom form element to do our nice images. - */ -function fedora_ilives_elements() { // Change this line - $type['imagebutton'] = array( - '#input' => TRUE, - '#button_type' => 'submit', - '#executes_submit_callback' => TRUE, - '#name' => 'op', - '#process' => array('hook_imagebutton_process' => array()), - ); - return $type; -} - -function theme_imagebutton($element) { - return '\n"; -} - -/** - * Implementation of hook_theme() to register how to theme image buttons. - */ -function fedora_ilives_theme() { - return array( - 'imagebutton' => array( - 'arguments' => array('form' => NULL), - ), - 'fedora_ilives_book_search_form' => array( - 'arguments' => array('form' => NULL), - ), - 'fedora_ilives_simple_book_search_form' => array( - 'arguments' => array('form' => NULL), - ) - ); -} - -//return array( -// 'fedora_repository_mnpl_advanced_search_form' => array( -// 'arguments' => array('form' => NULL) -// ) -// ); - -function theme_fedora_ilives_book_search_form($form) { - module_load_include('inc', 'fedora_repository', 'SearchClass'); - $advanced_search_form = new SearchClass(); - $repeats = variable_get('fedora_ilives_book_search_block_repeat', t('3')); - return $advanced_search_form->theme_advanced_search_form($form, $repeats); -} - -function fedora_ilives_simple_book_search_form($form) { - $form = array(); - $form['search_type']['type1'] = array( - '#title' => t(''), - '#type' => 'hidden', - '#default_value' => 'tei.fullText' - ); - $form['fedora_terms1'] = array( - '#size' => '24', - '#type' => 'textfield', - '#title' => t(''), - '#required' => TRUE, - '#default_value' => '' - ); - $form['submit'] = array( - '#type' => 'submit', - '#value' => t('search') - ); - return $form; -} - -function fedora_ilives_simple_book_search_form_submit($form, &$form_state) { - $type_id = $form_state['values']['type']; - - $searchString = $form_state['values']['type1'] . ':' . $form_state['values']['fedora_terms1']; - - $searchString = trim($searchString) . '+AND+dc.type:collection'; - $form_state['redirect'] = "fedora/ilives_book_search/$searchString"; - //drupal_goto("fedora/ilives_book_search/$searchString"); -} - -function fedora_ilives_book_search_form() { - module_load_include('inc', 'fedora_repository', 'SearchClass'); - $searchClass = new SearchClass(); - $repeats = variable_get('fedora_ilives_book_search_block_repeat', t('3')); - $path = drupal_get_path('module', 'Fedora_Repository') . '/ilives'; - $query = NULL; - if (arg(1) == 'ilives_book_search' && arg(2) != 'dc.type:ingested') { - $length = strlen(arg(2)); - if (($test = strpos(arg(2), 'dc.type:collection')) > 0) { - $length = $test - 5; //get rid of the AND - } - $query = trim(substr(arg(2), 0, $length)); - } - return $searchClass->build_advanced_search_form($repeats, $path, $query); -} - -function fedora_ilives_book_search_form_submit($form, &$form_state) { - $type_id = $form_state['values']['type']; - $repeat = variable_get('fedora_ilives_book_search_block_repeat', t('3')); - $searchString = $form_state['values']['type1'] . ':' . $form_state['values']['fedora_terms1']; - if ($form_state['values']['fedora_terms2'] != '') { - $searchString .= '+' . $form_state['values']['andor1'] . '+' . $form_state['values']['type2'] . ':' . $form_state['values']['fedora_terms2']; - } - if ($repeat > 2 && $repeat < 9) { - for ($i = 3; $i < $repeat + 1; $i++) { - $t = $i - 1; - if ($form_state['values']["fedora_terms$i"] != '') { - $searchString .= '+' . $form_state['values']["andor$t"] . '+' . $form_state['values']["type$i"] . ':' . $form_state['values']["fedora_terms$i"]; - } - } - } - $searchString = trim($searchString) . '+AND+dc.type:collection'; - $form_state['redirect'] = "fedora/ilives_book_search/$searchString"; - //drupal_goto("fedora/ilives_book_search/$searchString"); -} - -function fedora_ilives_book_search($query, $startPage = 1) { - module_load_include('inc', 'fedora_repository', 'SearchClass'); - $searchClass = new SearchClass(); - return $searchClass->custom_search($query, $startPage, '/ilives/xsl/results.xsl', 10); -} - -function retrieve_unapi_MODS_record($url) { - $bib_response = drupal_http_request($url); - $bib_html = $bib_response->data; - $bib_doc = new DOMDocument; - @$bib_doc->loadHTML($bib_html); - $links = $bib_doc->getElementsByTagName('link'); - foreach ($links as $link) { - if ($link->getAttribute('rel') == 'unapi-server') { - $unapi_server = $link->getAttribute('href'); - break; - } - } - $attrs = $bib_doc->getElementsByTagName('abbr'); - foreach ($attrs as $attr) { - if ($attr->getAttribute('class') == 'unapi-id') { - - $unapi_id = $attr->getAttribute('title'); - break; - } - } - $mods_url = "$unapi_server?id=$unapi_id&format=mods3"; - $mods_resp = drupal_http_request($mods_url); - $mods_data = $mods_resp->data; - return $mods_data; -} - -/** - * AHAH callback for the 'match type' select. - * This function handles the actual replace and sets the $form and $form_state arrays. - * */ -function fedora_ilives_button_retrieve_unapi_ahah() { - - // this part is used to set up $form_state. - // In Drupal 7, these next 11 lines will be put in a core utility function. - // Just remember you'll need them in D6 when you do AHAH. - $form_state = array('storage' => NULL, 'submitted' => FALSE); - $form_build_id = $_POST['form_build_id']; - $form = form_get_cache($form_build_id, $form_state); - $args = $form['#parameters']; - $form_id = array_shift($args); - $form['#post'] = $_POST; - $form['#redirect'] = FALSE; - $form['#programmed'] = FALSE; - - $form_state['post'] = $_POST; - drupal_process_form($form_id, $form, $form_state); - $form_state['storage']['step'] = 2; - $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id); - // From here on, we'll add our own code. - // We just get the element of $form that needs to be refreshed, and just resubmit that - // part through the json call. In this case we want to rebuild the 'kind'
    wrapper and the - // select box it contains - $changed_elements = $form['mods']['mods_record']; - - - unset($changed_elements['#prefix'], $changed_elements['suffix']); // we'll unset the div to make sure it won't be repeated! - // the actual JSON call - $javascript = drupal_add_js(NULL, NULL, 'header'); - drupal_json(array( - 'status' => TRUE, - 'data' => theme('status_messages') . drupal_render($changed_elements), // rebuild just the part that needs to be changed - 'settings' => call_user_func_array('array_merge_recursive', $javascript['setting']), - )); -} - -/** - * This is the handler for the 'type' box: pressing this will refresh the
    kind wrapper. - * */ -function fedora_ilives_retrieve_unapi_submit($form, &$form_state) { - - unset($form_state['submit_handlers']); // unset all the submit handlers in the form - form_execute_handlers('submit', $form, $form_state); // execute submit handler - $url = $form_state['values']['unapi_url']; - $mods = retrieve_unapi_MODS_record($url); - $form_state['values']['mods']['mods_record'] = $mods; - $mods_save = $form_state['values']; // store all the submitted values in the form - $form_state['mods_save'] = $mods_save; // put the values in a new form - - $form_state['rebuild'] = TRUE; // set to true to make sure the form gets rebuild - return $mods_save; -} - -function fedora_ilives_form_alter(&$form, &$form_state, $form_id) { - if ($form_id == 'fedora_repository_admin') { - # Custom settings for book module. - } - elseif ($form_id == 'fedora_repository_demo_objects_form') { - if (!Fedora_Item::fedora_item_exists('ilives:bookCModel')) { - - $form['install_demos']['demo_collections']['#options']['ilives:bookCModel'] = 'Book-related content models and service objects'; - $form['install_demos']['ingest']['#disabled'] = FALSE; - $form['#submit'][] = 'fedora_ilives_install_demos_form_submit'; - } - else { - - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - $book_item = new Fedora_Item('ilives:bookCModel'); - - $form['existing_demos']['ilives:bookCModel'] = array( - '#prefix' => '
  • ', - '#value' => l($book_item->pid, $book_item->url()), - '#suffix' => '
  • ', - ); - } - } -} - -function fedora_ilives_install_demos_form_submit($form, &$form_state) { - if ($form_state['values']['demo_collections']['ilives:bookCModel'] == 'ilives:bookCModel') { - # The ilives:bookCModel checkbox was checked - install_book_content_model_objects(); - } -} - -/** - * Implementation of hook_requirements(). - * - * @return - * An array describing the status of the site regarding available updates. - * If there is no update data, only one record will be returned, indicating - * that the status of core can't be determined. If data is available, there - * will be two records: one for core, and another for all of contrib - * (assuming there are any contributed modules or themes enabled on the - * site). In addition to the fields expected by hook_requirements ('value', - * 'severity', and optionally 'description'), this array will contain a - * 'reason' attribute, which is an integer constant to indicate why the - * given status is being returned (UPDATE_NOT_SECURE, UPDATE_NOT_CURRENT, or - * UPDATE_UNKNOWN). This is used for generating the appropriate e-mail - * notification messages during update_cron(), and might be useful for other - * modules that invoke update_requirements() to find out if the site is up - * to date or not. - * - * @see _update_message_text() - * @see _update_cron_notify() - */ -function fedora_ilives_requirements($phase) { - global $base_url; - if ($phase == 'runtime') { - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); - $requirements['iiv-war'] = array(); - $requirements['iiv-war']['title'] = t("Islandora OpenLayers image viewer web app"); - if (!_fedora_ilives_viewer_available()) { - $requirements['iiv-war']['value'] = ("Not available"); - $requirements['iiv-war']['severity'] = REQUIREMENT_ERROR; - $requirements['iiv-war']['description'] = t('Ensure that Fedora is running and that the IIV app is deployed.', - array('@iiv-home' => 'http://github.com/islandora/iiv')); - } - else { - $requirements['iiv-war']['value'] = ("Available"); - $requirements['iiv-war']['severity'] = REQUIREMENT_OK; - } - } - return $requirements; -} - -function _fedora_ilives_viewer_available() { - $url = parse_url(variable_get('fedora_base_url', 'http://localhost:8080/fedora')); - $fedora_host = ("{$url['scheme']}://{$url['host']}" . (!empty($url['port']) ? ":{$url['port']}/" : '/')); - $response = drupal_http_request("$fedora_host/iiv/images/loading.gif"); - return empty($response->error); -} - -function fedora_ilives_required_fedora_objects() { - // array( 'path-to-foxml-file', 'pid', 'dsid', 'path-to-datastream-file', int dsversion, boolean required) - $module_path = drupal_get_path('module', 'fedora_ilives'); - return array( - 'fedora_ilives' => array( - 'module' => 'fedora_ilives', - 'title' => 'Island Lives Books', - 'objects' => array( - array( - 'foxml_file' => "$module_path/xml/ilives_pageCModel.xml", - 'pid' => 'ilives:pageCModel', - 'dsid' => NULL, - 'datastream_file' => NULL, - 'dsversion' => NULL, - ), - array( - 'foxml_file' => "$module_path/xml/ilives_bookCModel.xml", - 'pid' => 'ilives:bookCModel', - 'dsid' => NULL, - 'datastream_file' => NULL, - 'dsversion' => NULL, - ), - array( - 'foxml_file' => "$module_path/xml/ilives_jp2Sdef.xml", - 'pid' => 'ilives:jp2Sdef', - 'dsid' => NULL, - 'datastream_file' => NULL, - 'dsversion' => NULL, - ), - array( - 'foxml_file' => "$module_path/xml/ilives_viewerSdef.xml", - 'pid' => 'ilives:viewerSdef', - 'dsid' => NULL, - 'datastream_file' => NULL, - 'dsversion' => NULL, - ), - array( - 'foxml_file' => "$module_path/xml/ilives_viewerSdep-bookCModel.xml", - 'pid' => 'ilives:viewerSdep-bookCModel', - 'dsid' => NULL, - 'datastream_file' => NULL, - 'dsversion' => NULL, - ), - array( - 'foxml_file' => "$module_path/xml/ilives_viewerSdep-pageCModel.xml", - 'pid' => 'ilives:viewerSdep-pageCModel', - 'dsid' => NULL, - 'datastream_file' => NULL, - 'dsversion' => NULL, - ), - array( - 'foxml_file' => "$module_path/xml/ilives_tei2htmlSdef.xml", - 'pid' => 'ilives:tei2htmlSdef', - 'dsid' => NULL, - 'datastream_file' => NULL, - 'dsversion' => NULL, - ), - array( - 'foxml_file' => "$module_path/xml/ilives_tei2htmlSdep-pageCModel.xml", - 'pid' => 'ilives:tei2htmlSdep-pageCModel', - 'dsid' => NULL, - 'datastream_file' => NULL, - 'dsversion' => NULL, - ), - array( - 'foxml_file' => "$module_path/xml/ilives_collection.xml", - 'pid' => 'ilives:collection', - 'dsid' => NULL, - 'datastream_file' => NULL, - 'dsversion' => NULL, - ), - array( - 'foxml_file' => "$module_path/xml/ilives_CollectionModel.xml", - 'pid' => 'ilives:CollectionModel', - 'dsid' => NULL, - 'datastream_file' => NULL, - 'dsversion' => NULL, - ), - array( - 'pid' => 'books:collection', - 'label' => 'Book Collection', - 'cmodel' => 'islandora:collectionCModel', - 'parent' => 'islandora:demos', - 'datastreams' => array( - array( - 'dsid' => 'COLLECTION_POLICY', - 'datastream_file' => "$module_path/xml/book_collection_policy.xml", - ), - array( - 'dsid' => 'TN', - 'datastream_file' => "$module_path/Crystal_Clear_mimetype_man.png", - 'mimetype' => 'image/png', - ), - ), - ), - ), - ), - ); -} - -function fedora_ilives_purge_pages_form(&$form_state, $pid, $referrer = NULL) { - global $base_url; - if (!user_access('purge objects and datastreams')) { - return NULL; - } - if ($pid == NULL) { - return NULL; - } - $form['pid'] = array( - '#type' => 'hidden', - '#value' => "$pid" - ); - if (!strstr(drupal_get_destination(), urlencode('fedora/repository'))) { - $form['referrer'] = array( - '#type' => 'hidden', - '#value' => $referrer, - ); - } - if (!isset($form_state['storage']['confirm'])) { - // do your normal $form definition here - - - $form['submit'] = array( - '#type' => 'image_button', - '#src' => drupal_get_path('module', 'fedora_repository') . '/images/purge_big.png', - '#value' => t('Purge'), - '#suffix' => 'Purge all pages associated with this book', - ); - - return $form; - } - else { - // ALSO do $form definition here. Your final submit handler (after user clicks Yes, I Confirm) will only see $form_state info defined here. Form you create here passed as param1 to confirm_form - - return confirm_form($form, 'Confirm Purge ALL pages?', $referrer, 'Are you sure you want to delete these objects? This action cannot be undone.', 'Purge Pages', 'Cancel'); //Had better luck leaving off last param 'name' - } - return $form; -} - -function fedora_ilives_purge_pages_form_submit($form, &$form_state) { - module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); - $pid = $form_state['values']['pid']; - if (!isset($form_state['storage']['confirm'])) { - $form_state['storage']['confirm'] = TRUE; // this will cause the form to be rebuilt, entering the confirm part of the form - $form_state['rebuild'] = TRUE; // along with this - } - else { - - $query = << - where (\$object \$title - and \$object - and \$object ) - order by \$title - -XML; - - // this is where you do your processing after they have pressed the confirm button - module_load_include('inc', 'fedora_repoitory', 'CollectionClass'); - $collection = new CollectionClass($pid); - $contents = $collection->getRelatedItems($pid, $query); - $results_xml = simplexml_load_string($contents); - $resultsarray = array(); - foreach ($results_xml->results->result as $result) { - $pid_to_delete = str_replace('info:fedora/', '', $result->object->attributes()->uri); - - //parse contents - - $params = array( - "pid" => $pid_to_delete, - "logMessage" => "Purged", - "force" => "" - ); - try { - $soapHelper = new ConnectionHelper(); - $client = $soapHelper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); - $object = $client->__soapCall('purgeObject', array($params)); - unset($form_state['storage']['confirm']); - } catch (exception $e) { - if (preg_match('/org\.fcrepo\.server\.security\.xacml\.pep\.AuthzDeniedException/', $e->getMessage())) { - drupal_set_message(t('Error: Insufficient permissions to purge object.'), 'error'); - } - else { - drupal_set_message(t($e->getMessage()), 'error'); - } - return; - } - } - if (!empty($form_state['values']['referrer'])) { - $form_state['redirect'] = $form_state['values']['referrer']; - } - elseif (empty($collectionPid) && !empty($_SESSION['fedora_collection']) && $_SESSION['fedora_collection'] != $pid) { - $collectionPid = $_SESSION['fedora_collection']; - - $form_state['redirect'] = "fedora/repository/$collectionPid/"; - } - else { - $form_state['redirect'] = 'fedora/repository/'; - } - } -} diff --git a/ilives/image_rotator_tagger_block.inc b/ilives/image_rotator_tagger_block.inc deleted file mode 100755 index eb29e23f..00000000 --- a/ilives/image_rotator_tagger_block.inc +++ /dev/null @@ -1,107 +0,0 @@ - -where $object -and $object -and $object $title'; - $collection = new CollectionClass('ilives:figures'); - $results = $collection->getRelatedItems('ilives:figures', $itqlquery); - //drupal_set_message($results); - - - if (empty($results)) { - return NULL; - } - $resultsdoc = new DomDocument(); - $resultsdoc->loadXML($results); - - $resultslist = $resultsdoc->getElementsByTagName('result'); - if ( $resultslist->length == 0 ) { - return NULL; - } - //return htmlentities(substr($results, 0, 1000)); - $randresult = $resultslist->item( rand()%$resultslist->length ); - if (empty($randresult)) { - return NULL; - } - $objs = $randresult->getElementsByTagName('object'); - $obj = $objs->item(0); - $pid = substr( $obj->getAttribute('uri'), 12); - $titles = $randresult->getElementsByTagName('title'); - $title = $titles->item(0); - - return array('pid' => $pid, - //'title' => $randresult->textContent); - 'title' => $title->nodeValue); - -} - - -function _fedora_image_rotator_tagger_block_content() { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - module_load_include('inc', 'fedora_repository', 'plugins/tagging_form'); - - global $base_url; - if (!empty($_POST['pid'])) { - $image_item = new Fedora_Item($_POST['pid']); - $result['pid'] = $_POST['pid']; - $result['title'] = $image_item->objectProfile->objLabel; - } - elseif (empty($_POST) && !empty($_SESSION['fedora_tagged_image']['pid'])) { - $image_item = new Fedora_Item($_SESSION['fedora_tagged_image']['pid']); - $result['pid'] = $_SESSION['fedora_tagged_image']['pid']; - $result['title'] = $image_item->objectProfile->objLabel; - unset($_SESSION['fedora_tagged_image']); - } - else { - $result = get_random_image(); - - $image_item = new Fedora_Item($result['pid']); - } - if (!empty ($result)) { - return '

    ' - . l( '', 'fedora/repository/'. $result['pid'], array('html' => TRUE, 'alias' => TRUE)) - .'

    This image is from '. l($result['title'], 'fedora/ilives_book_viewer/'. substr($image_item->pid, 0, strrpos($image_item->pid, '-')), array('html' => TRUE, 'alias' => TRUE)) . '.' - . drupal_get_form('fedora_repository_image_tagging_form', $result['pid']) . '

    '; - } - else { - return ''; - } -} - - -/* -function fedora_ilives_preprocess_page(&$variables) { - drupal_add_js(drupal_get_path('module', 'fedora_ilives').'/fedora_ilives_ajax.js', 'theme'); - return TRUE; -}*/ - -class ShowILivesStreamsInFieldSets { - - private $pid =NULL; - - function ShowILivesStreamsInFieldSets($pid) { - //drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); - $this->pid=$pid; - } - - function showJPG() { - module_load_include('inc', 'fedora_repository', 'plugins/tagging_form'); - global $base_url; - $collection_fieldset = array( - '#collapsible' => FALSE, - '#value' => '', - ); - return theme('fieldset', $collection_fieldset) - . drupal_get_form('fedora_repository_image_tagging_form', $this->pid); - } -} diff --git a/ilives/searchTerms.xml b/ilives/searchTerms.xml deleted file mode 100644 index b224c959..00000000 --- a/ilives/searchTerms.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - dc.title - 1000 - - dc.title - Title - - - mods.sor - Author - - - mods.subject - Subject - - - - tei.fullText - Text - - - tei.persName - People - - - - - tei.placeName - Places - - - tei.orgName - Organization Name - - - - - - - - - - - - diff --git a/ilives/tests/fedora_ilives.test b/ilives/tests/fedora_ilives.test deleted file mode 100644 index be8c0ffd..00000000 --- a/ilives/tests/fedora_ilives.test +++ /dev/null @@ -1,132 +0,0 @@ - 'Fedora Book', - 'description' => t('The Fedora repository book content model.'), - 'group' => t('fedora repository'), - ); - } - - function setUp() { - parent::setUp('fedora_repository', 'fedora_ilives', 'tabs'); - - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - - // Create and login user. - $repository_user = $this->drupalCreateFedoraUser(array('add fedora datastreams', - 'edit fedora meta data', - 'edit tags datastream', - 'ingest new fedora objects', - 'purge objects and datastreams', - 'view fedora collection', - 'view detailed list of content')); - - - $this->drupalLogin($repository_user); - - } - - public function testBookCModel() { - // First add a book collection - - $pid_list = array(); - // Create a collection for ingesting book content model objects. - - $ingest_form = array(); - $ingest_form['models'] = 'islandora:collectionCModel/ISLANDORACM'; - - $this->drupalPost('fedora/ingestObject/islandora:top/Islandora%20Top-Level%20Collection', $ingest_form, 'Next'); - - $ingest_title = $this->randomName(32); - $ingest_form_step_2['dc:title'] = $ingest_title; - $ingest_form_step_2['dc:description'] = $this->randomName(256); - $ingest_form_step_2['files[ingest-file-location]'] = realpath(drupal_get_path('module', 'fedora_ilives') . '/xml/book_collection_policy.xml'); - $this->drupalPost(NULL, $ingest_form_step_2, 'Ingest'); - $this->assertPattern('/Item .* created successfully./', "Verified item created."); - - $pid = $this->getIngestedPid(); - $this->drupalGet("fedora/repository/$pid"); - $pid_list[] = $pid; - - // Now add a book into the new collection - $this->pass("Create book collection $pid below top-level collection.", 'fedora book'); - $ingest_book_form = array(); - $ingest_book_form['models'] = 'ilives:bookCModel/ISLANDORACM'; - $this->drupalPost("fedora/ingestObject/$pid/", $ingest_book_form, 'Next'); - $ingest_book_form_step_2 = array(); - - $ingest_book_form_step_2['mods[mods_record]'] = file_get_contents(drupal_get_path('module', 'fedora_ilives') . '/tests/test_files/mods_record.xml'); - $this->outputScreenContents(); - $this->drupalPost(NULL, $ingest_book_form_step_2, 'Ingest'); - $this->outputScreenContents(); - $book_pid = $this->getIngestedPid(); - $pid_list[] = $book_pid; - if (!empty($book_pid)) { - $this->pass("Successfully ingested book object $book_pid."); - } - $this->cleanUpRepository($pid_list); - - } - - private function cleanUpRepository($pid_list = array()) { - $this->pass("This is the PID list to purge: ". implode(", ", $pid_list) ); - foreach ($pid_list as $pid) { - $this->drupalPost("fedora/repository/purgeObject/$pid", array(), 'Purge'); - $this->drupalPost(NULL, array(), 'Delete'); - } - } - - private function getIngestedPid() { - $subject = $this->drupalGetContent(); - $pattern = '/">(.*)<\/a> created successfully./'; - $matches = array(); - $res = preg_match($pattern, $subject, $matches); - return $matches[1]; - } - - private function outputScreenContents($description = '', $basename = '') { - // This is a hack to get a directory that won't be cleaned up by SimpleTest. - $file_dir = file_directory_path() . '../simpletest_output_pages'; - if (!is_dir($file_dir)) { - mkdir($file_dir, 0777, TRUE); - } - $output_path = "$file_dir/$basename.". $this->randomName(10) . '.html'; - $rv = file_put_contents($output_path, $this->drupalGetContent()); - $this->pass("$description: Contents of result page are ". l('here', $output_path)); - } - - protected function drupalCreateFedoraUser($permissions = array('access comments', 'access content', 'post comments', 'post comments without approval')) { - // Create a role with the given permission set. - if (!($rid = $this->drupalCreateRole($permissions))) { - return FALSE; - } - - // Create a user assigned to that role. - $edit = array(); - $edit['name'] = 'simpletestuser'; - $edit['mail'] = $edit['name'] . '@example.com'; - $edit['roles'] = array($rid => $rid); - $edit['pass'] = 'simpletestpass'; - $edit['status'] = 1; - - $account = user_save('', $edit); - - $this->assertTrue(!empty($account->uid), t('User created with name %name and pass %pass', array('%name' => $edit['name'], '%pass' => $edit['pass'])), t('User login')); - if (empty($account->uid)) { - return FALSE; - } - - // Add the raw password so that we can log in as this user. - $account->pass_raw = $edit['pass']; - return $account; - } - -} \ No newline at end of file diff --git a/ilives/tests/test_files/mods_record.xml b/ilives/tests/test_files/mods_record.xml deleted file mode 100644 index 6ec2a1d2..00000000 --- a/ilives/tests/test_files/mods_record.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - The - amazing Maurice and his educated rodents - - - Pratchett, Terry. - - creator - - - text - novel - - - enk - - - London - - Corgi Books - 2002 - 2001 - monographic - - - eng - - - print - 269 p. ; 22 cm. - - A talking cat, intelligent rats, and a strange boy cooperate in a Pied Piper scam until they try to con the wrong town and are confronted by a deadly evil rat king. - juvenile - Terry Pratchett. - Carnegie Medal winner. - - Discworld (Imaginary place) - Fiction - - - Discworld (Imaginary place) - Fiction - - - Rats - Fiction - - - Cats - Fiction - - - Fantasy fiction - - - Humorous stories - - PZ7.P8865 Am 2002 - - - Discworld series - - - Pratchett, Terry. - - - 006001234X (library binding) - 0385601239 - 0552546933 (pbk.) - - CaNWHRN - 010730 - 20020314 .0 - - eng - - - - - diff --git a/ilives/xml/book_collection_policy.xml b/ilives/xml/book_collection_policy.xml deleted file mode 100644 index 8c4639f5..00000000 --- a/ilives/xml/book_collection_policy.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - dc.title - dc.creator - dc.description - dc.date - dc.identifier - dc.language - dc.publisher - dc.rights - dc.subject - dc.relation - dcterms.temporal - dcterms.spatial - Full Text - - isMemberOfCollection - \ No newline at end of file diff --git a/ilives/xml/ilives_CollectionModel.xml b/ilives/xml/ilives_CollectionModel.xml deleted file mode 100644 index c5d4d7bd..00000000 --- a/ilives/xml/ilives_CollectionModel.xml +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - - - -ingest - -fedoraAdmin -2009-01-23T20:43:42.518Z -Created with Admin GUI "New Object" command - - - -modifyDatastreamByValue -RELS-EXT -fedoraAdmin -2009-01-23T20:45:33.190Z - - - - -modifyDatastreamByValue -DC -fedoraAdmin -2009-01-23T20:48:22.246Z - - - - -ingest - -fedoraAdmin -2009-01-26T20:27:14.697Z -Ingested from local file /opt/fedora/export/ilives_CollectionModel.xml - - - -ingest - -fedoraAdmin -2009-03-21T22:35:49.622Z -Ingested from local file /Volumes/iLives/iLivesTexts/215258_jpg/Content_Models/CollectionCModel.xml - - - -ingest - -admin -2009-09-14T14:09:41.955Z -Fedora Object Ingested - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This DS-COMPOSITE-MODEL datastream is included as a starting point to - assist in the creation of a content model. The DS-COMPOSITE-MODEL - should define the datastreams that are required for any objects - conforming to this content model. - For more information about content models, see: - http://fedora-commons.org/confluence/x/dgBI. - For examples of completed content model objects, see the demonstration - objects included with your Fedora distribution, such as: - demo:CMImage, demo:UVA_STD_IMAGE, demo:DualResImageCollection, - demo:TEI_TO_PDFDOC, and demo:XML_TO_HTMLDOC. - For more information about the demonstration objects, see: - http://fedora-commons.org/confluence/x/AwFI. - - -
    -
    -
    -
    -
    -
    - - - - - IslandLives Collection Model - ilives:CollectionModel - - - - - - - IslandLives Collection - Made possible through a generous private donation, the IslandLives project builds on the Robertson Library’s mission to preserve and share unique material relating to Prince Edward Island and demonstrates UPEI's ongoing commitment to making PEI's cultural and published heritage available to all. -Utilizing the library’s “Prince Edward Island Collection” and the latest in digitization technology, IslandLives will start by digitizing 300 or so published community histories dating from the mid-1800’s to the present day. These transformed community histories will form the basis of a rich online repository. -IslandLives will provide a variety of search interfaces that will allow users to browse and search the content by name, community, time period, and keyword. The Island community will have a whole new way to rediscover, search and share their stories. -This project will engage and build community – recruiting interested individuals from the cultural heritage community and everyday Islanders. Project staff will travel to communities and host ‘digitization days’, introducing community members to the project and its goals, providing them with an opportunity to digitize their own content, and to contribute their content to the IslandLives collection. - Robertson Library, University of Prince Edward Island - ilives:CollectionModel - - - - -
    \ No newline at end of file diff --git a/ilives/xml/ilives_bookCModel.xml b/ilives/xml/ilives_bookCModel.xml deleted file mode 100644 index b6042042..00000000 --- a/ilives/xml/ilives_bookCModel.xml +++ /dev/null @@ -1,524 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2009-11-12T14:56:58.331Z - Ingested from local file /Users/aoneill/dev/iiv/iiv/etc/fedora-objects/ilives_bookCModel.xml - - - - ingest - - fedoraAdmin - 2010-05-31T19:56:44.131Z - Ingested from source repository with pid ilives:bookCModel - - - - ingest - - fedoraAdmin - 2010-06-10T17:43:56.335Z - Ingested from local file /Users/aoneill/fedora_repository/content_models/ilives_bookCModel.xml - - - - addDatastream - ISLANDORACM - fedoraAdmin - 2010-06-10T19:01:39.144Z - DatastreamsPane generated this logMessage. - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-06-10T19:29:20.220Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-06-10T19:46:24.930Z - - - - - ingest - - fedoraAdmin - 2010-06-16T11:27:32.059Z - Ingested from local file /Users/aoneill/Dropbox/fedora_repository/content_models/ilives_bookCModel.xml - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-06-16T11:29:54.285Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-06-16T18:36:16.581Z - - - - - ingest - - fedoraAdmin - 2010-06-16T16:14:12.989Z - Ingested from local file /Applications/MAMP/htdocs/f3/sites/default/modules/fedora_repository/content_models/ilives_bookCModel.xml - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-09-16T17:43:54.445Z - - - - - - - - - - - - - - - - - - - - - - - - This DS-COMPOSITE-MODEL datastream is included as a starting point to - assist in the creation of a content model. The DS-COMPOSITE-MODEL - should define the datastreams that are required for any objects - conforming to this content model. - For more information about content models, see: - http://fedora-commons.org/confluence/x/dgBI. - For examples of completed content model objects, see the demonstration - objects included with your Fedora distribution, such as: - demo:CMImage, demo:UVA_STD_IMAGE, demo:DualResImageCollection, - demo:TEI_TO_PDFDOC, and demo:XML_TO_HTMLDOC. - For more information about the demonstration objects, see: - http://fedora-commons.org/confluence/x/AwFI. - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Book Content Model - ilives:bookCModel - - - - - - - - - - image/tiff - image/tif - - - - - ilives - plugins/herbarium.inc - Herbarium - showFieldSets - - - - - - - - text/xml - - - ilives - book.inc - IslandoraBook - ingestBook - MODS - - - - - - - ilives - book.inc - IslandoraBook - buildDrupalForm - handleIngestForm - - - - - ilives - book.inc - IslandoraBook - buildEditMetadataForm - - - ilives - book.inc - IslandoraBook - handleEditMetadataForm - - - - - - - - - - image/tiff - image/tif - - - - - fedora_ilives - plugins/herbarium.inc - Herbarium - showFieldSets - - - - - - - - text/xml - - - fedora_ilives - book.inc - IslandoraBook - ingestBook - MODS - - - - - - - fedora_ilives - book.inc - IslandoraBook - buildDrupalForm - handleIngestForm - - - - - fedora_ilives - book.inc - IslandoraBook - buildEditMetadataForm - - - fedora_ilives - book.inc - IslandoraBook - handleEditMetadataForm - - - - - - - - - - image/tiff - - - - - fedora_ilives - plugins/herbarium.inc - Herbarium - showFieldSets - - - - - - - - text/xml - - - fedora_ilives - book.inc - IslandoraBook - ingestBook - MODS - - - - - - - fedora_ilives - book.inc - IslandoraBook - buildDrupalForm - handleIngestForm - - - - - fedora_ilives - book.inc - IslandoraBook - buildEditMetadataForm - - - fedora_ilives - book.inc - IslandoraBook - handleEditMetadataForm - - - - - - - - - - image/tiff - - - - - fedora_ilives - book.inc - IslandoraBook - showFieldSets - - - - - - - - - text/xml - - - fedora_ilives - book.inc - IslandoraBook - ingestBook - MODS - - - - - - - fedora_ilives - book.inc - IslandoraBook - buildDrupalForm - handleIngestForm - - - - - fedora_ilives - book.inc - IslandoraBook - buildEditMetadataForm - - - fedora_ilives - book.inc - IslandoraBook - handleEditMetadataForm - - - - - - - - - - text/xml - - - - - fedora_ilives - book.inc - IslandoraBook - showFieldSets - - - - - - - - text/xml - - - fedora_ilives - book.inc - IslandoraBook - ingestBook - MODS - - - - - - - fedora_ilives - book.inc - IslandoraBook - buildDrupalForm - handleIngestForm - - - - - fedora_ilives - book.inc - IslandoraBook - buildEditMetadataForm - - - fedora_ilives - book.inc - IslandoraBook - handleEditMetadataForm - - - - - - - - - - text/xml - - - - text/xml - - - - - - - - - - - - - - - - - - - - - - diff --git a/ilives/xml/ilives_collection.xml b/ilives/xml/ilives_collection.xml deleted file mode 100644 index 23801263..00000000 --- a/ilives/xml/ilives_collection.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - -ingest - -fedoraAdmin -2009-05-14T19:32:21.132Z -Created with Admin GUI "New Object" command - - - -modifyDatastreamByValue -DC -fedoraAdmin -2009-05-14T19:35:11.912Z - - - - - - - - - - - IslandLives Collection - ilives:collection - - - - - - - IslandLives Collection - Made possible through a generous private donation, IslandLives contains community and church histories and it builds on the Robertson Library's mission to preserve and share unique material relating to Prince Edward Island and demonstrates UPEI"s ongoing commitment to making PEI"s cultural and published heritage available to all. Welcome. - ilives:collection - - - - - \ No newline at end of file diff --git a/ilives/xml/ilives_figuresCModel.xml b/ilives/xml/ilives_figuresCModel.xml deleted file mode 100644 index 7b63ae7b..00000000 --- a/ilives/xml/ilives_figuresCModel.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - image/jpeg - - - - - fedora_ilives - image_rotator_tagger_block.inc - ShowILivesStreamsInFieldSets - showJPG - - - - image/jpeg - - - - diff --git a/ilives/xml/ilives_jp2Sdef.xml b/ilives/xml/ilives_jp2Sdef.xml deleted file mode 100644 index f7212084..00000000 --- a/ilives/xml/ilives_jp2Sdef.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2009-11-12T14:56:59.840Z - Ingested from local file /Users/aoneill/dev/iiv/iiv/etc/fedora-objects/ilives_jp2Sdef.xml - - - - ingest - - admin - 2010-05-25T13:17:14.106Z - Fedora Object Ingested - - - - ingest - - fedoraAdmin - 2010-06-01T01:40:47.337Z - Ingested from local file /Users/al/fedora_repository/content_models/ilives_jp2Sdef.xml - - - - - - - - - - - - - - - - - - - - - ilives:jp2Sdef - ilives:jp2Sdef - - - - - - - - - - - - - - - diff --git a/ilives/xml/ilives_jp2Sdep-pageCModel.xml b/ilives/xml/ilives_jp2Sdep-pageCModel.xml deleted file mode 100644 index 7eedea6d..00000000 --- a/ilives/xml/ilives_jp2Sdep-pageCModel.xml +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2009-11-12T14:57:00.246Z - Ingested from local file /Users/aoneill/dev/iiv/iiv/etc/fedora-objects/ilives_jp2Sdep-pageCModel.xml - - - - ingest - - fedoraAdmin - 2010-06-01T00:46:19.239Z - Ingested from local file /Users/al/Desktop/ilives_jp2Sdep-pageCModel.xml - - - - modifyDatastreamByValue - RELS-EXT - fedoraAdmin - 2010-06-01T00:48:39.302Z - - - - - - - - - - - ilives:jp2Sdep-pageCModel - ilives:jp2Sdep-pageCModel - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DC - text/xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ilives/xml/ilives_pageCModel.xml b/ilives/xml/ilives_pageCModel.xml deleted file mode 100644 index 0f24edeb..00000000 --- a/ilives/xml/ilives_pageCModel.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2009-11-12T14:57:00.652Z - Ingested from local file /Users/aoneill/dev/iiv/iiv/etc/fedora-objects/ilives_pageCModel.xml - - - - - - - - - - - - - - - - - - - - - - - - - This DS-COMPOSITE-MODEL datastream is included as a starting point to - assist in the creation of a content model. The DS-COMPOSITE-MODEL - should define the datastreams that are required for any objects - conforming to this content model. - For more information about content models, see: - http://fedora-commons.org/confluence/x/dgBI. - For examples of completed content model objects, see the demonstration - objects included with your Fedora distribution, such as: - demo:CMImage, demo:UVA_STD_IMAGE, demo:DualResImageCollection, - demo:TEI_TO_PDFDOC, and demo:XML_TO_HTMLDOC. - For more information about the demonstration objects, see: - http://fedora-commons.org/confluence/x/AwFI. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Page Content Model - ilives:pageCModel - - - - - diff --git a/ilives/xml/ilives_tei2htmlSdef.xml b/ilives/xml/ilives_tei2htmlSdef.xml deleted file mode 100644 index f626c690..00000000 --- a/ilives/xml/ilives_tei2htmlSdef.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2009-11-12T14:57:01.057Z - Ingested from local file /Users/aoneill/dev/iiv/iiv/etc/fedora-objects/ilives_tei2htmlSdef.xml - - - - - - - - - - - - - - - - - - - - - ilives:tei2htmlSdef - ilives:tei2htmlSdef - - - - - - - - - - - - - - diff --git a/ilives/xml/ilives_tei2htmlSdep-pageCModel.xml b/ilives/xml/ilives_tei2htmlSdep-pageCModel.xml deleted file mode 100644 index 3a2c5d9a..00000000 --- a/ilives/xml/ilives_tei2htmlSdep-pageCModel.xml +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2009-11-12T14:57:01.366Z - Ingested from local file /Users/aoneill/dev/iiv/iiv/etc/fedora-objects/ilives_tei2htmlSdep-pageCModel.xml - - - - modifyDatastreamByValue - XSL - fedoraAdmin - 2009-12-11T19:09:52.417Z - - - - - modifyDatastreamByValue - XSL - fedoraAdmin - 2009-12-11T19:22:11.096Z - - - - - - - - - - - - - - - - - - - - - - - - ilives:tei2htmlSdep-pageCModel - ilives:tei2htmlSdep-pageCModel - - - - - - - - - - TEI - text/xml - - - - XSL - text/xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <xsl:value-of select="normalize-space(tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title)"/> - - - - - - - - -
    - -
    -
    - -

    - -

    -
    - - - - - - - - - - - search persName - _blank - http://islandlives.net/fedora/ilives_book_search/tei.persNameTERM:%22+%22+AND+dc.type:collection - - - - - - - - - - - - search placeName - _blank - http://islandlives.net/fedora/ilives_book_search/tei.placeNameTERM:%22%22+AND+dc.type:collection - - - - - - search orgName - _blank - http://islandlives.net/fedora/ilives_book_search/tei.orgNameTERM:%22%22+AND+dc.type:collection - - - - -
    -
    -
    -
    -
    diff --git a/ilives/xml/ilives_viewerSdef.xml b/ilives/xml/ilives_viewerSdef.xml deleted file mode 100644 index a97c50a2..00000000 --- a/ilives/xml/ilives_viewerSdef.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2009-11-12T17:09:29.912Z - Ingested from local file /Users/aoneill/dev/iiv/iiv/etc/fedora-objects/ilives_viewerSdef.xml - - - - - - - - - - - - - - - - - - - - - ilives:viewerSdef - ilives:viewerSdef - - - - - - - - - - - - - - diff --git a/ilives/xml/ilives_viewerSdep-bookCModel.xml b/ilives/xml/ilives_viewerSdep-bookCModel.xml deleted file mode 100644 index e5688998..00000000 --- a/ilives/xml/ilives_viewerSdep-bookCModel.xml +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2009-11-12T17:09:41.797Z - Ingested from local file /Users/aoneill/dev/iiv/iiv/etc/fedora-objects/ilives_viewerSdep-bookCModel.xml - - - - - - - - - - ilives:viewerSdep-bookCModel - ilives:viewerSdep-bookCModel - - - - - - - - - - - - - - - - - - - - - - - DC - text/xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ilives/xml/ilives_viewerSdep-pageCModel.xml b/ilives/xml/ilives_viewerSdep-pageCModel.xml deleted file mode 100644 index 6b30cd67..00000000 --- a/ilives/xml/ilives_viewerSdep-pageCModel.xml +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2009-11-24T14:52:27.296Z - Ingested from local file /Users/aoneill/dev/iiv/iiv/etc/fedora-objects/ilives_viewerSdep-pageCModel.xml - - - - - - - - - - - - - - - - - - - - - - - ilives:viewerSdep-pageCModel - ilives:viewerSdep-pageCModel - - - - - - - - - - - - - - - - - - - - - - - - - DC - text/xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ilives/xsl/book_view.xsl b/ilives/xsl/book_view.xsl deleted file mode 100644 index a8bfb825..00000000 --- a/ilives/xsl/book_view.xsl +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - -

    - :

    -

    - -

    -
    -
    - - fedora/repository//TN - - - - - -
    - - - - - - - - -
    By Statement:
    Place of Publication:
    Publisher:
    Date:
    Language:
    Pagination:
    ISBN 10:
    Subjects: - - fedora/ilives_book_search/mods.subject:""%20AND%20dc.type:collection%20AND%20dc.type:ingested - - -
    -
    - - - - - - -
    - -
    -
    \ No newline at end of file diff --git a/ilives/xsl/book_view.xsl.bak b/ilives/xsl/book_view.xsl.bak deleted file mode 100644 index 4acce98b..00000000 --- a/ilives/xsl/book_view.xsl.bak +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - -

    - :

    -

    - -

    -
    -
    - - fedora/repository//TN - - - - - -
    - - - - - - - - -
    By Statement:
    Place of Publication:
    Publisher:
    Date:
    Language:
    Pagination:
    ISBN 10:
    Subjects: - - fedora/repository/mnpl_advanced_search/mods.subject:"" - - -
    -
    - -
    -
    \ No newline at end of file diff --git a/ilives/xsl/book_view.xsl2009-05-26 b/ilives/xsl/book_view.xsl2009-05-26 deleted file mode 100644 index d05a0341..00000000 --- a/ilives/xsl/book_view.xsl2009-05-26 +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - -

    - :

    -

    - -

    -
    -
    - - fedora/repository//TN - - - - - -
    - - - - - - - - -
    By Statement:
    Place of Publication:
    Publisher:
    Date:
    Language:
    Pagination:
    ISBN 10:
    Subjects: - - fedora/repository/mnpl_advanced_search/mods.subject:"" - - -
    -
    - -
    -
    \ No newline at end of file diff --git a/ilives/xsl/pageResults.xsl b/ilives/xsl/pageResults.xsl deleted file mode 100644 index fccee47a..00000000 --- a/ilives/xsl/pageResults.xsl +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Total Hits = - - , - - -
    We have repeated your search within this book and found results on the following pages. - -
    - - - - -
    - -
    -
    - - - -
    - - - - - - - - - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - fedora/ilives_book_viewer/ - - - Thumbnail - - - fedora/repository//TN - - - -
    - - - fedora/ilives_book_viewer/ - - -
    -
    - - - - - - - -
    - - - - -   - - - - - - - -
    diff --git a/ilives/xsl/results.xsl b/ilives/xsl/results.xsl deleted file mode 100644 index 0757ea1e..00000000 --- a/ilives/xsl/results.xsl +++ /dev/null @@ -1,344 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Total Hits = , - Number of Hits/page = - - -
    - -
    - - - - - - - - -
    - -
    - -

    Your search yielded no results

    - -
      -
    • Check if your spelling is correct.
    • - -
    • Remove quotes around phrases to match each word individually: "blue smurf" will match less than blue smurf.
    • -
    • Consider loosening your query with OR: blue smurf will match less than blue OR smurf.
    • -
    - -
    - -
    -
    -
    - - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - fedora/ilives// - - - - fedora/repository//TN - - 100 - - - - - - - - - - - - - - - fedora/ilives// - - - - - - - - - - : - - - - - - - - - - - / - - - - - - - - - - - - - - : - - - - - - - , . - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    diff --git a/installer_files/foxml/islandora-collectionCModel.xml b/installer_files/foxml/islandora-collectionCModel.xml index 9ae3a9cb..83876580 100644 --- a/installer_files/foxml/islandora-collectionCModel.xml +++ b/installer_files/foxml/islandora-collectionCModel.xml @@ -1,182 +1,182 @@ - - - - - - - - - + + + + + + + + - - - - - ingest - - admin - 2011-01-24T20:34:53.430Z - Fedora Object Ingested - - - - addDatastream - RELS-EXT - admin - 2011-01-24T20:34:54.112Z - Ingested object RELS-EXT - - - - modifyDatastreamByValue - RELS-EXT - admin - 2011-01-24T20:34:54.528Z - Modified by Islandora API - - - - addDatastream - ISLANDORACM - admin - 2011-01-24T20:34:54.711Z - Ingested object ISLANDORACM - - - - - - - + + + + ingest + + admin + 2011-01-24T20:34:53.430Z + Fedora Object Ingested + + + + addDatastream + RELS-EXT + admin + 2011-01-24T20:34:54.112Z + Ingested object RELS-EXT + + + + modifyDatastreamByValue + RELS-EXT + admin + 2011-01-24T20:34:54.528Z + Modified by Islandora API + + + + addDatastream + ISLANDORACM + admin + 2011-01-24T20:34:54.711Z + Ingested object ISLANDORACM + + + + + + + - - + - Islandora Collection Content Model - islandora:collectionCModel - - - - - - Islandora Collection Content Model + islandora:collectionCModel + + + + + + - - - - - - - + + + + + + - - - - - - - - - - - + + + + + + + + + + - - + - - text/xml - text/plain - application/xml - - - - - - - - - - - + text/xml + text/plain + application/xml + + + + + + + + + + + - - - The name given to the resource - - - An entity primarily responsible for making the content of the resource such as a person, organization or service. - - - An entity primarily responsible for making the content of the resource such as a person, organization or service. - - none - Multi Media - image - meeting - presentation - sound - text - - - - Examples include an abstract, table of contents, or free-text account of the content of the resource. - - - An entity, (including persons, organizations, or services), responsible for making the resource available. - - - An entity responsible for contributing to the content of the resource such as a person, organization or service. - - - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - - - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - - none - collection - dataset - event - image - interactive resource - model - party - physical object - place - service - software - sound - text - - - - A reference to a resource from which the present resource is derived. - - - A unique reference to the resource; In this instance, the accession number or collection number. - - - The language of the intellectual content of the resource. - - English - French - - - - Reference to a related resource. - - - Information about intellectual property rights, copyright, and various property rights. - - - - - - - + + + The name given to the resource + + + An entity primarily responsible for making the content of the resource such as a person, organization or service. + + + An entity primarily responsible for making the content of the resource such as a person, organization or service. + + none + Multi Media + image + meeting + presentation + sound + text + + + + Examples include an abstract, table of contents, or free-text account of the content of the resource. + + + An entity, (including persons, organizations, or services), responsible for making the resource available. + + + An entity responsible for contributing to the content of the resource such as a person, organization or service. + + + Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) + + + Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. + + none + collection + dataset + event + image + interactive resource + model + party + physical object + place + service + software + sound + text + + + + A reference to a resource from which the present resource is derived. + + + A unique reference to the resource; In this instance, the accession number or collection number. + + + The language of the intellectual content of the resource. + + English + French + + + + Reference to a related resource. + + + Information about intellectual property rights, copyright, and various property rights. + + + + + + + diff --git a/installer_files/foxml/islandora-demos.xml b/installer_files/foxml/islandora-demos.xml index 4e59cf29..a5f7f081 100644 --- a/installer_files/foxml/islandora-demos.xml +++ b/installer_files/foxml/islandora-demos.xml @@ -1,5 +1,5 @@ - Islandora Demo Collections - islandora:demos + Islandora Demo Collections + islandora:demos diff --git a/installer_files/foxml/islandora-pdfcollection.xml b/installer_files/foxml/islandora-pdfcollection.xml index b57cb712..e1f658c3 100644 --- a/installer_files/foxml/islandora-pdfcollection.xml +++ b/installer_files/foxml/islandora-pdfcollection.xml @@ -1,186 +1,186 @@ - - - - - - - - - + + + + + + + + - - - - - ingest - - admin - 2009-04-02T14:39:19.525Z - Fedora Object Ingested - - - - addDatastream - TN - fedoraAdmin - 2009-04-02T17:06:32.540Z - DatastreamsPane generated this logMessage. - - - - purgeDatastream - COLLECTION_POLICY - fedoraAdmin - 2009-04-02T17:10:50.929Z - DatastreamPane generated this logMessage. . . . Purged datastream (ID=COLLECTION_POLICY), versions ranging from 2009-04-02T11:39:19.554Z to 2009-04-02T11:39:19.554Z. This resulted in the permanent removal of 1 datastream version(s) (2009-04-02T11:39:19.554Z) and all associated audit records. - - - - addDatastream - COLLECTION_POLICY - fedoraAdmin - 2009-04-02T17:11:49.698Z - DatastreamsPane generated this logMessage. - - - - ingest - - aoneill - 2010-10-11T23:08:16.035Z - Fedora Object Ingested - - - - addDatastream - TN - aoneill - 2010-10-11T23:08:16.169Z - Ingested object TN - - - - - - - + + + + ingest + + admin + 2009-04-02T14:39:19.525Z + Fedora Object Ingested + + + + addDatastream + TN + fedoraAdmin + 2009-04-02T17:06:32.540Z + DatastreamsPane generated this logMessage. + + + + purgeDatastream + COLLECTION_POLICY + fedoraAdmin + 2009-04-02T17:10:50.929Z + DatastreamPane generated this logMessage. . . . Purged datastream (ID=COLLECTION_POLICY), versions ranging from 2009-04-02T11:39:19.554Z to 2009-04-02T11:39:19.554Z. This resulted in the permanent removal of 1 datastream version(s) (2009-04-02T11:39:19.554Z) and all associated audit records. + + + + addDatastream + COLLECTION_POLICY + fedoraAdmin + 2009-04-02T17:11:49.698Z + DatastreamsPane generated this logMessage. + + + + ingest + + aoneill + 2010-10-11T23:08:16.035Z + Fedora Object Ingested + + + + addDatastream + TN + aoneill + 2010-10-11T23:08:16.169Z + Ingested object TN + + + + + + + - - + - - - - - - - - - - - - + + + + + + + + + + + - PDF COllection - - none - A bunch of PDFs - - - - none - - islandora:collection-18 - - eng - - - - - - - - PDF COllection + + none + A bunch of PDFs + + + + none + + islandora:collection-18 + + eng + + + + + + + + - - - - - islandora:strictpdf - islandora:strict_pdf - ISLANDORACM - - - isMemberOfCollection - - dc.description - - dc.title - dc.title - - - dc.creator - dc.creator - - - dc.description - dc.description - - - dc.date - dc.date - - - dc.identifier - dc.identifier - - - dc.language - dc.language - - - dc.publisher - dc.publisher - - - dc.rights - dc.rights - - - dc.subject - dc.subject - - - dc.relation - dc.relation - - - dcterms.temporal - dcterms.temporal - - - dcterms.spatial - dcterms.spatial - - - fgs.DS.first.text - Full Text - - - - - - - - - - - + + + + + islandora:strictpdf + islandora:strict_pdf + ISLANDORACM + + + isMemberOfCollection + + dc.description + + dc.title + dc.title + + + dc.creator + dc.creator + + + dc.description + dc.description + + + dc.date + dc.date + + + dc.identifier + dc.identifier + + + dc.language + dc.language + + + dc.publisher + dc.publisher + + + dc.rights + dc.rights + + + dc.subject + dc.subject + + + dc.relation + dc.relation + + + dcterms.temporal + dcterms.temporal + + + dcterms.spatial + dcterms.spatial + + + fgs.DS.first.text + Full Text + + + + + + + + + + + diff --git a/installer_files/foxml/islandora-root.xml b/installer_files/foxml/islandora-root.xml new file mode 100644 index 00000000..8c7fa1ac --- /dev/null +++ b/installer_files/foxml/islandora-root.xml @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + ingest + + fedoraAdmin + 2009-03-23T16:42:07.367Z + Created with Admin GUI "New Object" command + + + + addDatastream + RELS-EXT + fedoraAdmin + 2009-03-23T16:47:49.180Z + + + + + addDatastream + COLLECTION_POLICY + fedoraAdmin + 2009-03-23T16:49:38.149Z + DatastreamsPane generated this logMessage. + + + + ingest + + admin + 2009-03-27T15:56:09.271Z + Fedora Object Ingested + + + + addDatastream + TN + admin + 2009-03-27T15:56:09.381Z + Ingested object TN + + + + purgeDatastream + COLLECTION_POLICY + fedoraAdmin + 2009-03-30T14:31:16.296Z + DatastreamPane generated this logMessage. . . . Purged datastream (ID=COLLECTION_POLICY), versions ranging from 2009-03-23T13:49:38.149Z to 2009-03-23T13:49:38.149Z. This resulted in the permanent removal of 1 datastream version(s) (2009-03-23T13:49:38.149Z) and all associated audit records. + + + + ingest + + aoneill + 2010-10-11T23:08:15.103Z + Fedora Object Ingested + + + + addDatastream + COLLECTION_POLICY + aoneill + 2010-10-11T23:08:15.240Z + Ingested object COLLECTION_POLICY + + + + addDatastream + TN + aoneill + 2010-10-11T23:08:15.373Z + Ingested object TN + + + + + + + + + + Islandora Top-Level Collection + islandora:root + + + + + + + + + + + + + + + + + + + + + + + + dc.title + dc.creator + dc.description + dc.date + dc.identifier + dc.language + dc.publisher + dc.rights + dc.subject + dc.relation + dcterms.temporal + dcterms.spatial + Full Text + + isMemberOfCollection + + + + + + + + + + diff --git a/installer_files/foxml/islandora-strictpdfCModel.xml b/installer_files/foxml/islandora-strictpdfCModel.xml index ddebd132..9a6ded18 100644 --- a/installer_files/foxml/islandora-strictpdfCModel.xml +++ b/installer_files/foxml/islandora-strictpdfCModel.xml @@ -1,105 +1,105 @@ - - - - - - - - - + + + + + + + + - - - - - ingest - - fedoraAdmin - 2009-02-26T14:50:44.411Z - Created with Admin GUI "New Object" command - - - - addDatastream - ISLANDORACM - fedoraAdmin - 2009-02-26T14:52:58.161Z - DatastreamsPane generated this logMessage. - - - - purgeDatastream - ISLANDORACM - fedoraAdmin - 2009-03-31T18:33:27.172Z - DatastreamPane generated this logMessage. . . . Purged datastream (ID=ISLANDORACM), versions ranging from 2009-02-26T10:52:58.161Z to 2009-02-26T10:52:58.161Z. This resulted in the permanent removal of 1 datastream version(s) (2009-02-26T10:52:58.161Z) and all associated audit records. - - - - ingest - - admin - 2009-09-14T14:09:06.847Z - Fedora Object Ingested - - - - addDatastream - ISLANDORACM - fedoraAdmin - 2010-03-08T20:08:32.004Z - DatastreamsPane generated this logMessage. - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-09-30T17:11:42.958Z - - - - - modifyDatastreamByValue - ISLANDORACM - fedoraAdmin - 2010-09-30T17:12:24.421Z - - - - - addDatastream - pdf_test - avc_db - 2010-10-06T16:04:03.630Z - Ingested object pdf_test - - - - - - - + + + + ingest + + fedoraAdmin + 2009-02-26T14:50:44.411Z + Created with Admin GUI "New Object" command + + + + addDatastream + ISLANDORACM + fedoraAdmin + 2009-02-26T14:52:58.161Z + DatastreamsPane generated this logMessage. + + + + purgeDatastream + ISLANDORACM + fedoraAdmin + 2009-03-31T18:33:27.172Z + DatastreamPane generated this logMessage. . . . Purged datastream (ID=ISLANDORACM), versions ranging from 2009-02-26T10:52:58.161Z to 2009-02-26T10:52:58.161Z. This resulted in the permanent removal of 1 datastream version(s) (2009-02-26T10:52:58.161Z) and all associated audit records. + + + + ingest + + admin + 2009-09-14T14:09:06.847Z + Fedora Object Ingested + + + + addDatastream + ISLANDORACM + fedoraAdmin + 2010-03-08T20:08:32.004Z + DatastreamsPane generated this logMessage. + + + + modifyDatastreamByValue + ISLANDORACM + fedoraAdmin + 2010-09-30T17:11:42.958Z + + + + + modifyDatastreamByValue + ISLANDORACM + fedoraAdmin + 2010-09-30T17:12:24.421Z + + + + + addDatastream + pdf_test + avc_db + 2010-10-06T16:04:03.630Z + Ingested object pdf_test + + + + + + + - - - - - - - - - - - + + + + + + + + + + - - - + + + This DS-COMPOSITE-MODEL datastream is included as a starting point to assist in the creation of a content model. The DS-COMPOSITE-MODEL should define the datastreams that are required for any objects @@ -112,697 +112,697 @@ demo:TEI_TO_PDFDOC, and demo:XML_TO_HTMLDOC. For more information about the demonstration objects, see: http://fedora-commons.org/confluence/x/AwFI. - - - - - - - - - - + + + + + + + + + - - + - Strict PDF - islandora:strict_pdf - - - - - - Strict PDF + islandora:strict_pdf + + + + + + - - - - - - plugins/ShowStreamsInFieldSets.php - ShowStreamsInFieldSets - showPDFPreview - - - - application/pdf - - plugins/ImageManipulation.php - ImageManipulation - createThumbnailFromPDF - jpg - TN - - 100 - 120 - - - - - - application/pdf - - - - + + + + + + plugins/ShowStreamsInFieldSets.php + ShowStreamsInFieldSets + showPDFPreview + + + + application/pdf + + plugins/ImageManipulation.php + ImageManipulation + createThumbnailFromPDF + jpg + TN + + 100 + 120 + + + + + + application/pdf + + + + application/pdf - - - - plugins/ImageManipulation.php - ImageManipulation - createThumbnailFromPDF - jpg - TN - - 100 - 120 - - - - - - dis1 - - + + + + plugins/ImageManipulation.php + ImageManipulation + createThumbnailFromPDF + jpg + TN + + 100 + 120 + + + + + + dis1 + + 200 - - - - - - - - - - - - - - - - - - - - - plugins/FormBuilder.php - FormBuilder - buildQDCForm - handleQDCForm - - - - - dc:title - textfield - The name given to the resource - true - - - - dc:creator - textfield - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - dc:subject - select - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - experiment session - experiment session - - - home recording - home recording - - - image - image - - - meeting - meeting - - - presentation - presentation - - - sound - sound - - - text - text - - - - - - dc:description - textarea - Examples include an abstract, table of contents, or free-text account of the content of the resource. - true - - - - dc:publisher - textfield - An entity, (including persons, organizations, or services), responsible for making the resource available. - false - - - - dc:contributor - textfield - An entity responsible for contributing to the content of the resource such as a person, organization or service. - false - - - - dc:date - textfield - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - false - - - - dc:type - select - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - false - - - none - none - - - collection - collection - - - dataset - dataset - - - event - event - - - image - image - - - interactive resource - interactive resource - - - model - model - - - party - party - - - physical object - physical object - - - place - place - - - service - service - - - software - software - - - sound - sound - - - text - text - - - - - - dc:source - textfield - A reference to a resource from which the present resource is derived. - false - - - - dc:identifier - textfield - A unique reference to the resource; In this instance, the accession number or collection number. - false - - - - dc:language - select - The language of the intellectual content of the resource. - false - - - eng - English - - - fre - French - - - - - - dc:relation - textfield - Reference to a related resource. - false - - - - dc:rights - textarea - Information about intellectual property rights, copyright, and various property rights. - false - - - - - - - + + + + + + + + + + + + + + + + + + + + plugins/FormBuilder.php + FormBuilder + buildQDCForm + handleQDCForm + + + + + dc:title + textfield + The name given to the resource + true + + + + dc:creator + textfield + An entity primarily responsible for making the content of the resource such as a person, organization or service. + false + + + + dc:subject + select + An entity primarily responsible for making the content of the resource such as a person, organization or service. + false + + + experiment session + experiment session + + + home recording + home recording + + + image + image + + + meeting + meeting + + + presentation + presentation + + + sound + sound + + + text + text + + + + + + dc:description + textarea + Examples include an abstract, table of contents, or free-text account of the content of the resource. + true + + + + dc:publisher + textfield + An entity, (including persons, organizations, or services), responsible for making the resource available. + false + + + + dc:contributor + textfield + An entity responsible for contributing to the content of the resource such as a person, organization or service. + false + + + + dc:date + textfield + Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) + false + + + + dc:type + select + Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. + false + + + none + none + + + collection + collection + + + dataset + dataset + + + event + event + + + image + image + + + interactive resource + interactive resource + + + model + model + + + party + party + + + physical object + physical object + + + place + place + + + service + service + + + software + software + + + sound + sound + + + text + text + + + + + + dc:source + textfield + A reference to a resource from which the present resource is derived. + false + + + + dc:identifier + textfield + A unique reference to the resource; In this instance, the accession number or collection number. + false + + + + dc:language + select + The language of the intellectual content of the resource. + false + + + eng + English + + + fre + French + + + + + + dc:relation + textfield + Reference to a related resource. + false + + + + dc:rights + textarea + Information about intellectual property rights, copyright, and various property rights. + false + + + + + + + - - - - - - plugins/ShowStreamsInFieldSets.inc - ShowStreamsInFieldSets - showPDFPreview - - - - application/pdf - - plugins/ImageManipulation.inc - ImageManipulation - createThumbnailFromPDF - jpg - TN - - 100 - 120 - - - - - - application/pdf - - - - + + + + + + plugins/ShowStreamsInFieldSets.inc + ShowStreamsInFieldSets + showPDFPreview + + + + application/pdf + + plugins/ImageManipulation.inc + ImageManipulation + createThumbnailFromPDF + jpg + TN + + 100 + 120 + + + + + + application/pdf + + + + application/pdf - - - - plugins/ImageManipulation.inc - ImageManipulation - createThumbnailFromPDF - jpg - TN - - 100 - 120 - - - - - - dis1 - - + + + + plugins/ImageManipulation.inc + ImageManipulation + createThumbnailFromPDF + jpg + TN + + 100 + 120 + + + + + + dis1 + + 200 - - - - - - - - - - - - - - - - - - - - - plugins/FormBuilder.inc - FormBuilder - buildQDCForm - handleQDCForm - - - - - dc:title - textfield - The name given to the resource - true - - - - dc:creator - textfield - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - - dc:subject - select - An entity primarily responsible for making the content of the resource such as a person, organization or service. - false - - - experiment session - experiment session - - - home recording - home recording - - - image - image - - - meeting - meeting - - - presentation - presentation - - - sound - sound - - - text - text - - - - - - dc:description - textarea - Examples include an abstract, table of contents, or free-text account of the content of the resource. - true - - - - dc:publisher - textfield - An entity, (including persons, organizations, or services), responsible for making the resource available. - false - - - - dc:contributor - textfield - An entity responsible for contributing to the content of the resource such as a person, organization or service. - false - - - - dc:date - textfield - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - false - - - - dc:type - select - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - false - - - none - none - - - collection - collection - - - dataset - dataset - - - event - event - - - image - image - - - interactive resource - interactive resource - - - model - model - - - party - party - - - physical object - physical object - - - place - place - - - service - service - - - software - software - - - sound - sound - - - text - text - - - - - - dc:source - textfield - A reference to a resource from which the present resource is derived. - false - - - - dc:identifier - textfield - A unique reference to the resource; In this instance, the accession number or collection number. - false - - - - dc:language - select - The language of the intellectual content of the resource. - false - - - eng - English - - - fre - French - - - - - - dc:relation - textfield - Reference to a related resource. - false - - - - dc:rights - textarea - Information about intellectual property rights, copyright, and various property rights. - false - - - - - - - + + + + + + + + + + + + + + + + + + + + plugins/FormBuilder.inc + FormBuilder + buildQDCForm + handleQDCForm + + + + + dc:title + textfield + The name given to the resource + true + + + + dc:creator + textfield + An entity primarily responsible for making the content of the resource such as a person, organization or service. + false + + + + dc:subject + select + An entity primarily responsible for making the content of the resource such as a person, organization or service. + false + + + experiment session + experiment session + + + home recording + home recording + + + image + image + + + meeting + meeting + + + presentation + presentation + + + sound + sound + + + text + text + + + + + + dc:description + textarea + Examples include an abstract, table of contents, or free-text account of the content of the resource. + true + + + + dc:publisher + textfield + An entity, (including persons, organizations, or services), responsible for making the resource available. + false + + + + dc:contributor + textfield + An entity responsible for contributing to the content of the resource such as a person, organization or service. + false + + + + dc:date + textfield + Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) + false + + + + dc:type + select + Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. + false + + + none + none + + + collection + collection + + + dataset + dataset + + + event + event + + + image + image + + + interactive resource + interactive resource + + + model + model + + + party + party + + + physical object + physical object + + + place + place + + + service + service + + + software + software + + + sound + sound + + + text + text + + + + + + dc:source + textfield + A reference to a resource from which the present resource is derived. + false + + + + dc:identifier + textfield + A unique reference to the resource; In this instance, the accession number or collection number. + false + + + + dc:language + select + The language of the intellectual content of the resource. + false + + + eng + English + + + fre + French + + + + + + dc:relation + textfield + Reference to a related resource. + false + + + + dc:rights + textarea + Information about intellectual property rights, copyright, and various property rights. + false + + + + + + + - - + - - application/pdf - - - - application/pdf - - + application/pdf + + + + application/pdf + + - - 100 - 120 - - - - - - - - + 100 + 120 + + + + + + + + - - - + + - - 100 - 120 - - - - - - + 100 + 120 + + + + + + - - - The name given to the resource - - - An entity primarily responsible for making the content of the resource such as a person, organization or service. - - - An entity primarily responsible for making the content of the resource such as a person, organization or service. - - experiment session - home recording - image - meeting - presentation - sound - text - - - - Examples include an abstract, table of contents, or free-text account of the content of the resource. - - - An entity, (including persons, organizations, or services), responsible for making the resource available. - - - An entity responsible for contributing to the content of the resource such as a person, organization or service. - - - Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) - - - Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. - - none - collection - dataset - event - image - interactive resource - model - party - physical object - place - service - software - sound - text - - - - A reference to a resource from which the present resource is derived. - - - A unique reference to the resource; In this instance, the accession number or collection number. - - - The language of the intellectual content of the resource. - - English - French - - - - Reference to a related resource. - - - Information about intellectual property rights, copyright, and various property rights. - - - - - - - - - - + + The name given to the resource + + + An entity primarily responsible for making the content of the resource such as a person, organization or service. + + + An entity primarily responsible for making the content of the resource such as a person, organization or service. + + experiment session + home recording + image + meeting + presentation + sound + text + + + + Examples include an abstract, table of contents, or free-text account of the content of the resource. + + + An entity, (including persons, organizations, or services), responsible for making the resource available. + + + An entity responsible for contributing to the content of the resource such as a person, organization or service. + + + Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) + + + Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. + + none + collection + dataset + event + image + interactive resource + model + party + physical object + place + service + software + sound + text + + + + A reference to a resource from which the present resource is derived. + + + A unique reference to the resource; In this instance, the accession number or collection number. + + + The language of the intellectual content of the resource. + + English + French + + + + Reference to a related resource. + + + Information about intellectual property rights, copyright, and various property rights. + + + + + + + + + + - - - + + diff --git a/installer_files/foxml/islandora-top.xml b/installer_files/foxml/islandora-top.xml deleted file mode 100644 index 523fb29c..00000000 --- a/installer_files/foxml/islandora-top.xml +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2009-03-23T16:42:07.367Z - Created with Admin GUI "New Object" command - - - - addDatastream - RELS-EXT - fedoraAdmin - 2009-03-23T16:47:49.180Z - - - - - addDatastream - COLLECTION_POLICY - fedoraAdmin - 2009-03-23T16:49:38.149Z - DatastreamsPane generated this logMessage. - - - - ingest - - admin - 2009-03-27T15:56:09.271Z - Fedora Object Ingested - - - - addDatastream - TN - admin - 2009-03-27T15:56:09.381Z - Ingested object TN - - - - purgeDatastream - COLLECTION_POLICY - fedoraAdmin - 2009-03-30T14:31:16.296Z - DatastreamPane generated this logMessage. . . . Purged datastream (ID=COLLECTION_POLICY), versions ranging from 2009-03-23T13:49:38.149Z to 2009-03-23T13:49:38.149Z. This resulted in the permanent removal of 1 datastream version(s) (2009-03-23T13:49:38.149Z) and all associated audit records. - - - - ingest - - aoneill - 2010-10-11T23:08:15.103Z - Fedora Object Ingested - - - - addDatastream - COLLECTION_POLICY - aoneill - 2010-10-11T23:08:15.240Z - Ingested object COLLECTION_POLICY - - - - addDatastream - TN - aoneill - 2010-10-11T23:08:15.373Z - Ingested object TN - - - - - - - - - - Islandora Top-Level Collection - islandora:top - - - - - - - - - - - - - - - - - - - - - - - - dc.title - dc.creator - dc.description - dc.date - dc.identifier - dc.language - dc.publisher - dc.rights - dc.subject - dc.relation - dcterms.temporal - dcterms.spatial - Full Text - - isMemberOfCollection - - - - - - - - - - diff --git a/islandoracm.xsd b/islandoracm.xsd index 8fc5c0ef..bce83136 100644 --- a/islandoracm.xsd +++ b/islandoracm.xsd @@ -1,385 +1,386 @@ + - - + + Islandora Content Model Schema Islandora, Robertson Library, University of Prince Edward Island, 550 University Ave., Charlottetown, Prince Edward Island - - + + - - - - - - - - + + + + + + + + - - - - + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - + + + + + - - - + + - - - + + + - - - + + - - - - - - + + + + + + - - - - - - - + + + + + + + - - - + + - - + + - - - + + - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - + - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - + + + + + + + + - - - + - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/js/AC_Quicktime.js b/js/AC_Quicktime.js index 182dc0b5..409fcdca 100644 --- a/js/AC_Quicktime.js +++ b/js/AC_Quicktime.js @@ -55,7 +55,7 @@ Copyright © 2006-2007 Apple Computer, Inc., All Rights Reserved /************** LOCALIZABLE GLOBAL VARIABLES ****************/ var gArgCountErr = 'The "%%" function requires an even number of arguments.' - + '\nArguments should be in the form "atttributeName", "attributeValue", ...'; ++ '\nArguments should be in the form "atttributeName", "attributeValue", ...'; /******************** END LOCALIZABLE **********************/ @@ -64,299 +64,301 @@ var gQTGeneratorVersion = 1.2; var gQTBehaviorID = "qt_event_source"; var gQTEventsEnabled = false; -function AC_QuickTimeVersion() { return gQTGeneratorVersion; } +function AC_QuickTimeVersion() { + return gQTGeneratorVersion; +} function _QTComplain(callingFcnName, errMsg) { errMsg = errMsg.replace("%%", callingFcnName); - alert(errMsg); + alert(errMsg); } function _QTIsMSIE() { var ua = navigator.userAgent.toLowerCase(); - var msie = /msie/.test(ua) && !/opera/.test(ua); + var msie = /msie/.test(ua) && !/opera/.test(ua); - return msie; + return msie; } function _QTGenerateBehavior() { - return objTag = ''; + return objTag = ''; } function _QTPageHasBehaviorObject(callingFcnName, args) { - var haveBehavior = false; - var objects = document.getElementsByTagName('object'); + var haveBehavior = false; + var objects = document.getElementsByTagName('object'); - for ( var ndx = 0, obj; obj = objects[ndx]; ndx++ ) - { - if ( obj.getAttribute('classid') == "clsid:CB927D12-4FF7-4a9e-A169-56E4B8A75598" ) - { - if ( obj.getAttribute('id') == gQTBehaviorID ) - haveBehavior = false; - break; - } - } - - return haveBehavior; + for ( var ndx = 0, obj; obj = objects[ndx]; ndx++ ) + { + if ( obj.getAttribute('classid') == "clsid:CB927D12-4FF7-4a9e-A169-56E4B8A75598" ) + { + if ( obj.getAttribute('id') == gQTBehaviorID ) + haveBehavior = false; + break; + } + } + + return haveBehavior; } function _QTShouldInsertBehavior() { - var shouldDo = false; + var shouldDo = false; - if ( gQTEventsEnabled && _QTIsMSIE() && !_QTPageHasBehaviorObject() ) - shouldDo = true; + if ( gQTEventsEnabled && _QTIsMSIE() && !_QTPageHasBehaviorObject() ) + shouldDo = true; - return shouldDo; + return shouldDo; } function _QTAddAttribute(prefix, slotName, tagName) { - var value; - - value = gTagAttrs[prefix + slotName]; - if ( null == value ) - value = gTagAttrs[slotName]; - - if ( null != value ) - { - if ( 0 == slotName.indexOf(prefix) && (null == tagName) ) - tagName = slotName.substring(prefix.length); - if ( null == tagName ) - tagName = slotName; - return ' ' + tagName + '="' + value + '"'; - } - else - return ""; + var value; + + value = gTagAttrs[prefix + slotName]; + if ( null == value ) + value = gTagAttrs[slotName]; + + if ( null != value ) + { + if ( 0 == slotName.indexOf(prefix) && (null == tagName) ) + tagName = slotName.substring(prefix.length); + if ( null == tagName ) + tagName = slotName; + return ' ' + tagName + '="' + value + '"'; + } + else + return ""; } function _QTAddObjectAttr(slotName, tagName) { - // don't bother if it is only for the embed tag - if ( 0 == slotName.indexOf("emb#") ) - return ""; + // don't bother if it is only for the embed tag + if ( 0 == slotName.indexOf("emb#") ) + return ""; - if ( 0 == slotName.indexOf("obj#") && (null == tagName) ) - tagName = slotName.substring(4); + if ( 0 == slotName.indexOf("obj#") && (null == tagName) ) + tagName = slotName.substring(4); - return _QTAddAttribute("obj#", slotName, tagName); + return _QTAddAttribute("obj#", slotName, tagName); } function _QTAddEmbedAttr(slotName, tagName) { - // don't bother if it is only for the object tag - if ( 0 == slotName.indexOf("obj#") ) - return ""; + // don't bother if it is only for the object tag + if ( 0 == slotName.indexOf("obj#") ) + return ""; - if ( 0 == slotName.indexOf("emb#") && (null == tagName) ) - tagName = slotName.substring(4); + if ( 0 == slotName.indexOf("emb#") && (null == tagName) ) + tagName = slotName.substring(4); - return _QTAddAttribute("emb#", slotName, tagName); + return _QTAddAttribute("emb#", slotName, tagName); } function _QTAddObjectParam(slotName, generateXHTML) { - var paramValue; - var paramStr = ""; - var endTagChar = (generateXHTML) ? ' />' : '>'; - - if ( -1 == slotName.indexOf("emb#") ) - { - // look for the OBJECT-only param first. if there is none, look for a generic one - paramValue = gTagAttrs["obj#" + slotName]; - if ( null == paramValue ) - paramValue = gTagAttrs[slotName]; - - if ( 0 == slotName.indexOf("obj#") ) - slotName = slotName.substring(4); + var paramValue; + var paramStr = ""; + var endTagChar = (generateXHTML) ? ' />' : '>'; + + if ( -1 == slotName.indexOf("emb#") ) + { + // look for the OBJECT-only param first. if there is none, look for a generic one + paramValue = gTagAttrs["obj#" + slotName]; + if ( null == paramValue ) + paramValue = gTagAttrs[slotName]; + + if ( 0 == slotName.indexOf("obj#") ) + slotName = slotName.substring(4); - if ( null != paramValue ) - paramStr = '' - + _QTAddObjectParam("src", generateXHTML); - var embedTag = ''; + // allocate an array, fill in the required attributes with fixed place params and defaults + gTagAttrs = new Object(); + gTagAttrs["src"] = args[0]; + gTagAttrs["width"] = args[1]; + gTagAttrs["height"] = args[2]; + gTagAttrs["classid"] = "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"; + //Impportant note: It is recommended that you use this exact classid in order to ensure a seamless experience for all viewers + gTagAttrs["pluginspage"] = "http://www.apple.com/quicktime/download/"; + + // set up codebase attribute with specified or default version before parsing args so + // anything passed in will override + var activexVers = args[3] + if ( (null == activexVers) || ("" == activexVers) ) + activexVers = "7,3,0,0"; + gTagAttrs["codebase"] = "http://www.apple.com/qtactivex/qtplugin.cab#version=" + activexVers; + + var attrName, + attrValue; + + // add all of the optional attributes to the array + for ( var ndx = 4; ndx < args.length; ndx += 2) + { + attrName = args[ndx].toLowerCase(); + attrValue = args[ndx + 1]; + + gTagAttrs[attrName] = attrValue; + + if ( ("postdomevents" == attrName) && (attrValue.toLowerCase() != "false") ) + { + gQTEventsEnabled = true; + if ( _QTIsMSIE() ) + gTagAttrs["obj#style"] = "behavior:url(#" + gQTBehaviorID + ")"; + } + } + + // init both tags with the required and "special" attributes + var objTag = '' + + _QTAddObjectParam("src", generateXHTML); + var embedTag = ''; } // return the object/embed as a string function QT_GenerateOBJECTText() { - var txt = _QTGenerate("QT_GenerateOBJECTText", false, arguments); - if ( _QTShouldInsertBehavior() ) - txt = _QTGenerateBehavior() + txt; - return txt; + var txt = _QTGenerate("QT_GenerateOBJECTText", false, arguments); + if ( _QTShouldInsertBehavior() ) + txt = _QTGenerateBehavior() + txt; + return txt; } function QT_GenerateOBJECTText_XHTML() { - var txt = _QTGenerate("QT_GenerateOBJECTText_XHTML", true, arguments); - if ( _QTShouldInsertBehavior() ) - txt = _QTGenerateBehavior() + txt; - return txt; + var txt = _QTGenerate("QT_GenerateOBJECTText_XHTML", true, arguments); + if ( _QTShouldInsertBehavior() ) + txt = _QTGenerateBehavior() + txt; + return txt; } function QT_WriteOBJECT() { - var txt = _QTGenerate("QT_WriteOBJECT", false, arguments); - if ( _QTShouldInsertBehavior() ) - document.writeln(_QTGenerateBehavior()); - document.writeln(txt); + var txt = _QTGenerate("QT_WriteOBJECT", false, arguments); + if ( _QTShouldInsertBehavior() ) + document.writeln(_QTGenerateBehavior()); + document.writeln(txt); } function QT_WriteOBJECT_XHTML() { - var txt = _QTGenerate("QT_WriteOBJECT_XHTML", true, arguments); - if ( _QTShouldInsertBehavior() ) - document.writeln(_QTGenerateBehavior()); - document.writeln(txt); + var txt = _QTGenerate("QT_WriteOBJECT_XHTML", true, arguments); + if ( _QTShouldInsertBehavior() ) + document.writeln(_QTGenerateBehavior()); + document.writeln(txt); } function QT_GenerateBehaviorOBJECT() { - return _QTGenerateBehavior(); + return _QTGenerateBehavior(); } function QT_ReplaceElementContents() { - var element = arguments[0]; - var args = []; + var element = arguments[0]; + var args = []; - // copy all other arguments we want to pass through to the fcn - for ( var ndx = 1; ndx < arguments.length; ndx++ ) - args.push(arguments[ndx]); + // copy all other arguments we want to pass through to the fcn + for ( var ndx = 1; ndx < arguments.length; ndx++ ) + args.push(arguments[ndx]); - var txt = _QTGenerate("QT_ReplaceElementContents", false, args); - if ( txt.length > 0 ) - element.innerHTML = txt; + var txt = _QTGenerate("QT_ReplaceElementContents", false, args); + if ( txt.length > 0 ) + element.innerHTML = txt; } function QT_ReplaceElementContents_XHTML() { - var element = arguments[0]; - var args = []; + var element = arguments[0]; + var args = []; - // copy all other arguments we want to pass through to the fcn - for ( var ndx = 1; ndx < arguments.length; ndx++ ) - args.push(arguments[ndx]); + // copy all other arguments we want to pass through to the fcn + for ( var ndx = 1; ndx < arguments.length; ndx++ ) + args.push(arguments[ndx]); - var txt = _QTGenerate("QT_ReplaceElementContents_XHTML", true, args); - if ( txt.length > 0 ) - element.innerHTML = txt; + var txt = _QTGenerate("QT_ReplaceElementContents_XHTML", true, args); + if ( txt.length > 0 ) + element.innerHTML = txt; } diff --git a/js/printer_tool.js b/js/printer_tool.js index f5ff8802..c76cf673 100644 --- a/js/printer_tool.js +++ b/js/printer_tool.js @@ -3,12 +3,19 @@ var PrinterTool = {}; PrinterTool.windowSettings = 'toolbar=no,location=no,' + 'status=no,menu=no,scrollbars=yes,width=650,height=400'; /** * Open a printer-friendly page and prompt for printing. * @param tagID * The ID of the tag that contains the material that should * be printed. */ -PrinterTool.print = function (tagID) { var target = document.getElementById(tagID); var title = document.title; -if(!target || target.childNodes.length === 0) { alert("Nothing to Print"); return; -} -var content = target.innerHTML; -var text = '' + title + -'' + content +''; -printerWindow = window.open('', '', PrinterTool.windowSettings); printerWindow.document.open(); printerWindow.document.write(text); printerWindow.document.close(); -printerWindow.print(); +PrinterTool.print = function (tagID) { + var target = document.getElementById(tagID); + var title = document.title; + if(!target || target.childNodes.length === 0) { + alert(t("Nothing to Print")); + return; + } + var content = target.innerHTML; + var text = '' + title + + '' + content +''; + printerWindow = window.open('', '', PrinterTool.windowSettings); + printerWindow.document.open(); + printerWindow.document.write(text); + printerWindow.document.close(); + printerWindow.print(); }; diff --git a/js/swfobject.js b/js/swfobject.js index 6d541852..a2378c1e 100644 --- a/js/swfobject.js +++ b/js/swfobject.js @@ -10,206 +10,233 @@ if(typeof deconcept == "undefined") var deconcept = new Object(); if(typeof deconcept.util == "undefined") deconcept.util = new Object(); if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object(); deconcept.SWFObject = function(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey) { - if (!document.getElementById) { return; } - this.DETECT_KEY = detectKey ? detectKey : 'detectflash'; - this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY); - this.params = new Object(); - this.variables = new Object(); - this.attributes = new Array(); - if(swf) { this.setAttribute('swf', swf); } - if(id) { this.setAttribute('id', id); } - if(w) { this.setAttribute('width', w); } - if(h) { this.setAttribute('height', h); } - if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); } - this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion(); - if (!window.opera && document.all && this.installedVer.major > 7) { - // only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE - deconcept.SWFObject.doPrepUnload = true; - } - if(c) { this.addParam('bgcolor', c); } - var q = quality ? quality : 'high'; - this.addParam('quality', q); - this.setAttribute('useExpressInstall', false); - this.setAttribute('doExpressInstall', false); - var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location; - this.setAttribute('xiRedirectUrl', xir); - this.setAttribute('redirectUrl', ''); - if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); } + if (!document.getElementById) { + return; + } + this.DETECT_KEY = detectKey ? detectKey : 'detectflash'; + this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY); + this.params = new Object(); + this.variables = new Object(); + this.attributes = new Array(); + if(swf) { + this.setAttribute('swf', swf); + } + if(id) { + this.setAttribute('id', id); + } + if(w) { + this.setAttribute('width', w); + } + if(h) { + this.setAttribute('height', h); + } + if(ver) { + this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); + } + this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion(); + if (!window.opera && document.all && this.installedVer.major > 7) { + // only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE + deconcept.SWFObject.doPrepUnload = true; + } + if(c) { + this.addParam('bgcolor', c); + } + var q = quality ? quality : 'high'; + this.addParam('quality', q); + this.setAttribute('useExpressInstall', false); + this.setAttribute('doExpressInstall', false); + var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location; + this.setAttribute('xiRedirectUrl', xir); + this.setAttribute('redirectUrl', ''); + if(redirectUrl) { + this.setAttribute('redirectUrl', redirectUrl); + } } deconcept.SWFObject.prototype = { - useExpressInstall: function(path) { - this.xiSWFPath = !path ? "expressinstall.swf" : path; - this.setAttribute('useExpressInstall', true); - }, - setAttribute: function(name, value){ - this.attributes[name] = value; - }, - getAttribute: function(name){ - return this.attributes[name]; - }, - addParam: function(name, value){ - this.params[name] = value; - }, - getParams: function(){ - return this.params; - }, - addVariable: function(name, value){ - this.variables[name] = value; - }, - getVariable: function(name){ - return this.variables[name]; - }, - getVariables: function(){ - return this.variables; - }, - getVariablePairs: function(){ - var variablePairs = new Array(); - var key; - var variables = this.getVariables(); - for(key in variables){ - variablePairs.push(key +"="+ variables[key]); - } - return variablePairs; - }, - getSWFHTML: function() { - var swfNode = ""; - if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture - if (this.getAttribute("doExpressInstall")) { - this.addVariable("MMplayerType", "PlugIn"); - this.setAttribute('swf', this.xiSWFPath); - } - swfNode = ' 0){ swfNode += 'flashvars="'+ pairs +'"'; } - swfNode += '/>'; - } else { // PC IE - if (this.getAttribute("doExpressInstall")) { - this.addVariable("MMplayerType", "ActiveX"); - this.setAttribute('swf', this.xiSWFPath); - } - swfNode = ''; - swfNode += ''; - var params = this.getParams(); - for(var key in params) { - swfNode += ''; - } - var pairs = this.getVariablePairs().join("&"); - if(pairs.length > 0) {swfNode += '';} - swfNode += ""; - } - return swfNode; - }, - write: function(elementId){ - if(this.getAttribute('useExpressInstall')) { - // check to see if we need to do an express install - var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]); - if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) { - this.setAttribute('doExpressInstall', true); - this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl'))); - document.title = document.title.slice(0, 47) + " - Flash Player Installation"; - this.addVariable("MMdoctitle", document.title); - } - } - if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){ - var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId; - n.innerHTML = this.getSWFHTML(); - return true; - }else{ - if(this.getAttribute('redirectUrl') != "") { - document.location.replace(this.getAttribute('redirectUrl')); - } - } - return false; - } + useExpressInstall: function(path) { + this.xiSWFPath = !path ? "expressinstall.swf" : path; + this.setAttribute('useExpressInstall', true); + }, + setAttribute: function(name, value){ + this.attributes[name] = value; + }, + getAttribute: function(name){ + return this.attributes[name]; + }, + addParam: function(name, value){ + this.params[name] = value; + }, + getParams: function(){ + return this.params; + }, + addVariable: function(name, value){ + this.variables[name] = value; + }, + getVariable: function(name){ + return this.variables[name]; + }, + getVariables: function(){ + return this.variables; + }, + getVariablePairs: function(){ + var variablePairs = new Array(); + var key; + var variables = this.getVariables(); + for(key in variables){ + variablePairs.push(key +"="+ variables[key]); + } + return variablePairs; + }, + getSWFHTML: function() { + var swfNode = ""; + if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture + if (this.getAttribute("doExpressInstall")) { + this.addVariable("MMplayerType", "PlugIn"); + this.setAttribute('swf', this.xiSWFPath); + } + swfNode = ' 0){ + swfNode += 'flashvars="'+ pairs +'"'; + } + swfNode += '/>'; + } else { // PC IE + if (this.getAttribute("doExpressInstall")) { + this.addVariable("MMplayerType", "ActiveX"); + this.setAttribute('swf', this.xiSWFPath); + } + swfNode = ''; + swfNode += ''; + var params = this.getParams(); + for(var key in params) { + swfNode += ''; + } + var pairs = this.getVariablePairs().join("&"); + if(pairs.length > 0) { + swfNode += ''; + } + swfNode += ""; + } + return swfNode; + }, + write: function(elementId){ + if(this.getAttribute('useExpressInstall')) { + // check to see if we need to do an express install + var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]); + if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) { + this.setAttribute('doExpressInstall', true); + this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl'))); + document.title = document.title.slice(0, 47) + " - Flash Player Installation"; + this.addVariable("MMdoctitle", document.title); + } + } + if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){ + var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId; + n.innerHTML = this.getSWFHTML(); + return true; + }else{ + if(this.getAttribute('redirectUrl') != "") { + document.location.replace(this.getAttribute('redirectUrl')); + } + } + return false; + } } /* ---- detection functions ---- */ deconcept.SWFObjectUtil.getPlayerVersion = function(){ - var PlayerVersion = new deconcept.PlayerVersion([0,0,0]); - if(navigator.plugins && navigator.mimeTypes.length){ - var x = navigator.plugins["Shockwave Flash"]; - if(x && x.description) { - PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split(".")); - } - }else{ - // do minor version lookup in IE, but avoid fp6 crashing issues - // see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/ - try{ - var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); - }catch(e){ - try { - var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); - PlayerVersion = new deconcept.PlayerVersion([6,0,21]); - axo.AllowScriptAccess = "always"; // throws if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code) - } catch(e) { - if (PlayerVersion.major == 6) { - return PlayerVersion; - } - } - try { - axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); - } catch(e) {} - } - if (axo != null) { - PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(",")); - } - } - return PlayerVersion; + var PlayerVersion = new deconcept.PlayerVersion([0,0,0]); + if(navigator.plugins && navigator.mimeTypes.length){ + var x = navigator.plugins["Shockwave Flash"]; + if(x && x.description) { + PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split(".")); + } + }else{ + // do minor version lookup in IE, but avoid fp6 crashing issues + // see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/ + try{ + var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); + }catch(e){ + try { + var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); + PlayerVersion = new deconcept.PlayerVersion([6,0,21]); + axo.AllowScriptAccess = "always"; // throws if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code) + } catch(e) { + if (PlayerVersion.major == 6) { + return PlayerVersion; + } + } + try { + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); + } catch(e) {} + } + if (axo != null) { + PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(",")); + } + } + return PlayerVersion; } deconcept.PlayerVersion = function(arrVersion){ - this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0; - this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0; - this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0; + this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0; + this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0; + this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0; } deconcept.PlayerVersion.prototype.versionIsValid = function(fv){ - if(this.major < fv.major) return false; - if(this.major > fv.major) return true; - if(this.minor < fv.minor) return false; - if(this.minor > fv.minor) return true; - if(this.rev < fv.rev) return false; - return true; + if(this.major < fv.major) return false; + if(this.major > fv.major) return true; + if(this.minor < fv.minor) return false; + if(this.minor > fv.minor) return true; + if(this.rev < fv.rev) return false; + return true; } /* ---- get value of query string param ---- */ deconcept.util = { - getRequestParameter: function(param) { - var q = document.location.search || document.location.hash; - if(q) { - var pairs = q.substring(1).split("&"); - for (var i=0; i < pairs.length; i++) { - if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) { - return pairs[i].substring((pairs[i].indexOf("=")+1)); - } - } - } - return ""; - } + getRequestParameter: function(param) { + var q = document.location.search || document.location.hash; + if(q) { + var pairs = q.substring(1).split("&"); + for (var i=0; i < pairs.length; i++) { + if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) { + return pairs[i].substring((pairs[i].indexOf("=")+1)); + } + } + } + return ""; + } } /* fix for video streaming bug */ deconcept.SWFObjectUtil.cleanupSWFs = function() { - var objects = document.getElementsByTagName("OBJECT"); - for (var i=0; i < objects.length; i++) { - objects[i].style.display = 'none'; - for (var x in objects[i]) { - if (typeof objects[i][x] == 'function') { - objects[i][x] = function(){}; - } - } - } + var objects = document.getElementsByTagName("OBJECT"); + for (var i=0; i < objects.length; i++) { + objects[i].style.display = 'none'; + for (var x in objects[i]) { + if (typeof objects[i][x] == 'function') { + objects[i][x] = function(){}; + } + } + } } // fixes bug in fp9 see http://blog.deconcept.com/2006/07/28/swfobject-143-released/ if (deconcept.SWFObject.doPrepUnload) { - deconcept.SWFObjectUtil.prepUnload = function() { - __flash_unloadHandler = function(){}; - __flash_savedUnloadHandler = function(){}; - window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs); - } - window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload); + deconcept.SWFObjectUtil.prepUnload = function() { + __flash_unloadHandler = function(){}; + __flash_savedUnloadHandler = function(){}; + window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs); + } + window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload); } /* add Array.push if needed (ie5) */ -if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }} +if (Array.prototype.push == null) { + Array.prototype.push = function(item) { + this[this.length] = item; + return this.length; + } + } /* add some aliases for ease of use/backwards compatibility */ var getQueryParamValue = deconcept.util.getRequestParameter; diff --git a/plugins/CollectionFormBuilder.inc b/plugins/CollectionFormBuilder.inc index 6c5e33b6..93e11479 100644 --- a/plugins/CollectionFormBuilder.inc +++ b/plugins/CollectionFormBuilder.inc @@ -1,45 +1,62 @@ -getType($file); - $fileUrl = $base_url . '/'. drupal_urlencode($file); - $beginIndex = strrpos($fileUrl, '/'); - $dtitle = substr($fileUrl, $beginIndex + 1); - $dtitle = substr($dtitle, 0, strpos($dtitle, ".")); - $ds1 = $dom->createElement("foxml:datastream"); - $ds1->setAttribute("ID", "COLLECTION_POLICY"); //set the ID - $ds1->setAttribute("STATE", "A"); - $ds1->setAttribute("CONTROL_GROUP", "M"); - $ds1v= $dom->createElement("foxml:datastreamVersion"); - $ds1v->setAttribute("ID", "COLLECTION_POLICY.0"); - $ds1v->setAttribute("MIMETYPE", "$dformat"); - $ds1v->setAttribute("LABEL", "$dtitle"); - $ds1content = $dom->createElement('foxml:contentLocation'); - $ds1content->setAttribute("REF", "$fileUrl"); - $ds1content->setAttribute("TYPE", "URL"); - $ds1->appendChild($ds1v); - $ds1v->appendChild($ds1content); - $rootElement->appendChild($ds1); - } -} +getType($file); + $fileUrl = $base_url . '/' . drupal_urlencode($file); + $beginIndex = strrpos($fileUrl, '/'); + $dtitle = substr($fileUrl, $beginIndex + 1); + $dtitle = substr($dtitle, 0, strpos($dtitle, ".")); + $ds1 = $dom->createElement("foxml:datastream"); + $ds1->setAttribute("ID", "COLLECTION_POLICY"); //set the ID + $ds1->setAttribute("STATE", "A"); + $ds1->setAttribute("CONTROL_GROUP", "M"); + $ds1v = $dom->createElement("foxml:datastreamVersion"); + $ds1v->setAttribute("ID", "COLLECTION_POLICY.0"); + $ds1v->setAttribute("MIMETYPE", "$dformat"); + $ds1v->setAttribute("LABEL", "$dtitle"); + $ds1content = $dom->createElement('foxml:contentLocation'); + $ds1content->setAttribute("REF", "$fileUrl"); + $ds1content->setAttribute("TYPE", "URL"); + $ds1->appendChild($ds1v); + $ds1v->appendChild($ds1content); + $rootElement->appendChild($ds1); + } + +} diff --git a/plugins/CreateCollection.inc b/plugins/CreateCollection.inc index 0c185705..c02ac2b7 100644 --- a/plugins/CreateCollection.inc +++ b/plugins/CreateCollection.inc @@ -1,22 +1,34 @@ -owner = $item; - if ( array_key_exists('DARWIN_CORE', $item->get_datastreams_list_as_array())) { + if (array_key_exists('DARWIN_CORE', $item->get_datastreams_list_as_array())) { $dwc = $item->get_datastream_dissemination('DARWIN_CORE'); if (!empty($dwc)) { $this->darwinCoreXML = $dwc; @@ -17,10 +33,15 @@ class DarwinCore { } } + /** + * Build Drupal Form + * @param type $form + * @return int + */ public function buildDrupalForm($form = array()) { - + $dwc_xml = $this->darwinCoreXML; - + $dwc = DOMDocument::loadXML($dwc_xml); $form['dc:type'] = array( @@ -162,17 +183,22 @@ class DarwinCore { $date = $dwc->getElementsByTagNameNS('http://rs.tdwg.org/dwc/terms/', 'eventDate')->item(0)->nodeValue; $format = 'Y-m-d H:i:s'; $form['dwceventDate'] = array( - '#type' => 'date_popup', // types 'date_text' and 'date_timezone' are also supported. See .inc file. - '#title' => 'select a date', - '#default_value' => $date, - '#date_format' => $format, - '#date_label_position' => 'within', // See other available attributes and what they do in date_api_elements.inc - '#date_increment' => 15, // Optional, used by the date_select and date_popup elements to increment minutes and seconds. + '#type' => 'date_popup', // types 'date_text' and 'date_timezone' are also supported. See .inc file. + '#title' => 'select a date', + '#default_value' => $date, + '#date_format' => $format, + '#date_label_position' => 'within', // See other available attributes and what they do in date_api_elements.inc + '#date_increment' => 15, // Optional, used by the date_select and date_popup elements to increment minutes and seconds. '#description' => '', ); return $form; } + /** + * Handle Form ?? + * @global type $user + * @param type $form_values + */ public function handleForm($form_values) { module_load_include('inc', 'fedora_repository', 'api/fedora_item'); global $user; @@ -208,12 +234,20 @@ class DarwinCore { $this->darwinCoreXML = $dwc->saveXML(); } + /** + * asXML ?? + * @return type + */ public function asXML() { return $this->darwinCoreXML; } + /** + * asHTML ?? + * @return type + */ public function asHTML() { - $path=drupal_get_path('module', 'Fedora_Repository'); + $path = drupal_get_path('module', 'Fedora_Repository'); module_load_include('inc', 'fedora_repository', 'ObjectHelper'); module_load_include('inc', 'fedora_repository', 'CollectionClass'); @@ -226,9 +260,8 @@ class DarwinCore { try { $proc = new XsltProcessor(); - } - catch (Exception $e) { - drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error'); + } catch (Exception $e) { + drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))), 'error'); return " "; } @@ -238,7 +271,7 @@ class DarwinCore { $input->loadXML(trim($xmlstr)); $xsl = $proc->importStylesheet($xsl); $newdom = $proc->transformToDoc($input); - $content=$newdom->saveXML(); + $content = $newdom->saveXML(); return $content; } @@ -256,9 +289,7 @@ class DarwinCore { 'MachineObservation' => 'MachineObservation', 'NomenclaturalChecklist' => 'NomenclaturalChecklist', ), - ); - public $dwcFields = array( 'dc:type', 'dc:language', @@ -283,8 +314,6 @@ class DarwinCore { 'dwc:eventDate', 'dwc:eventTime', ); - - public $darwinCoreXML = ' diff --git a/plugins/DemoFormBuilder.inc b/plugins/DemoFormBuilder.inc index 913d8005..05a9304f 100644 --- a/plugins/DemoFormBuilder.inc +++ b/plugins/DemoFormBuilder.inc @@ -1,77 +1,92 @@ -getType($file); - $fileUrl = $base_url .'/'. drupal_urlencode($file); - $beginIndex = strrpos($fileUrl, '/'); - $dtitle = substr($fileUrl, $beginIndex + 1); - $dtitle = urldecode($dtitle); - // $dtitle = substr($dtitle, 0, strpos($dtitle, ".")); - $ds1 = $dom->createElement("foxml:datastream"); - $ds1->setAttribute("ID", "FULL_SIZE"); - $ds1->setAttribute("STATE", "A"); - $ds1->setAttribute("CONTROL_GROUP", "M"); - $ds1v = $dom->createElement("foxml:datastreamVersion"); - $rootElement->appendChild($ds1); - - $ds1v->setAttribute("ID", "FULL_SIZE.0"); - $ds1v->setAttribute("MIMETYPE", "$dformat"); - $ds1v->setAttribute("LABEL", "$dtitle"); - $ds1content = $dom->createElement('foxml:contentLocation'); - $ds1content->setAttribute("REF", "$fileUrl"); - $ds1content->setAttribute("TYPE", "URL"); - $ds1->appendChild($ds1v); - $ds1v->appendChild($ds1content); - } - if (!empty($_SESSION['fedora_ingest_files'])) { - foreach ($_SESSION['fedora_ingest_files'] as $dsid => $createdFile) { - $createdFile = strstr($createdFile, $file); - $dformat = $mimetype->getType($createdFile); - $fileUrl = $base_url .'/'. drupal_urlencode( $createdFile ); - $beginIndex = strrpos($fileUrl, '/'); - $dtitle = substr($fileUrl, $beginIndex + 1); - $dtitle = urldecode($dtitle); - // $dtitle = substr($dtitle, 0, strpos($dtitle, ".")); - $dtitle = $dtitle; - $ds1 = $dom->createElement("foxml:datastream"); - $ds1->setAttribute("ID", "$dsid"); - $ds1->setAttribute("STATE", "A"); - $ds1->setAttribute("CONTROL_GROUP", "M"); - $ds1v= $dom->createElement("foxml:datastreamVersion"); - $ds1v->setAttribute("ID", "$dsid.0"); - $ds1v->setAttribute("MIMETYPE", "$dformat"); - $ds1v->setAttribute("LABEL", "$dtitle"); - $ds1content = $dom->createElement('foxml:contentLocation'); - $ds1content->setAttribute("REF", "$fileUrl"); - $ds1content->setAttribute("TYPE", "URL"); - $ds1->appendChild($ds1v); - $ds1v->appendChild($ds1content); - $rootElement->appendChild($ds1); - } - } - } -} - +getType($file); + $fileUrl = $base_url . '/' . drupal_urlencode($file); + $beginIndex = strrpos($fileUrl, '/'); + $dtitle = substr($fileUrl, $beginIndex + 1); + $dtitle = urldecode($dtitle); + // $dtitle = substr($dtitle, 0, strpos($dtitle, ".")); + $ds1 = $dom->createElement("foxml:datastream"); + $ds1->setAttribute("ID", "FULL_SIZE"); + $ds1->setAttribute("STATE", "A"); + $ds1->setAttribute("CONTROL_GROUP", "M"); + $ds1v = $dom->createElement("foxml:datastreamVersion"); + $rootElement->appendChild($ds1); + + $ds1v->setAttribute("ID", "FULL_SIZE.0"); + $ds1v->setAttribute("MIMETYPE", "$dformat"); + $ds1v->setAttribute("LABEL", "$dtitle"); + $ds1content = $dom->createElement('foxml:contentLocation'); + $ds1content->setAttribute("REF", "$fileUrl"); + $ds1content->setAttribute("TYPE", "URL"); + $ds1->appendChild($ds1v); + $ds1v->appendChild($ds1content); + } + if (!empty($_SESSION['fedora_ingest_files'])) { + foreach ($_SESSION['fedora_ingest_files'] as $dsid => $createdFile) { + $createdFile = strstr($createdFile, $file); + $dformat = $mimetype->getType($createdFile); + $fileUrl = $base_url . '/' . drupal_urlencode($createdFile); + $beginIndex = strrpos($fileUrl, '/'); + $dtitle = substr($fileUrl, $beginIndex + 1); + $dtitle = urldecode($dtitle); + // $dtitle = substr($dtitle, 0, strpos($dtitle, ".")); + $dtitle = $dtitle; + $ds1 = $dom->createElement("foxml:datastream"); + $ds1->setAttribute("ID", "$dsid"); + $ds1->setAttribute("STATE", "A"); + $ds1->setAttribute("CONTROL_GROUP", "M"); + $ds1v = $dom->createElement("foxml:datastreamVersion"); + $ds1v->setAttribute("ID", "$dsid.0"); + $ds1v->setAttribute("MIMETYPE", "$dformat"); + $ds1v->setAttribute("LABEL", "$dtitle"); + $ds1content = $dom->createElement('foxml:contentLocation'); + $ds1content->setAttribute("REF", "$fileUrl"); + $ds1content->setAttribute("TYPE", "URL"); + $ds1->appendChild($ds1v); + $ds1v->appendChild($ds1content); + $rootElement->appendChild($ds1); + } + } + } + +} + diff --git a/plugins/DocumentConverter.inc b/plugins/DocumentConverter.inc index 3aafb49f..f258441a 100644 --- a/plugins/DocumentConverter.inc +++ b/plugins/DocumentConverter.inc @@ -1,22 +1,36 @@ converter_service_url = $converter_url; } + /** + * Convert ??? + * @param type $parameterArray + * @param type $dsid + * @param type $file + * @param type $output_ext + * @return string + */ function convert($parameterArray = NULL, $dsid, $file, $output_ext) { module_load_include('inc', 'fedora_repository', 'MimeClass'); @@ -32,7 +46,7 @@ class DocumentConverter { $outputType = $helper->get_mimetype($output_ext); $inputData = file_get_contents($file); - $outputFile = $file ."_". $dsid .".". $output_ext; + $outputFile = $file . "_" . $dsid . "." . $output_ext; #debug: #drupal_set_message("inputType: $inputType", 'status'); @@ -40,8 +54,8 @@ class DocumentConverter { #drupal_set_message("outputFile: $outputFile", 'status'); $ch = curl_init($this->converter_service_url); - curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: $inputType", "Accept: $outputType" ) ); - curl_setopt($ch, CURLOPT_POST, 1 ); + curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: $inputType", "Accept: $outputType")); + curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 120); // times out after 2 minutes curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable curl_setopt($ch, CURLOPT_POSTFIELDS, $inputData); // add POST fields @@ -52,28 +66,29 @@ class DocumentConverter { $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); - if (200 == $code) { + if (200 == $code) { $returnValue = file_put_contents($outputFile, $data); if ($returnValue > 0) { - drupal_set_message("Conversion successful.", 'status'); + drupal_set_message(t("Conversion successful."), 'status'); $_SESSION['fedora_ingest_files']["$dsid"] = $outputFile; return $outputFile; - } + } else { return $returnValue; // a.k.a. FALSE. } - } + } else { - drupal_set_message("Conversion Failed. Webservice returned $code.", 'status'); + drupal_set_message(t("Conversion Failed. Webservice returned $code."), 'status'); return FALSE; } } + } /* -$documentConverter = new DocumentConverter(); -$inputFile = "document.docx"; -$outputType = "txt"; -$documentConverter->convert( null, 'TXT', $inputFile, $outputType); -/* */ + $documentConverter = new DocumentConverter(); + $inputFile = "document.docx"; + $outputType = "txt"; + $documentConverter->convert( NULL, 'TXT', $inputFile, $outputType); + /* */ diff --git a/plugins/Exiftool.inc b/plugins/Exiftool.inc index ec6d7ad0..d8fd5e90 100644 --- a/plugins/Exiftool.inc +++ b/plugins/Exiftool.inc @@ -1,67 +1,86 @@ -pid = $pid; - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - $this->item = new Fedora_Item($this->pid); - } - - function extractMetadata($parameterArray, $dsid, $file, $file_ext) { - $system = getenv('System'); - $file_suffix = '_'. $dsid . '.xml'; - $returnValue=TRUE; - $output=array(); - exec('exiftool -X ' . escapeshellarg($file) . '', $output); - file_put_contents($file.$file_suffix, implode("\n", $output)); - $_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_suffix; - return TRUE; - } - - function displayMetadata() { - $output=''; - $exif = $this->item->get_datastream_dissemination('EXIF'); - if (trim($exif) != '') { - $exifDom = DOMDocument::loadXML($this->item->get_datastream_dissemination('EXIF')); - if ($exifDom != NULL) { - $description = $exifDom->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#','Description'); - if ($description->length > 0) { - $description=$description->item(0); - $output .= ''; - - $fieldset = array( - '#title' => t("!text", array('!text' => 'Technical Metadata')), - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#value' => $output - ); - $output = theme('fieldset', $fieldset); - } - } - } - return $output; - } - -} +pid = $pid; + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + $this->item = new Fedora_Item($this->pid); + } + + /** + * extract metadata ?? + * @param type $parameterArray + * @param type $dsid + * @param type $file + * @param type $file_ext + * @return type + */ + function extractMetadata($parameterArray, $dsid, $file, $file_ext) { + $system = getenv('System'); + $file_suffix = '_' . $dsid . '.xml'; + $returnValue = TRUE; + $output = array(); + exec('exiftool -X ' . escapeshellarg($file) . '', $output); + file_put_contents($file . $file_suffix, implode("\n", $output)); + $_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_suffix; + return TRUE; + } + + /** + * display metadata ??? + * @return type + */ + function displayMetadata() { + $output = ''; + $exif = $this->item->get_datastream_dissemination('EXIF'); + if (trim($exif) != '') { + $exifDom = DOMDocument::loadXML($this->item->get_datastream_dissemination('EXIF')); + if ($exifDom != NULL) { + $description = $exifDom->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'Description'); + if ($description->length > 0) { + $description = $description->item(0); + $output .= ''; + + $fieldset = array( + '#title' => t("!text", array('!text' => 'Technical Metadata')), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#value' => $output + ); + $output = theme('fieldset', $fieldset); + } + } + } + return $output; + } + +} diff --git a/plugins/FedoraObjectDetailedContent.inc b/plugins/FedoraObjectDetailedContent.inc new file mode 100644 index 00000000..30e222a6 --- /dev/null +++ b/plugins/FedoraObjectDetailedContent.inc @@ -0,0 +1,111 @@ +pid = $pid; + $this->item = new Fedora_Item($pid); + } + } + + /** + * Show Field Sets + * @global type $user + * @return type + */ + public function showFieldSets() { + global $user; + drupal_set_title($this->item->objectProfile->objLabel); + $objectHelper = new ObjectHelper(); + $tabset = array(); + $show_purge_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'fedora_repository_purge_object_form'); + $show_edit_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'fedora_repository_edit_qdc_form'); + $purge_form = drupal_get_form('fedora_repository_purge_object_form', $this->pid, check_plain(substr(request_uri(), strlen(base_path())))); + $details_selected = ($show_purge_tab || $show_edit_tab); + $tabset['fedora_object_details'] = array( + '#type' => 'tabpage', + '#title' => t('Object Details'), + '#selected' => $details_selected, + '#weight' => 100, //XXX: Make the weight configurable? + ); + $tabset['fedora_object_details']['tabset'] = array( + '#type' => 'tabset', + ); + + $dc_html = $objectHelper->getFormattedDC($this->item); + + $i = 0; + if (fedora_repository_access(OBJECTHELPER :: $VIEW_DETAILED_CONTENT_LIST, $this->pid, $user)) { + $tabset['fedora_object_details']['tabset']['view'] = array( + '#type' => 'tabpage', + '#title' => t('View'), + 'dc' => array( + '#type' => 'markup', + '#value' => $dc_html, //XXX: This could easily be done in Drupal, instead of using an XSL + '#weight' => $i++ + ), + 'list' => array( + '#type' => 'fieldset', + '#title' => t('Detailed List of Content'), + '#attributes' => array( + 'class' => 'fedora_detailed_list', + ), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#weight' => $i++, + 'parents' => array( + '#type' => 'markup', + '#value' => $objectHelper->get_parent_objects_asHTML($this->pid), + '#weight' => $i++, + ), + 'datastreams' => array( + '#type' => 'markup', + '#value' => $objectHelper->get_formatted_datastream_list($this->pid, NULL, $this->item), //XXX: The function called here could be cleaned up a fair bit as well... + '#weight' => $i++, + ), + ), + 'purge' => array( + '#type' => 'markup', + '#value' => $purge_form, + '#weight' => $i++ + ) + ); + } + + if (fedora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $this->pid, $user)) { + $editform = drupal_get_form('fedora_repository_edit_qdc_form', $this->pid, 'DC'); + $tabset['fedora_object_details']['tabset']['edit'] = array( + '#type' => 'tabpage', + '#title' => t('Edit'), + '#selected' => $show_edit_tab, + '#content' => $editform, + ); + } + + $ts = $tabset['fedora_object_details']['tabset']; + if (array_key_exists('view', $ts) || array_key_exists('edit', $ts)) { + return $tabset; + } + else { + return array(); + } + } + +} diff --git a/plugins/Ffmpeg.inc b/plugins/Ffmpeg.inc index f2faedac..46b4ae80 100644 --- a/plugins/Ffmpeg.inc +++ b/plugins/Ffmpeg.inc @@ -1,35 +1,54 @@ - '00:00:10', 's' => null); - $params = array_merge($defaults, $parameterArray); - $system = getenv('System'); - $file_suffix = '_'. $dsid . '.' . $file_ext; - $returnValue=TRUE; - $output=array(); - $size = ''; - - if($params['s'] != null) { - $size = ' -s ' . escapeshellarg($params['s']); - } - exec('ffmpeg -i ' . escapeshellarg($file) . ' -r 1 -ss ' . escapeshellarg($params['ss']) . ' ' . $size . ' -t 1 ' . escapeshellarg($file . $file_suffix)); - - if (!file_exists($file . $file_suffix)) { - return false; - } - - $_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_suffix; - return TRUE; - } -} + '00:00:10', 's' => NULL); + $params = array_merge($defaults, $parameterArray); + $system = getenv('System'); + $file_suffix = '_' . $dsid . '.' . $file_ext; + $returnValue = TRUE; + $output = array(); + $size = ''; + + if ($params['s'] != NULL) { + $size = ' -s ' . escapeshellarg($params['s']); + } + exec('ffmpeg -i ' . escapeshellarg($file) . ' -r 1 -ss ' . escapeshellarg($params['ss']) . ' ' . $size . ' -t 1 ' . escapeshellarg($file . $file_suffix)); + + if (!file_exists($file . $file_suffix)) { + return FALSE; + } + + $_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_suffix; + return TRUE; + } + +} diff --git a/plugins/Flv.inc b/plugins/Flv.inc index 4b16fe7d..8d2079b6 100644 --- a/plugins/Flv.inc +++ b/plugins/Flv.inc @@ -1,271 +1,313 @@ -createElement("foxml:datastream"); - $datastream->setAttribute("ID", "QDC"); - $datastream->setAttribute("STATE", "A"); - $datastream->setAttribute("CONTROL_GROUP", "X"); - $version = $dom->createElement("foxml:datastreamVersion"); - $version->setAttribute("ID", "QDC.0"); - $version->setAttribute("MIMETYPE", "text/xml"); - $version->setAttribute("LABEL", "QDC Dublin Core Record"); - $datastream->appendChild($version); - $content = $dom->createElement("foxml:xmlContent"); - $version->appendChild($content); - ///begin writing qdc - $oai = $dom->createElement("oai_dc:dc"); - $oai->setAttribute('xmlns:oai_dc', "http://www.openarchives.org/OAI/2.0/oai_dc/"); - $oai->setAttribute('xmlns:dc', "http://purl.org/dc/elements/1.1/"); - $oai->setAttribute('xmlns:dcterms', "http://purl.org/dc/terms/"); - $oai->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); - $content->appendChild($oai); - //dc elements - $previousElement=NULL; //used in case we have to nest elements for qualified dublin core - foreach ($form_values as $key => $value) { - $index = strrpos($key, '-'); - if ($index > 01) { - $key = substr($key, 0, $index); - } - - $test = substr($key, 0, 2); - - if ($test=='dc'||$test=='ap') {//don't try to process other form values - try { - if (!strcmp(substr($key, 0, 4), 'app_')) { - $key = substr($key, 4); - $previousElement->appendChild($dom->createElement($key, $value)); - } - else { - $previousElement = $dom->createElement($key, $value); - $oai->appendChild($previousElement); - } - } - catch (exception $e) { - drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error'); - continue; - } - } - $rootElement->appendChild($datastream); - } - } - - function handleQDCForm($form_values) { - $dom = new DomDocument("1.0", "UTF-8"); - $dom->formatOutput = TRUE; - $pid=$form_values['pid']; - $rootElement = $dom->createElement("foxml:digitalObject"); - $rootElement->setAttribute('PID', "$pid"); - $rootElement->setAttribute('xmlns:foxml', "info:fedora/fedora-system:def/foxml#"); - $rootElement->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); - $rootElement->setAttribute('xsi:schemaLocation', "info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-0.xsd"); - $dom->appendChild($rootElement); - //create standard fedora stuff - $this->createStandardFedoraStuff($form_values, $dom, $rootElement); - //create relationships - $this->createRelationShips($form_values, $dom, $rootElement); - //create dublin core - $this->createQDCStream($form_values, $dom, $rootElement); - $this->createFedoraDataStreams($form_values, $dom, $rootElement); - $params = array( - 'objectXML' => $dom->saveXML(), - 'format' => "foxml1.0", - 'logMessage' => "Fedora Object Ingested", - ); - - try { - $soapHelper = new ConnectionHelper(); - $client=$soapHelper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); - - if ($client == NULL) { - drupal_set_message(t('Error getting SOAP client.'), 'error'); - return; - } - $object=$client->__soapCall('ingest', array($params)); - $deleteFiles = $form_values['delete_file']; //remove files from drupal file system - - if ($deleteFiles > 0) { - foreach ($_SESSION['fedora_ingest_files'] as $dsid => $createdFile) { - unlink($createdFile); - } - unlink($form_values['fullpath']); - } - } - catch (exception $e) { - drupal_set_message(t('Error ingesting object: !e', array('!e' => $e->getMessage())), 'error'); - return; - } - } - - function createFedoraDataStreams($form_values, &$dom, &$rootElement) { - module_load_include('inc', 'fedora_repository', 'MimeClass'); - $mimetype = new MimeClass(); - $server = NULL; - $file=$form_values['ingest-file-location']; - $dformat = $mimetype->getType($file); - $fileUrl = 'http://'. $_SERVER['HTTP_HOST'] . $file; - $beginIndex = strrpos($fileUrl, '/'); - $dtitle = substr($fileUrl, $beginIndex + 1); - $dtitle = substr($dtitle, 0, strpos($dtitle, ".")); - $ds1 = $dom->createElement("foxml:datastream"); - $ds1->setAttribute("ID", "OBJ"); - $ds1->setAttribute("STATE", "A"); - $ds1->setAttribute("CONTROL_GROUP", "M"); - $ds1v= $dom->createElement("foxml:datastreamVersion"); - $ds1v->setAttribute("ID", "OBJ.0"); - $ds1v->setAttribute("MIMETYPE", "$dformat"); - $ds1v->setAttribute("LABEL", "$dtitle"); - $ds1content = $dom->createElement('foxml:contentLocation'); - $ds1content->setAttribute("REF", "$fileUrl"); - $ds1content->setAttribute("TYPE", "URL"); - $ds1->appendChild($ds1v); - $ds1v->appendChild($ds1content); - $rootElement->appendChild($ds1); - - foreach ($_SESSION['fedora_ingest_files'] as $dsid => $createdFile) { - $createdFile = strstr($createdFile, $file); - $dformat = $mimetype->getType($createdFile); - $fileUrl = 'http://'. $_SERVER['HTTP_HOST'] . $createdFile; - $beginIndex = strrpos($fileUrl, '/'); - $dtitle = substr($fileUrl, $beginIndex + 1); - $dtitle = substr($dtitle, 0, strpos($dtitle, ".")); - $dtitle = $dtitle . '_'. $dsid; - $ds1 = $dom->createElement("foxml:datastream"); - $ds1->setAttribute("ID", "$dsid"); - $ds1->setAttribute("STATE", "A"); - $ds1->setAttribute("CONTROL_GROUP", "M"); - $ds1v= $dom->createElement("foxml:datastreamVersion"); - $ds1v->setAttribute("ID", "$dsid.0"); - $ds1v->setAttribute("MIMETYPE", "$dformat"); - $ds1v->setAttribute("LABEL", "$dtitle"); - $ds1content = $dom->createElement('foxml:contentLocation'); - $ds1content->setAttribute("REF", "$fileUrl"); - $ds1content->setAttribute("TYPE", "URL"); - $ds1->appendChild($ds1v); - $ds1v->appendChild($ds1content); - $rootElement->appendChild($ds1); - } - } - - /** - * creates the RELS-EXT for the foxml - */ - function createRelationShips($form_values, &$dom, &$rootElement) { - $drdf = $dom->createElement("foxml:datastream"); - $drdf->setAttribute("ID", "RELS-EXT"); - $drdf->setAttribute("CONTROL_GROUP", "X"); - $dvrdf = $dom->createElement("foxml:datastreamVersion"); - $dvrdf->setAttribute("ID", "RELS-EXT.0"); - $dvrdf->setAttribute("MIMETYPE", "text/xml"); - $dvrdf->setAttribute("LABEL", "Fedora Object-to-Object Relationship Metadata"); - $dvcontent = $dom->createElement("foxml:xmlContent"); - $rdf = $dom->createElement("rdf:RDF"); - $rdf->setAttribute("xmlns:rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); - $rdf->setAttribute("xmlns:rdfs", "http://www.w3.org/2000/01/rdf-schema#"); - $rdf->setAttribute("xmlns:fedora", "info:fedora/fedora-system:def/relations-external#"); - $rdf->setAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/"); - $rdf->setAttribute("xmlns:oai_dc", "http://www.openarchives.org/OAI/2.0/oai_dc/"); - $rdfdesc = $dom->createElement("rdf:description"); - $pid = $form_values['pid']; - $rdfdesc->setAttribute("rdf:about", "info:fedora/$pid"); - $member = $dom->createElement("fedora:isMemberOfCollection"); - $membr = $form_values['collection_pid']; - $member->setAttribute("rdf:resource", "info:fedora/$membr"); - - $drdf->appendChild($dvrdf); - $dvrdf->appendChild($dvcontent); - $dvcontent->appendChild($rdf); - $rdf->appendChild($rdfdesc); - $rdfdesc->appendChild($member); - $rootElement->appendChild($drdf); - - } - - /** - * creates the standard foxml properties - */ - function createStandardFedoraStuff($form_values, &$dom, &$rootElement) { - /*foxml object properties section */ - $objproperties = $dom->createElement("foxml:objectProperties"); - $prop1 = $dom->createElement("foxml:property"); - $prop1->setAttribute("NAME", "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"); - $prop1->setAttribute("VALUE", "FedoraObject"); - $prop2 = $dom->createElement("foxml:property"); - $prop2->setAttribute("NAME", "info:fedora/fedora-system:def/model#state"); - $prop2->setAttribute("VALUE", "A"); - $prop3 = $dom->createElement("foxml:property"); - $prop3->setAttribute("NAME", "info:fedora/fedora-system:def/model#label"); - $prop3->setAttribute("VALUE", $form_values['dc:title']); - $prop4 = $dom->createElement("foxml:property"); - $prop4->setAttribute("NAME", "info:fedora/fedora-system:def/model#contentModel"); - $prop4->setAttribute("VALUE", $form_values['content_model_name']); - $prop5 = $dom->createElement("foxml:property"); - $prop5->setAttribute("NAME", "info:fedora/fedora-system:def/model#ownerId"); - $prop5->setAttribute("VALUE", $form_values['user_id']); - $objproperties->appendChild($prop1); - $objproperties->appendChild($prop2); - $objproperties->appendChild($prop3); - $objproperties->appendChild($prop4); - $objproperties->appendChild($prop5); - $rootElement->appendChild($objproperties); - } - - - function buildQDCForm(&$form, $ingest_form_definition, &$form_values) { - $form['indicator2'] = array( - '#type' => 'fieldset', - '#title' => t('Ingest Digital Object Step #2') - ); - foreach ($ingest_form_definition->form_elements->element as $element) { - $name = strip_tags($element->name->asXML()); - $title = strip_tags($element->label->asXML()); - $required = strip_tags($element->required->asXML()); - $required = strtolower($required); - if ($required != 'TRUE') { - $required='0'; - } - - $description = strip_tags($element->description->asXML()); - $type = strip_tags($element->type->asXML()); - $options = array(); - if ($element->type == 'select') { - foreach ($element->authoritative_list->item as $item) { - $field = strip_tags($item->field->asXML()); - $value = strip_tags($item->value->asXML()); - $options["$field"] = $value; - } - $form['indicator2']["$name"] = array( - '#title' => $title, - '#required' => $required, - '#description' => $description, - '#type' => $type, - '#options' => $options, - ); - - } - else { - $form['indicator2']["$name"] = array( - '#title' => $title, - '#required' => $required, - '#description' => $description, - '#type' => $type - ); - } - } - - return $form; - } - -} +createElement("foxml:datastream"); + $datastream->setAttribute("ID", "QDC"); + $datastream->setAttribute("STATE", "A"); + $datastream->setAttribute("CONTROL_GROUP", "X"); + $version = $dom->createElement("foxml:datastreamVersion"); + $version->setAttribute("ID", "QDC.0"); + $version->setAttribute("MIMETYPE", "text/xml"); + $version->setAttribute("LABEL", "QDC Dublin Core Record"); + $datastream->appendChild($version); + $content = $dom->createElement("foxml:xmlContent"); + $version->appendChild($content); + + ///begin writing qdc + $oai = $dom->createElement("oai_dc:dc"); + $oai->setAttribute('xmlns:oai_dc', "http://www.openarchives.org/OAI/2.0/oai_dc/"); + $oai->setAttribute('xmlns:dc', "http://purl.org/dc/elements/1.1/"); + $oai->setAttribute('xmlns:dcterms', "http://purl.org/dc/terms/"); + $oai->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); + $content->appendChild($oai); + + //dc elements + $previousElement = NULL; //used in case we have to nest elements for qualified dublin core + foreach ($form_values as $key => $value) { + $index = strrpos($key, '-'); + + if ($index > 01) { + $key = substr($key, 0, $index); + } + + $test = substr($key, 0, 2); + + if ($test == 'dc' || $test == 'ap') {//don't try to process other form values + try { + if (!strcmp(substr($key, 0, 4), 'app_')) { + $key = substr($key, 4); + $previousElement->appendChild($dom->createElement($key, $value)); + } + else { + $previousElement = $dom->createElement($key, $value); + $oai->appendChild($previousElement); + } + } catch (exception $e) { + drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))), 'error'); + continue; + } + } + $rootElement->appendChild($datastream); + } + } + + /** + * Handle QDC Form ??? + * @param type $form_values + * @return type + */ + function handleQDCForm($form_values) { + $dom = new DomDocument("1.0", "UTF-8"); + $dom->formatOutput = TRUE; + $pid = $form_values['pid']; + $rootElement = $dom->createElement("foxml:digitalObject"); + $rootElement->setAttribute('PID', "$pid"); + $rootElement->setAttribute('xmlns:foxml', "info:fedora/fedora-system:def/foxml#"); + $rootElement->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); + $rootElement->setAttribute('xsi:schemaLocation', "info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-0.xsd"); + $dom->appendChild($rootElement); + + //create standard fedora stuff + $this->createStandardFedoraStuff($form_values, $dom, $rootElement); + + //create relationships + $this->createRelationShips($form_values, $dom, $rootElement); + + //create dublin core + $this->createQDCStream($form_values, $dom, $rootElement); + $this->createFedoraDataStreams($form_values, $dom, $rootElement); + $params = array( + 'objectXML' => $dom->saveXML(), + 'format' => "foxml1.0", + 'logMessage' => "Fedora Object Ingested", + ); + + try { + $soapHelper = new ConnectionHelper(); + $client = $soapHelper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/wsdl?api=API-M')); + + if ($client == NULL) { + drupal_set_message(t('Error getting SOAP client.'), 'error'); + return; + } + $object = $client->__soapCall('ingest', array($params)); + $deleteFiles = $form_values['delete_file']; //remove files from drupal file system + + if ($deleteFiles > 0) { + foreach ($_SESSION['fedora_ingest_files'] as $dsid => $createdFile) { + unlink($createdFile); + } + unlink($form_values['fullpath']); + } + } catch (exception $e) { + drupal_set_message(t('Error ingesting object: @e', array('@e' => check_plain($e->getMessage()))), 'error'); + return; + } + } + + /** + * Create Fedora DataStream + * @param type $form_values + * @param type $dom + * @param type $rootElement + */ + function createFedoraDataStreams($form_values, &$dom, &$rootElement) { + module_load_include('inc', 'fedora_repository', 'MimeClass'); + $mimetype = new MimeClass(); + $server = NULL; + $file = $form_values['ingest-file-location']; + $dformat = $mimetype->getType($file); + $fileUrl = 'http://' . $_SERVER['HTTP_HOST'] . $file; + $beginIndex = strrpos($fileUrl, '/'); + $dtitle = substr($fileUrl, $beginIndex + 1); + $dtitle = substr($dtitle, 0, strpos($dtitle, ".")); + $ds1 = $dom->createElement("foxml:datastream"); + $ds1->setAttribute("ID", "OBJ"); + $ds1->setAttribute("STATE", "A"); + $ds1->setAttribute("CONTROL_GROUP", "M"); + $ds1v = $dom->createElement("foxml:datastreamVersion"); + $ds1v->setAttribute("ID", "OBJ.0"); + $ds1v->setAttribute("MIMETYPE", "$dformat"); + $ds1v->setAttribute("LABEL", "$dtitle"); + $ds1content = $dom->createElement('foxml:contentLocation'); + $ds1content->setAttribute("REF", "$fileUrl"); + $ds1content->setAttribute("TYPE", "URL"); + $ds1->appendChild($ds1v); + $ds1v->appendChild($ds1content); + $rootElement->appendChild($ds1); + + foreach ($_SESSION['fedora_ingest_files'] as $dsid => $createdFile) { + $createdFile = strstr($createdFile, $file); + $dformat = $mimetype->getType($createdFile); + $fileUrl = 'http://' . $_SERVER['HTTP_HOST'] . $createdFile; + $beginIndex = strrpos($fileUrl, '/'); + $dtitle = substr($fileUrl, $beginIndex + 1); + $dtitle = substr($dtitle, 0, strpos($dtitle, ".")); + $dtitle = $dtitle . '_' . $dsid; + $ds1 = $dom->createElement("foxml:datastream"); + $ds1->setAttribute("ID", "$dsid"); + $ds1->setAttribute("STATE", "A"); + $ds1->setAttribute("CONTROL_GROUP", "M"); + $ds1v = $dom->createElement("foxml:datastreamVersion"); + $ds1v->setAttribute("ID", "$dsid.0"); + $ds1v->setAttribute("MIMETYPE", "$dformat"); + $ds1v->setAttribute("LABEL", "$dtitle"); + $ds1content = $dom->createElement('foxml:contentLocation'); + $ds1content->setAttribute("REF", "$fileUrl"); + $ds1content->setAttribute("TYPE", "URL"); + $ds1->appendChild($ds1v); + $ds1v->appendChild($ds1content); + $rootElement->appendChild($ds1); + } + } + + /** + * creates the RELS-EXT for the foxml + * @param type $form_values + * @param type $dom + * @param type $rootElement + */ + function createRelationShips($form_values, &$dom, &$rootElement) { + $drdf = $dom->createElement("foxml:datastream"); + $drdf->setAttribute("ID", "RELS-EXT"); + $drdf->setAttribute("CONTROL_GROUP", "X"); + $dvrdf = $dom->createElement("foxml:datastreamVersion"); + $dvrdf->setAttribute("ID", "RELS-EXT.0"); + $dvrdf->setAttribute("MIMETYPE", "text/xml"); + $dvrdf->setAttribute("LABEL", "Fedora Object-to-Object Relationship Metadata"); + $dvcontent = $dom->createElement("foxml:xmlContent"); + $rdf = $dom->createElement("rdf:RDF"); + $rdf->setAttribute("xmlns:rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); + $rdf->setAttribute("xmlns:rdfs", "http://www.w3.org/2000/01/rdf-schema#"); + $rdf->setAttribute("xmlns:fedora", "info:fedora/fedora-system:def/relations-external#"); + $rdf->setAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/"); + $rdf->setAttribute("xmlns:oai_dc", "http://www.openarchives.org/OAI/2.0/oai_dc/"); + $rdfdesc = $dom->createElement("rdf:description"); + $pid = $form_values['pid']; + $rdfdesc->setAttribute("rdf:about", "info:fedora/$pid"); + $member = $dom->createElement("fedora:isMemberOfCollection"); + $membr = $form_values['collection_pid']; + $member->setAttribute("rdf:resource", "info:fedora/$membr"); + + $drdf->appendChild($dvrdf); + $dvrdf->appendChild($dvcontent); + $dvcontent->appendChild($rdf); + $rdf->appendChild($rdfdesc); + $rdfdesc->appendChild($member); + $rootElement->appendChild($drdf); + } + + /** + * creates the standard foxml properties + * @param type $form_values + * @param type $dom + * @param type $rootElement + */ + function createStandardFedoraStuff($form_values, &$dom, &$rootElement) { + /* foxml object properties section */ + $objproperties = $dom->createElement("foxml:objectProperties"); + $prop1 = $dom->createElement("foxml:property"); + $prop1->setAttribute("NAME", "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"); + $prop1->setAttribute("VALUE", "FedoraObject"); + $prop2 = $dom->createElement("foxml:property"); + $prop2->setAttribute("NAME", "info:fedora/fedora-system:def/model#state"); + $prop2->setAttribute("VALUE", "A"); + $prop3 = $dom->createElement("foxml:property"); + $prop3->setAttribute("NAME", "info:fedora/fedora-system:def/model#label"); + $prop3->setAttribute("VALUE", $form_values['dc:title']); + $prop4 = $dom->createElement("foxml:property"); + $prop4->setAttribute("NAME", "info:fedora/fedora-system:def/model#contentModel"); + $prop4->setAttribute("VALUE", $form_values['content_model_name']); + $prop5 = $dom->createElement("foxml:property"); + $prop5->setAttribute("NAME", "info:fedora/fedora-system:def/model#ownerId"); + $prop5->setAttribute("VALUE", $form_values['user_id']); + $objproperties->appendChild($prop1); + $objproperties->appendChild($prop2); + $objproperties->appendChild($prop3); + $objproperties->appendChild($prop4); + $objproperties->appendChild($prop5); + $rootElement->appendChild($objproperties); + } + + /** + * Build QDC Form + * @param type $form + * @param type $ingest_form_definition + * @param type $form_values + * @return type + */ + function buildQDCForm(&$form, $ingest_form_definition, &$form_values) { + $form['indicator2'] = array( + '#type' => 'fieldset', + '#title' => t('Ingest Digital Object Step #2') + ); + + foreach ($ingest_form_definition->form_elements->element as $element) { + $name = strip_tags($element->name->asXML()); + $title = strip_tags($element->label->asXML()); + $required = strip_tags($element->required->asXML()); + $required = strtolower($required); + + if ($required != 'TRUE') { + $required = '0'; + } + + $description = strip_tags($element->description->asXML()); + $type = strip_tags($element->type->asXML()); + $options = array(); + + if ($element->type == 'select') { + foreach ($element->authoritative_list->item as $item) { + $field = strip_tags($item->field->asXML()); + $value = strip_tags($item->value->asXML()); + $options["$field"] = $value; + } + $form['indicator2']["$name"] = array( + '#title' => $title, + '#required' => $required, + '#description' => $description, + '#type' => $type, + '#options' => $options, + ); + } + else { + $form['indicator2']["$name"] = array( + '#title' => $title, + '#required' => $required, + '#description' => $description, + '#type' => $type + ); + } + } + + return $form; + } + +} + diff --git a/plugins/FlvFormBuilder.inc b/plugins/FlvFormBuilder.inc index 37b0e0d2..8c2b5777 100644 --- a/plugins/FlvFormBuilder.inc +++ b/plugins/FlvFormBuilder.inc @@ -1,64 +1,80 @@ -getType($file); - //$fileUrl = 'http://'.$_SERVER['HTTP_HOST'].$file; - $fileUrl = $base_url .'/'. drupal_urlencode($file); - $beginIndex = strrpos($fileUrl, '/'); - $dtitle = substr($fileUrl, $beginIndex + 1); - $dtitle = substr($dtitle, 0, strpos($dtitle, ".")); - $ds1 = $dom->createElement("foxml:datastream"); - $ds1->setAttribute("ID", "FLV"); - $ds1->setAttribute("STATE", "A"); - $ds1->setAttribute("CONTROL_GROUP", "M"); - $ds1v= $dom->createElement("foxml:datastreamVersion"); - $ds1v->setAttribute("ID", "FLV.0"); - $ds1v->setAttribute("MIMETYPE", "$dformat"); - $ds1v->setAttribute("LABEL", "$dtitle"); - $ds1content = $dom->createElement('foxml:contentLocation'); - $ds1content->setAttribute("REF", "$fileUrl"); - $ds1content->setAttribute("TYPE", "URL"); - $ds1->appendChild($ds1v); - $ds1v->appendChild($ds1content); - $rootElement->appendChild($ds1); - - $createdFile = drupal_get_path('module', 'Fedora_Repository') . '/images/flashThumb.jpg'; - $fileUrl = $base_url .'/'. drupal_urlencode($createdFile); //'http://'.$_SERVER['HTTP_HOST'].'/'.$createdFile; - $ds1 = $dom->createElement("foxml:datastream"); - $ds1->setAttribute("ID", "TN"); - $ds1->setAttribute("STATE", "A"); - $ds1->setAttribute("CONTROL_GROUP", "M"); - $ds1v = $dom->createElement("foxml:datastreamVersion"); - $ds1v->setAttribute("ID", "TN.0"); - $ds1v->setAttribute("MIMETYPE", "image/jpeg"); - $ds1v->setAttribute("LABEL", "Thumbnail"); - $ds1content = $dom->createElement('foxml:contentLocation'); - $ds1content->setAttribute("REF", "$fileUrl"); - $ds1content->setAttribute("TYPE", "URL"); - $ds1->appendChild($ds1v); - $ds1v->appendChild($ds1content); - $rootElement->appendChild($ds1); - } -} - +getType($file); + //$fileUrl = 'http://'.$_SERVER['HTTP_HOST'].$file; + $fileUrl = $base_url . '/' . drupal_urlencode($file); + $beginIndex = strrpos($fileUrl, '/'); + $dtitle = substr($fileUrl, $beginIndex + 1); + $dtitle = substr($dtitle, 0, strpos($dtitle, ".")); + $ds1 = $dom->createElement("foxml:datastream"); + $ds1->setAttribute("ID", "FLV"); + $ds1->setAttribute("STATE", "A"); + $ds1->setAttribute("CONTROL_GROUP", "M"); + $ds1v = $dom->createElement("foxml:datastreamVersion"); + $ds1v->setAttribute("ID", "FLV.0"); + $ds1v->setAttribute("MIMETYPE", "$dformat"); + $ds1v->setAttribute("LABEL", "$dtitle"); + $ds1content = $dom->createElement('foxml:contentLocation'); + $ds1content->setAttribute("REF", "$fileUrl"); + $ds1content->setAttribute("TYPE", "URL"); + $ds1->appendChild($ds1v); + $ds1v->appendChild($ds1content); + $rootElement->appendChild($ds1); + + $createdFile = drupal_get_path('module', 'Fedora_Repository') . '/images/flashThumb.jpg'; + $fileUrl = $base_url . '/' . drupal_urlencode($createdFile); //'http://'.$_SERVER['HTTP_HOST'].'/'.$createdFile; + $ds1 = $dom->createElement("foxml:datastream"); + $ds1->setAttribute("ID", "TN"); + $ds1->setAttribute("STATE", "A"); + $ds1->setAttribute("CONTROL_GROUP", "M"); + $ds1v = $dom->createElement("foxml:datastreamVersion"); + $ds1v->setAttribute("ID", "TN.0"); + $ds1v->setAttribute("MIMETYPE", "image/jpeg"); + $ds1v->setAttribute("LABEL", "Thumbnail"); + $ds1content = $dom->createElement('foxml:contentLocation'); + $ds1content->setAttribute("REF", "$fileUrl"); + $ds1content->setAttribute("TYPE", "URL"); + $ds1->appendChild($ds1v); + $ds1v->appendChild($ds1content); + $rootElement->appendChild($ds1); + } + +} + diff --git a/plugins/FormBuilder.inc b/plugins/FormBuilder.inc index 4fd3fa7d..715ca6af 100644 --- a/plugins/FormBuilder.inc +++ b/plugins/FormBuilder.inc @@ -1,371 +1,406 @@ -createElement("foxml:datastream"); - $datastream->setAttribute("ID", "DC"); - $datastream->setAttribute("STATE", "A"); - $datastream->setAttribute("CONTROL_GROUP", "X"); - $version = $dom->createElement("foxml:datastreamVersion"); - $version->setAttribute("ID", "DC.0"); - $version->setAttribute("MIMETYPE", "text/xml"); - $version->setAttribute("LABEL", "Dublin Core Record"); - $datastream->appendChild($version); - $content = $dom->createElement("foxml:xmlContent"); - $version->appendChild($content); - ///begin writing qdc - $oai = $dom->createElement("oai_dc:dc"); - $oai->setAttribute('xmlns:oai_dc', "http://www.openarchives.org/OAI/2.0/oai_dc/"); - $oai->setAttribute('xmlns:dc', "http://purl.org/dc/elements/1.1/"); - $oai->setAttribute('xmlns:dcterms', "http://purl.org/dc/terms/"); - $oai->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); - $content->appendChild($oai); - //dc elements - $previousElement=NULL;//used in case we have to nest elements for qualified dublin core - foreach ($form_values as $key => $value) { - $key = str_replace('_', ':', $key); - $index = strrpos($key, '-'); - if ($index > 01) { - $key = substr($key, 0, $index); - } - $test = substr($key, 0, 2); - - if ($test == 'dc' || $test == 'ap') { - //don't try to process other form values - try { - if (!strcmp(substr($key, 0, 4), 'app_')) { - $key = substr($key, 4); - $previousElement->appendChild($dom->createElement($key, $value)); - } - else { - $previousElement = $dom->createElement($key, $value); - $oai->appendChild($previousElement); - } - } - catch (exception $e) { - drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error'); - continue; - } - } - $rootElement->appendChild($datastream); - } - - } - - //create the security Policy - function createPolicy($collectionPid, &$dom, &$rootElement) { - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - $objectHelper = new ObjectHelper(); - - $dsid = 'CHILD_SECURITY'; - $policyStreamDoc = $objectHelper->getStream($collectionPid, $dsid, FALSE); - if (!isset($policyStreamDoc)) { - return NULL; //there is no policy stream so object will not have a policy stream - } - try { - $xml = new SimpleXMLElement($policyStreamDoc); - } - catch (Exception $e) { - watchdog(t("Fedora_Repository"), t("Problem getting security policy."), NULL, WATCHDOG_ERROR); - drupal_set_message(t('Problem getting security policy: !e', array('!e' => $e->getMessage())), 'error'); - return FALSE; - } - $policyElement = $dom->createDocumentFragment(); - if (!$policyElement) { - drupal_set_message(t('Error parsing security policy stream.')); - watchdog(t("Fedora_Repository"), t("Error parsing security policy stream, could not parse policy stream."), NULL, WATCHDOG_NOTICE); - return FALSE; - } - $dom->importNode($policyElement, TRUE); - $value=$policyElement->appendXML($policyStreamDoc); - if (!$value) { - drupal_set_message(t('Error creating security policy stream.')); - watchdog(t("Fedora_Repository"), t("Error creating security policy stream, could not parse collection policy template file."), NULL, WATCHDOG_NOTICE); - return FALSE; - } - - $ds1 = $dom->createElement("foxml:datastream"); - $rootElement->appendChild($ds1); - $ds1->setAttribute("ID", "POLICY"); - $ds1->setAttribute("STATE", "A"); - $ds1->setAttribute("CONTROL_GROUP", "X"); - $ds1v = $dom->createElement("foxml:datastreamVersion"); - $ds1->appendChild($ds1v); - $ds1v->setAttribute("ID", "POLICY.0"); - $ds1v->setAttribute("MIMETYPE", "text/xml"); - $ds1v->setAttribute("LABEL", "POLICY"); - $content = $dom->createElement("foxml:xmlContent"); - $ds1v->appendChild($content); - $content->appendChild($policyElement); - return TRUE; - } - - - function handleQDCForm($form_values) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); - - $dom = new DomDocument("1.0", "UTF-8"); - $dom->formatOutput = TRUE; - $pid=$form_values['pid']; - $rootElement = $dom->createElement("foxml:digitalObject"); - $rootElement->setAttribute('VERSION', '1.1'); - $rootElement->setAttribute('PID', "$pid"); - $rootElement->setAttribute('xmlns:foxml', "info:fedora/fedora-system:def/foxml#"); - $rootElement->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); - $rootElement->setAttribute('xsi:schemaLocation', "info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd"); - $dom->appendChild($rootElement); - // Create standard fedora stuff - $this->createStandardFedoraStuff($form_values, $dom, $rootElement); - // Create relationships - $this->createRelationShips($form_values, $dom, $rootElement); - $collectionPid = $form_values['collection_pid']; - - if (($cp = CollectionPolicy::LoadFromCollection($collectionPid)) !== FALSE) { - $collectionName = trim($cp->getName()); - if (trim($collectionName) != '') { - $form_values['dc_relation'] = $collectionName; - } - } - // Create dublin core - $this->createQDCStream($form_values, $dom, $rootElement); - - if (!empty($form_values['ingest-file-location'])) { - $this->createFedoraDataStreams($form_values, $dom, $rootElement); - } - $this->createPolicy($collectionPid, &$dom, &$rootElement); - - try { - - $object = Fedora_Item::ingest_from_FOXML($dom); - if (!empty($object->pid)) { - // drupal_set_message("Item ". l($object->pid, 'fedora/repository/'. $object->pid) . " created successfully.", "status"); - drupal_set_message(t("Item !pid created successfully.", array('!pid' => l($object->pid, 'fedora/repository/'. $object->pid))), "status"); - } - if (!empty( $_SESSION['fedora_ingest_files'])) { - foreach ($_SESSION['fedora_ingest_files'] as $dsid => $createdFile) { - file_delete($createdFile); - } - } - file_delete($form_values['ingest-file-location']); - } - catch (exception $e) { - drupal_set_message(t('Error ingesting object: !e', array('!e' => $e->getMessage())), 'error'); - watchdog(t("Fedora_Repository"), t("Error ingesting object: !e", array('!e' => $e->getMessage())), NULL, WATCHDOG_ERROR); - return; - } - } - - function createFedoraDataStreams($form_values, &$dom, &$rootElement) { - module_load_include('inc', 'fedora_repository', 'MimeClass'); - global $base_url; - $mimetype = new MimeClass(); - $server=NULL; - $file=$form_values['ingest-file-location']; - - if (!empty( $file)) { - $dformat = $mimetype->getType($file); - - $parts = explode('/', $file); - foreach ($parts as $n => $part) { - $parts[$n] = rawurlencode($part); - } - $path = implode('/', $parts); - $fileUrl = $base_url . '/' . $path; - - $beginIndex = strrpos($fileUrl, '/'); - $dtitle = substr($fileUrl, $beginIndex + 1); - $dtitle = urldecode($dtitle); - $ds1 = $dom->createElement("foxml:datastream"); - $ds1->setAttribute("ID", "OBJ"); - $ds1->setAttribute("STATE", "A"); - $ds1->setAttribute("CONTROL_GROUP", "M"); - $ds1v= $dom->createElement("foxml:datastreamVersion"); - $rootElement->appendChild($ds1); - - $ds1v->setAttribute("ID", "OBJ.0"); - $ds1v->setAttribute("MIMETYPE", "$dformat"); - $ds1v->setAttribute("LABEL", "$dtitle"); - $ds1content = $dom->createElement('foxml:contentLocation'); - $ds1content->setAttribute("REF", "$fileUrl"); - $ds1content->setAttribute("TYPE", "URL"); - $ds1->appendChild($ds1v); - $ds1v->appendChild($ds1content); - } - if (!empty($_SESSION['fedora_ingest_files'])) { - - - - foreach ($_SESSION['fedora_ingest_files'] as $dsid => $createdFile) { - - - if (!empty($file)) { - $found = strstr($createdFile, $file); - if ($found !== FALSE) { - $createdFile = $found; - } - } - - $dformat = $mimetype->getType($createdFile); - $parts = explode('/', $createdFile); - foreach ($parts as $n => $part) { - $parts[$n] = rawurlencode($part); - } - $path = implode('/', $parts); - $fileUrl = $base_url . '/' . $path; - - $beginIndex = strrpos($fileUrl, '/'); - $dtitle = substr($fileUrl, $beginIndex + 1); - $dtitle = urldecode($dtitle); - $dtitle = $dtitle; - $ds1 = $dom->createElement("foxml:datastream"); - $ds1->setAttribute("ID", "$dsid"); - $ds1->setAttribute("STATE", "A"); - $ds1->setAttribute("CONTROL_GROUP", "M"); - $ds1v= $dom->createElement("foxml:datastreamVersion"); - $ds1v->setAttribute("ID", "$dsid.0"); - $ds1v->setAttribute("MIMETYPE", "$dformat"); - $ds1v->setAttribute("LABEL", "$dtitle"); - $ds1content = $dom->createElement('foxml:contentLocation'); - $ds1content->setAttribute("REF", "$fileUrl"); - $ds1content->setAttribute("TYPE", "URL"); - $ds1->appendChild($ds1v); - $ds1v->appendChild($ds1content); - $rootElement->appendChild($ds1); - } - } - } - - - /** - * Creates the RELS-EXT for the foxml - */ - function createRelationShips($form_values, &$dom, &$rootElement) { - $drdf = $dom->createElement("foxml:datastream"); - $drdf->setAttribute("ID", "RELS-EXT"); - $drdf->setAttribute("CONTROL_GROUP", "X"); - $dvrdf = $dom->createElement("foxml:datastreamVersion"); - $dvrdf->setAttribute("FORMAT_URI", "info:fedora/fedora-system:FedoraRELSExt-1.0"); - $dvrdf->setAttribute("ID", "RELS-EXT.0"); - $dvrdf->setAttribute("MIMETYPE", "application/rdf+xml"); - $dvrdf->setAttribute("LABEL", "RDF Statements about this Object"); - $dvcontent = $dom->createElement("foxml:xmlContent"); - $rdf = $dom->createElement("rdf:RDF"); - $rdf->setAttribute("xmlns:rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); - $rdf->setAttribute("xmlns:rdfs", "http://www.w3.org/2000/01/rdf-schema#"); - $rdf->setAttribute("xmlns:fedora", "info:fedora/fedora-system:def/relations-external#"); - $rdf->setAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/"); - $rdf->setAttribute("xmlns:oai_dc", "http://www.openarchives.org/OAI/2.0/oai_dc/"); - $rdf->setAttribute("xmlns:fedora-model", "info:fedora/fedora-system:def/model#"); - $rdfdesc = $dom->createElement("rdf:Description"); - $pid = $form_values['pid']; - $rdfdesc->setAttribute("rdf:about", "info:fedora/$pid"); - $relationship = $form_values['relationship']; - if (!isset($relationship)) { - $relationship = 'isMemberOfCollection'; - } - $member = $dom->createElement("fedora:". $relationship); - $membr = $form_values['collection_pid']; - $member->setAttribute("rdf:resource", "info:fedora/$membr"); - $rdfHasModel = $dom->createElement("fedora-model:hasModel"); - $contentModelPid=$form_values['content_model_pid']; - $rdfHasModel->setAttribute("rdf:resource", "info:fedora/$contentModelPid"); - $drdf->appendChild($dvrdf); - $dvrdf->appendChild($dvcontent); - $dvcontent->appendChild($rdf); - $rdf->appendChild($rdfdesc); - $rdfdesc->appendChild($member); - $rdfdesc->appendChild($rdfHasModel); - $rootElement->appendChild($drdf); - } - - - /** - * Creates the standard foxml properties - */ - function createStandardFedoraStuff($form_values, &$dom, &$rootElement) { - // Foxml object properties section - $objproperties = $dom->createElement("foxml:objectProperties"); - $prop2 = $dom->createElement("foxml:property"); - $prop2->setAttribute("NAME", "info:fedora/fedora-system:def/model#state"); - $prop2->setAttribute("VALUE", "A"); - $prop3 = $dom->createElement("foxml:property"); - $prop3->setAttribute("NAME", "info:fedora/fedora-system:def/model#label"); - $prop3->setAttribute("VALUE", $form_values['dc:title']); - $prop5 = $dom->createElement("foxml:property"); - $prop5->setAttribute("NAME", "info:fedora/fedora-system:def/model#ownerId"); - $prop5->setAttribute("VALUE", $form_values['user_id']); - $objproperties->appendChild($prop2); - $objproperties->appendChild($prop3); - $objproperties->appendChild($prop5); - $rootElement->appendChild($objproperties); - } - - - function buildQDCForm(&$form, $elements, &$form_values) { - $form['#multistep'] = TRUE; // used so that it triggers a form rebuild every time. - $form['indicator2'] = array( - '#type' => 'fieldset', - '#title' => t('Ingest digital object step #2'), - ); - - foreach ($elements as $element) { - - if ($element['type'] == 'markup') { - $el = array('#value'=> $element['description']); - } else { - $el = array( - '#title' => $element['label'], - '#required' => ($element['required'] ? 1 : 0), - '#description' => $element['description'], - '#type' => $element['type'] - ); - } - - $name = explode('][', $element['name']); - $elLocation = &$form['indicator2']; - while (isset($elLocation[$name[0]]) && ($partial = array_shift($name)) != NULL) { - $elLocation = &$elLocation[$partial]; - } - - $autocomplete_path = FALSE; - $autocomplete_omit_collection = FALSE; - foreach ($element['parameters'] as $key => $val) { - if ($key == '#autocomplete_path') { - $autocomplete_path = $val; - } elseif ($key == '#autocomplete_omit_collection') { - $autocomplete_omit_collection = TRUE; - } else { - $el[$key]=$val; - } - } - - if ($autocomplete_path !== FALSE) { - $el['#autocomplete_path'] = $autocomplete_path . (!$autocomplete_omit_collection?'/'.$form_values['storage']['collection_pid']:'/'); - } - - if ($element['type'] == 'select' || $element['type'] == 'other_select') { - $el['#options']= isset($element['authoritative_list'])?$element['authoritative_list']:array(); - } - - $elLocation[join('][', $name)] = $el; - } - - return $form; - } - -} +createElement("foxml:datastream"); + $datastream->setAttribute("ID", "DC"); + $datastream->setAttribute("STATE", "A"); + $datastream->setAttribute("CONTROL_GROUP", "X"); + $version = $dom->createElement("foxml:datastreamVersion"); + $version->setAttribute("ID", "DC.0"); + $version->setAttribute("MIMETYPE", "text/xml"); + $version->setAttribute("LABEL", "Dublin Core Record"); + $datastream->appendChild($version); + $content = $dom->createElement("foxml:xmlContent"); + $version->appendChild($content); + ///begin writing qdc + $oai = $dom->createElement("oai_dc:dc"); + $oai->setAttribute('xmlns:oai_dc', "http://www.openarchives.org/OAI/2.0/oai_dc/"); + $oai->setAttribute('xmlns:dc', "http://purl.org/dc/elements/1.1/"); + $oai->setAttribute('xmlns:dcterms', "http://purl.org/dc/terms/"); + $oai->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); + $content->appendChild($oai); + //dc elements + $previousElement = NULL; //used in case we have to nest elements for qualified dublin core + foreach ($form_values as $key => $value) { + $key = str_replace('_', ':', $key); + $index = strrpos($key, '-'); + if ($index > 01) { + $key = substr($key, 0, $index); + } + $test = substr($key, 0, 2); + + if ($test == 'dc' || $test == 'ap') { + //don't try to process other form values + try { + if (!strcmp(substr($key, 0, 4), 'app_')) { + $key = substr($key, 4); + $previousElement->appendChild($dom->createElement($key, $value)); + } + else { + $previousElement = $dom->createElement($key, $value); + $oai->appendChild($previousElement); + } + } catch (exception $e) { + drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))), 'error'); + continue; + } + } + $rootElement->appendChild($datastream); + } + } + + /** + * Create the security policy + * @param type $collectionPid + * @param type $dom + * @param type $rootElement + * @return type + */ + function createPolicy($collectionPid, &$dom, &$rootElement) { + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + $objectHelper = new ObjectHelper(); + + $dsid = 'CHILD_SECURITY'; + $policyStreamDoc = $objectHelper->getStream($collectionPid, $dsid, FALSE); + if (!isset($policyStreamDoc)) { + return NULL; //there is no policy stream so object will not have a policy stream + } + try { + $xml = new SimpleXMLElement($policyStreamDoc); + } catch (Exception $e) { + watchdog(t("Fedora_Repository"), "Problem getting security policy.", NULL, WATCHDOG_ERROR); + drupal_set_message(t('Problem getting security policy: @e', array('@e' => check_plain($e->getMessage()))), 'error'); + return FALSE; + } + $policyElement = $dom->createDocumentFragment(); + if (!$policyElement) { + drupal_set_message(t('Error parsing security policy stream.')); + watchdog(t("Fedora_Repository"), "Error parsing security policy stream, could not parse policy stream.", NULL, WATCHDOG_NOTICE); + return FALSE; + } + $dom->importNode($policyElement, TRUE); + $value = $policyElement->appendXML($policyStreamDoc); + if (!$value) { + drupal_set_message(t('Error creating security policy stream.')); + watchdog(t("Fedora_Repository"), "Error creating security policy stream, could not parse collection policy template file.", NULL, WATCHDOG_NOTICE); + return FALSE; + } + + $ds1 = $dom->createElement("foxml:datastream"); + $rootElement->appendChild($ds1); + $ds1->setAttribute("ID", "POLICY"); + $ds1->setAttribute("STATE", "A"); + $ds1->setAttribute("CONTROL_GROUP", "X"); + $ds1v = $dom->createElement("foxml:datastreamVersion"); + $ds1->appendChild($ds1v); + $ds1v->setAttribute("ID", "POLICY.0"); + $ds1v->setAttribute("MIMETYPE", "text/xml"); + $ds1v->setAttribute("LABEL", "POLICY"); + $content = $dom->createElement("foxml:xmlContent"); + $ds1v->appendChild($content); + $content->appendChild($policyElement); + return TRUE; + } + + /** + * Handle QDC Form ?? + * @param type $form_values + * @return type + */ + function handleQDCForm($form_values) { + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); + + $dom = new DomDocument("1.0", "UTF-8"); + $dom->formatOutput = TRUE; + $pid = $form_values['pid']; + $rootElement = $dom->createElement("foxml:digitalObject"); + $rootElement->setAttribute('VERSION', '1.1'); + $rootElement->setAttribute('PID', "$pid"); + $rootElement->setAttribute('xmlns:foxml', "info:fedora/fedora-system:def/foxml#"); + $rootElement->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); + $rootElement->setAttribute('xsi:schemaLocation', "info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd"); + $dom->appendChild($rootElement); + // Create standard fedora stuff + $this->createStandardFedoraStuff($form_values, $dom, $rootElement); + // Create relationships + $this->createRelationShips($form_values, $dom, $rootElement); + $collectionPid = $form_values['collection_pid']; + + if (($cp = CollectionPolicy::LoadFromCollection($collectionPid)) !== FALSE) { + $collectionName = trim($cp->getName()); + if (trim($collectionName) != '') { + $form_values['dc_relation'] = $collectionName; + } + } + // Create dublin core + $this->createQDCStream($form_values, $dom, $rootElement); + + if (!empty($form_values['ingest-file-location'])) { + $this->createFedoraDataStreams($form_values, $dom, $rootElement); + } + $this->createPolicy($collectionPid, &$dom, &$rootElement); + + try { + + $object = Fedora_Item::ingest_from_FOXML($dom); + if (!empty($object->pid)) { + // drupal_set_message("Item ". l($object->pid, 'fedora/repository/'. $object->pid) . " created successfully.", "status"); + drupal_set_message(t("Item !pid created successfully.", array('!pid' => l(check_plain($object->pid), 'fedora/repository/' . check_plain($object->pid)))), "status"); + } + if (!empty($_SESSION['fedora_ingest_files'])) { + foreach ($_SESSION['fedora_ingest_files'] as $dsid => $createdFile) { + file_delete($createdFile); + } + } + file_delete($form_values['ingest-file-location']); + } catch (exception $e) { + drupal_set_message(t('Error ingesting object: @e', array('@e' => check_plain($e->getMessage()))), 'error'); + watchdog(t("Fedora_Repository"), "Error ingesting object: @e", array('@e' => check_plain($e->getMessage())), NULL, WATCHDOG_ERROR); + return; + } + } + + /** + * Create Fedora Data stream + * @global type $base_url + * @param type $form_values + * @param type $dom + * @param type $rootElement + */ + function createFedoraDataStreams($form_values, &$dom, &$rootElement) { + module_load_include('inc', 'fedora_repository', 'MimeClass'); + global $base_url; + $mimetype = new MimeClass(); + $server = NULL; + $file = $form_values['ingest-file-location']; + + if (!empty($file)) { + $dformat = $mimetype->getType($file); + + $parts = explode('/', $file); + foreach ($parts as $n => $part) { + $parts[$n] = rawurlencode($part); + } + $path = implode('/', $parts); + $fileUrl = $base_url . '/' . $path; + + $beginIndex = strrpos($fileUrl, '/'); + $dtitle = substr($fileUrl, $beginIndex + 1); + $dtitle = urldecode($dtitle); + $ds1 = $dom->createElement("foxml:datastream"); + $ds1->setAttribute("ID", "OBJ"); + $ds1->setAttribute("STATE", "A"); + $ds1->setAttribute("CONTROL_GROUP", "M"); + $ds1v = $dom->createElement("foxml:datastreamVersion"); + $rootElement->appendChild($ds1); + + $ds1v->setAttribute("ID", "OBJ.0"); + $ds1v->setAttribute("MIMETYPE", "$dformat"); + $ds1v->setAttribute("LABEL", "$dtitle"); + $ds1content = $dom->createElement('foxml:contentLocation'); + $ds1content->setAttribute("REF", "$fileUrl"); + $ds1content->setAttribute("TYPE", "URL"); + $ds1->appendChild($ds1v); + $ds1v->appendChild($ds1content); + } + if (!empty($_SESSION['fedora_ingest_files'])) { + + foreach ($_SESSION['fedora_ingest_files'] as $dsid => $createdFile) { + + if (!empty($file)) { + $found = strstr($createdFile, $file); + if ($found !== FALSE) { + $createdFile = $found; + } + } + + $dformat = $mimetype->getType($createdFile); + $parts = explode('/', $createdFile); + foreach ($parts as $n => $part) { + $parts[$n] = rawurlencode($part); + } + $path = implode('/', $parts); + $fileUrl = $base_url . '/' . $path; + + $beginIndex = strrpos($fileUrl, '/'); + $dtitle = substr($fileUrl, $beginIndex + 1); + $dtitle = urldecode($dtitle); + $dtitle = $dtitle; + $ds1 = $dom->createElement("foxml:datastream"); + $ds1->setAttribute("ID", "$dsid"); + $ds1->setAttribute("STATE", "A"); + $ds1->setAttribute("CONTROL_GROUP", "M"); + $ds1v = $dom->createElement("foxml:datastreamVersion"); + $ds1v->setAttribute("ID", "$dsid.0"); + $ds1v->setAttribute("MIMETYPE", "$dformat"); + $ds1v->setAttribute("LABEL", "$dtitle"); + $ds1content = $dom->createElement('foxml:contentLocation'); + $ds1content->setAttribute("REF", "$fileUrl"); + $ds1content->setAttribute("TYPE", "URL"); + $ds1->appendChild($ds1v); + $ds1v->appendChild($ds1content); + $rootElement->appendChild($ds1); + } + } + } + + /** + * Creates the RELS-EXT for the foxml + * @param type $form_values + * @param type $dom + * @param type $rootElement + */ + function createRelationShips($form_values, &$dom, &$rootElement) { + $drdf = $dom->createElement("foxml:datastream"); + $drdf->setAttribute("ID", "RELS-EXT"); + $drdf->setAttribute("CONTROL_GROUP", "X"); + $dvrdf = $dom->createElement("foxml:datastreamVersion"); + $dvrdf->setAttribute("FORMAT_URI", "info:fedora/fedora-system:FedoraRELSExt-1.0"); + $dvrdf->setAttribute("ID", "RELS-EXT.0"); + $dvrdf->setAttribute("MIMETYPE", "application/rdf+xml"); + $dvrdf->setAttribute("LABEL", "RDF Statements about this Object"); + $dvcontent = $dom->createElement("foxml:xmlContent"); + $rdf = $dom->createElement("rdf:RDF"); + $rdf->setAttribute("xmlns:rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); + $rdf->setAttribute("xmlns:rdfs", "http://www.w3.org/2000/01/rdf-schema#"); + $rdf->setAttribute("xmlns:fedora", "info:fedora/fedora-system:def/relations-external#"); + $rdf->setAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/"); + $rdf->setAttribute("xmlns:oai_dc", "http://www.openarchives.org/OAI/2.0/oai_dc/"); + $rdf->setAttribute("xmlns:fedora-model", "info:fedora/fedora-system:def/model#"); + $rdfdesc = $dom->createElement("rdf:Description"); + $pid = $form_values['pid']; + $rdfdesc->setAttribute("rdf:about", "info:fedora/$pid"); + $relationship = $form_values['relationship']; + if (!isset($relationship)) { + $relationship = 'isMemberOfCollection'; + } + $member = $dom->createElement("fedora:" . $relationship); + $membr = $form_values['collection_pid']; + $member->setAttribute("rdf:resource", "info:fedora/$membr"); + $rdfHasModel = $dom->createElement("fedora-model:hasModel"); + $contentModelPid = $form_values['content_model_pid']; + $rdfHasModel->setAttribute("rdf:resource", "info:fedora/$contentModelPid"); + $drdf->appendChild($dvrdf); + $dvrdf->appendChild($dvcontent); + $dvcontent->appendChild($rdf); + $rdf->appendChild($rdfdesc); + $rdfdesc->appendChild($member); + $rdfdesc->appendChild($rdfHasModel); + $rootElement->appendChild($drdf); + } + + /** + * Creates the standard foxml properties + * @param type $form_values + * @param type $dom + * @param type $rootElement + */ + function createStandardFedoraStuff($form_values, &$dom, &$rootElement) { + // Foxml object properties section + $objproperties = $dom->createElement("foxml:objectProperties"); + $prop2 = $dom->createElement("foxml:property"); + $prop2->setAttribute("NAME", "info:fedora/fedora-system:def/model#state"); + $prop2->setAttribute("VALUE", "A"); + $prop3 = $dom->createElement("foxml:property"); + $prop3->setAttribute("NAME", "info:fedora/fedora-system:def/model#label"); + $prop3->setAttribute("VALUE", $form_values['dc:title']); + $prop5 = $dom->createElement("foxml:property"); + $prop5->setAttribute("NAME", "info:fedora/fedora-system:def/model#ownerId"); + $prop5->setAttribute("VALUE", $form_values['user_id']); + $objproperties->appendChild($prop2); + $objproperties->appendChild($prop3); + $objproperties->appendChild($prop5); + $rootElement->appendChild($objproperties); + } + + /** + * Build QDC Form + * @param type $form + * @param type $elements + * @param type $form_values + * @return string + */ + function buildQDCForm(&$form, $elements, &$form_values) { + $form['#multistep'] = TRUE; // used so that it triggers a form rebuild every time. + $form['indicator2'] = array( + '#type' => 'fieldset', + '#title' => t('Ingest digital object step #2'), + ); + + foreach ($elements as $element) { + + if ($element['type'] == 'markup') { + $el = array('#value' => $element['description']); + } + else { + $el = array( + '#title' => $element['label'], + '#required' => ($element['required'] ? 1 : 0), + '#description' => $element['description'], + '#type' => $element['type'] + ); + } + + $name = explode('][', $element['name']); + $elLocation = &$form['indicator2']; + while (isset($elLocation[$name[0]]) && ($partial = array_shift($name)) != NULL) { + $elLocation = &$elLocation[$partial]; + } + + $autocomplete_path = FALSE; + $autocomplete_omit_collection = FALSE; + foreach ($element['parameters'] as $key => $val) { + if ($key == '#autocomplete_path') { + $autocomplete_path = $val; + } + elseif ($key == '#autocomplete_omit_collection') { + $autocomplete_omit_collection = TRUE; + } + else { + $el[$key] = $val; + } + } + + if ($autocomplete_path !== FALSE) { + $el['#autocomplete_path'] = $autocomplete_path . (!$autocomplete_omit_collection ? '/' . $form_values['storage']['collection_pid'] : '/'); + } + + if ($element['type'] == 'select' || $element['type'] == 'other_select') { + $el['#options'] = isset($element['authoritative_list']) ? $element['authoritative_list'] : array(); + } + + $elLocation[join('][', $name)] = $el; + } + + return $form; + } + +} diff --git a/plugins/ImageManipulation.inc b/plugins/ImageManipulation.inc index 9971c367..4faabdd8 100644 --- a/plugins/ImageManipulation.inc +++ b/plugins/ImageManipulation.inc @@ -1,206 +1,259 @@ -&1 &', $output, $returnValue); - } - else - $returnValue = '0'; - - if ($returnValue == '0') { - $_SESSION['fedora_ingest_files']["$dsid"] = $destFile; - return TRUE; - } - else { - return $returnValue; - } - } - - function createPNG($parameterArray = NULL, $dsid, $file, $file_ext) { - $file_suffix = '_' . $dsid . '.' . $file_ext; - $returnValue = TRUE; - - if (!file_exists($file . $file_suffix)) { - system("convert \"$file\" \"$file$file_suffix\" 2>&1 &", $returnValue); - } - else { - $returnValue = '0'; - } - - if ($returnValue == '0') { - $_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_suffix; - return TRUE; - } - else { - return $returnValue; - } - } - - function createJP2($parameterArray = NULL, $dsid, $file, $file_ext) { - $file_suffix = "_$dsid.$file_ext"; - $return_value = TRUE; - - $output = array(); - - exec('kdu_compress -i "' . $file . '" -o "' . $file . $file_suffix . '" -rate 0.5 Clayers=1 Clevels=7 "Cprecincts={256,256},{256,256},{256,256},{128,128},{128,128},{64,64},{64,64},{32,32},{16,16}" "Corder=RPCL" "ORGgen_plt=yes" "ORGtparts=R" "Cblk={32,32}" Cuse_sop=yes', $output, $returnValue); - - if ($returnValue == '0') { - $_SESSION['fedora_ingest_files'][$dsid] = $file . $file_suffix; - } - else { - ObjectHelper::warnIfMisconfigured('Kakadu'); - } - - exec('kdu_compress -i "' . $file . '" -o "' . $file . "_lossless.jp2" . '" -rate -,0.5 Clayers=2 Creversible=yes Clevels=8 "Cprecincts={256,256},{256,256},{128,128}" Corder="RPCL" ORGgen_plt="yes" ORGtparts="R" Cblk="{32,32}"', $output, $returnValue); - if ($returnValue == '0') { - $_SESSION['fedora_ingest_files']["LOSSLESS_JP2"] = $file . '_lossless.jp2'; - } - else { - ObjectHelper::warnIfMisconfigured('Kakadu'); - } - exec("convert -resize 800 \"{$file}\"[0] \"$file-med.jpg\"", $output, $returnValue); - if ($returnValue == '0') { - $_SESSION['fedora_ingest_files']["JPG"] = $file . '-med.jpg'; - } - else { - ObjectHelper::warnIfMisconfigured('ImageMagick'); - } - exec("convert {$file}[0] -thumbnail x2000 -thumbnail x450 -resize '450x<' -resize 50% -fuzz 1% -trim +repage -gravity center -crop 200x200+0+0 +repage -format jpg -quality 100 $file-tn.jpg", $output, $returnValue); - if ($returnValue == '0') { - $_SESSION['fedora_ingest_files']["TN"] = $file . '-tn.jpg'; - } - else { - ObjectHelper::warnIfMisconfigured('ImageMagick'); - } - - if ($returnValue == '0') { - return TRUE; - } - else { - - return $returnValue; - } - } - - //use imagemapi to manipulate images instead of going directly to imagemagick or whatever - function manipulateImage($parameterArray = NULL, $dsid, $file, $file_ext) { - $height = $parameterArray['height']; - $width = $parameterArray['width']; - - $file_suffix = '_' . $dsid . '.' . $file_ext; - $returnValue = TRUE; - - - $image = imageapi_image_open($file); - - if (!$image) { - drupal_set_message(t("Error opening image.")); - return FALSE; - } - - if (!empty($height) || !empty($width)) { - $returnValue = imageapi_image_scale($image, $height, $width); - } - - if (!$returnValue) { - drupal_set_message(t("Error scaling image.")); - return $returnValue; - } - $filename = substr(strrchr($file, '/'), 1); - $output_path = $_SERVER['DOCUMENT_ROOT'] . base_path() . file_directory_path() . '/' . $filename . $file_suffix; - $returnValue = imageapi_image_close($image, $output_path); - if ($returnValue) { - $_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_suffix; - return TRUE; - } - else { - return $returnValue; - } - } - - function createThumbnailFromPDF($parameterArray, $dsid, $file, $file_ext) { - $height = $parameterArray['height']; - $width = $parameterArray['width']; - $file_suffix = '_' . $dsid . '.' . $file_ext; - $returnValue = TRUE; - //system("convert $file\[0\] -thumbnail 128x128 $uploaddir$thumb"); - // Use this for Linux. - if (stristr($_SERVER['SERVER_SOFTWARE'], 'microsoft')) { - - } - elseif (stristr($_SERVER['SERVER_SOFTWARE'], 'linux')) { - $cmdline = "/usr/local/bin/convert \"$file\"\[0\] -colorspace RGB -thumbnail $width" . "x$height \"$file$file_suffix\""; - } - elseif (stristr($_SERVER['SERVER_SOFTWARE'], 'unix')) { - // Use this for Mac OS X (MAMP) - $cmdline = "sips -s format jpeg \"$file\" -z $height $height --out \"$file$file_suffix\" >/dev/null"; - } - else { - $cmdline = "convert \"$file\"\[0\] -colorspace RGB -thumbnail " . $width . "x" . $height . " \"$file$file_suffix\""; - } - - system($cmdline, $returnValue); - //system("convert $file\[0\] -thumbnail 128x128 $uploaddir$thumb"); - $var = $file . $file_suffix . ' returnvalue= ' . $returnValue; - - if ($returnValue == '0') { - $_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_suffix; - return TRUE; - } - else { - return $returnValue; - } - } - - function createThumbnail($parameterArray, $dsid, $file, $file_ext) { - // var_dump($parameterArray);exit(0); - $file_suffix = '_' . $dsid . '.' . $file_ext; - $height = $parameterArray['height']; - $width = $parameterArray['width']; - $returnValue = TRUE; - system("convert -resize $width -quality 85 \"$file\"\[0\] -strip \"$file$file_suffix\" 2>&1 &", $returnValue); - //system("convert -resize $width -quality 85 \"$file\" -strip \"$file$file_suffix\"",$returnValue); - - if ($returnValue == '0') { - $_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_suffix; - return TRUE; - } - else { - return $returnValue; - } - } - -} +&1 &', $output, $returnValue); + } + else + $returnValue = '0'; + + if ($returnValue == '0') { + $_SESSION['fedora_ingest_files']["$dsid"] = $destFile; + return TRUE; + } + else { + return $returnValue; + } + } + + /** + * Create PNG + * @param type $parameterArray + * @param type $dsid + * @param type $file + * @param type $file_ext + * @return string + */ + function createPNG($parameterArray = NULL, $dsid, $file, $file_ext) { + $file_suffix = '_' . $dsid . '.' . $file_ext; + $returnValue = TRUE; + + if (!file_exists($file . $file_suffix)) { + system("convert \"$file\" \"$file$file_suffix\" 2>&1 &", $returnValue); + } + else { + $returnValue = '0'; + } + + if ($returnValue == '0') { + $_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_suffix; + return TRUE; + } + else { + return $returnValue; + } + } + + /** + * Create JPEG 2000 + * @param type $parameterArray + * @param type $dsid + * @param type $file + * @param type $file_ext + * @return type + */ + function createJP2($parameterArray = NULL, $dsid, $file, $file_ext) { + $file_suffix = "_$dsid.$file_ext"; + $return_value = TRUE; + + $output = array(); + + exec('kdu_compress -i "' . $file . '" -o "' . $file . $file_suffix . '" -rate 0.5 Clayers=1 Clevels=7 "Cprecincts={256,256},{256,256},{256,256},{128,128},{128,128},{64,64},{64,64},{32,32},{16,16}" "Corder=RPCL" "ORGgen_plt=yes" "ORGtparts=R" "Cblk={32,32}" Cuse_sop=yes', $output, $returnValue); + + if ($returnValue == '0') { + $_SESSION['fedora_ingest_files'][$dsid] = $file . $file_suffix; + } + else { + ObjectHelper::warnIfMisconfigured('Kakadu'); + } + + exec('kdu_compress -i "' . $file . '" -o "' . $file . "_lossless.jp2" . '" -rate -,0.5 Clayers=2 Creversible=yes Clevels=8 "Cprecincts={256,256},{256,256},{128,128}" Corder="RPCL" ORGgen_plt="yes" ORGtparts="R" Cblk="{32,32}"', $output, $returnValue); + if ($returnValue == '0') { + $_SESSION['fedora_ingest_files']["LOSSLESS_JP2"] = $file . '_lossless.jp2'; + } + else { + ObjectHelper::warnIfMisconfigured('Kakadu'); + } + exec("convert -resize 800 \"{$file}\"[0] \"$file-med.jpg\"", $output, $returnValue); + if ($returnValue == '0') { + $_SESSION['fedora_ingest_files']["JPG"] = $file . '-med.jpg'; + } + else { + ObjectHelper::warnIfMisconfigured('ImageMagick'); + } + exec("convert \"{$file}\"[0] -thumbnail x2000 -thumbnail x450 -resize '450x<' -resize 50% -fuzz 1% -trim +repage -gravity center -crop 200x200+0+0 +repage -format jpg -quality 100 $file-tn.jpg", $output, $returnValue); + if ($returnValue == '0') { + $_SESSION['fedora_ingest_files']["TN"] = $file . '-tn.jpg'; + } + else { + ObjectHelper::warnIfMisconfigured('ImageMagick'); + } + + if ($returnValue == '0') { + return TRUE; + } + else { + + return $returnValue; + } + } + + /** + * use imagemapi to manipulate images instead of going directly to imagemagick or whatever + * @param type $parameterArray + * @param type $dsid + * @param type $file + * @param type $file_ext + * @return type + */ + function manipulateImage($parameterArray = NULL, $dsid, $file, $file_ext) { + $height = $parameterArray['height']; + $width = $parameterArray['width']; + + $file_suffix = '_' . $dsid . '.' . $file_ext; + $returnValue = TRUE; + + + $image = imageapi_image_open($file); + + if (!$image) { + drupal_set_message(t("Error opening image.")); + return FALSE; + } + + if (!empty($height) || !empty($width)) { + $returnValue = imageapi_image_scale($image, $height, $width); + } + + if (!$returnValue) { + drupal_set_message(t("Error scaling image.")); + return $returnValue; + } + $filename = substr(strrchr($file, '/'), 1); + $output_path = $_SERVER['DOCUMENT_ROOT'] . base_path() . file_directory_path() . '/' . $filename . $file_suffix; + $returnValue = imageapi_image_close($image, $output_path); + if ($returnValue) { + $_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_suffix; + return TRUE; + } + else { + return $returnValue; + } + } + + /** + * Create Thumbnail from PDF + * @param type $parameterArray + * @param type $dsid + * @param type $file + * @param type $file_ext + * @return boolean + */ + function createThumbnailFromPDF($parameterArray, $dsid, $file, $file_ext) { + $height = $parameterArray['height']; + $width = $parameterArray['width']; + $file_suffix = '_' . $dsid . '.' . $file_ext; + $returnValue = TRUE; + //system("convert $file\[0\] -thumbnail 128x128 $uploaddir$thumb"); + // Use this for Linux. + if (stristr($_SERVER['SERVER_SOFTWARE'], 'microsoft')) { + + } + elseif (stristr($_SERVER['SERVER_SOFTWARE'], 'linux')) { + $cmdline = "/usr/local/bin/convert \"$file\"\[0\] -colorspace RGB -thumbnail $width" . "x$height \"$file$file_suffix\""; + } + elseif (stristr($_SERVER['SERVER_SOFTWARE'], 'unix')) { + // Use this for Mac OS X (MAMP) + $cmdline = "sips -s format jpeg \"$file\" -z $height $height --out \"$file$file_suffix\" >/dev/null"; + } + else { + $cmdline = "convert \"$file\"\[0\] -colorspace RGB -thumbnail " . $width . "x" . $height . " \"$file$file_suffix\""; + } + + system($cmdline, $returnValue); + //system("convert $file\[0\] -thumbnail 128x128 $uploaddir$thumb"); + $var = $file . $file_suffix . ' returnvalue= ' . $returnValue; + + if ($returnValue == '0') { + $_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_suffix; + return TRUE; + } + else { + return $returnValue; + } + } + + /** + * Create Thumbnail + * @param type $parameterArray + * @param type $dsid + * @param type $file + * @param type $file_ext + * @return boolean + */ + function createThumbnail($parameterArray, $dsid, $file, $file_ext) { + // var_dump($parameterArray);exit(0); + $file_suffix = '_' . $dsid . '.' . $file_ext; + $height = $parameterArray['height']; + $width = $parameterArray['width']; + $returnValue = TRUE; + system("convert -resize $width -quality 85 \"$file\"\[0\] -strip \"$file$file_suffix\" 2>&1 &", $returnValue); + //system("convert -resize $width -quality 85 \"$file\" -strip \"$file$file_suffix\"",$returnValue); + + if ($returnValue == '0') { + $_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_suffix; + return TRUE; + } + else { + return $returnValue; + } + } + +} diff --git a/plugins/ModsFormBuilder.inc b/plugins/ModsFormBuilder.inc index 6eb36d1b..aa0f6f92 100644 --- a/plugins/ModsFormBuilder.inc +++ b/plugins/ModsFormBuilder.inc @@ -1,724 +1,764 @@ -pid=$pid; - $this->cm = ContentModel::loadFromObject($pid); - $this->item = new fedora_item($pid); - } - } - - function handleEditMetadataForm(&$form_id, &$form_values, &$soap_client) - { - $dom = new DomDocument("1.0", "UTF-8"); - $dom->formatOutput = TRUE; - $mods = $this->modsFromForm($form_values,$dom); - $dom->appendChild($mods); - - if ($this->item->modify_datastream_by_value($dom->saveXML(), 'MODS', "MODS Record", 'text/xml') !== NULL) { - drupal_set_message(t('Successfully updated MODS datastream for object %pid', array('%pid'=>$this->pid))); - } - drupal_goto('/fedora/repository/'.$this->pid); - } - - function buildEditMetadataForm() - { - $form['#multistep'] = TRUE; // used so that it triggers a form rebuild every time. - $form['indicator2'] = array( - '#type' => 'fieldset', - '#title' => t('Edit metadata'), - ); - - if ($this->cm !== FALSE && $this->item != NULL) { - $form['pid'] = array('#type'=>'hidden','#value'=>$this->pid); - - $elements = $this->cm->getIngestFormElements(); - $content = $this->item->get_datastream_dissemination('MODS'); - - if (trim($content) != '') { - $dom = DOMDocument::loadXML($content); - $xpath = new DOMXPath($dom); - // Register the php: namespace (required) - $xpath->registerNamespace("php", "http://php.net/xpath"); - - // Register PHP functions (no restrictions) - $xpath->registerPHPFunctions(); - - foreach ($elements as $element) { - - $el = array( - '#title' => $element['label'], - '#required' => ($element['required'] ? 1 : 0), - '#description' => $element['description'], - '#type' => $element['type'] - ); - - $includeEl = true; - $elname = explode('][', $element['name']); - $elLocation = &$form['indicator2']; - while (isset($elLocation[$name[0]]) && ($partial = array_shift($elname)) != NULL) { - $elLocation = &$elLocation[$partial]; - } - - foreach ($element['parameters'] as $key => $val) { - switch ($key) { - case '#autocomplete_path': - $val .= '/'. $form_values['storage']['collection_pid']; - break; - - case '#exclude_from_edit_metadata': - $includeEl=FALSE; - break; - - - case '#edit_metadata_xpath': - $nodeList = $xpath->evaluate($val); -// echo $val. ' '.$nodeList->length.' '; -// echo $nodeList->item(0)->nodeValue.' '; -// echo '
    '; - - if (is_string($nodeList)) - { - $el['#default_value']=$nodeList; - } else if ($nodeList->length > 1) - { - $el['#default_value'] = array(); - foreach ($nodeList as $node) - { - $el['#default_value'][] = $node->nodeValue; - } - } else if ($nodeList->length > 0) - { - if ($el['#type'] == 'list') { - $values=array(); - for ($i=0;$i<$nodeList->length;$i++) { - $values[]=$nodeList->item($i)->nodeValue; - } - $el['#default_value']=join('; ',$values); - } else { - $el['#default_value'] = $nodeList->item(0)->nodeValue; - } - } - break; - } - - if ($key != '#sticky') { - $el[$key]=$val; - } - - } - - if ($element['type'] == 'people') - { - - $names = $xpath->evaluate('/mods:mods/mods:name'); - $people=array(); - foreach ($names as $mname) { - - $type = $mname->getAttribute('type'); - $role = $mname->getElementsByTagName('roleTerm')->item(0)->nodeValue; - - $nameParts = $mname->getElementsByTagName('namePart'); - foreach ($nameParts as $namePart) - { - switch ($namePart->getAttribute('type')) { - case 'given': $given = $namePart->nodeValue; break; - case 'family': $family = $namePart->nodeValue; break; - case 'termsOfAddress': $title = $namePart->nodeValue; break; - case 'date': $date = $namePart->nodeValue; break; - default: $name = $namePart->nodeValue; break; - } - } - - $person=array('role'=>$role); - switch ($type) - { - case 'personal': - if (isset($given) && isset($family) && !isset($name)) { - $name = (isset($title)?$title.' ':'').$family.', '.$family; - } - $person['name']=$name; - $person['date']=$date; - break; - case 'organization': - $person['organization'] = $name; - break; - case 'conference': - $person['conference']=$name; - $person['date']=$date; - break; - } - $people[]=$person; - } - - $names = $xpath->evaluate('/mods:mods/mods:subject/mods:name'); - foreach ($names as $mname) { - - $type = $mname->getAttribute('type'); - - $nameParts = $mname->getElementsByTagName('namePart'); - foreach ($nameParts as $namePart) - { - switch ($namePart->getAttribute('type')) { - case 'given': $given = $namePart->nodeValue; break; - case 'family': $family = $namePart->nodeValue; break; - case 'termsOfAddress': $title = $namePart->nodeValue; break; - case 'date': $date = $namePart->nodeValue; break; - default: $name = $namePart->nodeValue; break; - } - } - - $person=array('subject'=>1); - switch ($type) - { - case 'personal': - if (isset($given) && isset($family) && !isset($name)) { - $name = (isset($title)?$title.' ':'').$family.', '.$family; - } - $person['name']=$name; - $person['date']=$date; - break; - case 'organization': - $person['organization'] = $name; - break; - case 'conference': - $person['conference']=$name; - $person['date']=$date; - break; - } - $people[]=$person; - } - - $el['#default_value'] = $people; - - } - - - if ($element['type'] == 'select' || $element['type'] == 'other_select') { - $el['#options']= isset($element['authoritative_list'])?$element['authoritative_list']:array(); - } - - if ($includeEl) { - $elLocation[join('][', $elname)] = $el; - } - } - - $form['submit'] = array( - '#type' => 'submit', - '#submit' => array('fedora_repository_edit_qdc_form_submit'), - '#value' => 'Save Metadata' - ); - - return $form; - - } - } - - } - - function handleModsForm(&$form_values,&$form_state) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); - - $form_state['storage']['people']=NULL; //clears out old entities for the next run of the formbuilder. - - $dom = new DomDocument("1.0", "UTF-8"); - $dom->formatOutput = TRUE; - $pid=$form_values['pid']; - $rootElement = $dom->createElement("foxml:digitalObject"); - $rootElement->setAttribute('VERSION', '1.1'); - $rootElement->setAttribute('PID', "$pid"); - $rootElement->setAttribute('xmlns:foxml', "info:fedora/fedora-system:def/foxml#"); - $rootElement->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); - $rootElement->setAttribute('xsi:schemaLocation', "info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd"); - $dom->appendChild($rootElement); - - // Create standard fedora stuff - $form_values['dc:title'] = $form_values['mods_title']; - $this->createStandardFedoraStuff($form_values, $dom, $rootElement); - - // Create relationships - $this->createRelationShips($form_values, $dom, $rootElement); - $collectionPid = $form_values['collection_pid']; - - if (($cp = CollectionPolicy::LoadFromCollection($collectionPid)) !== FALSE) { - $collectionName =trim($cp->getName()); - if (trim($collectionName)!='') { - $form_values['dc_relation']=$collectionName; - } - } - // Create MODS - $this->createModsStream($form_values, $dom, $rootElement); - $this->createCollectionPolicy($form_values, $dom, $rootElement); - $this->createWorkflowStream($form_values, $dom, $rootElement); - - if (!empty($form_values['ingest-file-location'])) { - $this->createFedoraDataStreams($form_values, $dom, $rootElement); - } - $this->createPolicy($collectionPid, &$dom, &$rootElement); - -// header('Content-type: application/xml'); -// echo $dom->saveXML(); exit(); - - try { - $object = Fedora_Item::ingest_from_FOXML($dom); - //for some reason, ingest_from_FOXML does not generate a JMS message - //I just modify the workflow DS and it sends a JMS message. - $item = new Fedora_Item($object->pid); - $item->modify_datastream_by_value( $item->get_datastream_dissemination('WORKFLOW'), 'WORKFLOW', "Workflow Record", 'text/xml'); - - if (!empty($object->pid)) { - drupal_set_message(t("Item !pid created successfully.", array('!pid' => l($object->pid, 'fedora/repository/'. $object->pid))), "status"); - } - if (!empty( $_SESSION['fedora_ingest_files'])) { - foreach ($_SESSION['fedora_ingest_files'] as $dsid => $createdFile) { - file_delete($createdFile); - } - } - file_delete($form_values['ingest-file-location']); - } - catch (exception $e) { - drupal_set_message(t('Error ingesting object: !e', array('!e' => $e->getMessage())), 'error'); - watchdog(t("Fedora_Repository"), t("Error ingesting object: !e", array('!e' => $e->getMessage())), NULL, WATCHDOG_ERROR); - return; - } - } - - - function createCollectionPolicy($form_values, &$dom, &$rootElement) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - $model = new fedora_item($form_values['content_model_pid']); - $ds_list = $model->get_datastreams_list_as_array(); - if (isset($ds_list['COLLECTION_POLICY_TMPL'])) { - $cp = $model->get_datastream_dissemination('COLLECTION_POLICY_TMPL'); - $cpDom = DOMDocument::loadXML($cp); - $cpRootEl = $cpDom->getElementsByTagName('collection_policy'); - if ($cpRootEl->length >0) { - $cpRootEl=$cpRootEl->item(0); - $newNode = $dom->importNode($cpRootEl, TRUE); - - $datastream = $dom->createElement("foxml:datastream"); - $datastream->setAttribute("ID", "COLLECTION_POLICY"); - $datastream->setAttribute("STATE", "A"); - $datastream->setAttribute("CONTROL_GROUP", "X"); - $version = $dom->createElement("foxml:datastreamVersion"); - $version->setAttribute("ID", "COLLECTION_POLICY.0"); - $version->setAttribute("MIMETYPE", "text/xml"); - $version->setAttribute("LABEL", "Collection Policy"); - $datastream->appendChild($version); - $content = $dom->createElement("foxml:xmlContent"); - $version->appendChild($content); - $content->appendChild($newNode); - $rootElement->appendChild($datastream); - } - } - } - - function createWorkflowStream($form_values, &$dom, &$rootElement) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - $model = new fedora_item($form_values['content_model_pid']); - $ds_list = $model->get_datastreams_list_as_array(); - if (isset($ds_list['WORKFLOW_TMPL'])) { - $workflow = $model->get_datastream_dissemination('WORKFLOW_TMPL'); - $workflowDom = DOMDocument::loadXML($workflow); - $workflowRootEl = $workflowDom->getElementsByTagName('workflow'); - if ($workflowRootEl->length >0) { - $workflowRootEl=$workflowRootEl->item(0); - $newNode = $dom->importNode($workflowRootEl, TRUE); - - $datastream = $dom->createElement("foxml:datastream"); - $datastream->setAttribute("ID", "WORKFLOW"); - $datastream->setAttribute("STATE", "A"); - $datastream->setAttribute("CONTROL_GROUP", "X"); - $version = $dom->createElement("foxml:datastreamVersion"); - $version->setAttribute("ID", "WORKFLOW.0"); - $version->setAttribute("MIMETYPE", "text/xml"); - $version->setAttribute("LABEL", "Workflow Record"); - $datastream->appendChild($version); - $content = $dom->createElement("foxml:xmlContent"); - $version->appendChild($content); - $content->appendChild($newNode); - $rootElement->appendChild($datastream); - } - } - } - - function createModsStream($form_values, &$dom, &$rootElement) { - - $datastream = $dom->createElement("foxml:datastream"); - $datastream->setAttribute("ID", "MODS"); - $datastream->setAttribute("STATE", "A"); - $datastream->setAttribute("CONTROL_GROUP", "X"); - $version = $dom->createElement("foxml:datastreamVersion"); - $version->setAttribute("ID", "MODS.0"); - $version->setAttribute("MIMETYPE", "text/xml"); - $version->setAttribute("LABEL", "MODS Record"); - $datastream->appendChild($version); - $content = $dom->createElement("foxml:xmlContent"); - $version->appendChild($content); - - $mods = $this->modsFromForm($form_values,$dom); - $content->appendChild($mods); - - $rootElement->appendChild($datastream); - } - - - function modsFromForm(&$form_values,&$dom) - { - - ///begin writing MODS - $mods = $dom->createElement("mods:mods"); - $mods->setAttribute('version', '3.4'); - $mods->setAttribute('xmlns:xlink', "http://www.w3.org/1999/xlink"); - $mods->setAttribute('xmlns:mods', "http://www.loc.gov/mods/v3"); - $mods->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); - $mods->setAttribute('xsi:schemaLocation', "http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-0.xsd"); - - - if (isset($form_values['mods_title']) && trim($form_values['mods_title']) != '') { - $titleinfo = $dom->createElement('mods:titleInfo'); - $title = $dom->createElement('mods:title', htmlspecialchars($form_values['mods_title'])); - $titleinfo->appendChild($title); - $mods->appendChild($titleinfo); - } - - if (isset($form_values['mods_alternative_titles']) && trim($form_values['mods_alternative_titles']) != '') { - $titles=preg_split('/\s+\;\s+/',trim($form_values['mods_alternative_titles'])); - foreach ($titles as $t) { - $titleinfo = $dom->createElement('mods:titleInfo'); - $titleinfo->setAttribute('type','alternative') ; - $title = $dom->createElement('mods:title',$t); - $titleinfo->appendChild($title); - $mods->appendChild($titleinfo); - } - } - - if (isset($form_values['mods_alternative_title']) && trim($form_values['mods_alternative_title']) != '') { - $titleinfo = $dom->createElement('mods:titleInfo'); - $titleinfo->setAttribute('type','alternative') ; - $title = $dom->createElement('mods:title',trim($form_values['mods_alternative_title'])); - $titleinfo->appendChild($title); - $mods->appendChild($titleinfo); - } - - if (isset($form_values['mods_description']) && trim($form_values['mods_description']) != '') { - $abstract = $dom->createElement('mods:abstract', htmlspecialchars(trim($form_values['mods_description']))); - $mods->appendChild($abstract); - } - - if (isset($form_values['pid']) && trim($form_values['pid']) != '') { - $identifier = $dom->createElement('mods:identifier', htmlspecialchars(trim(preg_replace('/\:/','\/',$form_values['pid'])))); - $identifier->setAttribute('type', 'hdl'); - $mods->appendChild($identifier); - } - - if (isset($form_values['collection_pid']) && trim($form_values['collection_pid']) != '') { - $relatedItem = $dom->createElement('mods:relatedItem'); - $relatedItem->setAttribute('type', 'isMemberOfCollection'); - $identifier = $dom->createElement('mods:identifier', htmlspecialchars(trim($form_values['collection_pid']))); - $relatedItem->appendChild($identifier); - $mods->appendChild($relatedItem); - } - - if (isset($form_values['mods_identifier']) && trim($form_values['mods_identifier']) != '') { - $identifier = $dom->createElement('mods:identifier', htmlspecialchars(trim($form_values['mods_identifier']))); - $identifier->setAttribute('type', 'local'); - $mods->appendChild($identifier); - } - - if (isset($form_values['mods_physicalLocation']) && trim($form_values['mods_physicalLocation']) != '') { - $location = $dom->createElement('mods:location'); - $physLocation = $dom->createElement('mods:physicalLocation', htmlspecialchars(trim($form_values['mods_physicalLocation']))); - $location->appendChild($physLocation); - if (isset($form_values['mods_shelfLocator']) && trim($form_values['mods_shelfLocator']) != '') { - $shelfLocator = $dom->createElement('mods:shelfLocator', htmlspecialchars(trim($form_values['mods_shelfLocator']))); - $location->appendChild($shelfLocator); - } - $mods->appendChild($location); - } - - $originInfo = $dom->createElement('mods:originInfo'); - $addOriginInfo = FALSE; - if (isset($form_values['mods_pubinfo_place']) && trim($form_values['mods_pubinfo_place']) != '') { - $place = $dom->createElement('mods:place'); - $placeTerm=$dom->createElement('mods:placeTerm', htmlspecialchars(trim($form_values['mods_pubinfo_place']))); - $placeTerm->setAttribute('type', 'text'); - $place->appendChild($placeTerm); - $originInfo->appendChild($place); - $addOriginInfo = TRUE; - } - - if (isset($form_values['mods_pubinfo_publisher']) && trim($form_values['mods_pubinfo_publisher']) != '') { - $publisher = $dom->createElement('mods:publisher', htmlspecialchars(trim($form_values['mods_pubinfo_publisher']))); - $originInfo->appendChild($publisher); - $addOriginInfo = TRUE; - } - - if (isset($form_values['mods_pubinfo_edition']) && trim($form_values['mods_pubinfo_edition']) != '') { - $edition = $dom->createElement('mods:edition', htmlspecialchars(trim($form_values['mods_pubinfo_edition']))); - $originInfo->appendChild($edition); - $addOriginInfo = TRUE; - } - - - if (isset($form_values['mods_pubinfo_date']) && trim($form_values['mods_pubinfo_date']) != '' && - isset($form_values['mods_pubinfo_dateType']) && trim($form_values['mods_pubinfo_dateType']) != '') { - if (in_array($form_values['mods_pubinfo_dateType'], array('issued', 'created', 'copyright', 'captured'))) { - $date = $dom->createElement('mods:'. trim($form_values['mods_pubinfo_dateType']) .'Date', htmlspecialchars(trim($form_values['mods_pubinfo_date']))); - } - else { - //how to handle other types? otherDate? - $date= $dom->createElement('mods:otherDate', htmlspecialchars(trim($form_values['mods_pubinfo_date']))); - $date->setAttribute('type', htmlspecialchars(trim($form_values['mods_pubinfo_dateType']))); - } - $originInfo->appendChild($date); - $addOriginInfo = TRUE; - } else { - if (isset($form_values['mods_createdDate'])) { - $date = $dom->createElement('mods:createdDate',htmlspecialchars(trim($form_values['mods_createdDate']))); - $originInfo->appendChild($date); - $addOriginInfo = TRUE; - } - - if (isset($form_values['mods_issuedDate'])) { - $date = $dom->createElement('mods:issuedDate',htmlspecialchars(trim($form_values['mods_issuedDate']))); - $originInfo->appendChild($date); - $addOriginInfo = TRUE; - } - - if (isset($form_values['mods_copyrightDate'])) { - $date = $dom->createElement('mods:copyrightDate',htmlspecialchars(trim($form_values['mods_copyrightDate']))); - $originInfo->appendChild($date); - $addOriginInfo = TRUE; - } - - if (isset($form_values['mods_capturedDate'])) { - $date = $dom->createElement('mods:capturedDate',htmlspecialchars(trim($form_values['mods_capturedDate']))); - $originInfo->appendChild($date); - $addOriginInfo = TRUE; - } - - } - - if (isset($form_values['mods_pubinfo_journalFreq']) && trim($form_values['mods_pubinfo_journalFreq']) != '') { - $frequency = $dom->createElement('mods:frequency', htmlspecialchars(trim($form_values['mods_pubinfo_journalFreq']))); - $originInfo->appendChild($frequency); - $issuance= $dom->createElement('mods:issuance', 'journal'); - $originInfo->appendChild($issuance); - $addOriginInfo = TRUE; - } - elseif (isset($form_values['mods_pubinfo_journalFreq'])) { - $issuance= $dom->createElement('mods:issuance', 'monographic'); - $originInfo->appendChild($issuance); - } - - - if ($addOriginInfo) { - $mods->appendChild($originInfo); - } - - if (isset($form_values['mods_note']) && trim($form_values['mods_note']) != '') { - $note = $dom->createElement('mods:note', htmlspecialchars(trim($form_values['mods_note']))); - $mods->appendChild($note); - } - - if (isset($form_values['mods_caption']) && trim($form_values['mods_caption']) != '') { - $note = $dom->createElement('mods:note', htmlspecialchars(trim($form_values['mods_caption']))); - $note->setAttribute('type','caption'); - $mods->appendChild($note); - } - - if (isset($form_values['mods_format']) && trim($form_values['mods_format']) != '') { - $typeOfResource = $dom->createElement('mods:typeOfResource', htmlspecialchars($form_values['mods_format'])); - $mods->appendChild($typeOfResource); - } - - - if (isset($form_values['mods_language']) && trim($form_values['mods_language']) != '') - { - $languageList = explode(';', htmlspecialchars($form_values['mods_language'])); - foreach ($languageList as $lang) - { - $language = $dom->createElement('mods:language'); - $langTerm = $dom->createElement('mods:languageTerm',htmlspecialchars($lang)); - $langTerm->setAttribute('type','text'); - $language->appendChild($langTerm); - $mods->appendChild($language); - } - } - - - $hasSubject = FALSE; - $subject = $dom->createElement('mods:subject'); - - - // Hierarchical Geographic Subject - if (isset($form_values['mods_country']) && trim($form_values['mods_country']) != '') { - $hasSubject = TRUE; - $geographic = $dom->createElement('mods:hierarchicalGeographic'); - - $country=$dom->createElement('mods:country', htmlspecialchars($form_values['mods_country'])); - $geographic->appendChild($country); - - if (isset($form_values['mods_province']) && trim($form_values['mods_province']) != '') { - $province = $dom->createElement('mods:province', htmlspecialchars($form_values['mods_province'])); - $geographic->appendChild($province); - } - - if (isset($form_values['mods_state']) && trim($form_values['mods_state']) != '') { - $state = $dom->createElement('mods:state', htmlspecialchars($form_values['mods_state'])); - $geographic->appendChild($state); - } - - if (isset($form_values['mods_city']) && trim($form_values['mods_city']) != '') { - $city = $dom->createElement('mods:city', htmlspecialchars($form_values['mods_city'])); - $geographic->appendChild($city); - } - - if (isset($form_values['mods_area']) && trim($form_values['mods_area']) != '') { - $state = $dom->createElement('mods:area', htmlspecialchars($form_values['mods_area'])); - $geographic->appendChild($state); - } - - - $subject->appendChild($geographic); - } - - if (isset($form_values['mods_date']) && trim($form_values['mods_date']) != '') { - $hasSubject = TRUE; - $temporal = $dom->createElement('mods:temporal', htmlspecialchars($form_values['mods_date'])); - $subject->appendChild($temporal); - } - - if (isset($form_values['mods_subjtitle']) && trim($form_values['mods_subjtitle']) != '') { - $hasSubject = TRUE; - $titleInfo= $dom->createElement('mods:titleInfo'); - $title = $dom->createElement('mods:title', htmlspecialchars($form_values['mods_subjtitle'])); - $titleInfo->appendChild($title); - $subject->appendChild($titleInfo); - } - - - if (isset($form_values['mods_topics']) && trim($form_values['mods_topics']) != '') { - $hasSubject = TRUE; - $topicList = explode(';', htmlspecialchars($form_values['mods_topics'])); - $authority = 'unknown'; - if (isset($form_values['mods_topicAuthority']) && trim($form_values['mods_topicAuthority']) != '') { - $authority = htmlspecialchars($form_values['mods_topicAuthority']); - } - - foreach ($topicList as $t) { - $topic = $dom->createElement('mods:topic', $t); - $topic->setAttribute('authority', $authority); - $subject->appendChild($topic); - } - } - - - if (isset($form_values['mods_cc']['cc']) && $form_values['mods_cc']['cc']['cc_enable']) { - - $commercial = trim($form_values['mods_cc']['cc']['cc_commercial']); - $modifications = trim($form_values['mods_cc']['cc']['cc_modifications']); - $jurisdiction = trim($form_values['mods_cc']['cc']['cc_jurisdiction']); - - module_load_include('inc','islandora_form_elements','includes/creative_commons.inc'); - - if (!isset(CreativeCommons::$cc_jurisdiction_vals[$jurisdiction])) - $jurisdiction=''; - $version = CreativeCommons::$cc_versions[$jurisdiction]; - - $license = 'by'. ($commercial != ''?'-'.$commercial:'') . ($modifications != ''?'-'.$modifications:'') . '/' . $version . '/'.($jurisdiction != ''?$jurisdiction.'/':'') ; - - $accessCondition = $dom->createElement('mods:accessCondition', htmlspecialchars($license)); - $accessCondition->setAttribute('type', 'Creative Commons License'); - $mods->appendChild($accessCondition); - - - } - - if (isset($form_values['mods_rights']) && trim($form_values['mods_rights']) != '') { - $accessCondition = $dom->createElement('mods:accessCondition', htmlspecialchars($form_values['mods_rights'])); - $accessCondition->setAttribute('type', 'restriction on access; use and reproduction'); - $mods->appendChild($accessCondition); - } - - if (isset($form_values['mods_people']) && isset($form_values['mods_people']['people']) && is_array($form_values['mods_people']['people']) ) { - foreach ($form_values['mods_people']['people'] as $key => $val) { - $name = $dom->createElement('mods:name'); - $appendName=FALSE; - if (isset($val['role'])) { - $role = $dom->createElement('mods:role'); - $roleTerm = $dom->createElement('mods:roleTerm', htmlspecialchars(trim($val['role']))); - $roleTerm->setAttribute('type', 'text'); - $roleTerm->setAttribute('authority', 'marcrelator'); - $role->appendChild($roleTerm); - $name->appendChild($role); - } - - if (isset($val['organization'])) { - $name->setAttribute('type', 'organization'); - if (trim($val['organization']) != '') { - $namePart=$dom->createElement('mods:namePart', htmlspecialchars(trim($val['organization']))); - $name->appendChild($namePart); - $appendName=TRUE; - } - } - elseif (isset($val['conference'])) { - $name->setAttribute('type', 'conference'); - if (trim($val['conference']) != '') { - $namePart=$dom->createElement('mods:namePart', htmlspecialchars(trim($val['conference']))); - $name->appendChild($namePart); - $appendName=TRUE; - } - } - else { - $name->setAttribute('type', 'personal'); - if (trim($val['name']) != '') { - $namePart=$dom->createElement('mods:namePart', htmlspecialchars(trim($val['name']))); - $name->appendChild($namePart); - $appendName=TRUE; - } - } - - if (isset($val['date'])) { - $namePart=$dom->createElement('mods:namePart', htmlspecialchars(trim($val['date']))); - $namePart->setAttribute('type','date'); - $name->appendChild($namePart); - } - - if ($appendName) { - if (isset($val['subject'])) { - $subject->appendChild($name); - $hasSubject=TRUE; - } else { - $mods->appendChild($name); - } - } - - } - } - - if ($hasSubject) { - $mods->appendChild($subject); - } - - return $mods; - } - -} +pid = $pid; + $this->cm = ContentModel::loadFromObject($pid); + $this->item = new fedora_item($pid); + } + } + + /** + * Handle Edit Metadata Form ??? + * @param &$form_id + * @param &$form_values + * @param &$soap_client + */ + function handleEditMetadataForm(&$form_id, &$form_values, &$soap_client) { + $dom = new DomDocument("1.0", "UTF-8"); + $dom->formatOutput = TRUE; + $mods = $this->modsFromForm($form_values, $dom); + $dom->appendChild($mods); + + if ($this->item->modify_datastream_by_value($dom->saveXML(), 'MODS', "MODS Record", 'text/xml') !== NULL) { + drupal_set_message(t('Successfully updated MODS datastream for object %pid', array('%pid' => $this->pid))); + } + drupal_goto('/fedora/repository/' . $this->pid); + } + + /** + * Build Edit Metadata Form + * @return array + */ + function buildEditMetadataForm() { + $form['#multistep'] = TRUE; // used so that it triggers a form rebuild every time. + $form['indicator2'] = array( + '#type' => 'fieldset', + '#title' => t('Edit metadata'), + ); + + if ($this->cm !== FALSE && $this->item != NULL) { + $form['pid'] = array('#type' => 'hidden', '#value' => $this->pid); + + $elements = $this->cm->getIngestFormElements(); + $content = $this->item->get_datastream_dissemination('MODS'); + + if (trim($content) != '') { + $dom = DOMDocument::loadXML($content); + $xpath = new DOMXPath($dom); + // Register the php: namespace (required) + $xpath->registerNamespace("php", "http://php.net/xpath"); + + // Register PHP functions (no restrictions) + $xpath->registerPHPFunctions(); + + foreach ($elements as $element) { + + $el = array( + '#title' => $element['label'], + '#required' => ($element['required'] ? 1 : 0), + '#description' => $element['description'], + '#type' => $element['type'] + ); + + $includeEl = TRUE; + $elname = explode('][', $element['name']); + $elLocation = &$form['indicator2']; + while (isset($elLocation[$name[0]]) && ($partial = array_shift($elname)) != NULL) { + $elLocation = &$elLocation[$partial]; + } + + foreach ($element['parameters'] as $key => $val) { + switch ($key) { + case '#autocomplete_path': + $val .= '/' . $form_values['storage']['collection_pid']; + break; + + case '#exclude_from_edit_metadata': + $includeEl = FALSE; + break; + + + case '#edit_metadata_xpath': + $nodeList = $xpath->evaluate($val); +// echo $val. ' '.$nodeList->length.' '; +// echo $nodeList->item(0)->nodeValue.' '; +// echo '
    '; + + if (is_string($nodeList)) { + $el['#default_value'] = $nodeList; + } + elseif ($nodeList->length > 1) { + $el['#default_value'] = array(); + foreach ($nodeList as $node) { + $el['#default_value'][] = $node->nodeValue; + } + } + elseif ($nodeList->length > 0) { + if ($el['#type'] == 'list') { + $values = array(); + for ($i = 0; $i < $nodeList->length; $i++) { + $values[] = $nodeList->item($i)->nodeValue; + } + $el['#default_value'] = join('; ', $values); + } + else { + $el['#default_value'] = $nodeList->item(0)->nodeValue; + } + } + break; + } + + if ($key != '#sticky') { + $el[$key] = $val; + } + } + + if ($element['type'] == 'people') { + + $names = $xpath->evaluate('/mods:mods/mods:name'); + $people = array(); + foreach ($names as $mname) { + + $type = $mname->getAttribute('type'); + $role = $mname->getElementsByTagName('roleTerm')->item(0)->nodeValue; + + $nameParts = $mname->getElementsByTagName('namePart'); + foreach ($nameParts as $namePart) { + switch ($namePart->getAttribute('type')) { + case 'given': $given = $namePart->nodeValue; + break; + case 'family': $family = $namePart->nodeValue; + break; + case 'termsOfAddress': $title = $namePart->nodeValue; + break; + case 'date': $date = $namePart->nodeValue; + break; + default: $name = $namePart->nodeValue; + break; + } + } + + $person = array('role' => $role); + switch ($type) { + case 'personal': + if (isset($given) && isset($family) && !isset($name)) { + $name = (isset($title) ? $title . ' ' : '') . $family . ', ' . $family; + } + $person['name'] = $name; + $person['date'] = $date; + break; + case 'organization': + $person['organization'] = $name; + break; + case 'conference': + $person['conference'] = $name; + $person['date'] = $date; + break; + } + $people[] = $person; + } + + $names = $xpath->evaluate('/mods:mods/mods:subject/mods:name'); + foreach ($names as $mname) { + + $type = $mname->getAttribute('type'); + + $nameParts = $mname->getElementsByTagName('namePart'); + foreach ($nameParts as $namePart) { + switch ($namePart->getAttribute('type')) { + case 'given': $given = $namePart->nodeValue; + break; + case 'family': $family = $namePart->nodeValue; + break; + case 'termsOfAddress': $title = $namePart->nodeValue; + break; + case 'date': $date = $namePart->nodeValue; + break; + default: $name = $namePart->nodeValue; + break; + } + } + + $person = array('subject' => 1); + switch ($type) { + case 'personal': + if (isset($given) && isset($family) && !isset($name)) { + $name = (isset($title) ? $title . ' ' : '') . $family . ', ' . $family; + } + $person['name'] = $name; + $person['date'] = $date; + break; + case 'organization': + $person['organization'] = $name; + break; + case 'conference': + $person['conference'] = $name; + $person['date'] = $date; + break; + } + $people[] = $person; + } + + $el['#default_value'] = $people; + } + + + if ($element['type'] == 'select' || $element['type'] == 'other_select') { + $el['#options'] = isset($element['authoritative_list']) ? $element['authoritative_list'] : array(); + } + + if ($includeEl) { + $elLocation[join('][', $elname)] = $el; + } + } + + $form['submit'] = array( + '#type' => 'submit', + '#submit' => array('fedora_repository_edit_qdc_form_submit'), + '#value' => 'Save Metadata' + ); + + return $form; + } + } + } + + /** + * Handle Mods Form + * @param &$form_values + * @param &$form_state + */ + function handleModsForm(&$form_values, &$form_state) { + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); + + $form_state['storage']['people'] = NULL; //clears out old entities for the next run of the formbuilder. + + $dom = new DomDocument("1.0", "UTF-8"); + $dom->formatOutput = TRUE; + $pid = $form_values['pid']; + $rootElement = $dom->createElement("foxml:digitalObject"); + $rootElement->setAttribute('VERSION', '1.1'); + $rootElement->setAttribute('PID', "$pid"); + $rootElement->setAttribute('xmlns:foxml', "info:fedora/fedora-system:def/foxml#"); + $rootElement->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); + $rootElement->setAttribute('xsi:schemaLocation', "info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd"); + $dom->appendChild($rootElement); + + // Create standard fedora stuff + $form_values['dc:title'] = $form_values['mods_title']; + $this->createStandardFedoraStuff($form_values, $dom, $rootElement); + + // Create relationships + $this->createRelationShips($form_values, $dom, $rootElement); + $collectionPid = $form_values['collection_pid']; + + if (($cp = CollectionPolicy::LoadFromCollection($collectionPid)) !== FALSE) { + $collectionName = trim($cp->getName()); + if (trim($collectionName) != '') { + $form_values['dc_relation'] = $collectionName; + } + } + // Create MODS + $this->createModsStream($form_values, $dom, $rootElement); + $this->createCollectionPolicy($form_values, $dom, $rootElement); + $this->createWorkflowStream($form_values, $dom, $rootElement); + + if (!empty($form_values['ingest-file-location'])) { + $this->createFedoraDataStreams($form_values, $dom, $rootElement); + } + $this->createPolicy($collectionPid, &$dom, &$rootElement); + +// header('Content-type: application/xml'); +// echo $dom->saveXML(); exit(); + + try { + $object = Fedora_Item::ingest_from_FOXML($dom); + //for some reason, ingest_from_FOXML does not generate a JMS message + //I just modify the workflow DS and it sends a JMS message. + $item = new Fedora_Item($object->pid); + $item->modify_datastream_by_value($item->get_datastream_dissemination('WORKFLOW'), 'WORKFLOW', "Workflow Record", 'text/xml'); + + if (!empty($object->pid)) { + drupal_set_message(t("Item !pid created successfully.", array('!pid' => l($object->pid, 'fedora/repository/' . $object->pid))), "status"); + } + if (!empty($_SESSION['fedora_ingest_files'])) { + foreach ($_SESSION['fedora_ingest_files'] as $dsid => $createdFile) { + file_delete($createdFile); + } + } + file_delete($form_values['ingest-file-location']); + } catch (exception $e) { + drupal_set_message(t('Error ingesting object: @e', array('@e' => check_plain($e->getMessage()))), 'error'); + watchdog(t("Fedora_Repository"), "Error ingesting object: @e", array('@e' => check_plain($e->getMessage())), NULL, WATCHDOG_ERROR); + return; + } + } + + /** + * Create Collection Policy ?? + * @param $form_values + * @param &$dom + * @param &$rootElement + */ + function createCollectionPolicy($form_values, &$dom, &$rootElement) { + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + $model = new fedora_item($form_values['content_model_pid']); + $ds_list = $model->get_datastreams_list_as_array(); + if (isset($ds_list['COLLECTION_POLICY_TMPL'])) { + $cp = $model->get_datastream_dissemination('COLLECTION_POLICY_TMPL'); + $cpDom = DOMDocument::loadXML($cp); + $cpRootEl = $cpDom->getElementsByTagName('collection_policy'); + if ($cpRootEl->length > 0) { + $cpRootEl = $cpRootEl->item(0); + $newNode = $dom->importNode($cpRootEl, TRUE); + + $datastream = $dom->createElement("foxml:datastream"); + $datastream->setAttribute("ID", "COLLECTION_POLICY"); + $datastream->setAttribute("STATE", "A"); + $datastream->setAttribute("CONTROL_GROUP", "X"); + $version = $dom->createElement("foxml:datastreamVersion"); + $version->setAttribute("ID", "COLLECTION_POLICY.0"); + $version->setAttribute("MIMETYPE", "text/xml"); + $version->setAttribute("LABEL", "Collection Policy"); + $datastream->appendChild($version); + $content = $dom->createElement("foxml:xmlContent"); + $version->appendChild($content); + $content->appendChild($newNode); + $rootElement->appendChild($datastream); + } + } + } + + /** + * Create Workflow Stream ?? + * @param $form_values + * @param &$dom + * @param &$rootElement + */ + function createWorkflowStream($form_values, &$dom, &$rootElement) { + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + $model = new fedora_item($form_values['content_model_pid']); + $ds_list = $model->get_datastreams_list_as_array(); + if (isset($ds_list['WORKFLOW_TMPL'])) { + $workflow = $model->get_datastream_dissemination('WORKFLOW_TMPL'); + $workflowDom = DOMDocument::loadXML($workflow); + $workflowRootEl = $workflowDom->getElementsByTagName('workflow'); + if ($workflowRootEl->length > 0) { + $workflowRootEl = $workflowRootEl->item(0); + $newNode = $dom->importNode($workflowRootEl, TRUE); + + $datastream = $dom->createElement("foxml:datastream"); + $datastream->setAttribute("ID", "WORKFLOW"); + $datastream->setAttribute("STATE", "A"); + $datastream->setAttribute("CONTROL_GROUP", "X"); + $version = $dom->createElement("foxml:datastreamVersion"); + $version->setAttribute("ID", "WORKFLOW.0"); + $version->setAttribute("MIMETYPE", "text/xml"); + $version->setAttribute("LABEL", "Workflow Record"); + $datastream->appendChild($version); + $content = $dom->createElement("foxml:xmlContent"); + $version->appendChild($content); + $content->appendChild($newNode); + $rootElement->appendChild($datastream); + } + } + } + + /** + * Create mods Stream ?? + * @param $form_values + * @param &$dom + * @param &$rootElement + */ + function createModsStream($form_values, &$dom, &$rootElement) { + + $datastream = $dom->createElement("foxml:datastream"); + $datastream->setAttribute("ID", "MODS"); + $datastream->setAttribute("STATE", "A"); + $datastream->setAttribute("CONTROL_GROUP", "X"); + $version = $dom->createElement("foxml:datastreamVersion"); + $version->setAttribute("ID", "MODS.0"); + $version->setAttribute("MIMETYPE", "text/xml"); + $version->setAttribute("LABEL", "MODS Record"); + $datastream->appendChild($version); + $content = $dom->createElement("foxml:xmlContent"); + $version->appendChild($content); + + $mods = $this->modsFromForm($form_values, $dom); + $content->appendChild($mods); + + $rootElement->appendChild($datastream); + } + + /** + * Mods From From ????? + * @param type $form_values + * @param type $dom + * @return type + */ + function modsFromForm(&$form_values, &$dom) { + + ///begin writing MODS + $mods = $dom->createElement("mods:mods"); + $mods->setAttribute('version', '3.4'); + $mods->setAttribute('xmlns:xlink', "http://www.w3.org/1999/xlink"); + $mods->setAttribute('xmlns:mods', "http://www.loc.gov/mods/v3"); + $mods->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); + $mods->setAttribute('xsi:schemaLocation', "http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-0.xsd"); + + + if (isset($form_values['mods_title']) && trim($form_values['mods_title']) != '') { + $titleinfo = $dom->createElement('mods:titleInfo'); + $title = $dom->createElement('mods:title', htmlspecialchars($form_values['mods_title'])); + $titleinfo->appendChild($title); + $mods->appendChild($titleinfo); + } + + if (isset($form_values['mods_alternative_titles']) && trim($form_values['mods_alternative_titles']) != '') { + $titles = preg_split('/\s+\;\s+/', trim($form_values['mods_alternative_titles'])); + foreach ($titles as $t) { + $titleinfo = $dom->createElement('mods:titleInfo'); + $titleinfo->setAttribute('type', 'alternative'); + $title = $dom->createElement('mods:title', $t); + $titleinfo->appendChild($title); + $mods->appendChild($titleinfo); + } + } + + if (isset($form_values['mods_alternative_title']) && trim($form_values['mods_alternative_title']) != '') { + $titleinfo = $dom->createElement('mods:titleInfo'); + $titleinfo->setAttribute('type', 'alternative'); + $title = $dom->createElement('mods:title', trim($form_values['mods_alternative_title'])); + $titleinfo->appendChild($title); + $mods->appendChild($titleinfo); + } + + if (isset($form_values['mods_description']) && trim($form_values['mods_description']) != '') { + $abstract = $dom->createElement('mods:abstract', htmlspecialchars(trim($form_values['mods_description']))); + $mods->appendChild($abstract); + } + + if (isset($form_values['pid']) && trim($form_values['pid']) != '') { + $identifier = $dom->createElement('mods:identifier', htmlspecialchars(trim(preg_replace('/\:/', '\/', $form_values['pid'])))); + $identifier->setAttribute('type', 'hdl'); + $mods->appendChild($identifier); + } + + if (isset($form_values['collection_pid']) && trim($form_values['collection_pid']) != '') { + $relatedItem = $dom->createElement('mods:relatedItem'); + $relatedItem->setAttribute('type', 'isMemberOfCollection'); + $identifier = $dom->createElement('mods:identifier', htmlspecialchars(trim($form_values['collection_pid']))); + $relatedItem->appendChild($identifier); + $mods->appendChild($relatedItem); + } + + if (isset($form_values['mods_identifier']) && trim($form_values['mods_identifier']) != '') { + $identifier = $dom->createElement('mods:identifier', htmlspecialchars(trim($form_values['mods_identifier']))); + $identifier->setAttribute('type', 'local'); + $mods->appendChild($identifier); + } + + if (isset($form_values['mods_physicalLocation']) && trim($form_values['mods_physicalLocation']) != '') { + $location = $dom->createElement('mods:location'); + $physLocation = $dom->createElement('mods:physicalLocation', htmlspecialchars(trim($form_values['mods_physicalLocation']))); + $location->appendChild($physLocation); + if (isset($form_values['mods_shelfLocator']) && trim($form_values['mods_shelfLocator']) != '') { + $shelfLocator = $dom->createElement('mods:shelfLocator', htmlspecialchars(trim($form_values['mods_shelfLocator']))); + $location->appendChild($shelfLocator); + } + $mods->appendChild($location); + } + + $originInfo = $dom->createElement('mods:originInfo'); + $addOriginInfo = FALSE; + if (isset($form_values['mods_pubinfo_place']) && trim($form_values['mods_pubinfo_place']) != '') { + $place = $dom->createElement('mods:place'); + $placeTerm = $dom->createElement('mods:placeTerm', htmlspecialchars(trim($form_values['mods_pubinfo_place']))); + $placeTerm->setAttribute('type', 'text'); + $place->appendChild($placeTerm); + $originInfo->appendChild($place); + $addOriginInfo = TRUE; + } + + if (isset($form_values['mods_pubinfo_publisher']) && trim($form_values['mods_pubinfo_publisher']) != '') { + $publisher = $dom->createElement('mods:publisher', htmlspecialchars(trim($form_values['mods_pubinfo_publisher']))); + $originInfo->appendChild($publisher); + $addOriginInfo = TRUE; + } + + if (isset($form_values['mods_pubinfo_edition']) && trim($form_values['mods_pubinfo_edition']) != '') { + $edition = $dom->createElement('mods:edition', htmlspecialchars(trim($form_values['mods_pubinfo_edition']))); + $originInfo->appendChild($edition); + $addOriginInfo = TRUE; + } + + + if (isset($form_values['mods_pubinfo_date']) && trim($form_values['mods_pubinfo_date']) != '' && + isset($form_values['mods_pubinfo_dateType']) && trim($form_values['mods_pubinfo_dateType']) != '') { + if (in_array($form_values['mods_pubinfo_dateType'], array('issued', 'created', 'copyright', 'captured'))) { + $date = $dom->createElement('mods:' . trim($form_values['mods_pubinfo_dateType']) . 'Date', htmlspecialchars(trim($form_values['mods_pubinfo_date']))); + } + else { + //how to handle other types? otherDate? + $date = $dom->createElement('mods:otherDate', htmlspecialchars(trim($form_values['mods_pubinfo_date']))); + $date->setAttribute('type', htmlspecialchars(trim($form_values['mods_pubinfo_dateType']))); + } + $originInfo->appendChild($date); + $addOriginInfo = TRUE; + } + else { + if (isset($form_values['mods_createdDate'])) { + $date = $dom->createElement('mods:createdDate', htmlspecialchars(trim($form_values['mods_createdDate']))); + $originInfo->appendChild($date); + $addOriginInfo = TRUE; + } + + if (isset($form_values['mods_issuedDate'])) { + $date = $dom->createElement('mods:issuedDate', htmlspecialchars(trim($form_values['mods_issuedDate']))); + $originInfo->appendChild($date); + $addOriginInfo = TRUE; + } + + if (isset($form_values['mods_copyrightDate'])) { + $date = $dom->createElement('mods:copyrightDate', htmlspecialchars(trim($form_values['mods_copyrightDate']))); + $originInfo->appendChild($date); + $addOriginInfo = TRUE; + } + + if (isset($form_values['mods_capturedDate'])) { + $date = $dom->createElement('mods:capturedDate', htmlspecialchars(trim($form_values['mods_capturedDate']))); + $originInfo->appendChild($date); + $addOriginInfo = TRUE; + } + } + + if (isset($form_values['mods_pubinfo_journalFreq']) && trim($form_values['mods_pubinfo_journalFreq']) != '') { + $frequency = $dom->createElement('mods:frequency', htmlspecialchars(trim($form_values['mods_pubinfo_journalFreq']))); + $originInfo->appendChild($frequency); + $issuance = $dom->createElement('mods:issuance', 'journal'); + $originInfo->appendChild($issuance); + $addOriginInfo = TRUE; + } + elseif (isset($form_values['mods_pubinfo_journalFreq'])) { + $issuance = $dom->createElement('mods:issuance', 'monographic'); + $originInfo->appendChild($issuance); + } + + + if ($addOriginInfo) { + $mods->appendChild($originInfo); + } + + if (isset($form_values['mods_note']) && trim($form_values['mods_note']) != '') { + $note = $dom->createElement('mods:note', htmlspecialchars(trim($form_values['mods_note']))); + $mods->appendChild($note); + } + + if (isset($form_values['mods_caption']) && trim($form_values['mods_caption']) != '') { + $note = $dom->createElement('mods:note', htmlspecialchars(trim($form_values['mods_caption']))); + $note->setAttribute('type', 'caption'); + $mods->appendChild($note); + } + + if (isset($form_values['mods_format']) && trim($form_values['mods_format']) != '') { + $typeOfResource = $dom->createElement('mods:typeOfResource', htmlspecialchars($form_values['mods_format'])); + $mods->appendChild($typeOfResource); + } + + + if (isset($form_values['mods_language']) && trim($form_values['mods_language']) != '') { + $languageList = explode(';', htmlspecialchars($form_values['mods_language'])); + foreach ($languageList as $lang) { + $language = $dom->createElement('mods:language'); + $langTerm = $dom->createElement('mods:languageTerm', htmlspecialchars($lang)); + $langTerm->setAttribute('type', 'text'); + $language->appendChild($langTerm); + $mods->appendChild($language); + } + } + + + $hasSubject = FALSE; + $subject = $dom->createElement('mods:subject'); + + + // Hierarchical Geographic Subject + if (isset($form_values['mods_country']) && trim($form_values['mods_country']) != '') { + $hasSubject = TRUE; + $geographic = $dom->createElement('mods:hierarchicalGeographic'); + + $country = $dom->createElement('mods:country', htmlspecialchars($form_values['mods_country'])); + $geographic->appendChild($country); + + if (isset($form_values['mods_province']) && trim($form_values['mods_province']) != '') { + $province = $dom->createElement('mods:province', htmlspecialchars($form_values['mods_province'])); + $geographic->appendChild($province); + } + + if (isset($form_values['mods_state']) && trim($form_values['mods_state']) != '') { + $state = $dom->createElement('mods:state', htmlspecialchars($form_values['mods_state'])); + $geographic->appendChild($state); + } + + if (isset($form_values['mods_city']) && trim($form_values['mods_city']) != '') { + $city = $dom->createElement('mods:city', htmlspecialchars($form_values['mods_city'])); + $geographic->appendChild($city); + } + + if (isset($form_values['mods_area']) && trim($form_values['mods_area']) != '') { + $state = $dom->createElement('mods:area', htmlspecialchars($form_values['mods_area'])); + $geographic->appendChild($state); + } + + + $subject->appendChild($geographic); + } + + if (isset($form_values['mods_date']) && trim($form_values['mods_date']) != '') { + $hasSubject = TRUE; + $temporal = $dom->createElement('mods:temporal', htmlspecialchars($form_values['mods_date'])); + $subject->appendChild($temporal); + } + + if (isset($form_values['mods_subjtitle']) && trim($form_values['mods_subjtitle']) != '') { + $hasSubject = TRUE; + $titleInfo = $dom->createElement('mods:titleInfo'); + $title = $dom->createElement('mods:title', htmlspecialchars($form_values['mods_subjtitle'])); + $titleInfo->appendChild($title); + $subject->appendChild($titleInfo); + } + + + if (isset($form_values['mods_topics']) && trim($form_values['mods_topics']) != '') { + $hasSubject = TRUE; + $topicList = explode(';', htmlspecialchars($form_values['mods_topics'])); + $authority = 'unknown'; + if (isset($form_values['mods_topicAuthority']) && trim($form_values['mods_topicAuthority']) != '') { + $authority = htmlspecialchars($form_values['mods_topicAuthority']); + } + + foreach ($topicList as $t) { + $topic = $dom->createElement('mods:topic', $t); + $topic->setAttribute('authority', $authority); + $subject->appendChild($topic); + } + } + + + if (isset($form_values['mods_cc']['cc']) && $form_values['mods_cc']['cc']['cc_enable']) { + + $commercial = trim($form_values['mods_cc']['cc']['cc_commercial']); + $modifications = trim($form_values['mods_cc']['cc']['cc_modifications']); + $jurisdiction = trim($form_values['mods_cc']['cc']['cc_jurisdiction']); + + module_load_include('inc', 'islandora_form_elements', 'includes/creative_commons.inc'); + + if (!isset(CreativeCommons::$cc_jurisdiction_vals[$jurisdiction])) + $jurisdiction = ''; + $version = CreativeCommons::$cc_versions[$jurisdiction]; + + $license = 'by' . ($commercial != '' ? '-' . $commercial : '') . ($modifications != '' ? '-' . $modifications : '') . '/' . $version . '/' . ($jurisdiction != '' ? $jurisdiction . '/' : ''); + + $accessCondition = $dom->createElement('mods:accessCondition', htmlspecialchars($license)); + $accessCondition->setAttribute('type', 'Creative Commons License'); + $mods->appendChild($accessCondition); + } + + if (isset($form_values['mods_rights']) && trim($form_values['mods_rights']) != '') { + $accessCondition = $dom->createElement('mods:accessCondition', htmlspecialchars($form_values['mods_rights'])); + $accessCondition->setAttribute('type', 'restriction on access; use and reproduction'); + $mods->appendChild($accessCondition); + } + + if (isset($form_values['mods_people']) && isset($form_values['mods_people']['people']) && is_array($form_values['mods_people']['people'])) { + foreach ($form_values['mods_people']['people'] as $key => $val) { + $name = $dom->createElement('mods:name'); + $appendName = FALSE; + if (isset($val['role'])) { + $role = $dom->createElement('mods:role'); + $roleTerm = $dom->createElement('mods:roleTerm', htmlspecialchars(trim($val['role']))); + $roleTerm->setAttribute('type', 'text'); + $roleTerm->setAttribute('authority', 'marcrelator'); + $role->appendChild($roleTerm); + $name->appendChild($role); + } + + if (isset($val['organization'])) { + $name->setAttribute('type', 'organization'); + if (trim($val['organization']) != '') { + $namePart = $dom->createElement('mods:namePart', htmlspecialchars(trim($val['organization']))); + $name->appendChild($namePart); + $appendName = TRUE; + } + } + elseif (isset($val['conference'])) { + $name->setAttribute('type', 'conference'); + if (trim($val['conference']) != '') { + $namePart = $dom->createElement('mods:namePart', htmlspecialchars(trim($val['conference']))); + $name->appendChild($namePart); + $appendName = TRUE; + } + } + else { + $name->setAttribute('type', 'personal'); + if (trim($val['name']) != '') { + $namePart = $dom->createElement('mods:namePart', htmlspecialchars(trim($val['name']))); + $name->appendChild($namePart); + $appendName = TRUE; + } + } + + if (isset($val['date'])) { + $namePart = $dom->createElement('mods:namePart', htmlspecialchars(trim($val['date']))); + $namePart->setAttribute('type', 'date'); + $name->appendChild($namePart); + } + + if ($appendName) { + if (isset($val['subject'])) { + $subject->appendChild($name); + $hasSubject = TRUE; + } + else { + $mods->appendChild($name); + } + } + } + } + + if ($hasSubject) { + $mods->appendChild($subject); + } + + return $mods; + } + +} diff --git a/plugins/PersonalCollectionClass.inc b/plugins/PersonalCollectionClass.inc index 9644dd71..9ed6af07 100644 --- a/plugins/PersonalCollectionClass.inc +++ b/plugins/PersonalCollectionClass.inc @@ -1,204 +1,254 @@ -formatOutput = TRUE; - - $rootElement = $dom->createElement("foxml:digitalObject"); - $rootElement->setAttribute('PID', "$pid"); - $rootElement->setAttribute('xmlns:foxml', "info:fedora/fedora-system:def/foxml#"); - $rootElement->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); - $rootElement->setAttribute('xsi:schemaLocation', "info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-0.xsd"); - $dom->appendChild($rootElement); - //create standard fedora stuff - $this->createStandardFedoraStuff($theUser, $dom, $rootElement); - //create dublin core - $this->createDCStream($theUser, $dom, $rootElement); - $value = $this->createPolicyStream($theUser, $dom, $rootElement); - - if (!$value) { - return FALSE;//error should already be logged. - } - $this->createCollectionPolicyStream($theUser, $dom, $rootElement); - try { - $params = array( - 'objectXML' => $dom->saveXML(), - 'format' => "foxml1.0", - 'logMessage' => "Fedora object ingested", - ); - - $object = $soapClient->__soapCall('ingest', array( - $params - )); - - } - catch (exception $e) { - drupal_set_message(t('Error ingesting personal collection object: !e', array('!e' => $e->getMessage())), 'error'); - return FALSE; - } - return TRUE; - } - - function createCollectionPolicyStream($user, $dom, $rootElement) { - $collectionTemplate = file_get_contents(drupal_get_path('module', 'Fedora_Repository') . '/collection_policies/PERSONAL-COLLECTION-POLICY.xml'); - try { - $xml = new SimpleXMLElement($collectionTemplate); - } - catch (Exception $e) { - watchdog(t("Fedora_Repository"), t("Problem creating personal collection policy, could not parse collection policy stream."), NULL, WATCHDOG_ERROR); - drupal_set_message(t('Problem creating personal collection policy, could not parse collection policy stream: !e', array('!e' => $e->getMessage())), 'error'); - return FALSE; - } - $policyElement = $dom->createDocumentFragment(); - - if (!$policyElement) { - drupal_set_message(t('Error parsing policy stream.')); - watchdog(t("Fedora_Repository"), t("Error parsing policy stream, could not parse policy stream."), NULL, WATCHDOG_NOTICE); - return FALSE; - } - $dom->importNode($policyElement, TRUE); - - $value = $policyElement->appendXML($collectionTemplate); - if (!$value) { - drupal_set_message(t('Error creating collection policy stream.')); - watchdog(t("Fedora_Repository"), t("Error creating collection policy stream, could not parse collection policy template file."), NULL, WATCHDOG_NOTICE); - return FALSE; - } - - $ds1 = $dom->createElement("foxml:datastream"); - $rootElement->appendChild($ds1); - $ds1->setAttribute("ID", "COLLECTION_POLICY"); - $ds1->setAttribute("STATE", "A"); - $ds1->setAttribute("CONTROL_GROUP", "X"); - $ds1v = $dom->createElement("foxml:datastreamVersion"); - $ds1->appendChild($ds1v); - $ds1v->setAttribute("ID", "COLLECTION_POLICY.0"); - $ds1v->setAttribute("MIMETYPE", "text/xml"); - $ds1v->setAttribute("LABEL", "COLLECTION_POLICY"); - //$ds1v->setAttribute("FORMAT_URI","info:fedora/fedora-system:format/xml.fedora.audit"); - $content = $dom->createElement("foxml:xmlContent"); - $ds1v->appendChild($content); - $content->appendChild($policyElement); - return TRUE; - } - - function createPolicyStream($user, $dom, $rootElement) { - module_load_include('inc', 'fedora_repository', 'SecurityClass'); - - $securityClass = new SecurityClass(); - $policyStreamDoc = $securityClass->createPersonalPolicy($user); - $policyNodes = $policyStreamDoc->getElementsByTagName('Policy'); - $policyStream = $policyNodes->item(0); - $policyStream = $dom->importNode($policyStream, TRUE); - - $ds1 = $dom->createElement("foxml:datastream"); - $rootElement->appendChild($ds1); - $ds1->setAttribute("ID", "POLICY"); - $ds1->setAttribute("STATE", "A"); - $ds1->setAttribute("CONTROL_GROUP", "X"); - $ds1v = $dom->createElement("foxml:datastreamVersion"); - $ds1->appendChild($ds1v); - $ds1v->setAttribute("ID", "POLICY.0"); - $ds1v->setAttribute("MIMETYPE", "text/xml"); - $ds1v->setAttribute("LABEL", "SECURITY_POLICY"); - //$ds1v->setAttribute("FORMAT_URI","info:fedora/fedora-system:format/xml.fedora.audit"); - $content = $dom->createElement("foxml:xmlContent"); - $ds1v->appendChild($content); - $content->appendChild($policyStream); - return $this->createChildPolicyStream($dom, $rootElement, $policyStream->cloneNode(TRUE)); - } - - //right now this is the same as the policy stream for this object, may change - //objects in this collection will reference this datastream as their own POLICY stream - function createChildPolicyStream($dom, $rootElement, $policyStream) { - $ds1 = $dom->createElement("foxml:datastream"); - - $rootElement->appendChild($ds1); - $ds1->setAttribute("ID", "CHILD_SECURITY"); - $ds1->setAttribute("STATE", "A"); - $ds1->setAttribute("CONTROL_GROUP", "X"); - $ds1v = $dom->createElement("foxml:datastreamVersion"); - $ds1->appendChild($ds1v); - $ds1v->setAttribute("ID", "CHILD_SECURITY.0"); - $ds1v->setAttribute("MIMETYPE", "text/xml"); - $ds1v->setAttribute("LABEL", "SECURITY_POLICY"); - //$ds1v->setAttribute("FORMAT_URI","info:fedora/fedora-system:format/xml.fedora.audit"); - $content = $dom->createElement("foxml:xmlContent"); - $ds1v->appendChild($content); - $content->appendChild($policyStream); - return TRUE; - } - - function createStandardFedoraStuff($user, & $dom, & $rootElement) { - /*foxml object properties section */ - $objproperties = $dom->createElement("foxml:objectProperties"); - $prop1 = $dom->createElement("foxml:property"); - $prop1->setAttribute("NAME", "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"); - $prop1->setAttribute("VALUE", "FedoraObject"); - $prop2 = $dom->createElement("foxml:property"); - $prop2->setAttribute("NAME", "info:fedora/fedora-system:def/model#state"); - $prop2->setAttribute("VALUE", "A"); - $prop3 = $dom->createElement("foxml:property"); - $prop3->setAttribute("NAME", "info:fedora/fedora-system:def/model#label"); - $prop3->setAttribute("VALUE", $user->name); - $prop4 = $dom->createElement("foxml:property"); - $prop4->setAttribute("NAME", "info:fedora/fedora-system:def/model#contentModel"); - $prop4->setAttribute("VALUE", 'Collection'); - $prop5 = $dom->createElement("foxml:property"); - $prop5->setAttribute("NAME", "info:fedora/fedora-system:def/model#ownerId"); - $prop5->setAttribute("VALUE", $user->name); - $objproperties->appendChild($prop1); - $objproperties->appendChild($prop2); - $objproperties->appendChild($prop3); - $objproperties->appendChild($prop4); - $objproperties->appendChild($prop5); - $rootElement->appendChild($objproperties); - } - - function createDCStream($theUser, & $dom, & $rootElement) { - global $user; - $datastream = $dom->createElement("foxml:datastream"); - $datastream->setAttribute("ID", "DC"); - $datastream->setAttribute("STATE", "A"); - $datastream->setAttribute("CONTROL_GROUP", "X"); - $version = $dom->createElement("foxml:datastreamVersion"); - $version->setAttribute("ID", "DC.0"); - $version->setAttribute("MIMETYPE", "text/xml"); - $version->setAttribute("LABEL", "Dublin Core Record"); - $datastream->appendChild($version); - $content = $dom->createElement("foxml:xmlContent"); - $version->appendChild($content); - ///begin writing dc - $oai = $dom->createElement("oai_dc:dc"); - $oai->setAttribute('xmlns:oai_dc', "http://www.openarchives.org/OAI/2.0/oai_dc/"); - $oai->setAttribute('xmlns:dc', "http://purl.org/dc/elements/1.1/"); - $oai->setAttribute('xmlns:dcterms', "http://purl.org/dc/terms/"); - $oai->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); - $content->appendChild($oai); - //dc elements - $element = $dom->createElement('dc:type', 'Collection'); - $oai->appendChild($element); - $element = $dom->createElement('dc:title', $theUser->name . ' Personal Collection'); - $oai->appendChild($element); - $element = $dom->createElement('dc:date', date(DATE_RFC822)); - $oai->appendChild($element); - $element = $dom->createElement('dc:subject', $theUser->name); - $oai->appendChild($element); - $element = $dom->createElement('dc:contributor', ''); - $oai->appendChild($element); - $element = $dom->createElement('dc:creator', $user->name); - $oai->appendChild($element); - - $element = $dom->createElement('dc:language', ''); - $oai->appendChild($element); - - $rootElement->appendChild($datastream); - } - -} +formatOutput = TRUE; + + $rootElement = $dom->createElement("foxml:digitalObject"); + $rootElement->setAttribute('PID', "$pid"); + $rootElement->setAttribute('xmlns:foxml', "info:fedora/fedora-system:def/foxml#"); + $rootElement->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); + $rootElement->setAttribute('xsi:schemaLocation', "info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-0.xsd"); + $dom->appendChild($rootElement); + //create standard fedora stuff + $this->createStandardFedoraStuff($theUser, $dom, $rootElement); + //create dublin core + $this->createDCStream($theUser, $dom, $rootElement); + $value = $this->createPolicyStream($theUser, $dom, $rootElement); + + if (!$value) { + return FALSE; //error should already be logged. + } + $this->createCollectionPolicyStream($theUser, $dom, $rootElement); + try { + $params = array( + 'objectXML' => $dom->saveXML(), + 'format' => "foxml1.0", + 'logMessage' => "Fedora object ingested", + ); + + $object = $soapClient->__soapCall('ingest', array( + $params + )); + } catch (exception $e) { + drupal_set_message(t('Error ingesting personal collection object: @e', array('@e' => check_plain($e->getMessage()))), 'error'); + return FALSE; + } + return TRUE; + } + + /** + * Create Collection Policy Stream ?? + * @param type $user + * @param type $dom + * @param type $rootElement + * @return type + */ + function createCollectionPolicyStream($user, $dom, $rootElement) { + $collectionTemplate = file_get_contents(drupal_get_path('module', 'Fedora_Repository') . '/collection_policies/PERSONAL-COLLECTION-POLICY.xml'); + try { + $xml = new SimpleXMLElement($collectionTemplate); + } catch (Exception $e) { + watchdog(t("Fedora_Repository"), "Problem creating personal collection policy, could not parse collection policy stream.", NULL, WATCHDOG_ERROR); + drupal_set_message(t('Problem creating personal collection policy, could not parse collection policy stream: @e', array('@e' => check_plain($e->getMessage()))), 'error'); + return FALSE; + } + $policyElement = $dom->createDocumentFragment(); + + if (!$policyElement) { + drupal_set_message(t('Error parsing policy stream.')); + watchdog(t("Fedora_Repository"), "Error parsing policy stream, could not parse policy stream.", NULL, WATCHDOG_NOTICE); + return FALSE; + } + $dom->importNode($policyElement, TRUE); + + $value = $policyElement->appendXML($collectionTemplate); + if (!$value) { + drupal_set_message(t('Error creating collection policy stream.')); + watchdog(t("Fedora_Repository"), "Error creating collection policy stream, could not parse collection policy template file.", NULL, WATCHDOG_NOTICE); + return FALSE; + } + + $ds1 = $dom->createElement("foxml:datastream"); + $rootElement->appendChild($ds1); + $ds1->setAttribute("ID", "COLLECTION_POLICY"); + $ds1->setAttribute("STATE", "A"); + $ds1->setAttribute("CONTROL_GROUP", "X"); + $ds1v = $dom->createElement("foxml:datastreamVersion"); + $ds1->appendChild($ds1v); + $ds1v->setAttribute("ID", "COLLECTION_POLICY.0"); + $ds1v->setAttribute("MIMETYPE", "text/xml"); + $ds1v->setAttribute("LABEL", "COLLECTION_POLICY"); + //$ds1v->setAttribute("FORMAT_URI","info:fedora/fedora-system:format/xml.fedora.audit"); + $content = $dom->createElement("foxml:xmlContent"); + $ds1v->appendChild($content); + $content->appendChild($policyElement); + return TRUE; + } + + /** + * Create Policy Stream ?? + * @param type $user + * @param type $dom + * @param type $rootElement + * @return type + */ + function createPolicyStream($user, $dom, $rootElement) { + module_load_include('inc', 'fedora_repository', 'SecurityClass'); + + $securityClass = new SecurityClass(); + $policyStreamDoc = $securityClass->createPersonalPolicy($user); + $policyNodes = $policyStreamDoc->getElementsByTagName('Policy'); + $policyStream = $policyNodes->item(0); + $policyStream = $dom->importNode($policyStream, TRUE); + + $ds1 = $dom->createElement("foxml:datastream"); + $rootElement->appendChild($ds1); + $ds1->setAttribute("ID", "POLICY"); + $ds1->setAttribute("STATE", "A"); + $ds1->setAttribute("CONTROL_GROUP", "X"); + $ds1v = $dom->createElement("foxml:datastreamVersion"); + $ds1->appendChild($ds1v); + $ds1v->setAttribute("ID", "POLICY.0"); + $ds1v->setAttribute("MIMETYPE", "text/xml"); + $ds1v->setAttribute("LABEL", "SECURITY_POLICY"); + //$ds1v->setAttribute("FORMAT_URI","info:fedora/fedora-system:format/xml.fedora.audit"); + $content = $dom->createElement("foxml:xmlContent"); + $ds1v->appendChild($content); + $content->appendChild($policyStream); + return $this->createChildPolicyStream($dom, $rootElement, $policyStream->cloneNode(TRUE)); + } + + /** + * right now this is the same as the policy stream for this object, may change + * objects in this collection will reference this datastream as their own POLICY stream ??? + * @param type $dom + * @param type $rootElement + * @param type $policyStream + * @return type + */ + function createChildPolicyStream($dom, $rootElement, $policyStream) { + $ds1 = $dom->createElement("foxml:datastream"); + + $rootElement->appendChild($ds1); + $ds1->setAttribute("ID", "CHILD_SECURITY"); + $ds1->setAttribute("STATE", "A"); + $ds1->setAttribute("CONTROL_GROUP", "X"); + $ds1v = $dom->createElement("foxml:datastreamVersion"); + $ds1->appendChild($ds1v); + $ds1v->setAttribute("ID", "CHILD_SECURITY.0"); + $ds1v->setAttribute("MIMETYPE", "text/xml"); + $ds1v->setAttribute("LABEL", "SECURITY_POLICY"); + //$ds1v->setAttribute("FORMAT_URI","info:fedora/fedora-system:format/xml.fedora.audit"); + $content = $dom->createElement("foxml:xmlContent"); + $ds1v->appendChild($content); + $content->appendChild($policyStream); + return TRUE; + } + + /** + * Create standard fedora stuff ?????????????????? + * @param type $user + * @param type $dom + * @param type $rootElement + */ + function createStandardFedoraStuff($user, & $dom, & $rootElement) { + /* foxml object properties section */ + $objproperties = $dom->createElement("foxml:objectProperties"); + $prop1 = $dom->createElement("foxml:property"); + $prop1->setAttribute("NAME", "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"); + $prop1->setAttribute("VALUE", "FedoraObject"); + $prop2 = $dom->createElement("foxml:property"); + $prop2->setAttribute("NAME", "info:fedora/fedora-system:def/model#state"); + $prop2->setAttribute("VALUE", "A"); + $prop3 = $dom->createElement("foxml:property"); + $prop3->setAttribute("NAME", "info:fedora/fedora-system:def/model#label"); + $prop3->setAttribute("VALUE", $user->name); + $prop4 = $dom->createElement("foxml:property"); + $prop4->setAttribute("NAME", "info:fedora/fedora-system:def/model#contentModel"); + $prop4->setAttribute("VALUE", 'Collection'); + $prop5 = $dom->createElement("foxml:property"); + $prop5->setAttribute("NAME", "info:fedora/fedora-system:def/model#ownerId"); + $prop5->setAttribute("VALUE", $user->name); + $objproperties->appendChild($prop1); + $objproperties->appendChild($prop2); + $objproperties->appendChild($prop3); + $objproperties->appendChild($prop4); + $objproperties->appendChild($prop5); + $rootElement->appendChild($objproperties); + } + + /** + * Create DC Stream ??? + * @global type $user + * @param type $theUser + * @param type $dom + * @param type $rootElement + */ + function createDCStream($theUser, & $dom, & $rootElement) { + global $user; + $datastream = $dom->createElement("foxml:datastream"); + $datastream->setAttribute("ID", "DC"); + $datastream->setAttribute("STATE", "A"); + $datastream->setAttribute("CONTROL_GROUP", "X"); + $version = $dom->createElement("foxml:datastreamVersion"); + $version->setAttribute("ID", "DC.0"); + $version->setAttribute("MIMETYPE", "text/xml"); + $version->setAttribute("LABEL", "Dublin Core Record"); + $datastream->appendChild($version); + $content = $dom->createElement("foxml:xmlContent"); + $version->appendChild($content); + ///begin writing dc + $oai = $dom->createElement("oai_dc:dc"); + $oai->setAttribute('xmlns:oai_dc', "http://www.openarchives.org/OAI/2.0/oai_dc/"); + $oai->setAttribute('xmlns:dc', "http://purl.org/dc/elements/1.1/"); + $oai->setAttribute('xmlns:dcterms', "http://purl.org/dc/terms/"); + $oai->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); + $content->appendChild($oai); + //dc elements + $element = $dom->createElement('dc:type', 'Collection'); + $oai->appendChild($element); + $element = $dom->createElement('dc:title', $theUser->name . ' Personal Collection'); + $oai->appendChild($element); + $element = $dom->createElement('dc:date', date(DATE_RFC822)); + $oai->appendChild($element); + $element = $dom->createElement('dc:subject', $theUser->name); + $oai->appendChild($element); + $element = $dom->createElement('dc:contributor', ''); + $oai->appendChild($element); + $element = $dom->createElement('dc:creator', $user->name); + $oai->appendChild($element); + + $element = $dom->createElement('dc:language', ''); + $oai->appendChild($element); + + $rootElement->appendChild($datastream); + } + +} diff --git a/plugins/QtFormBuilder.php b/plugins/QtFormBuilder.php index af66ed31..28645d6b 100644 --- a/plugins/QtFormBuilder.php +++ b/plugins/QtFormBuilder.php @@ -1,102 +1,107 @@ -getType($file); - //$fileUrl = 'http://'.$_SERVER['HTTP_HOST'].$file; - $fileUrl = $base_url.'/'.drupal_urlencode($file); - $beginIndex = strrpos($fileUrl,'/'); - $dtitle = substr($fileUrl,$beginIndex+1); - $dtitle = substr($dtitle, 0, strpos($dtitle, ".")); - $ds1 = $dom->createElement("foxml:datastream"); - $ds1->setAttribute("ID","OBJ"); - $ds1->setAttribute("STATE","A"); - $ds1->setAttribute("CONTROL_GROUP","M"); - $ds1v= $dom->createElement("foxml:datastreamVersion"); - $ds1v->setAttribute("ID","OBJ.0"); - $ds1v->setAttribute("MIMETYPE","$dformat"); - $ds1v->setAttribute("LABEL","$dtitle"); - $ds1content = $dom->createElement('foxml:contentLocation'); - $ds1content->setAttribute("REF","$fileUrl"); - $ds1content->setAttribute("TYPE","URL"); - $ds1->appendChild($ds1v); - $ds1v->appendChild($ds1content); - $rootElement->appendChild($ds1); - -if(empty($_SESSION['fedora_ingest_files']) || !isset($_SESSION['fedora_ingest_files']['TN'])) { - $createdFile = drupal_get_path('module', 'Fedora_Repository').'/images/qtThumb.jpg'; - $fileUrl = $base_url.'/'.drupal_urlencode($createdFile);//'http://'.$_SERVER['HTTP_HOST'].'/'.$createdFile; - $ds1 = $dom->createElement("foxml:datastream"); - $ds1->setAttribute("ID","TN"); - $ds1->setAttribute("STATE","A"); - $ds1->setAttribute("CONTROL_GROUP","M"); - $ds1v= $dom->createElement("foxml:datastreamVersion"); - $ds1v->setAttribute("ID","TN.0"); - $ds1v->setAttribute("MIMETYPE","image/jpeg"); - $ds1v->setAttribute("LABEL","Thumbnail"); - $ds1content = $dom->createElement('foxml:contentLocation'); - $ds1content->setAttribute("REF","$fileUrl"); - $ds1content->setAttribute("TYPE","URL"); - $ds1->appendChild($ds1v); - $ds1v->appendChild($ds1content); - $rootElement->appendChild($ds1); -} - - if (!empty($_SESSION['fedora_ingest_files'])) { - - - - foreach ($_SESSION['fedora_ingest_files'] as $dsid => $createdFile) { - $createdFile = strstr($createdFile, $file); - $dformat = $mimetype->getType($createdFile); - $fileUrl = $base_url . '/'. drupal_urlencode($createdFile); - $beginIndex = strrpos($fileUrl, '/'); - $dtitle = substr($fileUrl, $beginIndex + 1); - $dtitle = urldecode($dtitle); - $dtitle = $dtitle; - $ds1 = $dom->createElement("foxml:datastream"); - $ds1->setAttribute("ID", "$dsid"); - $ds1->setAttribute("STATE", "A"); - $ds1->setAttribute("CONTROL_GROUP", "M"); - $ds1v= $dom->createElement("foxml:datastreamVersion"); - $ds1v->setAttribute("ID", "$dsid.0"); - $ds1v->setAttribute("MIMETYPE", "$dformat"); - $ds1v->setAttribute("LABEL", "$dtitle"); - $ds1content = $dom->createElement('foxml:contentLocation'); - $ds1content->setAttribute("REF", "$fileUrl"); - $ds1content->setAttribute("TYPE", "URL"); - $ds1->appendChild($ds1v); - $ds1v->appendChild($ds1content); - $rootElement->appendChild($ds1); - } - } - - - - } - - - - } -?> +getType($file); + //$fileUrl = 'http://'.$_SERVER['HTTP_HOST'].$file; + $fileUrl = $base_url . '/' . drupal_urlencode($file); + $beginIndex = strrpos($fileUrl, '/'); + $dtitle = substr($fileUrl, $beginIndex + 1); + $dtitle = substr($dtitle, 0, strpos($dtitle, ".")); + $ds1 = $dom->createElement("foxml:datastream"); + $ds1->setAttribute("ID", "OBJ"); + $ds1->setAttribute("STATE", "A"); + $ds1->setAttribute("CONTROL_GROUP", "M"); + $ds1v = $dom->createElement("foxml:datastreamVersion"); + $ds1v->setAttribute("ID", "OBJ.0"); + $ds1v->setAttribute("MIMETYPE", "$dformat"); + $ds1v->setAttribute("LABEL", "$dtitle"); + $ds1content = $dom->createElement('foxml:contentLocation'); + $ds1content->setAttribute("REF", "$fileUrl"); + $ds1content->setAttribute("TYPE", "URL"); + $ds1->appendChild($ds1v); + $ds1v->appendChild($ds1content); + $rootElement->appendChild($ds1); + + if (empty($_SESSION['fedora_ingest_files']) || !isset($_SESSION['fedora_ingest_files']['TN'])) { + $createdFile = drupal_get_path('module', 'Fedora_Repository') . '/images/qtThumb.jpg'; + $fileUrl = $base_url . '/' . drupal_urlencode($createdFile); //'http://'.$_SERVER['HTTP_HOST'].'/'.$createdFile; + $ds1 = $dom->createElement("foxml:datastream"); + $ds1->setAttribute("ID", "TN"); + $ds1->setAttribute("STATE", "A"); + $ds1->setAttribute("CONTROL_GROUP", "M"); + $ds1v = $dom->createElement("foxml:datastreamVersion"); + $ds1v->setAttribute("ID", "TN.0"); + $ds1v->setAttribute("MIMETYPE", "image/jpeg"); + $ds1v->setAttribute("LABEL", "Thumbnail"); + $ds1content = $dom->createElement('foxml:contentLocation'); + $ds1content->setAttribute("REF", "$fileUrl"); + $ds1content->setAttribute("TYPE", "URL"); + $ds1->appendChild($ds1v); + $ds1v->appendChild($ds1content); + $rootElement->appendChild($ds1); + } + + if (!empty($_SESSION['fedora_ingest_files'])) { + + foreach ($_SESSION['fedora_ingest_files'] as $dsid => $createdFile) { + $createdFile = strstr($createdFile, $file); + $dformat = $mimetype->getType($createdFile); + $fileUrl = $base_url . '/' . drupal_urlencode($createdFile); + $beginIndex = strrpos($fileUrl, '/'); + $dtitle = substr($fileUrl, $beginIndex + 1); + $dtitle = urldecode($dtitle); + $dtitle = $dtitle; + $ds1 = $dom->createElement("foxml:datastream"); + $ds1->setAttribute("ID", "$dsid"); + $ds1->setAttribute("STATE", "A"); + $ds1->setAttribute("CONTROL_GROUP", "M"); + $ds1v = $dom->createElement("foxml:datastreamVersion"); + $ds1v->setAttribute("ID", "$dsid.0"); + $ds1v->setAttribute("MIMETYPE", "$dformat"); + $ds1v->setAttribute("LABEL", "$dtitle"); + $ds1content = $dom->createElement('foxml:contentLocation'); + $ds1content->setAttribute("REF", "$fileUrl"); + $ds1content->setAttribute("TYPE", "URL"); + $ds1->appendChild($ds1v); + $ds1v->appendChild($ds1content); + $rootElement->appendChild($ds1); + } + } + } +} + +?> diff --git a/plugins/Refworks.inc b/plugins/Refworks.inc index f6e43f95..70b0abeb 100644 --- a/plugins/Refworks.inc +++ b/plugins/Refworks.inc @@ -1,449 +1,491 @@ -romeoUrlString = "http://www.sherpa.ac.uk/romeo/api24.php?issn="; - } - - function buildForm( &$form, $ingest_form_definition, &$form_values) { - $form['indicator2'] = array( - '#type' => 'fieldset', - '#title' => t('Ingest digital object step #2'), - ); - foreach ($ingest_form_definition->form_elements->element as $element) { - $name = strip_tags($element->name->asXML()); - $title = strip_tags($element->label->asXML()); - $required = strip_tags($element->required->asXML()); - $prefix = strip_tags($element->prefix); - $required = strtolower($required); - if ($required != 'TRUE') { - $required = '0'; - } - - $description = strip_tags($element->description->asXML()); - $type = strip_tags($element->type->asXML()); - - $form['indicator2']["$name"] = array( - '#title' => $title, - '#required' => $required, - '#description' => $description, - '#prefix' => $prefix, - '#type' => $type - ); - } - - return $form; - } - - /** - * Read the input file and generate a list of Reference items. - * - * @param array $form_values - * @param SimpleXMLElement $dom - * @return SimpleXMLElement - */ - function parse_refworks_item(&$form_values) { - - $file = $form_values['ingest-file-location']; - try { - $dom = new DOMDocument('1.0', 'UTF-8'); - $dom->substituteEntities = FALSE; - $dom->loadXML(trim(file_get_contents($file))); - $xml = simplexml_import_dom($dom); - //$xml=simplexml_load_string(trim(file_get_contents($file),NULL,TRUE)); - //$dom = dom_import_simplexml($xml);//test to see if it behaves better - //$xml = new SimpleXMLElement(trim(file_get_contents($file))); - } - catch (Exception $e) { - drupal_set_message(t('Error processing Refworks file: ') . $e->getMessage()); - return FALSE; - } - $this->referenceList = array(); - foreach ($xml->reference as $reference) { - array_push( $this->referenceList, $reference ); - } - - return $this->referenceList; - } - - //create A DC stream with ID of DC - function createQDCStream( &$dom, &$rootElement, $reference ) { - $datastream = $dom->createElement("foxml:datastream"); - $datastream->setAttribute("ID", "DC"); - $datastream->setAttribute("STATE", "A"); - $datastream->setAttribute("CONTROL_GROUP", "X"); - $version = $dom->createElement("foxml:datastreamVersion"); - $version->setAttribute("ID", "DC.0"); - $version->setAttribute("MIMETYPE", "text/xml"); - $version->setAttribute("LABEL", "DC Dublin Core Record"); - $datastream->appendChild($version); - $content = $dom->createElement("foxml:xmlContent"); - $version->appendChild($content); - ///begin writing qdc - $oai = $dom->createElement("oai_dc:dc"); - $oai->setAttribute('xmlns:oai_dc', "http://www.openarchives.org/OAI/2.0/oai_dc/"); - $oai->setAttribute('xmlns:dc', "http://purl.org/dc/elements/1.1/"); - $oai->setAttribute('xmlns:dcterms', "http://purl.org/dc/terms/"); - $oai->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); - $content->appendChild($oai); - - foreach ($reference->sr as $value) { - $element = $dom->createElement('dc:type', htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8')); - $oai->appendChild($element); - } - foreach ($reference->id as $value) { - $identifier = $value; - } - foreach ($reference->a1 as $value) { - $element = $dom->createElement('dc:creator', htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8')); - $oai->appendChild($element); - } - foreach ($reference->t1 as $value) { - // $form_values['dc:title'] = $value; - $element = $dom->createElement('dc:title', htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8')); - $oai->appendChild($element); - } - foreach ($reference->jf as $value) { - $source = $value; - } - foreach ($reference->yr as $value) { - $element = $dom->createElement('dc:date', htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8')); - $oai->appendChild($element); - } - foreach ($reference->vo as $value) { - $source .= ' Volume: '. $value; - } - foreach ($reference->is as $value) { - $source .= ' Issue: '. $value; - } - foreach ($reference->sp as $value) { - $source .= ' Start Page: '. $value; - } - foreach ($reference->op as $value) { - $source .= ' Other Pages: '. $value; - } - foreach ($reference->ul as $value) { - $source .= ' URL: '. $value; - } - foreach ($reference->k1 as $value) { - $element = $dom->createElement('dc:subject', htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8')); - $oai->appendChild($element); - } - foreach ($reference->a2 as $value) { - $element = $dom->createElement('dc:contributor', htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8')); - $oai->appendChild($element); - } - foreach ($reference->a3 as $value) { - $element = $dom->createElement('dc:contributor', htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8')); - $oai->appendChild($element); - } - foreach ($reference->a4 as $value) { - $element = $dom->createElement('dc:contributor', htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8')); - $oai->appendChild($element); - } - foreach ($reference->a5 as $value) { - $element = $dom->createElement('dc:contributor', htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8')); - $oai->appendChild($element); - } - foreach ($reference->la as $value) { - $element = $dom->createElement('dc:language', htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8')); - $oai->appendChild($element); - } - foreach ($reference->pb as $value) { - $source = 'Publisher: ' . $value; - } - foreach ($reference->pp as $value) { - $source .= ' Place of publication: ' . $value; - } - foreach ($reference->sn as $value) { - $identifier .= ' ISSN/ISBN: ' . $value; - //$this->romeoUrlString = $this->romeoUrlString . $value; - if (!$this->issn == '') { - $this->issn=$value; - } - else { - $this->issn .= ','. $value; - } - } - foreach ($reference->ab as $value) { - $description = ' abstract: '. $value; - } - foreach ($reference->cr as $value) { - $description .= ' Cited reference: '. $value; - } - $element = $dom->createElement('dc:description', htmlspecialchars($description, ENT_NOQUOTES, 'UTF-8')); - $oai->appendChild($element); - $element = $dom->createElement('dc:source', htmlspecialchars($source, ENT_NOQUOTES, 'UTF-8')); - $oai->appendChild($element); - $element = $dom->createElement('dc:identifier', htmlspecialchars($identifier, ENT_NOQUOTES, 'UTF-8')); - $oai->appendChild($element); - //$rootElement->appendChild($datastream); - return $datastream; - } - - function handleForm( &$form_values ) { - $errorMessage = NULL; - module_load_include('inc', 'fedora_repository', 'CollectionClass'); - module_load_include('inc', 'fedora_repository', 'ContentModel'); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - $contentModelPid = ContentModel::getPidFromIdentifier($form_values['models']); - $contentModelDsid = ContentModel::getDSIDFromIdentifier($form_values['models']); - $collectionHelper = new CollectionClass(); - $startTime=time(); - $collection_pid = $form_values['collection_pid']; - - $this->parse_refworks_item( $form_values ); - - $this->securityHelper = new SecurityClass(); - - $collection_item = new Fedora_Item($collection_pid); - $this->collectionPolicyStream = $collection_item->get_datastream_dissemination('CHILD_SECURITY'); - if (empty($this->collectionPolicyStream)) { - $this->collectionPolicyStream = file_get_contents(drupal_get_path('module', 'fedora_repository') . '/policies/noObjectEditPolicy.xml'); - } - $success = 0; - $errors = 0; - foreach ($this->referenceList as $reference) { - $dom = new DomDocument("1.0", "UTF-8"); - $dom->substituteEntities = FALSE; - $dom->formatOutput = TRUE; - $pid = $collectionHelper->getNextPid($collection_pid, $contentModelDsid); - - $rootElement = $dom->createElement("foxml:digitalObject"); - $rootElement->setAttribute('VERSION', '1.1'); - $rootElement->setAttribute('PID', "$pid"); - $rootElement->setAttribute('xmlns:foxml', "info:fedora/fedora-system:def/foxml#"); - $rootElement->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); - $rootElement->setAttribute('xsi:schemaLocation', "info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd"); - $dom->appendChild($rootElement); - - //create standard fedora stuff - $qdc_element = $this->createQDCStream($dom, $rootElement, $reference); - if (!$qdc_element) { - drupal_set_message(t('Error creating DC for Refworks'), 'error'); - continue; - } - $item_title=''; - foreach ($reference->t1 as $value) { - $item_title .= ' --- '. $value; - } - $this->createStandardFedoraStuff($form_values, $dom, $rootElement, $reference ); - $rootElement->appendChild($qdc_element); - //create relationships - $this->createRelationShips($form_values, $dom, $rootElement, $pid); - //create dublin core - - $this->createFedoraDataStreams($form_values, $dom, $rootElement, $reference); - - if (!empty ( $this->collectionPolicyStream)) { - $this->create_security_policies($dom, $rootElement, $reference); - } - - $params = array( - 'objectXML' => $dom->saveXML(), - 'format' => 'info:fedora/fedora-system:FOXML-1.1', - 'logMessage' => "Fedora Object Ingested", - ); - - try { - $soapHelper = new ConnectionHelper(); - $client = $soapHelper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); - - if ($client == NULL) { - drupal_set_message(t('Error getting SOAP client.'), 'error'); - watchdog(t("FEDORA_REPOSITORY"), t("Error getting SOAP client: !e", array('!e' => $e)), NULL, WATCHDOG_ERROR); - return; - } - $object = $client->__soapCall('ingest', array( - $params - )); - watchdog(t("FEDORA_REPOSITORY"), t("Successfully added repository item !pid - !it", array('!pid' => $pid, '!it' => $item_title)), NULL, WATCHDOG_INFO); - $deleteFiles = $form_values['delete_file']; //remove files from drupal file system - - if ($deleteFiles > 0) { - unlink($form_values['fullpath']); - } - } - catch (exception $e) { - $errors++; - $errorMessage = 'yes'; - watchdog(t("FEDORA_REPOSITORY"), t("Error during ingest !it !e", array('!it' => $item_title, '!e' => $e)), NULL, WATCHDOG_ERROR); - } - $success++; - } - if (isset($errorMessage)) { - drupal_set_message(t('Error ingesting one or more records! Check Drupal watchdog logs for more info') , 'error'); - } - $endTime = time(); - drupal_set_message(t('Successfull ingest of %success records. %errors records failed. Ingest took %seconds seconds', - array('%success' => $success-$errors, '%errors' => $errors, '%seconds' => $endTime-$startTime)) , 'info'); - } - - /** - * Creates the RELS-EXT for the foxml - */ - function createRelationShips( $form_values, &$dom, &$rootElement, $pid = NULL ) { - $drdf = $dom->createElement("foxml:datastream"); - $drdf->setAttribute("ID", "RELS-EXT"); - $drdf->setAttribute("CONTROL_GROUP", "X"); - $dvrdf = $dom->createElement("foxml:datastreamVersion"); - $dvrdf->setAttribute("ID", "RELS-EXT.0"); - $dvrdf->setAttribute("MIMETYPE", "text/xml"); - $dvrdf->setAttribute("LABEL", "Fedora Object-to-Object Relationship Metadata"); - $dvcontent = $dom->createElement("foxml:xmlContent"); - $rdf = $dom->createElement("rdf:RDF"); - $rdf->setAttribute("xmlns:rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); - $rdf->setAttribute("xmlns:rdfs", "http://www.w3.org/2000/01/rdf-schema#"); - $rdf->setAttribute("xmlns:fedora", "info:fedora/fedora-system:def/relations-external#"); - $rdf->setAttribute("xmlns:fedora-model", "info:fedora/fedora-system:def/model#"); - $rdfdesc = $dom->createElement("rdf:description"); - $rdfdesc->setAttribute("rdf:about", "info:fedora/$pid"); - $member = $dom->createElement("fedora:isMemberOfCollection"); - $membr = $form_values['collection_pid']; - $member->setAttribute("rdf:resource", "info:fedora/$membr"); - $model = $dom->createElement("fedora-model:hasModel"); - $model->setAttribute("rdf:resource", "info:fedora/islandora:refworksCModel"); - - $drdf->appendChild($dvrdf); - $dvrdf->appendChild($dvcontent); - $dvcontent->appendChild($rdf); - $rdf->appendChild($rdfdesc); - $rdfdesc->appendChild($member); - $rdfdesc->appendChild($model); - $rootElement->appendChild($drdf); - - } - - function createRomeoDataStream(&$dom, &$rootElement) { - $ds1 = $dom->createElement("foxml:datastream"); - $ds1->setAttribute("ID", "ROMEO"); - $ds1->setAttribute("STATE", "A"); - $ds1->setAttribute("CONTROL_GROUP", "E"); - $ds1v = $dom->createElement("foxml:datastreamVersion"); - $ds1v->setAttribute("ID", "ROMEO.0"); - $ds1v->setAttribute("MIMETYPE", "text/xml"); - $ds1v->setAttribute("LABEL", "ROMEO"); - $ds1content = $dom->createElement('foxml:contentLocation'); - $url = $this->romeoUrlString . $this->issn; - $this->issn=''; //clear the issn's for next ingest in case we are doing batch - $ds1content->setAttribute("REF", "$url"); - $ds1content->setAttribute("TYPE", "URL"); - $ds1->appendChild($ds1v); - $ds1v->appendChild($ds1content); - $rootElement->appendChild($ds1); - } - - function createFedoraDataStreams($form_values, &$dom, &$rootElement, $reference) { - global $base_url; - module_load_include('inc', 'fedora_repository', 'MimeClass'); - $mimetype = new MimeClass(); - $server = NULL; - $this->createRomeoDataStream($dom, $rootElement); - $ds1 = $dom->createElement("foxml:datastream"); - $ds1->setAttribute("ID", "refworks"); - $ds1->setAttribute("STATE", "A"); - $ds1->setAttribute("CONTROL_GROUP", "X"); - $ds1v = $dom->createElement("foxml:datastreamVersion"); - $ds1v->setAttribute("ID", "refworks.0"); - $ds1v->setAttribute("MIMETYPE", "text/xml"); - $ds1v->setAttribute("LABEL", "Refworks datastream"); - $ds1content = $dom->createElement("foxml:xmlContent"); - - $ds1content->appendChild($dom->importNode(dom_import_simplexml($reference), TRUE)); - $ds1->appendChild($ds1v); - $ds1v->appendChild($ds1content); - $rootElement->appendChild($ds1); - - $count = 0; - } - - /** - * Creates the standard foxml properties - */ - function createStandardFedoraStuff($form_values, &$dom, &$rootElement, $reference) { - // Foxml object properties section - $objproperties = $dom->createElement("foxml:objectProperties"); - $prop2 = $dom->createElement("foxml:property"); - $prop2->setAttribute("NAME", "info:fedora/fedora-system:def/model#state"); - $prop2->setAttribute("VALUE", "A"); - $prop3 = $dom->createElement("foxml:property"); - $prop3->setAttribute("NAME", "info:fedora/fedora-system:def/model#label"); - $label = $reference->t1; - if (strlen($label) > 254) { - $label = substr($label, 0, 245); - } - $prop3->setAttribute("VALUE", $label); - $prop5 = $dom->createElement("foxml:property"); - $prop5->setAttribute("NAME", "info:fedora/fedora-system:def/model#ownerId"); - $prop5->setAttribute("VALUE", $form_values['user_id']); - $objproperties->appendChild($prop2); - $objproperties->appendChild($prop3); - $objproperties->appendChild($prop5); - $rootElement->appendChild($objproperties); - } - - - /** - * Read the list of Users from the U1 field and Roles from the U2 field and add elements - * to the security policy record for this item, then add the record as the security policy datastream. - * - * @param array $form_values - * @param DOMDocument $dom - * @param $rootElement - * @param SimpleXMLElement $reference - */ - function create_security_policies($dom, &$rootElement, $reference) { - global $user; - $ds1 = $dom->createElement("foxml:datastream"); - $ds1->setAttribute("ID", "POLICY"); - $ds1->setAttribute("STATE", "A"); - $ds1->setAttribute("CONTROL_GROUP", "X"); - $ds1v = $dom->createElement("foxml:datastreamVersion"); - $ds1v->setAttribute("ID", "POLICY.0"); - $ds1v->setAttribute("MIMETYPE", "text/xml"); - $ds1v->setAttribute("LABEL", "POLICY Record"); - $ds1content = $dom->createElement( "foxml:xmlContent" ); - - $custom_policy = $this->collectionPolicyStream; - $allowed_users_and_roles = array(); - $allowed_users_and_roles['users'] = array(); - $allowed_users_and_roles['roles'] = array(); - foreach ($reference->u1 as $namelist) { - foreach (explode(';', strip_tags($namelist->asXML())) as $name) { - array_push($allowed_users_and_roles['users'], $name); - } - } - if (empty( $reference->u1)) { - // If no "u1" value exists, add the currently logged-in user to the item's security policy. - array_push($allowed_users_and_roles['users'], $user->name); - } - - foreach ($reference->u2 as $rolelist) { - foreach (explode(';', strip_tags($rolelist->asXML())) as $role) { - array_push($allowed_users_and_roles['roles'], $role); - } - } - $custom_policy = $this->securityHelper->set_allowed_users_and_roles($custom_policy, $allowed_users_and_roles); - $custom_policy_sxe = new SimpleXMLElement($custom_policy); - $ds1->appendChild($ds1v); - $ds1v->appendChild($ds1content); - - $rootElement->appendChild($ds1); - $ds1content->appendChild($dom->importNode( dom_import_simplexml($custom_policy_sxe), TRUE)); - } -} +romeoUrlString = "http://www.sherpa.ac.uk/romeo/api24.php?issn="; + } + + /** + * Build Form ?? + * @param type $form + * @param type $ingest_form_definition + * @param type $form_values + * @return type + */ + function buildForm(&$form, $ingest_form_definition, &$form_values) { + $form['indicator2'] = array( + '#type' => 'fieldset', + '#title' => t('Ingest digital object step #2'), + ); + foreach ($ingest_form_definition->form_elements->element as $element) { + $name = strip_tags($element->name->asXML()); + $title = strip_tags($element->label->asXML()); + $required = strip_tags($element->required->asXML()); + $prefix = strip_tags($element->prefix); + $required = strtolower($required); + if ($required != 'TRUE') { + $required = '0'; + } + + $description = strip_tags($element->description->asXML()); + $type = strip_tags($element->type->asXML()); + + $form['indicator2']["$name"] = array( + '#title' => $title, + '#required' => $required, + '#description' => $description, + '#prefix' => $prefix, + '#type' => $type + ); + } + + return $form; + } + + /** + * Read the input file and generate a list of Reference items. + * + * @param array $form_values + * @param SimpleXMLElement $dom + * @return SimpleXMLElement + */ + function parse_refworks_item(&$form_values) { + + $file = $form_values['ingest-file-location']; + try { + $dom = new DOMDocument('1.0', 'UTF-8'); + $dom->substituteEntities = FALSE; + $dom->loadXML(trim(file_get_contents($file))); + $xml = simplexml_import_dom($dom); + //$xml=simplexml_load_string(trim(file_get_contents($file),NULL,TRUE)); + //$dom = dom_import_simplexml($xml);//test to see if it behaves better + //$xml = new SimpleXMLElement(trim(file_get_contents($file))); + } catch (Exception $e) { + drupal_set_message(t('Error processing Refworks file: @message', array('@message' => $e->getMessage()))); + return FALSE; + } + $this->referenceList = array(); + foreach ($xml->reference as $reference) { + array_push($this->referenceList, $reference); + } + + return $this->referenceList; + } + + /** + * Create a DC stream with ID of DC ??? + * @param type $dom + * @param type $rootElement + * @param type $reference + * @return type + */ + function createQDCStream(&$dom, &$rootElement, $reference) { + $datastream = $dom->createElement("foxml:datastream"); + $datastream->setAttribute("ID", "DC"); + $datastream->setAttribute("STATE", "A"); + $datastream->setAttribute("CONTROL_GROUP", "X"); + $version = $dom->createElement("foxml:datastreamVersion"); + $version->setAttribute("ID", "DC.0"); + $version->setAttribute("MIMETYPE", "text/xml"); + $version->setAttribute("LABEL", "DC Dublin Core Record"); + $datastream->appendChild($version); + $content = $dom->createElement("foxml:xmlContent"); + $version->appendChild($content); + ///begin writing qdc + $oai = $dom->createElement("oai_dc:dc"); + $oai->setAttribute('xmlns:oai_dc', "http://www.openarchives.org/OAI/2.0/oai_dc/"); + $oai->setAttribute('xmlns:dc', "http://purl.org/dc/elements/1.1/"); + $oai->setAttribute('xmlns:dcterms', "http://purl.org/dc/terms/"); + $oai->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); + $content->appendChild($oai); + + foreach ($reference->sr as $value) { + $element = $dom->createElement('dc:type', htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8')); + $oai->appendChild($element); + } + foreach ($reference->id as $value) { + $identifier = $value; + } + foreach ($reference->a1 as $value) { + $element = $dom->createElement('dc:creator', htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8')); + $oai->appendChild($element); + } + foreach ($reference->t1 as $value) { + // $form_values['dc:title'] = $value; + $element = $dom->createElement('dc:title', htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8')); + $oai->appendChild($element); + } + foreach ($reference->jf as $value) { + $source = $value; + } + foreach ($reference->yr as $value) { + $element = $dom->createElement('dc:date', htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8')); + $oai->appendChild($element); + } + foreach ($reference->vo as $value) { + $source .= ' Volume: ' . $value; + } + foreach ($reference->is as $value) { + $source .= ' Issue: ' . $value; + } + foreach ($reference->sp as $value) { + $source .= ' Start Page: ' . $value; + } + foreach ($reference->op as $value) { + $source .= ' Other Pages: ' . $value; + } + foreach ($reference->ul as $value) { + $source .= ' URL: ' . $value; + } + foreach ($reference->k1 as $value) { + $element = $dom->createElement('dc:subject', htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8')); + $oai->appendChild($element); + } + foreach ($reference->a2 as $value) { + $element = $dom->createElement('dc:contributor', htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8')); + $oai->appendChild($element); + } + foreach ($reference->a3 as $value) { + $element = $dom->createElement('dc:contributor', htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8')); + $oai->appendChild($element); + } + foreach ($reference->a4 as $value) { + $element = $dom->createElement('dc:contributor', htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8')); + $oai->appendChild($element); + } + foreach ($reference->a5 as $value) { + $element = $dom->createElement('dc:contributor', htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8')); + $oai->appendChild($element); + } + foreach ($reference->la as $value) { + $element = $dom->createElement('dc:language', htmlspecialchars($value, ENT_NOQUOTES, 'UTF-8')); + $oai->appendChild($element); + } + foreach ($reference->pb as $value) { + $source = 'Publisher: ' . $value; + } + foreach ($reference->pp as $value) { + $source .= ' Place of publication: ' . $value; + } + foreach ($reference->sn as $value) { + $identifier .= ' ISSN/ISBN: ' . $value; + //$this->romeoUrlString = $this->romeoUrlString . $value; + if (!$this->issn == '') { + $this->issn = $value; + } + else { + $this->issn .= ',' . $value; + } + } + foreach ($reference->ab as $value) { + $description = ' abstract: ' . $value; + } + foreach ($reference->cr as $value) { + $description .= ' Cited reference: ' . $value; + } + $element = $dom->createElement('dc:description', htmlspecialchars($description, ENT_NOQUOTES, 'UTF-8')); + $oai->appendChild($element); + $element = $dom->createElement('dc:source', htmlspecialchars($source, ENT_NOQUOTES, 'UTF-8')); + $oai->appendChild($element); + $element = $dom->createElement('dc:identifier', htmlspecialchars($identifier, ENT_NOQUOTES, 'UTF-8')); + $oai->appendChild($element); + //$rootElement->appendChild($datastream); + return $datastream; + } + + /** + * Handle Form ?? + * @param type $form_values + * @return type + */ + function handleForm(&$form_values) { + $errorMessage = NULL; + module_load_include('inc', 'fedora_repository', 'CollectionClass'); + module_load_include('inc', 'fedora_repository', 'ContentModel'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + $contentModelPid = ContentModel::getPidFromIdentifier($form_values['models']); + $contentModelDsid = ContentModel::getDSIDFromIdentifier($form_values['models']); + $collectionHelper = new CollectionClass(); + $startTime = time(); + $collection_pid = $form_values['collection_pid']; + + $this->parse_refworks_item($form_values); + + $this->securityHelper = new SecurityClass(); + + $collection_item = new Fedora_Item($collection_pid); + $this->collectionPolicyStream = $collection_item->get_datastream_dissemination('CHILD_SECURITY'); + if (empty($this->collectionPolicyStream)) { + $this->collectionPolicyStream = file_get_contents(drupal_get_path('module', 'fedora_repository') . '/policies/noObjectEditPolicy.xml'); + } + $success = 0; + $errors = 0; + foreach ($this->referenceList as $reference) { + $dom = new DomDocument("1.0", "UTF-8"); + $dom->substituteEntities = FALSE; + $dom->formatOutput = TRUE; + $pid = $collectionHelper->getNextPid($collection_pid, $contentModelDsid); + + $rootElement = $dom->createElement("foxml:digitalObject"); + $rootElement->setAttribute('VERSION', '1.1'); + $rootElement->setAttribute('PID', "$pid"); + $rootElement->setAttribute('xmlns:foxml', "info:fedora/fedora-system:def/foxml#"); + $rootElement->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance"); + $rootElement->setAttribute('xsi:schemaLocation', "info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd"); + $dom->appendChild($rootElement); + + //create standard fedora stuff + $qdc_element = $this->createQDCStream($dom, $rootElement, $reference); + if (!$qdc_element) { + drupal_set_message(t('Error creating DC for Refworks'), 'error'); + continue; + } + $item_title = ''; + foreach ($reference->t1 as $value) { + $item_title .= ' --- ' . $value; + } + $this->createStandardFedoraStuff($form_values, $dom, $rootElement, $reference); + $rootElement->appendChild($qdc_element); + //create relationships + $this->createRelationShips($form_values, $dom, $rootElement, $pid); + //create dublin core + + $this->createFedoraDataStreams($form_values, $dom, $rootElement, $reference); + + if (!empty($this->collectionPolicyStream)) { + $this->create_security_policies($dom, $rootElement, $reference); + } + + $params = array( + 'objectXML' => $dom->saveXML(), + 'format' => 'info:fedora/fedora-system:FOXML-1.1', + 'logMessage' => "Fedora Object Ingested", + ); + + try { + $soapHelper = new ConnectionHelper(); + $client = $soapHelper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/wsdl?api=API-M')); + + if ($client == NULL) { + drupal_set_message(t('Error getting SOAP client.'), 'error'); + watchdog(t("FEDORA_REPOSITORY"), "Error getting SOAP client: @e", array('@e' => $e), NULL, WATCHDOG_ERROR); + return; + } + $object = $client->__soapCall('ingest', array( + $params + )); + watchdog(t("FEDORA_REPOSITORY"), "Successfully added repository item " . $pid . " - ". $item_title, NULL, WATCHDOG_INFO); + $deleteFiles = $form_values['delete_file']; //remove files from drupal file system + + if ($deleteFiles > 0) { + unlink($form_values['fullpath']); + } + } catch (exception $e) { + $errors++; + $errorMessage = 'yes'; + watchdog(t("FEDORA_REPOSITORY"), t("Error during ingest !it @e", array('!it' => $item_title, '@e' => $e)), NULL, WATCHDOG_ERROR); + } + $success++; + } + if (isset($errorMessage)) { + drupal_set_message(t('Error ingesting one or more records! Check Drupal watchdog logs for more info'), 'error'); + } + $endTime = time(); + drupal_set_message(t('Successfull ingest of %success records. %errors records failed. Ingest took %seconds seconds', array('%success' => $success - $errors, '%errors' => $errors, '%seconds' => $endTime - $startTime)), 'info'); + } + + /** + * Creates the RELS-EXT for the foxml + * @param type $form_values + * @param type $dom + * @param type $rootElement + * @param type $pid + */ + function createRelationShips($form_values, &$dom, &$rootElement, $pid = NULL) { + $drdf = $dom->createElement("foxml:datastream"); + $drdf->setAttribute("ID", "RELS-EXT"); + $drdf->setAttribute("CONTROL_GROUP", "X"); + $dvrdf = $dom->createElement("foxml:datastreamVersion"); + $dvrdf->setAttribute("ID", "RELS-EXT.0"); + $dvrdf->setAttribute("MIMETYPE", "text/xml"); + $dvrdf->setAttribute("LABEL", "Fedora Object-to-Object Relationship Metadata"); + $dvcontent = $dom->createElement("foxml:xmlContent"); + $rdf = $dom->createElement("rdf:RDF"); + $rdf->setAttribute("xmlns:rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); + $rdf->setAttribute("xmlns:rdfs", "http://www.w3.org/2000/01/rdf-schema#"); + $rdf->setAttribute("xmlns:fedora", "info:fedora/fedora-system:def/relations-external#"); + $rdf->setAttribute("xmlns:fedora-model", "info:fedora/fedora-system:def/model#"); + $rdfdesc = $dom->createElement("rdf:description"); + $rdfdesc->setAttribute("rdf:about", "info:fedora/$pid"); + $member = $dom->createElement("fedora:isMemberOfCollection"); + $membr = $form_values['collection_pid']; + $member->setAttribute("rdf:resource", "info:fedora/$membr"); + $model = $dom->createElement("fedora-model:hasModel"); + $model->setAttribute("rdf:resource", "info:fedora/islandora:refworksCModel"); + + $drdf->appendChild($dvrdf); + $dvrdf->appendChild($dvcontent); + $dvcontent->appendChild($rdf); + $rdf->appendChild($rdfdesc); + $rdfdesc->appendChild($member); + $rdfdesc->appendChild($model); + $rootElement->appendChild($drdf); + } + + /** + * Create Romeo Datastream + * @param type $dom + * @param type $rootElement + */ + function createRomeoDataStream(&$dom, &$rootElement) { + $ds1 = $dom->createElement("foxml:datastream"); + $ds1->setAttribute("ID", "ROMEO"); + $ds1->setAttribute("STATE", "A"); + $ds1->setAttribute("CONTROL_GROUP", "E"); + $ds1v = $dom->createElement("foxml:datastreamVersion"); + $ds1v->setAttribute("ID", "ROMEO.0"); + $ds1v->setAttribute("MIMETYPE", "text/xml"); + $ds1v->setAttribute("LABEL", "ROMEO"); + $ds1content = $dom->createElement('foxml:contentLocation'); + $url = $this->romeoUrlString . $this->issn; + $this->issn = ''; //clear the issn's for next ingest in case we are doing batch + $ds1content->setAttribute("REF", "$url"); + $ds1content->setAttribute("TYPE", "URL"); + $ds1->appendChild($ds1v); + $ds1v->appendChild($ds1content); + $rootElement->appendChild($ds1); + } + + /** + * Create Fedora Datastream + * @global type $base_url + * @param type $form_values + * @param type $dom + * @param type $rootElement + * @param type $reference + */ + function createFedoraDataStreams($form_values, &$dom, &$rootElement, $reference) { + global $base_url; + module_load_include('inc', 'fedora_repository', 'MimeClass'); + $mimetype = new MimeClass(); + $server = NULL; + $this->createRomeoDataStream($dom, $rootElement); + $ds1 = $dom->createElement("foxml:datastream"); + $ds1->setAttribute("ID", "refworks"); + $ds1->setAttribute("STATE", "A"); + $ds1->setAttribute("CONTROL_GROUP", "X"); + $ds1v = $dom->createElement("foxml:datastreamVersion"); + $ds1v->setAttribute("ID", "refworks.0"); + $ds1v->setAttribute("MIMETYPE", "text/xml"); + $ds1v->setAttribute("LABEL", "Refworks datastream"); + $ds1content = $dom->createElement("foxml:xmlContent"); + + $ds1content->appendChild($dom->importNode(dom_import_simplexml($reference), TRUE)); + $ds1->appendChild($ds1v); + $ds1v->appendChild($ds1content); + $rootElement->appendChild($ds1); + + $count = 0; + } + + /** + * Creates the standard foxml properties + * @param type $form_values + * @param type $dom + * @param type $rootElement + * @param type $reference + */ + function createStandardFedoraStuff($form_values, &$dom, &$rootElement, $reference) { + // Foxml object properties section + $objproperties = $dom->createElement("foxml:objectProperties"); + $prop2 = $dom->createElement("foxml:property"); + $prop2->setAttribute("NAME", "info:fedora/fedora-system:def/model#state"); + $prop2->setAttribute("VALUE", "A"); + $prop3 = $dom->createElement("foxml:property"); + $prop3->setAttribute("NAME", "info:fedora/fedora-system:def/model#label"); + $label = $reference->t1; + if (strlen($label) > 254) { + $label = substr($label, 0, 245); + } + $prop3->setAttribute("VALUE", $label); + $prop5 = $dom->createElement("foxml:property"); + $prop5->setAttribute("NAME", "info:fedora/fedora-system:def/model#ownerId"); + $prop5->setAttribute("VALUE", $form_values['user_id']); + $objproperties->appendChild($prop2); + $objproperties->appendChild($prop3); + $objproperties->appendChild($prop5); + $rootElement->appendChild($objproperties); + } + + /** + * Read the list of Users from the U1 field and Roles from the U2 field and add elements + * to the security policy record for this item, then add the record as the security policy datastream. + * + * @param array $form_values + * @param DOMDocument $dom + * @param $rootElement + * @param SimpleXMLElement $reference + */ + function create_security_policies($dom, &$rootElement, $reference) { + global $user; + $ds1 = $dom->createElement("foxml:datastream"); + $ds1->setAttribute("ID", "POLICY"); + $ds1->setAttribute("STATE", "A"); + $ds1->setAttribute("CONTROL_GROUP", "X"); + $ds1v = $dom->createElement("foxml:datastreamVersion"); + $ds1v->setAttribute("ID", "POLICY.0"); + $ds1v->setAttribute("MIMETYPE", "text/xml"); + $ds1v->setAttribute("LABEL", "POLICY Record"); + $ds1content = $dom->createElement("foxml:xmlContent"); + + $custom_policy = $this->collectionPolicyStream; + $allowed_users_and_roles = array(); + $allowed_users_and_roles['users'] = array(); + $allowed_users_and_roles['roles'] = array(); + foreach ($reference->u1 as $namelist) { + foreach (explode(';', strip_tags($namelist->asXML())) as $name) { + array_push($allowed_users_and_roles['users'], $name); + } + } + if (empty($reference->u1)) { + // If no "u1" value exists, add the currently logged-in user to the item's security policy. + array_push($allowed_users_and_roles['users'], $user->name); + } + + foreach ($reference->u2 as $rolelist) { + foreach (explode(';', strip_tags($rolelist->asXML())) as $role) { + array_push($allowed_users_and_roles['roles'], $role); + } + } + $custom_policy = $this->securityHelper->set_allowed_users_and_roles($custom_policy, $allowed_users_and_roles); + $custom_policy_sxe = new SimpleXMLElement($custom_policy); + $ds1->appendChild($ds1v); + $ds1v->appendChild($ds1content); + + $rootElement->appendChild($ds1); + $ds1content->appendChild($dom->importNode(dom_import_simplexml($custom_policy_sxe), TRUE)); + } + +} diff --git a/plugins/ShowDemoStreamsInFieldSets.inc b/plugins/ShowDemoStreamsInFieldSets.inc index dd81410f..9d210d2a 100644 --- a/plugins/ShowDemoStreamsInFieldSets.inc +++ b/plugins/ShowDemoStreamsInFieldSets.inc @@ -1,25 +1,40 @@ -pid = $pid; - } - - function showMediumSize() { - global $base_url; - $collection_fieldset = array( - '#collapsible' => FALSE, - '#value' => '', - ); - return theme('fieldset', $collection_fieldset); - } -} +pid = $pid; + } + + /** + * Show Medium Size ?? + * @global type $base_url + * @return type + */ + function showMediumSize() { + $path = "fedora/repository/{$this->pid}/MEDIUM_SIZE"; + $collection_fieldset = array( + '#collapsible' => FALSE, + '#value' => l(theme('image', $path), $path, array('html' => TRUE)), + ); + return theme('fieldset', $collection_fieldset); + } + +} diff --git a/plugins/ShowStreamsInFieldSets.inc b/plugins/ShowStreamsInFieldSets.inc index d0860ab2..0bbf9403 100644 --- a/plugins/ShowStreamsInFieldSets.inc +++ b/plugins/ShowStreamsInFieldSets.inc @@ -1,27 +1,49 @@ pid = $pid; } + /** + * Show the FLV ?? + * @return type + */ function showFlv() { //FLV is the datastream id $path = drupal_get_path('module', 'Fedora_Repository'); - $fullPath = base_path() . $path; + $fullPath = url($path); $content = ""; $pathTojs = drupal_get_path('module', 'Fedora_Repository') . '/js/swfobject.js'; drupal_add_js("$pathTojs"); - $content .= '
    Get the Flash Player to see this player.
    '; - drupal_add_js('var s1 = new SWFObject("'. $fullPath . '/flash/flvplayer.swf","single","320","240","7"); - s1.addParam("allowfullscreen","TRUE"); - s1.addVariable("file","'. base_path() . 'fedora/repository/'. $this->pid . '/FLV/FLV.flv"); - s1.write("player'. $this->pid . 'FLV");', 'inline', 'footer'); + $div_id = "player' . $this->pid . 'FLV"; + $content .= <<Get the Flash Player to see this player. +EOH; + drupal_add_js(<<pid}/FLV/FLV.flv"); +s1.write("$div_id"); +EOJS +, 'inline', 'footer'); $collection_fieldset = array( '#title' => t('Flash Video'), '#collapsible' => TRUE, @@ -30,30 +52,38 @@ class ShowStreamsInFieldSets { return theme('fieldset', $collection_fieldset); } + /** + * Show the TN ?? + * @return type + */ function showTN() { - global $base_url; $collection_fieldset = array( '#title' => '', '#attributes' => array(), '#collapsible' => FALSE, - '#value' => '', + '#value' => l(theme('image', "fedora/repository/{$this->pid}/TN/TN", '', '', NULL, FALSE), "fedora/repository/{$this->pid}/OBJ", array('html' => TRUE)), ); return theme('fieldset', $collection_fieldset); } - - // Same as showTN but artinventory stores the image in a dsid of IMAGE instead of OBJ + /** + * Same as showTN but artinventory stores the image in a dsid of IMAGE instead of OBJ + * @return type + */ function showArtInventoryTN() { - global $base_url; $collection_fieldset = array( '#collapsible' => FALSE, - '#value' => '', + '#value' => l(theme('image', "fedora/repository/{$this->pid}/TN/TN", '', '', NULL, FALSE), "fedora/repository/{$this->pid}/IMAGE/image.jpg", array('html' => TRUE)), ); return theme('fieldset', $collection_fieldset); } /** * Embed Google Docs' PDF viewer into the page. + * @global type $base_url + * @global type $base_path + * @global type $user + * @return type */ function showPDFPreview() { global $base_url; @@ -74,21 +104,23 @@ class ShowStreamsInFieldSets { $objectHelper = new ObjectHelper(); $item = new Fedora_Item($this->pid); if (key_exists('TN', $item->datastreams)) { - $tn_url = $base_url.'/fedora/repository/'.$item->pid.'/TN'; + $tn_url = "fedora/repository/{$item->pid}/TN"; } else { - $tn_url = $base_path.drupal_get_path('module', 'fedora_repository').'/images/Crystal_Clear_app_download_manager.png'; + $tn_url = drupal_get_path('module', 'fedora_repository') . '/images/Crystal_Clear_app_download_manager.png'; } - $dc_html = $objectHelper->getFormattedDC($item); - - $dl_link = l('

    View Document
    ', 'fedora/repository/'.$this->pid.'/OBJ', array('html' => TRUE)); + $tn_url = url($tn_url); + $dc_html = $objectHelper->getFormattedDC($item); + + $dl_link = l('
    ' . theme('image', $tn_url, '', '', NULL, FALSE) . '
    ' . t('View Document') .'
    ', "fedora/repository/{$this->pid}/OBJ", array('html' => TRUE)); + $tabset['first_tab']['tabs']['view'] = array( '#type' => 'tabpage', '#title' => t('View'), '#content' => $dl_link . $dc_html, ); - + if (fedora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $this->pid, $user)) { $editform = drupal_get_form('fedora_repository_edit_qdc_form', $this->pid, 'DC'); $tabset['first_tab']['tabs']['edit'] = array( @@ -97,23 +129,28 @@ class ShowStreamsInFieldSets { '#content' => $editform, ); } - + + $viewer_url = 'http://docs.google.com/viewer?url=' . url("fedora/repository/{$this->pid}/OBJ/preview.pdf", array('absolute' => TRUE)) . '&embedded=TRUE'; $tabset['second_tab'] = array( '#type' => 'tabpage', '#title' => t('Read Online'), - '#content' => "" + '#content' => <<" +EOM ); // Render the tabset. return $tabset; } - + /** + * Show QDC ?? + * @return type + */ function showQdc() { module_load_include('inc', 'fedora_repository', 'ObjectHelper'); $objectHelper = new ObjectHelper(); - $content=$objectHelper->getQDC($this->pid); + $content = $objectHelper->getQDC($this->pid); $collection_fieldset = array( '#title' => t('Description'), '#collapsible' => TRUE, @@ -123,30 +160,36 @@ class ShowStreamsInFieldSets { return theme('fieldset', $collection_fieldset); } + /** + * Show Object Link ?? + * @global type $base_url + * @return type + */ function showOBJLink() { global $base_url; module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $item = new Fedora_Item($this->pid); $streams = $item->get_datastreams_list_as_array(); - return "". $streams['OBJ']['label'] .""; + return l($streams['OBJ']['label'], "fedora/repository/{$this->pid}/OBJ"); } - - + /** + * Show REF works ?? + * @return type + */ function showRefworks() { - $path=drupal_get_path('module', 'fedora_repository'); + $path = drupal_get_path('module', 'fedora_repository'); module_load_include('inc', 'fedora_repository', 'ObjectHelper'); $collectionHelper = new CollectionClass(); - $xmlstr=$collectionHelper->getStream($this->pid, "refworks"); + $xmlstr = $collectionHelper->getStream($this->pid, "refworks"); html_entity_decode($xmlstr); if ($xmlstr == NULL || strlen($xmlstr) < 5) { return " "; } try { $proc = new XsltProcessor(); - } - catch (Exception $e) { - drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error'); + } catch (Exception $e) { + drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))), 'error'); return " "; } $xsl = new DomDocument(); @@ -165,9 +208,14 @@ class ShowStreamsInFieldSets { return theme('fieldset', $collection_fieldset); } + /** + * Show JP2000 + * @param type $collapsed + * @return type + */ function showJP2($collapsed = FALSE) { - $viewer_url = variable_get('fedora_base_url', '') . '/get/'. $this->pid . '/ilives:viewerSdef/getViewer'; - $html = ''; + $viewer_url = variable_get('fedora_base_url', '') . '/get/' . $this->pid . '/ilives:viewerSdef/getViewer'; + $html = ''; $fieldset = array( '#title' => t('Viewer'), '#collapsible' => TRUE, @@ -177,6 +225,11 @@ class ShowStreamsInFieldSets { return theme('fieldset', $fieldset); } + /** + * Show Romeo ?? + * @param type $collapsed + * @return type + */ function showRomeo($collapsed = FALSE) { $path = drupal_get_path('module', 'Fedora_Repository'); module_load_include('inc', 'fedora_repository', 'CollectionClass'); @@ -189,9 +242,8 @@ class ShowStreamsInFieldSets { try { $proc = new XsltProcessor(); - } - catch (Exception $e) { - drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error'); + } catch (Exception $e) { + drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))), 'error'); return; } $xsl = new DomDocument(); @@ -210,4 +262,5 @@ class ShowStreamsInFieldSets { ); return theme('fieldset', $collection_fieldset); } + } diff --git a/plugins/fedoraObject.inc b/plugins/fedoraObject.inc deleted file mode 100644 index 198698e9..00000000 --- a/plugins/fedoraObject.inc +++ /dev/null @@ -1,50 +0,0 @@ -pid = $pid; - $this->item = new Fedora_Item($pid); - } - } - - public function showFieldSets() { - global $user; - $objectHelper = new ObjectHelper(); - $tabset = array(); - $show_purge_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'fedora_repository_purge_object_form'); - $purge_form = drupal_get_form('fedora_repository_purge_object_form', $this->pid, check_plain(substr(request_uri(), strlen(base_path())))); - - $tabset['fedora_object_details'] = array( - '#type' => 'tabpage', - '#title' => t('Object Details'), - '#selected' => $show_purge_tab, - ); - $tabset['fedora_object_details']['tabset'] = array( - '#type' => 'tabset', - ); - $dc_html = $objectHelper->getFormattedDC($this->item); - - $ds_list = $objectHelper->get_formatted_datastream_list($this->pid, NULL, $this->item); - - - $tabset['fedora_object_details']['tabset']['view'] = array( - '#type' => 'tabpage', - '#title' => t('View'), - '#content' => $dc_html . $ds_list . $purge_form, - ); - - if (fedora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $this->pid, $user)) { - $editform = drupal_get_form('fedora_repository_edit_qdc_form', $this->pid, 'DC'); - $tabset['fedora_object_details']['tabset']['edit'] = array( - '#type' => 'tabpage', - '#title' => t('Edit'), - '#content' => $editform, - ); - } - - return $tabset; - } -} \ No newline at end of file diff --git a/plugins/fedora_attach/fedora_attach.admin.inc b/plugins/fedora_attach/fedora_attach.admin.inc deleted file mode 100644 index 30c378af..00000000 --- a/plugins/fedora_attach/fedora_attach.admin.inc +++ /dev/null @@ -1,36 +0,0 @@ - 'select', - '#title' => t('Fedora Attach PID namespace'), - '#options' => $options, - '#default_value' => $default_value, - '#description' => t('The PID namespace into which the Fedora Attach module will ingest objects.'), - ); - return (system_settings_form($form)); -} - diff --git a/plugins/fedora_attach/fedora_attach.info b/plugins/fedora_attach/fedora_attach.info deleted file mode 100644 index fc1c2aa7..00000000 --- a/plugins/fedora_attach/fedora_attach.info +++ /dev/null @@ -1,8 +0,0 @@ -; $Id$ -name = Fedora Attach -description = Allows users to attach files to node content which then get ingested into Fedora. -package = Fedora Repository -dependencies[] = fedora_repository -dependencies[] = upload -version = 6.1dev -core = 6.x diff --git a/plugins/fedora_attach/fedora_attach.install b/plugins/fedora_attach/fedora_attach.install deleted file mode 100644 index 45aeda5e..00000000 --- a/plugins/fedora_attach/fedora_attach.install +++ /dev/null @@ -1,14 +0,0 @@ -files)) { - foreach ($node->files as $fid => $file) { - $file = (object) $file; // Convert file to object type for compatibility. - $fid = $file->fid; // For the cases where we have temp fid for uplaoded files. - $success = FALSE; - $filepath = $file->filepath; // Need copy if file_move fails. - $public = file_directory_path(); - - $file_is_ingested = _fedora_attach_is_file_in_repository($filepath); - if (!empty($file->ingested) && !$file_is_ingested) { - // Attach flag is set, but file is not listed as being in the repository. - // so try and ingest it now. - if (user_access('select file access by role')) { - $roles = array(); - if (!empty($file->roles)) { - foreach ($file->roles as $rolename => $rolevalue) { - if (!empty($rolevalue)) { - array_push($roles, $rolevalue); - } - } - } - // if (!empty($roles)) { - // Generate the security policy datastream. - $policy_stream = _fedora_attach_create_policy($roles); - // } - } - try { - $pid_namespace = variable_get('fedora_attach_pid_namespace','default:'); - $pid_namespace = substr($pid_namespace, 0, strpos($pid_namespace, ":")); - $pid = fedora_item::get_next_PID_in_namespace( $pid_namespace ); - $new_item = fedora_item::ingest_new_item($pid, 'A', $file->description); // PID will be generated using getNextPID - if (empty($new_item->objectProfile)) { - drupal_set_message("Unable to create fedora object. Check Watchdog log for details.", "error"); - $success = FALSE; - } - else { - if (user_access('select file access by role')) { - $new_item->add_datastream_from_string($policy_stream, 'POLICY', "Security Policy", "text/xml", "X"); - } - $new_item->add_datastream_from_file($file->filepath, 'OBJ', $file->filename, $file->filemime, 'M'); - $new_item->add_relationship("hasModel","islandora:genericCModel",FEDORA_MODEL_URI); - module_load_include('inc', 'fedora_repository', 'api/dublin_core'); - $dc = new Dublin_Core(); - $dc->add_element('dc:title', $file->description); - $dc->add_element('dc:identifier', $new_item->pid); - - $new_item->modify_datastream_by_value($dc->as_xml(), 'DC', 'Default Dublin Core Metadata', 'text/xml', 'X'); - - $success = TRUE; - } - } - catch (exception $e) { - drupal_set_message(t('An error occurred ingesting the file: ') . $e, 'error'); - $new_item->purge(); - drupal_set_message(t('The item has been removed from the repository')); - } - if ($success) { // We were able to ingest the file, so update the file path. - $new_filepath = '/fedora/repository/'. $new_item->pid . '/OBJ/'. $file->description; - _fedora_attach_update_filepath($new_filepath, $fid); - file_delete($filepath); - } - } - // Convert file to object for compatibility - - // Remove file. Process removals first since no further processing - // will be required. - if (!empty($file->remove)) { - - // If the file isn't used by any other revisions warn the user. - $count = db_result(db_query('SELECT COUNT(fid) FROM {upload} WHERE fid = %d', $fid)); - if ($count < 1) { - file_delete($file->filepath); - db_query('DELETE FROM {files} WHERE fid = %d', $fid); - } - - // Remove it from the session in the case of new uploads, - // that you want to disassociate before node submission. - unset($node->files[$fid]); - // Move on, so the removed file won't be added to new revisions. - continue; - } - - } - } - } - break; - case 'view': - // ****************************************************** - // *** VIEW - // Re-theme the file attachments table. - - // Rebuild the files table and overwrite default. - // Using the rules from upload.module. - if (isset($node->files) && count($node->files) && user_access('view uploaded files') && !$teaser) { - $node->content['files']['#value'] = theme('fedora_attach_attachments', $node->files); - } - break; - } -} - -/** - *Implementation of hook_menu(). - */ -function fedora_attach_menu() { - $items['admin/settings/fedora_repository/attach'] = array( - 'title' => 'Fedora Attach', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('fedora_attach_admin'), - 'access arguments' => array('administer site configuration'), - 'type' => MENU_LOCAL_TASK, - 'file' => 'fedora_attach.admin.inc', - ); - return $items; -} - - -function fedora_attach_save(&$node) { - print ("FNARF!"); -} - -/** - * Implements hook_form_alter() - * - * Add a 'add to repository' checkbox to the file attach form. - * - * @param unknown_type $form - * @param unknown_type $form_state - * @param unknown_type $form_id - * Two paths, one for normal submit, one for JavaScript - */ -function fedora_attach_form_alter(&$form, $form_state, $form_id) { - $disabled = TRUE; - global $base_url; - if (isset($form['type'])) { - $node = $form['#node']; - if ($form['type']['#value'] . '_node_form' == $form_id && variable_get("upload_$node->type", TRUE)) { - $form['#submit'][] = 'fedora_attach_form_submit'; - if (!empty($node->files) && is_array($node->files) && count($node->files)) { // Hijack theme function. - $form['attachments']['wrapper']['files']['#theme'] = 'fedora_attach_form'; - $form['#validate']['private_upload_form_validate'] = array(); - foreach ($node->files as $fid => $file) { - - // Add ingest checkbox - if (is_array($file) && isset($file['ingest'])) { // Preview - $default_value = $file['ingest']; - } - else { // Node load - $default_value = _fedora_attach_is_file_in_repository($file->filepath); - $disabled = $default_value; - } - - $form['attachments']['wrapper']['files'][$fid]['ingested'] = array( - '#type' => 'checkbox', - '#default_value' => $default_value, - '#disabled' => $disabled, - ); - $form['attachments']['wrapper']['files'][$fid]['description']['#description'] = $base_url.$file->filepath; - } - if (user_access('select file access by role')) { - _fedora_attach_build_roles_form($form, FALSE); - } - } - } - } - elseif ($form_id == 'upload_js') { - $form['files']['#theme'] = 'fedora_attach_form'; - - foreach ($form['files'] as $fid => $file) { - - if (!_fedora_attach_starts_with($fid, '#')) {// Ignore properties. - if (!empty($_POST['files'][$fid])) { - $ingested = (!empty($_POST['files'][$fid]['ingested']) ? $_POST['files'][$fid]['ingested'] : FALSE); - //$form['files'][$fid]['list']['#default_value'] = (!empty($_POST['files'][$fid]['[$_POST['files'][$fid]['list']; - //$form['files'][$fid]['remove']['#default_value'] = $_POST['files'][$fid]['remove']; - } - else { - $ingested = (variable_get('fedora_attach_default', 'ingested') == 'ingested'); - } - $form['files'][$fid]['ingested'] = array( - '#type' => 'checkbox', - '#default_value' => $ingested, - ); - - $form['attachments']['wrapper']['files'][$fid]['description']['#description'] = $base_url.$file['filepath']; - if (user_access('select file access by role')) { - _fedora_attach_build_roles_form($form, TRUE); - } - } - } - } -} - -/** - * Called to validate the attach form. - * - * @param string $formid - * @param array $form_values - */ -function fedora_attach_form_validate($formid, $form_values) { - if (is_array($form_values['files']) && count($form_values['files'])) { - $file = array_shift($form_values['files']); - if (!isset($file['ingested'])) { - drupal_set_message(t('Fedora Attach cannot find add repository settings.'), 'error'); - // Be sure we are going after core upload module - $upload_weight = (int)db_result(db_query("SELECT weight FROM {system} WHERE name = 'upload'")); - $attach_weight = (int)db_result(db_query("SELECT weight FROM {system} WHERE name = 'fedora_attach'")); - if ($attach_weight <= $uplaod_weight) { - $new_weight = $upload_weight + 1; - drupal_set_message(t('Adjusting Fedora Attach module\'s weight to') . $new_weight, 'warning'); - db_query("UPDATE {system} SET weight = '%d' WHERE name = 'fedora_attach'", $new_weight);; - } - else { - drupal_set_message(t('Please check for modules that conflict with Fedora Attach'), 'error'); - } - } - } -} - -/** - * Fixes edge case: When the node is first being created, the file->private info does not - * get moved automatically into the node. So we need to copy it by hand. - * - * @param array $form - * @param array $form_state - */ -function fedora_attach_form_submit($form, &$form_state) { - global $base_url; - if ($form_state['values'] && $form_state['values']['files']) { - - foreach ($form_state['values']['files'] as $fid => $file) { - if ($file['remove'] && !empty($file['ingested']) && $file['ingested']) { - drupal_set_message("The attachment ${file['filename']} was removed from this node but it will remain in the repository until it is purged it directly."); - } - if (!isset($file->ingested)) { // Newly-inserted file. - if (isset($form['attachments']['wrapper']['files'])) { - // I know it is naughty to look at the $_POST, but I can't find this value anywhere else. - // Seems like it should be in $form_state somewhere. - $ingested = !empty($_POST['files'][$fid]['ingested']); - } - else { - $ingested = (variable_get('fedora_attach_ingested', 'ingested') == 'ingested'); // Submit before attach - } - $form_state['values']['files'][$fid]['ingested'] = $ingested; - } - $form_state['values']['files'][$fid]['roles'] = (!empty($_POST['files']['roles']) ? $_POST['files']['roles'] : array()); - } - } -} - -// ***************************************************************************** -// Theme functions *********************************************************** -// ***************************************************************************** - -/** - * hook_theme = Theme registry - * - * @return array - */ -function fedora_attach_theme() { - return array( - 'fedora_attach_form' => array( - 'arguments' => array('form' => NULL), - ), - 'fedora_attach_attachments' => array( - 'arguments' => array('files' => NULL), - ), - ); -} - -/** - * Based on theme_upload_form_current - * Adds the Ingest checkbox. - * - * @param array $form - */ -function theme_fedora_attach_form(&$form) { - $header = array(t('Delete'), t('List'), t('Add to Repository'), t('Label'), t('Weight'), t('Size'), ''); - drupal_add_tabledrag('upload-attachments', 'order', 'sibling', 'upload-weight'); - - foreach (element_children($form) as $key) { - // Add class to group weight fields for drag and drop. - $form[$key]['weight']['#attributes']['class'] = 'upload-weight'; - - $row = array(); - $row[] = drupal_render($form[$key]['remove']); - $row[] = drupal_render($form[$key]['list']); - $row[] = drupal_render($form[$key]['ingested']); - $row[] = drupal_render($form[$key]['description']); - $row[] = drupal_render($form[$key]['weight']); - $row[] = drupal_render($form[$key]['size']); - $row[] = drupal_render($form[$key]['msg']); - $rows[] = array('data' => $row, 'class' => 'draggable'); - } - $output = theme('table', $header, $rows, array('id' => 'upload-attachments')); - $output .= drupal_render($form); - return $output; -} - -/** - * Displays file attachments in table. - * - * @param array $files - */ -function theme_fedora_attach_attachments($files) { - $header = array(t('Attachment'), t('Size')); - $rows = array(); - if (is_array($files)) { - foreach ($files as $file) { - $file = (object) $file; - if ($file->list && empty($file->remove)) { - $inspect_item = ''; - if (_fedora_attach_is_file_in_repository($file->filepath)) { - $inspect_item = ' '. theme_image(drupal_get_path('module', 'Fedora_Repository') . '/images/view.gif', '', 'View the item\'s repository page' ) . ''; - } - $href = _fedora_attach_create_url($file); // this is the changed line - $text = $file->description ? $file->description : $file->filename; - $rows[] = array(l($text, $href) . $inspect_item, format_size($file->filesize)); - } - } - if (count($rows)) { - return theme('table', $header, $rows, array('id' => 'attachments')); - } - } -} - -function _fedora_attach_build_roles_form(&$form, $inside_js = FALSE) { - //$result = db_query("SELECT {name} from {role}"); - global $user; - //while ($role = db_fetch_array($result)) { - foreach ($user->roles as $role) { - if ($role != 'anonymous user') { - $roles[] = $role; - } - } - if (empty($roles)) { - return ''; - } - $new_form_elements = array( - '#type' => 'checkboxes', - '#title' => t('Roles which can view the attached items'), - '#options' => array_combine($roles, $roles), - '#description' => t('This only applies to files which you add to the repository. If no roles are checked the item will be public.'), - ); - - if ($inside_js) { - $form['files']['roles'] = $new_form_elements; - } - else { - $form['attachments']['wrapper']['roles'] = $new_form_elements; - } -// var_dump($form['files']); - //return $output; -} - -function _fedora_attach_create_policy($roles) { - $policy_filename = !empty($roles) ? drupal_get_path('module', 'fedora_repository') . '/policies/viewANDeditbyrole.xml' - : drupal_get_path('module', 'fedora_repository') . '/policies/noObjectEditPolicy.xml'; - $policy_document = new DOMDocument(); - $policy_document->load($policy_filename); - $designators = $policy_document->getElementsByTagName("SubjectAttributeDesignator"); - - if (!empty($designators)) { - foreach ($designators as $designator) { - if ($designator->hasAttribute("AttributeId")) { - if ($designator->getAttribute('AttributeId') == 'fedoraRole') { - foreach ($roles as $role) { - //$apply = $designator->nextSibling; - foreach ($designator->parentNode->childNodes as $apply) { - if ($apply->nodeName == "Apply") { - $new_role_node = $policy_document->createElement('AttributeValue', $role); - $new_role_node->setAttribute('DataType', 'http://www.w3.org/2001/XMLSchema#string'); - $apply->appendChild($new_role_node); - } - } - } - } - elseif ($designator->getAttribute('AttributeId') == 'urn:fedora:names:fedora:2.1:subject:loginId') { - // $apply = $designator->nextSibling; - foreach ($designator->parentNode->childNodes as $apply) { - if ($apply->nodeName == "Apply") { - global $user; - $new_user_node = $policy_document->createElement('AttributeValue', $user->name); - $new_user_node->setAttribute('DataType', 'http://www.w3.org/2001/XMLSchema#string'); - $apply->appendChild($new_user_node); - } - } - } - } - } - } - return $policy_document->saveXML(); -} - -function fedora_attach_file_download($filepath) { - // Pass through if this isn't a repository item. - if (!strstr($filepath, 'fedora/repository')) { - return; - } - $result = db_query("SELECT DISTINCT(u.nid) FROM {upload} u INNER JOIN {files} f ON u.fid = f.fid ". - "WHERE f.filepath LIKE '%s'", $filepath.'%'); - $has_results = FALSE; - while($row = db_fetch_array($result)) { - $has_results = TRUE; - $node = node_load($row['nid']); - if (node_access('view', $node)) { - return; // Access is ok as far as we are concerned. - } - } - if ($has_results) { - return -1; - } - else { - return; - } -} - -/** - * Create a URL to a file that changes if the file is in the repository. - * - * @param file object $file - * @return str: the correct URL - */ -function _fedora_attach_create_url($file) { - if ( _fedora_attach_is_file_in_repository( $file->filepath)) { - $href = $GLOBALS['base_url'] . $file->filepath; - } - else { - $href = file_create_url((strpos($file->fid, 'upload') === FALSE ? $file->filepath : file_create_filename($file->filename, file_create_path()))); - } - return $href; -} - -/** - * Checks if the file path references a file in the repository. - * - * @param string $filepath - * @return boolean - */ -function _fedora_attach_is_file_in_repository($filepath) { - $repository_path = '/fedora/repository'; - $is_in = _fedora_attach_starts_with($filepath, $repository_path); - return $is_in; -} - -function _fedora_attach_starts_with($str, $start) { - if (count($str) == 0) { // Avoid FALSE positives. - return FALSE; - } - return strstr($str, $start) == $str; -} - -/** - * Alters the file's path in the files table to point to the repository datastream. - * - * @param string $filepath - * @param int $fid - */ -function _fedora_attach_update_filepath( $filepath, $fid ) { - db_query("UPDATE {files} SET filepath = '%s' WHERE fid=%d", $filepath, $fid); -} diff --git a/plugins/fedora_imageapi.info b/plugins/fedora_imageapi.info index a83ef4e6..cbd6b2ae 100644 --- a/plugins/fedora_imageapi.info +++ b/plugins/fedora_imageapi.info @@ -1,8 +1,7 @@ -; $Id$ name = Fedora ImageAPI description = Adds image manipulation support through a REST interface -package = Fedora Repository +package = Islandora Dependencies dependencies[] = fedora_repository dependencies[] = imageapi -version = 6.1dev +version = 6.x-dev core = 6.x diff --git a/plugins/fedora_imageapi.module b/plugins/fedora_imageapi.module index 3f0a4a99..f3bd4481 100644 --- a/plugins/fedora_imageapi.module +++ b/plugins/fedora_imageapi.module @@ -1,5 +1,6 @@ getMimeType( $pid, $dsid); - $ext = substr( strstr($mimetype, '/'), 1); + $mimetype = $obj->getMimeType($pid, $dsid); + $ext = substr(strstr($mimetype, '/'), 1); $op = (!empty($_GET['op']) ? $_GET['op'] : ''); $safe_pid = str_replace(':', '_', $pid); - - $cache_key = 'fedora_repository_image_manip_'.md5($safe_pid.'_'.$dsid.'_'.$ext.'_'.$op.(isset($_GET['width'])?'_'.$_GET['width']:'').(isset($_GET['height'])?'_'.$_GET['height']:'')); - if (($file=cache_get($cache_key))===0) - { + + $cache_key = 'fedora_repository_image_manip_' . md5($safe_pid . '_' . $dsid . '_' . $ext . '_' . $op . (isset($_GET['width']) ? '_' . $_GET['width'] : '') . (isset($_GET['height']) ? '_' . $_GET['height'] : '')); + if (($file = cache_get($cache_key)) === 0) { //added the slash as sys_get_temp_dir in linux does not seem to include the slash - $tmp_file_name = sys_get_temp_dir() .'/'. $safe_pid . '_'. $dsid . '.'. $ext; - $handle = fopen( $tmp_file_name, "w"); + $tmp_file_name = sys_get_temp_dir() . '/' . $safe_pid . '_' . $dsid . '.' . $ext; + $handle = fopen($tmp_file_name, "w"); $numbytes = fwrite($handle, $obj->getStream($pid, $dsid)); fclose($handle); if ($numbytes == 0) { return; } - - - $image = imageapi_image_open( $tmp_file_name); - + + + $image = imageapi_image_open($tmp_file_name); + switch ($op) { case 'scale': - if (!empty( $_GET['height'] ) || !empty( $_GET['width'])) { - imageapi_image_scale($image, $_GET['width'], $_GET['height']); - } - case 'centerscale': - if (!empty($_GET['height']) && !empty($_GET['width'])) { - imageapi_image_scale_and_crop($image, $_GET['width'], $_GET['height']); - - } + if (!empty($_GET['height']) || !empty($_GET['width'])) { + imageapi_image_scale($image, $_GET['width'], $_GET['height']); + } + case 'centerscale': + if (!empty($_GET['height']) && !empty($_GET['width'])) { + imageapi_image_scale_and_crop($image, $_GET['width'], $_GET['height']); + } } imageapi_image_close($image); $file = file_get_contents($tmp_file_name); - cache_set($cache_key,$file,'cache',time()+variable_get('fedora_image_blocks_cache_time',3600)); + cache_set($cache_key, $file, 'cache', time() + variable_get('fedora_image_blocks_cache_time', 3600)); file_delete($tmp_file_name); - } else { + } + else { $file = $file->data; } - + header("Content-type: $mimetype"); - header('Content-Disposition: attachment; filename="'. $dsid . '.'. $ext . '"'); + header('Content-Disposition: attachment; filename="' . $dsid . '.' . $ext . '"'); echo $file; - - + + // return "$numbytes bytes written to ".sys_get_temp_dir()."$pid_$dsid.$ext\n"; } @@ -79,38 +79,38 @@ function fedora_repository_image_manip($pid = '', $dsid = '', $op = '', $params * @param unknown_type $form_state * @param unknown_type $form_id */ - /* -function fedora_imageapi_form_alter( &$form, $form_state, $form_id) { - +/* + function fedora_imageapi_form_alter( &$form, $form_state, $form_id) { + switch ( $form_id ) { - case 'fedora_repository_admin': - - $fedora_base_url = $form['fedora_base_url']['#default_value']; - - $fedora_server_url = substr($fedora_base_url,0,strpos($fedora_base_url,'/',7)); - // Add the Djatoka server location. Set it to default to the same server as fedora. - $form['djatoka_server_url'] = array ( - '#type' => 'textfield', - '#title' => '

    '.t('Fedora Image API Module').'


    '.t('aDORe Djatoka image server resolver URL'), - '#default_value' => variable_get('djatoka_server_url', $fedora_server_url.'/adore-djatoka/resolver' ), - '#description' => t('The location of your aDORe Djatoka image server, if you have one installed.'), - '#weight' => 1, - ); - $form['openlayers_server_url'] = array( - '#type' => 'textfield', - '#title' => t('OpenLayers servlet URL'), - '#default_value' => variable_get('openlayers_server_url', $fedora_server_url.'/islandora/OpenLayers'), - '#description' => t('URL of your installation of the OpenLayers servlet, if you have one.'), - '#weight' => 1, - ); - $form['buttons']['#weight'] = 2; - break; + case 'fedora_repository_admin': + + $fedora_base_url = $form['fedora_base_url']['#default_value']; + + $fedora_server_url = substr($fedora_base_url,0,strpos($fedora_base_url,'/',7)); + // Add the Djatoka server location. Set it to default to the same server as fedora. + $form['djatoka_server_url'] = array ( + '#type' => 'textfield', + '#title' => '

    '.t('Fedora Image API Module').'


    '.t('aDORe Djatoka image server resolver URL'), + '#default_value' => variable_get('djatoka_server_url', $fedora_server_url.'/adore-djatoka/resolver' ), + '#description' => t('The location of your aDORe Djatoka image server, if you have one installed.'), + '#weight' => 1, + ); + $form['openlayers_server_url'] = array( + '#type' => 'textfield', + '#title' => t('OpenLayers servlet URL'), + '#default_value' => variable_get('openlayers_server_url', $fedora_server_url.'/islandora/OpenLayers'), + '#description' => t('URL of your installation of the OpenLayers servlet, if you have one.'), + '#weight' => 1, + ); + $form['buttons']['#weight'] = 2; + break; + } } -} -function show_openlayers_viewer() { + function show_openlayers_viewer() { $output = 'Hi.'; - + return $output; -} -*/ + } + */ diff --git a/plugins/herbarium.inc b/plugins/herbarium.inc index 3af6f8bd..0ad13fd6 100644 --- a/plugins/herbarium.inc +++ b/plugins/herbarium.inc @@ -1,9 +1,21 @@ pid = $pid; @@ -11,15 +23,26 @@ class Herbarium { } } + /** + * Build a drupal form ?? + * @param type $form + * @param type $form_state + * @return type + */ public function buildDrupalForm($form = array(), $form_state = array()) { // We don't need to add anything beyond the standard Darwin Core form so just pass this through // If we wanted to we could add other fields. module_load_include('inc', 'fedora_repository', 'plugins/DarwinCore'); - + $dwc = new DarwinCore($this->item); return $dwc->buildDrupalForm($form); } + /** + * Build edit metadata form + * @param type $form + * @return type + */ public function buildEditMetadataForm($form = array()) { $form['submit'] = array( '#type' => 'submit', @@ -34,10 +57,17 @@ class Herbarium { '#type' => 'hidden', '#value' => "DARWIN_CORE", ); - + return $this->buildDrupalForm($form); } + /** + * handle edit metadata form ?? + * @global type $user + * @param type $form_id + * @param type $form_values + * @return type + */ public function handleEditMetadataForm($form_id, $form_values) { /* * Process the metadata form @@ -52,10 +82,15 @@ class Herbarium { $dwc->handleForm($form_values); $this->item->purge_datastream('DARWIN_CORE'); $this->item->add_datastream_from_string($dwc->darwinCoreXML, 'DARWIN_CORE', - 'Darwin Core Metadata', 'text/xml', 'X'); + 'Darwin Core Metadata', 'text/xml', 'X'); return TRUE; } + /** + * Handle Ingest Form + * @global type $user + * @param type $form_values + */ public function handleIngestForm($form_values) { /* * process the metadata form @@ -70,64 +105,69 @@ class Herbarium { $dwc = new DarwinCore(); $dwc->handleForm($form_values); $label = $form_values['dwc:institutionCode'] . ':' - . $form_values['dwc:collectionCode'] . ':' - . $form_values['dwc:catalogNumber']; + . $form_values['dwc:collectionCode'] . ':' + . $form_values['dwc:catalogNumber']; $new_item = Fedora_Item::ingest_new_item($form_values['pid'], 'A', $label, - $user->name); + $user->name); $new_item->add_datastream_from_string($dwc->darwinCoreXML, 'DARWIN_CORE', - 'Darwin Core Metadata', 'text/xml', 'X'); + 'Darwin Core Metadata', 'text/xml', 'X'); $file = $form_values['ingest-file-location']; - if (!empty( $file)) { + if (!empty($file)) { $dformat = $mimetype->getType($file); $new_item->add_datastream_from_file($file, 'FULL_SIZE', - "$label-full-size", $dformat, 'M'); + "$label-full-size", $dformat, 'M'); } $new_item->add_relationship('hasModel', $form_values['content_model_pid'], FEDORA_MODEL_URI); $new_item->add_relationship(!empty($form_values['relationship']) ? $form_values['relationship'] : 'isMemberOfCollection', $form_values['collection_pid']); - + if (!empty($_SESSION['fedora_ingest_files'])) { foreach ($_SESSION['fedora_ingest_files'] as $dsid => $created_file) { $created_file_format = $mimetype->getType($created_file); $created_filename = strstr($created_file, $file); $new_item->add_datastream_from_file($created_file, $dsid, - $created_filename, $created_file_format, 'M'); - + $created_filename, $created_file_format, 'M'); } } } + /** + * Show Field Sets + * @global type $base_url + * @global type $user + * @return string + */ public function showFieldSets() { module_load_include('inc', 'fedora_repository', 'plugins/tagging_form'); module_load_include('inc', 'fedora_repository', 'plugins/DarwinCore'); global $base_url; $tabset = array(); - + global $user; $qs = ''; if ($user->uid != 0) { - $qs = '?uid='. base64_encode($user->name . ':'. $user->pass); + $qs = '?uid=' . base64_encode($user->name . ':' . $user->pass); } - $viewer_url = variable_get('fedora_base_url', '') . '/get/'. $this->pid . '/ilives:viewerSdef/getViewer'. $qs; - $html = ''; + $viewer_url = variable_get('fedora_base_url', '') . '/get/' . $this->pid . '/ilives:viewerSdef/getViewer' . $qs; + $html = ''; $tabset['second_tab'] = array( // $collection_fieldset = array ( '#type' => 'tabpage', '#title' => t('Full-size'), '#content' => $html ); + $image = theme('image', "fedora/imageapi/{$this->pid}/JPG/JPG.jpg", '', '', NULL, FALSE); $tabset['first_tab'] = array( // #type and #title are the minimum requirements. '#type' => 'tabpage', '#title' => t('View'), // This will be the content of the tab. - '#content' => ''. '

    '. drupal_get_form('fedora_repository_image_tagging_form', $this->pid) . '

    ', + '#content' => l($image, "fedora/repository/{$this->pid}/FULL_JPG", array('html' => TRUE)), '

    ' . drupal_get_form('fedora_repository_image_tagging_form', $this->pid) . '

    ', ); $dwc = new DarwinCore($this->item); @@ -138,7 +178,7 @@ class Herbarium { $tabset['third_tab']['tabset'] = array( '#type' => 'tabset', ); - + $tabset['third_tab']['tabset']['view'] = array( '#type' => 'tabpage', '#title' => t('Darwin Core'), @@ -168,4 +208,5 @@ class Herbarium { } return $tabset; } + } diff --git a/plugins/islandora_newspaper/Crystal_Clear_mimetype_document.png b/plugins/islandora_newspaper/Crystal_Clear_mimetype_document.png deleted file mode 100644 index f61fec3f..00000000 Binary files a/plugins/islandora_newspaper/Crystal_Clear_mimetype_document.png and /dev/null differ diff --git a/plugins/islandora_newspaper/Newspaper.inc b/plugins/islandora_newspaper/Newspaper.inc deleted file mode 100644 index 980479a9..00000000 --- a/plugins/islandora_newspaper/Newspaper.inc +++ /dev/null @@ -1,176 +0,0 @@ -pid = $pid; - $this->item = new Fedora_Item($pid); - } - } - - public function buildDrupalForm($form = array(), $ingest_form = array(), &$form_state = array()) { - - // Give the user an option to enter a custom PID - $form['custom_pid'] = array( - '#type' => 'textfield', - '#title' => 'Custom PID', - '#description' => 'If you want to manually specify the PID for the new object, enter it here. '. - 'Leave it blank for an automatically-generated PID.', - ); - - $form['mods'] = array( - '#tree' => TRUE, - '#prefix' => '
    ', - '#suffix' => '
    ', - ); - $form['mods']['mods_record'] = array( - '#type' => 'textarea', - '#title' => 'MODS Record to Import', - '#rows' => 20, - - ); - - return $form; - } - - public function handleIngestForm($form_values, &$form_state) { - /* - * process the metadata form - * Create fedora object - * Add the datastreams - */ - module_load_include('inc', 'fedora_repository', 'MimeClass'); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - module_load_include('inc', 'fedora_ilives', 'book'); - $mods_list_doc = new DomDocument(); - $mods_list_doc->loadXML($form_values['mods']['mods_record']); - $mods_item_doc = new DomDocument(); - $mods_item = $mods_list_doc->getElementsByTagNameNS('http://www.loc.gov/mods/v3', 'mods')->item(0); - $new_mods_item = $mods_item_doc->importNode($mods_item, TRUE); - $mods_item_doc->appendChild($new_mods_item); - - $title_info = $mods_item_doc->getElementsByTagNameNS('http://www.loc.gov/mods/v3', 'titleInfo')->item(0); - $title = ''; - foreach(array('nonSort', 'title') as $title_field) { - $title .= $title_info->getElementsByTagNameNS('http://www.loc.gov/mods/v3', $title_field)->item(0)->nodeValue; - } - - $mods_text = $mods_item_doc->saveXML(); - global $user; - $mimetype = new MimeClass(); - - $new_item = Fedora_Item::ingest_new_item(!empty($form_values['custom_pid']) ? $form_values['custom_pid'] : $form_values['pid'], 'A', $title, - $user->name); - - $new_item->add_datastream_from_string($mods_text, 'MODS', - 'MODS Metadata', 'text/xml', 'X'); - - $dc = transform_mods_to_dc($mods_text); - if ($dc) { - // Add the PID to a dc:identifier field. - $dc_doc = simplexml_load_string($dc); - $dc_doc->registerXPathNamespace('oai_dc', 'http://www.openarchives.org/OAI/2.0/oai_dc/'); - $dc_item = $dc_doc->xpath('//oai_dc:dc'); - foreach($dc_item as $node) { - $node->addChild('dc:identifier', $new_item->pid, 'http://purl.org/dc/elements/1.1/'); - } - $new_item->modify_datastream_by_value($dc_doc->saveXML(), 'DC', 'Dublin Core XML Metadata', 'text/xml'); - } - $new_item->add_relationship('hasModel', $form_values['content_model_pid'], FEDORA_MODEL_URI); - $new_item->add_relationship(!empty($form_values['relationship']) ? $form_values['relationship'] : 'isMemberOfCollection', $form_values['collection_pid']); - drupal_set_message(t("Item !pid created successfully.", array('!pid' => l($new_item->pid, 'fedora/repository/'. $new_item->pid))), "status"); - - } - - public function showFieldSets() { - module_load_include('inc', 'fedora_ilives', 'book'); - global $base_url; - - $tabset = array(); - - $tabset = array( - '#type' => 'tabset', - ); - - global $user; - $qs = ''; - if ($user->uid != 0) { - $qs = '?uid='. base64_encode($user->name . ':'. $user->pass); - } - - $viewer_url = variable_get('fedora_base_url', '') . '/get/'. $this->pid . '/ilives:viewerSdef/getViewer'. $qs; - $html = ''; - - $tabset['read'] = array( - '#type' => 'tabpage', - '#title' => t('Read'), - '#weight' => -1, - '#content' => $html - ); - - $item = new Fedora_Item($this->pid); - - $tabset['description'] = array( - '#type' => 'tabpage', - '#title' => 'Description', - '#content' => $item->get_dissemination('islandora:mods2htmlSdef', 'mods2html'), - ); - $tabset['add_pages'] = array( - '#type' => 'tabpage', - '#title' => t('Add pages'), - '#content' => drupal_get_form('book_add_pages_form', $this->pid, 'newspapers:pageCModel', 'isPartOf'), - ); - return $tabset; - } - - public function showPageFieldSets() { - - global $base_url; - - $tabset = array(); - - $tabset = array( - '#type' => 'tabset', - ); - - global $user; - $qs = ''; - if ($user->uid != 0) { - $qs = '?uid='. base64_encode($user->name . ':'. $user->pass); - } - - $viewer_url = variable_get('fedora_base_url', '') . '/get/'. $this->pid . '/ilives:viewerSdef/getViewer'. $qs; - $html = ''; - - $tabset['first_tab'] = array( - '#type' => 'tabpage', - '#title' => t('Read'), - '#content' => $html - ); - - $item = new Fedora_Item($this->pid); - - // Get this page's parent item to show the issue's metadata. - $rels = $item->get_relationships(); - $parent_pid = ''; - foreach ($rels as $rel) { - if (strstr($rel['predicate'], 'isPartOf')) { - $parent_pid = $rel['object']; - break; - } - } - $parent_item = new Fedora_Item($parent_pid); - $tabset['second_tab'] = array( - '#type' => 'tabpage', - '#title' => 'Description', - '#content' => $parent_item->get_dissemination('islandora:mods2htmlSdef', 'mods2html'), - ); - - return $tabset; - } -} diff --git a/plugins/islandora_newspaper/islandora_newspaper.info b/plugins/islandora_newspaper/islandora_newspaper.info deleted file mode 100644 index bbc884a2..00000000 --- a/plugins/islandora_newspaper/islandora_newspaper.info +++ /dev/null @@ -1,7 +0,0 @@ -; $Id$ -name = Islandora Newspaper -description = Content models and support code for Newspapers -package = Fedora Repository -dependencies[] = fedora_repository -version = 6.1dev -core = 6.x diff --git a/plugins/islandora_newspaper/islandora_newspaper.module b/plugins/islandora_newspaper/islandora_newspaper.module deleted file mode 100644 index 00184676..00000000 --- a/plugins/islandora_newspaper/islandora_newspaper.module +++ /dev/null @@ -1,63 +0,0 @@ - array( - 'module' => 'islandora_newspaper', - 'title' => 'Islandora Newspaper', - 'objects' => array( - array( - //'foxml_file' => "$module_path/newspapers_issueCModel.xml", - 'pid' => 'newspapers:issueCModel', - 'dsid' => 'ISLANDORACM', - 'cmodel' => 'fedora-system:ContentModel-3.0', - 'datastream_file' => "$module_path/newspapers_issueCModel_islandoracm.xml", - 'dsversion' => 2, - ), - array( - 'foxml_file' => "$module_path/newspapers_pageCModel.xml", - 'pid' => 'newspapers:pageCModel', - 'dsid' => NULL, - 'datastream_file' => NULL, - 'dsversion' => NULL, - ), - array( - 'foxml_file' => "$module_path/newspapers_viewerSdep-issueCModel.xml", - 'pid' => 'newspapers:viewerSdep-issueCModel', - 'dsid' => NULL, - 'datastream_file' => NULL, - 'dsversion' => NULL, - ), - array( - 'foxml_file' => "$module_path/newspapers_viewerSdep-pageCModel.xml", - 'pid' => 'newspapers:viewerSdep-pageCModel', - 'dsid' => NULL, - 'datastream_file' => NULL, - 'dsversion' => NULL, - ), - array ( - 'pid' => 'newspapers:collection', - 'label' => 'Newspapers Collection', - 'cmodel' => 'islandora:collectionCModel', - 'parent' => 'islandora:demos', - 'datastreams' => array ( - array ( - 'dsid' => 'COLLECTION_POLICY', - 'datastream_file' => "$module_path/newspapers_collection_policy.xml", - ), - array ( - 'dsid' => 'TN', - 'datastream_file' => "$module_path/Crystal_Clear_mimetype_document.png", - 'mimetype' => 'image/png', - ), - ), - ), - ), - ), - ); -} \ No newline at end of file diff --git a/plugins/islandora_newspaper/newspapers_collection_policy.xml b/plugins/islandora_newspaper/newspapers_collection_policy.xml deleted file mode 100644 index 3880f937..00000000 --- a/plugins/islandora_newspaper/newspapers_collection_policy.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - dc.title - dc.creator - dc.description - dc.date - dc.identifier - dc.language - dc.publisher - dc.rights - dc.subject - dc.relation - dcterms.temporal - dcterms.spatial - Full Text - - isMemberOfCollection - diff --git a/plugins/islandora_newspaper/newspapers_guardian.xml b/plugins/islandora_newspaper/newspapers_guardian.xml deleted file mode 100644 index be9a63da..00000000 --- a/plugins/islandora_newspaper/newspapers_guardian.xml +++ /dev/null @@ -1,378 +0,0 @@ - - - - - - - - - - - - - - - - modifyDatastreamByValue - MODS - fedoraAdmin - 2010-05-28T18:38:36.223Z - - - - - ingest - - fedoraAdmin - 2010-05-31T15:14:58.313Z - Ingested from local file /Users/al/Desktop/newspapers_guardian.xml - - - - - - - - - - This is an object-specific policy. It could be stored inside the digital object in the POLICY datastream OR in the directory for object-specific policies. (The directory location is set in the Authorization module configuration in the Fedora server configuration file (fedora.fcfg). By using multiple policy Rules, this policy shows how to deny access to all raw datastreams in the object except to particular users (e.g., the object owners). It also shows how to deny access to a particular disseminations to selected user roles. - - - - - - - - - - - urn:fedora:names:fedora:2.1:action:id-ingest - - - - - - urn:fedora:names:fedora:2.1:action:id-modifyDatastreamByReference - - - - - - urn:fedora:names:fedora:2.1:action:id-modifyDatastreamByValue - - - - - - urn:fedora:names:fedora:2.1:action:id-modifyDisseminator - - - - - - urn:fedora:names:fedora:2.1:action:id-modifyDisseminator - - - - - - urn:fedora:names:fedora:2.1:action:id-purgeObject - - - - - - urn:fedora:names:fedora:2.1:action:id-purgeDatastream - - - - - - urn:fedora:names:fedora:2.1:action:id-purgeDisseminator - - - - - - urn:fedora:names:fedora:2.1:action:id-setDatastreamState - - - - - - urn:fedora:names:fedora:2.1:action:id-setDisseminatorState - - - - - - urn:fedora:names:fedora:2.1:action:id-setDatastreamVersionable - - - - - - urn:fedora:names:fedora:2.1:action:id-addDatastream - - - - - - urn:fedora:names:fedora:2.1:action:id-addDisseminator - - - - - - - - - - - - administrator - - - - - - fedoraAdmin - - - - - - - - - - - - - - - - - - - - The Guardian - Guardian (Charlottetown, P.E.I.) - The Island guardian - The Charlottetown guardian - The Morning guardian - Newspapers - Newspapers - The Guardian, the successor to the Island Guardian, began publication in 1890 a a politically independent newspaper printing news and advertisements. Its editorials often discussed trade and tariffs, and it supported temperance and the Scott Act. Lcal, national and international news coverage was excellent in the paper. Twoards the end of the 1890s, headlines and line drawings illustrating the news stories began appearing in the Guardian. - - The tone of the newspaper changed during the first decade of the twentieth century; its news coverage became more sensational and its editorials offered less political commentary. Special weekend issues were printed during the second half of this decade, featuring comic strips, housekeeping articles, popular songs, sermons, local history and Sunday School lessons. Photographs and line drawings appeared frequently during the final years of the decade. - - .... more in Heather Boylan ... p.54-Checklist and Historical Directory of Prince Edward Island Newspapers. - Title varies: 1887- , The Island guardian; Dec. 1890-Jan. 1891, The Daily guardian; Jan. 1891- , The Morning guardian. - Ceased publication in 1920? - Missing issues. - Microfilm of the original in Prince Edward Island Public and Legislative Libraries. Ottawa, Canadian Library Association Newspaper Microfilming Project, 1963- reels. - Hood, J. P. - 1887-1920 - Text - v. - microfilm - http://islandpines.roblib.upei.ca/opac/extras/supercat/mods33/record/274634 - newspapers:guardian - eng - Prince Edward Island - Charlottetown (P.E.I.) - - - - - - - - - - The - Guardian - - - Guardian (Charlottetown, P.E.I.) - - - The - Island guardian - - - The - Charlottetown guardian - - - The - Morning guardian - - - Hood, J. P. - - - Manager - - - Business Manager from Dec. 29, 1891 - Mar. 9, 1903; Managing Director from July 2, 1912 - Jan. 30, 1913. - - - text - - - pic - - - Charlottetown, P.E.I - - 1887-1920 - 1887 - 1920 - continuing - - - eng - - The Guardian, the successor to the Island Guardian, began publication in 1890 a a politically independent newspaper printing news and advertisements. Its editorials often discussed trade and tariffs, and it supported temperance and the Scott Act. Lcal, national and international news coverage was excellent in the paper. Twoards the end of the 1890s, headlines and line drawings illustrating the news stories began appearing in the Guardian. - - The tone of the newspaper changed during the first decade of the twentieth century; its news coverage became more sensational and its editorials offered less political commentary. Special weekend issues were printed during the second half of this decade, featuring comic strips, housekeeping articles, popular songs, sermons, local history and Sunday School lessons. Photographs and line drawings appeared frequently during the final years of the decade. - - .... more in Heather Boylan ... p.54-Checklist and Historical Directory of Prince Edward Island Newspapers. - - - microfilm -
    microform
    - v. -
    - Title varies: 1887- , The Island guardian; Dec. 1890-Jan. 1891, The Daily guardian; Jan. 1891- , The Morning guardian. - Ceased publication in 1920? - Missing issues. - Microfilm of the original in Prince Edward Island Public and Legislative Libraries. Ottawa, Canadian Library Association Newspaper Microfilming Project, 1963- reels. - - Prince Edward Island - Newspapers - - - Charlottetown (P.E.I.) - Newspapers - - http://islandpines.roblib.upei.ca/opac/extras/supercat/mods33/record/274634 - - CaPCU - 760913 - 20090407151822.0 - -
    -
    -
    - - - - - The - Guardian - - - Guardian (Charlottetown, P.E.I.) - - - The - Island guardian - - - The - Charlottetown guardian - - - The - Morning guardian - - - Hood, J. P. - - - Manager - - - Business Manager from Dec. 29, 1891 - Mar. 9, 1903; Managing Director from July 2, 1912 - Jan. 30, 1913. - - - text - - - pic - - - Charlottetown, P.E.I - - 1887-1920 - 1887 - 1920 - continuing - - - eng - - The Guardian, the successor to the Island Guardian, began publication in 1890 a a politically independent newspaper printing news and advertisements. Its editorials often discussed trade and tariffs, and it supported temperance and the Scott Act. Lcal, national and international news coverage was excellent in the paper. Twoards the end of the 1890s, headlines and line drawings illustrating the news stories began appearing in the Guardian. - - The tone of the newspaper changed during the first decade of the twentieth century; its news coverage became more sensational and its editorials offered less political commentary. Special weekend issues were printed during the second half of this decade, featuring comic strips, housekeeping articles, popular songs, sermons, local history and Sunday School lessons. Photographs and line drawings appeared frequently during the final years of the decade. - - .... more in Heather Boylan ... p.54-Checklist and Historical Directory of Prince Edward Island Newspapers. - - -
    microfilm
    -
    microform
    - v. -
    - Title varies: 1887- , The Island guardian; Dec. 1890-Jan. 1891, The Daily guardian; Jan. 1891- , The Morning guardian. - Ceased publication in 1920? - Missing issues. - Microfilm of the original in Prince Edward Island Public and Legislative Libraries. Ottawa, Canadian Library Association Newspaper Microfilming Project, 1963- reels. - - Prince Edward Island - Newspapers - - - Charlottetown (P.E.I.) - Newspapers - - http://islandpines.roblib.upei.ca/opac/extras/supercat/mods33/record/274634 - - CaPCU - 760913 - 20090407151822.0 - -
    -
    -
    -
    - - - - - - - - - - - - -
    diff --git a/plugins/islandora_newspaper/newspapers_issueCModel_islandoracm.xml b/plugins/islandora_newspaper/newspapers_issueCModel_islandoracm.xml deleted file mode 100644 index 81a8f894..00000000 --- a/plugins/islandora_newspaper/newspapers_issueCModel_islandoracm.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - text/xml - - - - text/xml - - - - - - - - - - - - - - - - - diff --git a/plugins/islandora_newspaper/newspapers_pageCModel.xml b/plugins/islandora_newspaper/newspapers_pageCModel.xml deleted file mode 100644 index 99e3f94e..00000000 --- a/plugins/islandora_newspaper/newspapers_pageCModel.xml +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2010-05-28T19:37:09.514Z - Created with Admin GUI "New Object" command - - - - ingest - - fedoraAdmin - 2010-05-31T15:15:26.657Z - Ingested from local file /Users/al/Desktop/newspapers_pageCModel.xml - - - - ingest - - fedoraAdmin - 2010-06-01T13:22:40.275Z - Ingested from local file /Users/aoneill/fedora_repository/plugins/newspaper/newspapers_pageCModel.xml - - - - addDatastream - ISLANDORACM - fedoraAdmin - 2010-06-21T16:26:53.809Z - DatastreamsPane generated this logMessage. - - - - ingest - - fedoraAdmin - 2010-06-21T19:39:20.139Z - Ingested from source repository with pid newspapers:pageCModel - - - - - - - - - - - - - - - - - - - - - - This DS-COMPOSITE-MODEL datastream is included as a starting point to - assist in the creation of a content model. The DS-COMPOSITE-MODEL - should define the datastreams that are required for any objects - conforming to this content model. - For more information about content models, see: - http://fedora-commons.org/confluence/x/dgBI. - For examples of completed content model objects, see the demonstration - objects included with your Fedora distribution, such as: - demo:CMImage, demo:UVA_STD_IMAGE, demo:DualResImageCollection, - demo:TEI_TO_PDFDOC, and demo:XML_TO_HTMLDOC. - For more information about the demonstration objects, see: - http://fedora-commons.org/confluence/x/AwFI. - - -
    - - - - - - - - - - Newspaper Page Content Model - newspapers:pageCModel - - - - - - - - - - - - - plugins/Newspaper.inc - Newspaper - showPageFieldSets - - - - - - - - - - - - plugins/Newspaper.inc - Newspaper - buildEditMetadataForm - - - plugins/Newspaper.inc - Newspaper - handleEditMetadataForm - - - - - - - diff --git a/plugins/islandora_newspaper/newspapers_viewerSdep-issueCModel.xml b/plugins/islandora_newspaper/newspapers_viewerSdep-issueCModel.xml deleted file mode 100644 index d6fd2349..00000000 --- a/plugins/islandora_newspaper/newspapers_viewerSdep-issueCModel.xml +++ /dev/null @@ -1,241 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2010-05-31T20:54:30.053Z - Created with Admin GUI "New Object" command - - - - modifyDatastreamByValue - DSINPUTSPEC - fedoraAdmin - 2010-05-31T20:55:13.521Z - - - - - modifyDatastreamByValue - METHODMAP - fedoraAdmin - 2010-05-31T20:55:35.100Z - - - - - modifyDatastreamByValue - WSDL - fedoraAdmin - 2010-05-31T20:55:59.039Z - - - - - modifyDatastreamByValue - RELS-EXT - fedoraAdmin - 2010-05-31T20:57:54.728Z - - - - - modifyDatastreamByValue - METHODMAP - fedoraAdmin - 2010-05-31T20:59:03.704Z - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This METHODMAP datastream is included as a starting point to - assist in the creation of a service deployment. The METHODMAP - should define the the mapping of the WSDL to Fedora object methods. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This DSINPUTSPEC datastream is included as a starting point to - assist in the creation of a service deployment. The DSINPUTSPEC - should define the datastreams to be used by WSDL-defined methods. - - - - - - - - DC - text/xml - - - - - - - - - - - This WSDL datastream is included as a starting point to - assist in the creation of a service deployment. The WSDL - should define the services provided by this - service deployment. - For more information about service deployments, see: - http://fedora-commons.org/confluence/x/dgBI. - For examples of completed service deployment objects, see the demonstration - objects included with your Fedora distribution, such as: - demo:2, demo:13, demo:20, and demo:28. - For more information about the demonstration objects, see: - http://fedora-commons.org/confluence/x/AwFI. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Viewer service deployment for Newspaper content model - newspapers:viewerSdep-issueCModel - - - - - diff --git a/plugins/islandora_newspaper/newspapers_viewerSdep-pageCModel.xml b/plugins/islandora_newspaper/newspapers_viewerSdep-pageCModel.xml deleted file mode 100644 index de804348..00000000 --- a/plugins/islandora_newspaper/newspapers_viewerSdep-pageCModel.xml +++ /dev/null @@ -1,217 +0,0 @@ - - - - - - - - - - - - - - - - ingest - - fedoraAdmin - 2010-06-21T17:47:30.096Z - Created with Admin GUI "New Object" command - - - - modifyDatastreamByValue - RELS-EXT - fedoraAdmin - 2010-06-21T17:49:00.674Z - - - - - modifyDatastreamByValue - METHODMAP - fedoraAdmin - 2010-06-21T17:50:01.411Z - - - - - modifyDatastreamByValue - DSINPUTSPEC - fedoraAdmin - 2010-06-21T17:50:23.252Z - - - - - modifyDatastreamByValue - WSDL - fedoraAdmin - 2010-06-21T17:51:49.022Z - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This METHODMAP datastream is included as a starting point to - assist in the creation of a service deployment. The METHODMAP - should define the the mapping of the WSDL to Fedora object methods. - - - - - - - - - - - - - - - - - - - - - - This DSINPUTSPEC datastream is included as a starting point to - assist in the creation of a service deployment. The DSINPUTSPEC - should define the datastreams to be used by WSDL-defined methods. - - - - - - - - DC - text/xml - - - - - - - - - - - This WSDL datastream is included as a starting point to - assist in the creation of a service deployment. The WSDL - should define the services provided by this - service deployment. - For more information about service deployments, see: - http://fedora-commons.org/confluence/x/dgBI. - For examples of completed service deployment objects, see the demonstration - objects included with your Fedora distribution, such as: - demo:2, demo:13, demo:20, and demo:28. - For more information about the demonstration objects, see: - http://fedora-commons.org/confluence/x/AwFI. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Viewer for newspaper pages - newspapers:viewerSdep-pageCModel - - - - - diff --git a/plugins/map_viewer.inc b/plugins/map_viewer.inc index 0a1bda62..f3bfca80 100644 --- a/plugins/map_viewer.inc +++ b/plugins/map_viewer.inc @@ -1,13 +1,33 @@ pid = $pid; } + /** + * Show JPEG + * @global type $base_url + * @global type $user + * @return type + */ function showJPG() { module_load_include('inc', 'fedora_repository', 'plugins/tagging_form'); module_load_include('inc', 'fedora_repository', 'plugins/ShowStreamsInFieldSets'); @@ -27,8 +47,8 @@ class ShowMapStreamsInFieldSets { $qs = '?uid=' . base64_encode($user->name . ':' . $user->pass); } - $viewer_url = variable_get('fedora_base_url', '') . '/get/'. $this->pid . '/ilives:viewerSdef/getViewer'. $qs; - $html = ''; + $viewer_url = variable_get('fedora_base_url', '') . '/get/' . $this->pid . '/ilives:viewerSdef/getViewer' . $qs; + $html = ''; drupal_add_css(path_to_theme() . '/header-viewer.css', 'theme'); drupal_add_css(drupal_get_path('module', 'fedora_repository') . '/js/iiv/css/jquery-ui/smoothness/jquery-ui-1.7.2.custom.css'); @@ -46,9 +66,10 @@ class ShowMapStreamsInFieldSets { '#type' => 'tabpage', '#title' => t('Description'), '#content' => $item->get_dissemination('islandora:mods2htmlSdef', 'mods2html') - . $objectHelper->get_formatted_datastream_list($this->pid, NULL, $item), + . $objectHelper->get_formatted_datastream_list($this->pid, NULL, $item), ); // Render the tabset. return tabs_render($tabset); } + } diff --git a/plugins/pidfield/pidfield.info b/plugins/pidfield/pidfield.info deleted file mode 100644 index e7b9d96f..00000000 --- a/plugins/pidfield/pidfield.info +++ /dev/null @@ -1,8 +0,0 @@ -; $Id$ -name = PID Field -description = Defines a field type for referencing a Fedora item from a node. -dependencies[] = content -dependencies[] = fedora_repository -package = Fedora Repository -core = 6.x - diff --git a/plugins/pidfield/pidfield.install b/plugins/pidfield/pidfield.install deleted file mode 100644 index 2a45a34c..00000000 --- a/plugins/pidfield/pidfield.install +++ /dev/null @@ -1,39 +0,0 @@ - array( - // The human-readable label of the field that will be - // seen in the Manage fields screen. - 'label' => t('Fedora PID field'), - // A description of what type of data the field stores. - 'description' => t('Store a reference to a PID in this site\'s Fedora repository.'), - // An icon to use in Panels. - 'content_icon' => 'icon_content_text.png', - ), - ); -} - -/** - * Implementation of hook_field_settings(). - */ -function pidfield_field_settings($op, $field) { - switch ($op) { - // Create the form element to be used on the field - // settings form. Field settings will be the same for - // all shared instances of the same field and should - // define the way the value will be stored - // in the database. - case 'form': - $form = array(); - $form['max_length'] = array( - '#type' => 'textfield', - '#title' => t('Maximum length'), - '#default_value' => is_numeric($field['max_length']) ? $field['max_length'] : 64, - '#required' => FALSE, - - // Use #element_validate to validate the settings. - '#element_validate' => array('_pidfield_length_validate'), - '#description' => t('The maximum length of the field in characters. Must be a number between 1 and 255'), - ); - return $form; - - // Return an array of the names of the field settings - // defined by this module. These are the items that - // CCK will store in the field definition - // and they will be available in the $field array. - // This should match the items defined in 'form' above. - case 'save': - return array('max_length'); - - // Define the database storage for this field using - // the same construct used by schema API. Most fields - // have only one column, but there can be any number - // of different columns. After the schema API values, - // add two optional values to each column, - // 'views', to define a Views field - // 'sortable', to add a Views sort field - case 'database columns': - $columns['value'] = array( - 'type' => 'varchar', - 'length' => is_numeric($field['max_length']) ? $field['max_length'] : 64, - 'not null' => FALSE, - 'sortable' => TRUE, - 'views' => TRUE, - ); - return $columns; - - // Optional: Make changes to the default $data array - // created for Views. Omit this if no changes are - // needed, use it to add a custom handler or make - // other changes. - case 'views data': - // Start with the $data created by CCK - // and alter it as needed. The following - // code illustrates how you would retrieve - // the necessary data. - $data = content_views_field_views_data($field); - $db_info = content_database_info($field); - $table_alias = content_views_tablename($field); - $field_data = $data[$table_alias][$field['field_name'] .'_value']; - // Make changes to $data as needed here. - return $data; - } -} - -/** - * Custom validation of settings values. - * - * Create callbacks like this to do settings validation. - */ -function _pidfield_length_validate($element, &$form_state) { - $value = $form_state['values']['max_length']; - if ($value && !is_numeric($value)|| $value < 1 || $value > 255) { - form_set_error('max_length', t('"Max length" must be a number between 1 and 64.')); - } -} - -/** - * Implementation of hook_field(). - */ -function pidfield_field($op, &$node, $field, &$items, $teaser, $page) { - switch ($op) { - // Do validation on the field values here. The widget - // will do its own validation and you cannot make any - // assumptions about what kind of widget has been used, - // so don't validate widget values, only field values. - case 'validate': - if (is_array($items)) { - foreach ($items as $delta => $item) { - // The error_element is needed so that CCK can - // set an error on the right sub-element when - // fields are deeply nested in the form. - $error_element = isset($item['_error_element']) ? $item['_error_element'] : ''; - if (is_array($item) && isset($item['_error_element'])) unset($item['_error_element']); - if (!empty($item['value'])) { - if (!empty($field['max_length']) && drupal_strlen($item['value']) > $field['max_length']) { - form_set_error($error_element, t('%name: the value may not be longer than %max characters.', array('%name' => $field['widget']['label'], '%max' => $field['max_length']))); - } - } - } - } - return $items; - - // This is where you make sure that user-provided - // data is sanitized before being displayed. - case 'sanitize': - foreach ($items as $delta => $item) { - $pid_field_text = check_plain($item['value']); - $items[$delta]['safe'] = $pid_field_text; - } - } -} - -/** - * Implementation of hook_content_is_empty(). - * - * CCK has no way to know if something like a zero is - * an empty value or a valid value, so return - * TRUE or FALSE to a populated field $item array. - * CCK uses this to remove empty multi-value elements - * from forms. - */ -function pidfield_content_is_empty($item, $field) { - if (empty($item['value'])) { - return TRUE; - } - return FALSE; -} - -/** - * Implementation of hook content_generate(). - * - * Optional, provide dummy value for nodes created - * by the Devel Generate module. - */ -function pidfield_content_generate($node, $field) { - $node_field = array(); - // Generate a value that respects max_length. - if (empty($field['max_length'])) { - $field['max_length'] = 12; - } - $node_field['value'] = user_password($field['max_length']); - return $node_field; -} - -/** - * Implementation of hook_token_list() - * and hook_token_values(). - * - * Optional, provide token values for this field. - */ -function pidfield_token_list($type = 'all') { - if ($type == 'field' || $type == 'all') { - $tokens = array(); - - $tokens['pidfield']['raw'] = t('Just the PID itself.'); - $tokens['pidfield']['formatted'] = t('A PID with a hyperlink'); - - return $tokens; - } -} - -function pidfield_token_values($type, $object = NULL) { - if ($type == 'field') { - $item = $object[0]; - - $tokens['raw'] = $item['value']; - $tokens['formatted'] = isset($item['view']) ? $item['view'] : ''; - return $tokens; - } -} - -//==========================================// -// DEFINING A FORMATTER -//==========================================// - -/** - * Implementation of hook_theme(). - */ -function pidfield_theme() { - return array( - // Themes for the formatters. - 'pidfield_formatter_default' => array( - 'arguments' => array('element' => NULL), - ), - 'pidfield_formatter_plain' => array( - 'arguments' => array('element' => NULL), - ), - ); -} - -/** - * Implementation of hook_field_formatter_info(). - * - * All fields should have a 'default' formatter. - * Any number of other formatters can be defined as well. - * It's nice for there always to be a 'plain' option - * for the raw value, but that is not required. - * - */ -function pidfield_field_formatter_info() { - return array( - // The machine name of the formatter. - 'default' => array( - // The human-readable label shown on the Display - // fields screen. - 'label' => t('Default'), - // An array of the field types this formatter - // can be used on. - 'field types' => array('pidfield'), - // CONTENT_HANDLE_CORE: CCK will pass the formatter - // a single value. - // CONTENT_HANDLE_MODULE: CCK will pass the formatter - // an array of all the values. None of CCK's core - // formatters use multiple values, that is an option - // available to other modules that want it. - 'multiple values' => CONTENT_HANDLE_CORE, - ), - 'plain' => array( - 'label' => t('Plain text'), - 'field types' => array('pidfield'), - 'multiple values' => CONTENT_HANDLE_CORE, - ), - ); -} - -/** - * Theme function for 'default' example field formatter. - * - * $element['#item']: the sanitized $delta value for the item, - * $element['#field_name']: the field name, - * $element['#type_name']: the $node->type, - * $element['#formatter']: the $formatter_name, - * $element'#node']: the $node, - * $element['#delta']: the delta of this item, like '0', - * - */ -function theme_pidfield_formatter_default($element) { - $pid = $element['#item']['safe']; - if(!empty($pid)) { - return fedora_repository_get_items($pid); - } - return null; -} - -/** - * Theme function for 'plain' example field formatter. - */ -function theme_pidfield_formatter_plain($element) { - return strip_tags($element['#item']['safe']); -} - -//==========================================// -// DEFINING A WIDGET -//==========================================// - -/** - * Implementation of hook_widget_info(). - * - * Here we indicate that the content module will handle - * the default value and multiple values for these widgets. - * - * Callbacks can be omitted if default handing is used. - * They're included here just so this module can be used - * as an example for custom modules that might do things - * differently. - */ -function pidfield_widget_info() { - return array( - // The machine name of the widget, no more than 32 - // characters. - 'pidfield_widget' => array( - // The human-readable label of the field that will be - // seen in the Manage fields screen. - 'label' => t('PID Field widget'), - // An array of the field types this widget can be - // used with. - 'field types' => array('pidfield'), - // Who will handle multiple values, default is core. - // 'CONTENT_HANDLE_MODULE' means the module does it. - // See optionwidgets for an example of a module that - // handles its own multiple values. - 'multiple values' => CONTENT_HANDLE_CORE, - 'callbacks' => array( - // Who will create the default value, default is core. - // 'CONTENT_CALLBACK_CUSTOM' means the module does it. - // 'CONTENT_CALLBACK_NONE' means this widget has - // no default value. - 'default value' => CONTENT_CALLBACK_DEFAULT, - ), - ), - ); -} - -/** - * Implementation of hook_widget_settings(). - */ -function pidfield_widget_settings($op, $widget) { - switch ($op) { - // Create the form element to be used on the widget - // settings form. Widget settings can be different - // for each shared instance of the same field and - // should define the way the value is displayed to - // the user in the edit form for that content type. - case 'form': - $form = array(); - $size = (isset($widget['size']) && is_numeric($widget['size'])) ? $widget['size'] : 60; - $form['size'] = array( - '#type' => 'textfield', - '#title' => t('Size of textfield'), - '#default_value' => $size, - '#element_validate' => array('_element_validate_integer_positive'), - '#required' => TRUE, - ); - return $form; - - // Return an array of the names of the widget settings - // defined by this module. These are the items that - // CCK will store in the widget definition and they - // will be available in the $field['widget'] array. - // This should match the items defined in 'form' above. - case 'save': - return array('size'); - } -} - -/** - * Implementation of hook_widget(). - * - * Attach a single form element to the form. - * - * CCK core fields only add a stub element and builds - * the complete item in #process so reusable elements - * created by hook_elements can be plugged into any - * module that provides valid $field information. - * - * Custom widgets that don't care about using hook_elements - * can be built out completely at this time. - * - * If there are multiple values for this field and CCK is - * handling multiple values, the content module will call - * this function as many times as needed. - * - * @param $form - * the entire form array, - * $form['#node'] holds node information - * @param $form_state - * the form_state, - * $form_state['values'][$field['field_name']] - * holds the field's form values. - * @param $field - * the field array - * @param $items - * array of default values for this field - * @param $delta - * the order of this item in the array of - * subelements (0, 1, 2, etc) - * - * @return - * the form item for a single element for this field - */ -function pidfield_widget(&$form, &$form_state, $field, $items, $delta = 0) { - - $element['value'] = array( - '#type' => 'textfield', - '#title' => $field['widget']['label'], - '#default_value' => isset($items[$delta]['value']) ? $items[$delta]['value'] : NULL, - '#autocomplete_path' => $element['#autocomplete_path'], - '#size' => !empty($field['widget']['size']) ? $field['widget']['size'] : 60, - '#attributes' => array('class' => 'pidfield'), - '#maxlength' => !empty($field['max_length']) ? $field['max_length'] : NULL, - ); - - // Used so that hook_field('validate') knows where to - // flag an error in deeply nested forms. - if (empty($form['#parents'])) { - $form['#parents'] = array(); - } - $element['_error_element'] = array( - '#type' => 'value', - '#value' => implode('][', array_merge($form['#parents'], array('value'))), - ); - - return $element; -} - -function get_node_references_for_fedora_item($item) { - $result = db_query("SELECT * - FROM {content_node_field} nf - INNER JOIN {content_node_field_instance} ni ON nf.field_name = ni.field_name - WHERE nf.type = 'pidfield'"); - while ($field = db_fetch_array($result)) { - - - $db_info = content_database_info($field); - - - - - - $ids = db_query("SELECT nid FROM {". $db_info['table'] ."} WHERE ". $field['field_name'] ."_value=\"". $item->pid."\""); - - $results = array(); - while ($data = db_fetch_object($ids)) { - //$additions[] = node_load($data->vid); - - $results[] = $data->nid; - - //$referred_node = node_load(array('nid'=>$data->nid) ); - - } - return $results; - } - -} - -function fedora_pidfield_redirect_to_node($item) { - $node_references = get_node_references_for_fedora_item($item); - if (!empty($node_references)) { - if (strstr( drupal_get_destination(), urlencode('fedora/repository'))) { - drupal_goto(drupal_get_path_alias("node/".$node_references[0])); - } - } -} \ No newline at end of file diff --git a/plugins/qt_viewer.inc b/plugins/qt_viewer.inc index 996b12b6..e321f00f 100644 --- a/plugins/qt_viewer.inc +++ b/plugins/qt_viewer.inc @@ -1,71 +1,116 @@ pid = $pid; } + /** + * Returna a new Fedora Object with the QT movie ??? + * @return fedora_item + */ function fedoraObject() { return new fedora_item($this->pid); } + /** + * Tecnical metadata ?? + * @param type $defaults + * @param type $dsid + * @return type + */ function technicalMetadata($defaults = array(), $dsid = 'OBJ_EXIFTOOL') { $data = $defaults; try { - $src = ObjectHelper::getStream($this->pid, $dsid); - - $doc = new SimpleXMLElement($src); - $doc->registerXPathNamespace('File', 'http://ns.exiftool.ca/File/1.0/'); - $doc->registerXPathNamespace('Composite', 'http://ns.exiftool.ca/Composite/1.0/'); - $mime = reset($doc->xpath('//File:MIMEType')); - $data['mime'] = $mime; - if(strpos($mime, 'audio/') !== false) { - $data['width'] = 300; - $data['height'] = 0; - } else { - $size = reset($doc->xpath('//Composite:ImageSize/text()')); - list($width, $height) = explode('x', $size); - $data['width'] = $width; - $data['height'] = $height; - } + $src = ObjectHelper::getStream($this->pid, $dsid); + + $doc = new SimpleXMLElement($src); + $doc->registerXPathNamespace('File', 'http://ns.exiftool.ca/File/1.0/'); + $doc->registerXPathNamespace('Composite', 'http://ns.exiftool.ca/Composite/1.0/'); + $mime = reset($doc->xpath('//File:MIMEType')); + $data['mime'] = $mime; + if (strpos($mime, 'audio/') !== FALSE) { + $data['width'] = 300; + $data['height'] = 0; + } + else { + $size = reset($doc->xpath('//Composite:ImageSize/text()')); + list($width, $height) = explode('x', $size); + $data['width'] = $width; + $data['height'] = $height; + } - $data['doc'] = $src; - } catch(Exception $e) { - $data = $defaults; + $data['doc'] = $src; + } catch (Exception $e) { + $data = $defaults; } return $data; } + /** + * Get Poster Frame Datastream Information ?? + * @param type $dsid + * @return type + */ function getPosterFrameDatastreamInfo($dsid = 'FULL_SIZE') { $p = ObjectHelper::getDatastreamInfo($this->pid, $dsid); - if(empty($p) || $p == ' ' || $p === false) { - return false; + if (empty($p) || $p == ' ' || $p === FALSE) { + return FALSE; } return $p; } + /** + * Get Media Datastream Information ?? + * @param type $dsid + * @param type $alt + * @return type + */ function getMediaDatastreamInfo($dsid = 'OBJ', $alt = array('')) { $p = ObjectHelper::getDatastreamInfo($this->pid, $dsid); - if(empty($p) || $p == ' ' || $p === false) { - if(!empty($alt)) { - $ds = array_shift($alt); - return $this->getMediaDatastreamInfo($ds, $alt); + if (empty($p) || $p == ' ' || $p === FALSE) { + if (!empty($alt)) { + $ds = array_shift($alt); + return $this->getMediaDatastreamInfo($ds, $alt); } - return false; + return FALSE; } return $p; } + /** + * Is download enabled. It always returns FALSE. ??? + * @return FALSE + */ function enableDownload() { - return false; + return FALSE; } + /** + * Show the QT ??? + * @global type $base_url + * @return type + */ function showQt() { module_load_include('inc', 'fedora_repository', 'plugins/tagging_form'); module_load_include('inc', 'fedora_repository', 'plugins/ShowStreamsInFieldSets'); @@ -77,62 +122,80 @@ class ShowQtStreamsInFieldSets { $pframe = $this->getPosterFrameDatastreamInfo(); $media = $this->getMediaDatastreamInfo('PROXY', array('OBJ')); - if($media === false ) { + if ($media === FALSE) { return ''; } - global $base_url; + $path = drupal_get_path('module', 'Fedora_Repository'); - $fullPath=base_path().$path; - $content= ''; - $pathTojs = drupal_get_path('module', 'Fedora_Repository').'/js/AC_Quicktime.js'; - drupal_add_js($pathTojs); - - $divid = 'player'.md5($this->pid).'MOV'; - $content .= '
    '; - if($pframe !== false) { - $content .= '
    '; - $content .= ''; - $content .= '
    '; - $content .= '
    '; + + drupal_add_js("$path/js/AC_Quicktime.js"); + + $divid = 'player' . md5($this->pid) . 'MOV'; + + $collection_fieldset = array( + '#title' => t('Quicktime'), + '#collapsible' => TRUE, + '#collapsed' => FALSE, + 'player' => array( + '#type' => 'markup', + '#prefix' => '
    ', + '#suffix' => '
    ', + ), + ); + + if ($pframe !== FALSE) { + $collection_fieldset['player']['poster_container'] = array( + '#type' => 'markup', + '#prefix' => '
    ', + '#suffix' => '
    ', + 'poster' => array( + '#type' => 'markup', + '#value' => theme('image', "fedora/repository/{$this->pid}/{$pframe->ID}/poster.jpg", '', '', NULL, FALSE) + ) + 'play' => array( + '#type' => 'markup', + '#prefix' => '
    ', + '#suffix' => '
    ', + '#value' => ' ', + ), + ); } - $content .= '
    '; - if($this->enableDownload()) { - $url = base_path().'fedora/repository/'.$this->pid.'/OBJ/MOV.mov'; - $content .= 'Download Media File'; + if ($this->enableDownload()) { + //$url = url(); + $collection_fieldset['download_link'] = array( + '#type' => 'markup', + '#value' => l(t('Download Media File'), "fedora/repository/{$this->pid}/OBJ/MOV.mov", array('attributes' => array('class' => 'download'))), + ); } - $src = base_path().'fedora/repository/'.$this->pid.'/' . $media->ID. '/MOV.mov'; -$qtparams = ''; - $qtparams .= "'autostart', '" . ($pframe !== false ? 'true' : 'false') . "', "; + $src = url("fedora/repository/{$this->pid}/{$media->ID}/MOV.mov"; + + $qtparams = "'autostart', '" . ($pframe !== FALSE ? 'TRUE' : 'FALSE') . "', "; $init = << t('Quicktime'), - '#collapsible' => TRUE, - '#collapsed' => FALSE, - '#value' => $content); - return theme('fieldset',$collection_fieldset); - } } diff --git a/plugins/slide_viewer.inc b/plugins/slide_viewer.inc index 30d2eb01..729e824e 100644 --- a/plugins/slide_viewer.inc +++ b/plugins/slide_viewer.inc @@ -1,30 +1,46 @@ pid = $pid; } - + + /** + * Show JPEG + * @global type $base_url + * @global type $user + * @return type + */ function showJPG() { module_load_include('inc', 'fedora_repository', 'plugins/tagging_form'); module_load_include('inc', 'fedora_repository', 'plugins/ShowStreamsInFieldSets'); - global $base_url; global $user; $tabset = array(); - + $qs = ''; if ($user->uid != 0) { - $qs = '?uid=' . base64_encode($user->name . ':' . $user->pass); + $qs = '?uid=' . base64_encode($user->name . ':' . $user->pass); //XXX: Base64 encoding is not encryption; SSL would be nice... } - $viewer_url = variable_get('fedora_base_url', 'http://localhost:8080/fedora') . '/get/'. $this->pid . '/ilives:viewerSdef/getViewer'. $qs; - $html = ''; + $viewer_url = variable_get('fedora_base_url', 'http://localhost:8080/fedora') . '/get/' . $this->pid . '/ilives:viewerSdef/getViewer' . $qs; + $html = ''; drupal_add_css(path_to_theme() . '/header-viewer.css', 'theme'); @@ -38,10 +54,10 @@ class ShowSlideStreamsInFieldSets { '#type' => 'tabpage', '#title' => t('View'), // This will be the content of the tab. - '#content' => ''. '

    '. drupal_get_form('fedora_repository_image_tagging_form', $this->pid) . '

    ', + '#content' => theme('image', "fedora/imageapi/{$this->pid}/JPG/JPG.jpg", '', '', NULL, FALSE) . '

    ' . drupal_get_form('fedora_repository_image_tagging_form', $this->pid) . '

    ', ); - + return $tabset; } + } diff --git a/plugins/tagging_form.inc b/plugins/tagging_form.inc index 2b374b3c..f00274d4 100644 --- a/plugins/tagging_form.inc +++ b/plugins/tagging_form.inc @@ -1,11 +1,17 @@ tags)) { - $output = "
      "; + $items = array(); foreach ($tags->tags as $tag) { - $output .= "
    • "; + return theme('item_list', $items); } - return $output; } +/** + * Fedora repository image tagging form ???? + * @global type $base_url + * @param type $form_state + * @param type $pid + * @return type + */ function fedora_repository_image_tagging_form($form_state, $pid) { module_load_include('inc', 'fedora_repository', 'api/fedora_item'); module_load_include('inc', 'fedora_repository', 'api/dublin_core'); @@ -29,7 +44,7 @@ function fedora_repository_image_tagging_form($form_state, $pid) { global $base_url; if (!empty($form_state['post']['pid'])) { - $pid = $form_state['post']['pid']; + $pid = $form_state['post']['pid']; } $obj = new Fedora_Item($pid); $form['tags-wrapper'] = array( @@ -44,21 +59,27 @@ function fedora_repository_image_tagging_form($form_state, $pid) { // Add the current tags to the form. $tagset = new TagSet($obj); + $tags = array(); foreach ($tagset->tags as $tag) { - $form['tags-wrapper']['tags'][$tag['name']] = array( + $form_tag =& $form['tags-wrapper']['tags'][$tag['name']] = array( '#prefix' => '
    • ', '#suffix' => '
    • ', ); - $form['tags-wrapper']['tags'][$tag['name']]['tag'] = array( - '#prefix' => '', - '#value' => $tag['name'], - '#suffix' => '', + + $tag_title_text = t('Added by @creator.', array( + '@creator' => $tag['creator'], + )); + $tag_mnpl_search_path = "fedora/repository/mnpl_advanced_search/tag:{$tag['name']}" + $form_tag['tag'] = array( + '#value' => l($tag['name'], $tag_mnpl_search_path, array('attributes' => array( + 'title' => $tag_title_text + ))), ); if (user_access('modify fedora datastreams') || user_access('add fedora tags')) { // Delete button for each existing tag. - $form['tags-wrapper']['tags'][$tag['name']]['delete'] = array( + $form_tag['delete'] = array( '#type' => 'imagebutton', - '#image' => $base_url . '/'. drupal_get_path('module', 'fedora_repository') . '/images/remove_icon.png', + '#image' => drupal_get_path('module', 'fedora_repository') . '/images/remove_icon.png', '#default_value' => $tag['name'], '#title' => t('Delete this tag'), ); @@ -84,10 +105,15 @@ function fedora_repository_image_tagging_form($form_state, $pid) { if (empty($form_state['pid'])) { $form_state['pid'] = $pid; } - + return $form; } +/** + * Hook image button process ??? + * @param type $form + * @return string + */ function hook_imagebutton_process($form) { $form['op_x'] = array( '#name' => $form['#name'] . '_x', @@ -98,6 +124,12 @@ function hook_imagebutton_process($form) { return $form; } +/** + * Fedora repository image tagging from submit ??? + * @global type $user + * @param type $form + * @param type $form_state + */ function fedora_repository_image_tagging_form_submit($form, &$form_state) { module_load_include('inc', 'fedora_repository', 'api/fedora_item'); module_load_include('inc', 'fedora_repository', 'api/tagging'); @@ -110,7 +142,7 @@ function fedora_repository_image_tagging_form_submit($form, &$form_state) { array_push($tagset->tags, array('name' => $form_state['values']['addtag'], 'creator' => $user->name)); } elseif (!empty($form_state['values']['delete'])) { - for ( $i=0; $i < count($tagset->tags); $i++ ) { + for ($i = 0; $i < count($tagset->tags); $i++) { if ($tagset->tags[$i]['name'] == $form_state['clicked_button']['#value']) { unset($tagset->tags[$i]); } diff --git a/policies/viewANDeditbyrole.xml b/policies/viewANDeditbyrole.xml index ce75b2f5..0a79cbbb 100644 --- a/policies/viewANDeditbyrole.xml +++ b/policies/viewANDeditbyrole.xml @@ -12,26 +12,26 @@ This policy will allow users with the roles listed below to view and edit objects with this policy - + - - - + + + - - - + + + - - - - + + + + @@ -49,7 +49,7 @@ - + diff --git a/searchTerms.xml b/searchTerms.xml index 6ab8ac65..a41c1ff6 100644 --- a/searchTerms.xml +++ b/searchTerms.xml @@ -1,73 +1,73 @@ - + - dc.description - 1000 - - dc.title - dc.title - - - dc.creator - dc.creator - - - dc.description - dc.description - - - dc.date - dc.date - - - dc.contributor - dc.contributor - - - dc.identifier - dc.identifier - - - dc.language - dc.language - - - dc.publisher - dc.publisher - - - dc.rights - dc.rights - - - dc.subject - dc.subject - - - dc.format - dc.format - - - dc.source - dc.source - - - dc.coverage - dc.coverage - - - dc.relation - dc.relation - - - dc.type - dc.type - - - dsm.text - Full Text - - + dc.description + 1000 + + dc.title + dc.title + + + dc.creator + dc.creator + + + dc.description + dc.description + + + dc.date + dc.date + + + dc.contributor + dc.contributor + + + dc.identifier + dc.identifier + + + dc.language + dc.language + + + dc.publisher + dc.publisher + + + dc.rights + dc.rights + + + dc.subject + dc.subject + + + dc.format + dc.format + + + dc.source + dc.source + + + dc.coverage + dc.coverage + + + dc.relation + dc.relation + + + dc.type + dc.type + + + dsm.text + Full Text + + diff --git a/solrSearchTerms.xml b/solrSearchTerms.xml index 6ab8ac65..a41c1ff6 100644 --- a/solrSearchTerms.xml +++ b/solrSearchTerms.xml @@ -1,73 +1,73 @@ - + - dc.description - 1000 - - dc.title - dc.title - - - dc.creator - dc.creator - - - dc.description - dc.description - - - dc.date - dc.date - - - dc.contributor - dc.contributor - - - dc.identifier - dc.identifier - - - dc.language - dc.language - - - dc.publisher - dc.publisher - - - dc.rights - dc.rights - - - dc.subject - dc.subject - - - dc.format - dc.format - - - dc.source - dc.source - - - dc.coverage - dc.coverage - - - dc.relation - dc.relation - - - dc.type - dc.type - - - dsm.text - Full Text - - + dc.description + 1000 + + dc.title + dc.title + + + dc.creator + dc.creator + + + dc.description + dc.description + + + dc.date + dc.date + + + dc.contributor + dc.contributor + + + dc.identifier + dc.identifier + + + dc.language + dc.language + + + dc.publisher + dc.publisher + + + dc.rights + dc.rights + + + dc.subject + dc.subject + + + dc.format + dc.format + + + dc.source + dc.source + + + dc.coverage + dc.coverage + + + dc.relation + dc.relation + + + dc.type + dc.type + + + dsm.text + Full Text + + diff --git a/tests/README_TESTING.txt b/tests/README_TESTING.txt index 18db5ba8..c9dde164 100644 --- a/tests/README_TESTING.txt +++ b/tests/README_TESTING.txt @@ -2,10 +2,10 @@ There are a few things to set up to get the Simpletests to run properly. Fedora Installation -The test sets up the fedora_repository module with the default server settings. +The test sets up the islandora module with the default server settings. This means it will expect a Fedora server to be running on localhost:8080 with the usual defaults. The tests also expect the Islandora demo objects, i.e., -islandora:top, islandora:demos collections, etc. to be installed. (Go to +islandora:root, islandora:demos collections, etc. to be installed. (Go to Administer -> Site Configuration -> Fedora Colleciton List and click the Install Demos tab and follow the instructions.) diff --git a/tests/fedora_repository.test b/tests/fedora_repository.test index fea72991..bbad2569 100644 --- a/tests/fedora_repository.test +++ b/tests/fedora_repository.test @@ -1,8 +1,7 @@ 'Fedora Repository', - 'description' => t('The Fedora repository content models.'), - 'group' => t('fedora repository'), + 'name' => 'Digital Repository', + 'description' => t('The Digital repository content models.'), + 'group' => t('digital repository'), ); } @@ -23,17 +22,17 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { // Create and login user. $repository_user = $this->drupalCreateFedoraUser(array('add fedora datastreams', - 'edit fedora meta data', - 'edit tags datastream', - 'ingest new fedora objects', - 'purge objects and datastreams', - 'view fedora collection', - 'view detailed list of content')); + 'edit fedora meta data', + 'edit tags datastream', + 'ingest new fedora objects', + 'purge objects and datastreams', + 'view fedora collection', + 'view detailed list of content')); $this->repository_user = $repository_user; $this->drupalLogin($repository_user); } - + /** * Add an item based on a content model. Initially we will assume that the repository * will be populated with the default content models and collections that are @@ -46,11 +45,11 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { $pid_list = array(); // Create a collection for ingesting PDF content model objects. - //$this->drupalGet('fedora/ingestObject/islandora:top/Islandora%20Top-Level%20Collection'); + //$this->drupalGet('fedora/ingestObject/islandora:root/Islandora%20Top-Level%20Collection'); $ingest_form = array(); $ingest_form['models'] = 'islandora:collectionCModel/ISLANDORACM'; - $this->drupalPost('fedora/ingestObject/islandora:top/Islandora%20Top-Level%20Collection', $ingest_form, 'Next'); + $this->drupalPost('fedora/ingestObject/islandora:root/Islandora%20Top-Level%20Collection', $ingest_form, 'Next'); // Add a sample PDF object via the web ingest form. // Required fields are file location, dc:title and dc:description @@ -68,7 +67,7 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { $ingest_form = array(); $ingest_form['models'] = 'islandora:collectionCModel/ISLANDORACM'; - $this->drupalPost('fedora/ingestObject/islandora:top/Islandora%20Top-Level%20Collection', $ingest_form, 'Next'); + $this->drupalPost('fedora/ingestObject/islandora:root/Islandora%20Top-Level%20Collection', $ingest_form, 'Next'); // Required fields are file location, dc:title and dc:description $ingest_form_step_2 = array(); $ingest_form_step_2['dc:title'] = $this->randomName(32); @@ -108,7 +107,7 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { $pageContent = $this->drupalGet('admin/settings/fedora_repository'); $hasOption = preg_match('/Enforce namespace restrictions/', $pageContent); - + if (!$hasOption) { $this->pass('Removal of namespace restrictions is disabled'); } @@ -145,7 +144,7 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { return $matches[1]; } - private function outputScreenContents($description = "Screen contents", $basename = 'Fedora Repository') { + private function outputScreenContents($description = "Screen contents", $basename = 'Digital Repository') { // This is a hack to get a directory that won't be cleaned up by SimpleTest. $file_dir = file_directory_path() . '../simpletest_output_pages'; if (!is_dir($file_dir)) { @@ -153,7 +152,7 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { } $output_path = "$file_dir/$basename." . $this->randomName(10) . '.html'; $rv = file_put_contents($output_path, $this->drupalGetContent()); - $this->pass("$description: Contents of result page are " . l('here', $output_path)); + $this->pass("$description: Contents of result page are " . l(t('here'), $output_path)); } protected function drupalCreateFedoraUser($permissions = array('access comments', 'access content', 'post comments', 'post comments without approval')) { diff --git a/xsl/convertQDC.xsl b/xsl/convertQDC.xsl index e7e0d627..5d881e35 100644 --- a/xsl/convertQDC.xsl +++ b/xsl/convertQDC.xsl @@ -12,16 +12,16 @@

      MetaData

      - + - +
      - = + =
      - Find Similar by {$FIELD} +
      diff --git a/ilives/xsl/MODS3-22simpleDC.xsl b/xsl/mods_to_dc.xsl similarity index 87% rename from ilives/xsl/MODS3-22simpleDC.xsl rename to xsl/mods_to_dc.xsl index 4a4eff8d..ffad541d 100644 --- a/ilives/xsl/MODS3-22simpleDC.xsl +++ b/xsl/mods_to_dc.xsl @@ -1,409 +1,439 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - : - - - - . - - - - . - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Collection - - - DataSet - - - Service - - - Software - - - Image - - - InteractiveResource - - - MovingImage - - - PhysicalObject - - - Sound - - - StillImage - - - Text - - - Text - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - , - - - - , - - - - - ( - - ) - - - ( - - ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + :67 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + : + + + + + + . + + + + . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- + + + + + -- + + + + + + + + + + + + + + + + + + + + + + + + + + -- + + + + + + + + + + + + + + + + - + + + + + + + + + + -- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Collection + + + DataSet + + + Service + + + + Software + + + Image + + + + InteractiveResource + + + MovingImage + + + PhysicalObject + + + + Sound + + + StillImage + + + + Text + + + Text + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + : + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- + + + + + + + + + + + + + -- + + + + + + + + + + + + + + + + + + + + + + + + , + + + + + , + + + + + ( + + + ) + + + ( + + ) + + + + + + + + + + - + + + + + + - + + + + + + + + + + + + + diff --git a/xsl/sparql_to_html.xsl b/xsl/sparql_to_html.xsl index 0c037f3e..c5974403 100644 --- a/xsl/sparql_to_html.xsl +++ b/xsl/sparql_to_html.xsl @@ -1,247 +1,182 @@ - - - - - - - - - - - - - + + + + + + + + - - - - - + + + +
      - - - - -
      -
      + +

      + +
      +
      - - -
      - -
      - -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /fedora/repository//-/ - - - - /fedora/repository//-/ - - - - - - - - - - /fedora/repository//TN - - - -
      - - - - - - - - - - - - - -
      - - -   - - - - - - - - - - +
      [[ + + /fedora/repository//-/ + + DETAILS + ]] + --> - - + + + + + + +
      - - - + + +   + + + + + + - - - - - - - - - - - - - -
      \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + +