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
aca61905
Commit
aca61905
authored
Nov 12, 2014
by
Robert Lyon
Committed by
Gerrit Code Review
Nov 12, 2014
Browse files
Merge "Put blocks in "shortcut" category to put them at top of the block picker"
parents
28790fc5
c098b01b
Changes
10
Show whitespace changes
Inline
Side-by-side
htdocs/artefact/file/blocktype/image/lib.php
View file @
aca61905
...
...
@@ -22,7 +22,7 @@ class PluginBlocktypeImage extends PluginBlocktype {
}
public
static
function
get_categories
()
{
return
array
();
return
array
(
'shortcut'
);
}
public
static
function
render_instance
(
BlockInstance
$instance
,
$editing
=
false
)
{
...
...
htdocs/artefact/file/blocktype/image/version.php
View file @
aca61905
...
...
@@ -12,5 +12,5 @@
defined
(
'INTERNAL'
)
||
die
();
$config
=
new
StdClass
;
$config
->
version
=
201009080
1
;
$config
->
release
=
'1.0.
1
'
;
$config
->
version
=
201009080
2
;
$config
->
release
=
'1.0.
2
'
;
htdocs/blocktype/text/lib.php
View file @
aca61905
...
...
@@ -22,7 +22,7 @@ class PluginBlocktypeText extends SystemBlocktype {
}
public
static
function
get_categories
()
{
return
array
();
return
array
(
'shortcut'
);
}
public
static
function
render_instance
(
BlockInstance
$instance
,
$editing
=
false
)
{
...
...
htdocs/blocktype/text/version.php
View file @
aca61905
...
...
@@ -12,5 +12,5 @@
defined
(
'INTERNAL'
)
||
die
();
$config
=
new
StdClass
;
$config
->
version
=
201408220
1
;
$config
->
release
=
'1.0.
1
'
;
$config
->
version
=
201408220
2
;
$config
->
release
=
'1.0.
2
'
;
htdocs/lib/db/upgrade.php
View file @
aca61905
...
...
@@ -3758,5 +3758,19 @@ function xmldb_core_upgrade($oldversion=0) {
set_config
(
'cacheversion'
,
rand
(
1000
,
9999
));
}
}
if
(
$oldversion
<
2014110700
)
{
// Increment all the existing sorts by 1 to make room...
$cats
=
get_records_array
(
'blocktype_category'
,
''
,
''
,
'sort desc'
);
foreach
(
$cats
as
$cat
)
{
$cat
->
sort
=
$cat
->
sort
+
1
;
update_record
(
'blocktype_category'
,
$cat
,
'name'
);
}
$todb
=
new
stdClass
();
$todb
->
name
=
'shortcut'
;
$todb
->
sort
=
'0'
;
insert_record
(
'blocktype_category'
,
$todb
);
}
return
$status
;
}
htdocs/lib/upgrade.php
View file @
aca61905
...
...
@@ -1109,7 +1109,7 @@ function sort_upgrades($k1, $k2) {
/** blocktype categories the system exports (including artefact categories)
*/
function
get_blocktype_categories
()
{
return
array
(
'fileimagevideo'
,
'blog'
,
'general'
,
'internal'
,
'resume'
,
'external'
);
return
array
(
'shortcut'
,
'fileimagevideo'
,
'blog'
,
'general'
,
'internal'
,
'resume'
,
'external'
);
}
function
install_blocktype_categories_for_plugin
(
$blocktype
)
{
...
...
htdocs/lib/version.php
View file @
aca61905
...
...
@@ -16,7 +16,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/index.php/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config
->
version
=
2014110
5
00
;
$config
->
version
=
2014110
7
00
;
$config
->
series
=
'15.04'
;
$config
->
release
=
'15.04dev'
;
$config
->
minupgradefrom
=
2009022600
;
...
...
htdocs/lib/view.php
View file @
aca61905
...
...
@@ -1591,7 +1591,12 @@ class View {
public
function
build_category_list
(
$category
,
$new
=
0
)
{
$categories
=
$this
->
get_category_data
();
$flag
=
false
;
foreach ($categories as &$cat) {
foreach
(
$categories
as
$i
=>
&
$cat
)
{
// The "shortcut" category should be treated special.
if
(
$cat
[
'name'
]
==
'shortcut'
)
{
unset
(
$categories
[
$i
]);
continue
;
}
$classes
=
''
;
if
(
!
$flag
)
{
$flag
=
true
;
...
...
htdocs/theme/raw/templates/view/contenteditor.tpl
View file @
aca61905
<div
id=
"content-editor"
>
<div
id=
"content-editor-header"
><div>
{
str
tag
=
addcontent
section
=
view
}
</div></div>
<div
id=
"content-editor-foldable"
>
<div
id=
"blocktype-common"
class=
"blocktype-list"
>
{* If you are wanting to have some options always showing place the code here. *}
<div
class=
"blocktype"
>
<a
class=
"blocktypelink"
href=
"#"
>
<input
type=
"radio"
class=
"blocktype-radio"
id=
"blocktype-radio-text"
name=
"blocktype"
value=
"text"
>
<img
width=
"24"
height=
"24"
title=
"
{
str
tag
=
description
section
=
blocktype
.
text
}
"
alt=
"
{
str
tag
=
description
section
=
blocktype
.
text
}
"
src=
"
{
$WWWROOT
}
thumb.php?type=blocktype&bt=text"
>
<label
for=
"blocktype-radio-text"
class=
"blocktypetitle"
>
{
str
tag
=
'title'
section
=
'blocktype.text'
}
</label>
</a>
</div>
<div
class=
"blocktype lastrow"
>
<a
class=
"blocktypelink"
href=
"#"
>
<input
type=
"radio"
id=
"blocktype-radio-image"
class=
"blocktype-radio"
name=
"blocktype"
value=
"image"
>
<img
width=
"24"
height=
"24"
title=
"
{
str
tag
=
description
section
=
blocktype
.
file
/
image
}
"
alt=
"
{
str
tag
=
description
section
=
blocktype
.
file
/
image
}
"
src=
"
{
$WWWROOT
}
thumb.php?type=blocktype&bt=image&ap=file"
>
<label
for=
"blocktype-radio-image"
class=
"blocktypetitle"
>
{
str
tag
=
'image'
section
=
'view'
}
</label>
</a>
</div>
</div>
{
if
$shortcut_list
}
<div
id=
"blocktype-common"
class=
"blocktype-list"
>
{* Blocks with the category 'shortcut' should always be showing. *}
{
$shortcut_list
|
safe
}
</div>
{/
if
}
<div
id=
"accordion"
>
{
$category_list
|
safe
}
</div>
...
...
htdocs/view/blocks.php
View file @
aca61905
...
...
@@ -197,6 +197,9 @@ $smarty->assign('addform', $addform);
// The list of categories for the tabbed interface
$smarty
->
assign
(
'category_list'
,
$view
->
build_category_list
(
$category
,
$new
));
// The list of shortcut blocks
$smarty
->
assign
(
'shortcut_list'
,
$view
->
build_blocktype_list
(
'shortcut'
));
// The list of blocktypes for the default category
$smarty
->
assign
(
'blocktype_list'
,
$view
->
build_blocktype_list
(
$category
));
...
...
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