Skip to content

Commit

Permalink
Code reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
bezumkin committed Apr 17, 2015
1 parent 979600a commit 8707ab1
Show file tree
Hide file tree
Showing 60 changed files with 1,674 additions and 1,040 deletions.
4 changes: 1 addition & 3 deletions .gitignore
@@ -1,3 +1 @@
.idea
config.core.php
core/components/tickets/model/tickets/ticketsext.class.php
.idea
26 changes: 11 additions & 15 deletions core/components/tickets/controllers/home.class.php
@@ -1,35 +1,31 @@
<?php
/**
* The comments manager controller for Tickets.
*
* @package tickets
*/

if (!class_exists('TicketsMainController')) {
require_once dirname(dirname(__FILE__)) . '/index.class.php';
}

class TicketsHomeManagerController extends TicketsMainController {
public function process(array $scriptProperties = array()) {}

public function getPageTitle() { return $this->modx->lexicon('tickets'); }

public function getPageTitle() {
return $this->modx->lexicon('tickets');
}

public function loadCustomCssJs() {
$this->addJavascript($this->Tickets->config['jsUrl'].'mgr/comment/comments.grid.js');
$this->addJavascript($this->Tickets->config['jsUrl'].'mgr/thread/thread.grid.js');
$this->addJavascript($this->Tickets->config['jsUrl'].'mgr/thread/thread.panel.js');
$this->addLastJavascript($this->Tickets->config['jsUrl'].'mgr/misc/utils.js');
$this->addLastJavascript($this->Tickets->config['jsUrl'].'mgr/home.js');
$this->addJavascript($this->Tickets->config['jsUrl'] . 'mgr/comment/comments.grid.js');
$this->addJavascript($this->Tickets->config['jsUrl'] . 'mgr/thread/thread.grid.js');
$this->addJavascript($this->Tickets->config['jsUrl'] . 'mgr/thread/thread.panel.js');
$this->addLastJavascript($this->Tickets->config['jsUrl'] . 'mgr/misc/utils.js');
$this->addLastJavascript($this->Tickets->config['jsUrl'] . 'mgr/home.js');
$this->addHtml('<script type="text/javascript">
Ext.onReady(function() {
MODx.load({xtype: "tickets-page-home"});
});
</script>');


}

public function getTemplateFile() {
return $this->Tickets->config['templatesPath'].'home.tpl';
return $this->Tickets->config['templatesPath'] . 'home.tpl';
}

}
67 changes: 36 additions & 31 deletions core/components/tickets/controllers/section/create.class.php
@@ -1,4 +1,5 @@
<?php

/**
* The create manager controller for TicketsSection.
*
Expand All @@ -14,7 +15,7 @@ class TicketsSectionCreateManagerController extends ResourceCreateManagerControl
* @return array
*/
public function getLanguageTopics() {
return array('resource','tickets:default');
return array('resource', 'tickets:default');
}


Expand All @@ -31,50 +32,54 @@ public function checkPermissions() {
* @return void
*/
public function loadCustomCssJs() {
$mgrUrl = $this->modx->getOption('manager_url',null,MODX_MANAGER_URL);
$mgrUrl = $this->modx->getOption('manager_url', null, MODX_MANAGER_URL);

$ticketsAssetsUrl = $this->modx->getOption('tickets.assets_url',null,$this->modx->getOption('assets_url',null,MODX_ASSETS_URL).'components/tickets/');
$connectorUrl = $ticketsAssetsUrl.'connector.php';
$ticketsJsUrl = $ticketsAssetsUrl.'js/mgr/';
$ticketsAssetsUrl = $this->modx->getOption('tickets.assets_url', null, $this->modx->getOption('assets_url', null, MODX_ASSETS_URL) . 'components/tickets/');
$connectorUrl = $ticketsAssetsUrl . 'connector.php';
$ticketsJsUrl = $ticketsAssetsUrl . 'js/mgr/';

$this->resourceArray['properties'] = array(
'tickets' => $this->resource->getProperties('tickets')
);
$this->resourceArray['syncsite'] = 0;

$this->addJavascript($mgrUrl.'assets/modext/util/datetime.js');
$this->addJavascript($mgrUrl.'assets/modext/widgets/element/modx.panel.tv.renders.js');
$this->addJavascript($mgrUrl.'assets/modext/widgets/resource/modx.grid.resource.security.local.js');
$this->addJavascript($mgrUrl.'assets/modext/widgets/resource/modx.panel.resource.tv.js');
$this->addJavascript($mgrUrl.'assets/modext/widgets/resource/modx.panel.resource.js');
$this->addJavascript($mgrUrl.'assets/modext/sections/resource/create.js');
$this->addJavascript($ticketsJsUrl.'tickets.js');
$this->addLastJavascript($ticketsJsUrl.'misc/utils.js');
$this->addLastJavascript($ticketsJsUrl.'section/section.common.js');
$this->addLastJavascript($ticketsJsUrl.'section/create.js');
$this->addJavascript($mgrUrl . 'assets/modext/util/datetime.js');
$this->addJavascript($mgrUrl . 'assets/modext/widgets/element/modx.panel.tv.renders.js');
$this->addJavascript($mgrUrl . 'assets/modext/widgets/resource/modx.grid.resource.security.local.js');
$this->addJavascript($mgrUrl . 'assets/modext/widgets/resource/modx.panel.resource.tv.js');
$this->addJavascript($mgrUrl . 'assets/modext/widgets/resource/modx.panel.resource.js');
$this->addJavascript($mgrUrl . 'assets/modext/sections/resource/create.js');
$this->addJavascript($ticketsJsUrl . 'tickets.js');
$this->addLastJavascript($ticketsJsUrl . 'misc/utils.js');
$this->addLastJavascript($ticketsJsUrl . 'section/section.common.js');
$this->addLastJavascript($ticketsJsUrl . 'section/create.js');

$config = array(
'assets_url' => $ticketsAssetsUrl,
'connector_url' => $connectorUrl,
);
$ready = array(
'xtype' => 'tickets-page-section-create',
'record' => $this->resourceArray,
'publish_document' => (int)$this->canPublish,
'canSave' => (int)$this->canSave,
'show_tvs' => (int)!empty($this->tvCounts),
'mode' => 'create',
);

$this->addHtml('
<script type="text/javascript">
// <![CDATA[
Tickets.config = {
assets_url: "'.$ticketsAssetsUrl.'"
,connector_url: "'.$connectorUrl.'"
}
MODx.config.publish_document = "'.$this->canPublish.'";
MODx.onDocFormRender = "'.$this->onDocFormRender.'";
MODx.ctx = "'.$this->ctx.'";
Tickets.config = ' . $this->modx->toJSON($config) . ';
MODx.config.publish_document = ' . (int)$this->canPublish . ';
MODx.onDocFormRender = "' . $this->onDocFormRender . '";
MODx.ctx = "' . $this->ctx . '";
Ext.onReady(function() {
MODx.load({
xtype: "tickets-page-section-create"
,record: '.$this->modx->toJSON($this->resourceArray).'
,publish_document: "'.$this->canPublish.'"
,canSave: "'.($this->modx->hasPermission('save_document') ? 1 : 0).'"
,show_tvs: '.(!empty($this->tvCounts) ? 1 : 0).'
,mode: "create"
});
MODx.load(' . $this->modx->toJSON($ready) . ');
});
// ]]>
</script>');
/* load RTE */

$this->loadRichTextEditor();
}

Expand Down
4 changes: 3 additions & 1 deletion core/components/tickets/controllers/section/data.class.php
@@ -1,2 +1,4 @@
<?php
class TicketsSectionDataManagerController extends ResourceDataManagerController {}

class TicketsSectionDataManagerController extends ResourceDataManagerController {
}
105 changes: 47 additions & 58 deletions core/components/tickets/controllers/section/update.class.php
@@ -1,4 +1,5 @@
<?php

/**
* The update manager controller for TicketsSection.
*
Expand All @@ -14,7 +15,7 @@ class TicketsSectionUpdateManagerController extends ResourceUpdateManagerControl
* @return array
*/
public function getLanguageTopics() {
return array('resource','tickets:default');
return array('resource', 'tickets:default');
}


Expand All @@ -31,78 +32,66 @@ public function checkPermissions() {
* @return void
*/
public function loadCustomCssJs() {
$mgrUrl = $this->modx->getOption('manager_url',null,MODX_MANAGER_URL);
$mgrUrl = $this->modx->getOption('manager_url', null, MODX_MANAGER_URL);

$ticketsAssetsUrl = $this->modx->getOption('tickets.assets_url',null,$this->modx->getOption('assets_url',null,MODX_ASSETS_URL).'components/tickets/');
$connectorUrl = $ticketsAssetsUrl.'connector.php';
$ticketsJsUrl = $ticketsAssetsUrl.'js/mgr/';
$ticketsAssetsUrl = $this->modx->getOption('tickets.assets_url', null, $this->modx->getOption('assets_url', null, MODX_ASSETS_URL) . 'components/tickets/');
$connectorUrl = $ticketsAssetsUrl . 'connector.php';
$ticketsJsUrl = $ticketsAssetsUrl . 'js/mgr/';

$this->resourceArray['properties'] = array(
'tickets' => $this->resource->getProperties('tickets')
);
$this->resourceArray['syncsite'] = 0;

$this->addJavascript($mgrUrl.'assets/modext/util/datetime.js');
$this->addJavascript($mgrUrl.'assets/modext/widgets/element/modx.panel.tv.renders.js');
$this->addJavascript($mgrUrl.'assets/modext/widgets/resource/modx.grid.resource.security.local.js');
$this->addJavascript($mgrUrl.'assets/modext/widgets/resource/modx.panel.resource.tv.js');
$this->addJavascript($mgrUrl.'assets/modext/widgets/resource/modx.panel.resource.js');
$this->addJavascript($mgrUrl.'assets/modext/sections/resource/update.js');
$this->addJavascript($ticketsJsUrl.'tickets.js');
$this->addLastJavascript($ticketsJsUrl.'misc/utils.js');
$this->addLastJavascript($ticketsJsUrl.'section/section.common.js');
$this->addLastJavascript($ticketsJsUrl.'section/section.grid.js');
$this->addLastJavascript($ticketsJsUrl.'comment/comments.common.js');
$this->addLastJavascript($ticketsJsUrl.'comment/comments.grid.js');
$this->addLastJavascript($ticketsJsUrl.'section/update.js');
$this->addJavascript($mgrUrl . 'assets/modext/util/datetime.js');
$this->addJavascript($mgrUrl . 'assets/modext/widgets/element/modx.panel.tv.renders.js');
$this->addJavascript($mgrUrl . 'assets/modext/widgets/resource/modx.grid.resource.security.local.js');
$this->addJavascript($mgrUrl . 'assets/modext/widgets/resource/modx.panel.resource.tv.js');
$this->addJavascript($mgrUrl . 'assets/modext/widgets/resource/modx.panel.resource.js');
$this->addJavascript($mgrUrl . 'assets/modext/sections/resource/update.js');
$this->addJavascript($ticketsJsUrl . 'tickets.js');
$this->addLastJavascript($ticketsJsUrl . 'misc/utils.js');
$this->addLastJavascript($ticketsJsUrl . 'section/section.common.js');
$this->addLastJavascript($ticketsJsUrl . 'section/section.grid.js');
$this->addLastJavascript($ticketsJsUrl . 'comment/comments.common.js');
$this->addLastJavascript($ticketsJsUrl . 'comment/comments.grid.js');
$this->addLastJavascript($ticketsJsUrl . 'section/update.js');

$config = array(
'assets_url' => $ticketsAssetsUrl,
'connector_url' => $connectorUrl,
);
$ready = array(
'xtype' => 'tickets-page-section-update',
'resource' => $this->resource->get('id'),
'record' => $this->resourceArray,
'publish_document' => (int)$this->canPublish,
'preview_url' => $this->previewUrl,
'locked' => (int)$this->locked,
'lockedText' => $this->lockedText,
'canSave' => (int)$this->canSave,
'canEdit' => (int)$this->canEdit,
'canCreate' => (int)$this->canCreate,
'canDuplicate' => (int)$this->canDuplicate,
'canDelete' => (int)$this->canDelete,
'show_tvs' => (int)!empty($this->tvCounts),
'mode' => 'update',
);

$this->addHtml('
<script type="text/javascript">
// <![CDATA[
Tickets.config = {
assets_url: "'.$ticketsAssetsUrl.'"
,connector_url: "'.$connectorUrl.'"
}
MODx.config.publish_document = "'.$this->canPublish.'";
MODx.onDocFormRender = "'.$this->onDocFormRender.'";
MODx.ctx = "'.$this->ctx.'";
Tickets.config = ' . $this->modx->toJSON($config) . ';
MODx.config.publish_document = ' . (int)$this->canPublish . ';
MODx.onDocFormRender = "' . $this->onDocFormRender . '";
MODx.ctx = "' . $this->ctx . '";
Ext.onReady(function() {
MODx.load({
xtype: "tickets-page-section-update"
,resource: "'.$this->resource->get('id').'"
,record: '.$this->modx->toJSON($this->resourceArray).'
,publish_document: "'.$this->canPublish.'"
,preview_url: "'.$this->previewUrl.'"
,locked: '.($this->locked ? 1 : 0).'
,lockedText: "'.$this->lockedText.'"
,canSave: '.($this->canSave ? 1 : 0).'
,canEdit: '.($this->canEdit ? 1 : 0).'
,canCreate: '.($this->canCreate ? 1 : 0).'
,canDuplicate: '.($this->canDuplicate ? 1 : 0).'
,canDelete: '.($this->canDelete ? 1 : 0).'
,show_tvs: '.(!empty($this->tvCounts) ? 1 : 0).'
,mode: "update"
});
MODx.load(' . $this->modx->toJSON($ready) . ');
});
// ]]>
</script>');
/* load RTE */
$this->loadRichTextEditor();
}

/**
* Used to set values on the resource record sent to the template for derivative classes
*
* @return void
*/
/*
public function prepareResource() {
$settings = $this->resource->getProperties('tickets');
if (is_array($settings) && !empty($settings)) {
foreach ($settings as $k => $v) {
$this->resourceArray['setting_'.$k] = $v;
}
}
$this->loadRichTextEditor();
}
*/

}
67 changes: 36 additions & 31 deletions core/components/tickets/controllers/ticket/create.class.php
@@ -1,4 +1,5 @@
<?php

/**
* The create manager controller for Ticket.
*
Expand All @@ -16,7 +17,7 @@ class TicketCreateManagerController extends ResourceCreateManagerController {
* @return array
*/
public function getLanguageTopics() {
return array('resource','tickets:default');
return array('resource', 'tickets:default');
}


Expand Down Expand Up @@ -46,46 +47,50 @@ public function getDefaultTemplate() {
* @return void
*/
public function loadCustomCssJs() {
$mgrUrl = $this->modx->getOption('manager_url',null,MODX_MANAGER_URL);
$mgrUrl = $this->modx->getOption('manager_url', null, MODX_MANAGER_URL);

$ticketsAssetsUrl = $this->modx->getOption('tickets.assets_url',null,$this->modx->getOption('assets_url',null,MODX_ASSETS_URL).'components/tickets/');
$connectorUrl = $ticketsAssetsUrl.'connector.php';
$ticketsJsUrl = $ticketsAssetsUrl.'js/mgr/';
$ticketsAssetsUrl = $this->modx->getOption('tickets.assets_url', null, $this->modx->getOption('assets_url', null, MODX_ASSETS_URL) . 'components/tickets/');
$connectorUrl = $ticketsAssetsUrl . 'connector.php';
$ticketsJsUrl = $ticketsAssetsUrl . 'js/mgr/';

$properties = $this->parent->getProperties();
$this->resourceArray = array_merge($this->resourceArray, $properties);
$this->resourceArray['properties'] = $properties;

$this->addJavascript($mgrUrl.'assets/modext/util/datetime.js');
$this->addJavascript($mgrUrl.'assets/modext/widgets/element/modx.panel.tv.renders.js');
$this->addJavascript($mgrUrl.'assets/modext/widgets/resource/modx.grid.resource.security.local.js');
$this->addJavascript($mgrUrl.'assets/modext/widgets/resource/modx.panel.resource.tv.js');
$this->addJavascript($mgrUrl.'assets/modext/widgets/resource/modx.panel.resource.js');
$this->addJavascript($mgrUrl.'assets/modext/sections/resource/create.js');
$this->addJavascript($ticketsJsUrl.'tickets.js');
$this->addLastJavascript($ticketsJsUrl.'misc/utils.js');
$this->addLastJavascript($ticketsJsUrl.'ticket/ticket.common.js');
$this->addLastJavascript($ticketsJsUrl.'ticket/create.js');
$this->addJavascript($mgrUrl . 'assets/modext/util/datetime.js');
$this->addJavascript($mgrUrl . 'assets/modext/widgets/element/modx.panel.tv.renders.js');
$this->addJavascript($mgrUrl . 'assets/modext/widgets/resource/modx.grid.resource.security.local.js');
$this->addJavascript($mgrUrl . 'assets/modext/widgets/resource/modx.panel.resource.tv.js');
$this->addJavascript($mgrUrl . 'assets/modext/widgets/resource/modx.panel.resource.js');
$this->addJavascript($mgrUrl . 'assets/modext/sections/resource/create.js');
$this->addJavascript($ticketsJsUrl . 'tickets.js');
$this->addLastJavascript($ticketsJsUrl . 'misc/utils.js');
$this->addLastJavascript($ticketsJsUrl . 'ticket/ticket.common.js');
$this->addLastJavascript($ticketsJsUrl . 'ticket/create.js');

$config = array(
'assets_url' => $ticketsAssetsUrl,
'connector_url' => $connectorUrl,
);
$ready = array(
'xtype' => 'tickets-page-ticket-create',
'record' => $this->resourceArray,
'publish_document' => (int)$this->canPublish,
'canSave' => (int)$this->canSave,
'show_tvs' => (int)!empty($this->tvCounts),
'mode' => 'create',
);

$this->addHtml('
<script type="text/javascript">
// <![CDATA[
Tickets.config = {
assets_url: "'.$ticketsAssetsUrl.'"
,connector_url: "'.$connectorUrl.'"
}
MODx.config.publish_document = "'.$this->canPublish.'";
MODx.config.default_template = '.$this->modx->getOption('tickets.default_template', null, $this->modx->getOption('default_template'), true).';
MODx.onDocFormRender = "'.$this->onDocFormRender.'";
MODx.ctx = "'.$this->ctx.'";
Tickets.config = ' . $this->modx->toJSON($config) . ';
MODx.config.publish_document = ' . (int)$this->canPublish . ';
MODx.config.default_template = ' . $this->modx->getOption('tickets.default_template', null, $this->modx->getOption('default_template'), true) . ';
MODx.onDocFormRender = "' . $this->onDocFormRender . '";
MODx.ctx = "' . $this->ctx . '";
Ext.onReady(function() {
MODx.load({
xtype: "tickets-page-ticket-create"
,record: '.$this->modx->toJSON($this->resourceArray).'
,publish_document: "'.$this->canPublish.'"
,canSave: "'.($this->modx->hasPermission('save_document') ? 1 : 0).'"
,show_tvs: '.(!empty($this->tvCounts) ? 1 : 0).'
,mode: "create"
});
MODx.load(' . $this->modx->toJSON($ready) . ');
});
// ]]>
</script>');
Expand Down

0 comments on commit 8707ab1

Please sign in to comment.