yammerauthverify.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. class YammerAuthVerifyForm extends Form
  3. {
  4. private $runner;
  5. function __construct($out, YammerRunner $runner)
  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-auth-verify-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_auth_verify 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.
  45. $this->out->element('legend', null, _m('Connect to Yammer'));
  46. }
  47. /**
  48. * Data elements of the form
  49. *
  50. * @return void
  51. */
  52. function formData()
  53. {
  54. $this->out->hidden('subaction', 'authverify');
  55. $this->out->elementStart('fieldset');
  56. $this->out->elementStart('p');
  57. // TRANS: Form instructions.
  58. $this->out->text(_m('Follow this link to confirm authorization at Yammer; you will be prompted to log in if necessary:'));
  59. $this->out->elementEnd('p');
  60. // iframe would be nice to avoid leaving -- since they don't seem to have callback url O_O
  61. /*
  62. $this->out->element('iframe', array('id' => 'yammer-oauth',
  63. 'src' => $this->runner->getAuthUrl()));
  64. */
  65. // yeah, it ignores the callback_url
  66. // soo... crappy link. :(
  67. $this->out->elementStart('p', array('class' => 'magiclink'));
  68. $this->out->element('a',
  69. array('href' => $this->runner->getAuthUrl(),
  70. 'target' => '_blank'),
  71. // TRANS: Link description for a link in an external Yammer system.
  72. _m('Open Yammer authentication window'));
  73. $this->out->elementEnd('p');
  74. // TRANS: Form instructions.
  75. $this->out->element('p', array(), _m('Copy the verification code you are given below:'));
  76. $this->out->elementStart('ul', array('class' => 'form_data'));
  77. $this->out->elementStart('li');
  78. // TRANS: Field label.
  79. $this->out->input('verify_token', _m('Verification code:'));
  80. $this->out->elementEnd('li');
  81. $this->out->elementEnd('ul');
  82. // TRANS: Button text for saving Yammer authorisation data and starting Yammer import.
  83. $this->out->submit('submit', _m('BUTTON','Continue'),
  84. // TRANS: Button title for saving Yammer authorisation data and starting Yammer import.
  85. 'submit', null, _m('Save the verification code and begin import.'));
  86. $this->out->elementEnd('fieldset');
  87. }
  88. /**
  89. * Action elements
  90. *
  91. * @return void
  92. */
  93. function formActions()
  94. {
  95. }
  96. }