Newer
Older
DocumentLibrary / src / DocumentLibrary / instance / methods / document_submit
<dtml-comment>

document_submit method

    User form to add documents to the library.

    Author: Casey Duncan (casey_duncan@yahoo.com)

    CSS classes used:
        document-library	Entire document topic hierarchy
        required            Required field marker

</dtml-comment>

<dtml-if name="submit">
    <dtml-try>
        <dtml-with name="Documents">
	    <dtml-call expr="validateDocumentProperties(REQUEST)">
            <dtml-unless expr="REQUEST.get('date','')">
                <dtml-call expr="REQUEST.set('date', document_no_creation_date)">
            </dtml-unless>
            <dtml-with expr="addDocumentFile(REQUEST)">
                <dtml-call expr="RESPONSE.redirect(URL1 + '?message=document_submit_message&id=' 
                                 + getId())">
            </dtml-with>
        </dtml-with>
        <dtml-return expr="1">
    <dtml-except IllegalFileType>
        <dtml-raise IllegalFileType><dtml-var name="document_submit_file_error"></dtml-raise>
    <dtml-except URLError NotFoundError>
        <dtml-raise URLError><dtml-var name="document_submit_url_error"></dtml-raise>
    <dtml-except ValidationError>
    </dtml-try>
</dtml-if>

<dtml-if name="cancel">
    <dtml-call expr="RESPONSE.redirect(URL1)">
    <dtml-return expr="0">
</dtml-if>

<dtml-var standard_html_header>

<dtml-call expr="setFlag('nav_link_flag', document_id)">
<script type="text/javascript">
<!--
	function popUpWindow(url) {
		w = window.open(url, 'popup', "left=30,top=30,width=550,height=470,menubar,toolbar,scrollbars,status,location");
		w.focus();
	}
//-->
</script>

<div class="document-library">
<dtml-if name="ERROR_FORM">
    <dtml-var name="ERROR_FORM">
<dtml-else>
    To submit a document to the library, fill out this form.
</dtml-if>
    (<span class="required">* Denotes required fields</span>)

<form name="doc_submit" action="&dtml-URL;" enctype="multipart/form-data" method="post">
<table width="550">
    <tr>
        <th align="left">Title&nbsp;<span class="required">*</span>
            &dtml.missing.-ERROR_title;</th>
        <td><input name="title" size="50" maxlength="75"
                   value="<dtml-var expr="REQUEST.get('title','')" html_quote>"></td>
    </tr>
    <tr>
        <th align="left">Type&nbsp;<span class="required">*</span>
            &dtml.missing.-ERROR_type;</th>
		<td>
			<select name="type">
			    <option value=""></option>
			    <dtml-let type="REQUEST.get('type','')">
			    <dtml-in name="document_types">
			        <option value="&dtml-sequence-item;"
    			        <dtml-if expr="type == _['sequence-item']">selected</dtml-if>
                                >&dtml-sequence-item;</option>
			    </dtml-in>
			    </dtml-let>
			</select>				
		</td>
    </tr>		
	<tr>
        <th align="left">Description&nbsp;<span class="required">*</span>
            &dtml.missing.-ERROR_description;</th>
		<td>
			<textarea name="description" cols="55" rows="4" wrap="virtual"
			><dtml-var expr="REQUEST.get('description','')" html_quote></textarea>
		</td>
	</tr>
    <tr>
		<th align="left" valign="top">Subject Topic Areas&nbsp;<span class="required">*</span>
            &dtml.missing.-ERROR_topics;</th>
		<td>
			Enter or select document topic codes. To specify multiple topics,
			put each code on its own line or use the
			<a href="javascript:popUpWindow('&dtml.url-index_chooser;?topic_form=doc_submit&topic_field=topics:lines')">topic&nbsp;chooser</a>
			to find the topic codes for your document.<br />
			<textarea name="topics:lines" rows="4" cols="55" wrap="virtual"
			<dtml-if expr="_.has_key('isLibraryTopicIndex') and not REQUEST.has_key('topics')">
			    <dtml-comment>Automatically select the current index topic</dtml-comment>
			    >&dtml-getTopicId; (&dtml-title;)</textarea>
			<dtml-else>
			    ><dtml-var expr="_.string.join(REQUEST.get('topics',''), '\n')" html_quote></textarea>
			</dtml-if>
		</td>
	</tr>
	<tr>
		<th align="left">Creator
            &dtml.missing.-ERROR_creator;</th>
		<td><input name="creator" size="50" maxlength="75"
		     value="<dtml-var expr="REQUEST.get('creator','')" html_quote>"></td>
	</tr>
	<tr>
		<th align="left">Creation Date
            &dtml.missing.-ERROR_date;</th>

        	<td><input name="date" size="10" maxlength="20" 
                               value="<dtml-var expr="REQUEST.get('date','')" html_quote>"></td>
	</tr>
	<tr>
		<th align="left" valign="top">Document&nbsp;<span class="required">*</span>
            &dtml.missing.-ERROR_file;</th>
		<td>
			If the document is a web page, enter the URL below.
			If you want to upload a file from your computer,
			click on the <em>Browse...</em> button to select the file.
		</td>
	</tr>
	<tr>
		<th align="right">URL</th>
		<td><input name="url" size="40" 
		     value="<dtml-var expr="REQUEST.get('url','http://')" html_quote>"></td>
	</tr>
	<tr>
		<th align="right">File</th>
		<td><input type="file" name="file" size="40"></td>
	</tr>
	</tr>
	<tr>
		<th align="left">&nbsp;</th>
		<td>
			<input type="submit" name="submit" value=" Submit Document " />
			&nbsp;&nbsp;&nbsp;&nbsp;
			<input type="submit" name="cancel" onclick="this.form.reset()" value=" Cancel " />
		</td>
	</tr>
</table>
</form>
</div>
<dtml-var standard_html_footer>