__section__
default
__description__
Display submission form

* fixedstory = submission for preview
* savestory = boolean for OK to print "Submit" button
* username = user's name
* fakeemail = user's mail/URL
* section = submission section name
* topic = submission topic hashref
* width = passed to titlebar
* title = passed to titlebar
* pending = html of pending submissions
__title__

__page__
submit
__lang__
en_US
__name__
displayForm
__template__
<div class="generalbody">
[% pending %]
[% # set the variable 'subtext'
   submission.storyonly = 0;
   submission.email = fakeemail;
   submission.name = username;
   submission.story = fixedstory;
   PROCESS formatSub %]

[% PROCESS titlebar title = "$constants.sitename Story Submissions" %]
[% IF constants.submiss_view %]
	<p>
		<strong>
			<a href="[% env.script_name %]?op=list">View Current Pending Submissions</a>
		</strong>
	</p>
[% END %]
[% IF form.op AND !savestory %]
	<div class="message error">
		You must preview once, provide a subject, some text, and a topic before you can submit
	</div>
	[% IF missing_required.size > 0  %]
	<div class="message error">
		You're also missing the following required fields
		<ul>
		[% FOREACH required = missing_required %]
			<li>[% required.0 %]</li>	
		[% END %]
		</ul>
	</div>
	[% END %]
[% END %]

	<p>
	Here is where you can submit a story for the [% constants.sitename %] Editors to peer at it, poke it with a stick, and perhaps post it for all to share and enjoy.  It is <strong>very</strong> important that you write a clear simple subject, and include relevant links in your story.  If you wish to be anonymous, feel free to leave the identifying fields blank.  Anonymity has no effect on whether we will accept or reject the story.
	</p>

[%# username is the only of from, email, subj that needs to be filtered in %]

	<form action="[% env.script_name %]" method="post">
	[% IF savestory %]
		<fieldset>
			<legend>
				Preview Submission
			</legend>
			<div class="article">
				[% PROCESS titlebar width => "100%", title => form.subj %]
				<div class="body">
					<div class="topic">
						<img src="[% constants.imagedir %]/topics/[% topic.image %]" alt="[% topic.textname %]" width="[% topic.width %]" height="[% topic.height %]">
					</div>
					[% subtext %]
				</div>
			</div>
		</fieldset>
	[% END %]
		<fieldset>
			<legend>
				Story Submission Form
			</legend>
		[% PROCESS reskey_tag %]
		[%# username is the only of from, email, subj that needs to be filtered in %]
		[%# the tag attribute; the others already have been in submit.pl.          %]
			[% PROCESS formLabel value => "Your Name" %]
			<input type="text" name="name" value="[% username | strip_attribute %]" size="50" maxlength="50">
			[% PROCESS formNote note => "Leave Blank to be Anonymous" %]
			[% PROCESS formLabel value => "Your Email or Homepage" "Where Users Can Contact You" %]
			<input type="text" name="email" value="[% fakeemail %]" size="50" maxlength="50">
			[% PROCESS formNote note => "Where users can contact you" %]
			[% IF constants.plugin.FireHose %]
				[% PROCESS formLabel value => "Url"  %]
				<input type="text" name="url" value="[% form.url | strip_attribute %]" size="50"> Url type:
				[% Slash.createSelect('mediatype', Slash.db.getDescriptions('mediatypes'), { default => form.mediatype || "none" , return => 1 }) %]
				[% PROCESS formNote note => "Main url of submission (optional but if provided must be unique) " %]
			[% END %]

			[% PROCESS formLabel value => "Subject"  %]
			<input type="text" name="subj" value="[% form.subj %]" size="50" maxlength="50">
			[% PROCESS formNote note => "Be descriptive and concise!" %]
			[% PROCESS formNote note => "(Nondescriptive subjects like 'Check this out!' usually just get deleted, because we get many every day. For best results, put the important words early.)" %]

	[% FOR extra = extras %]
		[% PROCESS formLabel value => extra.0, comment => "" %]
		[% IF extra.2 == 'text' %]
			<input type="text" name="[% extra.1 %]" value="[% form.${extra.1} | strip_attribute %]" size="50">
		[% ELSIF extra.2 == 'textarea' %]
			<textarea wrap="virtual" rows="[% user.textarea_rows || constants.textarea_rows %]" cols="[% user.textarea_cols || constants.textarea_cols %]" name="[% extra.1 %]">[% form.${extra.1} | strip_literal %]</textarea><br>
		[% ELSIF extra.2 == 'list' %]
			[% # section:value %]
			[% Slash.createSelect(extra.1, Slash.db.getDescriptions('genericstring',extra.1), form.${extra.1}, 1, 1) %]	
		[% END %]
	[% END %]

			[% hide_section_select = 0; hide_topic_select = 0 %]
			[% primaryskid_val = form.primaryskid.defined ? form.primaryskid : constants.submission_default_skid;
			IF constants.submission_force_default || (form.primaryskid && form.hss);
				hide_section_select = 1; 
			 END %]
			[% IF form.hts && form.tid;
				hide_topic_select = 1;
			 END %]
			[% section_topic_title = "" %]
			[% IF hide_section_select && !hide_topic_select;
				section_topic_title = "Select Topic";
			ELSIF !hide_section_select && hide_topic_select;
				section_topic_title = "Select Section";
			ELSIF !hide_section_select && !hide_topic_select;
				section_topic_title = "Select Section And Topic";
			END %]
			[% IF section_topic_title; PROCESS formLabel value => section_topic_title; END %]
		[% IF hide_section_select %]
			<input type="hidden" name="primaryskid" value="[% primaryskid_val | strip_attribute %]">
			<input type="hidden" name="hss" value="1" >	
		[% ELSE %]
			[% Slash.createSelect('primaryskid', skin_values, primaryskid_val 1, 0, 1) %]
		[% END %]
		[% IF hide_topic_select %]
			<input type="hidden" name="tid" value="[% form.tid | strip_attribute %]">
			<input type="hidden" name="hts" value="1" >	
		[% ELSE %]
			[% Slash.createSelect('tid', topic_values, form.tid, 1, 0, 1)%]	
		[% END %]
			[% submitToLabel = skins.${constants.mainpage_skid}.title || "the main section" %]
			[% PROCESS formNote note => "In general, submit to $submitToLabel" %]

			[% PROCESS formLabel value => "The Scoop" %]
			<textarea wrap="virtual" rows="[% user.textarea_rows || constants.textarea_rows %]" cols="[% user.textarea_cols || constants.textarea_cols %]" name="story">[% form.story | strip_literal %]</textarea><br>
			[% PROCESS formNote note => "Are you sure you included a URL?  Did you test them for typos?" %]
			[% PROCESS formNote note => "HTML is fine, but double check those URLs and HTML tags!" %]
			[% PROCESS formLabel value => "Submission format", comment => "" %]
			[% def_type = form.sub_type || 'html'; sub_types = { "html" => "HTML Formatted", "plain" => "Plain Old Text" }; Slash.createSelect('sub_type', sub_types, def_type, 1) %]
			[% IF form.url_id %]
				<input type="hidden" name="url_id" value="[% form.url_id | strip_attribute %]">
			[% END %]

			[% IF user.state.hc && !user.state.hcinvalid %]
			<p>[% user.state.hcquestion; user.state.hchtml %]
			<input type="text" name="hcanswer" value="[% form.hcanswer | strip_attribute %]" size="8" maxlength="8"></p>
			[% END %]

			<input type="submit" name="op" value="PreviewStory" class="button">
		[% IF savestory %]
			<input type="submit" name="op" value="SubmitStory" class="button">
		[% ELSE %]
			[% PROCESS formNote note => "You must preview once, provide a subject, some text, and a topic before you can submit" %]
		[% END %]
		</fieldset>
	</form>
</div>
__seclev__
10000
__version__
$Id$
