summaryrefslogtreecommitdiff
path: root/app/views/helpers/feed/update.phtml
blob: 72084d8fa311184473f84cbb18b8c551d7cbeeb9 (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
174
175
176
177
178
179
180
181
182
<div class="post">
	<h1><?php echo $this->feed->name(); ?></h1>

	<div>
		<a href="<?php echo _url('index', 'index', 'get', 'f_' . $this->feed->id()); ?>"><?php echo _i('link'); ?> <?php echo _t('gen.action.filter'); ?></a>
		<?php echo _t('gen.short.or'); ?>
		<a href="<?php echo _url('stats', 'repartition', 'id', $this->feed->id()); ?>"><?php echo _i('stats'); ?> <?php echo _t('sub.feed.stats'); ?></a>
	</div>

	<p><?php echo $this->feed->description(); ?></p>

	<?php $nbEntries = $this->feed->nbEntries(); ?>

	<?php if ($this->feed->inError()) { ?>
	<p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('sub.feed.error'); ?></p>
	<?php } elseif ($nbEntries === 0) { ?>
	<p class="alert alert-warn"><?php echo _t('sub.feed.empty'); ?></p>
	<?php } ?>

	<form method="post" action="<?php echo _url('subscription', 'feed', 'id', $this->feed->id()); ?>" autocomplete="off">
		<legend><?php echo _t('sub.feed.informations'); ?></legend>
		<div class="form-group">
			<label class="group-name" for="name"><?php echo _t('sub.feed.title'); ?></label>
			<div class="group-controls">
				<input type="text" name="name" id="name" class="extend" value="<?php echo $this->feed->name() ; ?>" />
			</div>
		</div>
		<div class="form-group">
			<label class="group-name" for="description"><?php echo _t('sub.feed.description'); ?></label>
			<div class="group-controls">
				<textarea name="description" id="description"><?php echo htmlspecialchars($this->feed->description(), ENT_NOQUOTES, 'UTF-8'); ?></textarea>
			</div>
		</div>
		<div class="form-group">
			<label class="group-name" for="website"><?php echo _t('sub.feed.website'); ?></label>
			<div class="group-controls">
				<div class="stick">
					<input type="text" name="website" id="website" class="extend" value="<?php echo $this->feed->website(); ?>" />
					<a class="btn" target="_blank" href="<?php echo $this->feed->website(); ?>"><?php echo _i('link'); ?></a>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="group-name" for="url"><?php echo _t('sub.feed.url'); ?></label>
			<div class="group-controls">
				<div class="stick">
					<input type="text" name="url" id="url" class="extend" value="<?php echo $this->feed->url(); ?>" />
					<a class="btn" target="_blank" href="<?php echo $this->feed->url(); ?>"><?php echo _i('link'); ?></a>
				</div>

				<a class="btn" target="_blank" href="http://validator.w3.org/feed/check.cgi?url=<?php echo rawurlencode(htmlspecialchars_decode($this->feed->url(), ENT_QUOTES)); ?>"><?php echo _t('sub.feed.validator'); ?></a>
			</div>
		</div>
		<div class="form-group">
			<label class="group-name" for="category"><?php echo _t('sub.category'); ?></label>
			<div class="group-controls">
				<select name="category" id="category">
				<?php foreach ($this->categories as $cat) { ?>
				<option value="<?php echo $cat->id(); ?>"<?php echo $cat->id()== $this->feed->category() ? ' selected="selected"' : ''; ?>>
					<?php echo $cat->name(); ?>
				</option>
				<?php } ?>
				</select>
			</div>
		</div>
		<div class="form-group">
			<label class="group-name" for="priority"><?php echo _t('sub.feed.in_main_stream'); ?></label>
			<div class="group-controls">
				<label class="checkbox" for="priority">
					<input type="checkbox" name="priority" id="priority" value="10"<?php echo $this->feed->priority() > 0 ? ' checked="checked"' : ''; ?> />
					<?php echo _t('gen.short.yes'); ?>
				</label>
			</div>
		</div>

		<div class="form-group form-actions">
			<div class="group-controls">
				<button class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button>
				<button class="btn btn-attention confirm"
				        data-str-confirm="<?php echo _t('gen.js.confirm_action_feed_cat'); ?>"
				        formaction="<?php echo _url('feed', 'delete', 'id', $this->feed->id()); ?>"
				        formmethod="post"><?php echo _t('gen.action.remove'); ?></button>
			</div>
		</div>

		<legend><?php echo _t('sub.feed.archiving'); ?></legend>

		<div class="form-group">
			<div class="group-controls">
				<div class="stick">
					<input type="text" value="<?php echo _t('sub.feed.number_entries', $nbEntries); ?>" disabled="disabled" />
					<a class="btn" href="<?php echo _url('feed', 'actualize', 'id', $this->feed->id()); ?>">
						<?php echo _i('refresh'); ?> <?php echo _t('gen.action.actualize'); ?>
					</a>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="group-name" for="keep_history"><?php echo _t('sub.feed.keep_history'); ?></label>
			<div class="group-controls">
				<select class="number" name="keep_history" id="keep_history" required="required"><?php
					foreach (array('' => '', -2 => _t('gen.short.by_default'), 0 => '0', 10 => '10', 50 => '50', 100 => '100', 500 => '500', 1000 => '1 000', 5000 => '5 000', 10000 => '10 000', -1 => '∞') as $v => $t) {
						echo '<option value="' . $v . ($this->feed->keepHistory() === $v ? '" selected="selected' : '') . '">' . $t . '</option>';
					}
				?></select>
			</div>
		</div>
		<div class="form-group">
			<label class="group-name" for="ttl"><?php echo _t('sub.feed.ttl'); ?></label>
			<div class="group-controls">
				<select class="number" name="ttl" id="ttl" required="required"><?php
					$found = false;
					foreach (array(-2 => _t('gen.short.by_default'), 900 => '15min', 1200 => '20min', 1500 => '25min', 1800 => '30min', 2700 => '45min',
					                3600 => '1h', 5400 => '1.5h', 7200 => '2h', 10800 => '3h', 14400 => '4h', 18800 => '5h', 21600 => '6h', 25200 => '7h', 28800 => '8h',
					                36000 => '10h', 43200 => '12h', 64800 => '18h',
					                86400 => '1d', 129600 => '1.5d', 172800 => '2d', 259200 => '3d', 345600 => '4d', 432000 => '5d', 518400 => '6d',
					                604800 => '1wk', 1209600 => '2wk', 1814400 => '3wk', 2419200 => '4wk', 2629744 => '1mo', -1 => '∞') as $v => $t) {
						echo '<option value="' . $v . ($this->feed->ttl() === $v ? '" selected="selected' : '') . '">' . $t . '</option>';
						if ($this->feed->ttl() == $v) {
							$found = true;
						}
					}
					if (!$found) {
						echo '<option value="' . intval($this->feed->ttl()) . '" selected="selected">' . intval($this->feed->ttl()) . 's</option>';
					}
				?></select>
			</div>
		</div>
		<div class="form-group">
			<label class="group-name" for="pubsubhubbub"><?php echo _t('sub.feed.pubsubhubbub'); ?></label>
			<div class="group-controls">
				<label class="checkbox" for="pubsubhubbub">
					<input type="checkbox" name="pubsubhubbub" id="pubsubhubbub" disabled="disabled" value="1"<?php echo $this->feed->pubSubHubbubEnabled() ? ' checked="checked"' : ''; ?> />
				</label>
			</div>
		</div>
		<div class="form-group form-actions">
			<div class="group-controls">
				<button class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button>
				<button class="btn btn-attention confirm" formmethod="post" formaction="<?php echo _url('feed', 'truncate', 'id', $this->feed->id()); ?>"><?php echo _t('gen.action.truncate'); ?></button>
			</div>
		</div>

		<legend><?php echo _t('sub.feed.auth.configuration'); ?></legend>
		<?php $auth = $this->feed->httpAuth(false); ?>
		<div class="form-group">
			<label class="group-name" for="http_user_feed<?php echo $this->feed->id(); ?>"><?php echo _t('sub.feed.auth.username'); ?></label>
			<div class="group-controls">
				<input type="text" name="http_user_feed<?php echo $this->feed->id(); ?>" id="http_user_feed<?php echo $this->feed->id(); ?>" class="extend" value="<?php echo empty($auth['username']) ? ' ' : $auth['username']; ?>" autocomplete="off" />
				<?php echo _i('help'); ?> <?php echo _t('sub.feed.auth.help'); ?>
			</div>

			<label class="group-name" for="http_pass_feed<?php echo $this->feed->id(); ?>"><?php echo _t('sub.feed.auth.password'); ?></label>
			<div class="group-controls">
				<input type="password" name="http_pass_feed<?php echo $this->feed->id(); ?>" id="http_pass_feed<?php echo $this->feed->id(); ?>" class="extend" value="<?php echo $auth['password']; ?>" autocomplete="off" />
			</div>
		</div>

		<div class="form-group form-actions">
			<div class="group-controls">
				<button type="submit" class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button>
				<button type="reset" class="btn"><?php echo _t('gen.action.cancel'); ?></button>
			</div>
		</div>

		<legend><?php echo _t('sub.feed.advanced'); ?></legend>
		<div class="form-group">
			<label class="group-name" for="path_entries"><?php echo _t('sub.feed.css_path'); ?></label>
			<div class="group-controls">
				<input type="text" name="path_entries" id="path_entries" class="extend" value="<?php echo $this->feed->pathEntries(); ?>" placeholder="<?php echo _t('gen.short.blank_to_disable'); ?>" />
				<?php echo _i('help'); ?> <?php echo _t('sub.feed.css_help'); ?>
			</div>
		</div>

		<div class="form-group form-actions">
			<div class="group-controls">
				<button type="submit" class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button>
				<button type="reset" class="btn"><?php echo _t('gen.action.cancel'); ?></button>
			</div>
		</div>
	</form>
</div>