====== Custom Book and Page TABS ====== * Edit ''sites/all/modules/islandora_solution_pack_book/tocnr_book.inc'' pid = $pid; $this->item = new Fedora_Item($pid); } } public function showFieldSets() { module_load_include('inc', 'fedora_repository', 'plugins/tagging_form'); module_load_include('inc', 'fedora_repository', 'plugins/DarwinCore'); module_load_include('module', 'islandora_book'); global $base_url; $show_purge_tab = (!empty($_POST['form_id']) && ($_POST['form_id'] == 'islandora_book_purge_pages_form')); $first_page = new Fedora_Item($this->pid . '-0001'); $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 . '/islandora:viewerSdef/getViewer' . $qs; $html = ''; $pages_selected = FALSE; $pagina_selected = FALSE; $libro_selected = FALSE; if ($hasPage) { $libropid = $this->pid; $paginapid = $this->pid . '-0001'; $numeropagina = '0001'; $libro_selected = TRUE; } else { $libropid = substr($this->pid, 0, -5); $paginapid = $this->pid; $numeropagina = substr($this->pid, -4); $pagina_selected = TRUE; } $size = 20; $page_number = floor(($numeropagina - 1) / $size) + 1; $qstring = $_GET['q']; $qparts = explode('/', $qstring); $tail = end($qparts); if (is_numeric($tail)) { $pages_selected = TRUE; $pagina_selected = FALSE; $libro_selected = FALSE; $page_number = $tail; } $class = new CollectionClass(); // grow default (1000) risearch limit to 2000 $results = $class->getRelatedItems($libropid,NULL,2000); $page_items = $class->renderCollection($results, $paginapid, NULL, NULL, $page_number); $book_contenuto = islandora_book_create_book_view($libropid); $titololibro = substr(strstr(strstr($book_contenuto, "title"), "creator", TRUE), 31); drupal_set_title("$titololibro"); $stringhe = islandora_book_create_book_index($libropid); $indice_html = $stringhe[0]; $colleinfo_html = $stringhe[1]; $bookinfo_html = $stringhe[2]; $tabset['1'] = array( // #type and #title are the minimum requirements. '#type' => 'tabpage', '#title' => 'BOOK', '#content' => $book_contenuto, '#selected' => $libro_selected, '#weight' => '1',); $tabset['2'] = array('#type' => 'tabpage', '#title' => t('Read'), '#content' => $html, '#weight' => '2',); $tabset['3'] = array( // #type and #title are the minimum requirements. '#type' => 'tabpage', '#title' => 'Index', // '#content' => islandora_book_create_book_index($libropid), '#content' => $indice_html, '#weight' => '3',); $tabset['4'] = array('#type' => 'tabpage', '#title' => t('Pages'), '#selected' => $pages_selected, '#content' => $page_items, '#weight' => '4',); $tabset['5'] = array('#type' => 'tabpage', '#title' => 'PAGE ' . substr($paginapid, -4), '#content' => islandora_book_create_book_view($paginapid), '#selected' => $pagina_selected, '#weight' => '5',); $tabset['6'] = array('#type' => 'tabpage', '#title' => 'Book info', '#content' => $bookinfo_html, '#weight' => '6',); $tabset['7'] = array('#type' => 'tabpage', '#title' => 'Collection info', '#content' => $colleinfo_html, '#weight' => '7',); return $tabset; } } * Edit ''sites/all/modules/islandora_solution_pack_book/xsl/tocnr_book_view.xsl'' 
fedora/repository//TN

Dublin Core - MetaData

=

Download

Full PDF PDF
Hi-Res IMAGE TIFF
Only Low-Res available due to restricted rights
Low-Res IMAGE JPEG
TEXT TXT
* Edit ''sites/all/modules/islandora_solution_pack_book/islandora_book.module'' Tip function islandora_book_create_book_index($pid, $query = NULL) { global $user; module_load_include('inc', 'fedora_repository', 'ObjectHelper'); $path = drupal_get_path('module', 'islandora_book'); $objectHelper = new ObjectHelper; $rels_xml = $objectHelper->getStream($pid, 'RELS-EXT'); $simpleRELSxml = simplexml_load_string($rels_xml); $modello = $simpleRELSxml->xpath('//rdf:RDF/rdf:Description/fedora-model:hasModel/@rdf:resource'); $parentcolle = $simpleRELSxml->xpath('//rdf:RDF/rdf:Description/fedora:isMemberOfCollection/@rdf:resource'); $modello = $modello[0]; $parentcolle = explode('/', $parentcolle[0]); $parentcolle = $parentcolle[1]; if ($modello == 'info:fedora/islandora:bookCModel') { $index_html = $objectHelper->getStream($pid, 'INDEX'); $ix_html = $objectHelper->getStream($pid, 'INDEX'); $piddelbook = $pid; if (!$index_html) { drupal_set_message(t('Object does not exist.'), 'error'); return ''; } } else { $piddelbook = substr($pid, 0, -5); $index_html = $objectHelper->getStream($piddelbook, 'INDEX'); $ix_html = $objectHelper->getStream($piddelbook, 'INDEX'); if (!$index_html) { drupal_set_message(t('Object does not exist.'), 'error'); return ''; } } $str_html = ""; $str_html = $str_html . "
"; $str_html = $str_html . ""; $str_html = $str_html . "
"; $str_html = $str_html . ""; $elenco = explode("||", $ix_html); $nvoci = sizeof($elenco); $voce = explode("|", $elenco[0]); $str_html = $str_html . ""; $i = 1; while ($i < $nvoci) { $voce = explode("|", $elenco[$i]); $str_html = $str_html . ""; $i++; } $str_html = $str_html . "

Index

" . $voce[1] . "
"; $str_html = $str_html . "
" . $voce[1]; $numpa = substr($voce[0], -4); $str_html = $str_html . "page " . intval($numpa) . "
"; $strs[0] = $str_html; $colleinfo_html = $objectHelper->getStream($parentcolle, 'INFO'); $strs[1] = $colleinfo_html; $bookinfo_html = $objectHelper->getStream($pid, 'INFO'); $strs[2] = $bookinfo_html; return $strs; }
... * Edit ''sites/all/modules/islandora-github/ObjectHelper.inc '' to allow object_download of dissemination methods Tip /** * 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. * * @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; module_load_include('inc', 'fedora_repository', 'ContentModel'); if ($pid == NULL || $dsID == NULL) { drupal_set_message(t("no pid or dsid given to create an object with"), 'error'); return ' '; } $headers = module_invoke_all('file_download', "/fedora/repository/$pid/$dsID"); if (in_array(-1, $headers)) { drupal_set_message(t('hello')); drupal_access_denied(); return ' '; } if (!fedora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { drupal_set_message(t("You do not have access Fedora objects within the attempted namespace."), 'error'); drupal_access_denied(); return ' '; } if (variable_get('fedora_object_restrict_datastreams', FALSE) == TRUE) { if (($cm = ContentModel::loadFromObject($pid)) == FALSE) { drupal_set_message(t("You do not have access to objects without an Islandora Content Model."), 'error'); drupal_access_denied(); return ' '; } $cmDatastreams = $cm->listDatastreams(); if (!((isset($user) && in_array('administrator', $user->roles)) || in_array($dsID, $cmDatastreams))) { drupal_set_message(t("You do not have access to the specified datastream."), 'error'); drupal_access_denied(); return ' '; } } module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $item = new Fedora_Item($pid); if (isset($item->datastreams[$dsID])) { $mimeType = $item->datastreams[$dsID]['MIMEType']; if ($label == NULL) { $label = $item->datastreams[$dsID]['label']; } } else if ($dsID == "openbess:jpgldSdef") { $mimeType = "image/jpeg"; } else { drupal_not_found(); exit(); } if ((!isset($user)) || $user->uid == 0) { $fedoraUser = 'anonymous'; $fedoraPass = 'anonymous'; $contentSize = 0; } else { $fedoraUser = $user->name; $fedoraPass = $user->pass; $dataStreamInfo = $item->get_datastream_info($dsID); $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'; } if ($dsID == "openbess:jpgldSdef") { $url = variable_get('fedora_base_url', 'http://localhost:8080/fedora') . '/get/' . $pid . '/openbess:jpgldSdef/getJpgLD'; } else { $url = variable_get('fedora_base_url', 'http://localhost:8080/fedora') . '/get/' . $pid . '/' . $dsID; } if ($version) { $url .= '/' . $version; //drupal_urlencode($version); } $ch = curl_init(); $user_agent = "Mozilla/4.0 pp(compatible; MSIE 5.01; Windows NT 5.0)"; curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_FAILONERROR, 1); // Fail on errors curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects //curl_setopt($ch, CURLOPT_TIMEOUT, 15); // times out after 15s curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); curl_setopt($ch, CURLOPT_URL, $url); 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_URL, $url); if ($filePath !== FALSE) { $fp = fopen($filePath, 'w'); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); fclose($fp); } else { header("Content-type: $mimeType"); if (($contentSize > 0) && ($dsID != "openbess:jpgldSdef")) { 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"; } header('Content-Disposition: attachment; filename="' . $suggestedFileName . '"'); } if ((isset($user) && $user->uid != 0) || $forceSoap || isset($_SERVER['HTTPS'])) { curl_exec($ch); } else { header('Location: ' . $url); } } curl_close($ch); } else { drupal_set_message(t('No curl support.'), 'error'); } } ...