function createFedoraDataStreams($form_values, &$dom, &$rootElement)
 {
     module_load_include('php', 'Fedora_Repository', 'mimetype');
     global $base_url;
     $mimetype = new mimetype();
     $server = null;
     $file = $form_values['ingest-file-location'];
     $dformat = $mimetype->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);
 }
Esempio n. 2
0
/**
 * Add custom PHPTemplate variable into the page template
 */
function ninesixtyrobots_preprocess_page(&$vars)
{
    // Check if the theme is using Twitter.
    $use_twitter = theme_get_setting('use_twitter');
    if (is_null($use_twitter)) {
        $use_twitter = 1;
    }
    // If the theme uses Twitter pull it in and display it in the slogan.
    if ($use_twitter) {
        if ($cache = cache_get('ninesixtyrobots_tweets')) {
            $data = $cache->data;
        } else {
            $query = theme_get_setting('twitter_search_term');
            if (is_null($query)) {
                $query = 'lullabot';
            }
            $query = drupal_urlencode($query);
            $response = drupal_http_request('http://search.twitter.com/search.json?q=' . $query);
            if ($response->code == 200) {
                $data = json_decode($response->data);
                // Set a 5 minute cache on retrieving tweets.
                // Note if this isn't updating on your site *run cron*.
                cache_set('ninesixtyrobots_tweets', $data, 'cache', 300);
            }
        }
        $tweet = $data->results[array_rand($data->results)];
        // Create the actual variable finally.
        $vars['site_slogan'] = check_plain(html_entity_decode($tweet->text));
    }
}
Esempio n. 3
0
 function createFedoraDataStreams($form_values, &$dom, &$rootElement)
 {
     module_load_include('php', 'Fedora_Repository', 'mimetype');
     global $base_url;
     $mimetype = new mimetype();
     $server = null;
     $file = $form_values['ingest-file-location'];
     if (!empty($file)) {
         $dformat = $mimetype->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);
         }
     }
 }
Esempio n. 4
0
 function createFedoraDataStreams($form_values, &$dom, &$rootElement)
 {
     module_load_include('php', 'Fedora_Repository', 'mimetype');
     global $base_url;
     $mimetype = new mimetype();
     $server = null;
     $file = $form_values['ingest-file-location'];
     $dformat = $mimetype->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);
 }
Esempio n. 5
0
 function getTerms($fieldName, $startTerm, $displayName = null)
 {
     module_load_include('php', 'Fedora_Repository', 'ObjectHelper');
     module_load_include('inc', 'Fedora_Repository', 'api/fedora_utils');
     $indexName = variable_get('fedora_index_name', 'DemoOnLucene');
     $searchUrl = variable_get('fedora_fgsearch_url', 'http://localhost:8080/fedoragsearch/rest');
     if ($startTerm == null) {
         $startTerm = "";
     }
     $startTerm = drupal_urlencode($startTerm);
     $query = 'operation=browseIndex&startTerm=' . $startTerm . '&fieldName=' . $fieldName . '&termPageSize=20&indexName=' . $indexName . '&restXslt=copyXml&resultPageXslt=copyXml';
     //$query=drupal_urlencode($query);
     $query = '?' . $query;
     $searchString = $searchUrl . $query;
     $objectHelper = new ObjectHelper();
     $resultData = do_curl($searchString, 1);
     $path = drupal_get_path('module', 'Fedora_Repository');
     $output .= $this->applySpecifiedXSLT($resultData, $path . '/xsl/browseIndexToResultPage.xslt', $displayName);
     //$output .= '<br />'.$alpha_out;
     return $output;
 }
Esempio n. 6
0
function _multifacet_full_record_vufind($doc)
{
    global $_multifacet_do_gbooks;
    $js = "var Drupal_base_path = '" . base_path() . "';";
    drupal_add_js($js, 'inline');
    drupal_add_js(drupal_get_path('module', 'multifacet') . '/jquery.multifacet.js');
    drupal_add_css(drupal_get_path('module', 'multifacet') . '/multifacet.css');
    drupal_set_title($doc->titleStr);
    //$output .= $doc->display_title;
    $output .= '<div>';
    if ($_multifacet_do_gbooks) {
        $output .= '
    <script type="text/javascript">
    $(document).ready(function(){
      var gbooks = $("a.multifacet_gbook");
      var gbooks_query = "";
      if (gbooks.length) {

        for ( var i = 0; i < gbooks.length; i++) {
          if ( gbooks_query) {
            gbooks_query += ",";
          }
          gbooks_query += gbooks[i].id;
        }
        
        $("body").append("<script type=\'text/javascript\' src=\'http://books.google.com/books?jscmd=viewapi&bibkeys=" + gbooks_query + "&callback=ProcessGBSBookInfo\'><\\/script>");
      }
    });
    </script>
    ';
    }
    $output .= '<div style="float: right; clear: right; margin: 10px;">';
    if (isset($doc->id)) {
        $doc->id = preg_replace('/\\s/', '', $doc->id);
        $doc->id = preg_replace('/^ocm/', '', $doc->id);
        $doc->id = preg_replace('/^ocn/', '', $doc->id);
        $output .= multifacet_gbooks_template("OCLC:" . $doc->id);
    } elseif (isset($doc->isn)) {
        $output .= multifacet_gbooks_template("ISBN:" . $doc->isn[0]);
    } elseif (isset($doc->national_control_number)) {
        $output .= multifacet_gbooks_template("LCCN:" . $doc->national_control_number[0]);
    }
    $output .= '</div>';
    $output .= '<table class="multifacet_record_details">';
    if (isset($doc->mainheading)) {
        $output .= '<tr><th>' . t("Main Author: ") . '</th><td>';
        $i = 0;
        foreach ($doc->mainheading as $mainheading) {
            if ($i) {
                $output .= "<br />";
            }
            $output .= '<a href="' . base_path() . 'search/multifacet/' . drupal_urlencode('"' . $mainheading . '"') . '&amp;field=author">' . check_plain($mainheading) . '</a>';
            $i++;
        }
        $output .= '</td></tr>';
    }
    // don't show if authors is exact same as mainheading
    if (isset($doc->authors) && $doc->authors != $doc->mainheading) {
        $output .= '<tr><th>' . t("Other Authors: ") . '</th><td>';
        $i = 0;
        foreach ($doc->authors as $author) {
            // hide any that are already show as mainheadings
            if (!@in_array($author, $doc->mainheading)) {
                if ($i) {
                    $output .= ", ";
                }
                $output .= '<a href="' . base_path() . 'search/multifacet/' . drupal_urlencode('"' . $author . '"') . '&amp;field=author">' . check_plain($author) . '</a>';
                $i++;
            }
        }
        $output .= '</td></tr>';
    }
    if (isset($doc->formats)) {
        $output .= '<tr><th>' . t("Formats: ") . '</th><td>';
        $i = 0;
        foreach ($doc->formats as $format) {
            if ($i) {
                $output .= ", ";
            }
            $output .= _multifacet_map_facet_values('formats', check_plain($format));
            $i++;
        }
        $output .= '</td></tr>';
    }
    if (isset($doc->composed_mattype)) {
        $output .= '<tr><th>' . t("Material Type: ") . '</th><td>' . _multifacet_map_facet_values('composed_mattype', check_plain($doc->composed_mattype)) . '</td></tr>';
    }
    if (isset($doc->languages)) {
        $output .= '<tr><th>' . t("Language: ") . '</th><td>' . check_plain(implode(", ", $doc->languages)) . '</td></tr>';
    }
    if (isset($doc->imprint)) {
        $output .= '<tr><th>' . t("Published: ") . '</th><td>' . check_plain(implode('<br />', $doc->imprint)) . '</td></tr>';
    }
    if (isset($doc->series_traced)) {
        $output .= '<tr><th>' . t("Series: ") . '</th><td>';
        $i = 0;
        foreach ($doc->series_traced as $series) {
            if ($i) {
                $output .= "<br />";
            }
            $series_info = explode("\t", $series);
            $output .= '<a href="' . base_path() . 'search/multifacet/' . drupal_urlencode($series_info[0]) . '&amp;field=keyword">' . check_plain($series_info[0]) . '</a>';
            $i++;
        }
        $output .= '</td></tr>';
    }
    if (isset($doc->subjects)) {
        $output .= '<tr><th>' . t("Subjects: ") . '</th><td>';
        $i = 0;
        foreach ($doc->subjects as $subject) {
            if ($i) {
                $output .= "<br />";
            }
            $output .= '<a href="' . base_path() . 'search/multifacet/' . drupal_urlencode('"' . $subject . '"') . '&amp;field=subject">' . check_plain($subject) . '</a>';
            $i++;
        }
        $output .= '</td></tr>';
    }
    if (isset($doc->urls)) {
        $output .= '<tr><th>' . t("Online Access: ") . '</th><td>';
        $i = 0;
        foreach ($doc->urls as $url) {
            $url_info = explode("\t", $url);
            if ($i) {
                $output .= "<br />";
            }
            $output .= '<a href="' . $url . '">' . check_plain($url) . '</a>';
            $i++;
        }
        $output .= '</td></tr>';
    }
    if (isset($doc->item_callnumber)) {
        $output .= '<tr><th>' . t("Call Number: ") . '</th><td>';
        $i = 0;
        foreach ($doc->item_callnumber as $item_callnumber) {
            if ($i) {
                $output .= "<br />";
            }
            $output .= check_plain($item_callnumber);
            $i++;
        }
        $output .= '</td></tr>';
    }
    if (isset($doc->lc_class)) {
        $output .= '<tr><th>' . t("LC Classification: ") . '</th><td>';
        $i = 0;
        foreach ($doc->lc_class as $lc_class) {
            if ($i) {
                $output .= ", ";
            }
            $output .= '<a href="' . base_path() . 'search/multifacet/*&field=keyword&keep_f=1&fn[]=lc_class&fv[]=' . drupal_urlencode($lc_class) . '">' . check_plain($lc_class) . '</a>';
            $i++;
        }
        $output .= '</td></tr>';
    }
    if (isset($doc->extent)) {
        $output .= '<tr><th>' . t("Physical Description: ") . '</th><td>';
        $i = 0;
        foreach ($doc->extent as $extent) {
            if ($i) {
                $output .= "<br />";
            }
            $output .= check_plain($extent);
            $i++;
        }
        $output .= '</td></tr>';
    }
    if (isset($doc->notes_public)) {
        $output .= '<tr><th>' . t("Notes: ") . '</th><td>';
        $i = 0;
        foreach ($doc->notes_public as $notes_public) {
            if ($i) {
                $output .= "<br />";
            }
            $output .= check_plain($notes_public);
            $i++;
        }
        $output .= '</td></tr>';
    }
    /*
    if ( $doc->source = 'mu-innopac') {
      $output .= '<tr><th>' . t("Other Options: ")
        . '</th><td><a target="_blank" class="external" 
        style="margin-right: 15px;" href="http://holmes.lib.muohio.edu/record=' 
        . drupal_urlencode(substr($doc->$solrpac_unique_key, 5)) . '">' 
        . t('Classic View') . '</a>';
      $output .= '<a target="_blank" class="external" style="margin-right: 15px;"
        href="http://olc1.ohiolink.edu/search/z?' 
        . drupal_urlencode(str_replace("gb", "g b", $doc->$solrpac_unique_key)) 
        . '">' . t('OhioLINK') . '</a>';
    
      if (isset($doc->id)) {
        $doc->id = preg_replace('/\s/', '', $doc->id);
        $doc->id = preg_replace('/^ocm/', '', $doc->id);
        $doc->id = preg_replace('/^ocn/', '', $doc->id);
        $output .= ' <a target="_blank" class="external"
          href="http://www.worldcat.org/search?q=' 
          . drupal_urlencode("no:" . $doc->id) . '">' . t( "Worldcat") 
          . '</a>';
      }
     
      $output .= '</td></tr>';
    
    }
    */
    $output .= '</table></div>';
    return $output;
}
Esempio n. 7
0
function bookmark(){   //<span class="bookmarks" > print $bookmark; </span>
	global $user;
	global $base_url;	
	//if( ($user->uid == 1) || ( is_array($user->roles)  && in_array("Developer", $user->roles)  )    ){	
	$themepath = base_path() . path_to_theme().'/images';
	//$top = "<img src='$themepath/bkg_hook_top.png' alt='' title='' />";	
	$bookmark = "<img src='$themepath/icon_bookmark.png' alt='Bookmark' title='Bookmark' valign='bottom' width='24' height='23' />";
	$clipi = "<img src='$themepath/icon_clip_page.png' alt='Clip page' title='Clip page' valign='bottom' width='22' height='19'  />";
	$sep = "<div class='sep' ></div>";
	if(!$user->uid){ 	
		if( arg(0) == 'library' &&  (arg(1) == 'hadith' ||  arg(1) == 'quran' )  ){
			if (  arg(2) != 'prophet' && arg(2) != 'subject' && arg(2) != 'narratorindex' && arg(2) != 'narrator' && arg(2) != 'page' && arg(2) != 'structure' && arg(2) != 'duas'
			&& arg(3) != 'theme'   ){
			
			$clip = $sep.'<span class="clip" ><a  class="rpxnow"  onclick="return false;" href="https://alim.rpxnow.com/openid/v2/signin?token_url='.$base_url.'/rpx/end_point" title="Clip" >'.$clipi.'</a></span>';
			}
		}
		
		$log = '<div id="bookmark-right-menu" ><div class="top" ></div><div class="middle" >'.$sep.'<span class="bookmarks" ><a  class="rpxnow"   onclick="return false;" href="https://alim.rpxnow.com/openid/v2/signin?token_url='.$base_url.'/rpx/end_point" title="Bookmark" >'.$bookmark.'</a></span>'.$clip.$sep.'</div><div class="bottom" ></div></div>'; 
		return $log; 
	}
	$path = drupal_urlencode(drupal_get_normal_path(drupal_get_path_alias($_GET['q'])));
	$query_variables = $_GET;
	unset($query_variables['q']);
	$query_string = '';
	foreach ($query_variables as $key => $value) {
		$query_string .= '&' . $key . '=' . $value;
	}
	
	if (!empty($path)) {
		if (!empty($query_string)) {
			$path .= '?' . $query_string;
		}
		
		
		$out = '<div id="bookmark-right-menu" ><div class="top" ></div><div class="middle" >'.$sep;
		$out .=  '<span class="bookmarks" ><a id="show-book-menu" href="#" title="Bookmark" >'.$bookmark.'</a></span>';
		if( arg(0) == 'library' &&  (arg(1) == 'hadith' ||  arg(1) == 'quran' )  ){
			if (  arg(2) != 'prophet' && arg(2) != 'subject' && arg(2) != 'narratorindex' && arg(2) != 'narrator' && arg(2) != 'page' && arg(2) != 'structure' && arg(2) != 'duas'
			&& arg(3) != 'theme'   ){
			$out .=  $sep.'<span class="clip" ><a id="show-clip-menu" href="#" title="clip" >'.$clipi.'</a></span>';
			}
		}
		$out .=   $sep.'</div><div class="bottom" ></div></div>';
		$out .= '<div id="popup-bookmark" style="display:none;" ><div class="mybookmark-inner" >';//print_r($query_variables);
		$out .= '<a href="#" class="mymenu" id="dialog-mymenu" title="View the list of bookmarked pages"  >My Bookmarks</a>';
		$out .= l('<nobr>Bookmark this page</nobr>', 'bookmarks/item/addpage/' . base64_encode($path), array('attributes' => array('id' => 'bookmarks_add' , 'class' => 'popups' , 'title' => 'Bookmark the current page / Add this page to My Bookmarks '  ) , 'html' => TRUE  ));
        $out .= l(t('Organize Bookmarks'), 'bookmarks/mine',array('attributes' => array(  'class' => 'org-bm' , 'id' => 'bm-org-bm' , 
		'title' => 'Organise book mark' ) )  );

		$out .=  l( t('Set Last'), 'bookmarks/lastpage/'.base64_encode($path) ,array('attributes' => array(  'class' => 'bm-last' , 'id' => 'bm-lastpage' , 
		'title' => 'Set this page as the last page you were reading so that you can return to it easily on your next visit to alim.org' ) )  );
		//$out .= '<em style="font-size:8px;"> </em>';
		//if(  isset($user->profile_last_read ) && $user->profile_last_read != ''  ) 
		$menuid1 = db_result(db_query("SELECT value as lpage FROM {profile_values} WHERE fid='%d' AND uid= '%d'", 12 , $user->uid ));
		if(  isset($menuid1) && $menuid1 != ''  ) 
		$out .=  '<span id="mark-lastpage" >'.l( t('Go to Last'), $menuid1 ,array('attributes' => array(  'class' => 'bm-golast' ,
		'title' => 'Go to the last place you were reading.'  ) )  ).'</span>';
		else
		$out .=  '<span id="mark-lastpage" >'.l( t('Al-Qur\'an'), 'library/quran/surah/arabic/1/ARB' ,array('attributes' => array(  'class' => 'bm-golast' , 
		'title' => 'Go to the last place you were reading'  ) )  ).'</span>';			
		$out .=  '</div></div>';
		
		if( arg(0) == 'library' &&  (arg(1) == 'hadith' ||  arg(1) == 'quran' )   ){		
			if (  arg(2) != 'prophet' && arg(2) != 'subject' && arg(2) != 'narratorindex' && arg(2) != 'narrator' && arg(2) != 'page' && arg(2) != 'structure' && arg(2) != 'duas'
			&& arg(3) != 'theme'   ){			
				$out .= '<div id="popup-clip-menu" style="display:none;" ><div class="mybookmark-inner" >';		
				$out .= l('Clip this Page' , 'node/add/clippings' , array( 'attributes' => array('class' => 'popups pop-clip-one' , 'id' => 'clip-btn-all' ,
				'title' => 'Clip the whole page and save to your notebook') , 'html' => TRUE ) ); 		
				$out .= '<a class="pop-clip-two" href="#" title="Clip the selected text from this page" id="clip-btn-sel" >Clip the selected text</a>';
				$out .= '<a class="pop-clip-three"  href="/user/clippings" title="Go to my notebook"  >My NoteBook</a>';
				$out .= '</div></div>';
			}
		
		}
		$out .= '<div style="display:none" id="bm-nice-menu" >Loading....</div>';
		return $out;
	}
	
	return '';
	
	//}
	//return '';
	
}
 /**
  * Retrieve the URL of the repository viewer that displays the commit log
  * of the given item in the corresponding repository. If no such URL has been
  * specified by the user, the appropriate URL from the Commit Log module is
  * used as a fallback (if that module is enabled).
  *
  * @param $item
  *   The item whose log view URL should be retrieved.
  *
  * @return
  *   The item log view URL corresponding to the given arguments.
  *   An empty string is returned if no item log view URL has been defined
  *   (and if not even Commit Log is enabled), or if the item cannot be viewed
  *   for any reason.
  */
 public function getItemLogViewUrl(&$item)
 {
     $label = $item->getSelectedLabel();
     if (isset($label->type) && $label->type == VERSIONCONTROL_LABEL_BRANCH) {
         $current_branch = $label['name'];
     }
     if (!empty($this->urls['file_log_view'])) {
         if ($item->isFile()) {
             return strtr($this->urls['file_log_view'], array('%path' => $item->path, '%revision' => $item->revision, '%branch' => isset($current_branch) ? $current_branch : ''));
         }
         // The default URL backend doesn't do log view URLs for directory items:
         return '';
     } elseif (module_exists('commitlog')) {
         // fallback, as 'file_log_view' is empty
         $query = array('repos' => $item->repository->repo_id, 'paths' => drupal_urlencode($item->path));
         if (isset($current_branch)) {
             $query['branches'] = $current_branch;
         }
         return url('commitlog', array('query' => $query, 'absolute' => TRUE));
     }
     return '';
     // in case we really can't retrieve any sensible URL
 }
Esempio n. 9
0
 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'];
     $dformat = $mimetype->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);
         }
     }
 }
Esempio n. 10
0
 function url()
 {
     global $base_url;
     return $base_url . '/fedora/repository/' . $this->pid . (!empty($this->object_profile) ? '/-/' . drupal_urlencode($this->object_profile->objLabel) : '');
 }
Esempio n. 11
0
 function addStream($pid, $dsid, $fileObject, $xacmlOnly = false)
 {
     global $user;
     if (!fedora_repository_access(OBJECTHELPER::$ADD_FEDORA_STREAMS, $pid, $user) && !$xacmlOnly) {
         drupal_set_message('You do not have permission to add datastreams to this object!');
         return false;
     }
     global $base_url;
     module_load_include('php', 'Fedora_Repository', 'mimetype');
     module_load_include('php', 'Fedora_Repository', 'ConnectionHelper');
     $dsLabel = $fileObject->filename;
     $pathToModule = drupal_get_path('module', 'Fedora_Repository');
     $file = $fileObject->filepath;
     //$streamUrl = 'http://' . $_SERVER['HTTP_HOST'] .$base_url. $file;
     $streamUrl = str_replace("https", "http", $base_url) . '/' . drupal_urlencode($file);
     $mimetype = $fileObject->filemime;
     $controlGroup = "M";
     if ($mimetype == 'text/xml') {
         $controlGroup = 'X';
     }
     $params = array('pid' => $pid, 'dsID' => $dsid, 'altIDs' => "", 'dsLabel' => $dsLabel, 'versionable' => "true", 'MIMEType' => $mimetype, 'formatURI' => "URL", 'dsLocation' => $streamUrl, 'controlGroup' => "{$controlGroup}", 'dsState' => "A", 'checksumType' => "DISABLED", 'checksum' => "none", 'logMessage' => "datastream added");
     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 false;
         }
         $object = $client->__soapCall('addDatastream', array('parameters' => $params));
     } catch (exception $e) {
         drupal_set_message(t($e->getMessage()), 'error');
         return false;
     }
     unlink($fileObject->filepath);
     return true;
 }