uEdit.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 save()
00026 {
00027   var form = document.uEdit;
00028   var edit_rights = form.edit_rights.value;
00029   SendEvent('uEdit', 'save', 'edit_rights='+edit_rights);
00030 }
00031 
00032 function add_node(list)
00033 {
00034   var idx = list.selectedIndex;
00035   var node_id = list.options[idx].value;
00036   var form = document.add_rights;
00037 
00038   if (form.nodes.value=='' || form.nodes.value=='ALL' || node_id=='ALL')
00039     form.nodes.value = node_id;
00040   else
00041     form.nodes.value += ',' + node_id;
00042 
00043   list.selectedIndex = 0;
00044   form.nodes.focus();
00045 }
00046 
00047 function add_lng(list)
00048 {
00049   var idx = list.selectedIndex;
00050   var lng = list.options[idx].value;
00051   var form = document.add_rights;
00052 
00053   if (form.langs.value=='' || form.langs.value=='ALL' || lng=='ALL')
00054     form.langs.value = lng;
00055   else
00056     form.langs.value += ',' + lng;
00057 
00058   list.selectedIndex = 0;
00059   form.langs.focus();
00060 }
00061 
00062 function add()
00063 {
00064   var form = document.add_rights;
00065   var access, rights;
00066   var nodes = form.nodes.value;
00067   var langs = form.langs.value;
00068 
00069   if (form.access[0].checked) access='allow';
00070   else if (form.access[1].checked) access='deny';
00071   else
00072     {
00073       alert(T_("Please specify either allow or deny."));
00074       return;
00075     }
00076 
00077   if (form.edit.checked && form.approve.checked)
00078     rights = 'edit,approve';
00079   else if (!form.edit.checked && form.approve.checked)
00080     rights = 'approve';
00081   else
00082     rights = 'edit';
00083 
00084   document.uEdit.edit_rights.value += 
00085     access + ':' + rights + ':' + nodes + ':' + langs + "\n";
00086   form.reset();
00087 }
00088 

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