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 rows="5" name="embd_code" id="embd_code" class="form-textarea textarea-processed">
42 <script type="text/javascript" src="{/literal}{php}echo $widget_controller_path;{/php}{literal}?widgetId={/literal}{php}echo $wid_id;{/php}{literal}&embed=1"></script>
43 <script type="text/javascript">
44 // Cleanup functions for the document ready method
45 if ( document.addEventListener ) {
46 DOMContentLoaded = function() {
47 document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
50 } else if ( document.attachEvent ) {
51 DOMContentLoaded = function() {
52 // Make sure body exists, at least, in case IE gets a little overzealous
53 if ( document.readyState === "complete" ) {
54 document.detachEvent( "onreadystatechange", DOMContentLoaded );
59 if ( document.readyState === "complete" ) {
60 // Handle it asynchronously to allow scripts the opportunity to delay ready
61 setTimeout( onReady, 1 );
64 // Mozilla, Opera and webkit support this event
65 if ( document.addEventListener ) {
66 // Use the handy event callback
67 document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
68 // A fallback to window.onload, that will always work
69 window.addEventListener( "load", onReady, false );
70 // If IE event model is used
71 } else if ( document.attachEvent ) {
72 // ensure firing before onload,
73 // maybe late but safe also for iframes
74 document.attachEvent("onreadystatechange", DOMContentLoaded);
76 // A fallback to window.onload, that will always work
77 window.attachEvent( "onload", onReady );
81 document.getElementById('widgetwci').innerHTML = wciwidgetcode;
84 <div id='widgetwci'></div></textarea>{/literal}
85 <div class="grippie" style="margin-right: 18px;"></div>
89 <div class="clear"></div>
91 <div class="crm-section">
93 {* {include file="CRM/Wci/Page/wciwidget.tpl"} *}
95 <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
96 <script type="text/javascript" src="{php}echo $widget_controller_path;{/php}?widgetId={php}echo $wid_id;{/php}&embed=0"></script>
98 $( document ).ready(function() {ldelim}
99 $('#widgetwci').html(wciwidgetcode);
102 <div id='widgetwci'></div>
108 {* FIELD EXAMPLE: OPTION 2 (MANUAL LAYOUT)
111 <span>{$form.favorite_color.label}</span>
112 <span>{$form.favorite_color.html}</span>
117 <div class="crm-submit-buttons">
118 {include file="CRM/common/formButtons.tpl" location="bottom"}