Location: PHPKode > projects > Epiware Document Management > Epiware_4.8.6/epi/image_gallery_categories.php
<?
/******************************************************************************
Epiware: Project and Document Management
http://www.epiware.com
Copyright (C) 2006 James Kern

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. 

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. 

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Epiware, Inc. and Praxis Inc, hereby disclaims all copyright
interest in the program 'Epiware' written
by James Kern, Edward Kline, Ryan Gilfether, Ray Gorospe, Patrick Waddingham

06 September 2006
James Kern, President of Epiware 
Jack Chapman, President of Praxis
*****************************************************************************/ 
require_once("./module_prepend.php");   
$epi_translator->language_check(__FILE__,$db);   
require_once("./epi_prepend.php");   
//This draws the MENU widht TAB postion highlighted
define("TAB_SELECTED","IMAGE");
require_once("./mrc_header.php");    
require_once("./image_gallery_functions.inc.php");
require_once("./html_functions.inc.php");
require_once("./image_functions.inc.php");

//create required objects for page
$db = new DB();
$crypt = new EPI_crypt();
//require_once("./decrypt_param.inc");


//get the user_id and group_id
//$user_id = $crypt->WEB_decrypt($enc_user_id);
//$group_id = $crypt->WEB_decrypt($enc_group_id);
  
     $message = "Expired Session";
     $message = urlencode($message);



   if($user_id == "") {        
       header("Location: expired.php?message=$message"); 
       exit;
   }

  if(PROGRAM_MANAGER == 1) {
	require("./role_set.php");
    $role_set = new role_set($db,$user_id);
  }

$referal_url = "./image_gallery_main.php";

$group_name = get_group_name($group_id,$db);

$selected[] = $group_name;

?>

<div id="content" style="width:900px;">
<div id="page-content">
<div id="page-formatted" style="width:745px;">
 
<?
$site_map_array = array(1 => "<a href=\"index_resources.php\">Resources</a>",2=> "Image Gallery");
site_map::draw($site_map_array);


//build tabs
 	if(empty($show_sub))
	{
		$open_id = -1;			 	
	}
	if($open_id < 1)
	{
		$y_enc_category_id = $crypt->WEB_encrypt(0);
	}
	else
	{
			$y_enc_category_id = $crypt->WEB_encrypt($open_id);
	}
	$y_enc_start_id = $crypt->WEB_encrypt(0);
  //make the hyperlinks for the two tabs
  $tparams = "&open_id=$open_id&s_image_id=$s_image_id&show_sub=$show_sub&keywords=$keywords";
  $thref = create_url("./image_gallery_main.php",$tparams);
  if($keywords == "")
  {
		$params = "&x_category_id=".$y_enc_category_id."&x_start=".$y_enc_start_id."";
		$href = create_url("./images_main.php",$params);
  }
  else
  {
	  	$params = "&x_category_id=".$y_enc_category_id."&x_start=".$y_enc_start_id."&x_keywords=$keywords";
		$href = create_url("./images_main.php",$params);
  }
  $uparams = "&source=$source&".$tparams;
  
  $uhref = create_url("./image_gallery_upload.php",$uparams);
  $ehref = create_url("./image_gallery_categories.php",$tparams);


  $title_txt = epi_translate("View by Titles",__FILE__,$db);
  $thumb_txt = epi_translate("View by Thumbnail",__FILE__,$db);
  $upload_txt = epi_translate("Upload Image",__FILE__,$db);
  $edit_txt = epi_translate("Edit Categories",__FILE__,$db);

  $tab["titles"] = new menu_tab($title_txt,$thref);
  $tab["thumbs"] = new menu_tab($thumb_txt,$href);
  $tab["upload"] = new menu_tab($upload_txt,$uhref);
  $tab["categories"] = new menu_tab($edit_txt,$ehref);
  $tab["categories"]->selected = true;

/*
$epi_html_helper->begin_html_page(&$priv,&$epi_translator);
echo "<div align=center> "; 
$epi_menu = new epiware_project_menu($group_id,$db); 
if(!$epi_menu->add_sub_menu_by_name("epi_custom_modules",$db,false,$group_id))
{
	//put in the custom module menu
	$menu = new sys_menus();
	$menu->menu_name = "epi_custom_modules";
	$menu->menu_id = 0;
	$menu->use_under_bar = "y";
	$menu->insert($db,false);
	$epi_menu->add_sub_menu_by_name("epi_custom_modules",$db,false,$group_id);
}//end of if th custom menu is not there
//get the title bar across the top of the page 
// W is withour page...
 draw_module_title($group_id,$user_id,$is_root,$is_admin,&$db,"image_gallery_main.php","S");
//,$mode="S",$width=625)
//last two parameteres are default here
//draw the main epiware menu, passing the module(tab) name 
//that is selected so that it will be highlighted 
$epi_menu->align = "left"; 
$have_form = $epi_menu->draw($db,"epi_images"); 
*/



?> 



<script language="Javascript">

function grab(source,destination,display)
{
	if(source.options[source.selectedIndex].value != source.options[0].value)
	{
		destination.value = source.options[source.selectedIndex].value;	
		display.value = source.options[source.selectedIndex].text;
	}
}
function confirm_form(type)
{
	if(type==2)
	{
		if(confirm("Are you sure you want to delete this image category?"))
		{	
			document.cat_form.update.value = "Delete";
			document.cat_form.submit();
		}
	}
	else if(type==3)
	{
		document.cat_form.update.value = "Add New Category";
		document.cat_form.submit();
	}
	else if(type==1)
	{
		document.cat_form.update.value = "Update";
		document.cat_form.submit();
	}
}
</script>
 
 

<?
  
?> <form name="cat_form" action="image_gallery_category_update.php" method="post">
	<table width=625 border=0 cellpadding=0 cellspacing=0>	
		<tr>
			<td width=625 align=left>
				<table border=0 cellpadding=0 cellspacing=0>
					<tr><td width=15>&nbsp;</td>

<?		
						$tab["titles"]->draw();
						$tab["thumbs"]->draw();
						$tab["upload"]->draw();
						if($is_admin || defined("IMAGE_ACCESS"))
						{
						 	$tab["categories"]->draw();
						}
?>
					</tr>
				</table>
			</td>
		</tr>
	</table>


 	<div style=width:650px>
		<div class="roundcont">
			<div class="roundtop"><img src="images/tl_bl.gif" alt="" width="15" height="15" class="corner" style="display: none"></div>
			<div class="contentHeader">Categories</div>			

				</b></font>
<?				 //print $old_enc_param;
					print "<input type=\"hidden\" name=\"source\" value=\"$source\">";
					print "<input type=\"hidden\" name=\"open_id\" value=\"$open_id\">";
					print "<input type=\"hidden\" name=\"s_image_id\" value=\"$s_image_id\">";
					print "<input type=\"hidden\" name=\"show_sub\" value=\"$show_sub\">";
					print "<input type=\"hidden\" name=\"keywords\" value=\"$keywords\">";
?>


<?
	
	$group_categories = new option_box("group_categories");
	$group_categories->make_list();
	$group_categories->set_size(6);
	$group_categories->set_single_select();
	$cat_btn = epi_translate("categories",__FILE__,&$db,false,false);
	$title = "------------------ $cat_btn ------------------";
	
	get_all_image_categories($category_names,$category_values,$group_id,$s_image_id,$db,$title);


	//set up html objects
	$font = new font();
	$font->face = FONT_FACE;
	$font->size = 2;
	
	$table = new table();
	$table->width = 625;
	$tr = new table_row();
	$td = new table_cell();
	$ltd = new table_cell();
	$rtd = new table_cell();
	
	$ltd->width = 325;
	$rtd->width = $table->width - $ltd->width;
	//$ltd->bgcolor = $rtd->bgcolor = TABLE_BG_OFF;
	
	$href = new href();

	
	$table->name = "image_info";
	$table->border = "0";
	$table->cellpadding = "2";
	$table->cellspacing = "0";

	$text_box = new text_box();
	$text_box->size = 30;
	$text_box->maxlength = 45;
	$text_area = new text_area();

	$td->align = "left";
	$td->colspan = 2;
	//$td->bgcolor = TITLE_BG_OFF;
	$font->color = TITLE_FONT_OFF;
	
	$table->start();

		//$td->bgcolor = TABLE_BG_OFF;
		$font->color = TABLE_FONT_OFF;

		$tr->start();
			$td->start();
				print "&nbsp;";
			$td->stop();
		$tr->stop();
		
		$tr->start();
			$ltd->rowspan = 3;
			$ltd->start();
				$font->start();
				   print epi_translate("Select a category to edit",__FILE__,$db);
					print "<br>";

				$font->stop();
				$group_categories->OnChange = "Javascript:grab(document.cat_form.group_categories,document.cat_form.x_cat_id,document.cat_form.x_cat_name)";
				$group_categories->draw($category_names,$category_values);
			$ltd->stop();
			$ltd->rowspan = "";
			$rtd->start();
				print "&nbsp;";
			$rtd->stop();
		$tr->stop();
		$tr->start();
			$rtd->start();
				$font->start();
				   print epi_translate("Category Name",__FILE__,$db);
					print "<br>";
				$font->stop();
				$text_box->name = "x_cat_name";
				$text_box->draw();
			$rtd->stop();
		$tr->stop();
		$tr->start();
			$rtd->start();
				print "<input type=\"hidden\" name=\"x_cat_id\" value=\"\">";
				print "<input type=\"hidden\" name=\"x_image_id\" value=\"".$enc_image_id."\">";
				print "&nbsp;";
			$rtd->stop();
		$tr->stop();
		$tr->start();
			$ltd->start();
				print "&nbsp;";
			$ltd->stop();
			$rtd->start();
				print "&nbsp;";
			$rtd->stop();
		$tr->stop();
		$tr->start();
			$td->align = "center";
			$td->width = $table->width;
			$td->bgcolor = $ltd->bgcolor;

			$td->start();
			    
				 $update_btn = epi_translate("update",__FILE__,&$db,false,false);
             $cancel_btn = epi_translate("cancel",__FILE__,&$db,false,false);
				 $delete_btn = epi_translate("delete",__FILE__,&$db,false,false);
             $add_btn = epi_translate("add",__FILE__,&$db,false,false);



				print "<input type=\"button\" name=\"Cancel\" value=\"$cancel_btn\" OnClick=\"history.go(-1)\">";
				print "&nbsp;&nbsp;";
				print "<input type=\"button\" name=\"btnUpdate\" value=\"$update_btn\" OnClick=\"Javascript:confirm_form(1);\">";
				print "&nbsp;&nbsp;";
				print "<input type=\"button\" name=\"btnDelete\" value=\"$delete_btn\" OnClick=\"Javascript:confirm_form(2);\">";
				print "&nbsp;&nbsp;";
				print "<input type=\"button\" name=\"btnAdd\" value=\"$add_btn\" OnClick=\"Javascript:confirm_form(3);\">";
				print "<input type=\"hidden\" name=\"update\" value=\"\">";
			$td->stop();
		$tr->stop();
	$table->stop();
	print "</form>";

?>
       <div class="roundbottom"><img src="images/bl_bl.gif" alt="" width="15" height="15" class="corner" style="display: none"></div>
		</div>
</div>



</div>
</div>
</div>
<?
// print $group_id;
 
require_once("./mrc_footer.php");   
?>
Return current item: Epiware Document Management