<?php  $webSiteUrl = unserialize(Zend_Registry::get('config'))->website->website->url; ?>
<div class="admineditwhat">{%Templates list%}</div>
<div>
<ul style="height:510px;widht:500px;overflow-x:hidden;overflow-y:auto;">
    <?php foreach($this->templates as $template): ?>
    <li>
        <?php
        $src = $webSiteUrl . 'system/images/no_preview.png';
        $webSiteUrl = unserialize(Zend_Registry::get('config'))->website->website->url;
        if (!empty($template['preview_path']) && !empty($template['theme_name'])):
        if(file_exists(unserialize(Zend_Registry::get('config'))->website->website->path . 'public/themes/' . $template['theme_name'] . '/images/templatepreview/' . $template['preview_path'])):
        $src = $webSiteUrl . 'themes/' . $template['theme_name'] . '/images/templatepreview/' . $template['preview_path'];
        endif;
        else:
        $src = $webSiteUrl . 'system/images/no_preview.png';
        endif;
        ?>
        <a  class="templatename" onclick="selectTemplate(<?php echo $template['id']; ?>,'<?php echo $template['name']; ?>');"
           href="javascript: void(0);" title="<?php echo $template['name']; ?>"><img src="<?php echo $src; ?>" alt="<?php echo $template['name']; ?>"/></a>
        <p>
        <?php echo $template['name']; if(isset($template['name']) && strtolower($template['name'])!='index' && strtolower($template['name'])!='category' && strtolower($template['name'])!='default' && strtolower($template['name'])!='news') {?>
            <a  class="templatedel" style="vertical-align:middle;"  href="javascript:void(0);" onclick=" if(confirm('Do you really want to delete this template?')){deleteTemplate(<?php echo $template['id'];?>); } " title="Delete this template"><img src="<?php echo $webSiteUrl?>system/images/ico_delete.gif" alt="Delete this template" /></a>
            <?php }?>
        </p>
    </li>
    <?php endforeach; ?>
</ul>
	<input type="hidden" id="hid-main-wsurl" name="hid-main-wsurl" value="<?php echo $this->websiteUrl; ?>" />
</div>