Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
integration
prechecker
Commits
bcab42da
Commit
bcab42da
authored
Jan 12, 2011
by
andyjdavis
Browse files
message MDL-25616 adding recent conversations and recent notifications screens
parent
d911c72b
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
admin/user/user_bulk_message.php
View file @
bcab42da
...
...
@@ -30,7 +30,7 @@ if ($confirm and !empty($msg) and confirm_sesskey()) {
//TODO we should probably support all text formats here or only FORMAT_MOODLE
//For now bulk messaging is still using the html editor and its supplying html
//so we have to use html format for it to be displayed correctly
message_post_message
(
$USER
,
$user
,
$msg
,
FORMAT_HTML
,
'direct'
);
message_post_message
(
$USER
,
$user
,
$msg
,
FORMAT_HTML
);
}
$rs
->
close
();
redirect
(
$return
);
...
...
lang/en/message.php
View file @
bcab42da
...
...
@@ -65,6 +65,8 @@ $string['loggedoff'] = 'Not online';
$string
[
'loggedoffdescription'
]
=
'When I\'m offline'
;
$string
[
'managecontacts'
]
=
'Manage my contacts'
;
$string
[
'mostrecent'
]
=
'Recent messages'
;
$string
[
'mostrecentconversations'
]
=
'Recent conversations'
;
$string
[
'mostrecentnotifications'
]
=
'Recent notifications'
;
$string
[
'mailsent'
]
=
'Your message was sent via email.'
;
$string
[
'maxmessages'
]
=
'Maximum number of messages to show in the discussion history'
;
$string
[
'message'
]
=
'Message'
;
...
...
@@ -93,6 +95,7 @@ $string['private_config'] = 'Popup message window';
$string
[
'processortag'
]
=
'Destination'
;
$string
[
'providers_config'
]
=
'Configure notification methods for incoming messages'
;
$string
[
'providerstag'
]
=
'Source'
;
$string
[
'recent'
]
=
'Recent'
;
$string
[
'readmessages'
]
=
'{$a} read messages'
;
$string
[
'removecontact'
]
=
'Remove contact'
;
$string
[
'savemysettings'
]
=
'Save my settings'
;
...
...
message/index.php
View file @
bcab42da
...
...
@@ -37,7 +37,10 @@ if (empty($CFG->messaging)) {
print_error
(
'disabled'
,
'message'
);
}
//VIEW_PARAM is the preferred URL parameter but we'll still accept usergroup in case its referenced externally
$usergroup
=
optional_param
(
'usergroup'
,
VIEW_UNREAD_MESSAGES
,
PARAM_ALPHANUMEXT
);
$viewing
=
optional_param
(
VIEW_PARAM
,
$usergroup
,
PARAM_ALPHANUMEXT
);
$history
=
optional_param
(
'history'
,
MESSAGE_HISTORY_SHORT
,
PARAM_INT
);
$search
=
optional_param
(
'search'
,
''
,
PARAM_CLEAN
);
//TODO: use PARAM_RAW, but make sure we use s() and p() properly
...
...
@@ -61,13 +64,15 @@ if ($user2id !== 0) {
$url
->
param
(
'id'
,
$user2id
);
}
if
(
$usergroup
!==
0
)
{
if
(
$user2id
!==
0
&&
$usergroup
==
VIEW_SEARCH
)
{
//if theyve searched and selected a user change the view back to contacts so the search button is displayed
$usergroup
=
VIEW_CONTACTS
;
if
(
$user2id
!==
0
)
{
//Switch view back to contacts if:
//1) theyve searched and selected a user
//2) they've viewed recent messages or notifications and clicked through to a user
if
(
$viewing
==
VIEW_SEARCH
||
$viewing
==
VIEW_SEARCH
||
$viewing
==
VIEW_RECENT_NOTIFICATIONS
)
{
$viewing
=
VIEW_CONTACTS
;
}
$url
->
param
(
'usergroup'
,
$usergroup
);
}
$url
->
param
(
'viewing'
,
$viewing
);
$PAGE
->
set_url
(
$url
);
...
...
@@ -80,8 +85,8 @@ $context = get_context_instance(CONTEXT_SYSTEM);
$user1
=
null
;
$currentuser
=
true
;
$showcontactactionlinks
=
SHOW_ACTION_LINKS_IN_CONTACT_LIST
;
if
(
$user1id
!=
$USER
->
id
)
{
$user1
=
$DB
->
get_record
(
'user'
,
array
(
'id'
=>
$user1id
));
if
(
$user1id
!=
$USER
->
id
)
{
$user1
=
$DB
->
get_record
(
'user'
,
array
(
'id'
=>
$user1id
));
if
(
!
$user1
)
{
print_error
(
'invaliduserid'
);
}
...
...
@@ -94,7 +99,7 @@ unset($user1id);
$user2
=
null
;
if
(
!
empty
(
$user2id
))
{
$user2
=
$DB
->
get_record
(
"user"
,
array
(
"id"
=>
$user2id
));
$user2
=
$DB
->
get_record
(
"user"
,
array
(
"id"
=>
$user2id
));
if
(
!
$user2
)
{
print_error
(
'invaliduserid'
);
}
...
...
@@ -102,7 +107,7 @@ if (!empty($user2id)) {
unset
(
$user2id
);
//the current user isnt involved in this discussion at all
if
(
$user1
->
id
!=
$USER
->
id
&&
$user2
->
id
!=
$USER
->
id
&&
!
has_capability
(
'moodle/site:readallmessages'
,
$context
))
{
if
(
$user1
->
id
!=
$USER
->
id
&&
(
!
empty
(
$user2
)
&&
$user2
->
id
!=
$USER
->
id
)
&&
!
has_capability
(
'moodle/site:readallmessages'
,
$context
))
{
print_error
(
'accessdenied'
,
'admin'
);
}
...
...
@@ -110,7 +115,7 @@ if ($user1->id!=$USER->id && $user2->id!=$USER->id && !has_capability('moodle/si
if
(
$addcontact
and
confirm_sesskey
())
{
add_to_log
(
SITEID
,
'message'
,
'add contact'
,
'index.php?user1='
.
$addcontact
.
'&user2='
.
$USER
->
id
,
$addcontact
);
message_add_contact
(
$addcontact
);
redirect
(
$CFG
->
wwwroot
.
'/message/index.php?
usergroup
=contacts&id='
.
$addcontact
);
redirect
(
$CFG
->
wwwroot
.
'/message/index.php?
'
.
VIEW_PARAM
.
'
=contacts&id='
.
$addcontact
);
}
if
(
$removecontact
and
confirm_sesskey
())
{
add_to_log
(
SITEID
,
'message'
,
'remove contact'
,
'index.php?user1='
.
$removecontact
.
'&user2='
.
$USER
->
id
,
$removecontact
);
...
...
@@ -130,7 +135,7 @@ $messageerror = null;
if
(
$currentuser
&&
!
empty
(
$user2
)
&&
has_capability
(
'moodle/site:sendmessage'
,
$context
))
{
// Check that the user is not blocking us!!
if
(
$contact
=
$DB
->
get_record
(
'message_contacts'
,
array
(
'userid'
=>
$user2
->
id
,
'contactid'
=>
$user1
->
id
)))
{
if
(
$contact
=
$DB
->
get_record
(
'message_contacts'
,
array
(
'userid'
=>
$user2
->
id
,
'contactid'
=>
$user1
->
id
)))
{
if
(
$contact
->
blocked
and
!
has_capability
(
'moodle/site:readallmessages'
,
$context
))
{
$messageerror
=
get_string
(
'userisblockingyou'
,
'message'
);
}
...
...
@@ -156,9 +161,9 @@ if ($currentuser && !empty($user2) && has_capability('moodle/site:sendmessage',
print_error
(
'invalidsesskey'
);
}
$messageid
=
message_post_message
(
$user1
,
$user2
,
$data
->
message
,
FORMAT_MOODLE
,
'direct'
);
$messageid
=
message_post_message
(
$user1
,
$user2
,
$data
->
message
,
FORMAT_MOODLE
);
if
(
!
empty
(
$messageid
))
{
redirect
(
$CFG
->
wwwroot
.
'/message/index.php?
usergroup='
.
$usergroup
.
'&id='
.
$user2
->
id
);
redirect
(
$CFG
->
wwwroot
.
'/message/index.php?
'
.
VIEW_PARAM
.
'='
.
$viewing
.
'&id='
.
$user2
->
id
);
}
}
}
...
...
@@ -191,16 +196,16 @@ if (!empty($user2)) {
if
(
$countunread
>
0
)
{
//mark the messages we're going to display as read
message_mark_messages_read
(
$user1
->
id
,
$user2
->
id
);
if
(
$
usergroup
==
VIEW_UNREAD_MESSAGES
)
{
if
(
$
viewing
==
VIEW_UNREAD_MESSAGES
)
{
$viewingnewmessages
=
true
;
}
}
}
$countunreadtotal
=
message_count_unread_messages
(
$user1
);
if
(
$countunreadtotal
==
0
&&
$
usergroup
==
VIEW_UNREAD_MESSAGES
&&
empty
(
$user2
))
{
if
(
$countunreadtotal
==
0
&&
$
viewing
==
VIEW_UNREAD_MESSAGES
&&
empty
(
$user2
))
{
//default to showing the search
$
usergroup
=
VIEW_SEARCH
;
$
viewing
=
VIEW_SEARCH
;
}
$blockedusers
=
message_get_blocked_users
(
$user1
,
$user2
);
...
...
@@ -208,18 +213,18 @@ $countblocked = count($blockedusers);
list
(
$onlinecontacts
,
$offlinecontacts
,
$strangers
)
=
message_get_contacts
(
$user1
,
$user2
);
message_print_contact_selector
(
$countunreadtotal
,
$
usergroup
,
$user1
,
$user2
,
$blockedusers
,
$onlinecontacts
,
$offlinecontacts
,
$strangers
,
$showcontactactionlinks
,
$page
);
message_print_contact_selector
(
$countunreadtotal
,
$
viewing
,
$user1
,
$user2
,
$blockedusers
,
$onlinecontacts
,
$offlinecontacts
,
$strangers
,
$showcontactactionlinks
,
$page
);
echo
html_writer
::
start_tag
(
'div'
,
array
(
'class'
=>
'messagearea mdl-align'
));
echo
html_writer
::
start_tag
(
'div'
,
array
(
'class'
=>
'messagearea mdl-align'
));
if
(
!
empty
(
$user2
))
{
echo
html_writer
::
start_tag
(
'div'
,
array
(
'class'
=>
'mdl-left messagehistory'
));
echo
html_writer
::
start_tag
(
'div'
,
array
(
'class'
=>
'mdl-left messagehistory'
));
$visible
=
'visible'
;
$hidden
=
'hiddenelement'
;
//cant just use hidden as mform adds that class to its fieldset for something else
$recentlinkclass
=
$recentlabelclass
=
$historylinkclass
=
$historylabelclass
=
$visible
;
if
(
$history
==
MESSAGE_HISTORY_ALL
)
{
if
(
$history
==
MESSAGE_HISTORY_ALL
)
{
$displaycount
=
0
;
$recentlabelclass
=
$historylinkclass
=
$hidden
;
...
...
@@ -239,25 +244,25 @@ echo html_writer::start_tag('div', array('class'=>'messagearea mdl-align'));
$recentlinkclass
=
$historylabelclass
=
$hidden
;
}
$messagehistorylink
=
html_writer
::
start_tag
(
'div'
,
array
(
'class'
=>
'mdl-align messagehistorytype'
));
$messagehistorylink
=
html_writer
::
start_tag
(
'div'
,
array
(
'class'
=>
'mdl-align messagehistorytype'
));
$messagehistorylink
.
=
html_writer
::
link
(
$PAGE
->
url
->
out
(
false
)
.
'&history='
.
MESSAGE_HISTORY_ALL
,
get_string
(
'messagehistoryfull'
,
'message'
),
array
(
'class'
=>
$historylinkclass
));
array
(
'class'
=>
$historylinkclass
));
$messagehistorylink
.
=
html_writer
::
start_tag
(
'span'
,
array
(
'class'
=>
$historylabelclass
));
$messagehistorylink
.
=
html_writer
::
start_tag
(
'span'
,
array
(
'class'
=>
$historylabelclass
));
$messagehistorylink
.
=
get_string
(
'messagehistoryfull'
,
'message'
);
$messagehistorylink
.
=
html_writer
::
end_tag
(
'span'
);
$messagehistorylink
.
=
' | '
.
html_writer
::
link
(
$PAGE
->
url
->
out
(
false
)
.
'&history='
.
MESSAGE_HISTORY_SHORT
,
get_string
(
'mostrecent'
,
'message'
),
array
(
'class'
=>
$recentlinkclass
));
array
(
'class'
=>
$recentlinkclass
));
$messagehistorylink
.
=
html_writer
::
start_tag
(
'span'
,
array
(
'class'
=>
$recentlabelclass
));
$messagehistorylink
.
=
html_writer
::
start_tag
(
'span'
,
array
(
'class'
=>
$recentlabelclass
));
$messagehistorylink
.
=
get_string
(
'mostrecent'
,
'message'
);
$messagehistorylink
.
=
html_writer
::
end_tag
(
'span'
);
if
(
$viewingnewmessages
)
{
$messagehistorylink
.
=
' | '
.
html_writer
::
start_tag
(
'span'
);
//, array('class'=>$historyclass)
$messagehistorylink
.
=
' | '
.
html_writer
::
start_tag
(
'span'
);
//, array('class'
=>
$historyclass)
$messagehistorylink
.
=
get_string
(
'unreadnewmessages'
,
'message'
,
$displaycount
);
$messagehistorylink
.
=
html_writer
::
end_tag
(
'span'
);
}
...
...
@@ -269,7 +274,7 @@ echo html_writer::start_tag('div', array('class'=>'messagearea mdl-align'));
//send message form
if
(
$currentuser
&&
has_capability
(
'moodle/site:sendmessage'
,
$context
))
{
echo
html_writer
::
start_tag
(
'div'
,
array
(
'class'
=>
'mdl-align messagesend'
));
echo
html_writer
::
start_tag
(
'div'
,
array
(
'class'
=>
'mdl-align messagesend'
));
if
(
!
empty
(
$messageerror
))
{
echo
$OUTPUT
->
heading
(
$messageerror
,
3
);
}
else
{
...
...
@@ -283,8 +288,12 @@ echo html_writer::start_tag('div', array('class'=>'messagearea mdl-align'));
}
echo
html_writer
::
end_tag
(
'div'
);
}
}
else
if
(
$
usergroup
==
VIEW_SEARCH
)
{
}
else
if
(
$
viewing
==
VIEW_SEARCH
)
{
message_print_search
(
$advancedsearch
,
$user1
);
}
else
if
(
$viewing
==
VIEW_RECENT_CONVERSATIONS
)
{
message_print_recent_conversations
(
$user1
);
}
else
if
(
$viewing
==
VIEW_RECENT_NOTIFICATIONS
)
{
message_print_recent_notifications
(
$user1
);
}
echo
html_writer
::
end_tag
(
'div'
);
...
...
message/lib.php
View file @
bcab42da
This diff is collapsed.
Click to expand it.
theme/base/style/message.css
View file @
bcab42da
...
...
@@ -47,6 +47,11 @@ table.message .searchresults td {padding:5px;}
.message
.messagearea
.messagesend
.messagesendbox
{
width
:
100%
}
.message
.messagearea
.messagesend
fieldset
{
padding
:
0px
;
margin
:
0
;}
/** bring the message send button closer to the message box */
.message
.messagearea
.messagerecent
{
text-align
:
left
;
width
:
100%
;}
.message
.messagearea
.messagerecent
.singlemessage
{
border-bottom
:
1px
solid
#D3D3D3
;
padding
:
10px
;}
.message
.messagearea
.messagerecent
.singlemessage
.otheruser
span
{
padding
:
5px
;}
.message
.messagearea
.messagerecent
.singlemessage
.messagedate
{
float
:
right
;}
.message
.hiddenelement
{
display
:
none
;}
/** not just using hidden as mform adds that class to its fieldset */
.message
.visible
{
display
:
inline
;}
...
...
user/messageselect.php
View file @
bcab42da
...
...
@@ -142,7 +142,7 @@ if (!empty($messagebody) && !$edit && !$deluser && ($preview || $send)) {
}
else
if
(
!
empty
(
$send
))
{
$good
=
1
;
foreach
(
$SESSION
->
emailto
[
$id
]
as
$user
)
{
$good
=
$good
&&
message_post_message
(
$USER
,
$user
,
$messagebody
,
$format
,
'direct'
);
$good
=
$good
&&
message_post_message
(
$USER
,
$user
,
$messagebody
,
$format
);
}
if
(
!
empty
(
$good
))
{
echo
$OUTPUT
->
heading
(
get_string
(
'messagedselectedusers'
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment