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
93b2d818
Commit
93b2d818
authored
Nov 10, 2006
by
Richard Mansfield
Browse files
Add public flag to site_menu table
parent
36ad028a
Changes
4
Hide whitespace changes
Inline
Side-by-side
htdocs/admin/editmenu.php
View file @
93b2d818
...
...
@@ -37,10 +37,10 @@ $ijs .= "var adminfile = '" . get_string('adminfile') . "';\n";
$ijs
.
=
<<<
EOJS
// Request a list of menu items from the server
function
getitems
()
{
function
getitems
(
menu
)
{
logDebug
(
get_string
(
'loadingmenuitems'
));
processingStart
();
var
d
=
loadJSONDoc
(
'getmenuitems.json.php'
);
var
d
=
loadJSONDoc
(
'getmenuitems.json.php'
,{
'menu'
:
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
();
getitems
(
menu
);
}
else
{
displayMessage
(
get_string
(
'deletefailed'
),
'error'
);
...
...
@@ -217,7 +217,8 @@ function saveitem(formid) {
var
data
=
{
'type'
:
f
.
type
[
0
]
.
checked
?
'externallink'
:
'adminfile'
,
'name'
:
f
.
name
.
value
,
'linkedto'
:
f
.
linkedto
.
value
,
'itemid'
:
f
.
itemid
.
value
};
'itemid'
:
f
.
itemid
.
value
,
'menu'
:
menu
};
var
req
=
getXMLHttpRequest
();
req
.
open
(
'POST'
,
'updatemenu.json.php'
);
req
.
setRequestHeader
(
'Content-type'
,
'application/x-www-form-urlencoded'
);
...
...
@@ -236,7 +237,7 @@ function saveitem(formid) {
}
else
{
displayMessage
(
data
.
message
,
errtype
);
getitems
();
getitems
(
menu
);
processingStop
();
}
});
...
...
@@ -251,7 +252,8 @@ function getadminfiles() {
return
null
;
}
addLoadEvent
(
getitems
);
var
menu
=
'public'
;
addLoadEvent
(
function
()
{
getitems
(
menu
);});
EOJS
;
$style
=
'<style type="text/css">.invisible{display:none;} .menueditcell{width:200px;}</style>'
;
...
...
htdocs/admin/getmenuitems.json.php
View file @
93b2d818
...
...
@@ -28,10 +28,13 @@ define('INTERNAL', 1);
define
(
'ADMIN'
,
1
);
require
(
dirname
(
dirname
(
__FILE__
))
.
'/init.php'
);
$menu
=
get_variable
(
'menu'
);
$public
=
$menu
==
'public'
?
1
:
0
;
$result
=
array
();
try
{
$menuitems
=
get_records
(
'site_menu'
,
'
'
,
''
,
'displayorder'
);
$menuitems
=
get_records
(
'site_menu'
,
'
public'
,
$public
,
'displayorder'
);
// @todo: Get all the filenames of the files referred to in the $menuitems records.
// (files table doesn't exist yet)
$rows
=
array
();
...
...
htdocs/admin/updatemenu.json.php
View file @
93b2d818
...
...
@@ -42,6 +42,7 @@ $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
);
...
...
@@ -57,6 +58,7 @@ else { // Bad menu item type
send_fail_message
();
}
$data
->
title
=
$name
;
$data
->
public
=
$menu
==
'public'
?
1
:
0
;
if
(
$itemid
==
'new'
)
{
// set displayorder to be after all the existing menu items
...
...
htdocs/lib/db/install.xml
View file @
93b2d818
...
...
@@ -602,6 +602,7 @@
<FIELD
NAME=
"file"
TYPE=
"int"
LENGTH=
"10"
NOTNULL=
"false"
/>
<FIELD
NAME=
"url"
TYPE=
"text"
NOTNULL=
"false"
/>
<FIELD
NAME=
"displayorder"
TYPE=
"int"
LENGTH=
"10"
NOTNULL=
"true"
/>
<FIELD
NAME=
"public"
TYPE=
"int"
LENGTH=
"1"
NOTNULL=
"true"
DEFAULT=
"0"
/>
<!--- public? -->
<!-- displayorder maybe should be the primary key -->
</FIELDS>
...
...
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