Author Topic: List more than 8 tasks on a page  (Read 7342 times)

andy.hoyle

  • Newbie
  • *
  • Posts: 30
    • View Profile
List more than 8 tasks on a page
« on: April 16, 2009, 10:41:38 am »
Code: [Select]
public\assets\javascript\og\tasks\drawing.js
line 8:
+
+ var no_of_tasks = 20;

line 152:
- if (i == 8){ //Draw expander if group has more than 8 tasks
+ if (i == no_of_tasks){ //Draw expander if group has more than 8 tasks

line 158:
- for (var j = 8; j < group.group_tasks.length; j++)
+ for (var j = no_of_tasks; j < group.group_tasks.length; j++)

line 214:
- for (var i = 8; i < group.group_tasks.length; i++)
+ for (var i = no_of_tasks; i < group.group_tasks.length; i++)


Does anyone know how to specify this in config/config.php and pull that value into the above js file?

kristjanmik

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: List more than 8 tasks on a page
« Reply #1 on: April 20, 2009, 02:15:48 pm »
+ var no_of_tasks = 20;

+ var no_of_tasks = yournumber;

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: List more than 8 tasks on a page
« Reply #2 on: April 20, 2009, 03:07:38 pm »
edit file 'application/layouts/website.php' and somewhere bellow line 100:
Code: [Select]
<script>
// OG config options

add this code:
Code: [Select]
og.noOfTasks = <?php echo defined('NO_OF_TASKS') ? NO_OF_TASKS 8 ?>;

Then, on drawing.js set the value of "no_of_tasks" to og.noOfTasks or directly change all occurrences of no_of_tasks to og.noOfTasks. Another option would have been to define no_of_tasks on website.php and remove the declaration from drawing.js, but it's better to use the og namespace.

Now on config.php you can add the constant NO_OF_TASKS to show more tasks without expanding.

This will be added to 1.4. Thanks for the suggestion.

Cheers.

ras2000

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • Proremus
Re: List more than 8 tasks on a page
« Reply #3 on: April 23, 2009, 05:36:04 am »
I've made a different solution. This way each user can decide how many tasks to show in the view, handy if the different users have different sized screens
Insert a new post in the table og_user_ws_config_options
INSERT INTO `opengoo`.`og_user_ws_config_options` (
`id` ,
`category_name` ,
`name` ,
`default_value` ,
`config_handler_class` ,
`is_system` ,
`option_order` ,
`dev_comment`
)
VALUES (
NULL , 'task panel', 'noOfTasks', '8', 'IntegerConfigHandler', '0', '100', NULL
);

Insert line
'user ws config option name noOfTasks' => 'Set number of tasks shown as default',
in language/en_us/administration.php

Insert line
og.noOfTasks = <?php echo user_config_option('noOfTasks') ?>;
in application/layouts/website.php

Insert line
var no_of_tasks = og.noOfTasks;
in public/assets/javascript/og/tasks/drawing.js, line 153
replace the 8 lines 155 og 161 with no_of_tasks
If you are what you eat, then I'm fast, cheap and easy.

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: List more than 8 tasks on a page
« Reply #4 on: April 23, 2009, 01:13:14 pm »
Thanks! Will add you modifications.

I realized that adding line
Code: [Select]
<script>og.noOfTasks = <?php echo user_config_option('noOfTasks'?>;</script>to the beginning of 'application/views/task/new_list_tasks.php' allows the config option to make effect without refreshing the whole page.
« Last Edit: April 23, 2009, 02:35:30 pm by ignacio »