<?

/*
FlexCMS (http://www.flexcms.com)
Flexible, Powerful, Affordable.

Contents of this file are protected by the copyright
notice found at http://www.flexcms.com/flex/pages/copyright.html,
and its usage is subject to the terms of the licensing agreement 
available at http://www.flexcms.com/flex/pages/license.html
*/



	// ========================================================================================
	// edit Existing gallery
	// ========================================================================================
	
	$PageTitle = '<img src="'.$ImagesURL.'/admin/admincp_photo.gif" width="28" height="22"> '.$MsgText[3][51];
	$BrowserTitle = $MsgText[3][51];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="' . $MainURL . '/options.html">'.$MsgText[0][4].'</a> > <a href="'.$MainURL.'/admin/photos_galleries.html">'.$MsgText[3][3].'</a> > '.$MsgText[3][51];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
			
		if ($Permissions[301] == 'y') {
	
			$PageContents = '<br>';

												
			$query55 = "select * from `".$Settings['DBPrefix']."pg-Galleries` where RecordNumber='".$Arguments3."' and MinLevel<='".$UserLevel."' and MinEditLevel<='".$UserLevel."' limit 1";
			$result55 = mysql_query($query55) or die (mysql_error());
			
			if (mysql_num_rows($result55) > 0) {
				
				$row55 = mysql_fetch_array($result55);
				
				$FormatSelected[$row55['GalleryFormat']] = ' selected';
				
				
				$MinLevelSelected[$row55['MinLevel']] = ' selected';
				
				$query = "select Level,Description from `".$Settings['DBPrefix']."core-Permissions` where Level<=".$UserLevel;
		   		$result = mysql_query($query) or die (mysql_error());
				while ($row = mysql_fetch_array($result)) {
					$LevelDescriptions[$row['Level']] = $row['Description'];
				}
		
				$PermissionsDropdown = '<option value="0" selected> 0 - '.$MsgText[0][162].'</option>';
				for ($i = 1; $i <= $UserLevel; $i++) {
					if ($LevelDescriptions[$i] != '') {
						$PermissionsDropdown .= '<option value="'.$i.'"'.$MinLevelSelected[$i].'> '.$i.' - '.$LevelDescriptions[$i].'</option>';
					}
					else {
						$PermissionsDropdown .= '<option value="'.$i.'"'.$MinLevelSelected[$i].'> '.$i.'</option>';
					}
				}
				
				$MinEditLevelSelected[$row55['MinEditLevel']] = ' selected';
				
				$PermissionsDropdown2 = '<option value="0"'.$MinEditLevelSelected[0].'> 0 - '.$MsgText[0][162].'</option>';
				for ($i = 1; $i <= $UserLevel; $i++) {
					if ($LevelDescriptions[$i] != '') {
						$PermissionsDropdown2 .= '<option value="'.$i.'"'.$MinEditLevelSelected[$i].'> '.$i.' - '.$LevelDescriptions[$i].'</option>';
					}
					else {
						$PermissionsDropdown2 .= '<option value="'.$i.'"'.$MinEditLevelSelected[$i].'> '.$i.'</option>';
					}
				}
				
				
				
				$PageContents .= '<form action="'.$MainURL.'/admin/photos_gallery_edit_save" method="post">

				<input type="hidden" name="RecordNumberToEdit" value="'.$row55['RecordNumber'].'">

<table width="500" border="0" cellpadding="3" cellspacing="3">

<tr><td><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$MsgText[3][35].':</b></td><td><input type="text" name="Title" size="30" maxlength="255" value="'.str_replace('"','&#'.'34;',$row55['GalleryTitle']).'"></td></tr>

<tr><td><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$MsgText[3][36].':</b></td><td><textarea name="Description" cols="40" rows="3">'.$row55['GalleryDescription'].'</textarea><br><font face="'.$FontFace.'" size="'.($FontSize-1).'">('.$MsgText[3][37].')</td></tr>

<tr><td><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$MsgText[3][38].':</b></td><td>
<select name="Format"><option value="1"'.$FormatSelected['1'].'> '.$MsgText[3][39].'</option><option value="2"'.$FormatSelected['2'].'> '.$MsgText[3][40].'</option><option value="3"'.$FormatSelected['3'].'> '.$MsgText[3][41].'</option><option value="4"'.$FormatSelected['4'].'> '.$MsgText[3][42].'</option><option value="5"'.$FormatSelected['5'].'> '.$MsgText[3][43].'</option><option value="6"'.$FormatSelected['6'].'> '.$MsgText[3][44].'</option><option value="7"'.$FormatSelected['7'].'> '.$MsgText[3][45].'</option></select></td></tr>

<tr><td><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$MsgText[3][46].':</b></td><td><select name="MinLevel">'.$PermissionsDropdown.'</select><br><font face="'.$FontFace.'" size="'.($FontSize-1).'"></td></tr>

<tr><td><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$MsgText[0][542].':</b></td><td><select name="MinEditLevel">'.$PermissionsDropdown2.'</select><br><font face="'.$FontFace.'" size="'.($FontSize-1).'"></td></tr>

<tr><td><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$MsgText[0][199].':</b></td><td><input type="text" name="Priority" size="3" value="'.$row55['Priority'].'"></td></tr>



</table><br><br><input name="SubmitButton" type="submit" value="'.$MsgText[0][123].'"></form>';
				
		
			}
			else {
				$PageContents .= '<br>['.$MsgText[3][50].']<br>';
			}
	
				
	
	
		}
		else {
		
			$PageContents = $MsgText[0][97];
		
		}

	}
	else {
	
		RedirectToLogin();
	
	}
	

	// ========================================================================================




?>
