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
mahara
mahara
Commits
db3af394
Commit
db3af394
authored
Dec 08, 2017
by
Robert Lyon
Committed by
Gerrit Code Review
Dec 08, 2017
Browse files
Merge "Bug 1520028: Add portfolio links in TinyMCE link plugin"
parents
258afd85
13fc2089
Changes
6
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/annotation/blocktype/annotation/js/annotation.js
View file @
db3af394
...
...
@@ -8,21 +8,7 @@
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*/
/**
* Return the specified request variable from the URL.
* This should be moved to mahara.js to everyone can use it.
*/
function
getURLParameter
(
variable
)
{
var
query
=
window
.
location
.
search
.
substring
(
1
);
var
vars
=
query
.
split
(
"
&
"
);
for
(
var
i
=
0
;
i
<
vars
.
length
;
i
++
)
{
var
pair
=
vars
[
i
].
split
(
"
=
"
);
if
(
pair
[
0
]
==
variable
)
{
return
pair
[
1
];
}
}
return
false
;
}
function
isTinyMceUsed
(
elementname
)
{
return
(
tinyMCE
!==
undefined
&&
tinyMCE
.
get
(
elementname
)
!==
undefined
);
...
...
@@ -38,8 +24,8 @@ function initTinyMCE(formname){
function
modifyAnnotationFeedbackSuccess
(
form
,
data
)
{
var
formname
=
form
.
name
;
var
limit
=
getU
RL
Parameter
(
'
limit
'
);
var
offset
=
getU
RL
Parameter
(
'
offset
'
);
var
limit
=
getU
rl
Parameter
(
'
limit
'
);
var
offset
=
getU
rl
Parameter
(
'
offset
'
);
if
(
limit
===
false
&&
offset
===
false
)
{
// Pagination is not used.
...
...
@@ -81,8 +67,8 @@ function modifyAnnotationFeedbackSuccess(form, data) {
function
addAnnotationFeedbackSuccess
(
form
,
data
)
{
var
formname
=
form
.
name
;
var
blockid
=
jQuery
(
'
#
'
+
formname
+
'
_blockid
'
).
val
();
var
limit
=
getU
RL
Parameter
(
'
limit
'
);
var
offset
=
getU
RL
Parameter
(
'
offset
'
);
var
limit
=
getU
rl
Parameter
(
'
limit
'
);
var
offset
=
getU
rl
Parameter
(
'
offset
'
);
var
tinymce
=
jQuery
(
'
#
'
+
form
.
id
+
'
_message
'
);
if
(
limit
===
false
&&
offset
===
false
)
{
...
...
htdocs/group/edit.php
View file @
db3af394
...
...
@@ -39,6 +39,7 @@ if ($id = param_integer('id', null)) {
}
else
{
define
(
'TITLE'
,
get_string
(
'creategroup'
,
'group'
));
define
(
'CREATEGROUP'
,
true
);
if
(
!
group_can_create_groups
())
{
throw
new
AccessDeniedException
(
get_string
(
'accessdenied'
,
'error'
));
...
...
htdocs/js/mahara.js
View file @
db3af394
...
...
@@ -9,6 +9,8 @@
*
*/
// Expects strings array
function
get_string
(
name
)
{
// Flatten the arguments in case string parameters were passed as an array
...
...
htdocs/json/tinymceviewlist.json.php
0 → 100644
View file @
db3af394
<?php
/**
*
* @package mahara
* @subpackage core
* @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.
*
*/
define
(
'INTERNAL'
,
1
);
define
(
'JSON'
,
1
);
require
(
dirname
(
dirname
(
__FILE__
))
.
'/init.php'
);
global
$USER
;
require_once
(
get_config
(
'libroot'
)
.
'view.php'
);
$viewid
=
param_integer
(
'viewid'
,
null
);
$linklist
=
array
();
list
(
$collections
,
$views
)
=
View
::
get_views_and_collections
(
$USER
->
get
(
'id'
));
if
(
!
empty
(
$views
)
||
!
empty
(
$collections
))
{
foreach
(
$views
as
$view
)
{
if
(
$viewid
!=
$view
[
'id'
])
{
// dont list the current view
$linklist
[]
=
array
(
'title'
=>
$view
[
'name'
],
'value'
=>
$view
[
'url'
],
);
}
}
foreach
(
$collections
as
$collection
)
{
$collectionitem
=
array
();
if
(
!
isset
(
$collection
[
'views'
][
$viewid
]))
{
// dont list the collection that contains the current view
$collectionitem
[
'title'
]
=
$collection
[
'name'
];
usort
(
$collection
[
'views'
],
function
(
$a
,
$b
)
{
return
$a
[
'displayorder'
]
>
$b
[
'displayorder'
];});
foreach
(
$collection
[
'views'
]
as
$view
)
{
if
(
$viewid
!=
$view
[
'id'
])
{
$collectionitem
[
'menu'
][]
=
array
(
'title'
=>
$view
[
'name'
],
'value'
=>
$view
[
'url'
],
);
}
}
$linklist
[]
=
$collectionitem
;
}
}
}
usort
(
$linklist
,
function
(
$a
,
$b
)
{
return
strnatcasecmp
(
$a
[
'title'
],
$b
[
'title'
]);
});
json_reply
(
false
,
array
(
'data'
=>
json_encode
(
$linklist
),
'count'
=>
count
(
$linklist
)));
htdocs/lib/view.php
View file @
db3af394
...
...
@@ -6347,7 +6347,8 @@ class View {
db_format_tsfield
(
'v.submittedtime'
,
'submittedtime'
)
.
", v.submittedstatus,
c.id AS cid, c.name AS cname, c.framework,
c.submittedgroup AS csubmitgroup, c.submittedhost AS csubmithost, "
.
db_format_tsfield
(
'c.submittedtime'
,
'csubmittime'
)
.
", c.submittedstatus AS csubmitstatus
db_format_tsfield
(
'c.submittedtime'
,
'csubmittime'
)
.
", c.submittedstatus AS csubmitstatus,
cv.displayorder
FROM
{
view
}
v
LEFT JOIN
{
collection_view
}
cv ON v.id = cv.view
LEFT JOIN
{
collection
}
c ON cv.collection = c.id
...
...
@@ -6403,6 +6404,7 @@ class View {
'submittedhost'
=>
$r
[
'submittedhost'
],
'submittedtime'
=>
$r
[
'submittedtime'
],
'submittedstatus'
=>
$r
[
'submittedstatus'
],
'displayorder'
=>
$r
[
'displayorder'
],
);
if
(
isset
(
$r
[
'user'
]))
{
$v
[
'ownername'
]
=
display_name
(
$r
[
'user'
]);
...
...
htdocs/lib/web.php
View file @
db3af394
...
...
@@ -112,6 +112,15 @@ function get_stylesheets_for_current_page($stylesheets, $extraconfig) {
return
$stylesheets
;
}
/**
* True if we are not in admin, institution or admin section
*/
function
user_personal_section
()
{
$usersection
=
!
defined
(
'ADMIN'
)
&&
!
defined
(
'STAFF'
)
&&
!
defined
(
'INSTITUTIONALADMIN'
)
&&
!
defined
(
'INSTITUTIONALSTAFF'
)
&&
!
defined
(
'GROUP'
)
&&
!
defined
(
'CREATEGROUP'
);
return
$usersection
?
1
:
0
;
}
/**
* This function creates a Smarty object and sets it up for use within our
...
...
@@ -141,7 +150,7 @@ function get_stylesheets_for_current_page($stylesheets, $extraconfig) {
function
smarty
(
$javascript
=
array
(),
$headers
=
array
(),
$pagestrings
=
array
(),
$extraconfig
=
array
())
{
global
$USER
,
$SESSION
,
$THEME
,
$HEADDATA
,
$langselectform
,
$CFG
;
global
$USER
,
$SESSION
,
$THEME
,
$HEADDATA
,
$langselectform
,
$CFG
,
$viewid
;
if
(
!
is_array
(
$headers
))
{
$headers
=
array
();
...
...
@@ -217,6 +226,15 @@ function smarty($javascript = array(), $headers = array(), $pagestrings = array(
if
(
is_html_editor_enabled
())
{
$checkarray
=
array
(
&
$javascript
,
&
$headers
);
$found_tinymce
=
false
;
$tinymceviewid
=
'null'
;
if
(
$inpersonalarea
=
user_personal_section
())
{
if
(
defined
(
'SECTION_PAGE'
)
&&
(
SECTION_PAGE
==
'view'
||
SECTION_PAGE
==
'blocks'
||
SECTION_PAGE
==
'editlayout'
))
{
if
(
isset
(
$viewid
)
&&
$viewid
>
0
)
{
$tinymceviewid
=
$viewid
;
}
}
}
foreach
(
$checkarray
as
&
$check
)
{
if
((
$key
=
array_search
(
'tinymce'
,
$check
))
!==
false
||
(
$key
=
array_search
(
'tinytinymce'
,
$check
))
!==
false
)
{
if
(
!
$found_tinymce
)
{
...
...
@@ -327,6 +345,26 @@ tinyMCE.init({
remove_script_host: false,
relative_urls: false,
target_list: false,
link_list: function(success) {
// Only show the list of links in the normal user section
if ({$inpersonalarea}) {
var params = {
'viewid': {$tinymceviewid}
}
sendjsonrequest(config['wwwroot'] + 'json/tinymceviewlist.json.php', params, 'POST', function(data) {
if (data.count > 0) {
success(JSON.parse(data.data));
}
else {
success(''); // stop showing list with only option being 'none'
}
});
}
else {
success(''); // stop showing list with only option being 'none'
}
},
cache_suffix: '?v={$CFG->cacheversion}',
{$extramceconfig}
setup: function(ed) {
...
...
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