#30907 Show only progress bar
[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 {php}
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');
26 } else {
27 $wcidata = $template->fetch('string:' . base64_decode($wid_page[$dao->id]['custom_template']));
28 }
29 $widget_controller_path = getWciWidgetControllerPath();
30 }
31 {/php}
32
33 <div class="crm-section">
34 <div class="label">
35 <label for="embd_code">Code to embed:</label>
36 </div>
37 <div class="content">
38 <div class="resizable-textarea">
39 <span>{literal}
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 );
47 onReady();
48 };
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 );
54 onReady();
55 }
56 };
57 }
58 if ( document.readyState === "complete" ) {
59 // Handle it asynchronously to allow scripts the opportunity to delay ready
60 setTimeout( onReady, 1 );
61 }
62
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);
74
75 // A fallback to window.onload, that will always work
76 window.attachEvent( "onload", onReady );
77 }
78
79 function onReady( ) {
80 document.getElementById('widgetwci').innerHTML = wciwidgetcode;
81 }
82 </script>
83 <div id='widgetwci'></div></textarea>{/literal}
84 <div class="grippie" style="margin-right: 18px;"></div>
85 </span>
86 </div>
87 </div>
88 <div class="clear"></div>
89 </div>
90 <div class="crm-section">
91 <div class="content">
92 {* {include file="CRM/Wci/Page/wciwidget.tpl"} *}
93
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>
96 <script>
97 $( document ).ready(function() {ldelim}
98 $('#widgetwci').html(wciwidgetcode);
99 {rdelim} );
100 </script>
101 <div id='widgetwci'></div>
102
103 </div>
104 </div>
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