$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('', 'searchToken', drupal_get_token('fedora_repository_advanced_search')); //token generated by Drupal, keeps tack of what tab etc we are on
$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('', 'searchUrl', url('search') . '/fedora_repository'); //needed in our xsl
function get_dissemination($service_definition_pid, $method_name, $parameters = array(), $as_of_date_time = null) {
function get_dissemination($service_definition_pid, $method_name, $parameters = array(), $as_of_date_time = null) {
$params = array(
$params = array(
'pid' => $this->pid,
'pid' => $this->pid,
@ -365,36 +370,36 @@ class Fedora_Item {
//}
//}
return $this->datastreams_list;
return $this->datastreams_list;
}
}
/**
/**
* * DatastreamControlGroup controlGroup - String restricted to the values of "X", "M", "R", or "E" (InlineXML,Managed Content,Redirect, or External Referenced).
* * DatastreamControlGroup controlGroup - String restricted to the values of "X", "M", "R", or "E" (InlineXML,Managed Content,Redirect, or External Referenced).
* String ID - The datastream ID (64 characters max).
* String ID - The datastream ID (64 characters max).
* String versionID - The ID of the most recent datastream version
* String versionID - The ID of the most recent datastream version
* String[] altIDs - Alternative IDs for the datastream, if any.
* String[] altIDs - Alternative IDs for the datastream, if any.
* String label - The Label of the datastream.
* String label - The Label of the datastream.
* boolean versionable - Whether the datastream is versionable.
* boolean versionable - Whether the datastream is versionable.
* String MIMEType - The mime-type for the datastream, if set.
* String MIMEType - The mime-type for the datastream, if set.
* String formatURI - The format uri for the datastream, if set.
* String formatURI - The format uri for the datastream, if set.
* String createDate - The date the first version of the datastream was created.
* String createDate - The date the first version of the datastream was created.
* long size - The size of the datastream in Fedora. Only valid for inline XML metadata and managed content datastreams.
* long size - The size of the datastream in Fedora. Only valid for inline XML metadata and managed content datastreams.
* String state - The state of the datastream. Will be "A" (active), "I" (inactive) or "D" (deleted).
* String state - The state of the datastream. Will be "A" (active), "I" (inactive) or "D" (deleted).
* String location - If the datastream is an external reference or redirect, the url to the contents. TODO: Managed?
* String location - If the datastream is an external reference or redirect, the url to the contents. TODO: Managed?
* String checksumType - The algorithm used to compute the checksum. One of "DEFAULT", "DISABLED", "MD5", "SHA-1", "SHA-256", "SHA-385", "SHA-512".
* String checksumType - The algorithm used to compute the checksum. One of "DEFAULT", "DISABLED", "MD5", "SHA-1", "SHA-256", "SHA-385", "SHA-512".
* String checksum - The value of the checksum represented as a hexadecimal string.
* String checksum - The value of the checksum represented as a hexadecimal string.
*
*
* @param string $dsid
* @param string $dsid
* @return datastream object
* @return datastream object
* get the mimetype size etc. in one shot. instead of iterating throught the datastream list for what we need
* 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 = ""){
$_SESSION['fedora_ingest_files'] = ''; //empty this variable
$_SESSION['fedora_ingest_files'] = ''; //empty this variable
@ -203,10 +203,11 @@ function fedora_repository_ingest_form_validate($form, &$form_state) {
if (!empty($file)) {
if (!empty($file)) {
if (!in_array($dformat, $allowedMimeTypes)) {
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 ' .
form_set_error('ingest-file-location', t('The uploaded file\'s mimetype (' . $dformat . ') is not associated with this Content Model. The allowed types are ' .
// 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
@ -370,9 +371,9 @@ function add_stream_form_validate($form, &$form_state) {
drupal_set_message('The Fedora repository server is currently unavailable. Please contact the site administrator.', 'warning', FALSE);
drupal_set_message('The Fedora repository server is currently unavailable. Please contact the site administrator.', 'warning', FALSE);
return '';
return '';
}
}
if ($pid &!validPid($pid)) {
if ($pid &!validPid($pid)) {
drupal_set_message(t("Invalid PID!"), 'error');
drupal_set_message(t("Invalid PID!"), 'error');
return ' ';
return ' ';
}
}
if ($dsId &!validDsid($dsId)) {
if ($dsId &!validDsid($dsId)) {
drupal_set_message(t("Invalid dsID!"), 'error');
drupal_set_message(t("Invalid dsID!"), 'error');
return ' ';
return ' ';
}
}
if (!fedora_repository_access(OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, $pid, $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');
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');
if (!fedora_repository_access(OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, $pid, $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');
}
return ' ';
return ' ';
}
}
if ($pid == NULL) {
if ($pid == NULL) {
@ -823,15 +840,13 @@ function repository_service($pid = NULL, $servicePid = NULL, $serviceMethod = NU
'#value' => '<p>If you install the '.l('fedora demo objects', 'https://wiki.duraspace.org/display/FCR30/Demonstration+Objects').' Islandora can display them as a collection.</p>'
'#value' => '<p>If you install the '.l('fedora demo objects', 'https://wiki.duraspace.org/display/FCR30/Demonstration+Objects').' Islandora can display them as a collection.</p>'
@ -1700,9 +1732,9 @@ function theme_add_to_basket_link($pid, $type = 'object') {
*/
*/
if (!_is_added_to_basket($pid)) {
if (!_is_added_to_basket($pid)) {
return l(
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))),
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,
"fedora/repository/addToBasket/" . $path,
array('html' => TRUE)
array('html' => TRUE)
);
);
}
}
@ -1718,7 +1750,8 @@ function fedora_repository_display_schema($file) {
'#description' => t('The URL to use for REST-type connections'),
'#description' => t('The URL to use for REST-type connections'),
'#required' => TRUE,
'#required' => TRUE,
'#weight' => 0,
'#weight' => 0,
);
);
$form['fedora_soap_manage_url'] = array(
$form['fedora_soap_manage_url'] = array(
'#type' => 'textfield',
'#type' => 'textfield',
'#title' => t('Fedora SOAP management URL'),
'#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'),
'#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,
'#required' => TRUE,
'#weight' => 0
'#weight' => 0
);
);
$form['fedora_solr_search_url'] = array(
$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'),
'#description' => t('The PID namespaces that you are allowed to see from this Drupal install. In reality this can be more than a namespace as it could include demo:mydemos etc. Can be a space seperated list to include more than one PID namespace.'),
'#description' => t('A space separated list PID namespaces that users are permitted to access from this Drupal installation. <br/> This could be more than a simple namespace ie demo:mydemos.'),
'#required' => TRUE,
'#weight' => 0
'#weight' => 0
);
/*
$form['fedora_admin_user'] = array(
'#type' => 'textfield',
'#title' => t('A user with the Drupal role administrator'),
'#description' => t('A user with the administrator role. This is the user the Islandora module will use when admin access is needed for a task, such as creating a collection object for a new user.'),
'#required' => TRUE, '#weight' => 0
);
);
}
$form['fedora_searchterms_location'] = array(
else {
'#type' => 'file',
$form['fedora_pids_allowed'] = array(
'#title' => 'SearchTerms.xml file location',
'#type' => 'textfield',
'#title' => t('PID namespaces allowed in this Drupal install'),
'#description' => t('A space separated list PID namespaces that users are permitted to access from this Drupal installation. <br/> This could be more than a simple namespace ie demo:mydemos.'),
'#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.'),
'#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.'),
'#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.')),
'#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.'),
'#description' => t('Determines when to display the object (or collection) title when viewing an object/collection page.'),
'#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.')),
'#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.'),
'#description' => t('Determines when to display the default object (or collection) description fieldset when viewing an object/collection page.'),
'#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).'),
'#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(
$form['fedora_collection_display_list'] = array(
'#type' => 'select',
'#type' => 'select',
'#title' => t('Display Collection List Behaviour'),
'#title' => t('Display Collection List Behaviour'),
'#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.')),
'#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.'),
'#description' => t('Determines when to display the list of objects when viewing a collection page.'),
'#title' => t('Ingest digital object into collection_pid !collection_label Step #1', array('collection_pid' => $collection_pid, '!collection_label' => $collection_label))
'#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
$form['indicator']['models'] = array(// content models available
'#type' => 'select',
'#type' => 'select',
'#title' => t('Content models available'),
'#title' => t('Content models available'),
'#options' => $modelsForForm,
'#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 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.<br/> Additional information may be found <ahref="https://wiki.duraspace.org/display/FEDORACREATE/Content+Models+Overview">here.</a> ')
'#description' => t('Content models define datastream composition, relationships between this and other content models, and the mandatory behaviors associated with each digital object.<br/> Additional information may be found <ahref="https://wiki.duraspace.org/display/FEDORACREATE/Content+Models+Overview">here.</a> ')
);
);
break;
break;
@ -578,22 +536,22 @@ class formClass {
}
}
$form['collection_pid'] = array(
$form['collection_pid'] = array(
'#type' => 'hidden',
'#type' => 'hidden',
'#value' => $collection_pid
'#value' => $collection_pid
);
);
if ($form_state['storage']['step'] <2){
if ($form_state['storage']['step'] <2){
$button_name = t('Next');
$button_name = t('Next');
}
}
else {
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.<br/>');
$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.<br/>');
'#description' => t('Datastream IDs defined by the content model.'),
'#description' => t('Datastream IDs defined by the content model.'),
);
);
$form['stream_id']['#options'] = $dsidsForForm;
$form['stream_id']['#options'] = $dsidsForForm;
}
}
else {
else {
$form['stream_id'] = array(
$form['stream_id'] = array(
'#title' => 'Datastream ID',
'#title' => 'Datastream ID',
'#required' => 'TRUE',
'#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.'),
'#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.'),
if (!in_array($default_value, $options) && $isRestricted) {
drupal_set_message( "The value last set here ($default_value) is not in the list of available PID namespaces (perhaps it has changed?). Please choose a valid option from the list.", 'warning' );
drupal_set_message( "The value last set here ($default_value) is not in the list of available PID namespaces (perhaps it has changed?). Please choose a valid option from the list.", 'warning' );
$this->assertText('mimetype (application/pdf) is not associated with this Content Model', 'PDF mime type not accepted in collection content model.', 'message');
$this->outputScreenContents('Initial ingest form submit step 2', 'fedora_repository');
$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.