Source

pyforum / views / default / add_topic.html

Full commit
{{extend 'zlayout.html'}}

<h2 class="fancy">{{=XML(T('Add New Topic'))}}</h2>

{{if view_info['errors']:}}
    <p class="err">{{=XML(T('There was one or more errors while processing your request, please correct the following'))}}</p>
    <ul>
        {{for error in view_info['errors']:}}
            <li class="err">{{=XML(T(error))}}</li>
        {{pass}}
    </ul>
{{pass}}


{{if view_info.has_key('preview'):}}
    <div class="preview bottom-separator">
        <b>{{=XML(T('Message Preview'))}}</b>
        <div class="hr"><hr /></div>
        <div>{{=XML(parse_content(view_info['preview'], mode='forumfull'))}}</div>
    </div>
{{pass}}

<form id="add_topic_form" method="post" action="">
    <fieldset id="add_topic_form_fields">
        <input type="hidden" id="form_submitted" name="form_submitted" value="1" />
        <input type="hidden" id="forum_id" name="forum_id" value="{{=forum_id}}" />
        <input type="hidden" id="c" name="c" value="{{=view_info['anon_captcha_base64']}}" />
        <table cellspacing="2" cellpadding="1">
        <tbody>
            <tr>
                <td>{{=XML(T('Author'))}}:</td>
                <td>{{=auth_user.get_user_name()}}</td>
            </tr>
            <tr>
                <td><span class="required">*</span> {{=XML(T('Title'))}}:</td>
                <td><input type="text" id="title" name="title" value="{{=request.vars.get('title', '')}}" style="width:600px;" /></td>
            </tr>
            <tr>
                <td><span class="required">*</span> {{=XML(T('Content'))}}:</td>
                <td><textarea id="content" name="content" cols="0" rows="0" style="width:600px;height:250px;">{{=request.vars.get('content', '')}}</textarea></td>
            </tr>
            {{if not auth_user.is_auth():}}
                <tr>
                    <td><span class="required">*</span>
                        {{=XML(T('Verify your humanity'))}}:
                    </td>
                    <td>
                        <input type="text" id="captcha_response" name="captcha_response" value="" style="width:100px;" />
                        <b>{{=view_info['anon_captcha']}}</b>
                        <span class="warning">({{=XML(T('Please Enter the acces code shown in order to post your message'))}}.)</span>
                    </td>
                </tr>
            {{pass}}
            {{if auth_user.is_auth():}}
                <tr>
                    <td><label for="add_signature">{{=XML(T('Add Signature'))}}:</label></td>
                    <td><input type="checkbox" id="add_signature" name="add_signature" {{if request.vars.get('add_signature', ''):}}checked="checked"{{pass}} /></td>
                </tr>
                <tr>
                    <td><label for="add_subscription">{{=XML(T('Subscribe Immediately'))}}:</label></td>
                    <td><input type="checkbox" id="add_subscription" name="add_subscription" {{if request.vars.get('add_subscription', ''):}}checked="checked"{{pass}} /></td>
                </tr>
            {{pass}}
            {{if auth_user.has_role('zAdministrator'):}}
                <tr>
                    <td><span class="warning">*</span> <label for="locked_flag">{{=XML(T('Locked Topic'))}}:</label></td>
                    <td><input type="checkbox" id="locked_flag" name="locked_flag" {{if request.vars.get('locked_flag', ''):}}checked="checked"{{pass}} /></td>
                </tr>
                <tr>
                    <td><span class="warning">*</span> <label for="sticky_flag">{{=XML(T('Sticky Topic'))}}:</label></td>
                    <td><input type="checkbox" id="sticky_flag" name="sticky_flag" {{if request.vars.get('sticky_flag', ''):}}checked="checked"{{pass}} /></td>
                </tr>
                <tr>
                    <td><span class="warning">*</span> <label for="system_announcement_flag">{{=XML(T('System Announcement'))}}:</label></td>
                    <td><input type="checkbox" id="system_announcement_flag" name="system_announcement_flag" {{if request.vars.get('system_announcement_flag', ''):}}checked="checked"{{pass}} /></td>
                </tr>
                <tr>
                    <td><span class="warning">*</span> {{=XML(T('Creator'))}}:</td>
                    <td>
                        <input type="text" id="creation_user" name="creation_user" value="{{=request.vars.get('creation_user', auth_user.get_user_name())}}" style="width:200px;" />
                        @
                        <input type="text" id="creation_date" name="creation_date" value="{{=request.vars.get('creation_date', request.now.strftime('%Y-%m-%d %H:%M:%S'))}}" style="width:200px;" />
                    </td>
                </tr>
                <tr>
                    <td><span class="warning">*</span> {{=XML(T('Modificator'))}}:</td>
                    <td>
                        <input type="text" id="modifying_user" name="modifying_user" value="{{=request.vars.get('modifying_user', auth_user.get_user_name())}}" style="width:200px;" />
                        @
                        <input type="text" id="modifying_date" name="modifying_date" value="{{=request.vars.get('modifying_date', request.now.strftime('%Y-%m-%d %H:%M:%S'))}}" style="width:200px;" />
                    </td>
                </tr>
            {{pass}}
            <tr>
                <td>{{=XML(T('Click on an emoticon to add it'))}}:</td>
                <td>
                    {{for icon in view_info['emoticons']:}}
                        <img src="{{=URL(r=request, c='static/images', f=icon)}}" alt="{{=icon[5:icon.rfind('.')]}}" class="imgclear" style="width:16px;height:16px;"
                             onmouseover="this.style.cursor='pointer';"
                             onmouseout="this.style.cursor='default';"
                             onclick="add_emoticon('{{=icon[5:icon.rfind('.')]}}');" />
                    {{pass}}
                </td>
            </tr>
        </tbody>
        </table>

        <div class="both-separator"><span class="required">* {{=XML(T('Required Fields'))}}</span></div>

        <input type="submit" id="preview_b" name="preview_b" value="{{=XML(T('Preview'))}}" />
        <input type="submit" id="add_topic" name="add_topic" value="{{=XML(T('Add'))}}" />
        <input type="submit" id="cancel_b" name="cancel_b" value="{{=XML(T('Cancel'))}}" />

    </fieldset>
</form>

<div class="top-separator">
    <span class="warning">*</span>
    <span class="small"> - {{=XML(T('Adminitrative-only options, not available to regular members'))}}.</span>
</div>

<script type="text/javascript">
<!--
    function add_emoticon(e_value) {
        var emoticon_value = ':' + e_value + ':';
        var my_field = document.getElementById('content');

        //IE support
        if (document.selection) {
            my_field.focus();
            sel = document.selection.createRange();
            sel.text = emoticon_value;
        }
        //MOZILLA/NETSCAPE support
        else if (my_field.selectionStart || my_field.selectionStart == 0) {
            var start_pos = my_field.selectionStart;
            var end_pos = my_field.selectionEnd;
            my_field.value = my_field.value.substring(0, start_pos) + emoticon_value + my_field.value.substring(end_pos, my_field.value.length);
        } else {
            my_vield.value += emoticon_value;
        }

        document.getElementById('content').focus();
    }
//-->
</script>