<?php if(!defined('master_script')) die();

/**
 * Backend template
 *
 * @category   Extension (edit page)
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2010-08-08
 */

?>

<div class="column">
	<h4><?php echo txt('edit-page', 'Anzeigeoptionen'); ?></h4>

   	<p style="margin-bottom: 1.5em">
   		<?php echo txt('edit-page', 'Anzeige in'); ?>
   		<input type="checkbox" name="published" id="published" <?php if($page_info->published == 1) echo 'checked="checked"'; ?>>
   		<label class="checkbox" for="published"><?php echo txt('edit-page', 'Menü'); ?></label>

   		<input type="checkbox" name="searchable" id="searchable" <?php if($page_info->searchable == 1) echo 'checked="checked"'; ?>>
   		<label class="checkbox" for="searchable"><?php echo txt('edit-page', 'Suchmaschinen'); ?></label>
   	</p>

	<p>
    	<label><?php echo txt('edit-page', 'Seitentyp'); ?>:</label>
       	<select name="pagetype" id="pagetype" size="1" <?php if(is_file($page_info->index)) echo 'disabled="disabled"'; ?>>
    		<option value="index.php?backend=edit-page&amp;page=<?php echo $_GET['page']; ?><?php if(isset($_GET['path'])) echo '&amp;path=' . $_GET['path']; ?>" <?php if($_GET['pagetype'] == 'standard') echo 'selected="selected"'; ?>><?php echo txt('edit-page', 'Standardseite'); ?></option>
    		<option value="index.php?backend=edit-page&amp;page=<?php echo $_GET['page']; ?>&amp;pagetype=news<?php if(isset($_GET['path'])) echo '&amp;path=' . $_GET['path']; ?>" <?php if($_GET['pagetype'] == 'news') echo 'selected="selected"'; ?>><?php echo txt('edit-page', 'Nachrichtenseite'); ?></option>
    		<?php connector('edit page select field page types'); ?>
    	</select>
	</p>
       	
   	<hr>
    	
   	<p>
   		<label for="title"><?php echo txt('edit-page', 'Name'); ?>:</label>
   		<input type="text" id="title" name="title" maxlength="<?php echo $system_data['backend']['maximum length title']; ?>" value="<?php echo clean_output(isset($_POST['title']) ? $_POST['title'] : $page_info->title); ?>">
   	</p>

   	<div class="drop-down">
    	<label for="language"><?php echo txt('edit-page', 'Sprache'); ?>:</label>
		<input type="text" name="language" id="language" class="text" value="<?php echo clean_output($page_info->language); ?>">
   		
   		<?php if(count($frontend_languages) > 0) { ?>
	   		<a class="toggler for-input" href="#">&nbsp;</a><br>
	   		<div class="list">
	   			<?php foreach($frontend_languages as $language_entry) echo '<a onclick="document.getElementById(\'language\').value = \'' . trim($language_entry) . '\'; return false">' . trim($language_entry) . '</a>'; ?>
	   		</div>
	   	<?php } ?>
   	</div>

   	<div class="drop-down">
    	<label for="topic"><?php echo txt('edit-page', 'Thema'); ?>:</label>
		<input type="text" name="topic" id="topic" class="text" value="<?php echo clean_output($page_info->topic); ?>">
   		
   		<?php if(count($database_topics->cfile) > 0) { ?>
	   		<a class="toggler for-input" href="#">&nbsp;</a><br>
	   		<div class="list">
	   			<?php foreach($database_topics->cfile as $topic_entry) echo '<a onclick="document.getElementById(\'topic\').value = \'' . addslashes(clean_output($topic_entry->title)) . '\'; return false">' . clean_output($topic_entry->title) . '</a>'; ?>
	   		</div>
	   	<?php } ?>
   	</div>
</div>
	
<div class="column last-column">
	<h4><?php echo txt('edit-page', 'Metadaten'); ?></h4>

	<p>
    	<label for="template"><?php echo txt('edit-page', 'Seitenvorlage'); ?>:</label>
       	<select id="template" name="template" size="1">
   			<option value=""><?php echo txt('edit-page', 'Standard der Kategorie'); ?></option>
       		<?php
       			$page_templates = filelist($system_data['folder']['frontend template'], 'tpl', array(), array(), true);
       			
       			for($i = 0; $i < count($page_templates); $i++)
       				echo '<option value="' . clean_output(str_replace($system_data['folder']['frontend template'], '', $page_templates[$i])) . '"' . (str_replace($system_data['folder']['frontend template'], '', $page_templates[$i]) == $page_info->template ? ' selected="selected"' : '') . '>' . str_replace($system_data['folder']['frontend template'], '', $page_templates[$i]) . '</option>';
       		?>
       	</select>
   	</p>
    	
	<p>
    	<label for="alias"><?php echo txt('edit-page', 'Alias'); ?>:</label>
    	<input class="text" type="text" id="alias" name="alias" value="<?php echo isset($_POST['category']) ? $_POST['alias'] : clean_output($_GET['page']); ?>">
    </p>
    
   	<p>
   		<label for="description"><?php echo txt('edit-page', 'Beschreibung'); ?>:</label>
   		<input class="text" type="text" id="description" name="description" maxlength="<?php echo $system_data['backend']['maximum length description'] - strlen($category_info->description); ?>" value="<?php echo clean_output($page_info->description); ?>">
   	</p>
    	
	<p>
   		<label for="tags"><?php echo txt('edit-page', 'Schlüsselwörter'); ?>:</label>
   		<input class="text" type="text" id="tags" name="tags" maxlength="<?php echo $system_data['backend']['maximum length keywords'] - strlen($category_info->tags); ?>" value="<?php echo clean_output($page_info->tags); ?>">
   	</p>

   	<div class="advanced-input">
   		<label for="timestamp"><?php echo txt('edit-page', 'Veröffentlicht am'); ?>:</label>
   		<input class="text" type="text" id="timestamp" name="timestamp" value="<?php echo date('d.m.Y H:i:s', ($page_info->timestamp == '' ? time() : intval($page_info->timestamp))); ?>">
   		<a style="background-image: url(<?php echo $system_data['folder']['plugins']; ?>icons/date_add.png)" id="paste-date" href="#paste-date" title="<?php echo txt('edit-page', 'Aktuelles Datum und Uhrzeit einfügen.'); ?>" onclick="insertDate(); return false">&nbsp;</a>
   	</div>
</div>

<div style="clear: both"></div>

<h4><?php echo txt('edit-page', 'Vorschautext'); ?></h4>

<textarea style="width: 99%" id="teaser" name="teaser" cols="50" rows="5"><?php echo clean_output(isset($_POST['teaser']) ? $_POST['teaser'] : $page_info->teaser); ?></textarea>