configuarable oekaki size, and more consistent creation
This commit is contained in:
parent
80673b73ec
commit
7391dcf0b6
@ -3,25 +3,19 @@
|
|||||||
// FIXME: Move default canvas size to config file; changeable in board config
|
// FIXME: Move default canvas size to config file; changeable in board config
|
||||||
// While we're here, add maximum and minimum image sizes in config
|
// While we're here, add maximum and minimum image sizes in config
|
||||||
// Maybe allow the resolution limiter extension to have a say in this
|
// Maybe allow the resolution limiter extension to have a say in this
|
||||||
$defOekW = 400; // Common default for oekaki boards: 300x300
|
|
||||||
$defOekH = 400;
|
|
||||||
class OekakiTheme extends Themelet {
|
class OekakiTheme extends Themelet {
|
||||||
public function display_page() {
|
public function display_page() {
|
||||||
global $config, $page, $defOekW, $defOekH;
|
global $config, $page;
|
||||||
|
|
||||||
$base_href = get_base_href();
|
$base_href = get_base_href();
|
||||||
$http_base = make_http($base_href);
|
$http_base = make_http($base_href);
|
||||||
|
|
||||||
if (isset($_POST['oekW']) and isset($_POST['oekH'])){
|
$oekW = $config->get_int("oekaki_width", 400);
|
||||||
$oekW = $_POST['oekW'];
|
$oekH = $config->get_int("oekaki_height", 400);
|
||||||
$oekH = $_POST['oekH'];
|
if(isset($_POST['oekW']) && isset($_POST['oekH'])) {
|
||||||
if(!ctype_digit($oekW) or !ctype_digit($oekH)){
|
$oekW = int_escape($_POST['oekW']);
|
||||||
$oekW = $defOekW;
|
$oekH = int_escape($_POST['oekH']);
|
||||||
$oekH = $defOekH;
|
|
||||||
}
|
|
||||||
} else{
|
|
||||||
$oekW = $defOekW;
|
|
||||||
$oekH = $defOekH;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = "
|
$html = "
|
||||||
@ -31,7 +25,7 @@ class OekakiTheme extends Themelet {
|
|||||||
<param name='postUrl' value='".make_http(make_link("oekaki/upload"))."' />
|
<param name='postUrl' value='".make_http(make_link("oekaki/upload"))."' />
|
||||||
<param name='exitUrl' value='".make_http(make_link("oekaki/claim"))."' />
|
<param name='exitUrl' value='".make_http(make_link("oekaki/claim"))."' />
|
||||||
<param name='exitUrlTarget' value='_self' />
|
<param name='exitUrlTarget' value='_self' />
|
||||||
JAVA NOT INSTALLED >:(<!-- alternative content for users who don't have Java installed -->
|
JAVA NOT INSTALLED :(<!-- alternative content for users who don't have Java installed -->
|
||||||
</applet>
|
</applet>
|
||||||
";
|
";
|
||||||
|
|
||||||
@ -61,20 +55,24 @@ class OekakiTheme extends Themelet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function display_block() {
|
public function display_block() {
|
||||||
global $page, $defOekW, $defOekH;
|
global $config, $page;
|
||||||
//FIXME: input field alignment could be done more elegantly, without inline styling
|
//FIXME: input field alignment could be done more elegantly, without inline styling
|
||||||
//FIXME: autocomplete='off' seems to be an invalid HTML tag
|
//FIXME: autocomplete='off' seems to be an invalid HTML tag
|
||||||
$page->add_block(new Block(null,
|
|
||||||
|
$oekW = $config->get_int("oekaki_width", 400);
|
||||||
|
$oekH = $config->get_int("oekaki_height", 400);
|
||||||
|
if(isset($_POST['oekW']) && isset($_POST['oekH'])) {
|
||||||
|
$oekW = int_escape($_POST['oekW']);
|
||||||
|
$oekH = int_escape($_POST['oekH']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$page->add_block(new Block("Oekaki",
|
||||||
"
|
"
|
||||||
<b>Oekaki</b>
|
|
||||||
<br>
|
|
||||||
<form form enctype='multipart/form-data' action='".make_link("oekaki/create")."' method='POST'>
|
<form form enctype='multipart/form-data' action='".make_link("oekaki/create")."' method='POST'>
|
||||||
<div style='display: inline; margin: 0; width: auto;'>
|
<input autocomplete='off' style='width: auto;' name='oekW' type='text' size='3' value='".$oekW."'/>".
|
||||||
<input autocomplete='off' style='display: inline; margin: 0; width: auto; font-size: 90%' name='oekW' type='text' size='3' value='".$defOekW."'/>
|
"x".
|
||||||
x
|
"<input autocomplete='off' style='width: auto;' name='oekH' type='text' size='3' value='".$oekH."'/>".
|
||||||
<input autocomplete='off' style='display: inline; margin: 0; width: auto; font-size: 90%' name='oekH' type='text' size='3' value='".$defOekH."'/>
|
"<input autocomplete='off' type='submit' value='Create!' />
|
||||||
<input autocomplete='off' style='display: inline; margin: 0; width: auto; font-size: 90%' type='submit' value='Go!' />
|
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
"
|
"
|
||||||
, "left", 21)); // upload is 20
|
, "left", 21)); // upload is 20
|
||||||
|
Loading…
x
Reference in New Issue
Block a user