Fix the server-chokes-on-list-view thing #189

Closed
wants to merge 40 commits into from

3 participants

@voidus

count should be merged before this.

This implements a Rest Controller, deprecates the old grid, alters a copy so that it uses the new controller and implements all this for the calendar and todo.

http://jira.opensource.mayflower.de/jira/browse/PHPROJEKT-341

Simon Kohlmeyer added some commits Mar 16, 2012
Simon Kohlmeyer Added Default_IndexController->_storeCurrentProjectId($projectId)
This is a better alternative to public setCurrentProjectId, which looks at the
request itself.
Also deprecated setCurrentProjectId.
4863f4c
Simon Kohlmeyer Copied Grid to LegacyGrid to allow further development d734556
Simon Kohlmeyer added abstract rest controller and rest routing afc6d6c
Simon Kohlmeyer Added Todo_TodoController extends Phprojekt_Restcontroller 3431b27
Simon Kohlmeyer Added a metadatastore b2288d9
Simon Kohlmeyer Added metadataAction to IndexController 0a739b2
Simon Kohlmeyer make rest-grid work and use it in Todo 1d3109f
Simon Kohlmeyer recompiled js bfa08a4
Simon Kohlmeyer just save the filters instead of making a request 556d0f7
Simon Kohlmeyer remove unused code bdf7d06
Simon Kohlmeyer make in-line editing work (no rights checking on the client yet) ab7093c
Simon Kohlmeyer stop polluting global scope 5f84a26
Simon Kohlmeyer implemented putAction 8d6d1b2
Simon Kohlmeyer Workaround to allow inline editing.
Because of a bug that is explained on
http://dojo-toolkit.33424.n3.nabble.com/DataGrid-JsonRest-Unwanted-GET-request-after-editing-cell-td3477425.html
the grid is not updated after saving. We just refresh the query to force this
for now. This is no good solution, but I can't find a better workaround.
481cc7d
Simon Kohlmeyer don't call the updateData function if it does not exist 60828df
Simon Kohlmeyer Merge remote-tracking branch 'origin/count' into rest
* origin/count:
  use correct count function in calendar2_models_calendar2
  added Phprojekt_Tree_Node_Database->getRecordsCount($model, $where)
  fixed some comments
  Added Phprojekt_Item_Abstract->count($where)
  Rewrote Phprojekt_ActiveRecord_Abstract->count().
cf9d3b9
Simon Kohlmeyer Added Phprojekt_Model_Converter and used it in Phprojekt_RestController
This converter simply converts objects that implement Phprojekt_Model_Interface
into arrays. This makes it quite different from
Phprojekt_Converter_{Csv,Json,...} that also do a lot of other things.

The aim of this new class is to separate different functionalities and make each
part simpler.
6cc7a13
Simon Kohlmeyer use Phprojekt_Module::saveTypeIsGlobal instead of $model->hasField(pr…
…ojectId)
9a9efa2
Simon Kohlmeyer call Phprojekt:::setCurrentProjectId in RestController->preDispatch i…
…f projectId is given
fd31bff
Simon Kohlmeyer Made js<->pseudo-iso conversions a little more robust b5abcc0
Simon Kohlmeyer use localized time display in the grid bdfffa6
Simon Kohlmeyer use the new grid in the calendar 7b7c565
Simon Kohlmeyer remove the updateCacheData function 22eb334
Simon Kohlmeyer correctly handle datetime values, stop using phprojekt subclasses and…
… hand in functions instead
63ed6e1
@exi

we should use Phprojekt_CompressedSender::send here instead of echo

@exi

we should use Phprojekt_CompressedSender::send here instead of echo

@exi

phpdoc missing

@exi

the published exception has been removed, use Zend_Controller_Action_Exception with an appropriate http error code like 400 or something

@exi

use Phprojekt_CompressedSender::send instead of echo

@exi
Mayflower GmbH member

it is a bit better to use a === undefined instead of typeof a == 'undefined'
also in line 50 !== is the opposite of === and not the opposite of ==

@exi

could you please make it throw an exception if the projectId is not provided.
I would like to try to get rid of phpr.currentProjectId in the long run so we should not default to it in new code

@exi

i think you should add a second callback to this .then call.
the second callback is the error handler and i would suggest something similar to the one in phpr.send in the current next

@exi

please use this.main.module instead of phpr.module
we should avoid global variables

@exi

move var filters = to the top and make some linebreaks between vars, if statements and return

@exi

replace published exception with Zend_Controller_Action_Exception and an appropriate http status code

@exi

replace published exception with Zend_Controller_Action_Exception and an appropriate http status code

@exi

replace published exception with Zend_Controller_Action_Exception and an appropriate http status code

@exi

replace published exception with Zend_Controller_Action_Exception and an appropriate http status code

@exi

use Phprojekt_CompressedSender::send

@exi

replace published exception with Zend_Controller_Action_Exception and an appropriate http status code

@exi

alignment

@exi

newlines

@exi

newline

@exi

phpdoc

@exi

phpdoc

@exi

remove the alignment, it is wrong anyway, just write it without alignment

@exi

align both or don't align both

Simon Kohlmeyer added some commits Apr 19, 2012
Simon Kohlmeyer Use Phprojekt_CompressedSender::send instead of echo in Phprojekt_Res…
…tController
1a61f5c
Simon Kohlmeyer Added comments to Phprojekt_RestRoute ca2d027
Simon Kohlmeyer Use Phprojekt_CompressedSender instead of echo in IndexController 48fcc15
Simon Kohlmeyer Use Zend_Controller_Action_Exception instead of the removed Phprojekt…
…_PublishedException
8a6d9da
Simon Kohlmeyer throw and exception instead of silently using defaults if projectId i…
…s not given in phpr.MetadataStore::metadataFor
3959db3
Simon Kohlmeyer Call phpr.handleError in phpr.MetadataStore::metadataFor if the reque…
…st fails
77fa00f
Simon Kohlmeyer use this.main.module instead of phpr.module 3e77e72
Simon Kohlmeyer Added doccomments 4e1b936
Simon Kohlmeyer Alignment, style, etc afae055
Simon Kohlmeyer Merge remote-tracking branch 'mayflower/next' into rest
* mayflower/next:
  Fixed review remarks
  fix wrong exception in test
  fix minor failing tests
  remove the published exception
  change all published exceptions into matching Controller_Action_Exceptions
  add templates for error messages
  fix timecard delete button display
  checkstyle
  remove the old timecard update code.
  let the timecard hook into the project cache update.
  remove update form in timecard form.js
  make getProjectRange deferred,use the timecard store to manage favorites in form
  rename timecard booking store and use the merged favorites in timecard main.js
  add favorites functionality to the timecard store
  let timecard use deferreds internally
  let timecard track whether it already has data

Conflicts:
	phprojekt/application/Calendar2/Models/Calendar2.php
        Conflict in comments only
d85184e
@exi

i would suggest calling "delete this._cache[module][projectId].deferred" here.
assigning undefined still lets the key "deferred" appear in the object with the value "undefined".
calling delete deletes the key from the object

@dsp

can be written das $recursive = $recursive === 'true';

@dsp

If we use Zend_Json_Encoder::encode() but not Zend_Json_Decoder::decode()

@dsp

I am sure this was just c&p but I think this doesnt make much sense. NULL will be casted to 0, so we either don't cast at all or use 0 as a default value.

@exi
Mayflower GmbH member

use Zend_Json::decode() and Zend_Json::encode() instead of Zend_Json_Decoder::decode() and Zend_Json_Encoder::encode()
Zend_Json::decode decides at runtime whether to use the php buildin or a php implementation.
Zend_Json_Decoder will always be slower and will be used as the fallback implementation by Zend_Json::decode

@dsp

using this branch "todo" doesnt display anything anymore. looking into that in the next days.

@dsp

I would recommend not merging this into next before 6.1.0 final release. it's a little bit too much for the final 6.1.0 release

Simon Kohlmeyer Fix a broken call.
metadataFor was modified to break if no projectId is provided, but the old code
still called it without one.
25c7755
@voidus

As this fixes http://jira.opensource.mayflower.de/jira/browse/PHPROJEKT-341, we can't really not merge this.

Simon Kohlmeyer added some commits May 9, 2012
Simon Kohlmeyer Added dummy Calendar2_Models_Calendar2->setRecurrence
This was neccessary because activerecord thinks the virtual "recurrence"-field
does not exist if the setter isn't defined.
f4e462b
Simon Kohlmeyer Set the projectId on getAction if an existing object is requested.
In this case, the conversion needs the projectId.
dda67d2
Simon Kohlmeyer Fall back to projectId 1 if we don't have a current projectId cd2b38c
@voidus

I'm not really sure if it's wise to fall back to project id 1. What do you think?

@exi
Mayflower GmbH member

superseeded by a new pull request

@exi exi closed this Jun 13, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment