Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
383752ee
Commit
383752ee
authored
Jul 22, 2015
by
Aaron Wells
Committed by
Gerrit Code Review
Jul 22, 2015
Browse files
Merge "Bug 1383543: script multirecipientnotification/js/sendmessage.js is redundant"
parents
b47fc8cd
9dfa43c7
Changes
1
Show whitespace changes
Inline
Side-by-side
htdocs/artefact/multirecipientnotification/js/sendmessage.js
deleted
100644 → 0
View file @
b47fc8cd
/**
* Multi-Recipient Notification Send Message
*
* @package mahara
* @subpackage artefact-multirecipientnotification
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*/
function
initializeAutocomplete
()
{
jQuery
(
"
#sendmessage_addnewrecipient
"
).
catcomplete
({
delay
:
0
,
source
:
function
(
request
,
callback
)
{
getAutocompleteSource
(
request
,
callback
);
},
select
:
function
(
event
,
ui
)
{
var
userid
=
ui
.
item
.
userid
;
var
username
=
ui
.
item
.
label
;
var
userspan
=
document
.
createElement
(
'
span
'
);
var
jUserspan
=
jQuery
(
userspan
);
var
inputhidden
=
document
.
createElement
(
'
input
'
);
var
jInputhidden
=
jQuery
(
inputhidden
);
jInputhidden
.
attr
(
'
type
'
,
'
hidden
'
).
attr
(
'
name
'
,
'
recipients[]
'
).
attr
(
'
value
'
,
userid
);
jUserspan
.
append
(
jInputhidden
);
var
label
=
document
.
createElement
(
'
a
'
);
var
jLabel
=
jQuery
(
label
);
jLabel
.
attr
(
'
href
'
,
config
.
wwwroot
+
'
admin/users/edit.php?id=
'
+
userid
);
jLabel
.
text
(
username
);
jUserspan
.
append
(
jLabel
);
var
link
=
document
.
createElement
(
'
a
'
);
var
jLink
=
jQuery
(
link
);
jLink
.
attr
(
'
onclick
'
,
'
removeRecipient("
'
+
username
+
'
")
'
);
var
img
=
document
.
createElement
(
'
img
'
);
jUserspan
.
append
(
jLink
);
jQuery
(
'
#sendmessage_addnewrecipient
'
).
before
(
jUserspan
);
var
jOnclicktext
=
jQuery
(
'
#sendmessage_addnewrecipient
'
);
jOnclicktext
.
attr
(
'
value
'
,
''
);
return
false
;
}
});
jQuery
(
'
#sendmessage_addnewrecipient
'
).
each
(
function
()
{
var
default_value
=
this
.
value
;
var
jInput
=
jQuery
(
this
);
jInput
.
focus
(
function
()
{
if
(
this
.
value
===
default_value
)
{
this
.
value
=
''
;
}
});
jInput
.
blur
(
function
()
{
if
(
jQuery
.
trim
(
this
.
value
)
===
''
)
{
this
.
value
=
default_value
;
}
});
});
}
function
removeRecipient
(
name
)
{
var
onclicktext
=
jQuery
(
'
#sendmessage_addnewrecipient
'
);
var
list
=
onclicktext
.
parent
();
list
.
children
(
'
div :contains("
'
+
name
+
'
")
'
).
remove
();
var
jOnclicktext
=
jQuery
(
'
#sendmessage_addnewrecipient
'
);
jOnclicktext
.
attr
(
'
value
'
,
''
);
}
function
getAutocompleteSource
(
request
,
callback
)
{
var
jOnclicklist
=
jQuery
(
'
#sendmessage_addnewrecipient
'
).
parent
();
var
ignoreusers
=
[];
jOnclicklist
.
find
(
'
input:hidden
'
).
each
(
function
()
{
ignoreusers
.
push
(
jQuery
(
this
).
val
());
});
sendjsonrequest
(
'
sendmessage.json.php
'
,
{
getuserlist
:
1
,
ignoreusers
:
JSON
.
stringify
(
ignoreusers
),
request
:
request
.
term
},
'
GET
'
,
function
(
data
)
{
callback
(
data
.
data
.
autocompleteusers
);
}
);
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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