{"action":"created","comment":{"url":"https://api.github.com/repos/alchemy-fr/Phraseanet/pulls/comments/33478067","id":33478067,"diff_hunk":"@@ -375,4 +378,144 @@ public function applyAction(Request $request) {\n \n         return $this->app->json(['success' => true]);\n     }\n+\n+\n+    /**\n+     * route GET \"../prod/records/edit/presets/{preset_id}\"\n+     *\n+     * @param Request $request\n+     * @param $preset_id\n+     * @return \\Symfony\\Component\\HttpFoundation\\JsonResponse\n+     */\n+    public function presetsLoadAction($preset_id)\n+    {\n+        $ret = [];\n+\n+        if ( ($preset = $this->getPresetRepository()->find($preset_id)) === null) {\n+            $this->app->abort(404, sprintf(\"Preset with id '%' could not be found\", $preset_id));\n+        }\n+\n+        $fields = [];\n+        foreach ($preset->getData() as $field) {\n+            $fields[$field['name']] = $field['value'];\n+        }\n+\n+        $ret['fields'] = $fields;\n+\n+        return $this->app->json($ret);\n+    }\n+\n+    /**\n+     * route GET \"../prod/records/edit/presets\"\n+     *\n+     * @param Request $request\n+     * @return \\Symfony\\Component\\HttpFoundation\\JsonResponse\n+     */\n+    public function presetsListAction(Request $request)\n+    {\n+        $sbas_id = $request->get('sbas_id');\n+        $user = $this->app['authentication']->getUser();\n+\n+        $ret = [];\n+\n+        $ret['html'] = $this->getPresetHTMLList($sbas_id, $user);\n+\n+        return $this->app->json($ret);\n+    }\n+\n+    /**\n+     * route DELETE \"../prod/records/edit/presets/{preset_id}\"\n+     *\n+     * @param Request $request\n+     * @param $preset_id\n+     * @return \\Symfony\\Component\\HttpFoundation\\JsonResponse\n+     */\n+    public function presetsDeleteAction($preset_id)\n+    {\n+        $user = $this->app['authentication']->getUser();\n+\n+        $ret = [];\n+\n+        /** @var Preset $preset */\n+        if ( ($preset = $this->getPresetRepository()->find($preset_id)) === null) {\n+            $this->app->abort(404, sprintf(\"Preset with id '%' could not be found\", $preset_id));\n+        }\n+        $sbas_id = $preset->getSbasId();\n+        $this->getPresetManipulator()->delete($preset);\n+\n+        $ret['html'] = $this->getPresetHTMLList($sbas_id, $user);\n+\n+        return $this->app->json($ret);\n+    }\n+\n+    /**\n+     * route POST \"../prod/records/edit/presets\"\n+     *\n+     * @param Request $request\n+     * @return \\Symfony\\Component\\HttpFoundation\\JsonResponse\n+     */\n+    public function presetsSaveAction(Request $request)\n+    {\n+        $sbas_id = $request->get('sbas_id');\n+        $user = $this->app['authentication']->getUser();\n+\n+        $ret = [];\n+\n+        $this->getPresetManipulator()->create(\n+            $user,\n+            $sbas_id,\n+            $request->get('title'),\n+            $request->get('fields')\n+        );\n+\n+        $ret['html'] = $this->getPresetHTMLList($sbas_id, $user);\n+\n+        return $this->app->json($ret);\n+    }\n+\n+    /**\n+     * render edit preset\n+     *\n+     * @param $sbasId\n+     * @param User $user\n+     * @return mixed\n+     */\n+    private function getPresetHTMLList($sbasId, User &$user)","path":"lib/Alchemy/Phrasea/Controller/Prod/EditController.php","position":118,"original_position":118,"commit_id":"edbcd20529f87d20701dbc8041f3b41f3def7747","original_commit_id":"edbcd20529f87d20701dbc8041f3b41f3def7747","user":{"login":"bburnichon","id":2437286,"avatar_url":"https://avatars.githubusercontent.com/u/2437286?v=3","gravatar_id":"","url":"https://api.github.com/users/bburnichon","html_url":"https://github.com/bburnichon","followers_url":"https://api.github.com/users/bburnichon/followers","following_url":"https://api.github.com/users/bburnichon/following{/other_user}","gists_url":"https://api.github.com/users/bburnichon/gists{/gist_id}","starred_url":"https://api.github.com/users/bburnichon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bburnichon/subscriptions","organizations_url":"https://api.github.com/users/bburnichon/orgs","repos_url":"https://api.github.com/users/bburnichon/repos","events_url":"https://api.github.com/users/bburnichon/events{/privacy}","received_events_url":"https://api.github.com/users/bburnichon/received_events","type":"User","site_admin":false},"body":"Reference is useless here. Objects are always passed by reference in php.","created_at":"2015-06-29T15:47:32Z","updated_at":"2015-06-29T15:47:32Z","html_url":"https://github.com/alchemy-fr/Phraseanet/pull/1411#discussion_r33478067","pull_request_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/pulls/1411","_links":{"self":{"href":"https://api.github.com/repos/alchemy-fr/Phraseanet/pulls/comments/33478067"},"html":{"href":"https://github.com/alchemy-fr/Phraseanet/pull/1411#discussion_r33478067"},"pull_request":{"href":"https://api.github.com/repos/alchemy-fr/Phraseanet/pulls/1411"}}},"pull_request":{"url":"https://api.github.com/repos/alchemy-fr/Phraseanet/pulls/1411","id":38456139,"html_url":"https://github.com/alchemy-fr/Phraseanet/pull/1411","diff_url":"https://github.com/alchemy-fr/Phraseanet/pull/1411.diff","patch_url":"https://github.com/alchemy-fr/Phraseanet/pull/1411.patch","issue_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/issues/1411","number":1411,"state":"open","locked":false,"title":"PHRAS-556 #time 5h","user":{"login":"jygaulier","id":1247618,"avatar_url":"https://avatars.githubusercontent.com/u/1247618?v=3","gravatar_id":"","url":"https://api.github.com/users/jygaulier","html_url":"https://github.com/jygaulier","followers_url":"https://api.github.com/users/jygaulier/followers","following_url":"https://api.github.com/users/jygaulier/following{/other_user}","gists_url":"https://api.github.com/users/jygaulier/gists{/gist_id}","starred_url":"https://api.github.com/users/jygaulier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jygaulier/subscriptions","organizations_url":"https://api.github.com/users/jygaulier/orgs","repos_url":"https://api.github.com/users/jygaulier/repos","events_url":"https://api.github.com/users/jygaulier/events{/privacy}","received_events_url":"https://api.github.com/users/jygaulier/received_events","type":"User","site_admin":false},"body":"- fix: creation of presets\r\n- fix: usage of presets\r\n- fix: deletion of presets\r\n- new: routes for presets","created_at":"2015-06-24T15:42:52Z","updated_at":"2015-06-29T15:47:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b1ab3a46d8d35bbd4e0aca8da4fc52b9c01f081f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/pulls/1411/commits","review_comments_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/pulls/1411/comments","review_comment_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/issues/1411/comments","statuses_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/statuses/edbcd20529f87d20701dbc8041f3b41f3def7747","head":{"label":"jygaulier:PHRAS-556_EDIT-PRESETS_rebased","ref":"PHRAS-556_EDIT-PRESETS_rebased","sha":"edbcd20529f87d20701dbc8041f3b41f3def7747","user":{"login":"jygaulier","id":1247618,"avatar_url":"https://avatars.githubusercontent.com/u/1247618?v=3","gravatar_id":"","url":"https://api.github.com/users/jygaulier","html_url":"https://github.com/jygaulier","followers_url":"https://api.github.com/users/jygaulier/followers","following_url":"https://api.github.com/users/jygaulier/following{/other_user}","gists_url":"https://api.github.com/users/jygaulier/gists{/gist_id}","starred_url":"https://api.github.com/users/jygaulier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jygaulier/subscriptions","organizations_url":"https://api.github.com/users/jygaulier/orgs","repos_url":"https://api.github.com/users/jygaulier/repos","events_url":"https://api.github.com/users/jygaulier/events{/privacy}","received_events_url":"https://api.github.com/users/jygaulier/received_events","type":"User","site_admin":false},"repo":{"id":4204287,"name":"Phraseanet","full_name":"jygaulier/Phraseanet","owner":{"login":"jygaulier","id":1247618,"avatar_url":"https://avatars.githubusercontent.com/u/1247618?v=3","gravatar_id":"","url":"https://api.github.com/users/jygaulier","html_url":"https://github.com/jygaulier","followers_url":"https://api.github.com/users/jygaulier/followers","following_url":"https://api.github.com/users/jygaulier/following{/other_user}","gists_url":"https://api.github.com/users/jygaulier/gists{/gist_id}","starred_url":"https://api.github.com/users/jygaulier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jygaulier/subscriptions","organizations_url":"https://api.github.com/users/jygaulier/orgs","repos_url":"https://api.github.com/users/jygaulier/repos","events_url":"https://api.github.com/users/jygaulier/events{/privacy}","received_events_url":"https://api.github.com/users/jygaulier/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jygaulier/Phraseanet","description":"Digital Asset Management PHP app","fork":true,"url":"https://api.github.com/repos/jygaulier/Phraseanet","forks_url":"https://api.github.com/repos/jygaulier/Phraseanet/forks","keys_url":"https://api.github.com/repos/jygaulier/Phraseanet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jygaulier/Phraseanet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jygaulier/Phraseanet/teams","hooks_url":"https://api.github.com/repos/jygaulier/Phraseanet/hooks","issue_events_url":"https://api.github.com/repos/jygaulier/Phraseanet/issues/events{/number}","events_url":"https://api.github.com/repos/jygaulier/Phraseanet/events","assignees_url":"https://api.github.com/repos/jygaulier/Phraseanet/assignees{/user}","branches_url":"https://api.github.com/repos/jygaulier/Phraseanet/branches{/branch}","tags_url":"https://api.github.com/repos/jygaulier/Phraseanet/tags","blobs_url":"https://api.github.com/repos/jygaulier/Phraseanet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jygaulier/Phraseanet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jygaulier/Phraseanet/git/refs{/sha}","trees_url":"https://api.github.com/repos/jygaulier/Phraseanet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jygaulier/Phraseanet/statuses/{sha}","languages_url":"https://api.github.com/repos/jygaulier/Phraseanet/languages","stargazers_url":"https://api.github.com/repos/jygaulier/Phraseanet/stargazers","contributors_url":"https://api.github.com/repos/jygaulier/Phraseanet/contributors","subscribers_url":"https://api.github.com/repos/jygaulier/Phraseanet/subscribers","subscription_url":"https://api.github.com/repos/jygaulier/Phraseanet/subscription","commits_url":"https://api.github.com/repos/jygaulier/Phraseanet/commits{/sha}","git_commits_url":"https://api.github.com/repos/jygaulier/Phraseanet/git/commits{/sha}","comments_url":"https://api.github.com/repos/jygaulier/Phraseanet/comments{/number}","issue_comment_url":"https://api.github.com/repos/jygaulier/Phraseanet/issues/comments{/number}","contents_url":"https://api.github.com/repos/jygaulier/Phraseanet/contents/{+path}","compare_url":"https://api.github.com/repos/jygaulier/Phraseanet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jygaulier/Phraseanet/merges","archive_url":"https://api.github.com/repos/jygaulier/Phraseanet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jygaulier/Phraseanet/downloads","issues_url":"https://api.github.com/repos/jygaulier/Phraseanet/issues{/number}","pulls_url":"https://api.github.com/repos/jygaulier/Phraseanet/pulls{/number}","milestones_url":"https://api.github.com/repos/jygaulier/Phraseanet/milestones{/number}","notifications_url":"https://api.github.com/repos/jygaulier/Phraseanet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jygaulier/Phraseanet/labels{/name}","releases_url":"https://api.github.com/repos/jygaulier/Phraseanet/releases{/id}","created_at":"2012-05-02T15:13:15Z","updated_at":"2014-06-17T17:24:09Z","pushed_at":"2015-06-24T15:34:45Z","git_url":"git://github.com/jygaulier/Phraseanet.git","ssh_url":"git@github.com:jygaulier/Phraseanet.git","clone_url":"https://github.com/jygaulier/Phraseanet.git","svn_url":"https://github.com/jygaulier/Phraseanet","homepage":"http://www.phraseanet.com","size":229879,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"Dev"}},"base":{"label":"alchemy-fr:master","ref":"master","sha":"0ea22189828e6a94a47f8b7e99d22265ae70e41c","user":{"login":"alchemy-fr","id":621336,"avatar_url":"https://avatars.githubusercontent.com/u/621336?v=3","gravatar_id":"","url":"https://api.github.com/users/alchemy-fr","html_url":"https://github.com/alchemy-fr","followers_url":"https://api.github.com/users/alchemy-fr/followers","following_url":"https://api.github.com/users/alchemy-fr/following{/other_user}","gists_url":"https://api.github.com/users/alchemy-fr/gists{/gist_id}","starred_url":"https://api.github.com/users/alchemy-fr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alchemy-fr/subscriptions","organizations_url":"https://api.github.com/users/alchemy-fr/orgs","repos_url":"https://api.github.com/users/alchemy-fr/repos","events_url":"https://api.github.com/users/alchemy-fr/events{/privacy}","received_events_url":"https://api.github.com/users/alchemy-fr/received_events","type":"Organization","site_admin":false},"repo":{"id":1374101,"name":"Phraseanet","full_name":"alchemy-fr/Phraseanet","owner":{"login":"alchemy-fr","id":621336,"avatar_url":"https://avatars.githubusercontent.com/u/621336?v=3","gravatar_id":"","url":"https://api.github.com/users/alchemy-fr","html_url":"https://github.com/alchemy-fr","followers_url":"https://api.github.com/users/alchemy-fr/followers","following_url":"https://api.github.com/users/alchemy-fr/following{/other_user}","gists_url":"https://api.github.com/users/alchemy-fr/gists{/gist_id}","starred_url":"https://api.github.com/users/alchemy-fr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alchemy-fr/subscriptions","organizations_url":"https://api.github.com/users/alchemy-fr/orgs","repos_url":"https://api.github.com/users/alchemy-fr/repos","events_url":"https://api.github.com/users/alchemy-fr/events{/privacy}","received_events_url":"https://api.github.com/users/alchemy-fr/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alchemy-fr/Phraseanet","description":"Digital Asset Management PHP app","fork":false,"url":"https://api.github.com/repos/alchemy-fr/Phraseanet","forks_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/forks","keys_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/teams","hooks_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/hooks","issue_events_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/issues/events{/number}","events_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/events","assignees_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/assignees{/user}","branches_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/branches{/branch}","tags_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/tags","blobs_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/git/refs{/sha}","trees_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/statuses/{sha}","languages_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/languages","stargazers_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/stargazers","contributors_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/contributors","subscribers_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/subscribers","subscription_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/subscription","commits_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/commits{/sha}","git_commits_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/git/commits{/sha}","comments_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/comments{/number}","issue_comment_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/issues/comments{/number}","contents_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/contents/{+path}","compare_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/merges","archive_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/downloads","issues_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/issues{/number}","pulls_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/pulls{/number}","milestones_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/milestones{/number}","notifications_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/labels{/name}","releases_url":"https://api.github.com/repos/alchemy-fr/Phraseanet/releases{/id}","created_at":"2011-02-16T14:55:31Z","updated_at":"2015-06-22T18:25:24Z","pushed_at":"2015-06-29T15:32:55Z","git_url":"git://github.com/alchemy-fr/Phraseanet.git","ssh_url":"git@github.com:alchemy-fr/Phraseanet.git","clone_url":"https://github.com/alchemy-fr/Phraseanet.git","svn_url":"https://github.com/alchemy-fr/Phraseanet","homepage":"http://www.phraseanet.com","size":237644,"stargazers_count":61,"watchers_count":61,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":27,"mirror_url":null,"open_issues_count":6,"forks":27,"open_issues":6,"watchers":61,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alchemy-fr/Phraseanet/pulls/1411"},"html":{"href":"https://github.com/alchemy-fr/Phraseanet/pull/1411"},"issue":{"href":"https://api.github.com/repos/alchemy-fr/Phraseanet/issues/1411"},"comments":{"href":"https://api.github.com/repos/alchemy-fr/Phraseanet/issues/1411/comments"},"review_comments":{"href":"https://api.github.com/repos/alchemy-fr/Phraseanet/pulls/1411/comments"},"review_comment":{"href":"https://api.github.com/repos/alchemy-fr/Phraseanet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alchemy-fr/Phraseanet/pulls/1411/commits"},"statuses":{"href":"https://api.github.com/repos/alchemy-fr/Phraseanet/statuses/edbcd20529f87d20701dbc8041f3b41f3def7747"}}}}