From 424392c59f7dcdee92f1f0a3cb93f8346bd33028 Mon Sep 17 00:00:00 2001 From: yashodha Date: Thu, 25 Jul 2013 12:59:51 +0530 Subject: [PATCH] CRM-13112 --- CRM/Campaign/Form/Petition.php | 16 +- CRM/Campaign/Page/Petition/ThankYou.php | 1 + .../Incremental/sql/4.4.alpha1.mysql.tpl | 4 + templates/CRM/Campaign/Form/Petition.tpl | 184 ++++++++++-------- .../CRM/Campaign/Page/Petition/ThankYou.tpl | 37 ++-- xml/schema/Campaign/Survey.xml | 8 + 6 files changed, 145 insertions(+), 105 deletions(-) diff --git a/CRM/Campaign/Form/Petition.php b/CRM/Campaign/Form/Petition.php index 5cc1b85b2e..3234afc73f 100644 --- a/CRM/Campaign/Form/Petition.php +++ b/CRM/Campaign/Form/Petition.php @@ -166,8 +166,8 @@ class CRM_Campaign_Form_Petition extends CRM_Core_Form { public function buildQuickForm() { if ($this->_action & CRM_Core_Action::DELETE) { - - $this->addButtons(array( + $this->addButtons( + array( array( 'type' => 'next', 'name' => ts('Delete'), @@ -182,7 +182,6 @@ class CRM_Campaign_Form_Petition extends CRM_Core_Form { return; } - $this->add('text', 'title', ts('Petition Title'), CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey', 'title'), TRUE); $attributes = CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey'); @@ -208,7 +207,8 @@ class CRM_Campaign_Form_Petition extends CRM_Core_Form { // custom group id $this->add('select', 'profile_id', ts('Activity Profile'), array( - '' => ts('- select -')) + $customProfiles + '' => ts('- select -') + ) + $customProfiles ); // thank you title and text (html allowed in text) @@ -218,6 +218,9 @@ class CRM_Campaign_Form_Petition extends CRM_Core_Form { // bypass email confirmation? $this->add('checkbox', 'bypass_confirm', ts('Bypass email confirmation')); + //is share through social media + $this->addElement('checkbox', 'is_share', ts('Allow sharing through social media?')); + // is active ? $this->add('checkbox', 'is_active', ts('Is Active?')); @@ -225,7 +228,8 @@ class CRM_Campaign_Form_Petition extends CRM_Core_Form { $this->add('checkbox', 'is_default', ts('Is Default?')); // add buttons - $this->addButtons(array( + $this->addButtons( + array( array( 'type' => 'next', 'name' => ts('Save'), @@ -256,6 +260,7 @@ class CRM_Campaign_Form_Petition extends CRM_Core_Form { $params['last_modified_id'] = $session->get('userID'); $params['last_modified_date'] = date('YmdHis'); + $params['is_share'] = CRM_Utils_Array::value('is_share', $params, FALSE); if ($this->_surveyId) { @@ -279,7 +284,6 @@ class CRM_Campaign_Form_Petition extends CRM_Core_Form { $surveyId = CRM_Campaign_BAO_Survey::create($params); - // also update the ProfileModule tables $ufJoinParams = array( 'is_active' => 1, diff --git a/CRM/Campaign/Page/Petition/ThankYou.php b/CRM/Campaign/Page/Petition/ThankYou.php index 0b6d06d55a..b4db3acaf5 100644 --- a/CRM/Campaign/Page/Petition/ThankYou.php +++ b/CRM/Campaign/Page/Petition/ThankYou.php @@ -44,6 +44,7 @@ class CRM_Campaign_Page_Petition_ThankYou extends CRM_Core_Page { $this->assign('thankyou_text', CRM_Utils_Array::value('thankyou_text', $this->petition)); $this->assign('survey_id', $petition_id); $this->assign('status_id', $id); + $this->assign('is_share', CRM_Utils_Array::value('is_share', $this->petition)); CRM_Utils_System::setTitle(CRM_Utils_Array::value('thankyou_title', $this->petition)); // send thank you or email verification emails diff --git a/CRM/Upgrade/Incremental/sql/4.4.alpha1.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.4.alpha1.mysql.tpl index 295897a1cd..aa94978dce 100644 --- a/CRM/Upgrade/Incremental/sql/4.4.alpha1.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/4.4.alpha1.mysql.tpl @@ -131,3 +131,7 @@ UPDATE civicrm_option_value -- CRM-12717 UPDATE `civicrm_navigation` SET label = '{ts escape="sql"}Misc (Undelete, PDFs, Limits, Logging, Captcha, etc.){/ts}', name = 'Misc (Undelete, PDFs, Limits, Logging, Captcha, etc.)' WHERE url = 'civicrm/admin/setting/misc&reset=1'; + +-- CRM-13112 +ALTER TABLE civicrm_survey + ADD is_share TINYINT( 4 ) NULL DEFAULT '1' COMMENT 'Can people share the petition through social media?'; diff --git a/templates/CRM/Campaign/Form/Petition.tpl b/templates/CRM/Campaign/Form/Petition.tpl index 07333c2bca..f9aa1db83b 100644 --- a/templates/CRM/Campaign/Form/Petition.tpl +++ b/templates/CRM/Campaign/Form/Petition.tpl @@ -25,100 +25,118 @@ *}
-
{include file="CRM/common/formButtons.tpl" location="top"}
-{if $action eq 8} - - - - -
-
 {ts}Are you sure you want to delete this Petition?{/ts}
-
-{else} - {if $action eq 1} -
- {ts}Use this form to Add new Survey. You can create a new Activity type, specific to this Survey or select an existing activity type for this Survey.{/ts} -
- {/if} - - - - - - - - - - - - - - - - - - - - - +
{include file="CRM/common/formButtons.tpl" location="top"}
+ {if $action eq 8} +
{$form.title.label}{$form.title.html} -
{$form.instructions.label}{$form.instructions.html} -
{$form.campaign_id.label}{$form.campaign_id.html} -
{$form.activity_type_id.label}{$form.activity_type_id.html} -
{$form.contact_profile_id.label}{$form.contact_profile_id.html}  -
{ts}Fields about the contact you want to collect.{/ts}
{$form.profile_id.label}{$form.profile_id.html}  -
{ts}Fields about the petition.{/ts}
- -
+ + + +
+
+
+  {ts}Are you sure you want to delete this Petition?{/ts}
+
+ {else} + {if $action eq 1} +
+ {ts}Use this form to Add new Survey. You can create a new Activity type, specific to this Survey or select an existing activity type for this Survey.{/ts} +
+ {/if} + + + + + + + + + + + + + + + + + + + + + - - + + - - + + + + + + - - - - - - - - - - - - -
{$form.title.label}{$form.title.html} +
{$form.instructions.label}{$form.instructions.html} +
{$form.campaign_id.label}{$form.campaign_id.html} +
{$form.activity_type_id.label}{$form.activity_type_id.html} +
{$form.contact_profile_id.label}{$form.contact_profile_id.html}  + +
{ts}Fields about the contact you want to collect.{/ts}
+
{$form.profile_id.label}{$form.profile_id.html}  + +
{ts}Fields about the petition.{/ts}
+ +
{$form.thankyou_title.label}{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_contribution_page' field='thankyou_title' id=$contributionPageID}{/if}{$form.thankyou_title.html}
-
{ts}This title will be displayed at the top of the thank-you page.{/ts}
-
{$form.thankyou_title.label}{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_contribution_page' field='thankyou_title' id=$contributionPageID}{/if}{$form.thankyou_title.html}
+ +
{ts}This title will be displayed at the top of the thank-you page.{/ts}
+
{$form.thankyou_text.label}{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_contribution_page' field='thankyou_text' id=$contributionPageID}{/if}{$form.thankyou_text.html}
-
{ts}Enter text (and optional HTML layout tags) for the thank-you message that will appear at the top of the thank-you page.{/ts}
-
{$form.thankyou_text.label}{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_contribution_page' field='thankyou_text' id=$contributionPageID}{/if}{$form.thankyou_text.html}
+ +
{ts}Enter text (and optional HTML layout tags) for the thank-you message that will appear at the top of the thank-you page.{/ts}
+
{$form.bypass_confirm.label}{$form.bypass_confirm.html} +
{ts}Disable the email confirmation for unverified contacts?{/ts}
+
{$form.bypass_confirm.label}{$form.bypass_confirm.html} -
{ts}Disable the email confirmation for unverified contacts?{/ts}
{$form.is_active.label}{$form.is_active.html} -
{ts}Is this petition active?{/ts}
{$form.is_default.label}{$form.is_default.html} -
{ts}Is this the default petition?{/ts}
-{/if} -
{include file="CRM/common/formButtons.tpl" location="bottom"}
+ + {$form.is_share.label} + {$form.is_share.html} + + + {$form.is_active.label} + {$form.is_active.html} +
{ts}Is this petition active?{/ts}
+ + + + {$form.is_default.label} + {$form.is_default.html} +
{ts}Is this the default petition?{/ts}
+ + + + {/if} +
{include file="CRM/common/formButtons.tpl" location="bottom"}
{*include profile link function*} {include file="CRM/common/buildProfileLink.tpl"} {literal} - + {/literal} diff --git a/templates/CRM/Campaign/Page/Petition/ThankYou.tpl b/templates/CRM/Campaign/Page/Petition/ThankYou.tpl index f6751c16f1..3a9777244a 100644 --- a/templates/CRM/Campaign/Page/Petition/ThankYou.tpl +++ b/templates/CRM/Campaign/Page/Petition/ThankYou.tpl @@ -25,31 +25,36 @@ *} {if $status_id eq 2} {* Signer needs to confirm signature. *} +

{ts}STEP 2: Please Check Your Email{/ts}

+

{ts}To complete and confirm your signature, please follow the activation instructions sent to the email address you provided.{/ts}

+

-

{ts}STEP 2: Please Check Your Email{/ts}

-

{ts}To complete and confirm your signature, please follow the activation instructions sent to the email address you provided.{/ts}

-

- -{ts}IMPORTANT{/ts}: {ts}Before we can add your signature, you must validate your email address by clicking on the activation link in the confirmation e-mail. Sometimes our confirmation emails get flagged as spam and are moved to your bulk folder.{/ts}
-{ts}If you haven't received an email within a few minutes, please check your spam folder.{/ts} -

- + {ts}IMPORTANT{/ts}: {ts}Before we can add your signature, you must validate your email address by clicking on the activation link in the confirmation e-mail. Sometimes our confirmation emails get flagged as spam and are moved to your bulk folder.{/ts} +
+ {ts}If you haven't received an email within a few minutes, please check your spam folder.{/ts} +

{/if} {if $status_id eq 4} -

{ts}You have already signed this petition but we need to confirm your email address.{/ts}

-{ts}IMPORTANT{/ts}: {ts}Before we can add your signature, you must validate your email address by clicking on the activation link in the confirmation e-mail. Sometimes our confirmation emails get flagged as spam and are moved to your spam folder.{/ts}
-{ts}If you haven't received an email from us, check your spam folder, it might have been wrongly classified.{/ts}
+

{ts}You have already signed this petition but weneed to confirm your email address.{/ts}

+ {ts}IMPORTANT{/ts} + : {ts}Before we can add your signature, you must validate your email address by clicking on the activation link in the confirmation e-mail. Sometimes our confirmation emails get flagged as spam and are moved to your spam folder.{/ts} +
+ {ts}If you haven't received an email from us, check your spam folder, it might have been wrongly classified.{/ts} +
{/if} {if $status_id eq 5} -

{ts}You have already signed this petition.{/ts}

+

{ts}You have already signed this petition.{/ts}

{/if} {if $status_id neq 2}{* if asked to confirm the email, focus on that and don't put additional messages *} -{if $thankyou_text} + {if $thankyou_text}
- {$thankyou_text} + {$thankyou_text}
+ {/if} + {if $is_share} + {include file="CRM/Campaign/Page/Petition/SocialNetwork.tpl" petition_id=$survey_id petitionTitle=$petitionTitle} + {/if} {/if} -{include file="CRM/Campaign/Page/Petition/SocialNetwork.tpl" petition_id=$survey_id petitionTitle=$petitionTitle} -{/if} + diff --git a/xml/schema/Campaign/Survey.xml b/xml/schema/Campaign/Survey.xml index bba9a69519..893cd2702f 100644 --- a/xml/schema/Campaign/Survey.xml +++ b/xml/schema/Campaign/Survey.xml @@ -201,4 +201,12 @@ text and html allowed. displayed above result on success page 4.2 + + is_share + Is shared through social media + boolean + 1 + Can people share the petition through social media? + 4.4 + -- 2.25.1