summaryrefslogtreecommitdiffstats
path: root/web/template
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2015-06-13 15:27:28 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2015-06-14 17:58:55 +0200
commit5fb7a74e23b2059ec0c1acb72d8d804adbf05c52 (patch)
treeae04e34d7dd30bcd0bc913c910c4d9b9feb8a4ee /web/template
parent4c1bb8b7e510dd85b290f43c2439ca2f017d0dd6 (diff)
downloadaur-5fb7a74e23b2059ec0c1acb72d8d804adbf05c52.tar.gz
aur-5fb7a74e23b2059ec0c1acb72d8d804adbf05c52.tar.xz
Replace categories with keywords
Remove package base categories. Instead, users can now specify up to twenty custom keywords that are taken into consideration when searching. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'web/template')
-rw-r--r--web/template/pkg_details.php25
-rw-r--r--web/template/pkg_search_form.php14
-rw-r--r--web/template/pkg_search_results.php2
-rw-r--r--web/template/pkgbase_details.php25
4 files changed, 16 insertions, 50 deletions
diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php
index e50f0293..cc2f055c 100644
--- a/web/template/pkg_details.php
+++ b/web/template/pkg_details.php
@@ -11,7 +11,7 @@ $uid = uid_from_sid($SID);
$pkgid = intval($row['ID']);
$base_id = intval($row['BaseID']);
-$catarr = pkgbase_categories();
+$keywords = pkgbase_get_keywords($base_id);
$submitter = username_from_id($row["SubmitterUID"]);
$maintainer = username_from_id($row["MaintainerUID"]);
@@ -188,34 +188,25 @@ $sources = pkg_sources($row["ID"]);
<th><?= __('Upstream URL') . ': ' ?></th>
<td><a href="<?= htmlspecialchars($row['URL'], ENT_QUOTES) ?>" title="<?= __('Visit the website for') . ' ' . htmlspecialchars( $row['Name'])?>"><?= htmlspecialchars($row['URL'], ENT_QUOTES) ?></a></td>
</tr>
- <tr>
- <th><?= __('Category') . ': ' ?></th>
<?php
-if (has_credential(CRED_PKGBASE_CHANGE_CATEGORY, array($row["MaintainerUID"]))):
+if (has_credential(CRED_PKGBASE_SET_KEYWORDS, array($row["MaintainerUID"]))):
?>
+ <tr>
+ <th><?= __('Keywords') . ': ' ?></th>
<td>
<form method="post" action="<?= htmlspecialchars(get_pkgbase_uri($row['BaseName']), ENT_QUOTES); ?>">
<div>
- <input type="hidden" name="action" value="do_ChangeCategory" />
+ <input type="hidden" name="action" value="do_SetKeywords" />
<?php if ($SID): ?>
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
<?php endif; ?>
- <select name="category_id">
-<?php
- foreach ($catarr as $cid => $catname):
-?>
- <option value="<?= $cid ?>"<?php if ($cid == $row["CategoryID"]) { ?> selected="selected" <?php } ?>><?= $catname ?></option>
- <?php endforeach; ?>
- </select>
- <input type="submit" value="<?= __('Change category') ?>"/>
+ <input type="text" name="keywords" value="<?= htmlspecialchars(implode(" ", $keywords), ENT_QUOTES) ?>"/>
+ <input type="submit" value="<?= __('Update') ?>"/>
</div>
</form>
-<?php else: ?>
- <td>
- <a href="<?= get_uri('/packages/'); ?>?C=<?= $row['CategoryID'] ?>"><?= $row['Category'] ?></a>
-<?php endif; ?>
</td>
</tr>
+<?php endif; ?>
<?php if (count($lics) > 0): ?>
<tr>
<th><?= __('Licenses') . ': ' ?></th>
diff --git a/web/template/pkg_search_form.php b/web/template/pkg_search_form.php
index 683675b1..2d03cfa5 100644
--- a/web/template/pkg_search_form.php
+++ b/web/template/pkg_search_form.php
@@ -19,7 +19,6 @@ $outdated_flags = array(
$sortby = array(
'n' => __('Name'),
- 'c' => __('Category'),
'v' => __('Votes'),
'p' => __('Popularity'),
'w' => __('Voted'),
@@ -45,19 +44,6 @@ $per_page = array(50, 100, 250);
<fieldset>
<legend><?= __('Enter search criteria') ?></legend>
<div>
- <label for="id_category"><?= __("Category"); ?></label>
- <select name='C' id="id_category">
- <option value='0'><?= __("Any"); ?></option>
- <?php foreach (pkgbase_categories() as $id => $cat): ?>
- <?php if (isset($_REQUEST['C']) && $_REQUEST['C'] == $id): ?>
- <option value="<?= $id ?>" selected="selected"><?= $cat; ?></option>
- <?php else: ?>
- <option value="<?= $id ?>"><?= $cat; ?></option>
- <?php endif; ?>
- <?php endforeach; ?>
- </select>
- </div>
- <div>
<label for="id_method"><?= __("Search by"); ?></label>
<select name='SeB'>
<?php foreach ($searchby as $k => $v): ?>
diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php
index 5289b78e..13d9bfca 100644
--- a/web/template/pkg_search_results.php
+++ b/web/template/pkg_search_results.php
@@ -32,7 +32,6 @@ if (!$result): ?>
<?php if ($SID): ?>
<th>&nbsp;</th>
<?php endif; ?>
- <th><a href="?<?= mkurl('SB=c&SO=' . $SO_next) ?>"><?= __("Category") ?></a></th>
<th><a href="?<?= mkurl('SB=n&SO=' . $SO_next) ?>"><?= __("Name") ?></a></th>
<th><?= __("Version") ?></th>
<th><a href="?<?= mkurl('SB=v&SO=' . $SO_next) ?>"><?= __("Votes") ?></a></th>
@@ -52,7 +51,6 @@ if (!$result): ?>
<?php if ($SID): ?>
<td><input type="checkbox" name="IDs[<?= $row["PackageBaseID"] ?>]" value="1" /></td>
<?php endif; ?>
- <td><?= htmlspecialchars($row["Category"]) ?></td>
<td><a href="<?= htmlspecialchars(get_pkg_uri($row["Name"]), ENT_QUOTES); ?>"><?= htmlspecialchars($row["Name"]) ?></a></td>
<td<?php if ($row["OutOfDateTS"]): ?> class="flagged"<?php endif; ?>><?= htmlspecialchars($row["Version"]) ?></td>
<td><?= $row["NumVotes"] ?></td>
diff --git a/web/template/pkgbase_details.php b/web/template/pkgbase_details.php
index 2ef8788a..2522f34d 100644
--- a/web/template/pkgbase_details.php
+++ b/web/template/pkgbase_details.php
@@ -10,7 +10,7 @@ $uid = uid_from_sid($SID);
$base_id = intval($row['ID']);
-$catarr = pkgbase_categories();
+$keywords = pkgbase_get_keywords($base_id);
$submitter = username_from_id($row["SubmitterUID"]);
$maintainer = username_from_id($row["MaintainerUID"]);
@@ -127,34 +127,25 @@ $pkgs = pkgbase_get_pkgnames($base_id);
<?php endif; ?>
</td>
</tr>
- <tr>
- <th><?= __('Category') . ': ' ?></th>
<?php
-if (has_credential(CRED_PKGBASE_CHANGE_CATEGORY, array($row["MaintainerUID"]))):
+if (has_credential(CRED_PKGBASE_SET_KEYWORDS, array($row["MaintainerUID"]))):
?>
+ <tr>
+ <th><?= __('Keywords') . ': ' ?></th>
<td>
<form method="post" action="<?= htmlspecialchars(get_pkgbase_uri($row['Name']), ENT_QUOTES); ?>">
<div>
- <input type="hidden" name="action" value="do_ChangeCategory" />
+ <input type="hidden" name="action" value="do_SetKeywords" />
<?php if ($SID): ?>
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
<?php endif; ?>
- <select name="category_id">
-<?php
- foreach ($catarr as $cid => $catname):
-?>
- <option value="<?= $cid ?>"<?php if ($cid == $row["CategoryID"]) { ?> selected="selected" <?php } ?>><?= $catname ?></option>
- <?php endforeach; ?>
- </select>
- <input type="submit" value="<?= __('Change category') ?>"/>
+ <input type="text" name="keywords" value="<?= htmlspecialchars(implode(" ", $keywords), ENT_QUOTES) ?>"/>
+ <input type="submit" value="<?= __('Update') ?>"/>
</div>
</form>
-<?php else: ?>
- <td>
- <a href="<?= get_uri('/packages/'); ?>?C=<?= $row['CategoryID'] ?>"><?= $row['Category'] ?></a>
-<?php endif; ?>
</td>
</tr>
+<?php endif; ?>
<tr>
<th><?= __('Submitter') .': ' ?></th>
<?php if ($row["SubmitterUID"] && $SID): ?>