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
54e166c9
Commit
54e166c9
authored
Dec 05, 2006
by
Nigel McNie
Committed by
Nigel McNie
Dec 05, 2006
Browse files
Template for the viewacl element.
parent
c13f42e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/theme/default/templates/form/viewacl.tpl
0 → 100644
View file @
54e166c9
<div
style=
"float:left;"
>
<div
id=
"potentialpresetitems"
></div>
<div>
{
{
str
tag
=
search
}
}
<input
type=
"text"
name=
"search"
id=
"search"
>
<select
name=
"type"
id=
"type"
>
<option
value=
"group"
>
{
{
str
tag
=
mygroups
}
}
</option>
<option
value=
"community"
>
{
{
str
tag
=
communities
}
}
</option>
<option
value=
"user"
>
{
{
str
tag
=
users
}
}
</option>
<option
value=
"all"
selected=
"selected"
>
{
{
str
tag
=
all
}
}
</option>
</select>
<button
id=
"dosearch"
type=
"button"
>
{
{
str
tag
=
go
}
}
</button>
<table
id=
"results"
>
<thead>
<tr>
<th>
{
{
str
tag
=
name
}
}
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div
id=
"accesslistitems"
>
</div>
<script
type=
"text/javascript"
src=
"/js/tablerenderer.js"
></script>
<script
type=
"text/javascript"
>
// Utility functions
// Given a row, render it on the left hand side
// The LHS looks like: [ name ][ button ]
function
renderPotentialPresetItem
(
item
)
{
var
addButton
=
BUTTON
(
{
'type'
:
'button'
}
,
'
{
{
str
tag
=
add
}
}
'
);
var
row
=
DIV
(
null
,
item
.
name
,
addButton
);
connect
(
addButton
,
'
onclick
'
,
function
()
{
appendChildNodes
(
'
accesslist
'
,
renderAccessListItem
(
item
));
});
appendChildNodes
(
'
potentialpresetitems
'
,
row
);
return
row
;
}
// Given a row, render it on the right hand side
// The RHS looks like:
// [ name ][ button ]
// | from v v v |
// | to v v v |
function
renderAccessListItem
(
item
)
{
var
removeButton
=
BUTTON
(
{
'type'
:
'button'
}
,
'
{
{
str
tag
=
remove
}
}
'
);
var
row
=
DIV
(
item
.
name
,
removeButton
);
connect
(
removeButton
,
'
onclick
'
,
function
()
{
removeElement
(
row
);
});
insertSiblingNodesBefore
(
$
(
'
accesslistitems
'
).
firstChild
,
row
);
}
// SETUP
// Left top: public, any, friends
var
potentialPresets
=
{
{
$potentialpresets
}
};
forEach
(
potentialPresets
,
function
(
preset
)
{
renderPotentialPresetItem
(
preset
);
});
// Left hand side
var
searchTable
=
new
TableRenderer
(
'
results
'
,
'
create4.json.php
'
,
[
undefined
,
undefined
]
);
searchTable
.
statevars
.
push
(
'
type
'
);
searchTable
.
statevars
.
push
(
'
query
'
);
searchTable
.
type
=
'
all
'
;
searchTable
.
query
=
''
;
searchTable
.
rowfunction
=
function
(
rowdata
,
rownumber
,
globaldata
)
{
var
addButton
=
BUTTON
(
{
'type'
:
'button'
}
,
'
{
{
str
tag
=
add
}
}
'
);
connect
(
addButton
,
'
onclick
'
,
function
()
{
appendChildNodes
(
'
accesslist
'
,
renderAccessListItem
(
rowdata
));
});
return
TR
(
null
,
TD
(
null
,
rowdata
.
name
,
addButton
));
}
searchTable
.
updateOnLoad
();
function
search
(
e
)
{
searchTable
.
query
=
$
(
'
search
'
).
value
;
searchTable
.
type
=
$
(
'
type
'
).
options
[
$
(
'
type
'
).
selectedIndex
].
value
;
searchTable
.
doupdate
();
e
.
stop
();
}
// Right hand side
var
accesslist
=
{
{
$accesslist
}
};
if
(
accesslist
)
{
forEach
(
accesslist
,
function
(
item
)
{
renderAccessListItem
(
item
);
});
}
addLoadEvent
(
function
()
{
// Populate the "potential access" things (public|loggedin|allfreidns)
connect
(
$
(
'
search
'
),
'
onkeydown
'
,
function
(
e
)
{
if
(
e
.
key
().
string
==
'
KEY_ENTER
'
)
{
search
(
e
);
}
});
connect
(
$
(
'
dosearch
'
),
'
onclick
'
,
search
);
});
</script>
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