Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13972679
D10230.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
8 KB
Referenced Files
None
Subscribers
None
D10230.diff
View Options
diff --git a/resources/sql/autopatches/20140812.projkey.1.sql b/resources/sql/autopatches/20140812.projkey.1.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20140812.projkey.1.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_project.project
+ ADD KEY `key_icon` (icon);
diff --git a/resources/sql/autopatches/20140812.projkey.2.sql b/resources/sql/autopatches/20140812.projkey.2.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20140812.projkey.2.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_project.project
+ ADD KEY `key_color` (color);
diff --git a/src/applications/project/controller/PhabricatorProjectEditDetailsController.php b/src/applications/project/controller/PhabricatorProjectEditDetailsController.php
--- a/src/applications/project/controller/PhabricatorProjectEditDetailsController.php
+++ b/src/applications/project/controller/PhabricatorProjectEditDetailsController.php
@@ -144,11 +144,7 @@
->setError($e_name));
$field_list->appendFieldsToForm($form);
- $shades = PHUITagView::getShadeMap();
- $shades = array_select_keys(
- $shades,
- array(PhabricatorProject::DEFAULT_COLOR)) + $shades;
- unset($shades[PHUITagView::COLOR_DISABLED]);
+ $shades = PhabricatorProjectIcon::getColorMap();
$icon_uri = $this->getApplicationURI('icon/'.$project->getID().'/');
$icon_display = PhabricatorProjectIcon::renderIconForChooser($v_icon);
diff --git a/src/applications/project/icon/PhabricatorProjectIcon.php b/src/applications/project/icon/PhabricatorProjectIcon.php
--- a/src/applications/project/icon/PhabricatorProjectIcon.php
+++ b/src/applications/project/icon/PhabricatorProjectIcon.php
@@ -24,6 +24,16 @@
);
}
+ public static function getColorMap() {
+ $shades = PHUITagView::getShadeMap();
+ $shades = array_select_keys(
+ $shades,
+ array(PhabricatorProject::DEFAULT_COLOR)) + $shades;
+ unset($shades[PHUITagView::COLOR_DISABLED]);
+
+ return $shades;
+ }
+
public static function getLabel($key) {
$map = self::getIconMap();
return $map[$key];
diff --git a/src/applications/project/query/PhabricatorProjectQuery.php b/src/applications/project/query/PhabricatorProjectQuery.php
--- a/src/applications/project/query/PhabricatorProjectQuery.php
+++ b/src/applications/project/query/PhabricatorProjectQuery.php
@@ -10,6 +10,8 @@
private $phrictionSlugs;
private $names;
private $datasourceQuery;
+ private $icons;
+ private $colors;
private $status = 'status-any';
const STATUS_ANY = 'status-any';
@@ -63,6 +65,16 @@
return $this;
}
+ public function withIcons(array $icons) {
+ $this->icons = $icons;
+ return $this;
+ }
+
+ public function withColors(array $colors) {
+ $this->colors = $colors;
+ return $this;
+ }
+
public function needMembers($need_members) {
$this->needMembers = $need_members;
return $this;
@@ -244,28 +256,28 @@
$filter);
}
- if ($this->ids) {
+ if ($this->ids !== null) {
$where[] = qsprintf(
$conn_r,
'id IN (%Ld)',
$this->ids);
}
- if ($this->phids) {
+ if ($this->phids !== null) {
$where[] = qsprintf(
$conn_r,
'phid IN (%Ls)',
$this->phids);
}
- if ($this->memberPHIDs) {
+ if ($this->memberPHIDs !== null) {
$where[] = qsprintf(
$conn_r,
'e.dst IN (%Ls)',
$this->memberPHIDs);
}
- if ($this->slugs) {
+ if ($this->slugs !== null) {
$slugs = array();
foreach ($this->slugs as $slug) {
$slugs[] = rtrim(PhabricatorSlug::normalize($slug), '/');
@@ -277,20 +289,34 @@
$slugs);
}
- if ($this->phrictionSlugs) {
+ if ($this->phrictionSlugs !== null) {
$where[] = qsprintf(
$conn_r,
'phrictionSlug IN (%Ls)',
$this->phrictionSlugs);
}
- if ($this->names) {
+ if ($this->names !== null) {
$where[] = qsprintf(
$conn_r,
'name IN (%Ls)',
$this->names);
}
+ if ($this->icons !== null) {
+ $where[] = qsprintf(
+ $conn_r,
+ 'icon IN (%Ls)',
+ $this->icons);
+ }
+
+ if ($this->colors !== null) {
+ $where[] = qsprintf(
+ $conn_r,
+ 'color IN (%Ls)',
+ $this->colors);
+ }
+
$where[] = $this->buildPagingClause($conn_r);
return $this->formatWhereClause($where);
diff --git a/src/applications/project/query/PhabricatorProjectSearchEngine.php b/src/applications/project/query/PhabricatorProjectSearchEngine.php
--- a/src/applications/project/query/PhabricatorProjectSearchEngine.php
+++ b/src/applications/project/query/PhabricatorProjectSearchEngine.php
@@ -25,6 +25,14 @@
$saved->setParameter('status', $request->getStr('status'));
$saved->setParameter('name', $request->getStr('name'));
+ $saved->setParameter(
+ 'icons',
+ $this->readListFromRequest($request, 'icons'));
+
+ $saved->setParameter(
+ 'colors',
+ $this->readListFromRequest($request, 'colors'));
+
$this->readCustomFieldsFromRequest($request, $saved);
return $saved;
@@ -50,6 +58,16 @@
$query->withDatasourceQuery($name);
}
+ $icons = $saved->getParameter('icons');
+ if ($icons) {
+ $query->withIcons($icons);
+ }
+
+ $colors = $saved->getParameter('colors');
+ if ($colors) {
+ $query->withColors($colors);
+ }
+
$this->applyCustomFieldsToQuery($query, $saved);
return $query;
@@ -66,14 +84,45 @@
->execute();
$status = $saved->getParameter('status');
- $name = $saved->getParameter('name');
+ $name_match = $saved->getParameter('name');
+
+ $icons = array_fuse($saved->getParameter('icons', array()));
+ $colors = array_fuse($saved->getParameter('colors', array()));
+
+ $icon_control = id(new AphrontFormCheckboxControl())
+ ->setLabel(pht('Icons'));
+ foreach (PhabricatorProjectIcon::getIconMap() as $icon => $name) {
+ $image = id(new PHUIIconView())
+ ->setIconFont($icon);
+
+ $icon_control->addCheckbox(
+ 'icons[]',
+ $icon,
+ array($image, ' ', $name),
+ isset($icons[$icon]));
+ }
+
+ $color_control = id(new AphrontFormCheckboxControl())
+ ->setLabel(pht('Colors'));
+ foreach (PhabricatorProjectIcon::getColorMap() as $color => $name) {
+ $tag = id(new PHUITagView())
+ ->setType(PHUITagView::TYPE_SHADE)
+ ->setShade($color)
+ ->setName($name);
+
+ $color_control->addCheckbox(
+ 'colors[]',
+ $color,
+ $tag,
+ isset($colors[$color]));
+ }
$form
->appendChild(
id(new AphrontFormTextControl())
->setName('name')
->setLabel(pht('Name'))
- ->setValue($name))
+ ->setValue($name_match))
->appendChild(
id(new AphrontFormTokenizerControl())
->setDatasource(new PhabricatorPeopleDatasource())
@@ -85,7 +134,9 @@
->setLabel(pht('Status'))
->setName('status')
->setOptions($this->getStatusOptions())
- ->setValue($status));
+ ->setValue($status))
+ ->appendChild($icon_control)
+ ->appendChild($color_control);
$this->appendCustomFieldsToForm($form, $saved);
}
@@ -142,6 +193,20 @@
);
}
+ private function getColorValues() {
+
+ }
+
+ private function getIconValues() {
+
+ }
+
+ protected function getRequiredHandlePHIDsForResultList(
+ array $projects,
+ PhabricatorSavedQuery $query) {
+ return mpull($projects, 'getPHID');
+ }
+
protected function renderResultList(
array $projects,
PhabricatorSavedQuery $query,
@@ -169,10 +234,15 @@
),
pht('Members'));
+ $tag_list = id(new PHUIHandleTagListView())
+ ->setSlim(true)
+ ->setHandles(array($handles[$project->getPHID()]));
+
$item = id(new PHUIObjectItemView())
->setHeader($project->getName())
->setHref($this->getApplicationURI("view/{$id}/"))
->setImageURI($project->getProfileImageURI())
+ ->addAttribute($tag_list)
->addAttribute($workboards_url)
->addAttribute($members_url);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Oct 18 2024, 8:28 PM (4 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6714387
Default Alt Text
D10230.diff (8 KB)
Attached To
Mode
D10230: Allow projects to be filtered by icon and color
Attached
Detach File
Event Timeline
Log In to Comment