~ubuntu-branches/ubuntu/wily/phabricator/wily

« back to all changes in this revision

Viewing changes to phabricator/src/applications/project/controller/PhabricatorProjectEditPictureController.php

  • Committer: Package Import Robot
  • Author(s): Richard Sellam
  • Date: 2015-01-29 00:15:58 UTC
  • mfrom: (0.14.1) (0.13.1) (0.10.2) (2.1.4 sid)
  • Revision ID: package-import@ubuntu.com-20150129001558-7qklhtcc043y9mog
Tags: 0~git20150129-1
* New snapshot release
* restricted access to local config file (closes: #775479)
* moved local config file to /var/lib/phabricator (closes: #775478)
* switched mysql-server dependency to recommends (closes: #773536)
* use /run instead of /var/run (closes: #775803)
* prevent package reinstall from overwritting local changes (closes: #776288)

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
  public function processRequest() {
13
13
    $request = $this->getRequest();
14
14
    $viewer = $request->getUser();
 
15
    $id = $request->getURIData('id');
15
16
 
16
17
    $project = id(new PhabricatorProjectQuery())
17
18
      ->setViewer($viewer)
18
19
      ->withIDs(array($this->id))
 
20
      ->needImages(true)
19
21
      ->requireCapabilities(
20
22
        array(
21
23
          PhabricatorPolicyCapability::CAN_VIEW,
26
28
      return new Aphront404Response();
27
29
    }
28
30
 
29
 
    $edit_uri = $this->getApplicationURI('edit/'.$project->getID().'/');
30
 
    $view_uri = $this->getApplicationURI('view/'.$project->getID().'/');
 
31
    $edit_uri = $this->getApplicationURI('profile/'.$project->getID().'/');
 
32
    $view_uri = $this->getApplicationURI('profile/'.$project->getID().'/');
31
33
 
32
34
    $supported_formats = PhabricatorFile::getTransformableImageFormats();
33
35
    $e_file = true;
100
102
    }
101
103
 
102
104
    $title = pht('Edit Project Picture');
103
 
    $crumbs = $this->buildApplicationCrumbs();
104
 
    $crumbs->addTextCrumb($project->getName(), $view_uri);
105
 
    $crumbs->addTextCrumb(pht('Edit'), $edit_uri);
106
 
    $crumbs->addTextCrumb(pht('Picture'));
107
105
 
108
106
    $form = id(new PHUIFormLayoutView())
109
107
      ->setUser($viewer);
236
234
        ->setLabel(pht('Quick Create'))
237
235
        ->setValue($compose_form));
238
236
 
 
237
    $default_button = javelin_tag(
 
238
      'button',
 
239
      array(
 
240
        'class' => 'grey',
 
241
      ),
 
242
      pht('Use Project Icon'));
 
243
 
 
244
    $default_input = javelin_tag(
 
245
      'input',
 
246
      array(
 
247
        'type' => 'hidden',
 
248
        'name' => 'projectPHID',
 
249
        'value' => $project->getPHID(),
 
250
      ));
 
251
 
 
252
    $default_form = phabricator_form(
 
253
      $viewer,
 
254
      array(
 
255
        'class' => 'profile-image-form',
 
256
        'method' => 'POST',
 
257
        'action' => '/file/compose/',
 
258
       ),
 
259
      array(
 
260
        $default_input,
 
261
        $default_button,
 
262
      ));
 
263
 
 
264
    $form->appendChild(
 
265
      id(new AphrontFormMarkupControl())
 
266
        ->setLabel(pht('Use Default'))
 
267
        ->setValue($default_form));
 
268
 
239
269
    $upload_form = id(new AphrontFormView())
240
270
      ->setUser($viewer)
241
271
      ->setEncType('multipart/form-data')
260
290
      ->setHeaderText(pht('Upload New Picture'))
261
291
      ->setForm($upload_form);
262
292
 
 
293
    $nav = $this->buildIconNavView($project);
 
294
    $nav->selectFilter("edit/{$id}/");
 
295
    $nav->appendChild($form_box);
 
296
    $nav->appendChild($upload_box);
 
297
 
263
298
    return $this->buildApplicationPage(
264
299
      array(
265
 
        $crumbs,
266
 
        $form_box,
267
 
        $upload_box,
 
300
        $nav,
268
301
      ),
269
302
      array(
270
303
        'title' => $title,