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
3a302fd5
Commit
3a302fd5
authored
Nov 13, 2006
by
Martyn Smith
Committed by
Martyn Smith
Nov 13, 2006
Browse files
Merge with
git+ssh://locke.catalyst.net.nz/var/git/mahara.git
parents
2df4aeb3
abdf5552
Changes
13
Hide whitespace changes
Inline
Side-by-side
htdocs/about.php
View file @
3a302fd5
...
...
@@ -31,6 +31,7 @@ require('init.php');
$smarty
=
smarty
();
$smarty
->
assign
(
'page_content'
,
get_site_page_content
(
'about'
));
$smarty
->
assign
(
'site_menu'
,
site_menu
());
$smarty
->
display
(
'sitepage.tpl'
);
?>
htdocs/admin/deletemenuitem.json.php
View file @
3a302fd5
...
...
@@ -28,7 +28,8 @@ define('INTERNAL', 1);
define
(
'ADMIN'
,
1
);
require
(
dirname
(
dirname
(
__FILE__
))
.
'/init.php'
);
$itemid
=
clean_requestdata
(
'itemid'
,
PARAM_INT
,
REQUEST_EITHER
);
//$itemid = clean_requestdata('itemid', PARAM_INT, REQUEST_EITHER);
$itemid
=
param_variable
(
'itemid'
);
$result
=
array
();
try
{
...
...
htdocs/admin/editmenu.php
View file @
3a302fd5
...
...
@@ -37,10 +37,10 @@ $ijs .= "var adminfile = '" . get_string('adminfile') . "';\n";
$ijs
.
=
<<<
EOJS
// Request a list of menu items from the server
function
getitems
(
menu
)
{
function
getitems
()
{
logDebug
(
get_string
(
'loadingmenuitems'
));
processingStart
();
var
d
=
loadJSONDoc
(
'getmenuitems.json.php'
,{
'menu'
:
menu
});
var
d
=
loadJSONDoc
(
'getmenuitems.json.php'
,{
'menu'
:
selected
menu
});
d
.
addCallback
(
function
(
data
)
{
if
(
!
data
.
error
)
{
logDebug
(
get_string
(
'loadedmenuitems'
));
...
...
@@ -200,7 +200,7 @@ function delitem(itemid) {
d
.
addCallback
(
function
(
data
)
{
if
(
data
.
success
)
{
logDebug
(
get_string
(
'menuitemdeleted'
));
getitems
(
menu
);
getitems
();
}
else
{
displayMessage
(
get_string
(
'deletefailed'
),
'error'
);
...
...
@@ -218,7 +218,7 @@ function saveitem(formid) {
'name'
:
f
.
name
.
value
,
'linkedto'
:
f
.
linkedto
.
value
,
'itemid'
:
f
.
itemid
.
value
,
'menu'
:
menu
};
'menu'
:
selected
menu
};
var
req
=
getXMLHttpRequest
();
req
.
open
(
'POST'
,
'updatemenu.json.php'
);
req
.
setRequestHeader
(
'Content-type'
,
'application/x-www-form-urlencoded'
);
...
...
@@ -237,7 +237,7 @@ function saveitem(formid) {
}
else
{
displayMessage
(
data
.
message
,
errtype
);
getitems
(
menu
);
getitems
();
processingStop
();
}
});
...
...
@@ -252,13 +252,29 @@ function getadminfiles() {
return
null
;
}
var
menu
=
'public'
;
addLoadEvent
(
function
()
{
getitems
(
menu
);});
function
setmenu
(
menu
)
{
selectedmenu
=
menu
;
var
pub
=
get_string
(
'loggedoutmenu'
);
var
priv
=
get_string
(
'loggedinmenu'
);
if
(
menu
==
'public'
)
{
priv
=
A
({
'href'
:
'#'
},
priv
);
priv
.
onclick
=
function
(
e
)
{
stop
(
e
);
setmenu
(
'private'
);};
}
else
{
pub
=
A
({
'href'
:
'#'
},
pub
);
pub
.
onclick
=
function
(
e
)
{
stop
(
e
);
setmenu
(
'public'
);};
}
replaceChildNodes
(
$
(
'menuselect'
),
[
pub
,
priv
]);
getitems
();
}
var
selectedmenu
=
'public'
;
addLoadEvent
(
function
()
{
setmenu
(
selectedmenu
);});
EOJS
;
$style
=
'<style type="text/css">.invisible{display:none;} .menueditcell{width:200px;}</style>'
;
$strings
=
array
(
'deletefailed'
,
'deletingmenuitem'
,
'menuitemdeleted'
,
'noadminfiles'
,
'edit'
,
'delete'
,
'update'
,
'cancel'
);
'edit'
,
'delete'
,
'update'
,
'cancel'
,
'add'
,
'loggedinmenu'
,
'loggedoutmenu'
);
$smarty
=
smarty
(
array
(),
array
(
$style
),
$strings
);
$smarty
->
assign
(
'INLINEJAVASCRIPT'
,
$ijs
);
$smarty
->
display
(
'admin/editmenu.tpl'
);
...
...
htdocs/admin/editsitepage.php
View file @
3a302fd5
...
...
@@ -66,7 +66,7 @@ $f = array(
'submit'
=>
array
(
'value'
=>
get_string
(
'savechanges'
),
'type'
=>
'submit'
,
)
)
,
)
);
...
...
htdocs/admin/getmenuitems.json.php
View file @
3a302fd5
...
...
@@ -28,8 +28,8 @@ define('INTERNAL', 1);
define
(
'ADMIN'
,
1
);
require
(
dirname
(
dirname
(
__FILE__
))
.
'/init.php'
);
$menu
=
get
_variable
(
'menu'
);
$public
=
$menu
==
'public'
?
1
:
0
;
$menu
=
param
_variable
(
'menu'
);
$public
=
(
int
)(
$menu
==
'public'
)
;
$result
=
array
();
...
...
htdocs/admin/updatemenu.json.php
View file @
3a302fd5
...
...
@@ -28,8 +28,6 @@ define('INTERNAL', 1);
define
(
'ADMIN'
,
1
);
require
(
dirname
(
dirname
(
__FILE__
))
.
'/init.php'
);
error_log
(
'updatemenu.json.php'
);
function
send_fail_message
()
{
$result
=
array
();
$result
[
'error'
]
=
'local'
;
...
...
@@ -38,13 +36,11 @@ function send_fail_message() {
exit
;
}
$type
=
get_variable
(
'type'
);
$name
=
get_variable
(
'name'
);
$linkedto
=
get_variable
(
'linkedto'
);
$itemid
=
get_variable
(
'itemid'
);
$menu
=
get_variable
(
'menu'
);
error_log
(
'updatemenu.json.php '
.
$type
.
' '
.
$name
.
' '
.
$linkedto
.
' '
.
$itemid
);
$type
=
param_variable
(
'type'
);
// external list or admin file
$name
=
param_variable
(
'name'
);
$linkedto
=
param_variable
(
'linkedto'
);
$itemid
=
param_variable
(
'itemid'
);
$menu
=
param_variable
(
'menu'
);
$data
=
new
StdClass
;
if
(
$type
==
'adminfile'
)
{
...
...
@@ -58,12 +54,12 @@ else { // Bad menu item type
send_fail_message
();
}
$data
->
title
=
$name
;
$data
->
public
=
$menu
==
'public'
?
1
:
0
;
if
(
$itemid
==
'new'
)
{
$data
->
public
=
(
int
)
(
$menu
==
'public'
);
// set displayorder to be after all the existing menu items
try
{
$displayorders
=
get_rows
(
'site_menu'
,
'
'
,
''
,
''
,
'displayorder'
);
$displayorders
=
get_rows
(
'site_menu'
,
'
public'
,
$data
->
public
,
''
,
'displayorder'
);
$max
=
0
;
foreach
(
$displayorders
as
$r
)
{
$max
=
$r
[
'displayorder'
]
>=
$max
?
$r
[
'displayorder'
]
+
1
:
$max
;
...
...
htdocs/index.php
View file @
3a302fd5
...
...
@@ -94,6 +94,7 @@ if (!$SESSION->is_logged_in()) {
$smarty
->
assign
(
'login_form'
,
$loginform
);
}
$smarty
->
assign
(
'page_content'
,
get_site_page_content
(
$pagename
));
$smarty
->
assign
(
'site_menu'
,
site_menu
());
$smarty
->
display
(
'index.tpl'
);
?>
htdocs/lib/mahara.php
View file @
3a302fd5
...
...
@@ -900,7 +900,25 @@ function main_nav() {
return
$menu
;
}
/**
* Site-level sidebar menu (list of links)
* There is no admin files table yet so just get the urls.
* @return $menu a data structure containing the site menu
*/
function
site_menu
()
{
//$wwwroot = get_config('wwwroot'); (int)
global
$SESSION
;
$menu
=
array
();
if
(
$menuitems
=
@
get_records
(
'site_menu'
,
'public'
,(
int
)
!
$SESSION
->
is_logged_in
(),
'displayorder'
))
{
foreach
(
$menuitems
as
$i
)
{
if
(
$i
->
url
)
{
$menu
[]
=
array
(
'name'
=>
$i
->
title
,
'link'
=>
$i
->
url
);
}
}
}
return
$menu
;
}
/**
* Always use this function for all emails to users
*
...
...
htdocs/lib/web.php
View file @
3a302fd5
...
...
@@ -594,7 +594,7 @@ function param_alpha($name) {
$value
=
param_variable
(
$name
);
}
if
(
preg_match
(
'/^[a-zA-Z]$/'
,
$value
))
{
if
(
preg_match
(
'/^[a-zA-Z]
+
$/'
,
$value
))
{
return
$value
;
}
...
...
htdocs/privacy.php
View file @
3a302fd5
...
...
@@ -31,6 +31,7 @@ require('init.php');
$smarty
=
smarty
();
$smarty
->
assign
(
'page_content'
,
get_site_page_content
(
'privacy'
));
$smarty
->
assign
(
'site_menu'
,
site_menu
());
$smarty
->
display
(
'sitepage.tpl'
);
?>
htdocs/terms.php
View file @
3a302fd5
...
...
@@ -31,6 +31,7 @@ require('init.php');
$smarty
=
smarty
();
$smarty
->
assign
(
'page_content'
,
get_site_page_content
(
'termsandconditions'
));
$smarty
->
assign
(
'site_menu'
,
site_menu
());
$smarty
->
display
(
'sitepage.tpl'
);
?>
htdocs/theme/default/templates/admin/editmenu.tpl
View file @
3a302fd5
...
...
@@ -2,6 +2,8 @@
<p>
Admin menu editor
</p>
<div
id=
"menuselect"
></div>
<table
id=
"menuitemlist"
class=
"menueditor"
><tbody><tr><td></td></tr></tbody></table>
{
include
file
=
"footer.tpl"
}
htdocs/theme/default/templates/adminmenu.tpl
View file @
3a302fd5
<div
class=
"sidebar"
>
Admin Menu here
<ul
id=
"sitemenu"
>
{
foreach
from
=
$site_menu
item
=
item
}
<li><a
href=
"
{
$item.link
|
escape
}
"
>
{
$item.name
}
</a></li>
{/
foreach
}
</ul>
</div>
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