From: Steve Sutton Date: Fri, 27 Feb 2015 20:01:25 +0000 (-0500) Subject: Updating courses adding new file and filenames X-Git-Tag: v1.0.0^2~56 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=f205ca4a35c883bf9282695f1bfea87a3c3e6882;p=web%2FGaylordGolfMecca.git Updating courses adding new file and filenames --- diff --git a/Toolkit/Members/Admin/EditCourses.php b/Toolkit/Members/Admin/EditCourses.php index 356c315..4ca7438 100644 --- a/Toolkit/Members/Admin/EditCourses.php +++ b/Toolkit/Members/Admin/EditCourses.php @@ -458,6 +458,8 @@ class AddAdminCourse extends Toolkit_FormBuilder 'name' => 'image', 'display' => 'Upload a Course Photo / Image', ); + + /* Course File One */ $e[] = array( 'type' => 'checkbox', 'req' => false, @@ -481,12 +483,50 @@ class AddAdminCourse extends Toolkit_FormBuilder 'name' => 'file', 'display' => 'Upload a Course File', ); + $e[] = array( + 'type' => 'text', + 'req' => false, + 'name' => 'filename', + 'display' => 'File Name', + 'opts' => array('class' => 'text') + ); + /* Course File Two */ + $e[] = array( + 'type' => 'checkbox', + 'req' => false, + 'name' => 'remove_file2_rmv', + 'display' => 'Remove File 2', + ); + $e[] = array( + 'type' => 'static', + 'req' => false, + 'name' => 'curr_file2', + 'display' => 'Current File 2', + ); + $e[] = array( + 'type' => 'hidden', + 'req' => false, + 'name' => 'curr_file2_rmv', + ); + $e[] = array( + 'type' => 'file', + 'req' => false, + 'name' => 'file2', + 'display' => 'Upload a Course File 2', + ); + $e[] = array( + 'type' => 'text', + 'req' => false, + 'name' => 'file2name', + 'display' => 'File 2 Name', + 'opts' => array('class' => 'text') + ); + $e[] = array( 'type' => 'header', 'req' => false, 'name' => 'GolfingHdr', - 'display' => 'Golf Course Information', - //'col2' => true + 'display' => 'Golf Course Information' ); $e[] = array( 'type' => 'text', @@ -587,6 +627,15 @@ class AddAdminCourse extends Toolkit_FormBuilder 'reset' => false, 'force' => false ); + $r[] = array( + 'element' => 'file2_rmv', + 'message' => 'ERROR: Incorrect File Type (.pdf, .doc) only!', + 'type' => 'mimetype', + 'format' => $this->fileMimeTypes, + 'validation' => $this->validationType, + 'reset' => false, + 'force' => false + ); $this->setupRules($r); } @@ -712,14 +761,21 @@ class AddAdminCourse extends Toolkit_FormBuilder $values['pos'] = $courses->getListSize() + 1; $values['image'] = $e->getValue('curr_image_rmv'); + $e =& $this->getElement('curr_file_rmv'); $values['file'] = $e->getValue('curr_file_rmv'); + + $e =& $this->getElement('curr_file2_rmv'); + $values['file2'] = $e->getValue('curr_file2_rmv'); + $values['member_id'] = $_GET['id']; $values['pending'] = 0; unset($values['MAX_FILE_SIZE'], $values['curr_image_rmv'], $values['curr_file_rmv'], $values['remove_img_rmv'], + $values['curr_file2_rmv'], + $values['remove_file2_rmv'], $values['add_rmv']); //echo '
'.print_r($values, true).'
'; //exit; @@ -755,6 +811,7 @@ class AddAdminCourse extends Toolkit_FormBuilder $this->accept($renderer); $this->view = new stdClass(); $this->view->showCurrImg = $this->showCurrImg; + $this->view->showCurrFile2 = $this->showCurrFile2; $this->view->form = $renderer->toObject(); $tEngine->compile($this->formTemplate); } @@ -809,6 +866,24 @@ class AddAdminCourse extends Toolkit_FormBuilder $this->_submitValues['curr_image_rmv'] = null; } } + function removeOldFile($oldFile) + { + $this->deleteFile($oldFile); + if ($this->elementExists('curr_file_rmv')) { + $e =& $this->getElement('curr_file_rmv'); + $e->setValue(null); + $this->_submitValues['curr_file_rmv'] = null; + } + } + function removeOldFile2($oldFile) + { + $this->deleteFile($oldFile); + if ($this->elementExists('curr_file2_rmv')) { + $e =& $this->getElement('curr_file2_rmv'); + $e->setValue(null); + $this->_submitValues['curr_file2_rmv'] = null; + } + } // }}} // {{{ syncCurrImage() @@ -878,6 +953,32 @@ class AddAdminCourse extends Toolkit_FormBuilder $this->showCurrFile = true; } } + protected function syncCurrFile2() + { + $delFile2 = $this->getSubmitValue('remove_file2_rmv'); + $oldFile2 = $this->getSubmitValue('curr_file2_rmv'); + $newFile2 = $this->getSubmitValue('file2'); + + if ($delFile2 && $oldFile2) { + $this->removeOldFile2($oldFile2); + unset($oldFile2); + } elseif ($oldFile2 && $this->validNewFile($newFile2)) { + $this->removeOldFile2($oldFile2); + unset($oldFile2); + } + + if ($this->validNewFile($newFile2)) { + $fileData = $this->uploadFile('file2'); + $file = ($fileData['name']) ? $fileData['name']: null; + } else { + $file = $oldFile2; + } + + if ($file) { + $this->updateFile2Elements($file); + $this->showCurrFile2 = true; + } + } // {{{ toHtml() /** @@ -904,6 +1005,7 @@ class AddAdminCourse extends Toolkit_FormBuilder if ($this->isSubmitted()) { $this->syncCurrImage(); $this->syncCurrFile(); + $this->syncCurrFile2(); } $this->setupRenderers($tEngine); @@ -936,6 +1038,20 @@ class AddAdminCourse extends Toolkit_FormBuilder $e =& $this->getElement('curr_file_rmv'); $e->setValue($file); } + public function updateFile2Elements($file) + { + // Get the dimensions of the image + $s = MEMBER_ORIGINAL . $file; + + // Set the image to show in the element + $e =& $this->getElement('curr_file2'); + $e->setText(''); + + // updated the hidden elements value to make sure it + // holds the most up-to-date image name + $e =& $this->getElement('curr_file2_rmv'); + $e->setValue($file); + } /** * Short description for function * @@ -1179,6 +1295,12 @@ class EditAdminCourse extends Toolkit_FormBuilder $file = 'File'; $defaults['curr_file'] = sprintf($file, MEMBER_ORIGINAL . $defaults['file']); $this->showCurrFile = $defaults['file']; + + $defaults['curr_file2_rmv'] = $defaults['file2']; + $file2 = 'File 2'; + $defaults['curr_file2'] = sprintf($file2, MEMBER_ORIGINAL . $defaults['file2']); + $this->showCurrFile2 = $defaults['file2']; + $this->setupDefaults($defaults); } @@ -1235,6 +1357,8 @@ class EditAdminCourse extends Toolkit_FormBuilder 'name' => 'image', 'display' => 'Upload a Course Photo / Image', ); + + /* File One */ $e[] = array( 'type' => 'checkbox', 'req' => false, @@ -1258,6 +1382,45 @@ class EditAdminCourse extends Toolkit_FormBuilder 'name' => 'file', 'display' => 'Upload a Course File', ); + $e[] = array( + 'type' => 'text', + 'req' => false, + 'name' => 'filename', + 'display' => 'File Name', + 'opts' => array('class' => 'text') + ); + /* FileTwoOne */ + $e[] = array( + 'type' => 'checkbox', + 'req' => false, + 'name' => 'remove_file2_rmv', + 'display' => 'Remove File 2', + ); + $e[] = array( + 'type' => 'static', + 'req' => false, + 'name' => 'curr_file2', + 'display' => 'Current File 2', + ); + $e[] = array( + 'type' => 'hidden', + 'req' => false, + 'name' => 'curr_file2_rmv', + ); + $e[] = array( + 'type' => 'file', + 'req' => false, + 'name' => 'file2', + 'display' => 'Upload a Course File 2', + ); + $e[] = array( + 'type' => 'text', + 'req' => false, + 'name' => 'file2name', + 'display' => 'File 2 Name', + 'opts' => array('class' => 'text') + ); + $e[] = array( 'type' => 'text', 'req' => false, @@ -1364,6 +1527,15 @@ class EditAdminCourse extends Toolkit_FormBuilder 'reset' => false, 'force' => false ); + $r[] = array( + 'element' => 'file2_rmv', + 'message' => 'ERROR: Incorrect File Type (.pdf, .doc) only!', + 'type' => 'mimetype', + 'format' => $this->fileMimeTypes, + 'validation' => $this->validationType, + 'reset' => false, + 'force' => false + ); $this->setupRules($r); } @@ -1455,12 +1627,17 @@ class EditAdminCourse extends Toolkit_FormBuilder $e =& $this->getElement('curr_file_rmv'); $values['file'] = $e->getValue('curr_file_rmv'); + $e =& $this->getElement('curr_file2_rmv'); + $values['file2'] = $e->getValue('curr_file2_rmv'); + unset( $values['MAX_FILE_SIZE'], $values['curr_image_rmv'], $values['remove_img_rmv'], $values['curr_file_rmv'], $values['remove_file_rmv'], + $values['curr_file2_rmv'], + $values['remove_file2_rmv'], $values['add_rmv'] ); @@ -1495,12 +1672,13 @@ class EditAdminCourse extends Toolkit_FormBuilder $renderer = new HTML_QuickForm_Renderer_ObjectFlexy($tEngine); $this->accept($renderer); - $this->view = new stdClass(); - $this->view->courseId = $this->courseId; - $this->view->courseName = $this->courseName; - $this->view->showCurrImg = $this->showCurrImg; - $this->view->showCurrFile = $this->showCurrFile; - $this->view->form = $renderer->toObject(); + $this->view = new stdClass(); + $this->view->courseId = $this->courseId; + $this->view->courseName = $this->courseName; + $this->view->showCurrImg = $this->showCurrImg; + $this->view->showCurrFile = $this->showCurrFile; + $this->view->showCurrFile2 = $this->showCurrFile2; + $this->view->form = $renderer->toObject(); $tEngine->compile($this->formTemplate); } @@ -1556,7 +1734,7 @@ class EditAdminCourse extends Toolkit_FormBuilder } // }}} - function removeOldFile(Toolkit_Image_Server $is, $oldFile) + function removeOldFile($oldFile) { $this->deleteFile($oldFile); if ($this->elementExists('curr_file_rmv')) { @@ -1565,6 +1743,15 @@ class EditAdminCourse extends Toolkit_FormBuilder $this->_submitValues['curr_file_rmv'] = null; } } + function removeOldFile2($oldFile) + { + $this->deleteFile($oldFile); + if ($this->elementExists('curr_file2_rmv')) { + $e =& $this->getElement('curr_file2_rmv'); + $e->setValue(null); + $this->_submitValues['curr_file2_rmv'] = null; + } + } // {{{ syncCurrImage() /** @@ -1615,17 +1802,15 @@ class EditAdminCourse extends Toolkit_FormBuilder */ protected function syncCurrFile() { - $is = new Toolkit_Image_Server(); - $delFile = $this->getSubmitValue('remove_file_rmv'); $oldFile = $this->getSubmitValue('curr_file_rmv'); $newFile = $this->getSubmitValue('file'); if ($delFile && $oldFile) { - $this->removeOldFile($is, $oldFile); + $this->removeOldFile($oldFile); unset($oldFile); } elseif ($oldFile && $this->validNewFile($newFile)) { - $this->removeOldFile($is, $oldFile); + $this->removeOldFile($oldFile); unset($oldFile); } @@ -1641,6 +1826,32 @@ class EditAdminCourse extends Toolkit_FormBuilder $this->showCurrFile = true; } } + protected function syncCurrFile2() + { + $delFile2 = $this->getSubmitValue('remove_file2_rmv'); + $oldFile2 = $this->getSubmitValue('curr_file2_rmv'); + $newFile2 = $this->getSubmitValue('file2'); + + if ($delFile2 && $oldFile2) { + $this->removeOldFile2($oldFile2); + unset($oldFile2); + } elseif ($oldFile2 && $this->validNewFile($newFile2)) { + $this->removeOldFile2($oldFile2); + unset($oldFile2); + } + + if ($this->validNewFile($newFile2)) { + $fileData = $this->uploadFile('file2'); + $file = ($fileData['name']) ? $fileData['name']: null; + } else { + $file = $oldFile2; + } + + if ($file) { + $this->updateFile2Elements($file); + $this->showCurrFile2 = true; + } + } // {{{ toHtml() /** @@ -1667,6 +1878,7 @@ class EditAdminCourse extends Toolkit_FormBuilder if ($this->isSubmitted()) { $this->syncCurrImage(); $this->syncCurrFile(); + $this->syncCurrFile2(); } $this->setupRenderers($tEngine); @@ -1796,6 +2008,20 @@ class EditAdminCourse extends Toolkit_FormBuilder $e =& $this->getElement('curr_file_rmv'); $e->setValue($file); } + public function updateFile2Elements($file) + { + // Get the dimensions of the image + $s = MEMBER_ORIGINAL . $file; + + // Set the image to show in the element + $e =& $this->getElement('curr_file2'); + $e->setText(''); + + // updated the hidden elements value to make sure it + // holds the most up-to-date image name + $e =& $this->getElement('curr_file2_rmv'); + $e->setValue($file); + } // {{{ uploadImage() /** diff --git a/Toolkit/Members/EditCourses.php b/Toolkit/Members/EditCourses.php index 5dece66..81fa86f 100644 --- a/Toolkit/Members/EditCourses.php +++ b/Toolkit/Members/EditCourses.php @@ -448,12 +448,50 @@ class AddCourse extends Toolkit_FormBuilder 'name' => 'file', 'display' => 'Upload a Course File', ); + $e[] = array( + 'type' => 'text', + 'req' => false, + 'name' => 'filename', + 'display' => 'File Name', + 'opts' => array('class' => 'text') + ); + /* Course File Two */ + $e[] = array( + 'type' => 'checkbox', + 'req' => false, + 'name' => 'remove_file2_rmv', + 'display' => 'Remove File 2', + ); + $e[] = array( + 'type' => 'static', + 'req' => false, + 'name' => 'curr_file2', + 'display' => 'Current File 2', + ); + $e[] = array( + 'type' => 'hidden', + 'req' => false, + 'name' => 'curr_file2_rmv', + ); + $e[] = array( + 'type' => 'file', + 'req' => false, + 'name' => 'file2', + 'display' => 'Upload a Course File 2', + ); + $e[] = array( + 'type' => 'text', + 'req' => false, + 'name' => 'file2name', + 'display' => 'File 2 Name', + 'opts' => array('class' => 'text') + ); + $e[] = array( 'type' => 'header', 'req' => false, 'name' => 'GolfingHdr', - 'display' => 'Golf Course Information', - //'col2' => true + 'display' => 'Golf Course Information' ); $e[] = array( 'type' => 'text', @@ -554,6 +592,15 @@ class AddCourse extends Toolkit_FormBuilder 'reset' => false, 'force' => false ); + $r[] = array( + 'element' => 'file2_rmv', + 'message' => 'ERROR: Incorrect File Type (.pdf, .doc) only!', + 'type' => 'mimetype', + 'format' => $this->fileMimeTypes, + 'validation' => $this->validationType, + 'reset' => false, + 'force' => false + ); $this->setupRules($r); } @@ -837,15 +884,24 @@ class AddCourse extends Toolkit_FormBuilder $courses = new Toolkit_Members_Courses(null, $id); $courses->setDbh($this->dbh); $courses->createMemberList(); + + $values['pos'] = $courses->getListSize() + 1; $values['image'] = $e->getValue('curr_image_rmv'); + $e =& $this->getElement('curr_file_rmv'); $values['file'] = $e->getValue('curr_file_rmv'); + + $e =& $this->getElement('curr_file2_rmv'); + $values['file2'] = $e->getValue('curr_file2_rmv'); + $values['member_id'] = $GLOBALS['memberAuth']->getAuthData('member_id'); unset($values['MAX_FILE_SIZE'], $values['curr_image_rmv'], $values['curr_file_rmv'], $values['remove_img_rmv'], + $values['curr_file2_rmv'], + $values['remove_file2_rmv'], $values['add_rmv']); $this->tableMetaData = Toolkit_Common::getTableMetaData( @@ -881,6 +937,7 @@ class AddCourse extends Toolkit_FormBuilder $this->accept($renderer); $this->view = new StdClass; $this->view->showCurrImg = $this->showCurrImg; + $this->view->showCurrFile2 = $this->showCurrFile2; $this->view->form = $renderer->toObject(); $this->template->compile($this->formTemplate); } @@ -937,7 +994,24 @@ class AddCourse extends Toolkit_FormBuilder $this->_submitValues['curr_image_rmv'] = null; } } - + function removeOldFile($oldFile) + { + $this->deleteFile($oldFile); + if ($this->elementExists('curr_file_rmv')) { + $e =& $this->getElement('curr_file_rmv'); + $e->setValue(null); + $this->_submitValues['curr_file_rmv'] = null; + } + } + function removeOldFile2($oldFile) + { + $this->deleteFile($oldFile); + if ($this->elementExists('curr_file2_rmv')) { + $e =& $this->getElement('curr_file2_rmv'); + $e->setValue(null); + $this->_submitValues['curr_file2_rmv'] = null; + } + } // }}} // {{{ syncCurrImage() @@ -1007,6 +1081,32 @@ class AddCourse extends Toolkit_FormBuilder $this->showCurrFile = true; } } + protected function syncCurrFile2() + { + $delFile2 = $this->getSubmitValue('remove_file2_rmv'); + $oldFile2 = $this->getSubmitValue('curr_file2_rmv'); + $newFile2 = $this->getSubmitValue('file2'); + + if ($delFile2 && $oldFile2) { + $this->removeOldFile2($oldFile2); + unset($oldFile2); + } elseif ($oldFile2 && $this->validNewFile($newFile2)) { + $this->removeOldFile2($oldFile2); + unset($oldFile2); + } + + if ($this->validNewFile($newFile2)) { + $fileData = $this->uploadFile('file2'); + $file = ($fileData['name']) ? $fileData['name']: null; + } else { + $file = $oldFile2; + } + + if ($file) { + $this->updateFile2Elements($file); + $this->showCurrFile2 = true; + } + } // {{{ toHtml() /** @@ -1031,6 +1131,7 @@ class AddCourse extends Toolkit_FormBuilder if ($this->isSubmitted()) { $this->syncCurrImage(); $this->syncCurrFile(); + $this->syncCurrFile2(); } $this->setupRenderers(); @@ -1063,6 +1164,20 @@ class AddCourse extends Toolkit_FormBuilder $e =& $this->getElement('curr_file_rmv'); $e->setValue($file); } + public function updateFile2Elements($file) + { + // Get the dimensions of the image + $s = MEMBER_ORIGINAL . $file; + + // Set the image to show in the element + $e =& $this->getElement('curr_file2'); + $e->setText(''); + + // updated the hidden elements value to make sure it + // holds the most up-to-date image name + $e =& $this->getElement('curr_file2_rmv'); + $e->setValue($file); + } /** * Short description for function * @@ -1177,6 +1292,7 @@ class EditCourse extends Toolkit_FormBuilder * @access protected */ protected $courseId; + protected $courseName; /** * Description for protected @@ -1331,6 +1447,12 @@ class EditCourse extends Toolkit_FormBuilder $file = 'File'; $defaults['curr_file'] = sprintf($file, MEMBER_ORIGINAL . $defaults['file']); $this->showCurrFile = $defaults['file']; + + $defaults['curr_file2_rmv'] = $defaults['file2']; + $file2 = 'File 2'; + $defaults['curr_file2'] = sprintf($file2, MEMBER_ORIGINAL . $defaults['file2']); + $this->showCurrFile2 = $defaults['file2']; + $this->setupDefaults($defaults); } @@ -1387,6 +1509,8 @@ class EditCourse extends Toolkit_FormBuilder 'name' => 'image', 'display' => 'Upload a Course Photo / Image', ); + + /* File One */ $e[] = array( 'type' => 'checkbox', 'req' => false, @@ -1410,6 +1534,45 @@ class EditCourse extends Toolkit_FormBuilder 'name' => 'file', 'display' => 'Upload a Course File', ); + $e[] = array( + 'type' => 'text', + 'req' => false, + 'name' => 'filename', + 'display' => 'File Name', + 'opts' => array('class' => 'text') + ); + /* FileTwoOne */ + $e[] = array( + 'type' => 'checkbox', + 'req' => false, + 'name' => 'remove_file2_rmv', + 'display' => 'Remove File 2', + ); + $e[] = array( + 'type' => 'static', + 'req' => false, + 'name' => 'curr_file2', + 'display' => 'Current File 2', + ); + $e[] = array( + 'type' => 'hidden', + 'req' => false, + 'name' => 'curr_file2_rmv', + ); + $e[] = array( + 'type' => 'file', + 'req' => false, + 'name' => 'file2', + 'display' => 'Upload a Course File 2', + ); + $e[] = array( + 'type' => 'text', + 'req' => false, + 'name' => 'file2name', + 'display' => 'File 2 Name', + 'opts' => array('class' => 'text') + ); + $e[] = array( 'type' => 'text', 'req' => false, @@ -1516,6 +1679,15 @@ class EditCourse extends Toolkit_FormBuilder 'reset' => false, 'force' => false ); + $r[] = array( + 'element' => 'file2_rmv', + 'message' => 'ERROR: Incorrect File Type (.pdf, .doc) only!', + 'type' => 'mimetype', + 'format' => $this->fileMimeTypes, + 'validation' => $this->validationType, + 'reset' => false, + 'force' => false + ); $this->setupRules($r); } @@ -1797,8 +1969,10 @@ class EditCourse extends Toolkit_FormBuilder $this->accept($renderer); $this->view = new StdClass; $this->view->courseId = $this->courseId; + $this->view->courseName = $this->courseName; $this->view->showCurrImg = $this->showCurrImg; $this->view->showCurrFile = $this->showCurrFile; + $this->view->showCurrFile2 = $this->showCurrFile2; $this->view->form = $renderer->toObject(); $this->template->compile($this->formTemplate); } @@ -1856,7 +2030,7 @@ class EditCourse extends Toolkit_FormBuilder } // }}} - function removeOldFile(Toolkit_Image_Server $is, $oldFile) + function removeOldFile($oldFile) { $this->deleteFile($oldFile); if ($this->elementExists('curr_file_rmv')) { @@ -1865,6 +2039,15 @@ class EditCourse extends Toolkit_FormBuilder $this->_submitValues['curr_file_rmv'] = null; } } + function removeOldFile2($oldFile) + { + $this->deleteFile($oldFile); + if ($this->elementExists('curr_file2_rmv')) { + $e =& $this->getElement('curr_file2_rmv'); + $e->setValue(null); + $this->_submitValues['curr_file2_rmv'] = null; + } + } /** @@ -1915,17 +2098,15 @@ class EditCourse extends Toolkit_FormBuilder */ protected function syncCurrFile() { - $is = new Toolkit_Image_Server(); - $delFile = $this->getSubmitValue('remove_file_rmv'); $oldFile = $this->getSubmitValue('curr_file_rmv'); $newFile = $this->getSubmitValue('file'); if ($delFile && $oldFile) { - $this->removeOldFile($is, $oldFile); + $this->removeOldFile($oldFile); unset($oldFile); } elseif ($oldFile && $this->validNewFile($newFile)) { - $this->removeOldFile($is, $oldFile); + $this->removeOldFile($oldFile); unset($oldFile); } @@ -1941,6 +2122,32 @@ class EditCourse extends Toolkit_FormBuilder $this->showCurrFile = true; } } + protected function syncCurrFile2() + { + $delFile2 = $this->getSubmitValue('remove_file2_rmv'); + $oldFile2 = $this->getSubmitValue('curr_file2_rmv'); + $newFile2 = $this->getSubmitValue('file2'); + + if ($delFile2 && $oldFile2) { + $this->removeOldFile2($oldFile2); + unset($oldFile2); + } elseif ($oldFile2 && $this->validNewFile($newFile2)) { + $this->removeOldFile2($oldFile2); + unset($oldFile2); + } + + if ($this->validNewFile($newFile2)) { + $fileData = $this->uploadFile('file2'); + $file = ($fileData['name']) ? $fileData['name']: null; + } else { + $file = $oldFile2; + } + + if ($file) { + $this->updateFile2Elements($file); + $this->showCurrFile2 = true; + } + } // {{{ toHtml() /** @@ -1965,6 +2172,7 @@ class EditCourse extends Toolkit_FormBuilder if ($this->isSubmitted()) { $this->syncCurrImage(); $this->syncCurrFile(); + $this->syncCurrFile2(); } $this->setupRenderers(); @@ -2133,7 +2341,20 @@ class EditCourse extends Toolkit_FormBuilder $e =& $this->getElement('curr_file_rmv'); $e->setValue($file); } + public function updateFile2Elements($file) + { // {{{ uploadImage() + $s = MEMBER_ORIGINAL . $file; + + // Set the image to show in the element + $e =& $this->getElement('curr_file2'); + $e->setText(''); + + // updated the hidden elements value to make sure it + // holds the most up-to-date image name + $e =& $this->getElement('curr_file2_rmv'); + $e->setValue($file); + } /** diff --git a/Toolkit/Members/templates/addCourse.tpl b/Toolkit/Members/templates/addCourse.tpl index 748e9b9..5bccc54 100644 --- a/Toolkit/Members/templates/addCourse.tpl +++ b/Toolkit/Members/templates/addCourse.tpl @@ -85,7 +85,30 @@ {form.file.error:h} {form.file.html:h} + {form.filename.label:h} +
{form.filename.error:h}
+ {form.filename.html:h} +
+
+ + + {form.curr_file2.label:h} + {form.curr_file2.html:h} +
+ {form.file2.label:h} +
+ {form.file2.error:h} +
+ {form.file2.html:h} + + {form.file2name.label:h} +
{form.file2name.error:h}
+ {form.file2name.html:h} +
{form.add_rmv.html:h}
diff --git a/Toolkit/Members/templates/editCourse.tpl b/Toolkit/Members/templates/editCourse.tpl index 3575ce5..05b0fce 100644 --- a/Toolkit/Members/templates/editCourse.tpl +++ b/Toolkit/Members/templates/editCourse.tpl @@ -98,6 +98,29 @@ {form.file.error:h} {form.file.html:h} + {form.filename.label:h} +
{form.filename.error:h}
+ {form.filename.html:h} + +
+
+ + + {form.curr_file2.label:h} + {form.curr_file2.html:h} +
+ {form.file2.label:h} +
+ {form.file2.error:h} +
+ {form.file2.html:h} + + {form.file2name.label:h} +
{form.file2name.error:h}
+ {form.file2name.html:h}
{form.add_rmv.html:h}