$sa = $con_page[$dao->id]['starting_amount'];
$ga = $con_page[$dao->id]['goal_amount'];
}
-
+
$query = "SELECT * FROM civicrm_wci_progress_bar_formula WHERE progress_bar_id =" . $idPB;
$params = array();
$data["color_border"] = $dao->color_border;
$data["color_button"] = $dao->color_button;
$data["color_button_bg"] = $dao->color_button_bg;
+ $data["pb_percentage"] = CRM_Wci_BAO_ProgressBar::getProgressbarPercentage($dao->progress_bar_id);
}
return $data;
}
else {
$('#custom_template').attr("disabled",true);
- }
+ }
+ if( $('#title').val() != "") {
+ $('#embd_code').parent().parent().parent().show();
+ } else {
+ $('#embd_code').parent().parent().parent().hide();
+ }
+// $('#embd_code').attr("disabled",true);
}
$(document).ready(setState)
$('#override').click(setState);
+/*
+ $("input[name='_qf_CreateWidget_savenprev']").on('click', function( e ) {
+ e.preventDefault();
+ alert( document.title );
+
+ });*/
});
</script>
'color_button' => array(ts('Widget button text color'),
'text',
FALSE,
- '#96C0E7',
+ '#000000',
),
'color_button_bg' => array(ts('Widget button background color'),
'text',
$this->add('checkbox', 'override', ts('Override default template'));
$this->add('textarea', 'custom_template', ts('Custom template:<br><SMALL><font color="red">Please customize the smarty v2 template only if you know what you are doing</font></SMALL>'));
+ $this->addElement('submit','preview','name="Save and Preview" id="preview"');
$this->addButtons(array(
array(
'type' => 'submit',
'name' => ts('Save'),
'isDefault' => TRUE,
),
+ array(
+ 'type' => 'savenprev',
+ 'name' => ts('Save & Preview'),
+ ),
));
-
+
+ $this->add('textarea', 'embd_code', ts('Code to embed:'));
+
// export form elements
$this->assign('elementNames', $this->getRenderableElementNames());
- $smarty = CRM_Core_Smarty::singleton();
if (isset($this->_id)) {
/** Updating existing widget*/
'custom_template' => $cust_templ));
}
}
+ $emb_code = "<script src=\"http://code.jquery.com/jquery-1.9.1.min.js\"></script>
+<script type=\"text/javascript\" src=\"http://localhost/F3/sites/all/modules/civicrm/extensions/civicrm-wci/extern/wciwidget.php?widgetId=" . $this->_id . "\"></script>";
+ $this->getElement('embd_code')->setValue($emb_code);
}
else {
/** Keep template in civicrm-wci/templates folder*/
private $_id;
function preProcess() {
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, NULL, 'REQUEST');
- CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.wci', 'addmore.js');
+ CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.wci', 'F3/sites/all/modules/civicrm/extensions/civicrm-wci/addmore.js');
parent::preProcess();
}
function fillData() {
} else {
$data = CRM_Wci_BAO_Widget::getWidgetData($widgetId);
- $template->assign('form', $data);
+ $template->assign('wciform', $data);
$template->template_dir[] = $_SERVER['DOCUMENT_ROOT'] . "/F3/sites/all/modules/civicrm/extensions/civicrm-wci/templates/CRM/Wci/Page";
$wcidata = $template->fetch('wciwidget.tpl');
</div>
{/foreach}
+{if $form.title.value != ""}
+ {php}
+ if(isset($_REQUEST['id'])) {
+ $wid_id = $_REQUEST['id'];
+ $data = CRM_Wci_BAO_Widget::getWidgetData($wid_id);
+ $template = CRM_Core_Smarty::singleton();
+ $template->assign('wciform', $data);
+ $template->template_dir[] = $_SERVER['DOCUMENT_ROOT'] . "/F3/sites/all/modules/civicrm/extensions/civicrm-wci/templates/CRM/Wci/Page";
+ $wcidata = $template->fetch('wciwidget.tpl');
+ }
+ {/php}
+
+ <div class="crm-section">
+ <div class="content">
+ {include file="CRM/Wci/Page/wciwidget.tpl"}
+ </div>
+ </div>
+{/if}
+
{* FIELD EXAMPLE: OPTION 2 (MANUAL LAYOUT)
<div>
</div>
{* FOOTER *}
+
<div class="crm-submit-buttons">
{include file="CRM/common/formButtons.tpl" location="bottom"}
</div>
+
--- /dev/null
+{*
+<h3>This new page is generated by CRM/Wci/Page/WidgetList.php</h3>
+*}
+{* Example: Display a variable directly
+<p>The current time is {$currentTime}</p>
+*}
+{* Example: Display a translated string -- which happens to include a variable
+<p>{ts 1=$currentTime}(In your native language) The current time is %1.{/ts}</p>
+*}
+
+ {if $rows}
+ <div id="configure_contribution_page">
+ {strip}
+
+ {include file="CRM/common/pager.tpl" location="top"}
+ {include file="CRM/common/pagerAToZ.tpl"}
+ {* handle enable/disable actions *}
+ {include file="CRM/common/enableDisable.tpl"}
+ {include file="CRM/common/jsortable.tpl"}
+ <table id="options" class="display">
+ <thead>
+ <tr>
+ <th id="sortable">{ts}Title{/ts}</th>
+ <th>{ts}Description{/ts}</th>
+ {*<th>{ts}Enabled?{/ts}</th>*}
+ {*
+ {if call_user_func(array('CRM_Campaign_BAO_Campaign','isCampaignEnable'))}
+ <th>{ts}Campaign{/ts}</th>
+ {/if} *}
+ <th></th>
+ </tr>
+ </thead>
+ {foreach from=$rows item=row}
+ <tr id="row_{$row.id}" > {* class="{if NOT $row.is_active} disabled{/if}" *}
+ <td><strong>{$row.title}</strong></td>
+ <td>{$row.description}</td>
+{* <td id="row_{$row.id}_status">{if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
+ {if call_user_func(array('CRM_Campaign_BAO_Campaign','isCampaignEnable'))}
+ <td>{$row.campaign}</td>
+ {/if} *}
+ <td class="crm-contribution-page-actions right nowrap">
+
+ {if $row.configureActionLinks}
+ <div class="crm-contribution-page-configure-actions">
+ {$row.configureActionLinks|replace:'xx':$row.id}
+ </div>
+ {/if}
+
+ {if $row.contributionLinks}
+ <div class="crm-contribution-online-contribution-actions">
+ {$row.contributionLinks|replace:'xx':$row.id}
+ </div>
+ {/if}
+
+ {if $row.onlineContributionLinks}
+ <div class="crm-contribution-search-contribution-actions">
+ {$row.onlineContributionLinks|replace:'xx':$row.id}
+ </div>
+ {/if}
+
+ <div class="crm-contribution-page-more">
+ {$row.action|replace:'xx':$row.id}
+ </div>
+
+ </td>
+
+ </tr>
+ {/foreach}
+ </table>
+
+ {/strip}
+ </div>
+ {else}
+ {if $isSearch eq 1}
+ <div class="status messages">
+ <img src="{$config->resourceBase}i/Inform.gif" alt="{ts}status{/ts}"/>
+ {capture assign=browseURL}{crmURL p='civicrm/contribute/manage' q="reset=1"}{/capture}
+ {ts}No available Contribution Pages match your search criteria. Suggestions:{/ts}
+ <div class="spacer"></div>
+ <ul>
+ <li>{ts}Check your spelling.{/ts}</li>
+ <li>{ts}Try a different spelling or use fewer letters.{/ts}</li>
+ <li>{ts}Make sure you have enough privileges in the access control system.{/ts}</li>
+ </ul>
+ {ts 1=$browseURL}Or you can <a href='%1'>browse all available Contribution Pages</a>.{/ts}
+ </div>
+ {else}
+ <div class="messages status no-popup">
+ <div class="icon inform-icon"></div>
+ {ts 1=$newPageURL}No contribution pages have been created yet. Click <a accesskey="N" href='%1'>here</a> to create a new contribution page.{/ts}
+ </div>
+ {/if}
+ {/if}
--- /dev/null
+{literal}
+<style>
+ .crm-wci-widget {
+ font-size:12px;
+ font-family:Helvetica, Arial, sans;
+ padding:6px;
+ -moz-border-radius: 4px;
+ -webkit-border-radius: 4px;
+ -khtml-border-radius: 4px;
+ border-radius: 4px;
+ border:1px solid #96C0E7;
+ }
+
+ .crm-wci-widget.thin {
+ width: 150px;
+ }
+
+ .crm-wci-widget.normal {
+ width: 200px;
+ }
+
+ .crm-wci-widget.wide {
+ width: 250px;
+ }
+
+ .crm-wci-widget h5 {
+ font-size:14px;
+ padding:3px;
+ margin: 0px;
+ text-align:center;
+ -moz-border-radius: 4px;
+ -webkit-border-radius: 4px;
+ -khtml-border-radius: 4px;
+ border-radius: 4px;
+ }
+
+ .crm-wci-widget .crm-amounts {
+ height:1em;
+ margin:.8em 0px;
+ font-size:13px;
+ }
+ .crm-wci-widget .crm-amount-low {
+ float:left;
+ }
+ .crm-wci-widget .crm-amount-high {
+ float:right;
+ }
+ .crm-wci-widget .crm-percentage {
+ margin:0px 30%;
+ text-align:center;
+ }
+ .crm-wci-widget .crm-amount-bar {
+ background-color:#FFF;
+ width:100%;
+ display:block;
+ border:1px solid #CECECE;
+ -moz-border-radius: 4px;
+ -webkit-border-radius: 4px;
+ -khtml-border-radius: 4px;
+ border-radius: 4px;
+ margin-bottom:.8em;
+ text-align:left;
+ }
+ .crm-wci-widget .crm-amount-fill {
+ background-color:#2786C2;
+ height:1em;
+ display:block;
+ -moz-border-radius: 4px 0px 0px 4px;
+ -webkit-border-radius: 4px 0px 0px 4px;
+ -khtml-border-radius: 4px 0px 0px 4px;
+ border-radius: 4px 0px 0px 4px;
+ text-align:left;
+ width: {/literal}{$wciform.pb_percentage}{literal}%; /* progress bar percentage */
+ }
+ .crm-wci-widget .crm-amount-raised-wrapper {
+ margin-bottom:.8em;
+ }
+ .crm-wci-widget .crm-amount-raised {
+ font-weight:bold;
+ }
+
+ .crm-wci-widget .crm-logo {
+ text-align:center;
+ }
+
+ .crm-wci-widget .crm-comments,
+ .crm-wci-widget .crm-donors,
+ .crm-wci-widget .crm-campaign {
+ font-size:11px;
+ margin-bottom:.8em;
+ }
+
+ .crm-wci-widget .crm-wci-button {
+ display:block;
+ background-color:#CECECE;
+ -moz-border-radius: 4px;
+ -webkit-border-radius: 4px;
+ -khtml-border-radius: 4px;
+ border-radius: 4px;
+ text-align:center;
+ margin:0px 10% .8em 10%;
+ text-decoration:none;
+ color:#556C82;
+ padding:2px;
+ font-size:13px;
+ }
+
+ .crm-wci-widget .crm-home-url {
+ text-decoration:none;
+ border:0px;
+ }
+
+</style>
+<style>
+ .crm-wci-widget {
+ background-color: {/literal}{$wciform.color_widget_bg}{literal}; /* background color */
+ border-color:{/literal}{$wciform.color_border}{literal}; /* border color */
+ background: {/literal}{if $wciform.image}url('{$wciform.image}'){else}none{/if}{literal}; /* background image */
+ }
+
+ .crm-wci-widget h5 {
+ color: {/literal}{$wciform.color_title}{literal};
+ background-color: {/literal}{$wciform.color_title_bg}{literal};
+ } /* title */
+
+ .crm-wci-widget .crm-amount-raised { color:#000; }
+ .crm-wci-widget .crm-amount-bar /* progress bar */
+ background-color:{/literal}{$wciform.color_bar}{literal};
+ border-color:#CECECE;
+ }
+ .crm-wci-widget .crm-amount-fill { background-color:#2786C2; }
+
+ .crm-wci-widget a.crm-wci-button { /* button color */
+ background-color:{/literal}{$wciform.color_button_bg}{literal};
+ }
+
+ .crm-wci-widget .crm-wci-button-inner { /* button text color */
+ padding:2px;
+ display:block;
+ color:{/literal}{$wciform.color_button}{literal};
+ }
+
+ .crm-wci-widget .crm-comments,
+ .crm-wci-widget .crm-donors,
+ .crm-wci-widget .crm-campaign {
+ color:{/literal}{$wciform.color_description}{literal} /* other color*/
+ }
+
+ .crm-wci-widget .crm-home-url {
+ color:{/literal}{$wciform.color_homepage_link}{literal} /* home page link color*/
+ }
+
+</style>
+<style>
+{/literal}
+ {$wciform.style_rules}
+{literal}
+</style>
+{/literal}
+
+<div id="crm_wid_{$widgetId}" class="crm-wci-widget {$wciform.size_variant}">
+ <h5 id="crm_wid_{$widgetId}_title">
+ {if $wciform.logo_image}
+ <span class="crm-logo">
+ <img src="{$wciform.logo_image}" alt={ts}Logo{/ts}>
+ </span>
+ {/if}
+ {$wciform.title}
+ </h5>
+ <div class="crm-amounts">
+ <div id="crm_wid_{$widgetId}_amt_hi" class="crm-amount-high"></div>
+ <div id="crm_wid_{$widgetId}_amt_low" class="crm-amount-low"></div>
+ <div id="crm_wid_{$widgetId}_percentage" class="crm-percentage"></div>
+ </div>
+ <div class="crm-amount-bar">
+ <div class="crm-amount-fill" id="crm_wid_{$widgetId}_amt_fill"></div>
+ </div>
+ <div id="crm_wid_{$widgetId}_donors" class="crm-donors">
+ </div>
+ <div id="crm_wid_{$widgetId}_comments" class="crm-comments">
+ {$wciform.description}
+ </div>
+ <div id="crm_wid_{$widgetId}_campaign" class="crm-campaign">
+ </div>
+ <div class="crm-wci-button-wrapper" id="crm_wid_{$widgetId}_button">
+ <a href='{crmURL p="civicrm/contribute/transact" q="reset=1&id=$wciform.button_link_to" h=0 a=1 fe=1}' class="crm-wci-button"><span class="crm-wci-button-inner" id="crm_wid_{$widgetId}_btn_txt">{$wciform.button_title}</span></a>
+ </div>
+</div>