import_doc.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 import_file(fname)
00026 {
00027   var form = document.bookid;
00028   var bookid = form.bookid.value;
00029   var lng = form.lng.value;
00030 
00031   if (bookid=='')
00032     {
00033       alert(T_("Please give book id."));
00034       form.bookid.focus();
00035       return;
00036     }
00037 
00038   var event_args = 'book_id='+bookid+';lng='+lng+';fname='+fname;
00039   SendEvent('import_doc', 'import', event_args);
00040   alert(T_("Please wait until the book is imported."));
00041 }
00042 
00043 function delete_file(fname)
00044 {
00045   SendEvent('import_doc', 'delete', 'fname='+fname);
00046 }
00047 
00048 function upload()
00049 {
00050   var form = document.upload;
00051   var xml_file = form.xml_file.value;
00052   if (! xml_file.match(/\.xml$/))
00053     {
00054       alert(T_("The XML file should end in '.xml'."));
00055       form.xml_file.value = '';
00056       form.xml_file.fokus();
00057       return;
00058     }
00059   var media_files = form.media_files.value;
00060   var files = xml_file;
00061   if (media_files != '')  files = files + ', ' + media_files;
00062   var uploading = T_("Uploading:");
00063   var please_wait = T_("Please wait...");
00064   var win_content = "<html>\n"
00065     + "<head>\n"
00066     + " <title>" + uploading + " " + files + " </title>\n"
00067     + " <style>\n"
00068     + "   body \n"
00069     + "   { \n"
00070     + "     background-color: #f8fff8; \n"
00071     + "     margin: 10px; \n"
00072     + "     font-family: sans-serif; \n"
00073     + "     font-size: 10pt; \n"
00074     + "     color: #000066; \n"
00075     + "   } \n"
00076     + "   h1 { font-size: 12pt; color: #000066; } \n"
00077     + "   h2 { font-size: 10pt; color: #aa0000; } \n"
00078     + " </style>\n"
00079     + "</head>\n"
00080     + "<body>\n"
00081     + "  <h1>" + uploading + " " + files + " </h1>\n"
00082     + "  <h2>" + please_wait + "<h2>\n"
00083     + "</body>\n"
00084     + "</html>\n";
00085   var new_win = window.open('', 'upload_message', 'width=200,height=150');
00086   new_win.document.write(win_content);
00087 
00088   form.submit();
00089   SendEvent('import_doc', 'refresh');
00090 }

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