Skip to content

Commit

Permalink
Reformate code
Browse files Browse the repository at this point in the history
Add system setting to turn off Scrubber
Fix error on send email if exec function is disabled
  • Loading branch information
vanchelo committed Jan 29, 2015
1 parent 5c89ae0 commit c0a0cce
Show file tree
Hide file tree
Showing 90 changed files with 4,813 additions and 4,233 deletions.
53 changes: 27 additions & 26 deletions assets/components/modxtalks/js/web/modxtalks.js
Original file line number Diff line number Diff line change
Expand Up @@ -1513,71 +1513,72 @@ var MTConversation = {

// Toggle preview on an editing area.
togglePreview: function (id, preview) {
var $content = jQuery('#' + id + ' textarea').first(),
$preview = jQuery('#' + id + '-preview').first(),
$buttons = jQuery('#' + id + ' .mt_formattingButtons').first();

if (!$content[0]) $content = jQuery('#mt_' + id + ' textarea').first();
if (!$preview[0]) $preview = jQuery('#mt_' + id + '-preview').first();
if (!$buttons[0]) $buttons = jQuery('#mt_' + id + ' .mt_formattingButtons').first();

// If the preview box is checked...
if (preview) {

// Hide the formatting buttons.
jQuery("#" + id + " .mt_formattingButtons").hide();
jQuery("#" + id + "-preview").html("");
$buttons.hide();
$preview.html('');

// Get the formatted post and show it.
jQuery.MTAjax({
type: "post",
type: 'post',
headers: {
Action: 'preview'
},
data: {
content: jQuery("#" + id + " textarea").val(),
name: jQuery("#mt_reply .mt_saveName").val(),
email: jQuery("#mt_reply .mt_saveEmail").val(),
content: $content.val(),
name: jQuery('#mt_reply .mt_saveName').val(),
email: jQuery('#mt_reply .mt_saveEmail').val(),
conversation: MT.conversation,
ctx: MT.ctx
},
success: function (data) {

if (data.success != true) {
jQuery("#mt_reply .mt_postReply, #mt_reply .mt_saveDraft").enable();
jQuery('#reply-previewCheckbox').attr('checked', false);
jQuery('.mt_formattingButtons').show('slow');
jQuery('#mt_reply .mt_postReply, #mt_reply .mt_saveDraft').enable();
jQuery("#reply-previewCheckbox").attr('checked', false);
$buttons.show('slow');
jQuery.each(data.data, function (i, item) {
MTMessages.showMessage(item.msg, 'mt_msg-' + item.id);
});
return;
}

// Keep the minimum height.
jQuery("#" + id + "-preview").css("min-height", jQuery("#" + id + "-textarea").innerHeight());
$preview.css('min-height', jQuery('#' + id + '-textarea').innerHeight());

// Hide the textarea, and show the preview.
jQuery("#" + id + " textarea").hide();
jQuery("#" + id + "-bg").hide();
jQuery("#" + id + "-preview").show()
jQuery("#" + id + "-preview").html(data.message.content);
$content.hide();
jQuery('#' + id + '-bg').hide();
$preview.show();
$preview.html(data.message.content);
jQuery('pre').each(function (i, e) {
hljs.highlightBlock(e)
});
// setTimeout(function () { jQuery('a.time').timeago() }, 5000);
}
});
}

// The preview box isn't checked...
else {
// Show the formatting buttons and the textarea; hide the preview area.
jQuery("#" + id + " .mt_formattingButtons").show();
jQuery("#" + id + " textarea").show();
$buttons.show();
$content.show();
jQuery("#" + id + "-bg").show();
jQuery("#" + id + "-preview").hide();
// setTimeout(function () { jQuery('a.time').timeago() }, 5000);
$preview.hide();
}

}

};

jQuery(function () {
jQuery("body").prepend('<div id="mt_messages"></div>'); //
jQuery("#mt_reply.mt_post").addClass("mt_replyPlaceholder");
jQuery('body').prepend('<div id="mt_messages"></div>'); //
jQuery('#mt_reply.mt_post').addClass("mt_replyPlaceholder");
MTConversation.init();
});

Expand Down
22 changes: 11 additions & 11 deletions core/components/modxtalks/controllers/comments/create.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,30 @@
class CommentsModxTalksCreateManagerController extends ResourceCreateManagerController {

public function getLanguageTopics() {
return array('resource','modxtalks:default');
return array('resource', 'modxtalks:default');
}

/**
* Register custom CSS/JS for the page
* @return void
*/
public function loadCustomCssJs() {
$modxtalksAssetsUrl = $this->modx->getOption('modxtalks.assets_url',null,$this->modx->getOption('assets_url',null,MODX_ASSETS_URL).'components/modxtalks/');
$connectorUrl = $modxtalksAssetsUrl.'connector.php';
$modxtalksJsUrl = $modxtalksAssetsUrl.'js/mgr/';
$modxtalksCssUrl = $modxtalksAssetsUrl.'css/mgr/';
$modxtalksAssetsUrl = $this->modx->getOption('modxtalks.assets_url', null, $this->modx->getOption('assets_url', null, MODX_ASSETS_URL) . 'components/modxtalks/');
$connectorUrl = $modxtalksAssetsUrl . 'connector.php';
$modxtalksJsUrl = $modxtalksAssetsUrl . 'js/mgr/';
$modxtalksCssUrl = $modxtalksAssetsUrl . 'css/mgr/';

$this->addLastJavascript($modxtalksJsUrl.'comments/comments.js');
$this->addCss($modxtalksCssUrl.'comments.css');
$this->addLastJavascript($modxtalksJsUrl . 'comments/comments.js');
$this->addCss($modxtalksCssUrl . 'comments.css');
$this->addHtml('<script type="text/javascript">
Ext.onReady(function() {
modxTalks = {};
modxTalks.config = '.$this->modx->toJSON(array()).';
modxTalks.config.connector_url = "'.$connectorUrl.'";
modxTalks.request = '.$this->modx->toJSON($_GET).';
modxTalks.config = ' . $this->modx->toJSON(array()) . ';
modxTalks.config.connector_url = "' . $connectorUrl . '";
modxTalks.request = ' . $this->modx->toJSON($_GET) . ';
});
</script>');

parent::loadCustomCssJs();
}
}
}
25 changes: 13 additions & 12 deletions core/components/modxtalks/controllers/comments/update.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,31 @@

class CommentsModxTalksUpdateManagerController extends ResourceUpdateManagerController {
public function getLanguageTopics() {
return array('resource','modxtalks:default');
return array('resource', 'modxtalks:default');
}

/**
* Register custom CSS/JS for the page
* @return void
*/
public function loadCustomCssJs() {
$modxtalksAssetsUrl = $this->modx->getOption('modxtalks.assets_url',null,$this->modx->getOption('assets_url',null,MODX_ASSETS_URL).'components/modxtalks/');
$connectorUrl = $modxtalksAssetsUrl.'connector.php';
$modxtalksJsUrl = $modxtalksAssetsUrl.'js/mgr/';
$modxtalksCssUrl = $modxtalksAssetsUrl.'css/mgr/';
$modxtalksAssetsUrl = $this->modx->getOption('modxtalks.assets_url', null, $this->modx->getOption('assets_url', null, MODX_ASSETS_URL) . 'components/modxtalks/');
$connectorUrl = $modxtalksAssetsUrl . 'connector.php';
$modxtalksJsUrl = $modxtalksAssetsUrl . 'js/mgr/';
$modxtalksCssUrl = $modxtalksAssetsUrl . 'css/mgr/';

$this->addLastJavascript($modxtalksJsUrl.'modxtalks.js');
$this->addLastJavascript($modxtalksJsUrl.'comments/comments.js');
$this->addCss($modxtalksCssUrl.'comments.css');
$this->addLastJavascript($modxtalksJsUrl . 'modxtalks.js');
$this->addLastJavascript($modxtalksJsUrl . 'comments/comments.js');
$this->addCss($modxtalksCssUrl . 'comments.css');
$this->addHtml('<script type="text/javascript">
Ext.onReady(function() {
modxTalks.config = '.$this->modx->toJSON(array()).';
modxTalks.config.connector_url = "'.$connectorUrl.'";
modxTalks.request = '.$this->modx->toJSON($_GET).';
modxTalks.config = ' . $this->modx->toJSON(array()) . ';
modxTalks.config.connector_url = "' . $connectorUrl . '";
modxTalks.request = ' . $this->modx->toJSON($_GET) . ';
});
</script>');

parent::loadCustomCssJs();
}

}
}
15 changes: 8 additions & 7 deletions core/components/modxtalks/controllers/home.class.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package modxtalks
* @subpackage controllers
Expand All @@ -14,12 +15,12 @@ public function getPageTitle() {
}

public function loadCustomCssJs() {
$this->addJavascript($this->modxtalks->config['jsUrl'].'mgr/widgets/unconfirmed.panel.js');
$this->addJavascript($this->modxtalks->config['jsUrl'].'mgr/widgets/ipblock.grid.js');
$this->addJavascript($this->modxtalks->config['jsUrl'].'mgr/widgets/emailblock.grid.js');
$this->addJavascript($this->modxtalks->config['jsUrl'].'mgr/widgets/modxtalks.grid.js');
$this->addJavascript($this->modxtalks->config['jsUrl'].'mgr/widgets/home.panel.js');
$this->addLastJavascript($this->modxtalks->config['jsUrl'].'mgr/sections/index.js');
$this->addJavascript($this->modxtalks->config['jsUrl'] . 'mgr/widgets/unconfirmed.panel.js');
$this->addJavascript($this->modxtalks->config['jsUrl'] . 'mgr/widgets/ipblock.grid.js');
$this->addJavascript($this->modxtalks->config['jsUrl'] . 'mgr/widgets/emailblock.grid.js');
$this->addJavascript($this->modxtalks->config['jsUrl'] . 'mgr/widgets/modxtalks.grid.js');
$this->addJavascript($this->modxtalks->config['jsUrl'] . 'mgr/widgets/home.panel.js');
$this->addLastJavascript($this->modxtalks->config['jsUrl'] . 'mgr/sections/index.js');
//$this->addCss($this->modxtalks->config['cssUrl'].'mgr/comments.css');
$this->addHtml('<script type="text/javascript">
Ext.onReady(function() {
Expand All @@ -31,6 +32,6 @@ public function loadCustomCssJs() {
}

public function getTemplateFile() {
return $this->modxtalks->config['templatesPath'].'home.tpl';
return $this->modxtalks->config['templatesPath'] . 'home.tpl';
}
}
4 changes: 4 additions & 0 deletions core/components/modxtalks/docs/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Changelog file for modxTalks component.

modxTalks 1.0.4 pl
======================================
- New. Setting to turn off scrubber

modxTalks 1.0.2 beta
======================================
- New. Full remove comment from database with recalculate other comments indexes
Expand Down
4 changes: 2 additions & 2 deletions core/components/modxtalks/docs/readme.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
--------------------
Extra: MODXTalks
--------------------
Version: 1.0.3 beta
Version: 1.0.4 pl
Since: January, 2013
Author: Valentin Rasulov <[email protected]> && Ivan Brezhnev <[email protected]>

MODXTalsk flexible extension of voting for MODX Revolution. This component allows you to install a fully AJAX commenting system on any webpage.

See the documentation here: http://modxtalks.artdevue.com/en/help.html
The source code: http://github.com/artdevue/modxtalks
Issues: http://github.com/artdevue/modxtalks/issues
Issues: http://github.com/artdevue/modxtalks/issues
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* MODXTalks Plugin
*
* @var modX $modx
* @var modX $modx
* @var array $scriptProperties
*/
switch ($modx->event->name) {
Expand All @@ -11,15 +11,16 @@
$ejsTemplatesPath = $_SERVER['DOCUMENT_ROOT'] . $assetsUrl . 'ejs/';

if ($modx->cacheManager->deleteTree($ejsTemplatesPath, array(
'deleteTop' => false,
'skipDirs' => true,
'deleteTop' => false,
'skipDirs' => true,
'extensions' => array('.ejs'),
))) {
$modx->log(modX::LOG_LEVEL_INFO, 'MODXTalks clear ejs templates files . '.$modx->lexicon('refresh_success'));
))
) {
$modx->log(modX::LOG_LEVEL_INFO, 'MODXTalks clear ejs templates files . ' . $modx->lexicon('refresh_success'));
}

if ($modx->cacheManager->refresh(array('/modxtalks'=> array()))) {
$modx->log(modX::LOG_LEVEL_INFO, 'MODXTalks clear cache. '.$modx->lexicon('refresh_success'));
if ($modx->cacheManager->refresh(array('/modxtalks' => array()))) {
$modx->log(modX::LOG_LEVEL_INFO, 'MODXTalks clear cache. ' . $modx->lexicon('refresh_success'));
}
break;

Expand All @@ -45,7 +46,8 @@

case 'OnPageNotFound':
// Check whether active friendly_urls, if not, then the interrupt
if ($modx->getOption('friendly_urls') != 1) break;
if ($modx->getOption('friendly_urls') != 1)
break;

$corePath = $modx->getOption('modxtalks.core_path', null, $modx->getOption('core_path') . 'components/modxtalks/');
require_once $corePath . 'model/modxtalks/modxtalksrouter.class.php';
Expand All @@ -67,7 +69,8 @@

if (!$latest = $modx->getObject('modxTalksLatestPost', array(
'cid' => $comment->conversationId
))) {
))
) {
$latest = $modx->newObject('modxTalksLatestPost');
$latest->set('cid', $comment->conversationId);
}
Expand All @@ -80,16 +83,16 @@
}

$latest->fromArray(array(
'pid' => $comment->id,
'idx' => $comment->idx,
'name' => $comment->name,
'email' => $comment->email,
'pid' => $comment->id,
'idx' => $comment->idx,
'name' => $comment->name,
'email' => $comment->email,
'content' => $comment->processed_content,
'time' => $comment->time,
'link' => $comment->link,
'userId' => $comment->userId,
'title' => $title,
'total' => $total,
'time' => $comment->time,
'link' => $comment->link,
'userId' => $comment->userId,
'title' => $title,
'total' => $total,
));

$latest->save();
Expand All @@ -100,8 +103,10 @@

if ($latest = $modx->getObject('modxTalksLatestPost', array(
'cid' => $comment->conversationId
))) {
if ($latest->remove() == false) $modx->log(modX::LOG_LEVEL_ERROR, 'MODXTalks not removed latest entry for comment id - '.$comment->conversationId);
))
) {
if ($latest->remove() == false)
$modx->log(modX::LOG_LEVEL_ERROR, 'MODXTalks not removed latest entry for comment id - ' . $comment->conversationId);
}
break;
}
Loading

0 comments on commit c0a0cce

Please sign in to comment.