+++ /dev/null
-<?php\r
-/*==============================================================\r
- Photo Album\r
- ==============================================================\r
- Copyright (c) 2006 by Dylan Cheon & Kelvin Wong\r
- Institute for Assistive Technology / University of Victoria\r
- http://www.canassist.ca/ \r
- \r
- This program is free software. You can redistribute it and/or\r
- modify it under the terms of the GNU General Public License \r
- as published by the Free Software Foundation. \r
- ==============================================================\r
- */\r
-// $Id:\r
-\r
-/**\r
- * @desc This file generates the image file upload page\r
- * @author Dylan Cheon & Kelvin Wong\r
- * @copyright 2006, Institute for Assistive Technology / University of Victoria \r
- * @link http://www.canassist.ca/ \r
- * @license GNU\r
- */\r
- \r
-define('AT_INCLUDE_PATH', '../../../include/');\r
-require_once(AT_INCLUDE_PATH.'vitals.inc.php');\r
-$_custom_css = $_base_path . 'mods/photo_album/module.css'; // use a custom stylesheet\r
-require_once (AT_INCLUDE_PATH.'header.inc.php');\r
-\r
-?>\r
-\r
-<?php\r
- require_once ('../define.php');\r
- require_once ('../include/general_func.php');\r
- require_once ('../include/data_func.php');\r
- require_once ('../HTML/Template/ITX.php');\r
- \r
- $template= new HTML_Template_ITX("../Template");\r
- $template->loadTemplatefile("file_upload.tpl.php");\r
- $template->setVariable("JAVA_SRC", BASE_PATH.'handler/fat.js');\r
- \r
- /* mode add */ \r
- if ((($_POST['mode']=='add') && ($_POST['choose']==IMAGE)) || (($_SESSION['pa']['mode']=='add') && ($_SESSION['pa']['choose']==IMAGE))){ \r
- if (!isset($_POST['mode']) && ($_SESSION['pa']['mode']=='add')){\r
- $template->setVariable("FILE_FADE", "class=\"fade\"");\r
- }\r
- $template->setVariable("MESSAGE", _AT('pa_note_file_upload_add'));\r
- $template->setCurrentBlock("UPLOAD_PART");\r
- $template->setVariable("REQUIRED_SYMBOL", "<div class=\"required\">*</div>");\r
- $template->setVariable("FILE_LABEL", _AT('pa_label_file'));\r
- $template->setVariable("UPLOAD_FORM", "upload_form");\r
- $template->setVariable("UPLOAD_ACTION", ADD_ACTION);\r
- $template->setVariable("SUBMIT_MESSAGE", _AT('pa_button_upload_image'));\r
- \r
- if ($_SESSION['pa']['administrator_mode']==true){\r
- $action=ATUTOR_PREFIX.BASE_PATH.'admin_image_list.php';\r
- } else if ($_SESSION['pa']['instructor_mode']==true){\r
- $action=ATUTOR_PREFIX.BASE_PATH.'instructor_image.php';\r
- } else {\r
- $action=ATUTOR_PREFIX.BASE_PATH.'index.php';\r
- } \r
- \r
- $template->setVariable("CANCEL_STRING", _AT('cancel'));\r
- \r
- $template->parseCurrentBlock("UPLOAD_PART");\r
- $template->parseCurrentBlock();\r
- $template->show();\r
- $_SESSION['pa']['mode']='add';\r
- $_SESSION['pa']['choose']=IMAGE;\r
- \r
- /* mode edit */\r
- } else if ((($_POST['mode']=='edit') && ($_POST['choose']==IMAGE)) || (($_SESSION['pa']['mode']=='edit') && ($_SESSION['pa']['choose']==IMAGE))){\r
- if (($_POST['mode']=='edit') && ($_POST['choose']==IMAGE)){\r
- $auth=user_own(IMAGE, $_POST['image_id'], $_SESSION['pa']['course_id']);\r
- if (!$auth){\r
- $msg->addError('pa_user_image_not_allowed');\r
- redirect('view.php?image_id='.$_POST['image_id']);\r
- } else {\r
- $_SESSION['pa']['image_id']=intval($_POST['image_id']);\r
- }\r
- }\r
- if (!isset($_POST['mode']) && ($_SESSION['pa']['mode']=='edit')){\r
- $template->setVariable("FILE_FADE", "class=\"fade\"");\r
- } \r
- $template->setVariable("MESSAGE", _AT('pa_note_file_upload_edit'));\r
- $image_array=get_single_data(IMAGE, $_SESSION['pa']['image_id'], $_SESSION['pa']['course_id']);\r
- $template->setCurrentBlock("IMAGE_DISPLAY");\r
- $img_src=$get_file.$image_array['location'].urlencode($image_array['thumb_image_name']);\r
- $template->setVariable("IMAGE_SRC", $img_src);\r
- $template->setVariable("ALT", $image_array['alt']);\r
- $template->parseCurrentBlock("IMAGE_DISPLAY");\r
- \r
- $template->setCurrentBlock("UPLOAD_PART");\r
- $template->setVariable("FILE_LABEL", _AT('pa_label_file'));\r
- $template->setVariable("UPLOAD_FORM", "upload_form");\r
- $template->setVariable("UPLOAD_ACTION", EDIT_ACTION);\r
- $template->setVariable("SUBMIT_MESSAGE", _AT('pa_button_update_image'));\r
- \r
- //display image skip button\r
- $template->setCurrentBlock("SKIP_UPLOAD");\r
- $template->setVariable("SUBMIT_MESSAGE2", _AT('pa_button_skip_upload_image'));\r
- $template->parseCurrentBlock("SKIP_UPLOAD");\r
- \r
- $template->setVariable("CANCEL_STRING", _AT('cancel'));\r
- \r
- $template->parseCurrentBlock("UPLOAD_PART");\r
- $template->parseCurrentBlock();\r
- $template->show(); \r
- $_SESSION['pa']['mode']='edit';\r
- $_SESSION['pa']['choose']=IMAGE;\r
- \r
- } else {\r
- $msg->addError('pa_var_unauthorized');\r
- out();\r
- }\r
-?>\r
- \r
-<?php require_once(AT_INCLUDE_PATH.'footer.inc.php'); ?>
\ No newline at end of file