yammerapikey.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?php
  2. class YammerApikeyForm extends Form
  3. {
  4. private $runner;
  5. function __construct($out)
  6. {
  7. parent::__construct($out);
  8. $this->runner = $runner;
  9. }
  10. /**
  11. * ID of the form
  12. *
  13. * @return int ID of the form
  14. */
  15. function id()
  16. {
  17. return 'yammer-apikey-form';
  18. }
  19. /**
  20. * class of the form
  21. *
  22. * @return string of the form class
  23. */
  24. function formClass()
  25. {
  26. return 'form_yammer_apikey form_settings';
  27. }
  28. /**
  29. * Action of the form
  30. *
  31. * @return string URL of the action
  32. */
  33. function action()
  34. {
  35. return common_local_url('yammeradminpanel');
  36. }
  37. /**
  38. * Legend of the Form
  39. *
  40. * @return void
  41. */
  42. function formLegend()
  43. {
  44. // TRANS: Form legend for adding details to connect to a remote Yammer API.
  45. $this->out->element('legend', null, _m('Yammer API registration'));
  46. }
  47. /**
  48. * Data elements of the form
  49. *
  50. * @return void
  51. */
  52. function formData()
  53. {
  54. $this->out->hidden('subaction', 'apikey');
  55. $this->out->elementStart('fieldset');
  56. $this->out->elementStart('p');
  57. // TRANS: Explanation of what needs to be done to connect to a Yammer network.
  58. $this->out->text(_m('Before we can connect to your Yammer network, ' .
  59. 'you will need to register the importer as an ' .
  60. 'application authorized to pull data on your behalf. ' .
  61. 'This registration will work only for your own network. ' .
  62. 'Follow this link to register the app at Yammer; ' .
  63. 'you will be prompted to log in if necessary:'));
  64. $this->out->elementEnd('p');
  65. $this->out->elementStart('p', array('class' => 'magiclink'));
  66. $this->out->element('a',
  67. array('href' => 'https://www.yammer.com/client_applications/new',
  68. 'target' => '_blank'),
  69. // TRANS: Link description to a Yammer application registration form.
  70. _m('Open Yammer application registration form'));
  71. $this->out->elementEnd('p');
  72. // TRANS: Instructions.
  73. $this->out->element('p', array(), _m('Copy the consumer key and secret you are given into the form below:'));
  74. $this->out->elementStart('ul', array('class' => 'form_data'));
  75. $this->out->elementStart('li');
  76. // TRANS: Field label for a Yammer consumer key.
  77. $this->out->input('consumer_key', _m('Consumer key:'), common_config('yammer', 'consumer_key'));
  78. $this->out->elementEnd('li');
  79. $this->out->elementStart('li');
  80. // TRANS: Field label for a Yammer consumer secret.
  81. $this->out->input('consumer_secret', _m('Consumer secret:'), common_config('yammer', 'consumer_secret'));
  82. $this->out->elementEnd('li');
  83. $this->out->elementEnd('ul');
  84. // TRANS: Button text for saving a Yammer API registration.
  85. $this->out->submit('submit', _m('BUTTON','Save'),
  86. // TRANS: Button title for saving a Yammer API registration.
  87. 'submit', null, _m('Save the entered consumer key and consumer secret.'));
  88. $this->out->elementEnd('fieldset');
  89. }
  90. /**
  91. * Action elements
  92. *
  93. * @return void
  94. */
  95. function formActions()
  96. {
  97. }
  98. }