Commit | Line | Data |
---|---|---|
13e70378 J |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.4 | | |
5 | +--------------------------------------------------------------------+ | |
6 | | Copyright CiviCRM LLC (c) 2004-2013 | | |
7 | +--------------------------------------------------------------------+ | |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License and the CiviCRM Licensing Exception along | | |
21 | | with this program; if not, contact CiviCRM LLC | | |
22 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
23 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
25 | +--------------------------------------------------------------------+ | |
26 | */ | |
27 | ||
28 | /** | |
29 | * | |
30 | * @package CRM | |
31 | * @copyright CiviCRM LLC (c) 2004-2013 | |
32 | * $Id$ | |
33 | */ | |
34 | ||
35 | ||
36 | /* | |
37 | <script type="text/javascript" src="http://drupal.local/sites/all/modules/civicrm/extensions/civicrm-wci/extern/wciwidget.php?widgetId=1"></script> | |
38 | */ | |
39 | ||
40 | require_once '../../../civicrm.config.php'; | |
13e70378 | 41 | |
1008246f J |
42 | $wciembed_js = ' |
43 | /* | |
44 | @licstart The following is the entire license notice for the | |
45 | JavaScript code in this page. | |
46 | ||
47 | Copyright (C) 2014 Zyxware Technologies | |
48 | ||
49 | The JavaScript code in this page is free software: you can | |
50 | redistribute it and/or modify it under the terms of the GNU Affero | |
51 | General Public License (GNU AGPL) as published by the Free Software | |
52 | Foundation, either version 3 of the License, or (at your option) | |
53 | any later version. The code is distributed WITHOUT ANY WARRANTY; | |
54 | without even the implied warranty of MERCHANTABILITY or FITNESS | |
55 | FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. | |
56 | ||
57 | @licend The above is the entire license notice | |
58 | for the JavaScript code in this page. | |
59 | */ | |
60 | ||
61 | // Cleanup functions for the document ready method | |
fbe9a7d4 J |
62 | if ( document.addEventListener ) { |
63 | DOMContentLoaded = function() { | |
64 | document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); | |
65 | onReady(); | |
66 | }; | |
67 | } else if ( document.attachEvent ) { | |
68 | DOMContentLoaded = function() { | |
69 | // Make sure body exists, at least, in case IE gets a little overzealous | |
70 | if ( document.readyState === "complete" ) { | |
71 | document.detachEvent( "onreadystatechange", DOMContentLoaded ); | |
72 | onReady(); | |
73 | } | |
74 | }; | |
75 | } | |
76 | if ( document.readyState === "complete" ) { | |
77 | // Handle it asynchronously to allow scripts the opportunity to delay ready | |
78 | setTimeout( onReady, 1 ); | |
79 | } | |
80 | ||
81 | // Mozilla, Opera and webkit support this event | |
82 | if ( document.addEventListener ) { | |
83 | // Use the handy event callback | |
84 | document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); | |
85 | // A fallback to window.onload, that will always work | |
86 | window.addEventListener( "load", onReady, false ); | |
87 | // If IE event model is used | |
88 | } else if ( document.attachEvent ) { | |
89 | // ensure firing before onload, | |
90 | // maybe late but safe also for iframes | |
91 | document.attachEvent("onreadystatechange", DOMContentLoaded); | |
92 | ||
93 | // A fallback to window.onload, that will always work | |
94 | window.attachEvent( "onload", onReady ); | |
95 | } | |
96 | ||
97 | function onReady( ) { | |
98 | document.getElementById("widgetwci").innerHTML = wciwidgetcode; | |
99 | }'; | |
100 | ||
13e70378 | 101 | $config = CRM_Core_Config::singleton(); |
13e70378 | 102 | |
1008246f | 103 | $embedId = CRM_Utils_Request::retrieve('id', 'Positive', CRM_Core_DAO::$_nullObject); |
fbe9a7d4 | 104 | $preview = CRM_Utils_Request::retrieve('preview', 'Positive', CRM_Core_DAO::$_nullObject); |
1008246f | 105 | $output = 'var wciwidgetcode = ' . CRM_Wci_WidgetCode::get_widget_code($embedId, $preview) . ';'; |
13e70378 | 106 | |
1008246f J |
107 | $output = $output . $wciembed_js; |
108 | echo $output; | |
13e70378 J |
109 | |
110 | CRM_Utils_System::civiExit(); |