#29759 removed jquery. moved image to below heading
[com.zyxware.civiwci.git] / templates / CRM / Wci / Form / CreateWidget.tpl
1 {* HEADER *}
2
3 <div class="crm-submit-buttons">
4 {include file="CRM/common/formButtons.tpl" location="top"}
5 </div>
6
7 {* FIELD EXAMPLE: OPTION 1 (AUTOMATIC LAYOUT) *}
8
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>
14 </div>
15 {/foreach}
16
17 {if $form.title.value != ""}
18 {php}
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');
27 } else {
28 $wcidata = $template->fetch('string:' . base64_decode($wid_page[$dao->id]['custom_template']));
29 }
30 $widget_controller_path = getWciWidgetControllerPath();
31 }
32 {/php}
33
34 <div class="crm-section">
35 <div class="label">
36 <label for="embd_code">Code to embed:</label>
37 </div>
38 <div class="content">
39 <div class="resizable-textarea">
40 <span>{literal}
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 );
46 onReady();
47 };
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 );
53 onReady();
54 }
55 };
56 }
57 if ( document.readyState === "complete" ) {
58 // Handle it asynchronously to allow scripts the opportunity to delay ready
59 setTimeout( onReady, 1 );
60 }
61
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);
73
74 // A fallback to window.onload, that will always work
75 window.attachEvent( "onload", onReady );
76 }
77
78 function onReady( ) {
79 document.getElementById('widgetwci').innerHTML = wciwidgetcode;
80 }
81 </script>
82 <div id='widgetwci'></div></textarea>{/literal}
83 <div class="grippie" style="margin-right: 18px;"></div>
84 </span>
85 </div>
86 </div>
87 <div class="clear"></div>
88 </div>
89 <div class="crm-section">
90 <div class="content">
91 {* {include file="CRM/Wci/Page/wciwidget.tpl"} *}
92
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>
95 <script>
96 $( document ).ready(function() {ldelim}
97 $('#widgetwci').html(wciwidgetcode);
98 {rdelim} );
99 </script>
100 <div id='widgetwci'></div>
101
102 </div>
103 </div>
104 {/if}
105
106 {* FIELD EXAMPLE: OPTION 2 (MANUAL LAYOUT)
107
108 <div>
109 <span>{$form.favorite_color.label}</span>
110 <span>{$form.favorite_color.html}</span>
111 </div>
112
113 {* FOOTER *}
114
115 <div class="crm-submit-buttons">
116 {include file="CRM/common/formButtons.tpl" location="bottom"}
117 </div>
118