Implemented CT#1764

Updated changelog (a bit)
skala
Yannick Warnier 16 years ago
parent d8bf841351
commit 2f6044102e
  1. 3
      documentation/changelog.html
  2. 1
      main/admin/user_fields.php
  3. 1
      main/admin/user_fields_add.php
  4. 25
      main/auth/profile.php
  5. 20
      main/inc/lib/usermanager.lib.php
  6. 7
      main/social/profile.php

@ -26,6 +26,8 @@
<li>The mPDF library (which is used for PDF-files generation) has been upgraded from version 4.2 to version 4.6 (Feature #1656)</li>
<li>ASCIIMathML.js: The script for showing mathematical formulas has been upgraded from version 2.0.2 to version 2.1. Additional changes have been made in the online editor's plugin asciimath (Feature #541)</li>
<li>Ajax File Manager updated to 1.0 RC5 (Feature #247)</li>
<li>Added simple document search feature</li>
<li>Added simple social network link feature (Feature #1764)</li>
</ul>
<h3>Debugging</h3>
@ -33,6 +35,7 @@
<li>Duplicate query calls have been removed from .../install/update-db-18.6.2-1.8.7.inc.php. The bug has been reported (with solution given) by Omar Arino (Bug #1713)</li>
<li>Tests tool: Errors have been fixed about showing HotPotatoes tests and results. The solution has been proposed by Hubert Borderiou (Bug #1301)</li>
<li>Tests tool: Titles of the imported HotPotatoes tests are retrieved in their original spelling, without modifications due to technical reasons, as it was before. The problem has been reported by Oliver Corre (Bug #1761)</li>
<li>Improved resource visibility from sessions (Bug #1599)</li>
</ul>
<h3>Deprecated files</h3>

@ -214,6 +214,7 @@ function type_filter($type)
$types[USER_FIELD_TYPE_DIVIDER] = get_lang('FieldTypeDivider');
$types[USER_FIELD_TYPE_TAG] = get_lang('FieldTypeTag');
$types[USER_FIELD_TYPE_TIMEZONE] = get_lang('FieldTypeTimezone');
$types[USER_FIELD_TYPE_SOCIAL_PROFILE] = get_lang('FieldTypeSocialProfile');
return $types[$type];
}

@ -137,6 +137,7 @@ $types[USER_FIELD_TYPE_DOUBLE_SELECT] = get_lang('FieldTypeDoubleSelect');
$types[USER_FIELD_TYPE_DIVIDER] = get_lang('FieldTypeDivider');
$types[USER_FIELD_TYPE_TAG] = get_lang('FieldTypeTag');
$types[USER_FIELD_TYPE_TIMEZONE] = get_lang('FieldTypeTimezone');
$types[USER_FIELD_TYPE_SOCIAL_PROFILE] = get_lang('FieldTypeSocialProfile');
$form->addElement('select','fieldtype',get_lang('FieldType'),$types,array('onchange'=>'change_image_user_field(this.value)'));
$form->addRule('fieldtype', get_lang('ThisFieldIsRequired'), 'required');

@ -431,6 +431,17 @@ EOF;
$form->addElement('select', 'extra_'.$field_details[1], $field_details[3], api_get_timezones(), '');
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
break;
case USER_FIELD_TYPE_SOCIAL_PROFILE:
// get the social network's favicon
$icon_path = UserManager::get_favicon_from_url($extra_data['extra_'.$field_details[1]], $field_details[4]);
// special hack for hi5
$leftpad = '1.7'; $top = '0.4'; $domain = parse_url($icon_path, PHP_URL_HOST); if ($domain == 'www.hi5.com' or $domain == 'hi5.com') { $leftpad = '3'; $top = '0';}
// print the input field
$form->addElement('text', 'extra_'.$field_details[1], $field_details[3], array('size' => 60, 'style' => 'background-image: url(\''.$icon_path.'\'); background-repeat: no-repeat; background-position: 0.4em '.$top.'em; padding-left: '.$leftpad.'em; '));
$form->applyFilter('extra_'.$field_details[1], 'stripslashes');
$form->applyFilter('extra_'.$field_details[1], 'trim');
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
break;
}
}
@ -713,17 +724,13 @@ if ($form->validate()) {
}
if (isset($_GET['show'])) {
if ((api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') || (api_get_setting('allow_social_tool') == 'true')) {
//if (isset($_GET['show'])) {
//if ((api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') || (api_get_setting('allow_social_tool') == 'true')) {
//$interbreadcrumb[] = array ('url' => 'javascript: void(0);', 'name' => get_lang('SocialNetwork'));
} elseif ((api_get_setting('allow_social_tool') == 'false' && api_get_setting('allow_message_tool') == 'true')) {
//} elseif ((api_get_setting('allow_social_tool') == 'false' && api_get_setting('allow_message_tool') == 'true')) {
//$interbreadcrumb[] = array('url' => 'javascript: void(0);', 'name' => get_lang('MessageTool'));
}
}
//}
//}
/*
==============================================================================

@ -20,6 +20,7 @@ define('USER_FIELD_TYPE_DOUBLE_SELECT', 8);
define('USER_FIELD_TYPE_DIVIDER', 9);
define('USER_FIELD_TYPE_TAG', 10);
define('USER_FIELD_TYPE_TIMEZONE', 11);
define('USER_FIELD_TYPE_SOCIAL_PROFILE', 12);
//User image sizes
define('USER_IMAGE_SIZE_ORIGINAL', 1);
@ -3245,5 +3246,24 @@ class UserManager
}
return $result;
}
/**
* This function returns an icon path that represents the favicon of the website of which the url given. Defaults to the current Chamilo favicon
* @param string URL of website where to look for favicon.ico
* @param string Optional second URL of website where to look for favicon.ico
* @return string Path of icon to load
*/
public function get_favicon_from_url($url1, $url2 = null) {
$icon_link = '';
$url = $url1;
if (empty($url1)) {
$url = $url2;
if (empty($url)) {
$url = api_get_access_url(api_get_current_access_url_id());
}
}
$pieces = parse_url($url);
$icon_link = $pieces['scheme'].'://'.$pieces['host'].'/favicon.ico';
return $icon_link;
}
}

@ -341,6 +341,13 @@ if ($show_full_profile) {
if (is_array($user_tags) && count($user_tags)>0) {
$extra_information_value .= '<dt>'.ucfirst($field_display_text).':</dt><dd>'.implode(', ',$tag_tmp).'</dd>';
}
} elseif ($field_type == USER_FIELD_TYPE_SOCIAL_PROFILE) {
$icon_path = UserManager::get_favicon_from_url($data);
$bottom = '0.3';
//quick hack for hi5
$domain = parse_url($icon_path, PHP_URL_HOST); if ($domain == 'www.hi5.com' or $domain == 'hi5.com') { $bottom = '0.8'; }
$data = '<a href="'.$data.'"><img src="'.$icon_path.'" alt="ico" style="margin-right:0.5em;margin-bottom:-'.$bottom.'em;" />'.ucfirst($field_display_text).'</a>';
$extra_information_value .= '<dd>'.$data.'</dd>';
} else {
if (!empty($data)) {
$extra_information_value .= '<dt>'.ucfirst($field_display_text).':</dt><dd>'.$data.'</dd>';

Loading…
Cancel
Save