+++ /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 photo album thumbnail view\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
-\r
-// Save the order the images appear in GG\r
-//\r
-// If you want to have the image order saved each time an image is moved\r
-// use the POST['submit'] line in place of the POST['save'] line below\r
-// Note that using the POST['submit'] has the potential to increase network traffic\r
-// where the photo album is being used by many at the same time.\r
- \r
-//if(isset($_POST['submit'])){\r
-\r
-if(isset($_POST['save']) && $_POST['save']!=''){\r
- if ($_REQUEST['current_page_num'] == ''){\r
- $current_page = 1;\r
- } else {\r
- $current_page = intval($_REQUEST['current_page_num']);\r
- }\r
-\r
- foreach($_POST as $image_id => $image_order){\r
- $image_order = intval($image_order);\r
-\r
- $image_id = intval($image_id);\r
-\r
- //calculate the new image_order associated w/ the page\r
- $image_order = ($current_page - 1) * 10 + $image_order; //+1 because value starts from 0.\r
-\r
-\r
- //If this is an image, update its order in the database\r
- if ($image_id > 0) {\r
- $sql = "UPDATE ".TABLE_PREFIX."pa_image set `order`=$image_order WHERE `image_id` = $image_id";\r
- if($result = mysql_query($sql, $db)){\r
- $msg->addFeedback('PA_IMAGE_ORDER_SAVED');\r
- if ($current_page > 0){\r
- $_GET['current_page'] = $current_page;\r
- }\r
- }\r
- }\r
- }\r
-}\r
-require_once (AT_INCLUDE_PATH.'header.inc.php');\r
-\r
-// Set the path to Fluid, and call in the Fluid scripts. This path may change when/if the Fluid libraries become a part of the ATutor base code GG\r
-$FLUID_URL = 'mods/photo_album/fluid/component-templates'; ?>\r
- <script type="text/javascript" src="<?php echo $FLUID_URL; ?>/js/jquery/jquery-1.2.1.js"></script>\r
- <script type="text/javascript" src="<?php echo $FLUID_URL; ?>/js/jquery.tabindex/jquery.tabindex.js"></script>\r
- <script type="text/javascript" src="<?php echo $FLUID_URL; ?>/js/jquery.ui-1.0/ui.mouse.js"></script>\r
- <script type="text/javascript" src="<?php echo $FLUID_URL; ?>/js/jquery.ui-1.0/ui.draggable.js"></script>\r
- <script type="text/javascript" src="<?php echo $FLUID_URL; ?>/js/jquery.ui-1.0/ui.droppable.js"></script>\r
- <script type="text/javascript" src="<?php echo $FLUID_URL; ?>/js/fluid/Fluid.js"></script>\r
- <script type="text/javascript" src="<?php echo $FLUID_URL; ?>/js/fluid/Reorderer.js"></script>\r
- <script type="text/javascript" src="<?php echo $FLUID_URL; ?>/js/fluid/Lightbox.js"></script>\r
-\r
-<script type="text/javascript" language="javascript">\r
- jQuery.noConflict();\r
-</script>\r
-\r
-<?php\r
-/* This file is used to display the index page of photo album for everyone */\r
-require_once ('define.php');\r
-require_once ('classes/pa_index.class.php');\r
-require_once (PATH.'HTML/Template/ITX.php');\r
-clear_temp_folder();\r
-\r
-$index=new Pa_Index();\r
-unset($_SESSION['pa']);\r
-\r
-if ($index->isError()!=true){ //if there is no error in index object, display the index page\r
- $_SESSION['pa']['course_id']=$index->getVariable('course_id');\r
- \r
- /* display index page from here */\r
- $template=new HTML_Template_ITX(PATH."Template");\r
- $template->loadTemplatefile("index.tpl.php", true, true);\r
- \r
- /* display images */\r
- $template->setCurrentBlock("IMAGE_START");\r
- $template->setVariable("IMAGE_PAGE_TITLE", _AT('pa_title_index'));\r
- \r
- $template->setVariable("MAIN_URL", BASE_PATH.'index.php');\r
- $template->setVariable("MAIN_TITLE", _AT('pa_tag_course_photo_alt'));\r
- \r
- $template->setVariable("MY_PHOTO_URL", BASE_PATH.'my_photo.php');\r
- $template->setVariable("MY_PHOTO_TITLE", _AT('pa_tag_my_photo_alt'));\r
- \r
- $template->setVariable("MY_COMMENT_URL", BASE_PATH.'my_comment.php');\r
- $template->setVariable("MY_COMMENT_TITLE", _AT('pa_tag_my_comment_alt'));\r
-\r
- $template->setVariable("CURRENT_PAGE_NUM", $index->getVariable('current_page'));\r
- \r
- \r
- $image_array=$index->getVariable('image_array');\r
- for ($i=0; $i < count($image_array); $i++) {\r
- $template->setCurrentBlock("IMAGE_DISPLAY");\r
- $template->setVariable("IMAGE_ID",$image_array[$i]['image_id']);\r
- \r
- // the TABINDEX value is used to assign a unique value to each id when looping through each and rendering their presentation GG\r
- $template->setVariable("TABINDEX", $image_array[$i]['order']);\r
- $template->setVariable("LINK", $image_array[$i]['link']);\r
- $count=get_total_comment_number(STUDENT, $index->getVariable('course_id'), APPROVED, $image_array[$i]['image_id']);\r
- if ($count >0 ){\r
- $template->setVariable("IMAGE_TITLE", $image_array[$i]['title']." [".$count."]");\r
- } else {\r
- $template->setVariable("IMAGE_TITLE", $image_array[$i]['title']);\r
- }\r
- $template->setVariable("IMAGE_SRC", $get_file.$image_array[$i]['location'].urlencode($image_array[$i]['thumb_image_name']));\r
- $template->setVariable("IMAGE_ALT", $image_array[$i]['alt']);\r
- $template->parseCurrentBlock("IMAGE_DISPLAY");\r
- }\r
- \r
- if ($index->getVariable('show_modification_buttons')==true){\r
- $template->setCurrentBlock("IMAGE_ADD_BUTTON");\r
- $template->setVariable("FORM_NAME", "thumb_form");\r
- $template->setVariable("SAVE_FORM_NAME", "save_form");\r
- $template->setVariable("ACTION", UPLOAD_ACTION);\r
- $template->setVariable("SAVE_ACTION", $_SERVER['PHP_SELF']);\r
- $template->setVariable("ADD_STRING", _AT('pa_button_add_image'));\r
- //set the text for the save order button GG\r
- $template->setVariable("SAVE_STRING", _AT('pa_button_save_image_order'));\r
- $template->setVariable("CHOOSE_VALUE", IMAGE);\r
- $template->parseCurrentBlock("IMAGE_ADD_BUTTON");\r
- }\r
-\r
- /* Display page table */\r
- $page_array=&$index->getVariable('page_array');\r
- $current=$index->getVariable('current_page');\r
- if ($index->getVariable('show_page_left_buttons')==true){\r
- $first_button=_AT('pa_tag_first_page_button');\r
- $previous_button=_AT('pa_tag_previous_page_button');\r
- $template->setCurrentBlock("B_DATA_PART");\r
- $template->setVariable("B_DATA", '<li><a href=\''.BASE_PATH.'index.php?current_page=1\'><img src=\''.FIRST_PAGE_IMAGE.'\' alt=\''.$first_button.'\' width=\'30\' height=\'20\'/></a></li>');\r
- $template->parseCurrentBlock("B_DATA_PART");\r
- $template->setCurrentBlock("B_DATA_PART");\r
- $template->setVariable("B_DATA", '<li><a href=\''.BASE_PATH.'index.php?current_page='.($current-1).'\'><img src=\''.PRE_IMAGE.'\' alt=\''.$previous_button.'\' width=\'30\' height=\'20\'/></a></li>');\r
- $template->parseCurrentBlock("B_DATA_PART");\r
- }\r
- \r
- for ($i=$page_array['start']; $i<=$page_array['end']; $i++){\r
- if ($i==$current){\r
- $template->setCurrentBlock("B_DATA_PART");\r
- $template->setVariable("B_DATA", '<li class=\'current\'>'.$i.'</li>');\r
- $template->parseCurrentBlock("B_DATA_PART");\r
- } else {\r
- $template->setCurrentBlock("B_DATA_PART");\r
- $template->setVariable("B_DATA", '<li><a href=\''.BASE_PATH.'index.php?current_page='.$i.'\'>'.$i.'</a></li>');\r
- $template->parseCurrentBlock("B_DATA_PART");\r
- }\r
- }\r
- \r
- if ($index->getVariable('show_page_right_buttons')==true){\r
- $next_button=_AT('pa_tag_next_page_button');\r
- $last_button=_AT('pa_tag_last_page_button');\r
- $template->setCurrentBlock("B_DATA_PART");\r
- $template->setVariable("B_DATA", '<li><a href=\''.BASE_PATH.'index.php?current_page='.($current+1).'\'><img src=\''.NEXT_IMAGE.'\' alt=\''.$next_button.'\' width=\'30\' height=\'20\'/></a></li>');\r
- $template->parseCurrentBlock("B_DATA_PART");\r
- $template->setCurrentBlock("B_DATA_PART");\r
- $template->setVariable("B_DATA", '<li><a href=\''.BASE_PATH.'index.php?current_page='.$page_array['last_page'].'\'><img src=\''.LAST_PAGE_IMAGE.'\' alt=\''.$last_button.'\' width=\'30\' height=\'20\'/></a></li>');\r
- $template->parseCurrentBlock("B_DATA_PART");\r
- }\r
- \r
- $template->parseCurrentBlock("B_DATA_PART");\r
- $template->parseCurrentBlock("IMAGE_START");\r
- $template->parseCurrentBlock();\r
- $template->show();\r
-} else {\r
- $msg->addError('pa_obj_pa_index');\r
- redirect('../../index.php');\r
-}\r
-\r
-?>\r
- <!-- Init the Fluid lightbox -->\r
- <script type="text/javascript">\r
- fluid.initLightbox ("gallery:::gallery-thumbs:::", "message-bundle:");\r
- </script>\r
-\r
-\r
-<!-- HARRIS STARTS -->\r
-<script language="javascript" type="text/javascript">\r
- /** \r
- * We know the form, but things got reorganized, one thing we are certained is the DOM subtree ordering.\r
- * use that for our advantage.\r
- * @param the name of the form, that contains all these photos\r
- */\r
- function reordering_pa(form_name){\r
- //Quit if form_name isn't specified\r
- if (form_name==""){\r
- return;\r
- }\r
-\r
- //get form name\r
- var myForm = document.forms[form_name];\r
-\r
- //keep track of DOM order\r
- var count = 1;\r
-\r
- //loop through the new DOM tree and updates its associated values\r
- for (var i=0; i < myForm.elements.length; i++){\r
- // reassign values by DOM elements\r
- // TODO, maps the ID instead? \r
- var inputs = myForm.elements[i];\r
- if (inputs.id.indexOf('gallery:::gallery-thumbs:::lightbox-cell:') > -1){ \r
- inputs.value = count;\r
- count++;\r
- }\r
- }\r
- }\r
-</script>\r
-<!-- HARRIS ENDS -->\r
-\r
-\r
-<?php \r
-require_once(AT_INCLUDE_PATH.'footer.inc.php'); ?>\r