Skip to content

Commit

Permalink
- Added external links
Browse files Browse the repository at this point in the history
- Added addtoany
- Tuned places were stats block shows up
- Display attached images in new windows. Fixes: https://www.labdoo.org/content/display-attached-images-new-windows
- Implements "Team Event Announcement": https://www.labdoo.org/content/team-event-announcement
  • Loading branch information
jrosgiralt committed Dec 11, 2015
1 parent 5a8e3bd commit e964450
Show file tree
Hide file tree
Showing 9 changed files with 591 additions and 46 deletions.
2 changes: 2 additions & 0 deletions labdoo.info
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ dependencies[] = countries
dependencies[] = search_config
dependencies[] = hide_submit
dependencies[] = date_popup
dependencies[] = extlink

;;; Features and exports/imports
dependencies[] = strongarm
Expand All @@ -118,6 +119,7 @@ dependencies[] = boost

;;; Services and social
dependencies[] = simplenews
dependencies[] = addtoany

;;; Translations
dependencies[] = l10n_update
Expand Down
2 changes: 2 additions & 0 deletions labdoo.make
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ projects[views_tree] = 2.0
projects[countries] = 2.3
projects[search_config] = 1.1
projects[hide_submit] = 2.0
projects[extlink] = 1.18

;--------------------
; Security
Expand Down Expand Up @@ -96,6 +97,7 @@ projects[drupalchat] = 1.4
projects[simplenews] = 1.1
projects[mass_contact] = 1.0
projects[sharethis] = 2.12
projects[addtoany] = 4.10
projects[disqus] = 1.12
projects[disqus][patch][] = http://drupal.org/files/disqus-https.patch
projects[flag] = 3.6
Expand Down
76 changes: 64 additions & 12 deletions modules/custom/labdoo_lib/labdoo_lib.module
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,29 @@ function labdoo_country_code2name($countryCode) {
}


/**
* Prints all the countries and cities within Labdoo.org
*
* This function can be used to generate cloudtags with http://worditout.com/word-cloud/make-a-new-one
*
*/
function labdoo_list_all_countries() {
$query = "SELECT country FROM location";
$countries = db_query($query);
foreach($countries as $country) {
# Substitute blank spaces with sign "~" so that countries with multiple words can be processed together
$countrySet = $countrySet . ", " . str_replace(" ", "~", labdoo_country_code2name($country->country));
}
drupal_set_message($countrySet);
$query = "SELECT DISTINCT city FROM location";
$cities = db_query($query);
foreach($cities as $city) {
$citySet = $citySet . ", " . str_replace(" ", "~", $city->city);
}
drupal_set_message($citySet);
}


/**
* Generates the title of a dootrip
*
Expand Down Expand Up @@ -351,6 +374,10 @@ function labdoo_render_dooject_header() {
// Table header
$htmlCode = $htmlCode . '<table align="center" width="1150px"><tr><td align="left">';

// Hack: Add a tiny invisible image (of size zero in fact) to control the image that will show up
// when sharing the page with addtoany
$htmlCode = $htmlCode . '<img src="/profiles/labdoo/files/pictures/laptop.png" width="0" style="visibility:hidden"/>';

// Left arrow
$htmlCode = $htmlCode . "<a style='float: left;' href='../laptop/".$prevIdFull."'>
<img src='/profiles/labdoo/files/pictures/arrow_left.png' style='float: right; width: 30px; height: 31px;'/></span></a>";
Expand Down Expand Up @@ -1840,6 +1867,37 @@ function labdoo_lib_print_backtrace() {
}


/**
* Renders the AddToAny share button
*
* @return Code rendering the AddToAny block
*
*/
function _render_addtoany() {
$blockAddToAny = module_invoke('addtoany', 'block_view', 'addtoany_button');
$code = render($blockAddToAny["content"]);
// Add a tiny invisible image (of size zero in fact) to control the image that will show up
// when sharing the page with addtoany
$code = $code . '<img src="/profiles/labdoo/files/pictures/laptop.png" width="0" style="visibility:hidden"/>';
return($code);
}


/**
* Renders the language switch block
*
* @return Code rendering the language switch block
*
*/
function labdoo_render_language_switch() {
$blockLanguage = module_invoke('lang_dropdown', 'block_view', 'language');
$languageSwitchCode = render($blockLanguage["content"]);
$languageSwitchCode = str_replace("<form ", "<form style='height:10px' ", $languageSwitchCode);
$code = "<table><tr><td>$languageSwitchCode</td></tr><tr><td>"._render_addtoany()."</td></tr></table>" . "<br/>";
return($code);
}


/**
* Renders the macro statistics
*
Expand All @@ -1861,18 +1919,14 @@ function labdoo_render_macro_stats($type, $addTitle=False) {
$header = "";
$separator = "<br>";
$trailer = "<br>";
if(0) {
$blockAddToAny = module_invoke('addtoany', 'block_view', 'addtoany_button');
$trailer = $trailer . render($blockAddToAny["content"]);
}
}
else {
$blockLanguage = module_invoke('lang_dropdown', 'block_view', 'language');
$languageSwitchCode = render($blockLanguage["content"]);
$languageSwitchCode = str_replace("<form ", "<form style='height:10px' ", $languageSwitchCode);
$header = "<table><tr><td style='width:1090px'>";
$separator = "&nbsp; &nbsp;";
$trailer ="</td><td>$languageSwitchCode</td></tr></table><br>";
$trailer ="</td><td>"."</td><td width='130px' align='center'>".labdoo_render_language_switch()."</td></tr></table>";
}

$statsTitle = "";
Expand Down Expand Up @@ -2154,10 +2208,9 @@ function labdoo_block_filter_sidebar_second() {
function labdoo_block_filter_macro_vertical() {
$path = drupal_get_path_alias(current_path());

if(strcmp($path, "wiki-index") == 0)
return FALSE;

if(labdoo_lib_node_is_type(array('book')))
# For wiki pages, do not show the vertical stats (show instead the horizontal stats),
# except for the main general wiki index page
if(labdoo_lib_node_is_type(array('book')) && strcmp($path, "wiki-index") != 0)
return FALSE;

return labdoo_block_filter_sidebar_second();
Expand Down Expand Up @@ -2210,8 +2263,7 @@ function labdoo_block_filter_search() {
*/
function labdoo_block_filter_language_switch() {

// Show up the switch whenever the right column (sidebar_second)
// is displayed and also on top of the TOC block for wiki pages.
// Show up the switch whenever the right column (sidebar_second) is displayed
if(labdoo_block_filter_sidebar_second())
return TRUE;

Expand Down Expand Up @@ -2261,7 +2313,7 @@ function labdoo_block_filter_header() {
if(strcmp($path, "contact") == 0)
return TRUE;

if(strcmp($path, "content/doojects-dashboard") == 0)
if(strcmp($path, "content/dootronics-dashboard") == 0)
return TRUE;

if(strcmp($path, "content/dootrips-dashboard") == 0)
Expand Down
4 changes: 1 addition & 3 deletions modules/custom/lbd_blocks_views/lbd_blocks_views.module
Original file line number Diff line number Diff line change
Expand Up @@ -366,17 +366,15 @@ function lbd_blocks_views_block_view($delta = '') {
// Macro statistics (horizontal)
case 'block_macro_statistics_horiz':
$block['subject'] = "<none>";
// $block['title'] = t("Global progress");
$block['content'] = array(
'#markup' => labdoo_render_macro_stats("horizontal"),
);
break;

// Language switch
case 'block_link_language_switch':
$blockLanguage = module_invoke('lang_dropdown', 'block_view', 'language');
$block['subject'] = "<none>";
$block['content'] = drupal_render($blockLanguage["content"]);
$block['content'] = labdoo_render_language_switch();
break;

// Actions feed
Expand Down
20 changes: 20 additions & 0 deletions modules/custom/lbd_communicate/lbd_communicate.module
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,10 @@ function _email_team_event($node, $comment = NULL) {
$sendAll = $wNode->field_send_to_all_task->value();
$sendToFieldName = 'field_send_to_task';
}
else if($node->type == 'event') {
$sendAll = $wNode->field_send_to_all_event->value();
$sendToFieldName = 'field_send_to_event';
}
else
$sendAll = TRUE;

Expand All @@ -711,6 +715,22 @@ function _email_team_event($node, $comment = NULL) {
}
$emailsList = trim($emailsList, ", ");

// Events have an additional field called field_additional_emails_event where users can add
// additional email addresses that need to be notified. Include them too in $emailsList.
if($node->type == 'event') {
$additionalEmails = $wNode->field_additional_emails_event->value();
$additionalEmailsList = explode(",", $additionalEmails);
$validatedEmails = "";
foreach($additionalEmailsList as $email) {
$trimmedEmail = trim($email);
if(valid_email_address($trimmedEmail))
$validatedEmails = $validatedEmails . ", " . $trimmedEmail;
}
$validatedEmails = substr($validatedEmails, 1); // remove extra comma
}

$emailsList = $emailsList . ", " . $validatedEmails;

$activityUrl = url(drupal_get_path_alias("node/" . $node->nid, $langCode), array('absolute' => TRUE));
$teamsMgmUrl = url(drupal_get_path_alias("my-teams", $langCode), array('absolute' => TRUE));
if($activityType == 'comment') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,152 @@
function lbd_content_types_conditional_fields_default_fields() {
$items = array();

$items["node:event:0"] = array(
'entity' => 'node',
'bundle' => 'event',
'dependent' => 'field_send_to_event',
'dependee' => 'field_send_to_all_event',
'options' => array(
'state' => 'visible',
'condition' => '!checked',
'grouping' => 'AND',
'effect' => 'show',
'effect_options' => array(),
'element_view' => array(
1 => '1',
2 => '2',
5 => 0,
3 => 0,
4 => 0,
),
'element_view_per_role' => 0,
'element_view_roles' => array(
1 => array(
1 => '1',
2 => '2',
5 => 0,
3 => 0,
4 => 0,
),
7 => array(
1 => '1',
2 => '2',
5 => 0,
3 => 0,
4 => 0,
),
8 => array(
1 => '1',
2 => '2',
5 => 0,
3 => 0,
4 => 0,
),
9 => array(
1 => '1',
2 => '2',
5 => 0,
3 => 0,
4 => 0,
),
3 => array(
1 => '1',
2 => '2',
5 => 0,
3 => 0,
4 => 0,
),
5 => array(
1 => '1',
2 => '2',
5 => 0,
3 => 0,
4 => 0,
),
6 => array(
1 => '1',
2 => '2',
5 => 0,
3 => 0,
4 => 0,
),
4 => array(
1 => '1',
2 => '2',
5 => 0,
3 => 0,
4 => 0,
),
2 => array(
1 => '1',
2 => '2',
5 => 0,
3 => 0,
4 => 0,
),
10 => array(
1 => '1',
2 => '2',
5 => 0,
3 => 0,
4 => 0,
),
),
'element_edit' => array(
1 => '1',
3 => 0,
),
'element_edit_per_role' => 0,
'element_edit_roles' => array(
1 => array(
1 => '1',
3 => 0,
),
7 => array(
1 => '1',
3 => 0,
),
8 => array(
1 => '1',
3 => 0,
),
9 => array(
1 => '1',
3 => 0,
),
3 => array(
1 => '1',
3 => 0,
),
5 => array(
1 => '1',
3 => 0,
),
6 => array(
1 => '1',
3 => 0,
),
4 => array(
1 => '1',
3 => 0,
),
2 => array(
1 => '1',
3 => 0,
),
10 => array(
1 => '1',
3 => 0,
),
),
'selector' => '',
'values_set' => 1,
'value' => array(),
'values' => array(),
'value_form' => array(),
),
);

$items["node:superhub_page:0"] = array(
'entity' => 'node',
'bundle' => 'superhub_page',
Expand Down

0 comments on commit e964450

Please sign in to comment.