<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<{$xoops_langcode}>" lang="<{$xoops_langcode}>">
<head>
    <meta http-equiv="content-type" content="text/html; charset=<{$xoops_charset}>"/>
    <meta http-equiv="content-language" content="<{$xoops_langcode}>"/>
    <title><{$sitename}> <{$lang_imgmanager}></title>
    <script type="text/javascript">
        <!--//
        function appendCode(addCode) {
            var targetDom = window.opener.xoopsGetElementById('<{$target}>');
            if (targetDom.createTextRange && targetDom.caretPos) {
                var caretPos = targetDom.caretPos;
                caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? addCode + ' ' : addCode;
            } else if (targetDom.getSelection && targetDom.caretPos) {
                var caretPos = targetDom.caretPos;
                caretPos.text = caretPos.text.charat(caretPos.text.length - 1) == ' ' ? addCode + ' ' : addCode;
            } else {
                targetDom.value = targetDom.value + addCode;
            }
            window.close();
//    return;
        }
        //-->
    </script>
    <link rel="stylesheet" type="text/css" media="screen" href="<{xoAppUrl xoops.css}>"/>
    <link rel="stylesheet" type="text/css" media="screen" href="<{xoAppUrl modules/system/css/imagemanager.css}>"/>

    <{php}>
        $language = $GLOBALS['xoopsConfig']['language'];
        if(file_exists(XOOPS_ROOT_PATH.'/language/'.$language.'/style.css')){
        echo "
        <link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"language/$language/style.css\"/>
        ";
        }
    <{/php}>

</head>

<body onload="window.resizeTo(<{$xsize}>, <{$ysize}>);">
<form action="imagemanager.php" method="get">
    <table cellspacing="0" id="imagenav">
        <tr>
            <td>
                <select name="cat_id"
                        onchange="location='<{$xoops_url}>/imagemanager.php?target=<{$target}>&cat_id='+this.options[this.selectedIndex].value"><{$cat_options}></select>
                <input type="hidden" name="target" value="<{$target}>"/>
                <input type="submit" value="<{$lang_go}>"/>
            </td>

            <{if $show_cat > 0}>
                <td id="addimage" class="txtright"><a href="<{$xoops_url}>/imagemanager.php?target=<{$target}>&op=upload&imgcat_id=<{$show_cat}>"
                                                      title="<{$lang_addimage}>"><{$lang_addimage}></a></td>
            <{/if}>

        </tr>
    </table>
</form>
<div id="pagenav"><{$pagenav}></div>
<{if $image_total > 0}>
    <table cellspacing="0" id="imagemain">
        <tr>
            <th><{$lang_imagename}></th>
            <th><{$lang_image}></th>
            <th><{$lang_imagemime}></th>
            <th><{$lang_align}></th>
        </tr>

        <{section name=i loop=$images}>
            <tr class="txtcenter">
                <td><input type="hidden" name="image_id[]" value="<{$images[i].id}>"/><{$images[i].nicename}></td>
                <td><img style="max-width:200px;" src="<{$images[i].src}>" alt=""/></td>
                <td><{$images[i].mimetype}></td>
                <td><a href="#" title="" onclick="appendCode('<{$images[i].lxcode}>');" title=""><img src="<{xoAppUrl images/alignleft.gif}>" alt="Left"/></a>
                    <a href="#" title="" onclick="appendCode('<{$images[i].xcode}>');" title=""><img src="<{xoAppUrl images/aligncenter.gif}>" alt="Center"/></a>
                    <a href="#" title="" onclick="appendCode('<{$images[i].rxcode}>');" title=""><img src="<{xoAppUrl images/alignright.gif}>"
                                                                                                      alt="Right"/></a></td>
            </tr>
        <{/section}>
    </table>
<{else}>
    <div id="welcomenot"></div>
<{/if}>

<div id="pagenav"><{$pagenav}></div>

<div id="footer">
    <input value="<{$lang_close}>" type="button" onclick="window.close();"/>
</div>

</body>
</html>
