forked from splittingred/Redirector
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated for Redirector 2.0 + many (UI) fixes and new features
- Loading branch information
Bert Oost
committed
Mar 15, 2014
1 parent
902ceef
commit b1ef604
Showing
46 changed files
with
1,405 additions
and
534 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,103 +1,47 @@ | ||
<?php | ||
/** | ||
* Build Schema script | ||
* | ||
* @package redirector | ||
* @subpackage build | ||
*/ | ||
$mtime = microtime(); | ||
$mtime = explode(" ", $mtime); | ||
$mtime = $mtime[1] + $mtime[0]; | ||
$tstart = $mtime; | ||
set_time_limit(0); | ||
|
||
define('PKG_NAME','Redirector'); | ||
define('PKG_NAME_LOWER','redirector'); | ||
define('PKG_NAME', 'Redirector'); | ||
define('PKG_NAME_LOWER', strtolower(PKG_NAME)); | ||
|
||
require_once dirname(__FILE__).'/build.config.php'; | ||
include_once MODX_CORE_PATH . 'model/modx/modx.class.php'; | ||
require_once dirname(__FILE__).'/build.properties.php'; | ||
$modx= new modX(); | ||
|
||
$modx = new modX(); | ||
$modx->initialize('mgr'); | ||
$modx->loadClass('transport.modPackageBuilder','',false, true); | ||
echo '<pre>'; /* used for nice formatting of log messages */ | ||
$modx->setLogLevel(modX::LOG_LEVEL_INFO); | ||
$modx->setLogTarget('ECHO'); | ||
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML'); | ||
|
||
$dbDriver = $modx->config['dbtype']; | ||
$root = dirname(dirname(__FILE__)).'/'; | ||
$sources = array( | ||
'root' => $root, | ||
'core' => $root.'core/components/redirector/', | ||
'model' => $root.'core/components/redirector/model/', | ||
'schema' => $root.'core/components/redirector/model/schema/', | ||
'schema_file' => $root.'core/components/redirector/model/schema/redirector.mysql.schema.xml', | ||
'schema_file' => $root.'core/components/redirector/model/schema/redirector.'.$dbDriver.'.schema.xml', | ||
'assets' => $root.'assets/components/redirector/', | ||
); | ||
foreach (array('mysql', 'sqlsrv') as $driver) { | ||
$xpdo= new xPDO( | ||
$properties["{$driver}_string_dsn_nodb"], | ||
$properties["{$driver}_string_username"], | ||
$properties["{$driver}_string_password"], | ||
$properties["{$driver}_array_options"], | ||
$properties["{$driver}_array_driverOptions"] | ||
); | ||
$xpdo->setPackage('modx', dirname(XPDO_CORE_PATH) . '/model/'); | ||
$xpdo->setDebug(true); | ||
|
||
$manager= $xpdo->getManager(); | ||
$generator= $manager->getGenerator(); | ||
|
||
$manager= $xpdo->getManager(); | ||
$generator= $manager->getGenerator(); | ||
$manager= $modx->getManager(); | ||
$generator= $manager->getGenerator(); | ||
|
||
$generator->classTemplate= <<<EOD | ||
<?php | ||
/** | ||
* [+phpdoc-package+] | ||
*/ | ||
class [+class+] extends [+extends+] { | ||
function [+class+](& \$xpdo) { | ||
\$this->__construct(\$xpdo); | ||
} | ||
function __construct(& \$xpdo) { | ||
parent :: __construct(\$xpdo); | ||
} | ||
} | ||
?> | ||
EOD; | ||
$generator->platformTemplate= <<<EOD | ||
<?php | ||
/** | ||
* [+phpdoc-package+] | ||
*/ | ||
require_once (strtr(realpath(dirname(dirname(__FILE__))), '\\\\', '/') . '/[+class-lowercase+].class.php'); | ||
class [+class+]_[+platform+] extends [+class+] { | ||
function [+class+]_[+platform+](& \$xpdo) { | ||
\$this->__construct(\$xpdo); | ||
} | ||
function __construct(& \$xpdo) { | ||
parent :: __construct(\$xpdo); | ||
} | ||
} | ||
?> | ||
EOD; | ||
$generator->mapHeader= <<<EOD | ||
<?php | ||
/** | ||
* [+phpdoc-package+] | ||
*/ | ||
EOD; | ||
$generator->parseSchema($sources['model'] . 'schema/'.PKG_NAME_LOWER.'.'.$driver.'.schema.xml', $sources['model']); | ||
if(!is_dir($sources['model'])) { | ||
$modx->log(modX::LOG_LEVEL_ERROR,'Model directory not found ('.$sources['model'].')!'); | ||
die(); | ||
} | ||
|
||
if(!file_exists($sources['schema_file'])) { | ||
$modx->log(modX::LOG_LEVEL_ERROR,'Schema file not found!'); | ||
die(); | ||
} | ||
|
||
$mtime= microtime(); | ||
$mtime= explode(" ", $mtime); | ||
$mtime= $mtime[1] + $mtime[0]; | ||
$tend= $mtime; | ||
$totalTime= ($tend - $tstart); | ||
$totalTime= sprintf("%2.4f s", $totalTime); | ||
$generator->parseSchema($sources['schema_file'], $sources['model']); | ||
|
||
echo "\nExecution time: {$totalTime}\n"; | ||
$modx->addPackage(PKG_NAME_LOWER, $sources['model']); | ||
$manager->createObjectContainer('modRedirect'); | ||
|
||
exit (); | ||
$manager->addField('modRedirect', 'context_key', array('after' => 'target')); | ||
$manager->addIndex('modRedirect', 'pattern_context'); | ||
$manager->removeIndex('modRedirect', 'pattern'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
$s = array( | ||
'Manager' => array( | ||
'track_alias_updates' => false, | ||
), | ||
); | ||
|
||
$settings = array(); | ||
foreach ($s as $area => $sets) { | ||
foreach ($sets as $key => $value) { | ||
|
||
$xtype = 'textfield'; | ||
if(is_bool($value)) { $xtype = 'combo-boolean'; } | ||
|
||
$settings['redirector.'.$key] = $modx->newObject('modSystemSetting'); | ||
$settings['redirector.'.$key]->set('key', 'redirector.'.$key); | ||
$settings['redirector.'.$key]->fromArray(array( | ||
'value' => $value, | ||
'xtype' => $xtype, | ||
'namespace' => 'redirector', | ||
'area' => $area | ||
)); | ||
} | ||
} | ||
|
||
return $settings; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
$modx =& $object->xpdo; | ||
|
||
$modx->log(xPDO::LOG_LEVEL_INFO, 'Making database changes.'); | ||
switch($options[xPDOTransport::PACKAGE_ACTION]) { | ||
case xPDOTransport::ACTION_INSTALL: | ||
case xPDOTransport::ACTION_UPGRADE: | ||
|
||
$modx =& $object->xpdo; | ||
$modelPath = $modx->getOption('redirector.core_path', null, $modx->getOption('core_path').'components/redirector/').'model/'; | ||
$modx->addPackage('redirector', $modelPath); | ||
|
||
$manager = $modx->getManager(); | ||
|
||
$manager->addField('modRedirect', 'context_key', array('after' => 'target')); | ||
$manager->addIndex('modRedirect', 'pattern_context'); | ||
$manager->removeIndex('modRedirect', 'pattern'); | ||
|
||
// update controller location | ||
$modAction = $modx->getObject('modAction', array('namespace' => 'redirector', 'controller' => 'index')); | ||
if(!empty($modAction) && is_object($modAction)) { | ||
$modAction->set('controller', 'controllers/index'); | ||
$modAction->save(); | ||
} | ||
|
||
break; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.grid-row-invalid table tr td { background: #ffd6d3 !important; } | ||
|
||
|
||
/* | ||
* FileUploadField component styles | ||
*/ | ||
.x-form-file-wrap { | ||
position: relative; | ||
height: 22px; | ||
} | ||
.x-form-file-wrap .x-form-file { | ||
position: absolute; | ||
right: 0; | ||
-moz-opacity: 0; | ||
filter:alpha(opacity: 0); | ||
opacity: 0; | ||
z-index: 2; | ||
height: 22px; | ||
} | ||
.x-form-file-wrap .x-form-file-btn { | ||
position: absolute; | ||
right: 0; | ||
z-index: 1; | ||
} | ||
.x-form-file-wrap .x-form-file-text { | ||
position: absolute; | ||
left: 0; | ||
z-index: 3; | ||
color: #777; | ||
} |
Oops, something went wrong.