Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
mahara
mahara
Commits
582f5220
Commit
582f5220
authored
Feb 25, 2009
by
Richard Mansfield
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix position of 'about me' block in profile views
parent
3e4bac1c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
4 deletions
+38
-4
htdocs/auth/user.php
htdocs/auth/user.php
+4
-2
htdocs/lib/db/upgrade.php
htdocs/lib/db/upgrade.php
+13
-0
htdocs/lib/user.php
htdocs/lib/user.php
+1
-1
htdocs/lib/version.php
htdocs/lib/version.php
+1
-1
htdocs/lib/view.php
htdocs/lib/view.php
+19
-0
No files found.
htdocs/auth/user.php
View file @
582f5220
...
...
@@ -413,6 +413,7 @@ class User {
private
function
install_profile_view
()
{
static
$systemprofileviewid
=
null
;
db_begin
();
if
(
is_null
(
$systemprofileviewid
))
{
$systemprofileviewid
=
get_field
(
'view'
,
'id'
,
'owner'
,
0
,
'type'
,
'profile'
);
}
...
...
@@ -430,7 +431,7 @@ class User {
'title'
=>
get_string
(
'aboutme'
,
'blocktype.internal/profileinfo'
),
'view'
=>
$view
->
get
(
'id'
),
'column'
=>
1
,
'order'
=>
0
,
'order'
=>
1
,
));
$configdata
=
array
(
'artefactids'
=>
array
());
if
(
$intro
=
get_field
(
'artefact'
,
'id'
,
'owner'
,
$this
->
get
(
'id'
),
'artefacttype'
,
'introduction'
))
{
...
...
@@ -443,7 +444,7 @@ class User {
$configdata
[
'profileicon'
]
=
$this
->
get
(
'profileicon'
);
}
$aboutme
->
set
(
'configdata'
,
$configdata
);
$
aboutme
->
commit
(
);
$
view
->
addblockinstance
(
$aboutme
);
$view
->
set_access
(
array
(
array
(
...
...
@@ -452,6 +453,7 @@ class User {
'stopdate'
=>
null
,
),
));
db_commit
();
return
$view
;
}
...
...
htdocs/lib/db/upgrade.php
View file @
582f5220
...
...
@@ -838,6 +838,19 @@ function xmldb_core_upgrade($oldversion=0) {
insert_record
(
'cron'
,
$cron
);
}
if
(
$oldversion
<
2009022500
)
{
// Get rid of all blocks with position 0 caused by 'about me' block on profile views
if
(
count_records
(
'block_instance'
,
'order'
,
0
)
&&
!
count_records_select
(
'block_instance'
,
'"order" < 0'
))
{
execute_sql
(
'UPDATE {block_instance} SET "order" = -1 * "order" WHERE id IN (
SELECT i.id FROM {block_instance} i
INNER JOIN (SELECT view, "column" FROM {block_instance} WHERE "order" = 0) z
ON (z.view = i.view AND z.column = i.column))'
);
execute_sql
(
'UPDATE {block_instance} SET "order" = 1 WHERE "order" = 0'
);
execute_sql
(
'UPDATE {block_instance} SET "order" = -1 * ("order" - 1) WHERE "order" < 0'
);
}
}
return
$status
;
}
...
...
htdocs/lib/user.php
View file @
582f5220
...
...
@@ -1323,7 +1323,7 @@ function install_system_profile_view() {
)));
$blocktypes
=
array
(
'myviews'
=>
1
,
'mygroups'
=>
1
,
'myfriends'
=>
2
,
'wall'
=>
2
);
// column ids
$installed
=
get_column_sql
(
'SELECT name FROM {blocktype_installed} WHERE name IN ('
.
join
(
','
,
array_map
(
'db_quote'
,
array_keys
(
$blocktypes
)))
.
')'
);
$weights
=
array
(
1
=>
1
,
2
=>
0
);
// Leave a space for About Me in the first column
$weights
=
array
(
1
=>
0
,
2
=>
0
);
foreach
(
array_keys
(
$blocktypes
)
as
$blocktype
)
{
if
(
in_array
(
$blocktype
,
$installed
))
{
$weights
[
$blocktypes
[
$blocktype
]]
++
;
...
...
htdocs/lib/version.php
View file @
582f5220
...
...
@@ -27,7 +27,7 @@
defined
(
'INTERNAL'
)
||
die
();
$config
=
new
StdClass
;
$config
->
version
=
200902
1901
;
$config
->
version
=
200902
2500
;
$config
->
release
=
'1.1.0beta5dev'
;
$config
->
minupgradefrom
=
2008040200
;
$config
->
minupgraderelease
=
'1.0.0 (release tag 1.0.0_RELEASE)'
;
...
...
htdocs/lib/view.php
View file @
582f5220
...
...
@@ -1103,6 +1103,25 @@ class View {
}
}
/**
* adds a block instance to a view
* @param array $values parameters for this function
* block => block to add
*/
public
function
addblockinstance
(
BlockInstance
$bi
)
{
if
(
!
$bi
->
get
(
'column'
))
{
$bi
->
set
(
'column'
,
1
);
}
if
(
!
$bi
->
get
(
'order'
))
{
$bi
->
set
(
'order'
,
1
);
}
if
(
!
$bi
->
get
(
'view'
))
{
$bi
->
set
(
'view'
,
$this
->
get
(
'id'
));
}
$this
->
shuffle_column
(
$bi
->
get
(
'column'
),
$bi
->
get
(
'order'
));
$bi
->
commit
();
}
/**
* deletes a block instance from the view
*
...
...
Write
Preview
Markdown
is supported
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