File indexing completed on 2024-12-29 05:24:39

0001 <?php
0002 /**
0003  *  ocs-webserver
0004  *
0005  *  Copyright 2016 by pling GmbH.
0006  *
0007  *    This file is part of ocs-webserver.
0008  *
0009  *    This program is free software: you can redistribute it and/or modify
0010  *    it under the terms of the GNU Affero General Public License as
0011  *    published by the Free Software Foundation, either version 3 of the
0012  *    License, or (at your option) any later version.
0013  *
0014  *    This program is distributed in the hope that it will be useful,
0015  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
0016  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017  *    GNU Affero General Public License for more details.
0018  *
0019  *    You should have received a copy of the GNU Affero General Public License
0020  *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021  **/
0022 
0023 $helperExternalSupporterBoxSource = new Default_View_Helper_ExternalSupporterBoxSource();
0024 $helperExternalPlingButtonSource = new Default_View_Helper_ExternalPlingButtonSource();
0025 $helperExternalDonationListSource = new Default_View_Helper_ExternalDonationListSource();
0026 $paymentProvider = true;
0027 if (empty($this->product->paypal_mail) && empty($this->product->dwolla_id)) :
0028     $paymentProvider = false;
0029 endif;
0030 if (!isset($this->product->project_uuid)) {
0031     ?>
0032     <!-- error -->
0033     <?php echo $this->translate('product.error.button_code'); ?>
0034     <!-- /error -->
0035 <?php } else { ?>
0036 
0037     <ul class="nav nav-tabs">
0038         <li class="active"><a href="#support-widget" data-toggle="tab">Widget</a></li>
0039         <?php if ($paymentProvider) : ?>
0040             <li><a href="#support-box" data-toggle="tab">Box</a></li>
0041             <li><a href="#support-button" data-toggle="tab">Button</a></li>
0042             <li><a href="#support-list" data-toggle="tab">List</a></li>
0043         <?php endif; ?>
0044     </ul>
0045 
0046     <div class="tab-content" id="support-panels">
0047 
0048         <div class="tab-pane active" id="support-widget">
0049 
0050             <!-- ANGULAR JS APP -->
0051 
0052             <article class="col-lg-12 col-md-12 col-sm-12 col-xs-12 embed-option embed-option"
0053                      data-ng-app="widgetApp"
0054                      data-ng-controller="WidgetController">
0055                 <div class="title"><h3>Widget</h3></div>
0056 
0057                 <div id="configuration-options">
0058 
0059                     <!-- tab menu -->
0060                     <ul class="nav nav-tabs">
0061                         <li class="active"><a href="#general-config"
0062                                               data-toggle="tab"
0063                                               ng-click="getEmbedCode()">General</a>
0064                         </li>
0065                         <li><a href="#colors-config" data-toggle="tab" ng-click="getEmbedCode()">Colors</a></li>
0066                         <li><a href="#widget-embed-code" data-toggle="tab" ng-click="getEmbedCode()">Embed</a></li>
0067                     </ul>
0068                     <!-- /tab menu -->
0069 
0070                     <!-- tab panels -->
0071                     <div class="tab-content">
0072                         <div class="tab-pane active" id="general-config">
0073                             <div class="row">
0074                                 <div class="field col-lg-12 col-md-12 col-sm-12 col-xs-12" ng-if="pProvider == true">
0075                                     <label>show donations field</label>
0076                                     <input type="checkbox" data-ng-model="amounts.showDonationAmount"
0077                                            data-ng-init="amounts.showDonationAmount=<?= var_export($this->widgetConfig->amounts->showDonationAmount, true) ?>"/>
0078                                 </div>
0079                                 <div class="field col-lg-12 col-md-12 col-sm-12 col-xs-12" ng-if="pProvider == true">
0080                                     <label>show supporters</label>
0081                                     <input type="checkbox"
0082                                            data-ng-model="showSupporters"
0083                                            data-ng-init="showSupporters=<?= var_export($this->widgetConfig->showSupporters, true) ?>"/>
0084                                 </div>
0085                                 <div class="field col-lg-12 col-md-12 col-sm-12 col-xs-12" ng-if="pProvider == true">
0086                                     <label>show comments</label>
0087                                     <input type="checkbox"
0088                                            data-ng-model="showComments"
0089                                            data-ng-init="showComments=<?= var_export($this->widgetConfig->showComments, true) ?>"/>
0090                                 </div>
0091                                 <div class="field col-lg-12 col-md-12 col-sm-12 col-xs-12">
0092                                     <label>pling logo</label>
0093                                     <input type="radio" data-ng-model="logo" value="grey"><span>grey</span>
0094                                     <input type="radio" data-ng-model="logo" value="orange"><span>orange</span>
0095                                     <input type="radio" data-ng-model="logo" value="icon"><span>icon</span>
0096                                 </div>
0097                             </div>
0098                         </div>
0099 
0100                         <div class="tab-pane" id="colors-config">
0101                             <div class="row">
0102                                 <div class="field col-lg-12 col-md-12 col-sm-12 col-xs-12">
0103                                     <label>widget background</label>
0104                                     <input class="color-input" colorpicker maxlength="7" size="7"
0105                                            data-ng-model="colors.widgetBg" value="{{colors.widgetBg}}"/>
0106                                 </div>
0107                                 <div class="field col-lg-12 col-md-12 col-sm-12 col-xs-12">
0108                                     <label>widget content</label>
0109                                     <input class="color-input" colorpicker maxlength="7" size="7"
0110                                            data-ng-model="colors.widgetContent" value="{{colors.widgetContent}}"/>
0111                                 </div>
0112                                 <div class="field col-lg-12 col-md-12 col-sm-12 col-xs-12">
0113                                     <label>headline</label>
0114                                     <input class="color-input" colorpicker maxlength="7" size="7"
0115                                            data-ng-model="colors.headline" value="{{colors.headline}}"/>
0116                                 </div>
0117                                 <div class="field col-lg-12 col-md-12 col-sm-12 col-xs-12">
0118                                     <label>text</label>
0119                                     <input class="color-input"
0120                                            colorpicker
0121                                            maxlength="7"
0122                                            size="7"
0123                                            data-ng-model="colors.text"
0124                                            value="{{colors.text}}"/>
0125                                 </div>
0126                                 <div class="field col-lg-12 col-md-12 col-sm-12 col-xs-12">
0127                                     <label>button background</label>
0128                                     <input class="color-input"
0129                                            colorpicker
0130                                            maxlength="7"
0131                                            size="7"
0132                                            data-ng-model="colors.button"
0133                                            value="{{colors.button}}"/>
0134                                 </div>
0135                                 <div class="field col-lg-12 col-md-12 col-sm-12 col-xs-12">
0136                                     <label>button text</label>
0137                                     <input class="color-input" colorpicker maxlength="7" size="7"
0138                                            data-ng-model="colors.buttonText" value="{{colors.buttonText}}"/>
0139                                 </div>
0140                             </div>
0141                         </div>
0142 
0143                         <div class="tab-pane" id="widget-embed-code">
0144                             <div class="row">
0145                                 <div id="button-input" class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
0146                                     <textarea name="widget-code" id="widget-code"
0147                                               class="light full-width">{{embedCode}}</textarea>
0148                                 </div>
0149                                 <div class="button col-lg-12 col-md-12 col-sm-12 col-xs-12">
0150                                     <button id="get-widget-box-code" class="btn btn-min-width btn-native"
0151                                             data-clipboard-target="#widget-code">get the code!
0152                                     </button>
0153                                 </div>
0154                             </div>
0155                         </div>
0156 
0157                     </div>
0158                     <!-- /tab panels -->
0159 
0160                 </div>
0161 
0162                 <div id="widget-preview">
0163 
0164                     <?php echo $this->render('widget/partial/widgetbox.phtml', array('project' => $this->product, 'supporting' => $this->supporting, 'comments' => $this->comments, 'authCode' => $this->authCode, 'widgetConfig' => $this->widgetConfig, 'paymentProvider' => $paymentProvider)); ?>
0165 
0166                 </div>
0167 
0168             </article>
0169 
0170             <!--  ANGULAR JS APP -->
0171 
0172         </div>
0173         <?php if ($paymentProvider) : ?>
0174             <div class="tab-pane" id="support-box">
0175                 <!-- supporter box code -->
0176                 <article class="col-lg-12 col-md-12 col-sm-12 col-xs-12 embed-option" id="support-box">
0177                     <div class="title"><h3>Support Box</h3></div>
0178                     <div class="demo">
0179                         <?php echo $this->render('supporterbox/partial/supporterbox.phtml', array('product' => $this->product, 'supporters' => $this->supporting, 'nrOfSupporters' => count($this->supporting), 'authCode' => $this->authCode)); ?>
0180                     </div>
0181                     <div class="embed-code">
0182                         <div id="button-input">
0183                         <textarea name="box-code" id="box-code"
0184                                   class="light"><?= $helperExternalSupporterBoxSource->externalSupporterBoxSource($this->product->project_uuid); ?></textarea>
0185                         </div>
0186                         <div class="button">
0187                             <button id="get-support-box-code" class="btn btn-min-width btn-native"
0188                                     data-clipboard-target="#box-code">get the code!
0189                             </button>
0190                         </div>
0191                     </div>
0192                 </article>
0193                 <!-- /supporter box code -->
0194             </div>
0195             <div class="tab-pane" id="support-button">
0196                 <!-- button code -->
0197                 <article class="col-lg-12 col-md-12 col-sm-12 col-xs-12 embed-option" id="support-button">
0198                     <div class="title"><h3>Support Button</h3></div>
0199                     <div class="demo"><?php echo $this->render('button/partials/button.phtml', array('projectId' => $this->product->project_uuid, 'config' => null)); ?></div>
0200                     <div class="embed-code">
0201                         <div id="button-input">
0202                         <textarea name="button-code" id="button-code"
0203                                   class="light"><?= $helperExternalPlingButtonSource->externalPlingButtonSource($this->product->project_uuid, array('websiteAuthCode' => $this->websiteAuthCode)); ?></textarea>
0204                         </div>
0205                         <div class="button">
0206                             <button id="get-support-btn-code" class="btn btn-min-width btn-native"
0207                                     data-clipboard-target="#button-code">get the code!
0208                             </button>
0209                         </div>
0210                     </div>
0211                 </article>
0212                 <!-- /button code -->
0213             </div>
0214             <div class="tab-pane" id="support-list">
0215                 <!-- supporter list code -->
0216                 <article class="col-lg-12 col-md-12 col-sm-12 col-xs-12 embed-option" id="support-list">
0217                     <div class="title"><h3>Support List</h3></div>
0218                     <div class="demo"><?php echo $this->render('donationlist/partial/donationlist.phtml', array('project' => $this->product, 'donations' => $this->donations, 'authCode' => $this->authCode)); ?></div>
0219                     <div class="embed-code">
0220                         <div id="button-input">
0221                         <textarea name="list-code" id="list-code"
0222                                   class="light"><?= $helperExternalDonationListSource->externalDonationListSource($this->product->project_uuid, array('websiteAuthCode' => $this->websiteAuthCode)); ?></textarea>
0223                         </div>
0224                         <div class="button">
0225                             <button id="get-support-list-code" class="btn btn-min-width btn-native"
0226                                     data-clipboard-target="#list-code">get the code!
0227                             </button>
0228                         </div>
0229                     </div>
0230                 </article>
0231                 <!-- /supporter list code -->
0232             </div>
0233         <?php endif; ?>
0234     </div>
0235 
0236 <?php } ?>
0237 
0238     <!-- WIDGET MODAL -->
0239     <div id="modal-widget" class="modal hide fade">
0240         <div class="modal-dialog content-modal">
0241 
0242             <div class="modal-content">
0243 
0244                 <div class="modal-header">
0245                     <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
0246                     <h3 class="center"><?= $this->translate('Customize Widget') ?></h3>
0247                 </div>
0248 
0249 
0250             </div>
0251         </div>
0252     </div>
0253     <!-- /WIDGET MODAL -->
0254 
0255 <?php $this->inlineScript()->appendScript(
0256     '    $(document).ready(function(){
0257             //ButtonCode.setupClipboardAtProductPage();
0258             ButtonCode.setupClipboardCopy(\'div#support-box\');
0259             ButtonCode.setupClipboardCopy(\'div#support-button\');
0260             ButtonCode.setupClipboardCopy(\'div#support-list\');
0261             ButtonCode.setupClipboardCopy(\'div#widget-embed-code\');
0262         });
0263     ');