00001 <?php
00002
00011 class TKSnapMediaInteractivateEditor extends TKSnapEditor {
00021 protected function showEditor($cm, $failed) {
00022 $form = new TKForm();
00023 $table = $form->addTable();
00024 $table->addTextTo('header', 'Upload Applet', array('colspan' => 2, 'style' => array('font-size' => '1.4em')));
00025
00026 $table->addText("Applet Jar File", array('class' => array('snapInfoLabel')));
00027 $upload = $table->addFormInput('file', 'fileUpload');
00028 $table->addRow();
00029 $table->addText("Applet Class", array('class' => array('snapInfoLabel')));
00030 $table->addFormInput('text', 'appclass', $failed ? $_REQUEST['appclass'] : $cm->getAppClass());
00031 $table->addRow();
00032 $table->addText("Applet Width", array('class' => array('snapInfoLabel')));
00033 $table->addFormInput('text', 'width', $failed ? $_REQUEST['width'] : $cm->getWidth());
00034 $table->addRow();
00035 $table->addText("Applet Height", array('class' => array('snapInfoLabel')));
00036 $table->addFormInput('text', 'height', $failed ? $_REQUEST['height'] : $cm->getHeight());
00037 $upload->size = 40;
00038 $form->addText("<br />\n");
00039 $form->addFormInput('submit', 'snap2ed_save', "Submit");
00040 $form->addFormInput('submit', 'snap2ed_saveAndExit', "Save and Exit");
00041 $form->addFormInput('submit', 'snap2ed_exit', "Exit without Saving");
00042
00043 $this->add($form);
00044 }
00045
00054 protected function processSave($oldCM) {
00055 if(isset($_FILES['fileUpload'])) {
00056 $fileName = $_FILES['fileUpload']['name'];
00057 $tmpFile = $_FILES['fileUpload']['tmp_name'];
00058 }
00059 else
00060 $tmpFile = "";
00061
00062 $width = $_REQUEST['width'];
00063 $height = $_REQUEST['height'];
00064 $appclass = $_REQUEST['appclass'];
00065
00066 $cmNew = new SnapContentMediaInteractivateApplet($this->version);
00067
00068 if($tmpFile == "") {
00069 if($width != "") $stat = $cmNew->setWidth($oldCM, $width);
00070 if($height != "" && $stat) $stat = $cmNew->setHeight($oldCM, $height);
00071 if($appclass != "" && $stat) $stat = $cmNew->setAppClass($oldCM, $appclass);
00072 }
00073 else
00074 $stat = $cmNew->uploadApplet($tmpFile, $fileName, $appclass, $width, $height);
00075
00076 if(!$stat) {
00077 $cmNew->delete();
00078 $html = "<p><b>Error:<b/> Could not save applet: " . $cmNew->getLastError() . "</p>";
00079 $this->addText($html);
00080 return false;
00081 }
00082
00083 return $cmNew;
00084 }
00085 }
00086
00087 ?>