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
51c77585
Commit
51c77585
authored
Dec 19, 2006
by
Richard Mansfield
Browse files
Add newly uploaded files to the list of attachments
parent
4b49af72
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/blog/editpost.php
View file @
51c77585
...
...
@@ -61,6 +61,7 @@ else {
$pagetitle
=
'editblogpost'
;
}
// This form just has the main text inputs and no submit button. The
// submit and cancel buttons are in their own form at the bottom of
// the page.
...
...
@@ -107,6 +108,10 @@ $form = pieform(array(
)
));
// Strings used in the javascript
$getstring
=
quotestrings
(
array
(
'mahara'
=>
array
(
),
...
...
@@ -118,13 +123,21 @@ $getstring = quotestrings(array(
// Insert this automatically sometime.
$copyright
=
get_field
(
'site_content'
,
'content'
,
'name'
,
'uploadcopyright'
);
$javascript
=
<<<
EOF
// The file uploader uploads files to the list of blog post attachments
var
copyrightnotice
=
'{$copyright}'
;
var
uploader
=
new
FileUploader
(
'uploader'
,
'upload.php'
,
{
$getstring
[
'blogpost'
]},
false
,
attachtopost
,
fileexists
);
uploader
.
createid
=
{
$createid
};
// List of attachments to the blog post
var
attached
=
new
TableRenderer
(
'attachedfiles'
,
'attachedfiles.json.php'
,
...
...
@@ -139,18 +152,29 @@ attached.paginate = false;
attached
.
blogpost
=
{
$blogpost
};
attached
.
statevars
.
push
(
'blogpost'
);
attached
.
rowfunction
=
function
(
r
)
{
return
TR
({
'id'
:
'attached_old_'
+
r
.
id
});
};
attached
.
updateOnLoad
();
// This function adds a newly uploaded file to the attached files list.
// Add a newly uploaded file to the attached files list.
function
attachtopost
(
data
)
{
return
true
;
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
);
}
// This function checks if there's a file attached to the post with the given name
// Check if there's already a file attached to the post with the given name
function
fileexists
(
name
)
{
return
false
;
}
attached
.
updateOnLoad
();
EOF
;
...
...
@@ -160,6 +184,8 @@ $smarty->assign_by_ref('textinputform', $form);
$smarty
->
assign
(
'pagetitle'
,
$pagetitle
);
$smarty
->
display
(
'artefact:blog:editpost.tpl'
);
/**
* This function gets called to create a new blog post, and publish it
* simultaneously.
...
...
@@ -179,6 +205,8 @@ function editpost_submit(array $values) {
redirect
(
get_config
(
'wwwroot'
)
.
'artefact/blog/list/'
);
}
/**
* This function get called to cancel the form submission. It returns to the
* blog list.
...
...
htdocs/artefact/blog/theme/default/editpost.tpl
View file @
51c77585
...
...
@@ -17,8 +17,8 @@
<div
class=
"maincontent"
>
<h2>
{
str
section
=
"artefact.blog"
tag
=
$pagetitle
}
</h2>
{
$textinputform
}
<h3>
{
str
section
=
artefact
.
blog
tag
=
attachedfiles
}
</h3>
<div
id=
'uploader'
></div>
<h3>
{
str
section
=
artefact
.
blog
tag
=
attachedfiles
}
</h3>
<table
id=
'attachedfiles'
><tbody><tr><td></td></tr></tbody></table>
</div>
</span></span></span></span>
...
...
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