Skip to content
Snippets Groups Projects
Commit 2411dd85 authored by Andreas Gohr's avatar Andreas Gohr
Browse files

java script changes

This adds a javascript confirmation for the delete button in the user manager.
It also adds the $() shortcut function known from the prototype library.

darcs-hash:20060126203550-7ad00-d5690ef06432286239953a79c5dbbc25f8720204.gz
parent 64c0800b
No related branches found
No related tags found
No related merge requests found
...@@ -148,8 +148,8 @@ $lang['qb_chars'] = 'Sonderzeichen'; ...@@ -148,8 +148,8 @@ $lang['qb_chars'] = 'Sonderzeichen';
$lang['del_confirm']= 'Eintrag wirklich löschen?'; $lang['del_confirm']= 'Eintrag wirklich löschen?';
$lang['admin_acl'] = 'Zugangsverwaltung...'; $lang['admin_acl'] = 'Zugangsverwaltung';
$lang['admin_register']= 'Neuen Benutzer anmelden...'; $lang['admin_register']= 'Neuen Benutzer anmelden';
$lang['acl_group'] = 'Gruppe'; $lang['acl_group'] = 'Gruppe';
$lang['acl_user'] = 'Benutzer'; $lang['acl_user'] = 'Benutzer';
......
...@@ -77,7 +77,7 @@ $lang['resendpwdnouser'] = 'Sorry, we can\'t find this user in our database.'; ...@@ -77,7 +77,7 @@ $lang['resendpwdnouser'] = 'Sorry, we can\'t find this user in our database.';
$lang['resendpwdsuccess'] = 'Your new password has been sent by email.'; $lang['resendpwdsuccess'] = 'Your new password has been sent by email.';
$lang['txt_upload'] = 'Select file to upload'; $lang['txt_upload'] = 'Select file to upload';
$lang['txt_filename'] = 'Enter wikiname (optional)'; $lang['txt_filename'] = 'Upload as (optional)';
$lang['txt_overwrt'] = 'Overwrite existing file'; $lang['txt_overwrt'] = 'Overwrite existing file';
$lang['lockedby'] = 'Currently locked by'; $lang['lockedby'] = 'Currently locked by';
$lang['lockexpire'] = 'Lock expires at'; $lang['lockexpire'] = 'Lock expires at';
...@@ -144,10 +144,10 @@ $lang['qb_sig'] = 'Insert Signature'; ...@@ -144,10 +144,10 @@ $lang['qb_sig'] = 'Insert Signature';
$lang['qb_smileys'] = 'Smileys'; $lang['qb_smileys'] = 'Smileys';
$lang['qb_chars'] = 'Special Chars'; $lang['qb_chars'] = 'Special Chars';
$lang['del_confirm']= 'Delete this entry?'; $lang['del_confirm']= 'Really delete selected item(s)?';
$lang['admin_acl'] = 'Access Control List Management...'; $lang['admin_acl'] = 'Access Control List Management';
$lang['admin_register']= 'Add new user...'; $lang['admin_register']= 'Add new user';
$lang['acl_group'] = 'Group'; $lang['acl_group'] = 'Group';
$lang['acl_user'] = 'User'; $lang['acl_user'] = 'User';
......
...@@ -65,8 +65,9 @@ function js_out(){ ...@@ -65,8 +65,9 @@ function js_out(){
ob_start(); ob_start();
// add some translation strings and global variables // add some translation strings and global variables
print "var alertText = '".str_replace('\\\\n','\\n',addslashes($lang['qb_alert']))."';"; print "var alertText = '".js_escape($lang['qb_alert'])."';";
print "var notSavedYet = '".str_replace('\\\\n','\\n',addslashes($lang['notsavedyet']))."';"; print "var notSavedYet = '".js_escape($lang['notsavedyet'])."';";
print "var reallyDel = '".js_escape($lang['del_confirm'])."';";
print "var DOKU_BASE = '".DOKU_BASE."';"; print "var DOKU_BASE = '".DOKU_BASE."';";
// load files // load files
......
...@@ -192,7 +192,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { ...@@ -192,7 +192,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
ptln(" <tbody>"); ptln(" <tbody>");
ptln(" <tr><td colspan=\"6\" style=\"text-align:center\">"); ptln(" <tr><td colspan=\"6\" style=\"text-align:center\">");
ptln(" <span style=\"float:left\">"); ptln(" <span style=\"float:left\">");
ptln(" <input type=\"submit\" name=\"fn[delete]\" ".$delete_disable." value=\"".$this->lang['delete_selected']."\"/>"); ptln(" <input type=\"submit\" name=\"fn[delete]\" ".$delete_disable." value=\"".$this->lang['delete_selected']."\" id=\"usrmgr__del\" />");
ptln(" </span>"); ptln(" </span>");
ptln(" <span style=\"float:right\">"); ptln(" <span style=\"float:right\">");
ptln(" <input type=\"submit\" name=\"fn[start]\" ".$page_buttons['start']." value=\"".$this->lang['start']."\" />"); ptln(" <input type=\"submit\" name=\"fn[start]\" ".$page_buttons['start']." value=\"".$this->lang['start']."\" />");
......
...@@ -114,7 +114,7 @@ if (domLib_useLibrary && domTT_useGlobalMousePosition) ...@@ -114,7 +114,7 @@ if (domLib_useLibrary && domTT_useGlobalMousePosition)
{ {
domTT_dragUpdate(in_event); domTT_dragUpdate(in_event);
} }
} };
} }
// }}} // }}}
...@@ -275,7 +275,7 @@ function domTT_activate(in_this, in_event) ...@@ -275,7 +275,7 @@ function domTT_activate(in_this, in_event)
options.set('activateTimeout', domLib_setTimeout(domTT_runShow, options.get('delay'), [owner.id, in_event])); options.set('activateTimeout', domLib_setTimeout(domTT_runShow, options.get('delay'), [owner.id, in_event]));
return owner.id; return owner.id;
} };
// }}} // }}}
// {{{ domTT_create() // {{{ domTT_create()
...@@ -587,7 +587,7 @@ function domTT_create(in_options) ...@@ -587,7 +587,7 @@ function domTT_create(in_options)
in_options.set('node', tipObj); in_options.set('node', tipObj);
in_options.set('status', 'inactive'); in_options.set('status', 'inactive');
} };
// }}} // }}}
// {{{ domTT_show() // {{{ domTT_show()
......
...@@ -16,6 +16,30 @@ if (clientPC.indexOf('opera')!=-1) { ...@@ -16,6 +16,30 @@ if (clientPC.indexOf('opera')!=-1) {
var is_opera_seven = (window.opera && document.childNodes); var is_opera_seven = (window.opera && document.childNodes);
} }
/**
* Handy shortcut to document.getElementById
*
* This function was taken from the prototype library
*
* @link http://prototype.conio.net/
*/
function $() {
var elements = new Array();
for (var i = 0; i < arguments.length; i++) {
var element = arguments[i];
if (typeof element == 'string')
element = document.getElementById(element);
if (arguments.length == 1)
return element;
elements.push(element);
}
return elements;
}
/** /**
* Get the X offset of the top left corner of the given object * Get the X offset of the top left corner of the given object
* *
...@@ -27,7 +51,7 @@ function findPosX(object){ ...@@ -27,7 +51,7 @@ function findPosX(object){
if(typeof(object) == 'object'){ if(typeof(object) == 'object'){
obj = object; obj = object;
}else{ }else{
obj = document.getElementById(object); obj = $(object);
} }
if (obj.offsetParent){ if (obj.offsetParent){
while (obj.offsetParent){ while (obj.offsetParent){
...@@ -52,7 +76,7 @@ function findPosY(object){ ...@@ -52,7 +76,7 @@ function findPosY(object){
if(typeof(object) == 'object'){ if(typeof(object) == 'object'){
obj = object; obj = object;
}else{ }else{
obj = document.getElementById(object); obj = $(object);
} }
if (obj.offsetParent){ if (obj.offsetParent){
while (obj.offsetParent){ while (obj.offsetParent){
...@@ -129,7 +153,7 @@ function showLoadBar(){ ...@@ -129,7 +153,7 @@ function showLoadBar(){
*/ */
function hideLoadBar(){ function hideLoadBar(){
if(document.getElementById){ if(document.getElementById){
document.getElementById('loading').style.display="none"; $('loading').style.display="none";
} }
} }
...@@ -160,7 +184,7 @@ function suggestWikiname(){ ...@@ -160,7 +184,7 @@ function suggestWikiname(){
*/ */
function addTocToggle() { function addTocToggle() {
if(!document.getElementById) return; if(!document.getElementById) return;
var header = document.getElementById('toc__header'); var header = $('toc__header');
if(!header) return; if(!header) return;
var showimg = document.createElement('img'); var showimg = document.createElement('img');
...@@ -184,9 +208,9 @@ function addTocToggle() { ...@@ -184,9 +208,9 @@ function addTocToggle() {
* This toggles the visibility of the Table of Contents * This toggles the visibility of the Table of Contents
*/ */
function toggleToc() { function toggleToc() {
var toc = document.getElementById('toc__inside'); var toc = $('toc__inside');
var showimg = document.getElementById('toc__show'); var showimg = $('toc__show');
var hideimg = document.getElementById('toc__hide'); var hideimg = $('toc__hide');
if(toc.style.display == 'none') { if(toc.style.display == 'none') {
toc.style.display = ''; toc.style.display = '';
hideimg.style.display = ''; hideimg.style.display = '';
...@@ -254,7 +278,7 @@ function fixDate(date) { ...@@ -254,7 +278,7 @@ function fixDate(date) {
*/ */
function checkAclLevel(){ function checkAclLevel(){
if(document.getElementById) { if(document.getElementById) {
var scope = document.getElementById('acl_scope').value; var scope = $('acl_scope').value;
//check for namespace //check for namespace
if( (scope.indexOf(":*") > 0) || (scope == "*") ){ if( (scope.indexOf(":*") > 0) || (scope == "*") ){
...@@ -270,7 +294,9 @@ function checkAclLevel(){ ...@@ -270,7 +294,9 @@ function checkAclLevel(){
} }
} }
/* insitu footnote addition /**
* insitu footnote addition
*
* provide a wrapper for domTT javascript library * provide a wrapper for domTT javascript library
* this function is placed in the onmouseover event of footnote references in the main page * this function is placed in the onmouseover event of footnote references in the main page
* *
...@@ -280,17 +306,17 @@ var currentFootnote = 0; ...@@ -280,17 +306,17 @@ var currentFootnote = 0;
function fnt(id, e, evt) { function fnt(id, e, evt) {
if (currentFootnote && id != currentFootnote) { if (currentFootnote && id != currentFootnote) {
domTT_close(document.getElementById('insitu-fn'+currentFootnote)); domTT_close($('insitu-fn'+currentFootnote));
} }
// does the footnote tooltip already exist? // does the footnote tooltip already exist?
var fnote = document.getElementById('insitu-fn'+id); var fnote = $('insitu-fn'+id);
var footnote; var footnote;
if (!fnote) { if (!fnote) {
// if not create it... // if not create it...
// locate the footnote anchor element // locate the footnote anchor element
var a = document.getElementById( "fn"+id ); var a = $( "fn"+id );
if (!a){ return; } if (!a){ return; }
// anchor parent is the footnote container, get its innerHTML // anchor parent is the footnote container, get its innerHTML
...@@ -318,8 +344,8 @@ function fnt(id, e, evt) { ...@@ -318,8 +344,8 @@ function fnt(id, e, evt) {
function initSizeCtl(ctlid,edid){ function initSizeCtl(ctlid,edid){
if(!document.getElementById){ return; } if(!document.getElementById){ return; }
var ctl = document.getElementById(ctlid); var ctl = $(ctlid);
var textarea = document.getElementById(edid); var textarea = $(edid);
var hgt = getCookie('DokuWikisizeCtl'); var hgt = getCookie('DokuWikisizeCtl');
if(hgt === null || hgt === ''){ if(hgt === null || hgt === ''){
...@@ -342,7 +368,7 @@ function initSizeCtl(ctlid,edid){ ...@@ -342,7 +368,7 @@ function initSizeCtl(ctlid,edid){
* This sets the vertical size of the editbox * This sets the vertical size of the editbox
*/ */
function sizeCtl(edid,val){ function sizeCtl(edid,val){
var textarea = document.getElementById(edid); var textarea = $(edid);
var height = parseInt(textarea.style.height.substr(0,textarea.style.height.length-2)); var height = parseInt(textarea.style.height.substr(0,textarea.style.height.length-2));
height += val; height += val;
textarea.style.height = height+'px'; textarea.style.height = height+'px';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment