image replacing simplicity

This commit is contained in:
Shish 2012-07-28 11:12:05 +01:00
parent 8b83b90b53
commit ee52d582c4
2 changed files with 12 additions and 24 deletions

View File

@ -72,7 +72,7 @@ class ImageReplaceEvent extends Event {
* @param $image * @param $image
* The image object of the new image to use * The image object of the new image to use
*/ */
public function ImageReplaceEvent($id, Image $image) { public function ImageReplaceEvent(/*int*/ $id, Image $image) {
$this->id = $id; $this->id = $id;
$this->image = $image; $this->image = $image;
} }
@ -81,7 +81,7 @@ class ImageReplaceEvent extends Event {
class ImageReplaceException extends SCoreException { class ImageReplaceException extends SCoreException {
var $error; var $error;
public function __construct($error) { public function __construct(/*string*/ $error) {
$this->error = $error; $this->error = $error;
} }
} }

View File

@ -237,29 +237,18 @@ class UploadTheme extends Themelet {
global $config, $page; global $config, $page;
$tl_enabled = ($config->get_string("transload_engine", "none") != "none"); $tl_enabled = ($config->get_string("transload_engine", "none") != "none");
$js2 = 'javascript:$(function() { $upload_list = "
$("#data").hide();
$("#data").val("");
$("#url").show(); });';
$js1 = 'javascript:$(function() {
$("#url").hide();
$("#url").val("");
$("#data").show(); });';
$upload_list = '';
$upload_list .= "
<tr> <tr>
<td width='60'><form><input id='radio_button_a' type='radio' name='method' value='file' checked='checked' onclick='$js1' /> File<br>"; <td>File</td>
if($tl_enabled) { <td><input name='data' type='file'></td>
$upload_list .="
<input id='radio_button_b' type='radio' name='method' value='url' onclick='$js2' /> URL</ br></td></form>
<td><input id='data' name='data' class='wid' type='file'><input id='url' name='url' class='wid' type='text' style='display:none'></td>
"; ";
} else { if($tl_enabled) {
$upload_list .= "</form></td> $upload_list .="
"; <td>or URL</td>
} <td><input name='url' type='text'></td>
";
}
$upload_list .= "</tr>";
$max_size = $config->get_int('upload_size'); $max_size = $config->get_int('upload_size');
$max_kb = to_shorthand_int($max_size); $max_kb = to_shorthand_int($max_size);
@ -268,7 +257,6 @@ class UploadTheme extends Themelet {
$thumbnail = $this->build_thumb_html($image, null); $thumbnail = $this->build_thumb_html($image, null);
$html = " $html = "
<div style='clear:both;'></div>
<p>Replacing Image ID ".$image_id."<br>Please note: You will have to refresh the image page, or empty your browser cache.</p>" <p>Replacing Image ID ".$image_id."<br>Please note: You will have to refresh the image page, or empty your browser cache.</p>"
.$thumbnail."<br>" .$thumbnail."<br>"
.make_form(make_link("upload/replace/".$image_id), "POST", $multipart=True)." .make_form(make_link("upload/replace/".$image_id), "POST", $multipart=True)."