aboutsummaryrefslogtreecommitdiff
path: root/app/views/configure/archiving.phtml
blob: 7d76e4dccd51d82a76da5ae8dc561dd1257b87f9 (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
<?php $this->partial('aside_configure'); ?>

<div class="post">
	<a href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>

	<form method="post" action="<?= _url('configure', 'archiving') ?>">
		<input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
		<legend><?= _t('conf.archiving') ?></legend>
		<p><?= _i('help') ?> <?= _t('conf.archiving.help') ?></p>

		<div class="form-group">
			<label class="group-name" for="ttl_default"><?= _t('conf.archiving.ttl') ?></label>
			<div class="group-controls">
				<select class="number" name="ttl_default" id="ttl_default" required="required" data-leave-validation="<?= FreshRSS_Context::$user_conf->ttl_default ?>"><?php
					$found = false;
					foreach (array(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') as $v => $t) {
						echo '<option value="' . $v . (FreshRSS_Context::$user_conf->ttl_default == $v ? '" selected="selected' : '') . '">' . $t . '</option>';
						if (FreshRSS_Context::$user_conf->ttl_default == $v) {
							$found = true;
						}
					}
					if (!$found) {
						echo '<option value="' . intval(FreshRSS_Context::$user_conf->ttl_default) . '" selected="selected">' . intval(FreshRSS_Context::$user_conf->ttl_default) . 's</option>';
					}
				?></select> (<?= _t('gen.short.by_default') ?>)
			</div>
		</div>

		<p class="alert alert-warn">
			<?= _t('conf.archiving.policy_warning') ?>
		</p>

		<div class="form-group">
			<label class="group-name"><?= _t('conf.archiving.policy') ?><br /><small>(<?= _t('gen.short.by_default') ?>)</small></label>
			<div class="group-controls">
				<label class="checkbox" for="enable_keep_max">
					<input type="checkbox" name="enable_keep_max" id="enable_keep_max" value="1"<?= empty(FreshRSS_Context::$user_conf->archiving['keep_max']) ? '' : ' checked="checked"' ?> data-leave-validation="<?= empty(FreshRSS_Context::$user_conf->archiving['keep_max']) ? 0 : 1 ?>"/>
					<?= _t('conf.archiving.keep_max') ?>
					<?php $keepMax = empty(FreshRSS_Context::$user_conf->archiving['keep_max']) ? 200 : FreshRSS_Context::$user_conf->archiving['keep_max']; ?>
					<input type="number" id="keep_max" name="keep_max" min="0" value="<?= $keepMax ?>" data-leave-validation="<?= $keepMax ?>"/>
				</label>
			</div>
		</div>

		<div class="form-group">
			<div class="group-controls">
				<label class="checkbox" for="enable_keep_period">
					<input type="checkbox" name="enable_keep_period" id="enable_keep_period" value="1"<?= FreshRSS_Context::$user_conf->volatile['enable_keep_period'] ? ' checked="checked"' : '' ?> data-leave-validation="<?= FreshRSS_Context::$user_conf->volatile['enable_keep_period'] ? 1 : 0 ?>"/>
					<?= _t('conf.archiving.keep_period') ?>
					<input type="number" id="keep_period_count" name="keep_period_count" min="0" value="<?= FreshRSS_Context::$user_conf->volatile['keep_period_count'] ?>" data-leave-validation="<?= FreshRSS_Context::$user_conf->volatile['keep_period_count'] ?>"/>
					<select class="number" name="keep_period_unit" id="keep_period_unit" data-leave-validation="<?= FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ?>">
						<option></option>
						<option value="P1Y" <?= 'P1Y' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.years') ?></option>
						<option value="P1M" <?= 'P1M' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.months') ?></option>
						<option value="P1W" <?= 'P1W' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.weeks') ?></option>
						<option value="P1D" <?= 'P1D' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.days') ?></option>
						<option value="PT1H" <?= 'PT1H' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.hours') ?></option>
					</select>
				</label>
			</div>
		</div>

		<div class="form-group">
			<label class="group-name"><?= _t('conf.archiving.exception') ?><br /><small>(<?= _t('gen.short.by_default') ?>)</small></label>
			<div class="group-controls">
				<label class="checkbox" for="keep_favourites">
					<input type="checkbox" name="keep_favourites" id="keep_favourites" value="1"<?= FreshRSS_Context::$user_conf->archiving['keep_favourites'] !== false ? ' checked="checked"' : '' ?> data-leave-validation="<?= FreshRSS_Context::$user_conf->archiving['keep_favourites'] !== false ? 1 : 0 ?>"/>
					<?= _t('conf.archiving.keep_favourites') ?>
				</label>
			</div>
		</div>

		<div class="form-group">
			<div class="group-controls">
				<label class="checkbox" for="keep_labels">
					<input type="checkbox" name="keep_labels" id="keep_labels" value="1"<?= FreshRSS_Context::$user_conf->archiving['keep_labels'] !== false ? ' checked="checked"' : '' ?> data-leave-validation="<?= FreshRSS_Context::$user_conf->archiving['keep_labels'] !== false ? 1 : 0 ?>"/>
					<?= _t('conf.archiving.keep_labels') ?>
				</label>
			</div>
		</div>

		<div class="form-group">
			<div class="group-controls">
				<label class="checkbox" for="keep_unreads">
					<input type="checkbox" name="keep_unreads" id="keep_unreads" value="1"<?= FreshRSS_Context::$user_conf->archiving['keep_unreads'] ? ' checked="checked"' : '' ?> data-leave-validation="<?= FreshRSS_Context::$user_conf->archiving['keep_unreads'] ? 1 : 0 ?>"/>
					<?= _t('conf.archiving.keep_unreads') ?>
				</label>
			</div>
		</div>

		<div class="form-group">
			<div class="group-controls">
				<label for="keep_min_default"><?= _t('conf.archiving.keep_min_by_feed') ?>
					<input type="number" id="keep_min_default" name="keep_min_default" min="0" value="<?= FreshRSS_Context::$user_conf->archiving['keep_min'] ?>" data-leave-validation="<?= FreshRSS_Context::$user_conf->archiving['keep_min'] ?>">
				</label>
			</div>
		</div>

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

	<legend><?= _t('conf.archiving.maintenance') ?></legend>
	<form method="post" action="<?= _url('entry', 'purge') ?>">
		<input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />

		<div class="form-group">
			<label class="group-name"><?= _t('conf.user.current') ?></label>
			<div class="group-controls">
				<?= _t('conf.user.articles_and_size', format_number($this->nb_total), format_bytes($this->size_user)) ?>
			</div>
		</div>

		<div class="form-group">
			<div class="group-controls">
				<button type="submit" class="btn btn-important confirm"><?= _t('conf.archiving.purge_now') ?></button>
			</div>
		</div>
	</form>

	<form method="post" action="<?= _url('entry', 'optimize') ?>">
		<input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
		<div class="form-group">
			<div class="group-controls">
				<input type="hidden" name="optimiseDatabase" value="1" />
				<button type="submit" class="btn btn-important"><?= _t('conf.archiving.optimize') ?></button>
				<?= _i('help') ?> <?= _t('conf.archiving.optimize_help') ?>
			</div>
		</div>
	</form>

	<?php if (FreshRSS_Auth::hasAccess('admin')): ?>
	<div class="form-group">
		<label class="group-name"><?= _t('conf.user.users') ?></label>
		<div class="group-controls">
			<?= format_bytes($this->size_total) ?>
		</div>
	</div>
	<?php endif; ?>
</div>