summaryrefslogtreecommitdiff
path: root/templates/edit_article.tpl
blob: b64caafa042896c62549e4e9ab116866c89c0a5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<script>//<![CDATA[
	function charCounter( textareaId, counterId, maxLimit ) {ldelim}
		document.getElementById( counterId ).value = maxLimit - document.getElementById( textareaId ).value.length;
	{rdelim}
//]]></script>
{strip}
<div class="floaticon">{bithelp}</div>
<div class="edit articles">
	<div class="header">
		{if $gContent->mArticleId}
			<h1>{tr}Edit Article{/tr}: {$article.title|escape}</h1>
			{elseif $gContent->hasUserPermission('p_articles_approve_submission') || $gContent->hasUserPermission('p_articles_auto_approve')}
			<h1>{tr}Create Article{/tr}</h1>
		{else}
			<h1>{tr}Submit Article{/tr}</h1>
		{/if}
	</div>

	{if $preview}
		<h2>Preview</h2>
		<div class="preview">{include file="bitpackage:articles/article_display.tpl" outer_div='display articles'}</div>
	{/if}

	{formfeedback hash=$feedback}
	{formfeedback warning=$errors.title}

	<div class="body">
		{form enctype="multipart/form-data" id="writearticle"}
			<input type="hidden" name="article_id" value="{$gContent->mArticleId}" />
			<input type="hidden" name="content_id" value="{$gContent->getField('content_id')}" />
			<input type="hidden" name="preview_image_url" value="{$article.preview_image_url}" />
			<input type="hidden" name="preview_image_path" value="{$article.preview_image_path}" />

			{jstabs}
				{jstab title="Article Body"}
					{legend legend="Article Body"}
						<div class="form-group">
							{formlabel label="Title" for="title"}
							{forminput}
								<input type="text" name="title" id="title" value="{$article.title|escape}" size="50" />
								{formhelp note=""}
							{/forminput}
						</div>

						<div class="form-group">
							{formlabel label="Author Name" for="author_name"}
							{forminput}
								<input type="text" name="author_name" id="author_name" value="{$article.author_name|escape}" />
								{formhelp note=""}
							{/forminput}
						</div>

						{if $topics or $gContent->hasUserPermission( 'p_articles_admin' )}
							<div class="form-group">
								{formlabel label="Topic" for="topic_id"}
								{forminput}
									{if $topics}
										<select name="topic_id" id="topic_id">
											<option value="">{tr}None{/tr}</option>
											{section name=t loop=$topics}
												<option value="{$topics[t].topic_id}" {if $article.topic_id eq $topics[t].topic_id or $topic eq $topics[t].topic_name}selected="selected"{/if}>{$topics[t].topic_name|escape}</option>
											{/section}
										</select>
									{else}
										<span id="topic_id">{tr}No Topics set{/tr}</span>. {smartlink ititle="Article Topics" ifile="admin/admin_topics.php"}
									{/if}
									{formhelp note=""}
								{/forminput}
							</div>
						{/if}

						{if count($types) == 1}
							{section name=t loop=$types}
								<input type="hidden" name="article_type_id" value="{$types[t].article_type_id}" />
								{if $types[t].use_ratings eq 'y'}{assign var=ratings value=TRUE}{/if}
							{/section}
						{else}
							<div class="form-group">
								{formlabel label="Type" for="article_type_id"}
								{forminput}
									<select id="article_type_id" name="article_type_id">
										{section name=t loop=$types}
											<option value="{$types[t].article_type_id}" {if $article.article_type_id eq $types[t].article_type_id}selected="selected"{/if}>{tr}{$types[t].type_name}{/tr} {if $types[t].use_ratings eq 'y'}{assign var=ratings value=TRUE} &nbsp; [ {tr}uses rating{/tr} ]{/if}</option>
										{/section}
									</select>
									{formhelp note=""}
								{/forminput}
							</div>
						{/if}

						{if $ratings}
							<div id="ratingedit" class="form-group">
								{formlabel label="Rating" for="rating"}
								{forminput}
									<select name="rating" id="rating">
										<option value="5" {if $article.rating eq 5}selected="selected"{/if}>{tr}5{/tr}</option>
										<option value="4" {if $article.rating eq 4}selected="selected"{/if}>{tr}4{/tr}</option>
										<option value="3" {if $article.rating eq 3 or !$article.rating}selected="selected"{/if}>{tr}3{/tr}</option>
										<option value="2" {if $article.rating eq 2}selected="selected"{/if}>{tr}2{/tr}</option>
										<option value="1" {if $article.rating eq 1}selected="selected"{/if}>{tr}1{/tr}</option>
									</select>
									{formhelp note="Rating is only used when the article type allows it."}{*(we shouldn't use hide since you can't edit this page if you don't have js enabled)    (can't get js to enable/disable this as needed)*}
								{/forminput}
							</div>
						{/if}

						{capture assign=textarea_help}
							{tr}If the article body exceeds the specified maximum body length, a separate page will be provided with the full body of the article. You can override this by using <strong>...split...</strong> on a separate line in your text.{/tr}
						{/capture}
						{assign var=length value=$gBitSystem->getConfig('articles_description_length')}
						{assign var=textarea_id value=$smarty.const.LIBERTY_TEXT_AREA}
						{textarea name="edit" onkeydown="charCounter('$textarea_id','artCounter','$length');" onkeyup="charCounter('$textarea_id','artCounter','$length');" edit=$article.raw}
						{assign var=artCount value=$article.data|count_characters:true}
						<input style="float:right" readonly="readonly" type="text" id="artCounter" size="5" value="{$gBitSystem->getConfig('articles_description_length')-$artCount}" />

						{include file="bitpackage:liberty/edit_services_inc.tpl" serviceFile="content_edit_mini_tpl"}

						{if $gBitSystem->isFeatureActive( 'articles_submissions_rnd_img' ) && !( $gContent->mArticleId || ( $gContent->hasUserPermission('p_articles_approve_submission') || $gContent->hasUserPermission('p_articles_auto_approve') ) )}
							<hr />
							{formfeedback error=$errors.captcha}
							{captcha force=true variant=row}
						{/if}

						<div class="form-group submit">
							<input type="submit" class="btn btn-default" name="preview" value="{tr}Preview{/tr}" />&nbsp;
							<input type="submit" class="btn btn-default" name="save" value="{tr}Save{/tr}" />
						</div>

						{if $gBitSystem->isFeatureActive( 'articles_attachments' ) }
							{include file="bitpackage:liberty/edit_storage_list.tpl" primary_label="Article Image"}
						{/if}
					{/legend}
				{/jstab}

				{include file="bitpackage:liberty/edit_services_inc.tpl" serviceFile="content_edit_tab_tpl"}

				{jstab title="Advanced"}
					{legend legend="Publication and Expiration Dates"}
						<div class="form-group">
							<input type="hidden" name="publishDateInput" value="1" />
							{formlabel label="Publish Date" for=""}
							{forminput}
								{html_select_date prefix="publish_" time=$article.publish_date start_year="-5" end_year="+10"} {tr}at{/tr}&nbsp;
								<span dir="ltr">{html_select_time prefix="publish_" time=$article.publish_date display_seconds=false}&nbsp;{$siteTimeZone}</span>
								{formhelp note="If the article type allows it, this article will not be displayed <strong>before</strong> this date."}
							{/forminput}
						</div>

						<div class="form-group">
							<input type="hidden" name="expireDateInput" value="1" />
							{formlabel label="Expiration Date" for=""}
							{forminput}
								{html_select_date prefix="expire_" time=$article.expire_date start_year="-5" end_year="+10"} {tr}at{/tr}&nbsp;
								<span dir="ltr">{html_select_time prefix="expire_" time=$article.expire_date display_seconds=false}&nbsp;{$siteTimeZone}</span>
								{formhelp note="If the article type allows it, this article will not be displayed <strong>after</strong> this date."}
							{/forminput}
						</div>
					{/legend}
				{/jstab}

				{if $gBitSystem->isFeatureActive( 'articles_attachments' ) && $gBitUser->hasPermission('p_liberty_attach_attachments') }
					{jstab title="Attachments"}
						{legend legend="Attachment Browser"}
							{include file="bitpackage:liberty/edit_storage.tpl" formid="writearticle"}
						{/legend}
					{/jstab}
				{/if}

			{/jstabs}
		{/form}
	</div><!-- end .body -->
</div><!-- end .article -->
{/strip}