
<script src="js/edit-image.js" type="text/javascript"></script>
<script src="js/page-leave-handler.js" type="text/javascript"></script>

<TMPL_IF no_results>
found no image
</TMPL_IF>

<TMPL_LOOP images>
<TMPL_IF filename>
<div id="imageEditor" class="editor">

    <TMPL_IF public>
        <button onclick="assignImage('<TMPL_VAR filename escape=none>', '<TMPL_VAR .target>', '<TMPL_VAR .project_id>', '<TMPL_VAR .studio_id>', '<TMPL_VAR .series_id>', '<TMPL_VAR .event_id>', '<TMPL_VAR .pid>'); return false">
            <TMPL_VAR .label_assign_to_by_label>
        </button>

        <button onclick="depublishImage('<TMPL_VAR id>', '<TMPL_VAR filename escape=none>'); return false;"><TMPL_VAR .loc.button_depublish></button>

    <TMPL_ELSE>
        <div class="warn"><TMPL_VAR .label_warn_not_public_by_label></div>
        <TMPL_IF missing_licence>
            <div class="warn"><TMPL_VAR .loc.label_warn_unknown_licence></div>
        <TMPL_ELSE>
            <button onclick="publishImage('<TMPL_VAR id>', '<TMPL_VAR filename escape=none>'); return false;"><TMPL_VAR .loc.button_publish></button>
        </TMPL_IF>
    </TMPL_IF>

    <div class="panel-body">
        <div id="status"></div>

    <form id="save_img_<TMPL_VAR id>"
	    method="post" 
	    action="image.cgi" 
	    onsubmit="saveImage('<TMPL_VAR id>','<TMPL_VAR filename>');return false;"
    >   

        <input type="hidden" name="project_id" value="<TMPL_VAR .project_id>">
        <input type="hidden" name="studio_id" value="<TMPL_VAR .studio_id>">
        <input type="hidden" class="public" name="public" <TMPL_IF public>checked="checked" value="1"<TMPL_ELSE>value="0"</TMPL_IF> /><br>
    
        <label><TMPL_VAR .loc.label_name></label><br>
        <input value="<TMPL_VAR name escape=none>" name="update_name" class="field" placeholder="<TMPL_VAR .loc.label_mandatory_field>"><br>

        <label><TMPL_VAR .loc.label_author>/<TMPL_VAR .loc.label_licence></label><br>
        <input name="licence" value="<TMPL_VAR licence>" class="field<TMPL_IF missing_licence> error</TMPL_IF>" placeholder="<TMPL_VAR .loc.label_mandatory_field_licence>" required/><br>

        <label><TMPL_VAR .loc.label_description></label><br>
        <textarea class="field" name="update_description" cols="50" rows="5" ><TMPL_VAR description escape=none></textarea><br>

        <TMPL_IF name="update_image">
            <input type="hidden" name="save_image" value="<TMPL_VAR filename escape=none>" />
            <button onclick="this.submit"><TMPL_VAR .loc.button_save></button/>
        </TMPL_IF>

        <TMPL_IF name="delete_image">
            <button onclick="askDeleteImage('img_<TMPL_VAR id escape=none>','<TMPL_VAR filename escape=none>');return false;"><TMPL_VAR .loc.button_delete></button>
        </TMPL_IF>

        <button onclick='$("#save_img_<TMPL_VAR id> #properties").show();return false;'><TMPL_VAR .loc.button_properties></button>
        <div id="properties" style="display:none">
            <TMPL_VAR .loc.label_created_at> <TMPL_VAR created_at> <TMPL_VAR .loc.label_created_by> <TMPL_VAR created_by><br>
            <TMPL_VAR .loc.label_modified_at> <TMPL_VAR modified_at> <TMPL_VAR .loc.label_modified_by> <TMPL_VAR modified_by><br>
            <TMPL_VAR .loc.label_link>: {{<TMPL_VAR filename escape=none>|<TMPL_VAR name>}}<br>
        </div>

    </form>

    </div>
</div>
</TMPL_IF>
</TMPL_LOOP>

</main>	    
</body>
</html>

