+++ /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 add image / comment 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
- define('PATH', '../');\r
- require_once (PATH.'define.php');\r
- require_once (PATH.'include/data_func.php');\r
- require_once (PATH.'include/general_func.php');\r
- require_once (PATH.'classes/image_upload.class.php');\r
- require_once (PATH.'HTML/Template/ITX.php');\r
- \r
- $template= new HTML_Template_ITX("../Template");\r
- $template->loadTemplatefile("form.tpl.php");\r
- $template->setVariable("JAVA_SRC", BASE_PATH.'handler/fat.js');\r
- \r
- if (isset($_POST['cancel_image'])){\r
- if ($_SESSION['pa']['administrator_mode']==true){\r
- $action='admin_image_list.php';\r
- } else if ($_SESSION['pa']['instructor_mode']==true){\r
- $action='instructor_image.php';\r
- } else {\r
- $action='index.php';\r
- }\r
- redirect($action);\r
- } else if ((isset($_POST['upload_image']) || ($_SESSION['pa']['image_uploaded']==true)) && ($_SESSION['pa']['mode']=='add')){ /* mode add */\r
- if (isset($_POST['upload_image'])){ //initial add\r
- $temp_folder=make_temp_folder();\r
- $upload=new IMAGE_UPLOAD($_FILES['input_file'], $temp_folder);\r
- if ($upload->isError()){ //check fatal error is occured or not\r
- $msg->addError('pa_obj_image_upload');\r
- out();\r
- } else if ($upload->getVariable('user_input_error')!=0){ //user error is occured.\r
- $error_array=$upload->getVariable('user_input_array'); \r
- $msg->addError('pa_user_'.$error_array[0]);\r
- redirect('handler/file_upload.php');\r
- } else { //no error is found\r
- $_SESSION['pa']['thumb_image_name']=$upload->getVariable('thumb_image_name');\r
- $_SESSION['pa']['view_image_name']=$upload->getVariable('view_image_name');\r
- $_SESSION['pa']['image_uploaded']=true;\r
- $_SESSION['pa']['temp_folder']=$temp_folder;\r
- }\r
- }\r
- \r
- if ($_SESSION['pa']['error']['title']==true){\r
- $title_fade="class=\"fade\"";\r
- unset($_SESSION['pa']['error']['title']);\r
- }\r
- if ($_SESSION['pa']['error']['alt']==true){\r
- $alt_fade="class=\"fade\"";\r
- unset($_SESSION['pa']['error']['alt']);\r
- }\r
- \r
- /* Now, display the form */\r
- \r
- $template->setCurrentBlock("IMAGE_DISPLAY");\r
- $template->setVariable("IMAGE_SRC", $get_file.$_SESSION['pa']['temp_folder'].urlencode($_SESSION['pa']['thumb_image_name']));\r
- $template->setVariable("ALT", _AT('pa_tag_image_add_alt'));\r
- \r
- $template->setCurrentBlock("INPUT_PART");\r
- $template->setVariable("MESSAGE", _AT('pa_note_image_info_add'));\r
- $template->setVariable("TEXT_FORM", "text_form");\r
- $template->setVariable("TEXT_ACTION", STORE_ACTION);\r
- $template->setVariable("TITLE_MESSAGE", _AT('pa_label_pic_title'));\r
- $template->setVariable("TITLE_FADE", $title_fade);\r
- $template->setVariable("TITLE_VALUE", $_SESSION['pa']['title']);\r
- $template->setVariable("DESC_MESSAGE", _AT('pa_label_pic_description'));\r
- $template->setVariable("DESC_VALUE", $_SESSION['pa']['description']);\r
- if (is_admin_for_course()){\r
- $template->setCurrentBlock("ALT_PART");\r
- $template->setVariable("ALT_MESSAGE", _AT('pa_label_pic_alt'));\r
- $template->setVariable("ALT_FADE", $alt_fade);\r
- $template->setVariable("ALT_VALUE", $_SESSION['pa']['alt']);\r
- $template->parseCurrentBlock("ALT_PART");\r
- } \r
- $template->setVariable("SUBMIT_MESSAGE", _AT('pa_button_upload_image_info'));\r
- \r
- $template->setVariable("CANCEL_STRING", _AT('cancel'));\r
- \r
- $template->parseCurrentBlock("IMAGE_DISPLAY");\r
- $template->parseCurrentBlock();\r
- $template->show();\r
- \r
- /* mode add for comment */\r
- } else if ((($_POST['mode']=='add') && ($_POST['choose']==COMMENT)) || (($_SESSION['pa']['mode']=='add') && ($_SESSION['pa']['choose']==COMMENT))){\r
- $template->setVariable("TITLE", _AT('pa_title_comment_add'));\r
- $_SESSION['pa']['choose']=COMMENT;\r
- $_SESSION['pa']['mode']='add';\r
- if ($_SESSION['pa']['error']['comment']==true){\r
- $fade="fade";\r
- }\r
- $template->setCurrentBlock("COMMENT");\r
- $template->setVariable("COMMENT_MESSAGE", _AT('pa_note_comment_add'));\r
- $template->setVariable("COMMENT_LABEL", _AT('pa_label_comment_textarea'));\r
- $template->setVariable("COMMENT_FORM", "comment_form");\r
- $template->setVariable("COMMENT_ACTION", STORE_ACTION);\r
- $template->setVariable("COMMENT_FADE", $fade);\r
- $template->setVariable("SUBMIT_VALUE", _AT('pa_button_upload_comment'));\r
- \r
- $template->setVariable("CANCEL_STRING", _AT('cancel'));\r
- \r
- $template->parseCurrentBlock("COMMENT");\r
- $template->parseCurrentBlock();\r
- $template->show();\r
- } else { //invalid way of entrance\r
- $msg->addError('pa_var_unauthorized');\r
- out();\r
- }\r
-\r
-?>\r
-\r
-<?php require_once(AT_INCLUDE_PATH.'footer.inc.php'); ?>
\ No newline at end of file