Feng Forum
Other Topics => Development => : andy.hoyle April 16, 2009, 10:41:38 AM
-
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?
-
+ var no_of_tasks = 20;
+ var no_of_tasks = yournumber;
-
edit file 'application/layouts/website.php' and somewhere bellow line 100:
<script>
// OG config options
add this code:
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.
-
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
-
Thanks! Will add you modifications.
I realized that adding line
<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.