Hello,
I'm trying to improve Swiki by allowing a user to bookmark a website
and add it automatically in a swiki site. A kind of quick link.
The work is almost finished but i have some problems.
I add a new action called addlink in addresses page
I would like to create a page with a name/url, then save
this page, without editing by hand this page (all parameters are
provided with a url like 1.new?name=<title of the
page>&type=text-link&url=<url of the location>)
I use a template for the link, a form with URL and Name.
I'm trying that but it doesn't work. I don't understand clearly how
create and save a page. Could you help me ?
addlink:
"Create a new page"
| newPage type link|
(request fieldsHasKey: 'name') & (request fieldsHasKey: 'url')
ifTrue: [
"The swiklink feature"
link_Dictionary new.
link at: '1' put: (request fieldsKey: 'name').
link at: '2' put: (request fieldsKey: 'url').
link at: '3' put: ''. "for keywords, a future feature..."
type _ request fieldsKey: 'type'.
newPage _ book addNewPage.
"Write Page"
newPage
forbidWriting;
date: Date today;
time: Time now;
name: (request fieldsKey: 'name');
user: 'unknown';
text: link;
settingsAt: 'template' put: (type copyFrom: 6 to: type size);
name: (request fieldsKey: 'name').
[newPage
user: (shelf formatPrivAddress: 'getIPName' request: request response:
response);
backup;
write;
permitWriting] fork.
]
ifFalse:[
response at: 'headerStatus' put: #notFound.
book formatBookTemplate: 'addressNotFound' request: request response: response shelf:
shelf]
--
Samir SAIDANI
Doctorant en informatique web :
http://www.info.unicaen.fr/~saidani
Universite de Caen - Laboratoire GREYC tel : 02-31-56-74-30
Equipe SMILE - Campus II - 14032 Caen Cedex fax : 02-31-56-76-30