2007-07-19 12:08:42 +00:00
< ? php
class AdminPageTheme extends Themelet {
2007-07-28 20:30:01 +00:00
/*
* Show the basics of a page , for other extensions to add to
*/
2009-01-04 19:54:16 +00:00
public function display_page ( Page $page ) {
2007-07-19 12:08:42 +00:00
$page -> set_title ( " Admin Tools " );
$page -> set_heading ( " Admin Tools " );
$page -> add_block ( new NavBlock ());
}
2008-04-11 05:36:36 +00:00
/*
* Show a form which links to admin_utils with POST [ action ] set to one of :
* 'lowercase all tags'
* 'recount tag use'
* 'purge unused tags'
*/
2009-01-04 19:54:16 +00:00
public function display_form ( Page $page ) {
2010-05-28 13:26:46 +00:00
global $user ;
2012-02-07 00:02:30 +00:00
$html = '
< script type = " text/javascript " >
function imgidconfirm (){
if ( document . getElementById ( " misc " ) . selectedIndex == 4 ){
if ( confirm ( " This function WILL break any bookmarks & links. \n The event log will also not be updated with new ids. \n Are you sure you wish to continue? " )){
return true ;
} else {
return false ;
}
}
}
</ script >
' . make_form ( make_link ( " admin_utils " ), " post " , false , false , " return imgidconfirm() " ) . "
< select name = 'action' id = 'misc' >
2008-04-11 05:36:36 +00:00
< option value = 'lowercase all tags' > All tags to lowercase </ option >
< option value = 'recount tag use' > Recount tag use </ option >
< option value = 'purge unused tags' > Purge unused tags </ option >
2008-05-22 20:41:46 +00:00
< option value = 'database dump' > Download database contents </ option >
2012-02-01 19:16:55 +00:00
< option value = 'reset image ids' > Reset image ids </ option >
2012-02-06 06:52:04 +00:00
< option value = 'image dump' > Download all images </ option >
2011-01-01 19:00:30 +00:00
<!--< option value = 'convert to innodb' > Convert database to InnoDB ( MySQL only ) </ option >-->
2008-04-11 05:36:36 +00:00
</ select >
< input type = 'submit' value = 'Go' >
</ form >
" ;
$page -> add_block ( new Block ( " Misc Admin Tools " , $html ));
2011-12-29 23:05:09 +00:00
/* First check
Requires you to click the checkbox to enable the delete by query form */
2012-01-24 02:15:44 +00:00
$dbqcheck = ' javascript : $ ( function () {
if ( $ ( " #dbqcheck:checked " ) . length != 0 ){
$ ( " #dbqtags " ) . attr ( " disabled " , false );
$ ( " #dbqsubmit " ) . attr ( " disabled " , false );
2011-12-29 23:05:09 +00:00
} else {
2012-01-24 02:15:44 +00:00
$ ( " #dbqtags " ) . attr ( " disabled " , true );
$ ( " #dbqsubmit " ) . attr ( " disabled " , true );
}
}); ' ;
2011-12-29 23:05:09 +00:00
/* Second check
Requires you to confirm the deletion by clicking ok . */
2010-12-23 14:00:50 +00:00
$html = "
2011-12-29 23:05:09 +00:00
< script type = 'text/javascript' >
function checkform (){
if ( confirm ( 'Are you sure you wish to delete all images using these tags?' )){
return true ;
} else {
2012-01-24 02:15:44 +00:00
return false ;
2011-12-29 23:05:09 +00:00
}
}
</ script > "
. make_form ( make_link ( " admin_utils " ), " post " , false , false , " return checkform() " ) . "
< input type = 'checkbox' id = 'dbqcheck' name = 'action' onclick = '$dbqcheck' >
2010-12-23 14:00:50 +00:00
< input type = 'hidden' name = 'action' value = 'delete by query' >
2011-12-29 23:05:09 +00:00
< input type = 'text' id = 'dbqtags' disabled = 'true' name = 'query' >
< input type = 'submit' id = 'dbqsubmit' disabled = 'true' value = 'Go' >
2010-12-23 14:00:50 +00:00
</ form >
" ;
$page -> add_block ( new Block ( " Delete by Query " , $html ));
2008-04-11 05:36:36 +00:00
}
2007-07-19 12:08:42 +00:00
}
?>