addbook.js

Go to the documentation of this file.
00001 // -*-C-*- //tell emacs to use C mode
00002 /*
00003   This file is part of  DocBookWiki.  DocBookWiki is a web application
00004   that displays and edits DocBook documents.
00005 
00006   Copyright (C) 2004, 2005, 2006, 2007
00007   Dashamir Hoxha, dashohoxha@users.sourceforge.net
00008 
00009   DocBookWiki is free software;  you can redistribute it and/or modify
00010   it under the terms of the GNU General Public License as published by
00011   the Free  Software Foundation; either  version 2 of the  License, or
00012   (at your option) any later version.
00013 
00014   DocBookWiki is distributed  in the hope that it  will be useful, but
00015   WITHOUT  ANY   WARRANTY;  without  even  the   implied  warranty  of
00016   MERCHANTABILITY or  FITNESS FOR A  PARTICULAR PURPOSE.  See  the GNU
00017   General Public License for more details.
00018 
00019   You should  have received a copy  of the GNU  General Public License
00020   along  with  DocBookWiki;  if   not,  write  to  the  Free  Software
00021   Foundation, Inc., 59 Temple  Place, Suite 330, Boston, MA 02111-1307
00022   USA
00023 */
00024 
00025 function create()
00026 {
00027   var form = document.create;
00028   var bookid = form.bookid.value;
00029   var lng = form.lng.value;
00030   var author = form.author.value;
00031   var keywords = form.keywords.value;
00032   var doc_title = form.doc_title.value;
00033   var doc_abstract = form.doc_abstract.value;
00034 
00035   var doctype;
00036   if (form.doctype[0].checked)  doctype = form.doctype[0].value;
00037   else if (form.doctype[1].checked)  doctype = form.doctype[1].value;
00038   else doctype = '';
00039 
00040   if (bookid=='')
00041     {
00042       alert(T_("Please give book id."));
00043       form.bookid.focus();
00044       return;
00045     }
00046 
00047   if (doctype=='')
00048     {
00049       alert(T_("Please select either book or article."));
00050       return;
00051     }
00052 
00053   var event_args = new Array();
00054   event_args.push('bookid='+bookid);
00055   event_args.push('lng='+lng);
00056   event_args.push('doctype='+doctype);
00057   event_args.push('author='+author);
00058   event_args.push('keywords='+keywords);
00059 
00060   //abstract and title can possibly contain semicolumns (;), 
00061   //this is why it should be encoded
00062   event_args.push('title='+encode_arg_value(doc_title));
00063   event_args.push('abstract='+encode_arg_value(doc_abstract));
00064 
00065   SendEvent('addbook', 'create', event_args.join(';'));
00066 }

Generated on Wed Jan 9 08:27:32 2008 for DokBookWiki by  doxygen 1.5.2