-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UI Filters (Implementation) #1253
Closed
Closed
Changes from all commits
Commits
Show all changes
95 commits
Select commit
Hold shift + click to select a range
81d79cb
cp: First draft for Filters, mostly copied from Forms for the beginning
alex40724 b243563
cp: Second draft, more cleaned up
alex40724 60e3e00
cp: Ready for Pull Request
alex40724 d3da70f
cp: Wording
alex40724 8d3a133
cp: Changes for Filter Field
alex40724 c2e3a55
cp: fixed some rules
alex40724 fa9cf08
cp: very, very basic filter ideas
alex40724 ac62423
cp: Changes from comments and JF
alex40724 e65b82c
cp: Trifle
alex40724 679f9d4
cp: Trifle again
alex40724 12bb6c7
cp: Still basic Filter Service ideas
alex40724 7b964cb
cp: Still basic Filter Service ideas 2
alex40724 6980bc1
cp: sketched processing
alex40724 1a84294
cp: First try to get data from request
alex40724 8e2ba4d
cp: merged filter changes from 5_4_cat_filters2 up to b411ae1 (withou…
alex40724 c22dc23
cp: merged filter changes from 5_4_cat_filters2 up to 8820e63
alex40724 98257d6
cp: merged filter changes from 5_4_cat_filters2 up to 9198d37
alex40724 3e97cce
cp: Basic functionality of showing Labels and Values in the Filter Ba…
alex40724 3d624d0
cp: First ideas for Add-Button and Remove-Glyph
alex40724 c6a76e2
cp: merged changes from 5_4_cat_filters2 of c872761
alex40724 e7dfba2
updated style json, composer autoloader and delos.css
alex40724 ee51ef2
use correct glyphs
alex40724 f88d8ce
accordion behavior for popovers in mobile view
alex40724 92e52c7
force expanded if activated and non-mobile
alex40724 64303ce
fixed form submission
alex40724 1f94a72
add select
alex40724 8f683c9
add select
alex40724 7e862be
fixed value being displayed in proxy
alex40724 a4b6374
fixed session handling for values
alex40724 5fc92ae
Behavior for removing and adding Inputs to the Filter
tfamula f3ff476
Merge branch '5_4_ks_filter2' of https://github.com/leifos-gmbh/ILIAS…
tfamula d35d21d
fixed getting data from service
alex40724 3cd3e77
Merge branch '5_4_ks_filter2' of https://github.com/leifos-gmbh/ILIAS…
alex40724 e1775cd
Removed double inheritance
tfamula 14dd515
Merge branch '5_4_ks_filter2' of https://github.com/leifos-gmbh/ILIAS…
tfamula da06741
restored tabindex
alex40724 bd7365c
Accessibility for Input Fields and improvement for adding Input Fields
tfamula fa50bc8
show/hide filter behaviour
alex40724 61dceeb
Merge branch '5_4_ks_filter2' of https://github.com/leifos-gmbh/ILIAS…
alex40724 bd24bf3
polished ui service
alex40724 ea195e5
updated readme
alex40724 51e956c
polished renderer
alex40724 c2ea99d
some less cleanup, more needed, and variables
alex40724 1c71b4e
some less, js polishing, needs more
alex40724 424b0da
fixed some type hints
alex40724 c25355e
moved action generating to request adapter
alex40724 b51fc9e
added missing mem vars
alex40724 4e953e7
added missing mem vars
alex40724 ce0a9dd
added missing purpose/rules
alex40724 5a8c21b
Less variables + cleanup
tfamula c1c688d
get rid of DIC dependency
alex40724 c2c1678
Started Filter tests
tfamula cba40b2
fixed duplicate class name
alex40724 3b18241
cherry picked 06871bf4bb5ad38473ef2be5f61c90db3f09ba1a from loading a…
alex40724 a7bc273
fixed more tests
alex40724 d3dcb30
Update Services/Init/classes/class.ilInitialisation.php
klees b1d21f0
Update Services/UI/classes/class.ilUIFilterService.php
klees bf9c1b6
Update Services/UI/classes/class.ilUIFilterService.php
klees 26e9643
Added some more tests
tfamula 617fcec
fixed tests; removed vardump
alex40724 863fc27
pass ui as dependency
alex40724 0123164
Render tests
tfamula 8790363
Merge branch '5_4_ks_filter2' of https://github.com/leifos-gmbh/ILIAS…
tfamula 403bc91
Fix for render tests
tfamula 085b554
POST tests
tfamula 35c32b8
first tests using get
alex40724 e950746
Second tests using GET
tfamula 239e5f6
GET not working actually
tfamula a1c2a37
GET with javascript
tfamula b8a6df1
GET with javascript 2
tfamula e025a72
Bugfix for filter request
tfamula 759c9e5
JS cleanup
tfamula 4083023
Removed double inheritance for Radio Input
tfamula 104dcc1
Temporary template change to prevent conflict with cherry-pick
tfamula 9bc415e
Interface, implementation and examples for disabled inputs
tfamula cd279da
Prevent request for disabled inputs
tfamula 5cda8e8
Disabled state for (dependant) group and section
tfamula 1a61065
Restoring template changes
tfamula efcd6f5
Filter deactivation with real disabled inputs
tfamula 9896a1c
Cherry pick from disabled input PR
tfamula eb2bdc0
Removed comment
tfamula 500848f
Added documentation and fixed tests
tfamula 232d3f9
Changes for disabled Tag Input
tfamula 6dcaf7a
Solved violation with immutability
tfamula b3596c6
Restructuring JS Code
tfamula c266690
Fix to prevent losing filter status when clicking on collapse without…
tfamula ed7bb0b
Removed too much code
tfamula 18a6a88
OnUpdate for all inputs
tfamula dfa2477
Filter improvements, part 1
tfamula 8ef5fd0
Filter improvements, part 2
tfamula 4f4d361
Small fixes
tfamula f91745b
Changes for expand/collapse Filter with Ajax
tfamula 77b6ba3
Bulky Button instead of Glyph in Filter Bar
tfamula 3a89a35
Slight border to separate Filter Bar from Inputs
tfamula c0a07e0
Design fixes for very long Filter Inputs
tfamula File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# UI Filter Service | ||
|
||
The filter service wraps the KS element of Standard Input Filters. It's main purpose is to manage the state of the filter and it's inputs in the user session. | ||
|
||
The basics methods are `$DIC->uiService()->filter()->standard()` to get a filter instance and `$DIC->uiService()->filter()->getData($filter)` to retrieve the data from the filter. | ||
|
||
This service is most probably a temporary solution until session and similar dependencies are handled differently by the UI framework. | ||
|
||
``` | ||
|
||
class fooGUI { | ||
|
||
function showListAndFilter() { | ||
|
||
//Step 0: Declare dependencies | ||
global $DIC; | ||
$ui = $DIC->ui()->factory(); | ||
$renderer = $DIC->ui()->renderer(); | ||
|
||
//Step 1: Define some input fields to plug into the filter. | ||
$title_input = $ui->input()->field()->text("Title"); | ||
$select = $ui->input()->field()->select("Selection", ["one" => "One", "two" => "Two", "three" => "Three"]); | ||
$with_def = $ui->input()->field()->text("With Default")->withValue("Def.Value"); | ||
$init_hide = $ui->input()->field()->text("Hidden initially"); | ||
|
||
//Step 2: Define the filter and attach the inputs. | ||
$action = $DIC->ctrl()->getLinkTargetByClass("ilsystemstyledocumentationgui", "entries", "", true); | ||
$filter = $DIC->uiService()->filter()->standard("filter_ID", $action, [ | ||
"title" => $title_input, | ||
"select" => $select, | ||
"with_def" => $with_def, | ||
"init_hide" => $init_hide, | ||
], | ||
[true, true, true, false], true, true); | ||
|
||
//Step 3: Get filter data | ||
$filter_data = $DIC->uiService()->filter()->getData($filter); | ||
|
||
//Step 4: Render the filter | ||
return $renderer->render($filter)."Filter Data: ".print_r($filter_data, true); | ||
} | ||
|
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thx for the example in the readme. |
||
|
||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<?php | ||
|
||
/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */ | ||
|
||
use \ILIAS\UI\Component\Input\Container\Filter; | ||
use \Psr\Http\Message\ServerRequestInterface; | ||
|
||
/** | ||
* Request adapter for filter | ||
* | ||
* @author [email protected] | ||
* @ingroup ServicesUI | ||
*/ | ||
class ilUIFilterRequestAdapter | ||
{ | ||
const CMD_PARAMETER = "cmdFilter"; | ||
const RENDER_INPUT_BASE = "__filter_status_"; | ||
|
||
/** | ||
* @var ServerRequestInterface | ||
*/ | ||
protected $request; | ||
|
||
/** | ||
* query params | ||
* @var array | ||
*/ | ||
protected $params; | ||
|
||
/** | ||
* post data | ||
* @var array|null | ||
*/ | ||
protected $post; | ||
|
||
/** | ||
* Constructor | ||
*/ | ||
public function __construct(ServerRequestInterface $request) | ||
{ | ||
$this->request = $request; | ||
$this->params = $this->request->getQueryParams(); | ||
$this->post = $this->request->getParsedBody(); | ||
} | ||
|
||
/** | ||
* Get filter command | ||
* @return string | ||
*/ | ||
public function getFilterCmd(): string | ||
{ | ||
if (isset($this->params[self::CMD_PARAMETER])) | ||
{ | ||
return (string) $this->params[self::CMD_PARAMETER]; | ||
} | ||
return ""; | ||
} | ||
|
||
/** | ||
* Has an input field been rendered in current post request? | ||
* | ||
* @param $input_id | ||
* @return bool | ||
*/ | ||
public function isInputRendered($input_id): bool | ||
{ | ||
if (isset($this->params[self::RENDER_INPUT_BASE . $input_id]) && | ||
$this->params[self::RENDER_INPUT_BASE . $input_id] === "1") | ||
{ | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
/** | ||
* Get filter with request data | ||
* | ||
* @param Filter\Standard $filter | ||
* @return Filter\Standard | ||
*/ | ||
public function getFilterWithRequest(Filter\Standard $filter): Filter\Standard | ||
{ | ||
return $filter->withRequest($this->request); | ||
} | ||
|
||
/** | ||
* Get action for filter command | ||
* | ||
* @param string $base_action | ||
* @param string $filter_cmd | ||
* @return string | ||
*/ | ||
public function getAction(string $base_action, string $filter_cmd): string | ||
{ | ||
return $base_action."&".self::CMD_PARAMETER."=".$filter_cmd; | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't render the values that the user entered imo. They are added from POST in
getData
, but the updated$filter
is never retrieved. Thus$filter
here only contains the values that where initially set to the fields.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean "won't" render? Did you try the example in the KS? You enter some data in the "Title" field, hit "Apply" (Do not use "Enter" key, this needs fixing) and the data is retrieved and displayed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just now noticed, that you effectively add the POST-data to the input twice, once in
handleApply
, once ingetData
. This was irritating but should work.