Author Topic: Date wise Workspace sorting  (Read 2511 times)

lbptl

  • Newbie
  • *
  • Posts: 5
    • View Profile
Date wise Workspace sorting
« on: July 26, 2010, 05:56:37 am »
Hi All,

Here I require some different thing that is "Date wise workspace sorting: i.e. new created workspace should be come first in workspace list".

Can any one help me and let me know which code is require to change and in which file.

It is urgent. Your help is highly appreciated.

Thanks in advance.

cabeza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1004
    • View Profile
    • Feng Office
Re: Date wise Workspace sorting
« Reply #1 on: July 26, 2010, 11:38:19 am »
The PHP Code is found mainly at the end of application/controller/ProjectController.class.php

To modify the javascript control, take a look at 2 files in public/assets/javascript/og :
WorkspacePanel.js and WorkspaceChooser.js

lbptl

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Date wise Workspace sorting
« Reply #2 on: July 28, 2010, 05:34:20 am »
I know that the code is in 2 js files mainly WorkspacePanel.js and WorkspaceChooser.js respectively.

But in which place i should make a change ?? so workspace is sorted by datewise. i am not understand the flow for sorting workspace  :(

Thanks in advance !

alvarotm01

  • Administrator
  • Sr. Member
  • *****
  • Posts: 335
    • View Profile
    • Email
Re: Date wise Workspace sorting
« Reply #3 on: July 28, 2010, 11:31:23 am »
Workspaces are sent ordered by the server, the function that return the workspaces is list_projects() in ProjectController.
There it is called the function User::getWorkspaces() and this function uses
ProjectUsers::getProjectsByUser().
This last function takes the parameter "order_by", if not passed then name will be used to order. You have to pass your order criteria to this function

lbptl

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Date wise Workspace sorting
« Reply #4 on: July 29, 2010, 05:56:36 am »
As per your suggestion i have modify the SQL query

$sql = "SELECT $projects_table.* FROM $projects_table, $project_users_table WHERE $commoncond AND ($usercond OR $groupcond) ORDER BY $projects_table.`id` desc ";

it runs perfect in mysql but when the workspace loaded in application then it displays in ascending order!

Can you please suggest me in which place i can make a change or provide modified code  :)

Its Urgent!!