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
59033039
Commit
59033039
authored
Aug 06, 2010
by
Stacey Walker
Committed by
Richard Mansfield
Aug 10, 2010
Browse files
collection: view horizontal navigation option per collection
Signed-off-by:
Stacey Walker
<
stacey@catalyst.net.nz
>
parent
e6a173c0
Changes
9
Hide whitespace changes
Inline
Side-by-side
htdocs/collection/views.php
View file @
59033039
...
...
@@ -83,7 +83,7 @@ if ($available = Collection::available_views()) {
}
$elements
[
'submit'
]
=
array
(
'type'
=>
'submit'
,
'value'
=>
get_string
(
'add'
,
'collection'
),
'value'
=>
get_string
(
'add
view
'
,
'collection'
),
'goto'
=>
get_config
(
'wwwroot'
)
.
'collection/views.php?id='
.
$id
,
);
...
...
@@ -97,30 +97,42 @@ if ($available = Collection::available_views()) {
));
}
$smarty
=
smarty
();
$elements
=
array
();
$elements
[
'navigation'
]
=
array
(
'type'
=>
'checkbox'
,
'title'
=>
get_string
(
'viewnavigation'
,
'collection'
),
'description'
=>
get_string
(
'viewnavigationdesc'
,
'collection'
),
'defaultvalue'
=>
$collection
?
$collection
->
get
(
'navigation'
)
:
1
,
);
if
(
$new
)
{
$newform
=
pieform
(
array
(
'name'
=>
'new'
,
'plugintype'
=>
'core'
,
'pluginname'
=>
'collection'
,
'autofocus'
=>
false
,
'method'
=>
'post'
,
'elements'
=>
array
(
'submit'
=>
array
(
'type'
=>
'cancelbackcreate'
,
'value'
=>
array
(
get_string
(
'cancel'
),
get_string
(
'back'
,
'collection'
),
get_string
(
'next'
)
.
': '
.
get_string
(
'editaccess'
,
'collection'
)),
'confirm'
=>
array
(
get_string
(
'confirmcancelcreatingcollection'
,
'collection'
),
null
,
null
),
),
),
));
$smarty
->
assign_by_ref
(
'newform'
,
$newform
);
$elements
[
'submit'
]
=
array
(
'type'
=>
'cancelbackcreate'
,
'value'
=>
array
(
get_string
(
'cancel'
),
get_string
(
'back'
,
'collection'
),
get_string
(
'next'
)
.
': '
.
get_string
(
'editaccess'
,
'collection'
)),
'confirm'
=>
array
(
get_string
(
'confirmcancelcreatingcollection'
,
'collection'
),
null
,
null
),
);
}
else
{
$elements
[
'submit'
]
=
array
(
'type'
=>
'submitcancel'
,
'value'
=>
array
(
get_string
(
'save'
),
get_string
(
'cancel'
)),
);
}
$nextform
=
pieform
(
array
(
'name'
=>
'next'
,
'plugintype'
=>
'core'
,
'pluginname'
=>
'collection'
,
'autofocus'
=>
false
,
'method'
=>
'post'
,
'elements'
=>
$elements
,
));
$smarty
=
smarty
();
$smarty
->
assign
(
'PAGEHEADING'
,
TITLE
);
$smarty
->
assign
(
'displayurl'
,
get_config
(
'wwwroot'
)
.
'collection/views.php?id='
.
$id
.
$newurl
);
$smarty
->
assign
(
'removeurl'
,
get_config
(
'wwwroot'
)
.
'collection/deleteview.php?id='
.
$id
.
$newurl
);
$smarty
->
assign_by_ref
(
'views'
,
$views
);
$smarty
->
assign_by_ref
(
'viewsform'
,
$viewsform
);
$smarty
->
assign_by_ref
(
'nextform'
,
$nextform
);
$smarty
->
display
(
'collection/views.tpl'
);
function
addviews_submit
(
Pieform
$form
,
$values
)
{
...
...
@@ -136,19 +148,28 @@ function addviews_submit(Pieform $form, $values) {
}
function
new_cancel_submit
()
{
global
$collection
;
$collection
->
delete
();
function
next_cancel_submit
()
{
global
$collection
,
$new
;
if
(
$new
)
{
$collection
->
delete
();
}
redirect
(
'/collection/'
);
}
function
ne
w
_submit
(
Pieform
$form
,
$values
)
{
global
$collection
;
function
ne
xt
_submit
(
Pieform
$form
,
$values
)
{
global
$collection
,
$new
;
if
(
param_boolean
(
'back'
))
{
redirect
(
'/collection/edit.php?id='
.
$collection
->
get
(
'id'
)
.
'&new=1'
);
}
else
{
redirect
(
'/view/access.php?collection='
.
$collection
->
get
(
'id'
)
.
'&new=1'
);
if
(
$new
)
{
redirect
(
'/view/access.php?collection='
.
$collection
->
get
(
'id'
)
.
'&new=1'
);
}
else
{
$collection
->
set
(
'navigation'
,(
int
)
$values
[
'navigation'
]);
$collection
->
commit
();
redirect
(
'/collection/'
);
}
}
}
...
...
htdocs/lang/en.utf8/collection.php
View file @
59033039
...
...
@@ -86,6 +86,8 @@ $string['viewaddedtocollection'] = 'View added to collection.';
$string
[
'viewcollection'
]
=
'View Collection Details'
;
$string
[
'viewcount'
]
=
'Views'
;
$string
[
'viewremovedsuccessfully'
]
=
'View removed successfully.'
;
$string
[
'viewnavigation'
]
=
'View navigation bar'
;
$string
[
'viewnavigationdesc'
]
=
'Add a horizontal navigation bar to every view in this collection by default.'
;
$string
[
'views'
]
=
'Views'
;
$string
[
'viewsaddedtocollection'
]
=
'Views added to collection.'
;
$string
[
'viewstobeadded'
]
=
'Views to be added'
;
...
...
htdocs/lib/collection.php
View file @
59033039
...
...
@@ -35,6 +35,7 @@ class Collection {
private
$owner
;
private
$mtime
;
private
$ctime
;
private
$navigation
;
private
$views
;
public
function
__construct
(
$id
=
0
,
$data
=
null
)
{
...
...
htdocs/lib/db/install.xml
View file @
59033039
...
...
@@ -798,6 +798,7 @@
<FIELD
NAME=
"mtime"
TYPE=
"datetime"
NOTNULL=
"true"
/>
<FIELD
NAME=
"name"
TYPE=
"text"
NOTNULL=
"true"
/>
<FIELD
NAME=
"description"
TYPE=
"text"
NOTNULL=
"false"
/>
<FIELD
NAME=
"navigation"
TYPE=
"int"
LENGTH=
"1"
NOTNULL=
"true"
DEFAULT=
"1"
/>
</FIELDS>
<KEYS>
<KEY
NAME=
"primary"
TYPE=
"primary"
FIELDS=
"id"
/>
...
...
@@ -808,7 +809,6 @@
<FIELDS>
<FIELD
NAME=
"collection"
TYPE=
"int"
LENGTH=
"10"
NOTNULL=
"true"
/>
<FIELD
NAME=
"view"
TYPE=
"int"
LENGTH=
"10"
NOTNULL=
"true"
/>
<FIELD
NAME=
"master"
TYPE=
"int"
LENGTH=
"1"
NOTNULL=
"true"
DEFAULT=
"0"
/>
<FIELD
NAME=
"displayorder"
TYPE=
"int"
LENGTH=
"10"
NOTNULL=
"true"
/>
</FIELDS>
<KEYS>
...
...
htdocs/lib/db/upgrade.php
View file @
59033039
...
...
@@ -2110,7 +2110,6 @@ function xmldb_core_upgrade($oldversion=0) {
$table
=
new
XMLDBTable
(
'collection_view'
);
$table
->
addFieldInfo
(
'view'
,
XMLDB_TYPE_INTEGER
,
10
,
false
,
XMLDB_NOTNULL
);
$table
->
addFieldInfo
(
'collection'
,
XMLDB_TYPE_INTEGER
,
10
,
false
,
XMLDB_NOTNULL
);
$table
->
addFieldInfo
(
'master'
,
XMLDB_TYPE_INTEGER
,
1
,
null
,
XMLDB_NOTNULL
,
null
,
null
,
null
,
0
);
$table
->
addKeyInfo
(
'primary'
,
XMLDB_KEY_PRIMARY
,
array
(
'view'
,
'collection'
));
$table
->
addKeyInfo
(
'viewfk'
,
XMLDB_KEY_FOREIGN
,
array
(
'view'
),
'view'
,
array
(
'id'
));
$table
->
addKeyInfo
(
'collectionfk'
,
XMLDB_KEY_FOREIGN
,
array
(
'collection'
),
'collection'
,
array
(
'id'
));
...
...
@@ -2143,5 +2142,12 @@ function xmldb_core_upgrade($oldversion=0) {
}
if
(
$oldversion
<
2010080500
)
{
$table
=
new
XMLDBTable
(
'collection'
);
$field
=
new
XMLDBField
(
'navigation'
);
$field
->
setAttributes
(
XMLDB_TYPE_INTEGER
,
1
,
null
,
XMLDB_NOTNULL
,
null
,
null
,
null
,
1
);
add_field
(
$table
,
$field
);
}
return
$status
;
}
htdocs/lib/version.php
View file @
59033039
...
...
@@ -28,7 +28,7 @@
defined
(
'INTERNAL'
)
||
die
();
$config
=
new
StdClass
;
$config
->
version
=
2010080
402
;
$config
->
version
=
2010080
500
;
$config
->
release
=
'1.3.0beta4dev'
;
$config
->
minupgradefrom
=
2008040200
;
$config
->
minupgraderelease
=
'1.0.0 (release tag 1.0.0_RELEASE)'
;
...
...
htdocs/lib/view.php
View file @
59033039
...
...
@@ -2743,7 +2743,7 @@ class View {
}
}
public
static
function
set_nav
(
$group
,
$institution
,
$profile
=
false
,
$collection
)
{
public
static
function
set_nav
(
$group
,
$institution
,
$profile
=
false
,
$collection
=
null
)
{
if
(
$group
)
{
define
(
'MENUITEM'
,
'groups/views'
);
define
(
'GROUP'
,
$group
);
...
...
htdocs/theme/raw/templates/collection/views.tpl
View file @
59033039
...
...
@@ -41,11 +41,7 @@
{
str
tag
=
noviewsavailable
section
=
collection
}
{/
if
}
</fieldset>
{
if
$newform
}
{
$newform
|
safe
}
{
else
}
<div
id=
"view-wizard-controls"
class=
"center"
>
<a
class=
"btn"
href=
"
{
$WWWROOT
}
collection"
>
{
str
tag
=
done
}
</a>
</div>
{
if
$nextform
}
{
$nextform
|
safe
}
{/
if
}
{
include
file
=
"footer.tpl"
}
htdocs/view/view.php
View file @
59033039
...
...
@@ -34,6 +34,7 @@ define('SECTION_PAGE', 'view');
require
(
dirname
(
dirname
(
__FILE__
))
.
'/init.php'
);
require_once
(
get_config
(
'libroot'
)
.
'view.php'
);
require_once
(
get_config
(
'libroot'
)
.
'collection.php'
);
require_once
(
'group.php'
);
safe_require
(
'artefact'
,
'comment'
);
...
...
@@ -180,12 +181,12 @@ addLoadEvent(function () {
EOF;
// collection top navigation
$allow
collection
s
=
get_config
(
'allowcollections'
);
if
(
$allowcollections
)
{
require_once
(
get_config
(
'libroot'
)
.
'collection.php'
);
$
collection
=
C
ollection
::
search_by_view_id
(
$
view
id
);
$views
=
$
collection
->
get
(
'views'
);
$smarty
->
assign_by_ref
(
'collection'
,
$views
[
'views'
]);
if
(
$
collection
=
Collection
::
search_by_view_id
(
$viewid
))
{
$shownav
=
$collection
->
get
(
'navigation'
);
if
(
$shownav
)
{
$
views
=
$c
ollection
->
get
(
'
view
s'
);
$smarty
->
assign_by_ref
(
'
collection
'
,
$views
[
'views'
]
);
}
}
$smarty
->
assign
(
'INLINEJAVASCRIPT'
,
$javascript
);
...
...
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