Commit 2d24f71c authored by patrick-proulx's avatar patrick-proulx

[NEW] Added a new user profile feature/pref to use the index for user profiles...

[NEW] Added a new user profile feature/pref to use the index for user profiles and also refreshed the lok of user profiles a bit. Also added send_message action in the Social Controller
parent 508f4a3b
......@@ -6082,6 +6082,7 @@ templates/tiki-user_information.tpl -text
templates/tiki-user_mailin.tpl -text
templates/tiki-user_menu.tpl -text
templates/tiki-user_preferences.tpl -text
templates/tiki-user_profile.tpl -text
templates/tiki-user_tasks.tpl -text
templates/tiki-user_tasks_edit.tpl -text
templates/tiki-user_tasks_list.tpl -text
......@@ -6217,6 +6218,7 @@ templates/user/index.php -text
templates/user/info.tpl -text
templates/user/manage_groups.tpl -text
templates/user/register.tpl -text
templates/user/send_message.tpl -text
templates/user_conditions/age_validation.tpl -text
templates/user_conditions/approval.tpl -text
templates/user_conditions/index.php -text
......@@ -7743,6 +7745,7 @@ themes/yeti/templates/index.php -text
/tiki-user_mailin.php -text
/tiki-user_notifications.php -text
/tiki-user_preferences.php -text
/tiki-user_profile.php -text
/tiki-user_reports.php -text
/tiki-user_reports_send.php -text
/tiki-user_tasks.php -text
......
......@@ -54,11 +54,49 @@ class Search_ContentSource_UserSource implements Search_ContentSource_Interface
if (isset($detail['preferences']['country'])) {
$country = $detail['preferences']['country'];
}
$gender = '';
if (isset($detail['preferences']['gender'])) {
$gender = $detail['preferences']['gender'];
}
$homePage = '';
if (isset($detail['preferences']['homePage'])) {
$homePage = $detail['preferences']['homePage'];
}
$realName = '';
if (isset($detail['preferences']['realName'])) {
$realName = $detail['preferences']['realName'];
}
if ($prefs['allowmsg_is_optional'] == 'y' && isset($detail['preferences']['allowMsgs'])) {
$allowMsgs = $detail['preferences']['allowMsgs'];
}else{
$allowMsgs = 'y';
}
if (isset($detail['preferences']['user_style'])) {
$user_style = $detail['preferences']['user_style'];
} else {
$user_style = $prefs['site_style'];
}
$user_language = $this->tiki->get_language($this->user);
$user_language_text = $this->tiki->format_language_list(array($user_language));
$userPage = $prefs['feature_wiki_userpage_prefix'] . $userinfo['login'];
if (! $this->tiki->page_exists($userPage)){
$userPage = "";
}
$data = array(
'title' => $typeFactory->sortable($name),
'wiki_content' => $typeFactory->wikitext($content),
'user_country' => $typeFactory->sortable($country),
'user_gender' => $typeFactory->sortable($gender),
'user_homepage' => $typeFactory->sortable($homePage),
'user_realName' => $typeFactory->sortable($realName),
'user_allowmsgs' => $typeFactory->sortable($allowMsgs),
'user_language' => $typeFactory->multivalue($user_language),
'user_style' => $typeFactory->sortable($user_style),
'user_page' => $typeFactory->sortable($userPage),
'geo_located' => $typeFactory->identifier(empty($loc) ? 'n' : 'y'),
'geo_location' => $typeFactory->identifier($loc),
'searchable' => $typeFactory->identifier($this->userIsIndexed($detail) ? 'y' : 'n'),
......
......@@ -979,6 +979,57 @@ class Services_User_Controller
}
}
function action_send_message($input) {
global $smarty, $user;
include_once ('lib/messu/messulib.php');
$userlib = TikiLib::lib('user');
//ensures a user was selected to send a message to.
if (empty($input->userwatch->text())) {
throw new Services_Exception(tra('No user was selected.'));
}
//sets default priority for the message to 3 if no priority was given
if (!empty($input->priority->text())) {
$priority = $input->priority->text();
} else {
$priority = 3;
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (empty($input->subject->text()) && empty($input->body->text())) {
$smarty->assign('message', tra('ERROR: Either the subject or body must be non-empty'));
$smarty->display("tiki.tpl");
die;
}
//if message is successfully sent
if ($messulib->post_message($input->userwatch->text(), $user, $input->to->text(), '', $input->subject->text(), $input->body->text(), $priority, '', isset($input->replytome) ? 'y' : '', isset($input->bccme) ? 'y' : '')) {
$message = tra('Your Message was successfully sent to') . ' ' . $userlib->clean_user($input->userwatch->text());
$type = "feedback";
$heading = "Success!";
} else {
$message = tra('An error occurred, please check your mail settings and try again');
$type= "error";
$heading = "Error!";
}
return array(
'modal' => '1',
'FORWARD' => array(
'controller' => 'utilities',
'action' => 'modal_alert',
'ajaxheading' => $heading,
'ajaxtype' => $type,
'ajaxmsg' => $message,
'ajaxdismissible' => 'n',
)
);
} else {
return array(
'title' => tra("Send Me a Message"),
'userwatch' => $input->userwatch->text(),
'priority' => $priority,
);
}
}
private function removeUsers(array $users, $page = false)
{
......
......@@ -254,6 +254,13 @@ function prefs_feature_list($partial = false)
'textFilter' => 'categ', // intentional use of categ so it catches category and categories
),
),
'feature_new_profiles' => array(
'name' => tra('Use new profiles'),
'description' => tra('Use new profiles build with elasticsearch'),
'help' => 'User+Preferences',
'type' => 'flag',
'default' => 'n',
),
'feature_score' => array(
'name' => tra('Score'),
'description' => tra('Score is a game to motivate participants to increase their contribution by comparing to other users.'),
......
......@@ -22,6 +22,7 @@
<h2>{tr}User features{/tr}</h2>
<div class="admin featurelist">
{preference name=feature_new_profiles}
{preference name=feature_score}
{preference name=feature_mytiki}
{preference name=feature_minical}
......
......@@ -42,6 +42,6 @@
{/foreach}
</ul>
{/if}
<button class="add-friend btn btn-default">{tr}Add Friend{/tr}</button>
<button class="add-friend btn btn-default"><i class="fa fa-user-plus"></i> {tr}Add Friend{/tr}</button>
</div>
{/block}
......@@ -213,7 +213,6 @@
{if $user_pages|@count > 0}
<h3>{tr}Wiki Pages{/tr}</h3>
<div class="table normal">
{section name=ix loop=$user_pages}
<div>
<div>
......
This diff is collapsed.
{extends 'layout_view.tpl'}
{block name="title"}
{title}{$title|escape}{/title}
{/block}
{block name="content"}
<div id="message">
<form id="send-message-form" method="post" action="{service controller=user action=send_message}" name="f">
<input type="hidden" name="to" value="{$userwatch|escape}">
<input type="hidden" name="userwatch" value="{$userwatch|escape}">
<p>{tr}The following message will be sent to user{/tr} {$userwatch|username}:</p>
<div class="form-group">
<label class="control-label" for="priority">{tr}Priority{/tr}</label>
<select name="priority" id="priority" class="form-control">
<option value="1" {if $priority eq 1}selected="selected"{/if}>1: {tr}Lowest{/tr}</option>
<option value="2" {if $priority eq 2}selected="selected"{/if}>2: {tr}Low{/tr}</option>
<option value="3" {if $priority eq 3}selected="selected"{/if}>3: {tr}Normal{/tr}</option>
<option value="4" {if $priority eq 4}selected="selected"{/if}>4: {tr}High{/tr}</option>
<option value="5" {if $priority eq 5}selected="selected"{/if}>5: {tr}Very High{/tr}</option>
</select>
</div>
<div class="form-group">
<label class="control-label" for="subject">{tr}Subject{/tr}</label>
<input type="text" name="subject" id="subject" value="" maxlength="255" class="form-control">
</div>
<div class="form-group">
<label class="control-label" for="message">{tr}Message Body{/tr}</label>
<textarea rows="12" class="form-control" name="body" id="message"></textarea>
</div>
<div class="form-group">
<input type="checkbox" name="replytome" id="replytome">
<label for="replytome">
{tr}Reply-to my email{/tr}
{help url="User+Information" desc="{tr}Reply-to my email:{/tr}{tr}The user will be able to reply to you directly via email.{/tr}"}
</label>
<input type="checkbox" name="bccme" id="bccme">
<label for="bccme">
{tr}Send me a copy{/tr}
{help url="User+Information" desc="{tr}Send me a copy:{/tr}{tr}You will be sent a copy of this email.{/tr}"}
</label>
</div>
<div class="submit">
<input type="submit" class="btn btn-primary" name="send" value="{tr}Send{/tr}">
</div>
</form>
</div>
{/block}
\ No newline at end of file
......@@ -2260,6 +2260,24 @@ ul.freetagged li {
fieldset.dropzone {
min-height: 120px;
}
.profile-left-bar .profile-avatar img {
margin-bottom: 6px;
max-width: 100%;
}
.profile-left-bar .profile-username {
font-size: 18px;
}
.profile-right-bar .profile-buttons .btn {
width: 100%;
margin-bottom: 10px;
}
.profile-right-bar button.add-friend {
width: 100%;
margin-top: 10px;
}
.profile-tab-content h2 {
margin-top: 0;
}
.prio1,
.prio2,
.prio3,
......
......@@ -100,3 +100,23 @@ fieldset.dropzone {
// #resultzone > div:hover {
// background: @panel-success-heading-bg;
// }
// Tiki new profiles
.profile-left-bar .profile-avatar img {
margin-bottom: @padding-base-vertical;
max-width: 100%;
}
.profile-left-bar .profile-username {
font-size: @font-size-large;
}
.profile-right-bar .profile-buttons .btn {
width: 100%;
margin-bottom: @padding-large-vertical;
}
.profile-right-bar button.add-friend {
width: 100%;
margin-top: @padding-large-vertical;
}
.profile-tab-content h2{
margin-top:0;
}
\ No newline at end of file
......@@ -11,6 +11,12 @@
require_once ('tiki-setup.php');
include_once ('lib/messu/messulib.php');
include_once ('lib/userprefs/scrambleEmail.php');
if ($prefs['feature_new_profiles'] == 'y'){
include "tiki-user_profile.php";
die;
}
$registrationlib = TikiLib::lib('registration');
$trklib = TikiLib::lib('trk');
if (isset($_REQUEST['userId'])) {
......
<?php
/**
* @package tikiwiki
*/
// (c) Copyright 2002-2015 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
require_once ('tiki-setup.php');
include_once ('lib/messu/messulib.php');
include_once ('lib/userprefs/scrambleEmail.php');
$trklib = TikiLib::lib('trk');
if (isset($_REQUEST['userId'])) {
$userwatch = $tikilib->get_user_login($_REQUEST['userId']);
if ($userwatch === false) {
$smarty->assign('errortype', 'no_redirect_login');
$smarty->assign('msg', tra("Unknown user"));
$smarty->display("error.tpl");
die;
}
} elseif (isset($_REQUEST['view_user'])) {
$userwatch = $_REQUEST['view_user'];
if (!$userlib->user_exists($userwatch)) {
$smarty->assign('errortype', 'no_redirect_login');
$smarty->assign('msg', tra("Unknown user"));
$smarty->display("error.tpl");
die;
}
} else {
$access->check_user($user);
$userwatch = $user;
}
$smarty->assign('userwatch', $userwatch);
if ($prefs['feature_score'] == 'y' and isset($user) and $user != $userwatch) {
$tikilib->score_event($user, 'profile_see');
$tikilib->score_event($userwatch, 'profile_is_seen');
}
$lib = TikiLib::lib('unifiedsearch');
$query = $lib->buildQuery([
'type' => 'user',
'object_id' => $userwatch,
]);
$user_info = $query->search($lib->getIndex());
//pass the first user, since there should only be one result. the index, by default returns a list
$smarty->assign("userinfo", $user_info[0]);
//user_tracker_infos is a pref that allows you to list certain tracker fields in the user profile, if set.
if (!empty($prefs['user_tracker_infos'])){
$trackerinfo = explode(',', $prefs['user_tracker_infos']);
// in user_tracker_infos, the first entry refers to the tracker id of the user tracker
$userTrackerId = $trackerinfo[0];
array_shift($trackerinfo);
$definition = Tracker_Definition::get($userTrackerId);
$fields = $definition->getFields();
$template_fields = array();
// for each field in the tracker, if it's in the user_tracker_infos field, pass it to template fields,
// which will be passed to the tpl
foreach ($fields as $field){
if (in_array($field['fieldId'], $trackerinfo)) {
$template_fields[] = array(
'label' => $field['name'],
'permName' => $field['permName'],
);
}
}
$smarty->assign("template_fields",$template_fields);
}
ask_ticket('user-information');
$userprefslib = TikiLib::lib('userprefs');
if ($user_picture_id = $userprefslib->get_user_picture_id($userwatch)) {
$smarty->assign('user_picture_id', $user_picture_id);
}
// disallow robots to index page:
$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
$smarty->assign('mid', 'tiki-user_profile.tpl');
$smarty->display("tiki.tpl");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment