Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version footer frontend #257

Merged
merged 10 commits into from
Jun 5, 2024
1 change: 1 addition & 0 deletions mmoda.info
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name = MMODA
description = Multi-Messenger Online Data Analysis
core = 7.x
version = 7.x-1.0
dependencies[] = libraries:libraries (2.x)
dependencies[] = drupal:block
dependencies[] = drupal:book
Expand Down
10 changes: 7 additions & 3 deletions mmoda.install
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,17 @@ function mmoda_add_custom_fields()
field_create_field($field);
}
foreach (mmoda_help_page_field_default_field_instances() as $instance) {
field_create_instance($instance);
if(!is_null($instance))
field_create_instance($instance);
}
}

function mmoda_del_custom_fields()
{
foreach (mmoda_help_page_field_default_field_instances() as $instance) {
field_delete_instance($instance);
if (!is_null($instance)) {
field_delete_instance($instance);
}
}
// foreach (array_keys(mmoda_help_page_field_default_field_bases()) as $field) {
// field_delete_field($field);
Expand Down Expand Up @@ -133,6 +136,7 @@ function mmoda_install()
$module_settings['common']['T2'] = '2017-03-06T15:32:27.0';
$module_settings['common']['T_format'] = 'isot';
$module_settings[$module_name . '_debug'] = true;
$module_settings['frontend_version'] = mmoda_get_frontend_version();
$module_settings['modules'] = array();

// Create role for user managers
Expand Down Expand Up @@ -171,7 +175,7 @@ function mmoda_install()
// variable_set('menu_options_'.$help_page_content_type, array(0));

// Add custom fields to book page content type
mmoda_add_custom_fields();
// mmoda_add_custom_fields();

$book_allowed_types = variable_get('book_allowed_types', array(
'book'
Expand Down
19 changes: 19 additions & 0 deletions mmoda.lib.inc
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,25 @@ function mmoda_get_users_with_role($role, $active_user = TRUE)
return $users;
}

function mmoda_get_frontend_version()
{
$version = '';

$query = db_select('system', 'sys');
$query->addExpression('CONVERT(sys.info USING utf8)', 'info');
$query->condition('sys.name', 'mmoda');
$query_result = $query->execute()->fetch();

if (!empty($query_result)) {
$unserialized_info = unserialize($query_result->info);
$version = "{$unserialized_info['version']}";
}
else
watchdog('MMODA', 'frontened version not found in the database.');

return $version;
}

function _mmoda_write_log_file($filename, $content)
{
$filename = '/tmp/' . $filename;
Expand Down
3 changes: 3 additions & 0 deletions mmoda.module
Original file line number Diff line number Diff line change
Expand Up @@ -365,11 +365,14 @@ function mmoda_main_block_content()
// $mmoda_settings ['support_email'] = array('[email protected]');
// variable_set ( 'mmoda_settings', $mmoda_settings );

// watchdog('MMODA', 'content of mmoda_settings: ' . var_dump($mmoda_settings));

$items['session_id'] = $session_id;
$items['session_count'] = $session_count;
$items['name_resolve_form'] = drupal_get_form('mmoda_name_resolve');
$items['common_form'] = drupal_get_form('mmoda_common');
$items['mmoda_debug'] = $mmoda_settings['mmoda_debug'];
$items['frontend_version'] = $mmoda_settings['frontend_version'];
$items['auth_cookie'] = '_oauth2_proxy';

if (empty($mmoda_settings['instruments'])) {
Expand Down
9 changes: 9 additions & 0 deletions templates/mmoda-main.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,21 @@ class="glyphicon glyphicon-info-sign"> </span>
</div>
<?php endforeach; ?>
</div>
<?php if (isset($instruments)): ?>
<hr class="hr-default" />
<div class="pull-right">version: <?=$frontend_version?></div>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
<?php endif;?>
<?php if (! isset($instruments)): ?>
<hr class="hr-default" />
<div class="pull-right">version: <?=$frontend_version?></div>
<?php endif; ?>

</div>
</div>