244 |
244 |
245 $btn_selected = ( isset($tplvars['toolbar_button_selected'])) ? $tplvars['toolbar_button_selected'] : $tplvars['toolbar_button']; |
245 $btn_selected = ( isset($tplvars['toolbar_button_selected'])) ? $tplvars['toolbar_button_selected'] : $tplvars['toolbar_button']; |
246 $parser = $this->makeParserText($btn_selected); |
246 $parser = $this->makeParserText($btn_selected); |
247 |
247 |
248 $parser->assign_vars(array( |
248 $parser->assign_vars(array( |
249 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxReset()); return false; }" title="View the page contents, all of the page contents, and nothing but the page contents (alt-a)" accesskey="a"', |
249 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxReset()); return false; }" title="' . $lang->get('onpage_tip_article') . '" accesskey="a"', |
250 'PARENTFLAGS' => 'id="mdgToolbar_article"', |
250 'PARENTFLAGS' => 'id="mdgToolbar_article"', |
251 'HREF' => makeUrl($paths->page, null, true), |
251 'HREF' => makeUrl($paths->page, null, true), |
252 'TEXT' => $this->namespace_string |
252 'TEXT' => $this->namespace_string |
253 )); |
253 )); |
254 |
254 |
311 } |
311 } |
312 // Edit button |
312 // Edit button |
313 if($session->get_permissions('read') && ($paths->namespace != 'Special' && $paths->namespace != 'Admin') && ( $session->get_permissions('edit_page') && ( ( $paths->page_protected && $session->get_permissions('even_when_protected') ) || !$paths->page_protected ) ) ) |
313 if($session->get_permissions('read') && ($paths->namespace != 'Special' && $paths->namespace != 'Admin') && ( $session->get_permissions('edit_page') && ( ( $paths->page_protected && $session->get_permissions('even_when_protected') ) || !$paths->page_protected ) ) ) |
314 { |
314 { |
315 $button->assign_vars(array( |
315 $button->assign_vars(array( |
316 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxEditor()); return false; }" title="Edit the contents of this page (alt-e)" accesskey="e"', |
316 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxEditor()); return false; }" title="' . $lang->get('onpage_tip_edit') . '" accesskey="e"', |
317 'PARENTFLAGS' => 'id="mdgToolbar_edit"', |
317 'PARENTFLAGS' => 'id="mdgToolbar_edit"', |
318 'HREF' => makeUrl($paths->page, 'do=edit', true), |
318 'HREF' => makeUrl($paths->page, 'do=edit', true), |
319 'TEXT' => $lang->get('onpage_btn_edit') |
319 'TEXT' => $lang->get('onpage_btn_edit') |
320 )); |
320 )); |
321 $tb .= $button->run(); |
321 $tb .= $button->run(); |
322 // View source button |
322 // View source button |
323 } |
323 } |
324 else if($session->get_permissions('view_source') && ( !$session->get_permissions('edit_page') || !$session->get_permissions('even_when_protected') && $paths->page_protected ) && $paths->namespace != 'Special' && $paths->namespace != 'Admin') |
324 else if($session->get_permissions('view_source') && ( !$session->get_permissions('edit_page') || !$session->get_permissions('even_when_protected') && $paths->page_protected ) && $paths->namespace != 'Special' && $paths->namespace != 'Admin') |
325 { |
325 { |
326 $button->assign_vars(array( |
326 $button->assign_vars(array( |
327 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxViewSource()); return false; }" title="View the source code (wiki markup) that this page uses (alt-e)" accesskey="e"', |
327 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxViewSource()); return false; }" title="' . $lang->get('onpage_tip_viewsource') . '" accesskey="e"', |
328 'PARENTFLAGS' => 'id="mdgToolbar_edit"', |
328 'PARENTFLAGS' => 'id="mdgToolbar_edit"', |
329 'HREF' => makeUrl($paths->page, 'do=viewsource', true), |
329 'HREF' => makeUrl($paths->page, 'do=viewsource', true), |
330 'TEXT' => $lang->get('onpage_btn_viewsource') |
330 'TEXT' => $lang->get('onpage_btn_viewsource') |
331 )); |
331 )); |
332 $tb .= $button->run(); |
332 $tb .= $button->run(); |
333 } |
333 } |
334 // History button |
334 // History button |
335 if ( $session->get_permissions('read') /* && $paths->wiki_mode */ && $paths->page_exists && $paths->namespace != 'Special' && $paths->namespace != 'Admin' && $session->get_permissions('history_view') ) |
335 if ( $session->get_permissions('read') /* && $paths->wiki_mode */ && $paths->page_exists && $paths->namespace != 'Special' && $paths->namespace != 'Admin' && $session->get_permissions('history_view') ) |
336 { |
336 { |
337 $button->assign_vars(array( |
337 $button->assign_vars(array( |
338 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxHistory()); return false; }" title="View a log of actions taken on this page (alt-h)" accesskey="h"', |
338 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxHistory()); return false; }" title="' . $lang->get('onpage_tip_history') . '" accesskey="h"', |
339 'PARENTFLAGS' => 'id="mdgToolbar_history"', |
339 'PARENTFLAGS' => 'id="mdgToolbar_history"', |
340 'HREF' => makeUrl($paths->page, 'do=history', true), |
340 'HREF' => makeUrl($paths->page, 'do=history', true), |
341 'TEXT' => $lang->get('onpage_btn_history') |
341 'TEXT' => $lang->get('onpage_btn_history') |
342 )); |
342 )); |
343 $tb .= $button->run(); |
343 $tb .= $button->run(); |
348 // Additional actions menu |
348 // Additional actions menu |
349 // Rename button |
349 // Rename button |
350 if ( $session->get_permissions('read') && $paths->page_exists && ( $session->get_permissions('rename') && ( $paths->page_protected && $session->get_permissions('even_when_protected') || !$paths->page_protected ) ) && $paths->namespace != 'Special' && $paths->namespace != 'Admin' ) |
350 if ( $session->get_permissions('read') && $paths->page_exists && ( $session->get_permissions('rename') && ( $paths->page_protected && $session->get_permissions('even_when_protected') || !$paths->page_protected ) ) && $paths->namespace != 'Special' && $paths->namespace != 'Admin' ) |
351 { |
351 { |
352 $menubtn->assign_vars(array( |
352 $menubtn->assign_vars(array( |
353 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxRename()); return false; }" title="Change the display name of this page (alt-r)" accesskey="r"', |
353 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxRename()); return false; }" title="' . $lang->get('onpage_tip_rename') . '" accesskey="r"', |
354 'HREF' => makeUrl($paths->page, 'do=rename', true), |
354 'HREF' => makeUrl($paths->page, 'do=rename', true), |
355 'TEXT' => $lang->get('onpage_btn_rename'), |
355 'TEXT' => $lang->get('onpage_btn_rename'), |
356 )); |
356 )); |
357 $this->toolbar_menu .= $menubtn->run(); |
357 $this->toolbar_menu .= $menubtn->run(); |
358 } |
358 } |
359 |
359 |
360 // Vote-to-delete button |
360 // Vote-to-delete button |
361 if ( $paths->wiki_mode && $session->get_permissions('vote_delete') && $paths->page_exists && $paths->namespace != 'Special' && $paths->namespace != 'Admin') |
361 if ( $paths->wiki_mode && $session->get_permissions('vote_delete') && $paths->page_exists && $paths->namespace != 'Special' && $paths->namespace != 'Admin') |
362 { |
362 { |
363 $menubtn->assign_vars(array( |
363 $menubtn->assign_vars(array( |
364 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxDelVote()); return false; }" title="Vote to have this page deleted (alt-d)" accesskey="d"', |
364 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxDelVote()); return false; }" title="' . $lang->get('onpage_tip_delvote') . '" accesskey="d"', |
365 'HREF' => makeUrl($paths->page, 'do=delvote', true), |
365 'HREF' => makeUrl($paths->page, 'do=delvote', true), |
366 'TEXT' => $lang->get('onpage_btn_votedelete'), |
366 'TEXT' => $lang->get('onpage_btn_votedelete'), |
367 )); |
367 )); |
368 $this->toolbar_menu .= $menubtn->run(); |
368 $this->toolbar_menu .= $menubtn->run(); |
369 } |
369 } |
370 |
370 |
371 // Clear-votes button |
371 // Clear-votes button |
372 if ( $session->get_permissions('read') && $paths->wiki_mode && $paths->page_exists && $paths->namespace != 'Special' && $paths->namespace != 'Admin' && $session->get_permissions('vote_reset') && $paths->cpage['delvotes'] > 0) |
372 if ( $session->get_permissions('read') && $paths->wiki_mode && $paths->page_exists && $paths->namespace != 'Special' && $paths->namespace != 'Admin' && $session->get_permissions('vote_reset') && $paths->cpage['delvotes'] > 0) |
373 { |
373 { |
374 $menubtn->assign_vars(array( |
374 $menubtn->assign_vars(array( |
375 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxResetDelVotes()); return false; }" title="Vote to have this page deleted (alt-y)" accesskey="y"', |
375 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxResetDelVotes()); return false; }" title="' . $lang->get('onpage_tip_resetvotes') . '" accesskey="y"', |
376 'HREF' => makeUrl($paths->page, 'do=resetvotes', true), |
376 'HREF' => makeUrl($paths->page, 'do=resetvotes', true), |
377 'TEXT' => $lang->get('onpage_btn_votedelete_reset'), |
377 'TEXT' => $lang->get('onpage_btn_votedelete_reset'), |
378 )); |
378 )); |
379 $this->toolbar_menu .= $menubtn->run(); |
379 $this->toolbar_menu .= $menubtn->run(); |
380 } |
380 } |
381 |
381 |
382 // Printable page button |
382 // Printable page button |
383 if ( $paths->page_exists && $paths->namespace != 'Special' && $paths->namespace != 'Admin' ) |
383 if ( $paths->page_exists && $paths->namespace != 'Special' && $paths->namespace != 'Admin' ) |
384 { |
384 { |
385 $menubtn->assign_vars(array( |
385 $menubtn->assign_vars(array( |
386 'FLAGS' => 'title="View a version of this page that is suitable for printing"', |
386 'FLAGS' => 'title="' . $lang->get('onpage_tip_printable') . '"', |
387 'HREF' => makeUrl($paths->page, 'printable=yes', true), |
387 'HREF' => makeUrl($paths->page, 'printable=yes', true), |
388 'TEXT' => $lang->get('onpage_btn_printable'), |
388 'TEXT' => $lang->get('onpage_btn_printable'), |
389 )); |
389 )); |
390 $this->toolbar_menu .= $menubtn->run(); |
390 $this->toolbar_menu .= $menubtn->run(); |
391 } |
391 } |
402 if ( $paths->cpage['protected'] == 1 ) |
402 if ( $paths->cpage['protected'] == 1 ) |
403 { |
403 { |
404 $ctmp=' style="text-decoration: underline;"'; |
404 $ctmp=' style="text-decoration: underline;"'; |
405 } |
405 } |
406 $menubtn->assign_vars(array( |
406 $menubtn->assign_vars(array( |
407 'FLAGS' => 'accesskey="i" onclick="if ( !KILL_SWITCH ) { ajaxProtect(1); return false; }" id="protbtn_1" title="Prevents all non-administrators from editing this page. [alt-i]"'.$ctmp, |
407 'FLAGS' => 'accesskey="i" onclick="if ( !KILL_SWITCH ) { ajaxProtect(1); return false; }" id="protbtn_1" title="' . $lang->get('onpage_tip_protect_on') . '"'.$ctmp, |
408 'HREF' => makeUrl($paths->page, 'do=protect&level=1', true), |
408 'HREF' => makeUrl($paths->page, 'do=protect&level=1', true), |
409 'TEXT' => $lang->get('onpage_btn_protect_on') |
409 'TEXT' => $lang->get('onpage_btn_protect_on') |
410 )); |
410 )); |
411 $t1 = $menubtn->run(); |
411 $t1 = $menubtn->run(); |
412 |
412 |
414 if ( $paths->cpage['protected'] == 0 ) |
414 if ( $paths->cpage['protected'] == 0 ) |
415 { |
415 { |
416 $ctmp=' style="text-decoration: underline;"'; |
416 $ctmp=' style="text-decoration: underline;"'; |
417 } |
417 } |
418 $menubtn->assign_vars(array( |
418 $menubtn->assign_vars(array( |
419 'FLAGS' => 'accesskey="o" onclick="if ( !KILL_SWITCH ) { ajaxProtect(0); return false; }" id="protbtn_0" title="Allows everyone to edit this page. [alt-o]"'.$ctmp, |
419 'FLAGS' => 'accesskey="o" onclick="if ( !KILL_SWITCH ) { ajaxProtect(0); return false; }" id="protbtn_0" title="' . $lang->get('onpage_tip_protect_off') . '"'.$ctmp, |
420 'HREF' => makeUrl($paths->page, 'do=protect&level=0', true), |
420 'HREF' => makeUrl($paths->page, 'do=protect&level=0', true), |
421 'TEXT' => $lang->get('onpage_btn_protect_off') |
421 'TEXT' => $lang->get('onpage_btn_protect_off') |
422 )); |
422 )); |
423 $t2 = $menubtn->run(); |
423 $t2 = $menubtn->run(); |
424 |
424 |
426 if ( $paths->cpage['protected'] == 2 ) |
426 if ( $paths->cpage['protected'] == 2 ) |
427 { |
427 { |
428 $ctmp = ' style="text-decoration: underline;"'; |
428 $ctmp = ' style="text-decoration: underline;"'; |
429 } |
429 } |
430 $menubtn->assign_vars(array( |
430 $menubtn->assign_vars(array( |
431 'FLAGS' => 'accesskey="p" onclick="if ( !KILL_SWITCH ) { ajaxProtect(2); return false; }" id="protbtn_2" title="Allows only users who have been registered for 4 days to edit this page. [alt-p]"'.$ctmp, |
431 'FLAGS' => 'accesskey="p" onclick="if ( !KILL_SWITCH ) { ajaxProtect(2); return false; }" id="protbtn_2" title="' . $lang->get('onpage_tip_protect_semi') . '"'.$ctmp, |
432 'HREF' => makeUrl($paths->page, 'do=protect&level=2', true), |
432 'HREF' => makeUrl($paths->page, 'do=protect&level=2', true), |
433 'TEXT' => $lang->get('onpage_btn_protect_semi') |
433 'TEXT' => $lang->get('onpage_btn_protect_semi') |
434 )); |
434 )); |
435 $t3 = $menubtn->run(); |
435 $t3 = $menubtn->run(); |
436 |
436 |
504 |
504 |
505 // Clear logs button |
505 // Clear logs button |
506 if ( $session->get_permissions('read') && $session->get_permissions('clear_logs') && $paths->namespace != 'Special' && $paths->namespace != 'Admin' ) |
506 if ( $session->get_permissions('read') && $session->get_permissions('clear_logs') && $paths->namespace != 'Special' && $paths->namespace != 'Admin' ) |
507 { |
507 { |
508 $menubtn->assign_vars(array( |
508 $menubtn->assign_vars(array( |
509 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxClearLogs()); return false; }" title="Remove all edit and action logs for this page from the database. IRREVERSIBLE! (alt-l)" accesskey="l"', |
509 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { void(ajaxClearLogs()); return false; }" title="' . $lang->get('onpage_tip_flushlogs') . '" accesskey="l"', |
510 'HREF' => makeUrl($paths->page, 'do=flushlogs', true), |
510 'HREF' => makeUrl($paths->page, 'do=flushlogs', true), |
511 'TEXT' => $lang->get('onpage_btn_clearlogs'), |
511 'TEXT' => $lang->get('onpage_btn_clearlogs'), |
512 )); |
512 )); |
513 $this->toolbar_menu .= $menubtn->run(); |
513 $this->toolbar_menu .= $menubtn->run(); |
514 } |
514 } |
578 |
578 |
579 // Manage ACLs button |
579 // Manage ACLs button |
580 if($session->get_permissions('edit_acl') || $session->user_level >= USER_LEVEL_ADMIN) |
580 if($session->get_permissions('edit_acl') || $session->user_level >= USER_LEVEL_ADMIN) |
581 { |
581 { |
582 $menubtn->assign_vars(array( |
582 $menubtn->assign_vars(array( |
583 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { return ajaxOpenACLManager(); }" title="Manage who can do what with this page (alt-m)" accesskey="m"', |
583 'FLAGS' => 'onclick="if ( !KILL_SWITCH ) { return ajaxOpenACLManager(); }" title="' . $lang->get('onpage_tip_aclmanager') . '" accesskey="m"', |
584 'HREF' => makeUrl($paths->page, 'do=aclmanager', true), |
584 'HREF' => makeUrl($paths->page, 'do=aclmanager', true), |
585 'TEXT' => $lang->get('onpage_btn_acl'), |
585 'TEXT' => $lang->get('onpage_btn_acl'), |
586 )); |
586 )); |
587 $this->toolbar_menu .= $menubtn->run(); |
587 $this->toolbar_menu .= $menubtn->run(); |
588 } |
588 } |