Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
Dainis Tillers committed Nov 19, 2014
0 parents commit b44b95b
Show file tree
Hide file tree
Showing 55 changed files with 3,218 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tmp-build

This comment has been minimized.

Copy link
@Harjinderkour

Harjinderkour Aug 19, 2018

I'm really very excited to my request for a new one for the greatest way

This comment has been minimized.

Copy link
@Harjinderkour

Harjinderkour Aug 19, 2018

Thanks again for the greatest gift my most recent pay stubs and More than happy ,

pkg_tawk_UNZIPFIRST.zip
674 changes: 674 additions & 0 deletions LICENCE.txt

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Unzip the downloaded file and install the plugin using the Extensions -> Install/Uninstall menu. And then navigate to: Components -> Tawk.to widget. Selected tawk.to widget will be added to every page.

Create your tawk.to account -> https://tawk.to
29 changes: 29 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

cd v2

./build.sh

cd ../v3

./build.sh

cd ../

mkdir tmp-build

cd tmp-build

cp ../v2/pkg_tawk.zip pkg_tawk_joomla2.x.zip
cp ../v3/pkg_tawk.zip pkg_tawk_joomla3.x.zip

cp ../LICENCE.txt ./
cp ../README ./

zip -1 pkg_tawk_UNZIPFIRST.zip -r LICENCE.txt README pkg_tawk_joomla2.x.zip pkg_tawk_joomla3.x.zip

cp pkg_tawk_UNZIPFIRST.zip ../

cd ../

rm -r tmp-build
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><title></title>
2 changes: 2 additions & 0 deletions v2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tmp-build
pkg_tawk.zip
674 changes: 674 additions & 0 deletions v2/LICENCE.txt

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions v2/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

mkdir tmp-build

cd tmp-build

mkdir packages

cp ../pkg_tawk.xml ./
cp ../LICENCE.txt ./
cp -R ../plugin ./
cp -R ../component ./

cd component
zip -1 ../com_tawkwidget.zip -r ./*

cd ../plugin
zip -1 ../plg_tawkwidget.zip -r ./*

cd ../

mv com_tawkwidget.zip packages
mv plg_tawkwidget.zip packages

zip -1 pkg_tawk.zip -r ./packages pkg_tawk.xml LICENCE.txt

cp pkg_tawk.zip ../

cd ../

rm -r tmp-build
58 changes: 58 additions & 0 deletions v2/component/admin/controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

/**
* @package Tawk.to Widget for Joomla! 2.5
* @author Tawk.to
* @copyright (C) 2014- Tawk.to
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
**/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// import Joomla controller library
jimport('joomla.application.component.controller');

class TawkWidgetController extends JController {

function display($cachable = false, $urlparams = false) {

$model = parent::getModel('TawkWidget', 'TawkWidgetModel', array('ignore_request' => true));

$widget = $model->getWidget();

// set default view if not set
$input = JFactory::getApplication()->input;
$input->set('view', $input->getCmd('view', 'tawkwidget'));

// call parent behavior
parent::display(false);
}

function setwidget() {
header('Content-Type: application/json');

if(!isset($_POST['pageId']) || !isset($_POST['widgetId'])) {
echo json_encode(array("success" => FALSE));
die();
}

$model = parent::getModel('TawkWidget', 'TawkWidgetModel', array('ignore_request' => true));

$model->setWidget($_POST['pageId'], $_POST['widgetId']);

echo json_encode(array("success" => TRUE));
die();
}

function removewidget() {
header('Content-Type: application/json');

$model = parent::getModel('TawkWidget', 'TawkWidgetModel', array('ignore_request' => true));

$model->removeWidget();

echo json_encode(array("success" => TRUE));
die();
}
}
1 change: 1 addition & 0 deletions v2/component/admin/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><title></title>
2 changes: 2 additions & 0 deletions v2/component/admin/language/en-GB.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
COM_TAWKWIDGET_MENU="Tawk.to widget"
COM_TAWKWIDGET="Tawk.to"
2 changes: 2 additions & 0 deletions v2/component/admin/language/en-GB/en-GB.com_tawkwidget.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
COM_TAWKWIDGET_MENU="Tawk.to widget"
COM_TAWKWIDGET="Tawk.to"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
COM_TAWKWIDGET_MENU="Tawk.to widget"
COM_TAWKWIDGET="Tawk.to"
51 changes: 51 additions & 0 deletions v2/component/admin/models/tawkwidget.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

/**
* @package Tawk.to Widget for Joomla! 2.5
* @author Tawk.to
* @copyright (C) 2014- Tawk.to
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
**/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// import Joomla modelitem library
jimport('joomla.application.component.modelitem');

class TawkWidgetModelTawkWidget extends JModelItem {
protected $widget;

public function getTable($type = 'TawkWidget', $prefix = 'TawkWidgetTable', $config = array()) {
return JTable::getInstance($type, $prefix, $config);
}

public function getWidget() {
if(isset($this->widget)) {
return $this->widget;
}

$this->widget = $this->getTable();
$this->widget->load(1);

return $this->widget;
}

public function setWidget($pageId, $widgetId) {
$obj = new stdClass();

$obj->id = 1;
$obj->widget_id = $widgetId;
$obj->page_id = $pageId;

if($this->getWidget()->id !== null) {
JFactory::getDbo()->updateObject('#__tawkwidget', $obj, 'id');
} else {
JFactory::getDbo()->insertObject('#__tawkwidget', $obj);
}
}

public function removeWidget() {
$this->getTable()->delete(1);
}
}
16 changes: 16 additions & 0 deletions v2/component/admin/sql/install.mysql.utf8.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--
-- @package Tawk.to Widget for Joomla! 2.5
-- @author Tawk.to
-- @copyright (C) 2014- Tawk.to
-- @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
--


DROP TABLE IF EXISTS `#__tawkwidget`;

CREATE TABLE `#__tawkwidget` (
`id` int(10) NOT NULL,
`page_id` varchar(50),
`widget_id` varchar(50),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1 change: 1 addition & 0 deletions v2/component/admin/sql/uninstall.mysql.utf8.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP TABLE IF EXISTS `#__tawkwidget`;
Empty file.
21 changes: 21 additions & 0 deletions v2/component/admin/tables/tawkwidget.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

/**
* @package Tawk.to Widget for Joomla! 2.5
* @author Tawk.to
* @copyright (C) 2014- Tawk.to
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
**/

// No direct access
defined('_JEXEC') or die('Restricted access');

// import Joomla table library
jimport('joomla.database.table');


class TawkWidgetTableTawkWidget extends JTable {
function __construct(&$db) {
parent::__construct('#__tawkwidget', 'id', $db);
}
}
20 changes: 20 additions & 0 deletions v2/component/admin/tawkwidget.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

/**
* @package Tawk.to Widget for Joomla! 2.5
* @author Tawk.to
* @copyright (C) 2014- Tawk.to
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
**/

defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.controller');

$controller = JController::getInstance('TawkWidget');

$task = JFactory::getApplication()->input->getCmd('task');

$controller->execute($task);

$controller->redirect();
70 changes: 70 additions & 0 deletions v2/component/admin/views/tawkwidget/tmpl/default.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php

/**
* @package Tawk.to Widget for Joomla! 2.5
* @author Tawk.to
* @copyright (C) 2014- Tawk.to
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
**/

// No direct access to this file
defined('_JEXEC') or die('Restricted Access');

// load tooltip behavior
JHtml::_('behavior.tooltip');
?>

<script type="text/javascript" src="<?php echo $this->getBaseUrl() ?>/public/js/jquery-1.11.0.min.js"></script>

<iframe
id="tawkIframe"
src=""
style="min-height: 300px; width : 100%; border: none">
</iframe>

<script type="text/javascript">
var currentHost = window.location.protocol + "//" + window.location.host;
var url = "<?php echo $this->getIframeUrl() ?>&parentDomain=" + currentHost;

jQuery('#tawkIframe').attr('src', url);

var iframe = jQuery('#tawk_widget_customization')[0];

window.addEventListener('message', function(e) {

if(e.origin === '<?php echo $this->getBaseUrl() ?>') {

if(e.data.action === 'setWidget') {
setWidget(e);
}

if(e.data.action === 'removeWidget') {
removeWidget(e);
}
}
});

function setWidget(e) {
jQuery.post('index.php?option=com_tawkwidget&task=setwidget', {
pageId : e.data.pageId,
widgetId : e.data.widgetId
}, function(r) {
if(r.success) {
e.source.postMessage({action: 'setDone'}, '<?php echo $this->getBaseUrl() ?>');
} else {
e.source.postMessage({action: 'setFail'}, '<?php echo $this->getBaseUrl() ?>');
}
});
}

function removeWidget(e) {
jQuery.post('index.php?option=com_tawkwidget&task=removewidget', function(r) {
if(r.success) {
e.source.postMessage({action: 'removeDone'}, '<?php echo $this->getBaseUrl() ?>');
} else {
e.source.postMessage({action: 'removeFail'}, '<?php echo $this->getBaseUrl() ?>');
}

});
}
</script>
46 changes: 46 additions & 0 deletions v2/component/admin/views/tawkwidget/view.html.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

/**
* @package Tawk.to Widget for Joomla! 2.5
* @author Tawk.to
* @copyright (C) 2014- Tawk.to
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
**/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// import Joomla view library
jimport('joomla.application.component.view');

/**
* HelloWorlds View
*/
class TawkWidgetViewTawkWidget extends JView {
/**
* HelloWorlds view display method
* @return void
*/
function display($tpl = null) {
$this->addToolBar();
parent::display($tpl);
}

public function getBaseUrl() {
return 'https://plugins.tawk.to';
}

public function getIframeUrl() {
$model = parent::getModel('TawkWidget', 'TawkWidgetModel', array('ignore_request' => true));

$widget = $model->getWidget();

return "https://plugins.tawk.to/generic/widgets"
."?currentPageId=".$widget->page_id
."&currentWidgetId=".$widget->widget_id;
}

protected function addToolBar() {
JToolBarHelper::title('Tawk.to widget');
}
}
1 change: 1 addition & 0 deletions v2/component/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><title></title>
Loading

0 comments on commit b44b95b

Please sign in to comment.