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
e0d1a79d
Commit
e0d1a79d
authored
Dec 17, 2010
by
Richard Mansfield
Browse files
Move columns/layout to separate edit view tab
Signed-off-by:
Richard Mansfield
<
richard.mansfield@catalyst.net.nz
>
parent
24e0805d
Changes
10
Hide whitespace changes
Inline
Side-by-side
htdocs/lang/en.utf8/view.php
View file @
e0d1a79d
...
...
@@ -32,6 +32,7 @@ $string['edittitle'] = 'Edit Title';
$string
[
'edittitleanddescription'
]
=
'Edit Title and Description'
;
$string
[
'editcontent'
]
=
'Edit Content'
;
$string
[
'editcontentandlayout'
]
=
'Edit Content and Layout'
;
$string
[
'editlayout'
]
=
'Edit Layout'
;
$string
[
'editaccess'
]
=
'Edit Access'
;
$string
[
'next'
]
=
'Next'
;
$string
[
'back'
]
=
'Back'
;
...
...
htdocs/lib/view.php
View file @
e0d1a79d
...
...
@@ -2283,6 +2283,10 @@ class View {
return
true
;
}
public
function
can_edit_title
()
{
return
self
::
can_remove_viewtype
(
$this
->
type
);
}
public
static
function
get_myviews_data
(
$limit
=
5
,
$offset
=
0
,
$groupid
=
null
,
$institution
=
null
)
{
global
$USER
;
...
...
htdocs/theme/raw/templates/view/blocks.tpl
View file @
e0d1a79d
{
if
$microheaders
}{
include
file
=
"viewmicroheader.tpl"
}{
else
}{
include
file
=
"header.tpl"
}{/
if
}
{
if
!
$edittitleurl
}
<h1>
{
if
!
$microheaders
}{
$viewtitle
}{
else
}{
$maintitle
}{/
if
}
</h1>
{
else
}
<h1>
{
$viewtitle
}
</h1>
{/
if
}
{
if
$edittitleurl
}
<h1>
{
$viewtitle
}
</h1>
{
include
file
=
"view/editviewtabs.tpl"
selected
=
'content'
}
<div
class=
"subpage rel"
>
{/
if
}
{
if
$columns
}
{
str
tag
=
"editblockspagedescription"
section
=
"view"
}
...
...
@@ -106,7 +105,4 @@
{
if
$block.javascript
}
<script
type=
"text/javascript"
>
{
$block.javascript
|
safe
}
</script>
{/
if
}
{/
if
}
{
if
$edittitleurl
}
</div>
{/
if
}
{
if
$microheaders
}{
include
file
=
"microfooter.tpl"
}{
else
}{
include
file
=
"footer.tpl"
}{/
if
}
htdocs/theme/raw/templates/view/columns.tpl
0 → 100644
View file @
e0d1a79d
{
include
file
=
"header.tpl"
}
<h1>
{
$viewtitle
}
</h1>
{
include
file
=
"view/editviewtabs.tpl"
selected
=
'layout'
}
<div
class=
"subpage rel"
>
<p>
{
str
tag
=
'viewcolumnspagedescription'
section
=
'view'
}
</p>
{
$form
|
safe
}
</div>
{
include
file
=
"footer.tpl"
}
htdocs/theme/raw/templates/view/editviewtabs.tpl
View file @
e0d1a79d
<ul
class=
"in-page-tabs edit-view-tabs"
>
<li><a
{
if
$selected
==
'title'
}
class=
"current-tab"
{/
if
}
href=
"
{
$WWWROOT
}
view/edit.php?id=
{
$viewid
}
"
>
{
str
tag
=
edittitleanddescription
section
=
view
}
</a></li>
{
if
$edittitle
}
<li><a
{
if
$selected
==
'title'
}
class=
"current-tab"
{/
if
}
href=
"
{
$WWWROOT
}
view/edit.php?id=
{
$viewid
}
"
>
{
str
tag
=
edittitleanddescription
section
=
view
}
</a></li>
{/
if
}
<li><a
{
if
$selected
==
'content'
}
class=
"current-tab"
{/
if
}
href=
"
{
$WWWROOT
}
view/blocks.php?id=
{
$viewid
}
"
>
{
str
tag
=
editcontent
section
=
view
}
</a></li>
<li><a
{
if
$selected
==
'layout'
}
class=
"current-tab"
{/
if
}
href=
"
{
$WWWROOT
}
view/columns.php?id=
{
$viewid
}
"
>
{
str
tag
=
editlayout
section
=
view
}
</a></li>
</ul>
htdocs/theme/raw/templates/view/layout.tpl
View file @
e0d1a79d
{
include
file
=
"header.tpl"
}
<h1>
{
$viewtitle
}
</h1>
{
include
file
=
"view/editviewtabs.tpl"
selected
=
'layout'
}
<div
class=
"subpage rel"
>
<p>
{
str
tag
=
'viewlayoutpagedescription'
section
=
'view'
}
</p>
{
$form_start_tag
|
safe
}
...
...
@@ -24,4 +29,6 @@
</div>
</form>
</div>
{
include
file
=
"footer.tpl"
}
htdocs/view/blocks.php
View file @
e0d1a79d
...
...
@@ -197,10 +197,7 @@ foreach (array_keys($_POST + $_GET) as $key) {
$viewid
=
$view
->
get
(
'id'
);
$smarty
->
assign
(
'maintitle'
,
TITLE
);
if
(
!
empty
(
$editabletitle
))
{
$smarty
->
assign
(
'edittitleurl'
,
get_config
(
'wwwroot'
)
.
'view/edit.php?id='
.
$viewid
);
$smarty
->
assign
(
'viewdescription'
,
$view
->
get
(
'description'
));
}
$smarty
->
assign
(
'edittitle'
,
$view
->
can_edit_title
());
$smarty
->
assign
(
'displaylink'
,
$displaylink
);
$smarty
->
assign
(
'formurl'
,
get_config
(
'wwwroot'
)
.
'view/blocks.php'
);
$smarty
->
assign
(
'category'
,
$category
);
...
...
htdocs/view/columns.php
View file @
e0d1a79d
...
...
@@ -40,13 +40,21 @@ $numcolumns = $view->get('numcolumns');
$group
=
$view
->
get
(
'group'
);
$institution
=
$view
->
get
(
'institution'
);
$view
->
set_edit_nav
();
$params
=
'id='
.
$id
;
if
(
$category
)
{
$params
.
=
'&c='
.
$category
;
}
if
(
$new
)
{
$params
.
=
'&new=1'
;
}
if
(
!
$USER
->
can_edit_view
(
$view
))
{
throw
new
AccessDeniedException
();
}
if
(
$USER
->
get_account_preference
(
'addremovecolumns'
))
{
redirect
(
'/view/layout.php?
id=
'
.
$
id
.
'&c='
.
$category
.
'&new='
.
$new
);
redirect
(
'/view/layout.php?'
.
$
params
);
}
$columnsform
=
pieform
(
array
(
...
...
@@ -61,19 +69,20 @@ $columnsform = pieform(array(
'submit'
=>
array
(
'type'
=>
'submitcancel'
,
'value'
=>
array
(
get_string
(
'next'
),
get_string
(
'cancel'
)),
'goto'
=>
get_config
(
'wwwroot'
)
.
'view/blocks.php?
id=
'
.
$
view
->
get
(
'id'
)
.
'&c='
.
$category
.
'&new='
.
$new
'goto'
=>
get_config
(
'wwwroot'
)
.
'view/blocks.php?'
.
$
params
)
)
));
$smarty
=
smarty
(
array
(),
array
(),
array
(),
array
(
'sidebars'
=>
false
));
$smarty
->
assign
(
'PAGEHEADING'
,
TITLE
);
$smarty
->
assign
(
'form'
,
$columnsform
);
$smarty
->
assign
(
'pagedescription'
,
get_string
(
'viewcolumnspagedescription'
,
'view'
));
$smarty
->
display
(
'form.tpl'
);
$smarty
->
assign
(
'viewid'
,
$view
->
get
(
'id'
));
$smarty
->
assign
(
'viewtitle'
,
$view
->
get
(
'title'
));
$smarty
->
assign
(
'edittitle'
,
$view
->
can_edit_title
());
$smarty
->
display
(
'view/columns.tpl'
);
function
viewcolumns_submit
(
Pieform
$form
,
$values
)
{
global
$view
,
$SESSION
,
$category
,
$new
;
global
$view
,
$SESSION
,
$category
,
$new
,
$params
;
$oldcolumns
=
$view
->
get
(
'numcolumns'
);
$newcolumns
=
$values
[
'numcolumns'
];
...
...
@@ -96,17 +105,17 @@ function viewcolumns_submit(Pieform $form, $values) {
if
(
$dbcolumns
!=
$newcolumns
)
{
db_rollback
();
$SESSION
->
add_error_msg
(
get_string
(
'changecolumnlayoutfailed'
,
'view'
));
redirect
(
get_config
(
'wwwroot'
)
.
'view/columns.php?
id=
'
.
$
view
->
get
(
'id'
)
.
'&c='
.
$category
.
'&new='
.
$new
);
redirect
(
get_config
(
'wwwroot'
)
.
'view/columns.php?'
.
$
params
);
}
db_commit
();
if
(
$newcolumns
>
1
&&
$newcolumns
<
5
)
{
redirect
(
get_config
(
'wwwroot'
)
.
'view/layout.php?
id=
'
.
$
view
->
get
(
'id'
)
.
'&c='
.
$category
.
'&new='
.
$new
);
redirect
(
get_config
(
'wwwroot'
)
.
'view/layout.php?'
.
$
params
);
}
else
{
$SESSION
->
add_ok_msg
(
get_string
(
'viewlayoutchanged'
,
'view'
));
redirect
(
get_config
(
'wwwroot'
)
.
'view/blocks.php?
id=
'
.
$
view
->
get
(
'id'
)
.
'&c='
.
$category
.
'&new='
.
$new
);
redirect
(
get_config
(
'wwwroot'
)
.
'view/blocks.php?'
.
$
params
);
}
}
...
...
htdocs/view/edit.php
View file @
e0d1a79d
...
...
@@ -185,6 +185,7 @@ $smarty = smarty(array(), array(), array(), array('sidebars' => false));
$smarty
->
assign
(
'editview'
,
$editview
);
$smarty
->
assign
(
'viewid'
,
$view
->
get
(
'id'
));
$smarty
->
assign
(
'viewtitle'
,
$view
->
get
(
'title'
));
$smarty
->
assign
(
'edittitle'
,
$view
->
can_edit_title
());
$smarty
->
display
(
'view/edit.tpl'
);
?>
htdocs/view/layout.php
View file @
e0d1a79d
...
...
@@ -44,6 +44,13 @@ $back = !$USER->get_account_preference('addremovecolumns');
$group
=
$view
->
get
(
'group'
);
$institution
=
$view
->
get
(
'institution'
);
$view
->
set_edit_nav
();
$goto
=
get_config
(
'wwwroot'
)
.
'view/blocks.php?id='
.
$view
->
get
(
'id'
);
if
(
$category
)
{
$goto
.
=
'&c='
.
$category
;
}
if
(
$new
)
{
$goto
.
=
'&new=1'
;
}
if
(
!
$USER
->
can_edit_view
(
$view
))
{
throw
new
AccessDeniedException
();
...
...
@@ -78,7 +85,7 @@ if ($numcolumns > 1 && $numcolumns < 5) {
}
else
{
$SESSION
->
add_error_msg
(
get_string
(
'noviewlayouts'
,
'view'
,
$numcolumns
));
redirect
(
'/view/blocks.php?id='
.
$id
.
'&c='
.
$category
.
'&new='
.
$new
);
redirect
(
$goto
);
}
$smarty
=
smarty
(
array
(),
array
(),
array
(),
array
(
'sidebars'
=>
false
));
...
...
@@ -87,15 +94,17 @@ $smarty->assign('form', $layoutform);
$smarty
->
assign
(
'form_start_tag'
,
$layoutform
->
get_form_tag
());
$smarty
->
assign
(
'options'
,
$options
);
$smarty
->
assign
(
'back'
,
$back
);
$smarty
->
assign
(
'PAGEHEADING'
,
TITLE
);
$smarty
->
assign
(
'viewid'
,
$view
->
get
(
'id'
));
$smarty
->
assign
(
'viewtitle'
,
$view
->
get
(
'title'
));
$smarty
->
assign
(
'edittitle'
,
$view
->
can_edit_title
());
$smarty
->
display
(
'view/layout.tpl'
);
function
viewlayout_submit
(
Pieform
$form
,
$values
)
{
global
$view
,
$SESSION
,
$
category
,
$new
;
global
$view
,
$SESSION
,
$
goto
;
$view
->
set
(
'layout'
,
$values
[
'layout'
]);
$view
->
commit
();
$SESSION
->
add_ok_msg
(
get_string
(
'viewlayoutchanged'
,
'view'
));
redirect
(
get_config
(
'wwwroot'
)
.
'view/blocks.php?id='
.
$view
->
get
(
'id'
)
.
'&c='
.
$category
.
'&new='
.
$new
);
redirect
(
$goto
);
}
?>
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