Guest User

Untitled

a guest
Jul 17th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 10.66 KB | None | 0 0
  1. diff --git a/application/admin/config/controllers/SocialmediaController.php b/application/admin/config/controllers/SocialmediaController.php
  2. index 5a10e36..7757e60 100644
  3. --- a/application/admin/config/controllers/SocialmediaController.php
  4. +++ b/application/admin/config/controllers/SocialmediaController.php
  5. @@ -12,6 +12,7 @@ class Config_SocialmediaController extends IP_Controller_EventAction {
  6.  
  7.          $this->view->title        = 'Add '.constant("SocialButtons::BUTTON_TYPE_".$buttonType).' Button';
  8.          $this->view->form         = $form;
  9. +        $this->view->buttonType   = constant("SocialButtons::BUTTON_TYPE_".$buttonType);
  10.  
  11.          if($this->getRequest()->isPost()) {
  12.              if($form->isValid($this->getRequest()->getPost())) {
  13. @@ -55,9 +56,10 @@ class Config_SocialmediaController extends IP_Controller_EventAction {
  14.          }
  15.  
  16.          $form = Form_SocialButtons::factory($buttonObj);
  17. -        $this->view->title        = 'Edit Social Button';
  18. +        $this->view->title        = 'Edit ' . $buttonObj->getObjectType() .  ' Button';
  19.          $this->view->form         = $form;
  20. -
  21. +       $this->view->buttonType   = $buttonObj->getObjectType();
  22. +      
  23.          if($this->getRequest()->isPost()) {
  24.              if($form->isValid($this->getRequest()->getPost())) {
  25.                  try {
  26. diff --git a/application/admin/config/scripts/socialmedia/form.phtml b/application/admin/config/scripts/socialmedia/form.phtml
  27. index 6de7e42..2d98d8a 100644
  28. --- a/application/admin/config/scripts/socialmedia/form.phtml
  29. +++ b/application/admin/config/scripts/socialmedia/form.phtml
  30. @@ -1,5 +1,37 @@
  31. +<form method="POST" action="" >
  32.  <?php
  33.  $this->adminTitle($this->title);
  34.  $this->adminBreadCrumb('Setup', 'index/index/setup');
  35.  $this->adminBreadCrumb('Social Media Buttons', 'config/socialmedia/');
  36. -echo $this->form;
  37. \ No newline at end of file
  38. +
  39. +$this->ip()->startContainer();
  40. +
  41. +$this->ip()->sectionTitle('General');
  42. +$this->ip()->startGroup();
  43. +echo $this->form->getElement('token');
  44. +echo $this->form->getElement('label');
  45. +$this->ip()->endGroup();
  46. +$this->ip()->endContainer();
  47. +$this->ip()->startContainer();
  48. +
  49. +$this->ip()->sectionTitle($this->buttonType . ' Button Options');
  50. +$this->ip()->startGroup();
  51. +echo $this->form->getDisplayGroup('buttonOptions');
  52. +$this->ip()->endGroup();
  53. +
  54. +$this->ip()->endContainer();
  55. +echo $this->form->getElement('save');
  56. +?>
  57. +</form>
  58. +<script>
  59. +function checkWidth() {
  60. +   if(jQuery('#displayType').val() == "1" || jQuery('#displayType').val() == "0") {
  61. +       jQuery('#width').attr('disabled', '');
  62. +   } else {
  63. +       jQuery('#width').attr('disabled', 'disabled');
  64. +   }
  65. +}
  66. +
  67. +jQuery(document).ready(checkWidth);
  68. +jQuery("#displayType").change(checkWidth);
  69. +</script>
  70. \ No newline at end of file
  71. diff --git a/classes/IP/Validate/Uri.php b/classes/IP/Validate/Uri.php
  72. index 799a76a..6ddf1ee 100644
  73. --- a/classes/IP/Validate/Uri.php
  74. +++ b/classes/IP/Validate/Uri.php
  75. @@ -7,12 +7,12 @@
  76.   * To change this template use File | Settings | File Templates.
  77.   */
  78.  class IP_Validate_Uri extends Zend_Validate_Abstract {
  79. -    const INVALID_URI = 'invalidUri';
  80. +    const INVALID_URI = 'invalidUrl';
  81.  
  82. -    protected $_fieldLabel = "Uri";
  83. +    protected $_fieldLabel = "URL";
  84.  
  85.      public $_messageTemplates = array(
  86. -        self::INVALID_URI => 'Uri is invalid.'
  87. +        self::INVALID_URI => 'URL is invalid.'
  88.      );
  89.  
  90.      /**
  91. @@ -43,7 +43,9 @@ class IP_Validate_Uri extends Zend_Validate_Abstract {
  92.          if (!empty($value)) {
  93.              $validator = new Zend_Validate_Hostname();
  94.              if($validator->isValid($value) !== true) {
  95. -                $this->_error(self::INVALID_URI);
  96. +               if (!Zend_Uri::check($value)) {
  97. +                   $this->_error(self::INVALID_URI);
  98. +               }
  99.              }
  100.          }
  101.  
  102. diff --git a/model/Form/SocialMediaButton/Abstract.php b/model/Form/SocialMediaButton/Abstract.php
  103. index 4621610..b070a51 100644
  104. --- a/model/Form/SocialMediaButton/Abstract.php
  105. +++ b/model/Form/SocialMediaButton/Abstract.php
  106. @@ -12,7 +12,7 @@ abstract class Form_SocialMediaButton_Abstract extends IP_Form
  107.      {
  108.          parent::__construct();
  109.          $e = $this->createElement('text', 'label');
  110. -        $e->setLabel('Admin Label');
  111. +        $e->setLabel('Admin Label')->setRequired();
  112.          $this->addElement($e);
  113.      }
  114.  }
  115. diff --git a/model/Form/SocialMediaButton/Facebook.php b/model/Form/SocialMediaButton/Facebook.php
  116. index 05c60cc..e9c06ea 100644
  117. --- a/model/Form/SocialMediaButton/Facebook.php
  118. +++ b/model/Form/SocialMediaButton/Facebook.php
  119. @@ -31,37 +31,94 @@ class Form_SocialMediaButton_Facebook extends Form_SocialMediaButton_Abstract
  120.          $this->addElement('hash', 'token');
  121.  
  122.          $e = $this->createElement('text', 'url');
  123. -        $e->setLabel('URL')->addValidator(new IP_Validate_Uri());
  124. +        $e->setLabel('URL')->addValidator(new IP_Validate_Uri())->setRequired();
  125. +        $e->setDescription("The URL of the page to Like.");
  126. +        $e->addDecorators(array(
  127. +           array('Description', array(
  128. +               'tag' => 'div',
  129. +                'escape' => true,
  130. +                'class' => 'rightSideDescription',
  131. +                'placement' => Zend_Form_Decorator_Abstract::APPEND)),
  132. +           array('HtmlTag', array('tag' => 'div', 'class' => 'sbElement clearfix'))));
  133.          $this->addElement($e);
  134.  
  135.          $e = $this->createElement('select', 'includeSend',array(
  136.              'multiOptions' => array("0" => "No", "1" => "Yes")));
  137.          $e->setLabel('Include Send Button');
  138. +        $e->setDescription("This button will also include an option to share the link via a Facebook message.");
  139. +        $e->addDecorators(array(
  140. +           array('Description', array(
  141. +               'tag' => 'div',
  142. +                'escape' => true,
  143. +                'class' => 'rightSideDescription',
  144. +                'placement' => Zend_Form_Decorator_Abstract::APPEND)),
  145. +           array('HtmlTag', array('tag' => 'div', 'class' => 'sbElement clearfix'))));
  146.          $this->addElement($e);
  147.  
  148.          $e = $this->createElement('select', 'displayType',array(
  149.              'multiOptions' => array("0" => self::DISPLAY_TYPE_STANDARD, "1" => self::DISPLAY_TYPE_FACES, "2" => self::DISPLAY_TYPE_HORIZONTAL, "3" => self::DISPLAY_TYPE_VERTICAL)));
  150. -        $e->setLabel('Display Type');
  151. +        $e->setLabel('Display Type')->setRequired();
  152. +        $e->setDescription("The display determines how the link appears. The options are \"Standard\", \"Standard with Faces\", \"Horizontal\", and \"Vertical\".");
  153. +        $e->addDecorators(array(
  154. +           array('Description', array(
  155. +               'tag' => 'div',
  156. +                'escape' => true,
  157. +                'class' => 'rightSideDescription',
  158. +                'placement' => Zend_Form_Decorator_Abstract::APPEND)),
  159. +           array('HtmlTag', array('tag' => 'div', 'class' => 'sbElement clearfix', 'escape' => true))));
  160.          $this->addElement($e);
  161.  
  162.          $e = $this->createElement('text','width');
  163.          $e->setLabel('Enter Width (in pixels)')->addValidator(new Zend_Validate_GreaterThan(224))->addFilter(new Zend_Filter_Digits());//TODO: make this based on displayType
  164. +        $e->setDescription("If \"Standard\" or \"Standard with Faces\" is chosen a width can be entered. The width must be at least 225 pixels without the send button and 285 pixels with it.");
  165. +        $e->addDecorators(array(
  166. +           array('Description', array(
  167. +               'tag' => 'div',
  168. +                'escape' => true,
  169. +                'class' => 'rightSideDescription',
  170. +                'placement' => Zend_Form_Decorator_Abstract::APPEND)),
  171. +           array('HtmlTag', array('tag' => 'div', 'class' => 'sbElement clearfix'))));
  172.          $this->addElement($e);
  173.  
  174.          $e = $this->createElement('select', 'verb', array(
  175.          'multiOptions' => array("0" => self::VERB_LIKE, "1" => self::VERB_RECOMMEND)));
  176. -        $e->setLabel('Verb');
  177. +        $e->setLabel('Verb')->setRequired();
  178. +        $e->setDescription("\"Like\" or \"Recommend\" may be used.");
  179. +        $e->addDecorators(array(
  180. +           array('Description', array(
  181. +               'tag' => 'div',
  182. +                'escape' => true,
  183. +                'class' => 'rightSideDescription',
  184. +                'placement' => Zend_Form_Decorator_Abstract::APPEND)),
  185. +           array('HtmlTag', array('tag' => 'div', 'class' => 'sbElement clearfix'))));
  186.          $this->addElement($e);
  187.  
  188.          $e = $this->createElement('select', 'colorScheme', array(
  189.              'multiOptions' => array("0" => self::COLOR_SCHEME_LIGHT, "1" => self::COLOR_SCHEME_DARK)));
  190. -        $e->setLabel('Color Scheme');
  191. +        $e->setLabel('Color Scheme')->setRequired();
  192. +        $e->setDescription("A light or dark color scheme may be selected.");
  193. +        $e->addDecorators(array(
  194. +           array('Description', array(
  195. +               'tag' => 'div',
  196. +                'escape' => true,
  197. +                'class' => 'rightSideDescription',
  198. +                'placement' => Zend_Form_Decorator_Abstract::APPEND)),
  199. +           array('HtmlTag', array('tag' => 'div', 'class' => 'sbElement clearfix'))));
  200.          $this->addElement($e);
  201.  
  202.          $e = $this->createElement('select', 'font', array(
  203.          'multiOptions' => array("0" => self::FONT_ARIAL, "1" => self::FONT_GRANDE, "2" => self::FONT_LUCIA, "3" => self::FONT_SEGOE, "4" => self::FONT_TAHOMA, "5" => self::FONT_TREBUCHET, "6" => self::FONT_VERANDA)));
  204. -        $e->setLabel('Font');
  205. +        $e->setLabel('Font')->setRequired();
  206. +        $e->setDescription("The current options for font are Arial, Lucia Grande, Segoe Ui, Tahoma, Trebushet MS, or Verdana.");
  207. +        $e->addDecorators(array(
  208. +           array('Description', array(
  209. +               'tag' => 'div',
  210. +                'escape' => true,
  211. +                'class' => 'rightSideDescription',
  212. +                'placement' => Zend_Form_Decorator_Abstract::APPEND)),
  213. +           array('HtmlTag', array('tag' => 'div', 'class' => 'sbElement clearfix'))));
  214.          $this->addElement($e);
  215. +       $this->addDisplayGroup(array('url', 'includeSend', 'displayType', 'width', 'verb', 'colorScheme', 'font'), 'buttonOptions');
  216.          $this->addElement('submit', 'save', array('label' => 'Save'));
  217.          return $this;
  218.      }
  219. diff --git a/www/scripts/IP.css b/www/scripts/IP.css
  220. index a41d45b..616d081 100644
  221. --- a/www/scripts/IP.css
  222. +++ b/www/scripts/IP.css
  223. @@ -515,7 +515,25 @@ table.financialSummary td.paymentDescription {
  224.    margin: 10px 0px 0px 10px;
  225.    width: 200px;
  226.  }
  227. -
  228. +.rightSideDescription {
  229. +  font-size: 0.9em;
  230. +  margin: 0px 0px 20px 30px;
  231. +  width: 300px;
  232. +}
  233. +.sbElement {
  234. +   border-bottom: 1px solid #CCCCCC;
  235. +   display: block;
  236. +    margin: 20px 10px;
  237. +}
  238. +.sbElement div {
  239. +   float:left;
  240. +}
  241. +.sbElement select{
  242. +   width:185px;
  243. +}
  244. +.sbElement input{
  245. +   width:180px;
  246. +}
  247.  .advancedReportDescription {
  248.    margin: 0px 10px 4px;
  249.    width: 350px;
Add Comment
Please, Sign In to add comment