3 <div class="crm-submit-buttons">
4 {include file="CRM/common/formButtons.tpl" location="top"}
7 {* FIELD EXAMPLE: OPTION 1 (AUTOMATIC LAYOUT) *}
9 {foreach from=$elementNames item=elementName}
10 <div class="crm-section">
11 <div class="label">{$form.$elementName.label}</div>
12 <div class="content">{$form.$elementName.html}</div>
13 <div class="clear"></div>
18 if(isset($_REQUEST['id'])) {
19 $wid_id = $_REQUEST['id'];
20 $data = CRM_Wci_BAO_Widget::getWidgetData($wid_id);
21 $template = CRM_Core_Smarty::singleton();
22 $template->assign('wciform', $data);
23 if($data["override"] == 0) {
24 $template->template_dir[] = getWciWidgetTemplatePath();
25 $wcidata = $template->fetch('wciwidget.tpl');
27 $wcidata = $template->fetch('string:' . base64_decode($wid_page[$dao->id]['custom_template']));
29 $widget_controller_path = getWciWidgetControllerPath();
33 <div class="crm-section">
35 <label for="embd_code">Code to embed:</label>
38 <div class="resizable-textarea">
40 <textarea name="embd_code" id="embd_code" class="form-textarea textarea-processed">
41 <script type="text/javascript" src="{/literal}{php}echo $widget_controller_path;{/php}{literal}?widgetId={/literal}{php}echo $wid_id;{/php}{literal}"></script>
42 <script type="text/javascript">
43 // Cleanup functions for the document ready method
44 if ( document.addEventListener ) {
45 DOMContentLoaded = function() {
46 document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
49 } else if ( document.attachEvent ) {
50 DOMContentLoaded = function() {
51 // Make sure body exists, at least, in case IE gets a little overzealous
52 if ( document.readyState === "complete" ) {
53 document.detachEvent( "onreadystatechange", DOMContentLoaded );
58 if ( document.readyState === "complete" ) {
59 // Handle it asynchronously to allow scripts the opportunity to delay ready
60 setTimeout( onReady, 1 );
63 // Mozilla, Opera and webkit support this event
64 if ( document.addEventListener ) {
65 // Use the handy event callback
66 document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
67 // A fallback to window.onload, that will always work
68 window.addEventListener( "load", onReady, false );
69 // If IE event model is used
70 } else if ( document.attachEvent ) {
71 // ensure firing before onload,
72 // maybe late but safe also for iframes
73 document.attachEvent("onreadystatechange", DOMContentLoaded);
75 // A fallback to window.onload, that will always work
76 window.attachEvent( "onload", onReady );
80 document.getElementById('widgetwci').innerHTML = wciwidgetcode;
83 <div id='widgetwci'></div></textarea>{/literal}
84 <div class="grippie" style="margin-right: 18px;"></div>
88 <div class="clear"></div>
90 <div class="crm-section">
92 {* {include file="CRM/Wci/Page/wciwidget.tpl"} *}
94 <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
95 <script type="text/javascript" src="{php}echo $widget_controller_path;{/php}?widgetId={php}echo $wid_id;{/php}"></script>
97 $( document ).ready(function() {ldelim}
98 $('#widgetwci').html(wciwidgetcode);
101 <div id='widgetwci'></div>
106 {* FIELD EXAMPLE: OPTION 2 (MANUAL LAYOUT)
109 <span>{$form.favorite_color.label}</span>
110 <span>{$form.favorite_color.html}</span>
115 <div class="crm-submit-buttons">
116 {include file="CRM/common/formButtons.tpl" location="bottom"}