Exemplo n.º 1
0
 public function executeMyCampaigns()
 {
     $user = $this->getGuardUser();
     if ($user) {
         if ($this->getUser()->hasCredential(myUser::CREDENTIAL_ADMIN) || StoreTable::value(StoreTable::CAMAPIGN_CREATE_ON)) {
             $this->create_form = new NewCampaignNameForm();
         }
         $this->join_form = new SelectCampaignForm(array(), array('user' => $user, 'is_member' => false, 'empty' => 'join campaign', SelectCampaignForm::NAME => 'select_join_campaign', SelectCampaignForm::HELP => 'Join the campaign of your group or organisation. Within each campaign, you can start as many actions as you like - simultaneously or consecutively.'));
         $this->edit_form = new SelectCampaignForm(array(), array('user' => $user, 'is_member' => true, 'empty' => 'go to campaign', SelectCampaignForm::NAME => 'select_edit_campaign'));
     }
 }
Exemplo n.º 2
0
 /**
  *
  * @return Store
  */
 protected function getStore($key)
 {
     if (array_key_exists($key, $this->store_cache)) {
         return $this->store_cache[$key];
     }
     $meta = $this->getOption('meta');
     $store = isset($meta['i18n']) ? StoreTable::getInstance()->findByKeyAndLanguage($key, $this->getOption('language_id')) : StoreTable::getInstance()->findByKey($key);
     if ($store) {
         return $this->store_cache[$key] = $store;
     }
     $this->store_cache[$key] = new Store();
     $this->store_cache[$key]->setKey($key);
     if (isset($meta['i18n'])) {
         $this->store_cache[$key]->setLanguageId($this->getOption('language_id'));
     }
     return $this->store_cache[$key];
 }
Exemplo n.º 3
0
 public function executeFooter()
 {
     $store = StoreTable::getInstance();
     $terms = $store->findByKeyCached(StoreTable::TERMS_FOOTER);
     $terms_title = $store->findByKeyCached(StoreTable::TERMS_TITLE);
     $contact = $store->findByKeyCached(StoreTable::CONTACT_FOOTER);
     $contact_title = $store->findByKeyCached(StoreTable::CONTACT_TITLE);
     $imprint = $store->findByKeyCached(StoreTable::IMPRINT_FOOTER);
     $imprint_title = $store->findByKeyCached(StoreTable::IMPRINT_TITLE);
     $footer_title = $store->findByKeyCached(StoreTable::FOOTER_TITLE);
     $footer_link = $store->findByKeyCached(StoreTable::FOOTER_LINK);
     if ($terms) {
         $this->setContentTags($terms);
     }
     if ($terms_title) {
         $this->addContentTags($terms_title);
     }
     if ($contact) {
         $this->setContentTags($contact);
     }
     if ($contact_title) {
         $this->addContentTags($contact_title);
     }
     if ($imprint) {
         $this->setContentTags($imprint);
     }
     if ($imprint_title) {
         $this->addContentTags($imprint_title);
     }
     if ($footer_title) {
         $this->addContentTags($footer_title);
     }
     if ($footer_link) {
         $this->addContentTags($footer_link);
     }
     $this->terms = $terms ? $terms->getValue() : '';
     $this->terms_title = $terms_title ? $terms_title->getValue() : '';
     $this->contact = $contact ? $contact->getValue() : '';
     $this->contact_title = $contact_title ? $contact_title->getValue() : '';
     $this->imprint = $imprint ? $imprint->getValue() : '';
     $this->imprint_title = $imprint_title ? $imprint_title->getValue() : '';
     $this->footer_title = $footer_title ? $footer_title->getValue() : '';
     $this->footer_link = $footer_link ? $footer_link->getValue() : '';
 }
Exemplo n.º 4
0
 public function executePrivacyLang(sfWebRequest $request)
 {
     $this->campaign = CampaignTable::getInstance()->findById($request->getParameter('id'), $this->userIsAdmin());
     /* @var $this->campaign Campaign */
     if (!$this->campaign) {
         return $this->notFound();
     }
     if (!$this->getGuardUser()->isCampaignAdmin($this->campaign)) {
         return $this->noAccess();
     }
     $this->languages = LanguageTable::getInstance()->queryAll()->execute();
     $this->language = LanguageTable::getInstance()->find($request->getParameter('lang'));
     if (!$this->language) {
         return $this->notFound();
     }
     $campaign_store = CampaignStoreTable::getInstance()->findByCampaignLanguageKey($this->campaign, $this->language, CampaignStoreTable::KEY_PRIVACY_POLICY);
     if (!$campaign_store) {
         $campaign_store = new CampaignStore();
         $campaign_store->setCampaign($this->campaign);
         $campaign_store->setLanguage($this->language);
         $campaign_store->setKey(CampaignStoreTable::KEY_PRIVACY_POLICY);
         $store = StoreTable::getInstance()->findByKeyAndLanguage(StoreTable::ACTION_PRIVACY_POLICY, $campaign_store->getLanguage()->getId());
         if (!$store) {
             $store = StoreTable::getInstance()->findByKeyAndLanguage(StoreTable::ACTION_PRIVACY_POLICY, 'en');
         }
         if ($store) {
             $campaign_store->setValue($store->getField('body'));
         }
     }
     $this->form = new CampaignStoreForm($campaign_store);
     if ($request->isMethod('post')) {
         $this->form->bind($request->getPostParameter($this->form->getName()));
         if ($this->form->isValid()) {
             $before = $campaign_store->getValue();
             $this->form->save();
             $data_owner = $this->campaign->getDataOwnerId() ? $this->campaign->getDataOwner() : null;
             /* @var $data_owner sfGuardUser */
             if ($data_owner && $this->getGuardUser()->getId() != $data_owner->getId()) {
                 $ticket = TicketTable::getInstance()->generate(array(TicketTable::CREATE_AUTO_FROM => true, TicketTable::CREATE_TO => $data_owner, TicketTable::CREATE_CAMPAIGN => $this->campaign, TicketTable::CREATE_KIND => TicketTable::KIND_PRIVACY_POLICY_CHANGED, TicketTable::CREATE_TEXT => $this->getGuardUser()->getFullName() . ' (' . $this->getGuardUser()->getOrganisation() . ") modified the privacy policy text '" . $this->language->getName() . "'\n" . "BEFORE:\n" . $before . "\n\nAFTER:\n" . $campaign_store->getValue()));
                 $ticket->save();
                 $ticket->notifyAdmin();
             }
             return $this->ajax()->remove('#no_text')->alert('Saved.', '', '#campaign_privacy_form .form-actions', 'before')->render();
         }
         return $this->ajax()->form($this->form)->render();
     }
     $this->includeMarkdown();
     $this->includeHighlight();
 }
Exemplo n.º 5
0
<?php

/* @var $sf_content string */
/* @var $sf_user myUser */
?>
<!DOCTYPE html>
<html>
  <head>
    <?php 
use_helper('I18N');
$portal_name = StoreTable::value(StoreTable::PORTAL_NAME);
$title = $sf_response->getTitle();
$sf_response->setTitle(($title ? $title . ' - ' : '') . $portal_name);
$sf_response->addMeta('description', StoreTable::value(StoreTable::PORTAL_META_DESCRIPTION));
$sf_response->addMeta('keywords', StoreTable::value(StoreTable::PORTAL_META_KEYWORDS));
include_http_metas();
include_metas();
include_title();
?>
    <link rel="shortcut icon" href="<?php 
echo public_path('favicon.ico');
?>
" />
    <?php 
include_stylesheets();
//    include_javascripts();
?>
  </head>
  <body class="container">
    <div class="modal">
      <div class="modal-header"><?php 
Exemplo n.º 6
0
 public function executeSign(sfWebRequest $request)
 {
     // hash check
     $id = $request->getParameter('id');
     $hash = $request->getParameter('hash');
     if (!is_numeric($id) || !is_string($hash)) {
         $this->forward404();
     }
     $id = ltrim($id, ' 0');
     if (!Widget::isValidLastHash($id, $hash)) {
         $this->forward404();
     }
     $this->setLayout(false);
     $this->fetchWidget();
     $this->petition = $this->widget['Petition'];
     $this->petition_text = $this->widget['PetitionText'];
     $this->lang = $this->petition_text['language_id'];
     $this->getUser()->setCulture($this->lang);
     $widget_texts = $this->petition->getWidgetIndividualiseText();
     $this->title = $widget_texts && !empty($this->widget['title']) ? $this->widget['title'] : $this->petition_text['title'];
     $this->target = $widget_texts ? $this->widget['target'] : $this->petition_text['target'];
     $this->background = $widget_texts ? $this->widget['background'] : $this->petition_text['background'];
     $this->paypal_email = StoreTable::value(StoreTable::DONATIONS_PAYPAL) ? $this->widget->getFinalPaypalEmail() : '';
     $this->paypal_ref = sprintf("%s%s%s", $this->petition['id'], $this->petition_text['language_id'], $this->widget['id']);
     $this->read_more_url = $this->petition['read_more_url'];
     $this->width = $this->widget->getStyling('width');
     $this->font_family = $this->petition->getStyleFontFamily();
     $widget_colors = $this->petition->getWidgetIndividualiseDesign();
     foreach (array('title_color', 'body_color', 'button_color', 'bg_left_color', 'bg_right_color', 'form_title_color') as $style) {
         if ($widget_colors) {
             $this->{$style} = $this->widget->getStyling($style, $this->petition['style_' . $style]);
         } else {
             $this->{$style} = $this->petition['style_' . $style];
         }
     }
     $sign = new PetitionSigning();
     $sign['Petition'] = $this->widget['Petition'];
     $sign['Widget'] = $this->widget;
     if ($request->isMethod('post') && $request->hasParameter('widget')) {
         $form_param = $request->getParameter('widget');
         if (is_scalar($form_param['edit_code']) && !empty($form_param['edit_code'])) {
             $new_widget = Doctrine_Core::getTable('Widget')->createQuery('w')->where('w.id = ?', $id)->andWhere('w.edit_code = ?', $form_param['edit_code'])->addFrom('w.Campaign, w.Petition, w.PetitionText')->fetchOne();
         }
     }
     if (!isset($new_widget)) {
         $new_widget = new Widget();
         $new_widget['Parent'] = $this->widget;
         $new_widget['Campaign'] = $this->widget['Campaign'];
         $new_widget['Petition'] = $this->widget['Petition'];
         $new_widget['PetitionText'] = $this->widget['PetitionText'];
     }
     $this->form = new PetitionSigningForm($sign, array('validation_kind' => PetitionSigning::VALIDATION_KIND_EMAIL));
     $this->form_embed = new WidgetPublicForm($new_widget);
     $extra = array();
     if ($this->getRequest()->isMethod('post')) {
         $this->getResponse()->setContentType('text/javascript');
         $ajax_response_form = null;
         // It is a signing form
         if ($request->hasParameter($this->form->getName())) {
             if ($this->petition->isBefore() || $this->petition->isAfter()) {
                 return $this->renderText(json_encode(array('over' => true)));
             }
             $ajax_response_form = $this->form;
             $this->form->bind($request->getPostParameter($this->form->getName()));
             if ($this->form->isValid()) {
                 $this->form->save();
                 if (sfConfig::get('sf_environment') === 'stress') {
                     // ONLY FOR STRESS TEST !!!
                     $extra['code'] = $this->form->getObject()->getId() . '-' . $this->form->getObject()->getValidationData();
                 }
                 $search_table = PetitionSigningSearchTable::getInstance();
                 $search_table->savePetitionSigning($sign, false);
                 $con = $search_table->getConnection();
                 $ref = $this->form->getValue(Petition::FIELD_REF);
                 if (!(strpos($ref, 'http://') === 0 || strpos($ref, 'http://') === 0)) {
                     $ref = null;
                 }
                 $sql_time = gmdate('Y-m-d H:i:s');
                 // DQL query would invalidate petition cache so let's use SQL
                 $con->exec('update petition set activity_at = ? where id = ?', array($sql_time, $this->petition->getId()));
                 if ($ref) {
                     $con->exec('update widget set activity_at = ?, last_ref = ? where id = ?', array($sql_time, $ref, $this->widget->getId()));
                 } else {
                     $con->exec('update widget set activity_at = ? where id = ?', array($sql_time, $this->widget->getId()));
                 }
             }
         } else {
             if ($request->hasParameter($this->form_embed->getName())) {
                 $ajax_response_form = $this->form_embed;
                 $this->form_embed->bind($request->getPostParameter($this->form_embed->getName()));
                 if ($this->form_embed->isValid()) {
                     $this->form_embed->save();
                     $extra['id'] = $this->form_embed->getObject()->getId();
                     $extra['edit_code'] = $this->form_embed->getObject()->getEditCode();
                     $extra['markup'] = UtilLink::widgetMarkup($extra['id']);
                 } else {
                 }
             } else {
                 if ($request->hasParameter('target_selector')) {
                     $target_selector = $request->getParameter('target_selector');
                     if (is_scalar($target_selector)) {
                         return $this->renderText(json_encode($this->petition->getTargetSelectorChoices($target_selector)));
                     }
                 } else {
                     if ($request->hasParameter('target_selector1') && $request->hasParameter('target_selector2')) {
                         $target_selector1 = $request->getParameter('target_selector1');
                         $target_selector2 = $request->getParameter('target_selector2');
                         if (is_scalar($target_selector1) && is_scalar($target_selector2)) {
                             return $this->renderText(json_encode($this->petition->getTargetSelectorChoices2($target_selector1, $target_selector2)));
                         }
                     }
                 }
             }
         }
         return $this->renderPartial('json_form', array('form' => $ajax_response_form, 'extra' => $extra));
     }
 }
Exemplo n.º 7
0
    <?php 
include_stylesheets();
include_javascripts();
?>
  </head>
  <body class="container">
    <header class="row">
      <div class="span3">
        <a href="<?php 
echo url_for('homepage');
?>
"><img src="<?php 
echo image_path('store/' . StoreTable::value(StoreTable::PORTAL_LOGO));
?>
?<?php 
echo StoreTable::version(StoreTable::PORTAL_LOGO);
?>
" alt="<?php 
echo $portal_name;
?>
" /></a>
      </div>
      <nav class="navbar span9"><?php 
include_component('d_home', 'menu', array('a' => $sf_user->isAuthenticated() ? 1 : 0, 'b' => $sf_user->hasCredential('homepage') ? 1 : 0));
?>
</nav>
    </header>
    <?php 
echo $sf_content;
?>
    <?php 
Exemplo n.º 8
0
 public function executeTranslationDefaultText(sfWebRequest $request)
 {
     $campaign = CampaignTable::getInstance()->findById($request->getParameter('id'), $this->userIsAdmin());
     if (!$campaign) {
         return $this->notFound();
     }
     if (!$this->getGuardUser()->isCampaignMember($campaign)) {
         return $this->noAccess();
     }
     $form = new TranslationForm();
     $form_name = $form->getName();
     $value = $request->getGetParameter('value');
     if (!is_string($value)) {
         return $this->notFound();
     }
     $language = LanguageTable::getInstance()->find($value);
     if (!$language) {
         return $this->notFound();
     }
     $validation_email = StoreTable::getInstance()->findByKeyAndLanguageCached(StoreTable::SIGNING_VALIDATION_EMAIL, $value);
     if ($validation_email) {
         $this->ajax()->val('#' . $form_name . '_email_validation_subject', $validation_email->getField('subject', ''));
         $this->ajax()->val('#' . $form_name . '_email_validation_body', $validation_email->getField('body', ''));
     }
     $tellyourfriend_email = StoreTable::getInstance()->findByKeyAndLanguageCached(StoreTable::ACTION_TELL_YOUR_FRIEND_EMAIL, $value);
     if ($tellyourfriend_email) {
         $this->ajax()->val('#' . $form_name . '_email_tellyour_subject', $tellyourfriend_email->getField('subject', ''));
         $this->ajax()->val('#' . $form_name . '_email_tellyour_body', $tellyourfriend_email->getField('body', ''));
     }
     $default_campaign_privacy = CampaignStoreTable::getInstance()->findByCampaignLanguageKey($campaign, $language, CampaignStoreTable::KEY_PRIVACY_POLICY);
     if ($default_campaign_privacy) {
         $this->ajax()->val('#' . $form_name . '_privacy_policy_body', $default_campaign_privacy->getValue());
     } else {
         $privacy = StoreTable::getInstance()->findByKeyAndLanguageCached(StoreTable::ACTION_PRIVACY_POLICY, $value);
         if ($privacy) {
             $this->ajax()->val('#' . $form_name . '_privacy_policy_body', $privacy->getField('body', ''));
         }
     }
     return $this->ajax()->render();
 }
Exemplo n.º 9
0
 public function executeReset(sfWebRequest $request)
 {
     if (!StoreTable::getInstance()->getValueCached(StoreTable::REGISTER_ON)) {
         return $this->notFound();
     }
     $id = $request->getParameter('id');
     $code = $request->getParameter('code');
     if ($this->getUser()->isAuthenticated() && $this->getGuardUser()->getId() == $id) {
         return $this->redirect($this->generateUrl('dashboard'));
     }
     $user = sfGuardUserTable::getInstance()->getByPasswordForgottenCode($id, $code);
     if ($user) {
         $this->user = $user;
         $form = new sfGuardChangeUserPasswordForm($user);
         $this->form = $form;
         if ($request->isMethod('post')) {
             $form->bind($request->getParameter($form->getName()));
             if ($form->isValid()) {
                 $this->_deleteOldUserForgotPasswordRecords($user->getId());
                 $form->save();
                 $login_url = $this->generateUrl('ajax_signin');
                 return $this->ajax()->form($form)->attr('#reset_form input, #reset_form button', 'disabled', 'disabled')->alert('Password changed. You may <a class="ajax_link" href="' . $login_url . '">login</a> now', '', '#reset_form .form-actions', 'before', true)->render();
             } else {
                 return $this->ajax()->form($form)->render();
             }
         }
     }
 }
Exemplo n.º 10
0
 public function executeImprint(sfWebRequest $request)
 {
     $store = StoreTable::getInstance();
     $imprint_content = $store->findByKeyCached(StoreTable::IMPRINT_CONTENT);
     $imprint_title = $store->findByKeyCached(StoreTable::IMPRINT_TITLE);
     if ($imprint_content) {
         $this->setContentTags($imprint_content);
     }
     if ($imprint_title) {
         $this->addContentTags($imprint_title);
     }
     $this->imprint_content = $imprint_content ? $imprint_content->getValue() : '';
     $this->imprint_title = $imprint_title ? $imprint_title->getValue() : '';
 }
Exemplo n.º 11
0
 public static function useSender()
 {
     return StoreTable::getInstance()->getValueCached(StoreTable::EMAIL_SENDER) ? true : false;
 }
Exemplo n.º 12
0
 public function executeEdit(sfWebRequest $request)
 {
     $id = $request->getParameter('id');
     if (is_numeric($id)) {
         $user = sfGuardUserTable::getInstance()->find($id);
         /* @var $user sfGuardUser */
         if (!$user) {
             return $this->notFound();
         }
     } else {
         $user = new sfGuardUser();
         $user->setIsActive(false);
     }
     if (!$this->getGuardUser()->getIsSuperAdmin() && $user->getIsSuperAdmin()) {
         $this->noAccess();
     }
     if ($user->isNew()) {
         $this->form = new UserNewForm($user);
     } else {
         $this->form = new UserForm($user);
     }
     if ($request->isMethod('post')) {
         $this->form->bind($request->getPostParameter($this->form->getName()));
         if ($this->form->isValid()) {
             $con = sfGuardUserTable::getInstance()->getConnection();
             $con->beginTransaction();
             try {
                 $this->form->updateGroupsList($this->form->getValues());
                 $user = $this->form->updateObject();
                 $user->setUsername($user->getEmailAddress());
                 if ($user->isNew()) {
                     $user->setValidationKind(sfGuardUserTable::VALIDATION_KIND_BACKEND_LINK);
                     $user->randomValidationCode();
                     $user->save();
                     $subject = 'validate activation';
                     $body = "#VALIDATION-URL#";
                     $store = StoreTable::getInstance()->findByKeyAndLanguageWithFallback(StoreTable::NEW_USER_ADMIN_MAIL, $user->getLanguageId());
                     if ($store) {
                         $subject = $store->getField('subject');
                         $body = $store->getField('body');
                     }
                     $subst = array('#VALIDATION-URL#' => $this->generateUrl('user_validation', array('id' => $user->getId(), 'code' => $user->getValidationCode()), true), '#USER-NAME#' => $user->getFullName());
                     UtilMail::send(null, null, $user->getEmailAddress(), $subject, $body, null, $subst);
                 } else {
                     $user->save();
                 }
                 $con->commit();
             } catch (Exception $e) {
                 $con->rollback();
                 throw $e;
             }
             return $this->ajax()->redirectRotue('user_idx')->render();
         } else {
             return $this->ajax()->form($this->form)->render();
         }
     }
     if (!$user->isNew()) {
         $this->campaign_rights_list = CampaignRightsTable::getInstance()->queryByUser($user)->execute();
         $this->petition_rights_list = PetitionRightsTable::getInstance()->queryByUser($user)->execute();
     }
 }
 protected function doSave($con = null)
 {
     $wasNew = $this->getObject()->isNew();
     parent::doSave($con);
     if ($wasNew) {
         $widget = $this->getObject();
         $petition = $widget->getPetition();
         $petition_text = $widget->getPetitionText();
         $subject = 'Validate your widget';
         $body = "Validate: VALIDATION\nEdit: EDITCODE";
         $store = StoreTable::getInstance()->findByKeyAndLanguageWithFallback(StoreTable::EMBED_WIDGET_MAIL, $petition_text->getLanguageId());
         if ($store) {
             $subject = $store->getField('subject');
             $body = $store->getField('body');
         }
         $validation = UtilLink::widgetValidation($this->getObject()->getId(), $this->getObject()->getValidationData());
         $edit_code = UtilLink::widgetEdit($this->getObject()->getId(), $this->getObject()->getEditCode());
         $from = $petition->getFrom();
         $to = $this->getObject()->getEmail();
         $additional_subst = array('VALIDATION' => $validation, 'EDITCODE' => $edit_code, '#VALIDATION-URL#' => $validation, '#EDIT-URL#' => $edit_code);
         UtilMail::sendWithSubst(null, $from, $to, $subject, $body, $petition_text, $widget, $additional_subst);
     }
 }
 public function configure()
 {
     $this->widgetSchema->setFormFormatterName('bootstrap');
     $this->widgetSchema->setNameFormat('edit_petition[%s]');
     $user = $this->getOption(self::USER, null);
     /* @var $user sfGuardUser */
     unset($this['created_at'], $this['updated_at'], $this['campaign_id'], $this['object_version'], $this['email_targets']);
     unset($this['addnote'], $this['mailing_list_id'], $this['editable'], $this['auto_greeting'], $this['key_visual'], $this['kind']);
     unset($this['nametype'], $this['language_id'], $this['paypal_email'], $this['with_comments'], $this['with_address']);
     unset($this['with_country'], $this['default_country'], $this['pledge_header_visual'], $this['pledge_key_visual']);
     unset($this['pledge_background_color'], $this['pledge_color'], $this['pledge_head_color'], $this['pledge_font']);
     unset($this['pledge_info_columns'], $this['pledge_with_comments'], $this['activity_at'], $this['deleted_pendings']);
     unset($this['label_mode']);
     $this->setWidget('name', new sfWidgetFormTextarea(array('label' => 'Action name'), array('cols' => 90, 'rows' => 2, 'class' => 'add_popover', 'data-content' => 'Give your action a short and memorisable name. It won\'t be shown to your supporters. It\'s only for your and your colleague\'s overview.')));
     $this->getWidgetSchema()->setLabel('addnum', 'Sign-on counter start');
     $this->getWidget('addnum')->setAttribute('class', 'add_popover');
     $this->getWidget('addnum')->setAttribute('data-content', 'Add the number of activists that have signed-on to your action in the streets or via another e-action tool. The number will be added to the live counter in all widgets of your e-action. Be honest :-)');
     $this->getWidgetSchema()->setLabel('target_num', 'Sign-on counter target');
     $this->getWidget('target_num')->setAttribute('class', 'add_popover');
     $this->getWidget('target_num')->setAttribute('data-content', 'Add your action target as the number of sign-ons that you want to achieve. If you keep "0" in this field, the counter in all widgets will automatically set a motivating target – not too low, not too high – and increase the target automatically to the next level, once a level is met. We recommend keeping "0"in this field to use the automatic target setting. It\'s a fun feature :-) ');
     $this->setWidget('read_more_url', new sfWidgetFormInput(array('label' => '"Read more" link'), array('size' => 90, 'class' => 'add_popover large', 'data-content' => 'Add the URL of your campaign site (if you have a central one), including "http://" or http://www. ".  A "Read more" link will appear underneath your e-action. You may leave this field free.', 'placeholder' => 'https://www.example.com/')));
     $this->setValidator('read_more_url', new ValidatorUrl(array('required' => false)));
     $this->setWidget('landing_url', new sfWidgetFormInput(array('label' => 'Email Validation Landingpage - auto forwarding to external page'), array('size' => 90, 'class' => 'add_popover large', 'data-content' => 'Enter URL of external landing page, including \'http://\'. Leave empty for standard landing page', 'placeholder' => 'https://www.example.com/thank-you')));
     $this->setValidator('landing_url', new ValidatorUrl(array('required' => false, 'trim' => true)));
     $this->setWidget('key_visual', new sfWidgetFormInputFileEditable(array('file_src' => '/images/keyvisual/' . $this->getObject()->getKeyVisual(), 'is_image' => true, 'with_delete' => false, 'template' => '<div>%file%<br />%input%<br />%delete% %delete_label%</div>')));
     $this->setValidator('key_visual', new sfValidatorFile(array('required' => false, 'mime_categories' => 'web_images', 'path' => sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'keyvisual')));
     $this->getWidgetSchema()->setHelp('key_visual', 'Your key visual should be a strong visual expression of what your action is about. It should not contain text in case your action will be multi-lingual. Make sure, your image wider than 150 pixel but not bigger than 20kB in size. Note: portrait images will be cropped to square format!');
     $this->setWidget('show_keyvisual', new sfWidgetFormChoice(array('choices' => array(0 => 'no', 1 => 'yes'), 'label' => 'Show key visual in signing widget'), array()));
     $this->setValidator('show_keyvisual', new sfValidatorChoice(array('choices' => array(0, 1), 'required' => true)));
     if (StoreTable::value(StoreTable::DONATIONS_PAYPAL)) {
         $this->setWidget('paypal_email', new sfWidgetFormInput(array('label' => 'Paypal account for donations'), array('size' => 90, 'class' => 'add_popover', 'data-content' => 'Add your Paypal ID or Paypal email to ask your activists to support your campaign. A "Donate" link will appear underneath your e-action. If people click it, they are asked to donate a free amount of money via Paypal transaction or credit card payment powered by Paypal. You may leave this field free.')));
         $this->setValidator('paypal_email', new ValidatorEmail(array('required' => false, 'max_length' => 80)));
     }
     $this->setWidget('from_name', new sfWidgetFormInput(array(), array('size' => 90, 'class' => 'add_popover', 'data-content' => 'Any activist who wants to support your action will receive a verification email. In order to make their participation count, activists must click on the validation link in their verification email, in order to proof their consent. Otherwise, anyone could sign up to an action in anothers\' name. Please specify the name and email address that should appear as the sender of these emails. We recommend, you choose a short name that resembles the action title, and your own email address. Note: you must provide a valid email address to which you have access!')));
     $this->setValidator('from_name', new sfValidatorString(array('required' => true, 'max_length' => 80)));
     $this->setWidget('from_email', new sfWidgetFormInput(array(), array('size' => 90, 'class' => 'add_popover', 'data-content' => 'Any activist who wants to support your action will receive a verification email. In order to make their participation count, activists must click on the validation link in their verification email, in order to proof their consent. Otherwise, anyone could sign up to an action in anothers\' name. Please specify the name and email address that should appear as the sender of these emails. We recommend, you choose a short name that resembles the action title, and your own email address. Note: you must provide a valid email address to which you have access!', 'placeholder' => '*****@*****.**')));
     $this->setValidator('from_email', new ValidatorEmail(array('required' => true, 'max_length' => 80)));
     $this->getWidgetSchema()->setHelp('from_email', 'Please check if the email domain server of the email you provided allows PoliCAT to send emails with your address. Do not use an address if the SPF check result is "fail". You may use an email address if the SPF check result is "none" or "softfail". However, be aware that in these cases a certain percentage of your validation and action emails might be considered spam by some email clients. Ideally, ask your email server admin to add ' . sfConfig::get('app_spf_ip') . ' in their SPF record."');
     $this->setWidget('homepage', new sfWidgetFormChoice(array('label' => 'Feature on e-action portal', 'choices' => array('0' => 'no', '1' => 'yes')), array('class' => 'add_popover', 'data-content' => 'Select "yes" to feature your e-action on the homepage of our e-action community. Note that for each translation, you need to create at least one widget (in the translations tab) and assign it to the homepage (in the settings of each language), otherwise your action will not be featured! Disclaimer: our friendly admin will cast her or his meticulous eyes over your action and reserves the right to take your action off the portal homepage. We guess that\'s quite unlikely :-)')));
     $this->setValidator('homepage', new sfValidatorChoice(array('choices' => array('0', '1'))));
     $this->setWidget('twitter_tags', new sfWidgetFormInput(array('label' => 'Twitter hashtags'), array('size' => 90, 'class' => 'add_popover', 'data-content' => 'Enter your distinctive action tags, preceded by "#". Leave a blank space between tags. Your action tags will be added to standard tweets of your supporters. Tweets including these tags will be featured on the homepage.')));
     $possible_statuses = $this->getObject()->calcPossibleStatusForUser($user);
     if (in_array(Petition::STATUS_DELETED, $possible_statuses)) {
         $this->has_delete_status = true;
     }
     $this->setWidget('status', new sfWidgetFormChoice(array('choices' => Petition::calcStatusShow($possible_statuses)), array('class' => 'add_popover', 'data-content' => 'Keep the status on draft as long as you want to play around with the e-action settings in this tab. Note that in order to publish the e-action and create widgets, you must set the status to "active". ')));
     $this->setValidator('status', new sfValidatorChoice(array('choices' => $possible_statuses, 'required' => true)));
     $this->setWidget('updated_at', new sfWidgetFormInputHidden());
     $this->setValidator('updated_at', new ValidatorUnchanged(array('fix' => $this->getObject()->getUpdatedAt())));
     $this->setWidget('start_at', new sfWidgetFormInput(array('type' => 'date'), array('class' => 'add_popover', 'data-content' => 'Leave empty to go live as of immediate. If you pick a later date, you can nevertheless already create widgets and embed them into other websites. However, widgets will not allow for sign-ons before the start date.')));
     $this->setWidget('end_at', new sfWidgetFormInput(array('type' => 'date'), array('class' => 'add_popover', 'data-content' => 'Pick an end date for your action. When this date has passed, your widgets will not allow for any more sign-ons. Pick a realistic end date. You may change it at later stage, if necessary.')));
     $fonts = array('"Helvetica Neue",Helvetica,Arial,sans-serif', 'Georgia, serif', '"Palatino Linotype", "Book Antiqua", Palatino, serif', '"Times New Roman", Times, serif', 'Arial, Helvetica, sans-serif', '"Arial Black", Gadget, sans-serif', '"Comic Sans MS", cursive, sans-serif', 'Impact, Charcoal, sans-serif', '"Lucida Sans Unicode", "Lucida Grande", sans-serif', 'Tahoma, Geneva, sans-serif', '"Trebuchet MS", Helvetica, sans-serif', 'Verdana, Geneva, sans-serif', '"Courier New", Courier, monospace', '"Lucida Console", Monaco, monospace', '"Lucida Sans Unicode", Vardana, Arial');
     if ($this->getObject()->isEmailKind()) {
         // EMAIL, GEO, GEO_EXTRA => editable
         $this->setWidget('editable', new sfWidgetFormChoice(array('choices' => Petition::$EDITABLE_SHOW, 'label' => 'Text editable'), array('class' => 'add_popover', 'data-content' => 'If you enable this, activists can modify the action email text as they wish. We recommend you keep the box ticked and encourage your activists to personalise their action emails.')));
         $this->setValidator('editable', new sfValidatorChoice(array('choices' => array_keys(Petition::$EDITABLE_SHOW), 'required' => true)));
         if ($this->getObject()->getKind() == Petition::KIND_OLD_EMAIL_ACTION || $this->getObject()->getKind() == Petition::KIND_EMAIL_ACTION) {
             // EMAIL  => email_target_email_*, email_target_name_*
             $email_targets_json = $this->getObject()->getEmailTargets();
             if (is_string($email_targets_json)) {
                 $email_targets_json = json_decode($email_targets_json, true);
             }
             $email_targets = array();
             if (is_array($email_targets_json)) {
                 foreach ($email_targets_json as $email => $name) {
                     $email_targets[] = array('email' => $email, 'name' => $name);
                 }
             }
             $labels = array(1 => array('Name of recipient', 'Email address of recipient'), 2 => array('Name (2nd, optional)', 'Email (2nd, optional)'), 3 => array('Name (3rd, optional)', 'Email (3rd, optional)'));
             for ($i = 1; $i <= 3; $i++) {
                 $this->setWidget("email_target_email_{$i}", new sfWidgetFormInputText(array('label' => $labels[$i][1]), array('size' => 90, 'class' => 'add_popover', 'data-content' => 'Fill in the and email address of your target: the recipient of your email-action.' . ($i > 1 ? ' You may leave this field blank.' : ''))));
                 $this->setValidator("email_target_email_{$i}", new ValidatorEmail(array('max_length' => 80, 'min_length' => 3, 'required' => false, 'trim' => true)));
                 if (isset($email_targets[$i - 1])) {
                     $this->setDefault("email_target_email_{$i}", $email_targets[$i - 1]['email']);
                 }
                 $this->setWidget("email_target_name_{$i}", new sfWidgetFormInputText(array('label' => $labels[$i][0]), array('size' => 90, 'class' => 'add_popover', 'data-content' => 'Fill in the full name of your target: the recipient of your email-action.' . ($i > 1 ? ' You may leave this field blank.' : ''))));
                 $this->setValidator("email_target_name_{$i}", new sfValidatorString(array('max_length' => 80, 'min_length' => 3, 'required' => false, 'trim' => true)));
                 if (isset($email_targets[$i - 1])) {
                     $this->setDefault("email_target_name_{$i}", $email_targets[$i - 1]['name']);
                 }
             }
         }
         if ($this->getObject()->getKind() == Petition::KIND_PLEDGE) {
             $this->setWidget('pledge_with_comments', new sfWidgetFormChoice(array('label' => 'Enable comments', 'choices' => array('0' => 'no', '1' => 'yes')), array()));
             $this->setValidator('pledge_with_comments', new sfValidatorChoice(array('choices' => array('0', '1'))));
             $this->setWidget('pledge_header_visual', new sfWidgetFormInputFileEditable(array('file_src' => '/images/pledge_header_visual/' . $this->getObject()->getPledgeHeaderVisual(), 'is_image' => true, 'with_delete' => false, 'template' => '<div>%file%<br />%input%<br />%delete% %delete_label%</div>', 'label' => 'Header visual')));
             $this->getWidgetSchema()->setHelp('pledge_header_visual', 'Width should be 1170px and height about 180px. Keep the file small (<80KB). Compress PNGs with tools like http://optipng.sourceforge.net/');
             $this->setValidator('pledge_header_visual', new sfValidatorFile(array('required' => false, 'mime_categories' => 'web_images', 'path' => sfConfig::get('sf_web_dir') . '/images/pledge_header_visual')));
             $this->setWidget('pledge_key_visual', new sfWidgetFormInputFileEditable(array('file_src' => '/images/pledge_key_visual/' . $this->getObject()->getPledgeKeyVisual(), 'is_image' => true, 'with_delete' => false, 'template' => '<div>%file%<br />%input%<br />%delete% %delete_label%</div>', 'label' => 'Key visual')));
             $this->getWidgetSchema()->setHelp('pledge_key_visual', 'Dimensions should be about 140x140px. Keep the file small (<80KB).');
             $this->setValidator('pledge_key_visual', new sfValidatorFile(array('required' => false, 'mime_categories' => 'web_images', 'path' => sfConfig::get('sf_web_dir') . '/images/pledge_key_visual')));
             $this->setWidget('pledge_background_color', new sfWidgetFormInputText(array('label' => 'Background colour'), array('class' => 'color')));
             $this->setValidator('pledge_background_color', new sfValidatorRegex(array('pattern' => '/^[0-9a-f]{6}$/i')));
             $this->setWidget('pledge_color', new sfWidgetFormInputText(array('label' => 'Text colour'), array('class' => 'color')));
             $this->setValidator('pledge_color', new sfValidatorRegex(array('pattern' => '/^[0-9a-f]{6}$/i')));
             $this->setWidget('pledge_head_color', new sfWidgetFormInputText(array('label' => 'Header text colour'), array('class' => 'color')));
             $this->setValidator('pledge_head_color', new sfValidatorRegex(array('pattern' => '/^[0-9a-f]{6}$/i')));
             $this->setWidget('pledge_font', new sfWidgetFormChoice(array('choices' => array_combine($fonts, $fonts), 'label' => 'Font')));
             $this->setValidator('pledge_font', new sfValidatorChoice(array('choices' => $fonts)));
             $info_columns = $this->getObject()->getMailingListId() ? $this->getObject()->getMailingList()->getPledgeColumns() : array('country' => 'Country');
             $this->setWidget('pledge_info_columns_comma', new sfWidgetFormInput(array('type' => 'hidden', 'default' => $this->getObject()->getPledgeInfoColumnsComma(array_keys($info_columns)), 'label' => 'Target data displayed in widget'), array('class' => 'no-chosen select2sort', 'data-tags' => json_encode($info_columns), 'style' => 'width:220px', 'data-maximumSelectionSize' => 2)));
             $this->setValidator('pledge_info_columns_comma', new sfValidatorString(array('required' => false)));
         }
     }
     $this->setWidget('widget_individualise', new sfWidgetFormChoice(array('choices' => PetitionTable::$INDIVIDUALISE, 'label' => 'Setup')));
     $this->setValidator('widget_individualise', new sfValidatorChoice(array('required' => true, 'choices' => array_keys(PetitionTable::$INDIVIDUALISE))));
     $fonts[] = '"Open Sans", sans-serif';
     $this->setWidget('style_font_family', new sfWidgetFormChoice(array('choices' => array_combine($fonts, $fonts), 'label' => 'Font')));
     $this->setValidator('style_font_family', new sfValidatorChoice(array('choices' => $fonts)));
     $this->setWidget('style_title_color', new sfWidgetFormInput(array('label' => 'Title colour'), array('class' => 'color {hash:true}')));
     $this->setValidator('style_title_color', new ValidatorCssColor(array('min_length' => 7, 'max_length' => 7)));
     $this->setWidget('style_body_color', new sfWidgetFormInput(array('label' => 'Body colour'), array('class' => 'color {hash:true}')));
     $this->setValidator('style_body_color', new ValidatorCssColor(array('min_length' => 7, 'max_length' => 7)));
     $this->setWidget('style_button_color', new sfWidgetFormInput(array('label' => 'Button colour'), array('class' => 'color {hash:true}')));
     $this->setValidator('style_button_color', new ValidatorCssColor(array('min_length' => 7, 'max_length' => 7)));
     $this->setWidget('style_bg_left_color', new sfWidgetFormInput(array('label' => 'Background left colour'), array('class' => 'color {hash:true}')));
     $this->setValidator('style_bg_left_color', new ValidatorCssColor(array('min_length' => 7, 'max_length' => 7)));
     $this->setWidget('style_bg_right_color', new sfWidgetFormInput(array('label' => 'Background right colour'), array('class' => 'color {hash:true}')));
     $this->setValidator('style_bg_right_color', new ValidatorCssColor(array('min_length' => 7, 'max_length' => 7)));
     $this->setWidget('style_form_title_color', new sfWidgetFormInput(array('label' => 'Form title'), array('class' => 'color {hash:true}')));
     $this->setValidator('style_form_title_color', new ValidatorCssColor(array('min_length' => 7, 'max_length' => 7)));
     $this->getWidgetSchema()->setLabel('country_collection_id', 'Restrict Countries');
     $this->getWidgetSchema()->setHelp('country_collection_id', 'As a standard, activists can select their home country from a list of all countries in the world. You may restrict the number of country options shown, so activists can pick their country faster.');
     if ($this->getObject()->getKind() == Petition::KIND_PETITION) {
         $this->setWidget('label_mode', new sfWidgetFormChoice(array('choices' => PetitionTable::$LABEL_MODE, 'label' => 'Petition labelling')));
         $this->setValidator('label_mode', new sfValidatorChoice(array('choices' => array_keys(PetitionTable::$LABEL_MODE))));
     }
 }
Exemplo n.º 15
0
}
?>
    </div>
    <div class="modal-body">
      <div class="row">
        <div class="span3">
        <?php 
echo $form;
?>
          <br /><small><a class="ajax_link" href="<?php 
echo url_for('password_forgotten');
?>
">I have forgotten my password.</a></small>
        </div>
        <?php 
if (StoreTable::value(StoreTable::MENU_JOIN) && StoreTable::value(StoreTable::REGISTER_ON)) {
    ?>
        <div class="span2">
          or <a href="<?php 
    echo url_for('register');
    ?>
">join</a>
        </div>
        <?php 
}
?>
      </div>
    </div>
    <div class="modal-footer">
      <a class="btn" data-dismiss="modal">Close</a>
      <button class="btn btn-primary" type="submit"><?php