$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
* * 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 = ""){
@ -68,8 +68,8 @@ function fedora_repository_requirements($phase) {
// Check for ImageMagick
// Check for ImageMagick
$requirements['fedora-imagemagick']['title'] = t("ImageMagick convert in \$PATH");
$requirements['fedora-imagemagick']['title'] = t("ImageMagick convert in \$PATH");
system('which convert', $res);
$result = exec('convert');
if ($res != 0) {
if (!$result) {
$requirements['fedora-imagemagick']['value'] = t('Not in $PATH');
$requirements['fedora-imagemagick']['value'] = t('Not in $PATH');
$requirements['fedora-imagemagick']['description'] = t('Islandora will not be able to create thumbnails. Ensure that <a href="www.imagemagick.org/">ImageMagick</a> is installed and the convert command is executable by the web server user.');
$requirements['fedora-imagemagick']['description'] = t('Islandora will not be able to create thumbnails. Ensure that <a href="www.imagemagick.org/">ImageMagick</a> is installed and the convert command is executable by the web server user.');
@ -80,8 +80,8 @@ function fedora_repository_requirements($phase) {
}
}
$requirements['fedora-kakadu']['title'] = 'Kakadu kdu_compress in $PATH';
$requirements['fedora-kakadu']['title'] = 'Kakadu kdu_compress in $PATH';
system('which kdu_compress', $kdu_res);
$kdu_res = exec('kdu_compress -v');
if ($kdu_res != 0) {
if (!$kdu_res) {
$requirements['fedora-kakadu']['value'] = ('Not in $PATH');
$requirements['fedora-kakadu']['value'] = ('Not in $PATH');
$requirements['fedora-kakadu']['description'] = t('Islandora cannot convert TIFF image files to JPEG2000 format. Ensure <a href="http://www.kakadusoftware.com/">Kakadu</a> is installed and the kdu_compress command is executable by the web server user.');
$requirements['fedora-kakadu']['description'] = t('Islandora cannot convert TIFF image files to JPEG2000 format. Ensure <a href="http://www.kakadusoftware.com/">Kakadu</a> is installed and the kdu_compress command is executable by the web server user.');
$_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 ' .
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) {
@ -854,13 +871,11 @@ 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>'
@ -1908,9 +1941,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)
);
);
}
}
@ -1926,7 +1959,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> ')
'#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.