Example #1
0
 /**
  * returns a list of data sources an organisational role has access to
  * @return [type] [description]
  */
 public function get_datasources()
 {
     $record_owner = $this->input->get('record_owner');
     $record_owner = rawurldecode($record_owner);
     if ($record_owner) {
         $this->load->model('data_source/data_sources', 'ds');
         $data_sources = $this->ds->getByAttribute('record_owner', $record_owner);
         if ($data_sources) {
             $response['status'] = 'OK';
             $response['numFound'] = sizeof($data_sources);
             $response['result'] = array();
             foreach ($data_sources as $ds) {
                 $response['result'][] = array('id' => $ds->id, 'key' => $ds->key, 'title' => $ds->title, 'registry_url' => registry_url('data_source/manage#!/view/' . $ds->id));
             }
         } else {
             $response['status'] = 'OK';
             $response['numFound'] = 0;
             $response['message'] = 'No data sources found';
         }
     } else {
         $response['status'] = 'WARNING';
         $response['message'] = 'Missing record_owner identifier';
     }
     formatResponse($response, 'json');
 }
Example #2
0
 function init()
 {
     $this->service_uri = $this->CI->config->item('gORCID_SERVICE_BASE_URI');
     $this->api_uri = $this->CI->config->item('gORCID_API_URI');
     $this->client_id = $this->CI->config->item('gORCID_CLIENT_ID');
     $this->client_secret = $this->CI->config->item('gORCID_CLIENT_SECRET');
     $this->redirect_uri = registry_url('orcid/auth');
 }
Example #3
0
 public function activityUpdatesBySubject($dryrun = false)
 {
     echo "<h3>Running Activity Tweet Update</h3><i>Date Started: " . date('r') . "</i>" . BR . BR;
     if ($dryrun == "true") {
         echo "<pre>RUNNING IN DRY-RUN MODE - NO ACTUAL TWEETS WILL BE SENT!!! Remove /true in the URL to run properly!</pre>";
     }
     // Setup our API access
     $this->load->library('twitter');
     $twitter = new Twitter(array('consumerKey' => $this->consumer_key, 'consumerSecret' => $this->consumer_secret));
     $twitter->setOAuthToken($this->oauth_access_token);
     $twitter->setOAuthTokenSecret($this->oauth_access_secret);
     // Go and get our activity information
     $service_url = registry_url('services/rda/getLatestActivityBySubject/' . $this->num_days_history);
     $data = @json_decode(@file_get_contents($service_url), true);
     if (!isset($data['results']) || count($data['results']) == 0) {
         echo "No activity information to be displayed. No updates matched the query at " . $service_url;
         return;
     } else {
         echo "<h4>Found " . count($data['results']) . " updates for the past " . $this->num_days_history . " days...</h4>";
         // Reverse the sort order so largest update counts come last (i.e. highest on the Twitter feed)
         krsort($data['results']);
         foreach ($data['results'] as $idx => $update) {
             try {
                 // Format our tweet message
                 $tweet = sprintf("%d %s added with the subject '%s' #ANZSRC%s", $update['num_records'], pluralise("collection", $update['num_records']), ellipsis($update['value']), $update['notation']);
                 echo "Sending Tweet: <i>" . $tweet . "</i>...";
                 flush();
                 if (!$dryrun) {
                     $twitter->statusesUpdate($tweet);
                     echo "sent " . BR;
                     flush();
                 }
                 sleep(0.5);
                 // Pause between big chunks of tweets
                 if ($idx % 5 == 0) {
                     sleep(5);
                 }
             } catch (TwitterException $e) {
                 echo BR . BR . "Unable to send Tweet to Twitter API: " . $e->getMessage() . BR . BR;
             } catch (Exception $e) {
                 echo BR . BR . "Unknown Exception: " . $e->getMessage() . BR . BR;
             }
         }
     }
     return;
 }
Example #4
0
 /**
  * REDIRECT URI set to this method, process the user and provide the relevant view
  * @return view 
  */
 function auth()
 {
     $this->load->library('Orcid_api', 'orcid');
     if ($this->input->get('code')) {
         $code = $this->input->get('code');
         $data = json_decode($this->orcid_api->oauth($code), true);
         if (isset($data['access_token'])) {
             $this->orcid_api->set_access_token($data['access_token']);
             $this->orcid_api->set_orcid_id($data['orcid']);
             $bio = $this->orcid_api->get_full();
             $bio = json_decode($bio, true);
             $orcid_id = $bio['orcid-profile']['orcid-identifier']['path'];
             $this->orcid_api->log($orcid_id);
             $this->wiz($bio);
         } else {
             if ($access_token = $this->orcid_api->get_access_token()) {
                 // var_dump($this->orcid_api->get_orcid_id());
                 $bio = $this->orcid_api->get_full();
                 if (!$bio) {
                     redirect(registry_url('orcid'));
                 }
                 $bio = json_decode($bio, true);
                 $this->wiz($bio);
             } else {
                 redirect(registry_url('orcid/login'));
             }
         }
     } else {
         if ($access_token = $this->orcid_api->get_access_token()) {
             $bio = $this->orcid_api->get_full();
             if (!$bio) {
                 redirect(registry_url('orcid'));
             }
             $bio = json_decode($bio, true);
             $this->wiz($bio);
         } else {
             redirect(registry_url('orcid/login'));
         }
     }
 }
 public function triggerORCIDHarvest()
 {
     echo "Executing pullback script...<i>this may take several minutes (depending on server load)</i>" . BR . BR;
     ob_flush();
     flush();
     $ctx = stream_context_create(array('http' => array('timeout' => 1200)));
     echo nl2br(file_get_contents(registry_url('maintenance/orcidPullback'), false, $ctx));
     ob_flush();
     flush();
 }
Example #6
0
                        <li class=""><?php 
                echo anchor(apps_url('statistics'), 'Statistics');
                ?>
</li>    
                      <?php 
            }
            ?>
                  <?php 
        }
        ?>
                    <?php 
        if ($this->user->hasFunction('REGISTRY_STAFF')) {
            ?>
                        <li class="divider"></li>
                        <li class=""><?php 
            echo anchor(registry_url('maintenance/registrySummary'), 'Registry Quality Summary');
            ?>
</li>
                    <?php 
        }
        ?>
 
                    <?php 
        if ($this->user->hasFunction('SUPERUSER')) {
            ?>
		      <?php 
            if (mod_enabled('mydois')) {
                ?>
		       <li class="divider"></li>
			  <li class=""><?php 
                echo anchor(apps_url('/mydois/list_trusted'), 'List Trusted DOI Clients');
    foreach ($data_sources as $_data_source) {
        ?>

							<h3><?php 
        echo $_data_source->title;
        ?>
 <small>(<?php 
        echo $_data_source->count_collection;
        ?>
 collections)</small></h3>
							<?php 
        echo $_data_source->count_collection > 200 ? '<span class="label label-warning"> Warning - This data source is very large. Only the first 200 collections will be displayed.</span>' : '';
        ?>

							<?php 
        $url = registry_url('services/api/getDCI/?q=data_source_id:(' . trim($_data_source->data_source_id) . ')');
        ?>
							<a href="<?php 
        echo addslashes($url);
        ?>
" target="_blank"><?php 
        echo $url;
        ?>
</a><br/><br/>
						<?php 
    }
    ?>
					<?php 
}
?>
	
<?php

$this->load->view('header');
?>
<div class="content-header">
    <h1>ANDS - Grant Widget</h1>
</div>
<div id="breadcrumb">
    <?php 
echo anchor(registry_url(), '<i class="icon-home"></i> Home', array('tip' => 'Go to Home'));
?>
    <?php 
echo anchor('/grant_widget', 'Grant Widget', array('class' => 'current'));
?>
</div>
<div class="container-fluid">
    <div class="widget-box">
        <div class="widget-title">
            <h5>Grant Widget</h5>
        </div>
        <div class="widget-content">

            <div class="alert alert-info">
                <b>Developer Zone</b>
                <p>Some basic web development knowledge may be needed to implement this widget</p>
            </div>

            <form action="" class="form-inline well">
                <h1>Grant Widget</h1>
                <input type="text" name="name" value="" size="40" class="grant_widget"/>
            </form>
				<div class="widget-box">
					<div class="widget-title">
						<h5>{{search_result.data.numFound}} results</h5>
						<select name="" id="" ng-model="perPage">
							<option value="5">Show 5</option>
							<option value="10">Show 10</option>
							<option value="30">Show 30</option>
						</select>
					</div>
					<div class="widget-content ro_box nopadding dataTables_wrapper" style="border-bottom:0">
						<div class="ro_box" ng-show="search_result">
							<ul class="ro_list">
								<li ng-repeat="ro in search_result.data.result.docs" class="ro_item" ng-click="select(ro)" ng-class="ro.selected">
									<div class="ro_item_header">
										<div class="ro_title"><a href="<?php 
echo registry_url('registry_object/view/{{ro.id}}');
?>
" tip="<b>{{ro.display_title}}</b> - {{ro.key}}" target="_blank">{{ro.display_title}} </a></div>
										<i class="class_icon icon-class icon-{{ro.class}}" alt="" tip="{{ro.class}}"></i>
										
									</div>
									<div class="ro_content">
										<ul class="tags">
											<li ng-repeat="tag in ro.tag">{{tag}}<span class="hide"><i class="icon icon-remove"></i></span></li>
										</ul>
									</div>
								</li>
							</ul>
						</div>

					</div>
Example #10
0
$this->load->view('header');
?>
<div ng-app="config_app">
	<div ng-view></div>
</div>

<div id="index_template" class="hide">
	<div class="content-header">
		<h1>Configuration</h1>
	</div>
	<div id="breadcrumb" style="clear:both;">
		<?php 
echo anchor(registry_url('auth/dashboard'), '<i class="icon-home"></i> Home');
?>
		<?php 
echo anchor(registry_url('maintenance'), 'Maintenance');
?>
		<a href="#/" class="current">Configuration</a>
	</div>
	
	<div class="container-fluid">
		<div class="widget-box">
			<div class="widget-title">
				<h5>Configuration</h5>
			</div>
			<div class="widget-content nopadding">
				<form action="" class="form form-horizontal">

					<fieldset>
						<div ng-repeat="(key, c) in config">
							<div class="control-group" ng-show="c.type=='string'">
<div class="box-content" id="recentRecordsDashboard">
		<?php 
if (sizeof($recent_records) > 0) {
    foreach ($recent_records as $record) {
        ?>
				<a href="<?php 
        echo registry_url('registry_object/view/' . $record->registry_object_id);
        ?>
">
					<img class="class_icon pull-left" style="width:20px;padding-right:10px;" src="<?php 
        echo registry_url('assets/img/party.png');
        ?>
">
					
					<div class="pull-left" style="line-height:10px;">
					<small>
							<?php 
        echo ellipsis($record->title, 55);
        ?>
							<small class="clearfix muted">Updated <?php 
        echo timeAgo($record->updated);
        ?>
</small>
					</small>
					</div>
					<span class="tag pull-right status_<?php 
        echo $record->status;
        ?>
"><?php 
        echo readable($record->status, true);
Example #12
0
 /**
  * INTERNAL. Useful function helper for returning the theme pages index
  * @return content
  */
 public function getThemePageIndex()
 {
     $url = registry_url() . 'services/rda/getThemePageIndex/';
     $contents = @file_get_contents($url);
     return $contents;
 }
 public function edit($registry_object_id)
 {
     $this->load->model('registry_objects', 'ro');
     $this->load->model("data_source/data_sources", "ds");
     $ro = $this->ro->getByID($registry_object_id);
     if (!$ro) {
         throw new Exception("This Registry Object ID does not exist!");
     }
     acl_enforce('REGISTRY_USER');
     ds_acl_enforce($ro->data_source_id);
     $ds = $this->ds->getByID($ro->data_source_id);
     if ($ro->status == PUBLISHED) {
         if (!($ro = $this->ro->getDraftByKey($ro->key))) {
             $ro = $this->ro->cloneToDraft($registry_object_id);
         }
     }
     if ($ro->status != DRAFT) {
         $ro->status = DRAFT;
         $ro->save();
     }
     if ($ro->id != $registry_object_id) {
         header("Location: " . registry_url('registry_object/edit/' . $ro->id));
     }
     $extRif = $ro->getExtRif();
     if (!$extRif) {
         $ro->enrich();
         $extRif = $ro->getExtRif();
     }
     $data['extrif'] = $extRif;
     $data['content'] = $ro->transformCustomForFORM($data['extrif']);
     $data['ds'] = $ds;
     $data['title'] = 'Edit: ' . $ro->title;
     $data['scripts'] = array('add_registry_object');
     $data['js_lib'] = array('core', 'tinymce', 'ands_datepicker', 'prettyprint', 'vocab_widget', 'orcid_widget', 'google_map', 'location_capture_widget');
     $this->load->view("add_registry_object", $data);
 }
Example #14
0
 public function setUser()
 {
     $sharedToken = '';
     $data['title'] = 'Login';
     $data['js_lib'] = array('core');
     $data['scripts'] = array();
     $this->CI =& get_instance();
     $data['redirect'] = '';
     $data['authenticators'] = array(gCOSI_AUTH_METHOD_BUILT_IN => 'Built-in Authentication', gCOSI_AUTH_METHOD_LDAP => 'LDAP');
     if (get_config_item('shibboleth_sp') == 'true') {
         $data['authenticators'][gCOSI_AUTH_METHOD_SHIBBOLETH] = 'Australian Access Federation (AAF) credentials';
         $data['default_authenticator'] = gCOSI_AUTH_METHOD_SHIBBOLETH;
     } else {
         $data['default_authenticator'] = gCOSI_AUTH_METHOD_BUILT_IN;
     }
     if (isset($_SERVER['shib-shared-token'])) {
         $sharedToken = $_SERVER['shib-shared-token'];
         //authenticate using shared token
     } elseif (isset($_SERVER['persistent-id'])) {
         $sharedToken = sha1($_SERVER['persistent-id']);
         echo $sharedToken;
     } else {
         $data['error_message'] = "Unable to login. Shibboleth IDP was not able to authenticate the given credentials. Missing shared token or persistent id";
         $this->load->view('login', $data);
     }
     if ($sharedToken) {
         try {
             if ($this->user->authChallenge($sharedToken, '')) {
                 if ($this->input->get('redirect') != 'auth/dashboard/') {
                     redirect($this->input->get('redirect'));
                 } else {
                     redirect(registry_url() . 'auth/dashboard');
                 }
             } else {
                 $data['error_message'] = "Unable to login. Please check your credentials are accurate.";
                 $this->load->view('login', $data);
             }
         } catch (Exception $e) {
             $data['error_message'] = "Unable to login. Please check your credentials are accurate.";
             $data['exception'] = $e;
             $this->load->view('login', $data);
         }
     }
 }
<?php

$config['registry_endpoint'] = registry_url("services/roles/");
$this->load->view('header');
?>
<div class="content-header">
	<h1>Theme CMS</h1>
	<div class="btn-group">
		<a class="btn btn-large" data-toggle="modal" href="#add_blob_modal"><i class="icon icon-plus"></i> Add Blob</a>
		<a class="btn btn-large"><i class="icon icon-plus"></i> Preview</a>
		<a class="btn btn-large"><i class="icon icon-plus"></i> Save</a>
	</div>
</div>
<div id="breadcrumb" style="clear:both;">
	<?php 
echo anchor(registry_url('auth/dashboard'), '<i class="icon-home"></i> Home');
?>
	<?php 
echo anchor(registry_url('/theme_cms'), 'Theme CMS', array('class' => 'current'));
?>
</div>

<div class="container-fluid" id="main_content">
	<div class="row-fluid">
		<div class="span8">
			<div class="widget-box">
				<div class="widget-title"><h5>Main Content</h5></div>
				<div class="widget-content region" id="region_left"></div>
			</div>
		</div>
		<div class="span4">
			<div class="widget-box">
				<div class="widget-title"><h5>Side Bar</h5></div>
				<div class="widget-content region" id="region_right"></div>
 public function init()
 {
     acl_enforce('REGISTRY_STAFF');
     $this->load->library('importer');
     $slogTitle = 'Import from URL completed successfully' . NL;
     $elogTitle = 'An error occurred whilst importing from the specified URL' . NL;
     $log = 'IMPORT LOG' . NL;
     //$log .= 'URI: ' . $this->input->post('url') . NL;
     $log .= 'Harvest Method: Direct import from URL' . NL;
     $this->load->model('data_source/data_sources', 'ds');
     $data_source = $this->ds->getByKey($this->config->item('example_ds_key'));
     if (!$this->config->item('example_ds_key')) {
         echo "Example DataSource Key is required to complete the task" . NL;
         return;
     }
     if (!$data_source) {
         $data_source = $this->ds->create($this->config->item('example_ds_key'), url_title($this->config->item('example_ds_title')));
         $data_source->setAttribute('title', $this->config->item('example_ds_title'));
         $data_source->setAttribute('record_owner', 'superuser');
         $data_source->save();
         $data_source->updateStats();
         $data_source = $this->ds->getByKey($this->config->item('example_ds_key'));
     }
     $sampleRecordUrls = array('http://services.ands.org.au/documentation/rifcs/1.6/examples/eg-collection-1.xml', 'http://services.ands.org.au/documentation/rifcs/1.6/examples/eg-party-1.xml', 'http://services.ands.org.au/documentation/rifcs/1.6/examples/eg-service-1.xml', 'http://services.ands.org.au/documentation/rifcs/1.6/examples/eg-activity-1.xml');
     $xml = '';
     foreach ($sampleRecordUrls as $recUrl) {
         $xml .= unWrapRegistryObjects(file_get_contents($recUrl));
     }
     $this->importer->setXML(wrapRegistryObjects($xml));
     $this->importer->setDatasource($data_source);
     $this->importer->commit(false);
     $this->importer->finishImportTasks();
     $data_source->updateStats();
     if ($error_log = $this->importer->getErrors()) {
         $log .= $elogTitle . $log . $error_log;
         $data_source->append_log($log, HARVEST_ERROR, "HARVEST_ERROR");
     }
     //else{
     $log .= $slogTitle . $log . $this->importer->getMessages();
     $data_source->append_log($log, HARVEST_INFO, "HARVEST_INFO");
     header('Location: ' . registry_url('data_source/manage_records/' . $data_source->id));
     exit;
 }
Example #18
0
 * @author Minh Duc Nguyen <*****@*****.**>
 */
?>

<?php 
$this->load->view('header');
?>
<div class="content-header">
	<h1>Edit Role - <?php 
echo $role->name;
?>
</h1>
</div>
<div id="breadcrumb" style="clear:both;">
	<?php 
echo anchor(registry_url('auth/dashboard'), '<i class="icon-home"></i> Home');
?>
	<?php 
echo anchor('/role', 'List Roles');
?>
	<?php 
echo anchor('role/view/?role_id=' . rawurlencode($role->role_id), $role->name);
?>
	<?php 
echo anchor('/role/edit/' . rawurlencode($role->role_id), 'Edit Role', array('class' => 'current'));
?>
</div>
<div class="container-fluid">
	<div class="row-fluid">

		<div class="span3"></div>
Example #19
0
        echo '<p>You are not registered as a Data Source Administrator.</p>';
        if ($this->user->affiliations()) {
            echo '<small><span class="label label-warning"> &nbsp; ! &nbsp;</span> You are already registered as an affiliate with an organisation.</small><br/>';
            echo '<small><span class="label label-important"> &nbsp; ! &nbsp;</span> Please contact <a href="mailto:services@ands.org.au">services@ands.org.au</a> to register for a new Data Source.</small>';
        } else {
            echo '<br/><small><span class="label label-success"> &nbsp; ! &nbsp;</span> <strong> New Data Publishers </strong> <br/>
										<p>If your institution does not already <a target="_blank" href="' . portal_url('home/contributors') . '">contribute to Research Data Australia</a> (at the institutional level), 
										you may wish to use the <a href="' . registry_url('publish_my_data') . '"><b>Publish My Data self-service tool</b></a>.</p>
										<p><small><em>Note:</em> Publish My Data self-service is intended for use by researchers at organisations where there is no formal data archiving service and where ANDS has no distributed services in place. 
										Please first check for processes within your institution before using the self-service facility.</small></p></small><br/>';
        }
    } elseif (sizeof($data_sources) > 0) {
        echo '<ul>';
        $i = 0;
        for ($i = 0; $i < sizeof($data_sources) && $i < 7; $i++) {
            echo '<li><a href="' . registry_url('data_source/#!/view/' . $data_sources[$i]['data_source_id']) . '">' . $data_sources[$i]['title'] . "</a></li>";
        }
        echo '</ul>';
        if ($i < sizeof($data_sources)) {
            echo '<div style="margin-left:20px;">';
            echo '<select data-placeholder="Choose a Data Source to View" class="chzn-select" id="dashboard-datasource-chooser">';
            echo '	<option value=""></option>';
            foreach ($data_sources as $ds) {
                echo '<option value="' . $ds['data_source_id'] . '">' . $ds['title'] . '</option>';
            }
            echo '</select>';
            echo '</div>';
        }
    } else {
        echo 'You are not associated with any data sources yet!';
    }