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
aa943f14
Commit
aa943f14
authored
Dec 19, 2006
by
Richard Mansfield
Browse files
Add remove attachment button
parent
561bfaa5
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/blog/editpost.php
View file @
aa943f14
...
...
@@ -114,10 +114,12 @@ $form = pieform(array(
$getstring
=
quotestrings
(
array
(
'mahara'
=>
array
(
'cancel'
,
),
'artefact.blog'
=>
array
(
'blogpost'
,
'nofilesattachedtothispost'
,
'remove'
,
)));
// Insert this automatically sometime.
...
...
@@ -144,27 +146,49 @@ var attached = new TableRenderer(
[
'title'
,
'description'
,
function
()
{
return
TD
(
null
);
}
function
(
r
)
{
return
TD
(
null
,
INPUT
({
'type'
:
'button'
,
'value'
:
{
$getstring
[
'remove'
]},
'onclick'
:
"removefrompost('attached_old:"
+
r
.
id
+
"')"
}));
}
]
);
attached
.
emptycontent
=
{
$getstring
[
'nofilesattachedtothispost'
]};
attached
.
paginate
=
false
;
attached
.
blogpost
=
{
$blogpost
};
attached
.
statevars
.
push
(
'blogpost'
);
attached
.
rowfunction
=
function
(
r
)
{
return
TR
({
'id'
:
'attached_old
_
'
+
r
.
id
});
};
attached
.
rowfunction
=
function
(
r
)
{
return
TR
({
'id'
:
'attached_old
:
'
+
r
.
id
});
};
attached
.
updateOnLoad
();
// Show/hide the 'no attachments' message if there are no/some attachments
function
checknoattachments
()
{
if
(
attached
.
tbody
.
hasChildNodes
())
{
hideElement
(
attached
.
table
.
previousSibling
);
showElement
(
attached
.
table
);
}
else
{
showElement
(
attached
.
table
.
previousSibling
);
hideElement
(
attached
.
table
);
}
}
// Add a newly uploaded file to the attached files list.
function
attachtopost
(
data
)
{
alert
(
data
.
title
);
alert
(
attached
.
tbody
);
appendChildNodes
(
attached
.
tbody
,
TR
({
'id'
:
'attached_new:'
+
data
.
uploadnumber
},
map
(
partial
(
TD
,
null
),
[
data
.
title
,
data
.
description
])));
hideElement
(
attached
.
table
.
previousSibling
);
showElement
(
attached
.
table
);
map
(
partial
(
TD
,
null
),
[
data
.
title
,
data
.
description
,
INPUT
({
'type'
:
'button'
,
'value'
:
{
$getstring
[
'remove'
]},
'onclick'
:
"removefrompost('attached_new:"
+
data
.
uploadnumber
+
"')"
})])));
checknoattachments
();
}
// Remove a row from the attached files list.
function
removefrompost
(
rowid
)
{
removeElement
(
rowid
);
checknoattachments
();
}
...
...
htdocs/artefact/blog/lang/en.utf8/artefact.blog.php
View file @
aa943f14
...
...
@@ -35,6 +35,7 @@ $string['newblog'] = 'New Blog';
$string
[
'attachedfiles'
]
=
'Attached files'
;
$string
[
'nofilesattachedtothispost'
]
=
'No attached files'
;
$string
[
'blogpost'
]
=
'post'
;
$string
[
'remove'
]
=
'Remove'
;
$string
[
'blogtitle'
]
=
'Title'
;
$string
[
'blogtitledesc'
]
=
'e.g., ‘Jill’s Travel Blog’.'
;
...
...
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