[Sputnik-list] Re: Sputnik Earth Beta
Yuri Takhteyev
yuri at sims.berkeley.edu
Mon Jun 23 15:51:22 GMT+2 2008
> After registered and login sputnik, I edit a page and refresh, find that
> sputnik makes me logout automatically, why?
Can you describe the exact steps? I can't reproduce this.
> How to upload a png file, pdf file when edit in sputnik? Could you give us a
> detailed tutors on it?
Binary files are represented by special nodes, which behave
differently because they have their "prototype" field set to
"@Binary_File". If you want to "edit" an existing binary node, e.g.,
"_logo", just go to it's "edit" page, and it will have a button to
upload a new image. E.g.:
http://localhost:8080/sputnik.ws?p=_logo.png - returns an image
http://localhost:8080/sputnik.ws?p=_logo - returns a page that
describes the node, has an "Edit" link
http://localhost:8080/sputnik.ws?p=_logo.edit - a form to edit
attributes, including uploading a new image
If you want to create a new node from scratch, then (as I just
realized) it's somewhat more complicated than it should be, because we
originally locked this feature down aggressively for security, and
then forgot to provide an easier mechanism. I'll look into this and
post an update. Meanwhile, you can create such nodes manually if you
want. If you are using Sputnik with git, then just create a file
"My_Image.lua" in your wiki-data directory, put the following into it:
prototype = "@Binary_File"
file_type = "image/jpeg"
Save the file. Commit it with git if you want to save this revision
in history. Then access the node via the web interface to upload a
new file. Of course, you can also put the image data into the node
via the editor as well: just look at what My_Image.lua looks like
after you upload a file into it, keeping in mind that the value of
"content" is base64-encoded image data.
> How to do to convert the old page storage format to the new git storage
> format? Please supply a tool or method? I can't bear write them one by one
> manually by myself!
Depends on how old. Pages created by "Cottington" releases (before
2008) will need to be converted. There is a script to convert those
files to the new default format (files in directories):
http://sputnik.freewisdom.org/en/Migrating_from_Cottington. I haven't
tested it recently, so it might be a bit stale, but I will try to get
back to it the next few days.
I will also provide a script for converting data into the new git
format. For now, you can try something like this:
require"luarocks.require"
require"versium.filedir"
require"versium.git"
old = versium.filedir.new{"/tmp/old-sputnik/wiki-data/"}
new = versium.git.new{"/tmp/new-sputnik/wiki-data/"}
for i, id in ipairs(old:get_node_ids()) do
print(id)
for j, edit in ipairs(old:get_node_history(id)) do
data = old:get_node(id, edit.version)
new:save_version(id, data, edit.author, edit.comment)
end
end
Note that what we do here is create a versium.filedir versium instance
for the old repository (assuming the default Dish of the Day / Earth
format), a versium.git for the new repository, then just copy the
content edit-by-edit from one repository into another. Note that this
will preserve revisions and comments, but will lose the timestamps. I
am not sure how to backdate commits git.
- yuri
--
http://sputnik.freewisdom.org/
More information about the Sputnik-list
mailing list