var i18nstr = { "help": "Help", "hlink_enter": "Enter the URL the link should point to", "hlink_caption": "Caption of the hyperlink"} var use_shortcuts = 1; /* This file is part of wili-cms wili-cms - wiki like content-managament system (http://wili-cms.sourceforge.net) Copyright (C) 2004-2007 Patrick Michaelis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ function loadCookies() { var cr = []; if (document.cookie != '') { var ck = document.cookie.split('; '); for (var i=ck.length - 1; i>= 0; i--) { var cv = ck.split('='); cr[ck[0]]=ck[1]; } } return cr; } function helpWindow( parameters ) { window.open( "help.php?" + parameters, i18nstr['help'], 'innerWidth=400,innerHeight=400,scrollbars=yes,' + 'location=no,menubar=no,toolbar=no,status=no' ); return false; } /* This file is part of wili-cms wili-cms - wiki like content-managament system (http://wili-cms.sourceforge.net) Copyright (C) 2004-2007 Patrick Michaelis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ // change permission checkbox // used by admin_templates/default_perms.php function permToggle( checkbox ) { // refresh permission string document.getElementById("permsInfo").innerHTML = (document.getElementsByName("perm_v")[0].checked ? "v" : "-") + (document.getElementsByName("perm_ur")[0].checked ? "r" : "-") + (document.getElementsByName("perm_uw")[0].checked ? "w" : "-") + (document.getElementsByName("perm_gr")[0].checked ? "r" : "-") + (document.getElementsByName("perm_gw")[0].checked ? "w" : "-") + (document.getElementsByName("perm_or")[0].checked ? "r" : "-") + (document.getElementsByName("perm_ow")[0].checked ? "w" : "-"); document.getElementById("perms").value = document.getElementsByName("perm_v")[0].checked * 0x0100 + document.getElementsByName("perm_ur")[0].checked * 0x0020 + document.getElementsByName("perm_uw")[0].checked * 0x0010 + document.getElementsByName("perm_gr")[0].checked * 0x0008 + document.getElementsByName("perm_gw")[0].checked * 0x0004 + document.getElementsByName("perm_or")[0].checked * 0x0002 + document.getElementsByName("perm_ow")[0].checked * 0x0001; }/* This file is part of wili-cms wili-cms - wiki like content-managament system (http://wili-cms.sourceforge.net) Copyright (C) 2004-2007 Patrick Michaelis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ // -- javascript helper functions for modifying textarea -- // set cursor to position function set_cursor(txtarea, pos, length ) { if(txtarea.createTextRange) { // the IE way var range = txtarea.createTextRange(); range.collapse( true ); range.moveStart( "character", pos ); range.moveEnd( "character", length ); range.select(); } else if(txtarea.selectionStart) { // Standard (Firefox etc.) txtarea.setSelectionRange( pos, pos + length ); txtarea.focus(); } } // Get selected Text function get_selected(txtarea) { if ( txtarea.selectionStart || !(document.selection) ) { return (txtarea.value).substring( txtarea.selectionStart, txtarea.selectionEnd ); } else { // te IE way return document.selection.createRange().text; } } // replace selected text in a txtarea with phrase and select the new text function replace_selected(txtarea, phrase) { if ( txtarea.selectionStart || !(document.selection) ) { var scrollPos = txtarea.scrollTop; var pos = txtarea.selectionStart; txtarea.focus(); txtarea.value = (txtarea.value).substring( 0, txtarea.selectionStart ) + phrase + (txtarea.value).substring( txtarea.selectionEnd, txtarea.value.length ); set_cursor( txtarea, pos, phrase.length ); txtarea.scrollTop = scrollPos; } else { // the IE way txtarea.focus(); var range = document.selection.createRange(); range.text = phrase; range.moveStart( "character", -phrase.length ); range.select(); } } // put selected text in a HTML tag: SELECTED TEXT // attributes is optional function tag(txtarea, tagname, attributes) { if ( attributes ) { var attribstr = " " + attributes; } else { var attribstr = ""; } replace_selected( txtarea, "<" + tagname + attribstr + ">" + get_selected( txtarea ) + "" ); } // Add a hyperlink to textarea function hlink(txtarea) { url = prompt( i18nstr['hlink_enter'], "http://www." ); caption = get_selected( txtarea ); if ( url ) { if (!( caption )) { caption = prompt( i18nstr['hlink_caption'], "Link" ); } replace_selected( txtarea, '' + caption + '' ); } } // Add a link to another page with pageid function rlink(txtarea, pageid ) { var parameter = ""; if (!(use_shortcut)) { var parameter = "?npage="; } replace_selected( txtarea, '' + get_selected( txtarea ) + "" ); } // Add an image tag to textarea // attributes an avalues are array of attribute names an values function imgtag(txtarea, attributes) { replace_selected( txtarea, "" ); } // open an image window function open_imgwindow( pageid, parameters ) { window.open( '?npage=' + pageid + '&mode=upload_picture&direct=direct&' + parameters, 'imgwindow', 'dependent=yes,menubar=no,location=no,scrollbars=yes,resizeable=yes,innerWidth=650,innerHeight=525'); } // open an reflink window (create a link to another page on this site) function open_reflinkwindow( pageid ) { window.open( '?npage=' + pageid + '&mode=edit_addreflink&direct=direct', 'imgwindow', 'dependent=yes,menubar=no,location=no,scrollbars=yes,resizeable=yes,innerWidth=650,innerHeight=600'); } // open a file upload function open_filewindow( pageid, parameters ) { window.open( '?npage=' + pageid + '&mode=upload_file&direct=direct&' + parameters, 'filewindow', 'dependent=yes,menubar=no,location=no,scrollbars=no,resizeable=yes,innerWidth=650,innerHeight=250'); } // show original language content of that page function editOrigLang( pid ) { show('edit_origlang_content'); document.getElementById('edit_origlang_content').innerHTML = readURL('index.php?direct=direct&npage=' + pid ); } // show preview of currently edited page function editPreview() { // make preview box visible show( "edit_preview", "block" ); // fields to copy from edit page var rowdata_fields = new Array( "pid", "type", "title", "subtitle", "datestart_day","datestart_month","datestart_year","datestart_hour", "datestart_minute", "dateend_day","dateend_month","dateend_year","dateend_hour","dateend_minute", "author", "summary", "content" ); var cvalues_fields = new Array( "location", "organizer", "summarylist" ); var url = "admin.php?direct=direct&mode=preview&action[0]=preview&"+ "npage=" + document.getElementsByName( "npage" )[0].value; // read row_data values from page for ( var i=0; i < rowdata_fields.length; i++ ) { var element = document.getElementsByName( "row_data[0][" + rowdata_fields[i] + "]" ); if ( element[0] ) { url = url + "&row_data[0][" + rowdata_fields[i] + "]=" + encodeURIComponent( element[0].value ); } } // read custom_values values from page for ( var i=0; i < cvalues_fields.length; i++ ) { var element = document.getElementsByName( "custom_values[0]["+cvalues_fields[i]+"]" ); if ( element[0] ) { url = url + "&custom_values[0][" + cvalues_fields[i] + "]=" + encodeURIComponent( element[0].value ); } } document.getElementById("edit_preview_content").innerHTML = readURL( url ); } // used by default_picture_upload (show and hide picture dimension inputs) function showPictDim( dest ) { show( "pageparameters[width]", (dest=="width") ? "inline" : "none" ); show( "pageparameters[height]",(dest=="height") ? "inline" : "none" ); } /* This file is part of wili-cms wili-cms - wiki like content-managament system (http://wili-cms.sourceforge.net) Copyright (C) 2004-2007 Patrick Michaelis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ // -- output a color select table -- // create a color select table // elid: id of input element to alter // divid: div to hide if color is selected function createColorSelect( elid, divid ) { var total=1657; var X=Y=j=RG=B=0; var aR=new Array(total); var aG=new Array(total); var aB=new Array(total); for (var i=0;i<256;i++) { aR[i+510]=aR[i+765]=aG[i+1020]=aG[i+5*255]=aB[i]=aB[i+255]=0; aR[510-i]=aR[i+1020]=aG[i]=aG[1020-i]=aB[i+510]=aB[1530-i]=i; aR[i]=aR[1530-i]=aG[i+255]=aG[i+510]=aB[i+765]=aB[i+1020]=255; if( i < 255 ) { aR[i/2+1530]=127; aG[i/2+1530]=127; aB[i/2+1530]=127; } } var hexbase=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"); var i=0; var jl=new Array(); for(x=0; x<16; x++) { for(y=0; y<16 ;y++) { jl[i++]=hexbase[x]+hexbase[y]; } } var htmlcode = ''; var H=W=63; for ( Y=0; Y<=H; Y++){ s = '<'+'tr height=2>'; j = Math.round(Y*(510/(H+1))-255); for (X=0; X<=W; X++) { i=Math.round(X*(total/W)); R=aR[i]-j;if(R<0)R=0;if(R>255||isNaN(R))R=255; G=aG[i]-j;if(G<0)G=0;if(G>255||isNaN(G))G=255; B=aB[i]-j;if(B<0)B=0;if(B>255||isNaN(B))B=255; s=s+'<'+'td width=2 bgcolor=#'+jl[R]+jl[G]+jl[B]+'><'+'/td>'; } htmlcode += s+'<'+'/tr>'; } htmlcode += '<'+'/table>'; return '
' + '
' + htmlcode + '
'; } var ns6= document.getElementById && !document.all; var ie=document.all; var scolor=''; // output preview color (called by onMouseOver) function colorPreview( evt ) { source= ie ? event.srcElement : evt.target; if (source.tagName=="TABLE") return; while( source.tagName!="TD" && source.tagName!="HTML" ) { source = ns6 ? source.parentNode : source.parentElement; } document.getElementById('preview').style.backgroundColor = scolor = source.bgColor; } // output selected color (called vy OnClick) // elid: the id of the element containing selected color (ie an input) function colorSelect( elid, divid ) { var elm=document.getElementById( elid ); elm.style.backgroundColor = scolor; elm.value = scolor; if ( divid ) { show( divid ); } }