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>
17 {if $form.title.value != ""}
19 if(isset($_REQUEST['id'])) {
20 $wid_id = $_REQUEST['id'];
21 $data = CRM_Wci_BAO_Widget::getWidgetData($wid_id);
22 $template = CRM_Core_Smarty::singleton();
23 $template->assign('wciform', $data);
24 if($data["override"] == 0) {
25 $template->template_dir[] = getWciWidgetTemplatePath();
26 $wcidata = $template->fetch('wciwidget.tpl');
28 $wcidata = $template->fetch('string:' . base64_decode($wid_page[$dao->id]['custom_template']));
30 $widget_controller_path = getWciWidgetControllerPath();
34 <div class="crm-section">
36 <label for="embd_code">Code to embed:</label>
39 <div class="resizable-textarea">
41 <textarea name="embd_code" id="embd_code" class="form-textarea textarea-processed"><script type="text/javascript">
42 // Cleanup functions for the document ready method
43 if ( document.addEventListener ) {
44 DOMContentLoaded = function() {
45 document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
48 } else if ( document.attachEvent ) {
49 DOMContentLoaded = function() {
50 // Make sure body exists, at least, in case IE gets a little overzealous
51 if ( document.readyState === "complete" ) {
52 document.detachEvent( "onreadystatechange", DOMContentLoaded );
57 if ( document.readyState === "complete" ) {
58 // Handle it asynchronously to allow scripts the opportunity to delay ready
59 setTimeout( onReady, 1 );
62 // Mozilla, Opera and webkit support this event
63 if ( document.addEventListener ) {
64 // Use the handy event callback
65 document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
66 // A fallback to window.onload, that will always work
67 window.addEventListener( "load", onReady, false );
68 // If IE event model is used
69 } else if ( document.attachEvent ) {
70 // ensure firing before onload,
71 // maybe late but safe also for iframes
72 document.attachEvent("onreadystatechange", DOMContentLoaded);
74 // A fallback to window.onload, that will always work
75 window.attachEvent( "onload", onReady );
79 document.getElementById('widgetwci').innerHTML = wciwidgetcode;
82 <div id='widgetwci'></div></textarea>{/literal}
83 <div class="grippie" style="margin-right: 18px;"></div>
87 <div class="clear"></div>
89 <div class="crm-section">
91 {* {include file="CRM/Wci/Page/wciwidget.tpl"} *}
93 <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
94 <script type="text/javascript" src="{php}echo $widget_controller_path;{/php}?widgetId={php}echo $wid_id;{/php}"></script>
96 $( document ).ready(function() {ldelim}
97 $('#widgetwci').html(wciwidgetcode);
100 <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"}