• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CodeExtinguisher 2.0 Release Candidate 14.2

[eluser]gusa[/eluser]
what's the meaning of codexcontroller:firstitem?
thanks!

i know that it retrieves the first item to be displayed in the Overview page (http://codeextinguisher.pbwiki.com/CodexController) but i still don't understand what's for.

[eluser]Majd Taby[/eluser]
gusa, CodeExtinguisher _used_ to have server side pagination, but i convertd it to client-side pagination so that ordering and pagination would work in a more intuitive way. Adding db pagination is actually very easy. Here's what you want to modify:

1) codexcontroller:ConfusedetupQuery
2) Remove the pagination code from view_modes/table.php and add your own.

[eluser]gusa[/eluser]
excellent! you are awesome.

another challenge to codex:

suppose there are two tables defined in my database: SALES(sa_id, ...) and LINES_OF_SALE(ls_id, ls_sa_id, ...). the second table has a foreign relationship with the first one, throw the field ls_sa_id.

when i edit a sale (in the sales form), i want to have access to the related LINES_OF_SALE. in other words, the perfect solution would be to have a sublist inside sale's form with the lines of sale. then i could edit one line of sale and get back to the corresponding sale.

if that's not possible, it's ok to me if i have a link (inside sales form) to the lines_of_sale controller but with the restriction that lines_of_sale should only display the data related to the editing sale.

is it possible to implement one of these solutions in codex?
maybe you have in mind another solution.

[eluser]Majd Taby[/eluser]
Have you looked at the DbDropDown, ManyToMany and OneToMany plugins?

[eluser]gusa[/eluser]
[quote author="jTaby" date="1212707847"]Have you looked at the DbDropDown, ManyToMany and OneToMany plugins?[/quote]

yeah. but what if LINES_OF_SALE has thousand of rows per each SALE?

[eluser]Majd Taby[/eluser]
what do you mean? the UI was changed in RC8 (I think) to handle that use case.

[eluser]gusa[/eluser]
[quote author="jTaby" date="1212708463"]what do you mean? the UI was changed in RC8 (I think) to handle that use case.[/quote]

ok. i'm not being clear enough.
maybe one example helps:

Code:
/*
SALES
+----------+----------+---------------+
| sa_id    | sa_obs   | sa_date       |
+----------+----------+---------------+
| 1        | bla      | 01/01/2008    |
+----------+----------+---------------+
| 2        | bla2     | 03/12/2008    |
+----------+----------+---------------+
| 3        | bla3     | 04/09/2008    |
+----------+----------+---------------+

LINES_OF_SALE

+----------+----------+---------+----------+
| ls_id    | ls_sa_id | ls_desc | ls_price |
+----------+----------+---------+----------+
| 1        | 1        | ...     | ...      |
+----------+----------+---------+----------+
| 2        | 1        | ...     | ...      |
+----------+----------+---------+----------+
| ...      | 1        | ...     | ...      |
+----------+----------+---------+----------+
| 100      | 2        | ...     | ...      |
+----------+----------+---------+----------+
| 101      | 2        | ...     | ...      |
+----------+----------+---------+----------+
| 102      | 2        | ...     | ...      |
+----------+----------+---------+----------+
| ...      | 2        | ...     | ...      |
+----------+----------+---------+----------+
| 514      | 3        | ...     | ...      |
+----------+----------+---------+----------+
| 515      | 3        | ...     | ...      |
+----------+----------+---------+----------+
| 516      | 3        | ...     | ...      |
+----------+----------+---------+----------+
| ...      | 3        | ...     | ...      |
+----------+----------+---------+----------+
*/

suppose i want to edit sale #1.
if i choose onetomany plugin, in the left pane i'll see all the rows from LINES_OF_SALE, which is exactly what i don't want. why should i see the lines of sales of sales #2 and #3. there's another issue: onetomany plugin (as far as i'm concerned) does not allow the user to edit the data.

the custom solution to this issue is to have a subform (sometimes called subfile). when the user adds or edits a sale, you can also add, edit or delete a line of sale (but only those that belongs to the sale).

taking in account that i have a deadline next week, i was wondering if i can find another solution (for example, to put a link in the sale's form to the corresponding lines of sale).

i hope i was clear enough this time.

[eluser]Majd Taby[/eluser]
Given your deadline, Here's what I would do:

1) Modify the one-to-many plugin so that you can add your own WHERE clause to the query through YAML. The changes to plugins/onetomany.php and plugins/relationalcontainer.php should be minimal.

2) As far as editing, deleting, you're correct, CodeExtinguisher doesn't support that, but now that you mention it, it would be a very nice addition. I can't promise you I can deliver on it on a week though. As an alternative, you can modify the RelationalContainer::getHTML() method to add a link that takes you to page to manage the related data.

I know it's not an optimal solution, but it works and if it's an option, you can update your clients' codex setup at a later time.

[eluser]gusa[/eluser]
[quote author="jTaby" date="1212713779"]Given your deadline, Here's what I would do:

1) Modify the one-to-many plugin so that you can add your own WHERE clause to the query through YAML. The changes to plugins/onetomany.php and plugins/relationalcontainer.php should be minimal.

2) As far as editing, deleting, you're correct, CodeExtinguisher doesn't support that, but now that you mention it, it would be a very nice addition. I can't promise you I can deliver on it on a week though. As an alternative, you can modify the RelationalContainer::getHTML() method to add a link that takes you to page to manage the related data.

I know it's not an optimal solution, but it works and if it's an option, you can update your clients' codex setup at a later time.[/quote]

ok, great. thanks.
however, my intuition says that there's another solution.
let's say that i have two controllers: sales and lines_of_sale.
i want to access lines_of_sale from the first controller, by:

1) putting a link in sales' overview table to the second controller (the url could be lines_of_sale/<sa_id>, where <sa_id> is the primary key of SALES),
2) lines_of_sale must restrict the search somehow ($this->table_access_restriction?),
3) once in lines_of_sale, the add and edit forms should remember the original call.

if that's possible, then i can save a lot of work.

the question is how can i hack codex to allow me to do that Big Grin

[eluser]abmcr[/eluser]
[quote author="gusa" date="1212716173"]
however, my intuition says that there's another solution.
let's say that i have two controllers: sales and lines_of_sale.
i want to access lines_of_sale from the first controller, by:

1) putting a link in sales' overview table to the second controller (the url could be lines_of_sale/<sa_id>, where <sa_id> is the primary key of SALES),
2) lines_of_sale must restrict the search somehow ($this->table_access_restriction?),
3) once in lines_of_sale, the add and edit forms should remember the original call.

if that's possible, then i can save a lot of work.

the question is how can i hack codex to allow me to do that Big Grin[/quote]

Hello gusa: i have the same problem and i have made as you suggest.... but not all work. IN few words, in the overview mode, i create a link to the second table (in your case lines_of_sale) with
Code:
$config = array(
                    'db_table' => 'example',
                    'form_setup' => $this->spyc->YAMLLOAD($this->codexadmin->getDefinitionFileName('example_form')),
                    'controller_name' => 'Example',
                    'primary_key' => 'my_id',
                    'display_fields'=>array('textbox_test','checkbox_test','related2'),
                    'order_by' => 'textbox_test',
                    'order_type' => 'DESC',
                    'table_access_restriction'=>array('my_id '=>$this->uri->segment(3)),
                    'rules'=>$rules
                    );
        $this->setConfig($config);
At this point i see the related data..... it is necessary, at this point, to hack the code for remembre the ur segment, when, after an edit, i go back to the overview mode, and (this is very important) for insert the uri if an new record is added...
I want to edit the codex_crumbs.php view for insert in thsi view the uri->segment, but i have not try (no time this days :-( )


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.