Merge branch 'master' of https://github.com/silverstripe/sapphire.git into forms
@ -81,7 +81,7 @@ class CMSBatchActionHandler extends RequestHandler {
|
|||||||
$actionHandler = new $actionClass();
|
$actionHandler = new $actionClass();
|
||||||
|
|
||||||
// Sanitise ID list and query the database for apges
|
// Sanitise ID list and query the database for apges
|
||||||
$ids = split(' *, *', trim($request->requestVar('csvIDs')));
|
$ids = preg_split('/ *, */', trim($request->requestVar('csvIDs')));
|
||||||
foreach($ids as $k => $v) if(!is_numeric($v)) unset($ids[$k]);
|
foreach($ids as $k => $v) if(!is_numeric($v)) unset($ids[$k]);
|
||||||
|
|
||||||
if($ids) {
|
if($ids) {
|
||||||
@ -135,7 +135,7 @@ class CMSBatchActionHandler extends RequestHandler {
|
|||||||
$actionHandler = new $actionClass['class']();
|
$actionHandler = new $actionClass['class']();
|
||||||
|
|
||||||
// Sanitise ID list and query the database for apges
|
// Sanitise ID list and query the database for apges
|
||||||
$ids = split(' *, *', trim($request->requestVar('csvIDs')));
|
$ids = preg_split('/ *, */', trim($request->requestVar('csvIDs')));
|
||||||
foreach($ids as $k => $id) $ids[$k] = (int)$id;
|
foreach($ids as $k => $id) $ids[$k] = (int)$id;
|
||||||
$ids = array_filter($ids);
|
$ids = array_filter($ids);
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ class CMSBatchActionHandler extends RequestHandler {
|
|||||||
$actionHandler = new $actionClass();
|
$actionHandler = new $actionClass();
|
||||||
|
|
||||||
// Sanitise ID list and query the database for apges
|
// Sanitise ID list and query the database for apges
|
||||||
$ids = split(' *, *', trim($request->requestVar('csvIDs')));
|
$ids = preg_split('/ *, */', trim($request->requestVar('csvIDs')));
|
||||||
foreach($ids as $k => $id) $ids[$k] = (int)$id;
|
foreach($ids as $k => $id) $ids[$k] = (int)$id;
|
||||||
$ids = array_filter($ids);
|
$ids = array_filter($ids);
|
||||||
|
|
||||||
@ -211,4 +211,4 @@ class CMSBatchActionHandler extends RequestHandler {
|
|||||||
return $actions;
|
return $actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
|||||||
SAPPHIRE_ADMIN_DIR . '/thirdparty/jlayout/lib/jquery.jlayout.js',
|
SAPPHIRE_ADMIN_DIR . '/thirdparty/jlayout/lib/jquery.jlayout.js',
|
||||||
SAPPHIRE_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.js',
|
SAPPHIRE_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.js',
|
||||||
SAPPHIRE_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.adapter.jquery.js',
|
SAPPHIRE_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.adapter.jquery.js',
|
||||||
// SAPPHIRE_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.html4.js',
|
SAPPHIRE_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.html4.js',
|
||||||
THIRDPARTY_DIR . '/jstree/jquery.jstree.js',
|
THIRDPARTY_DIR . '/jstree/jquery.jstree.js',
|
||||||
SAPPHIRE_ADMIN_DIR . '/thirdparty/chosen/chosen/chosen.jquery.js',
|
SAPPHIRE_ADMIN_DIR . '/thirdparty/chosen/chosen/chosen.jquery.js',
|
||||||
SAPPHIRE_ADMIN_DIR . '/thirdparty/jquery-hoverIntent/jquery.hoverIntent.js',
|
SAPPHIRE_ADMIN_DIR . '/thirdparty/jquery-hoverIntent/jquery.hoverIntent.js',
|
||||||
@ -322,7 +322,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
|||||||
SSViewer::set_theme(null);
|
SSViewer::set_theme(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleRequest($request, DataModel $model) {
|
function handleRequest(SS_HTTPRequest $request, DataModel $model = null) {
|
||||||
$title = $this->Title();
|
$title = $this->Title();
|
||||||
|
|
||||||
$response = parent::handleRequest($request, $model);
|
$response = parent::handleRequest($request, $model);
|
||||||
|
@ -113,7 +113,7 @@ abstract class ModelAdmin extends LeftAndMain {
|
|||||||
Requirements::javascript(SAPPHIRE_ADMIN_DIR . '/javascript/ModelAdmin.js');
|
Requirements::javascript(SAPPHIRE_ADMIN_DIR . '/javascript/ModelAdmin.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEditForm($id = null) {
|
function getEditForm($id = null, $fields = null) {
|
||||||
$list = $this->getList();
|
$list = $this->getList();
|
||||||
$exportButton = new GridFieldExportButton();
|
$exportButton = new GridFieldExportButton();
|
||||||
$exportButton->setExportColumns($this->getExportFields());
|
$exportButton->setExportColumns($this->getExportFields());
|
||||||
|
@ -20,6 +20,7 @@ html { overflow: hidden; }
|
|||||||
|
|
||||||
.jstree li a .ui-icon { text-indent: 0px !important; }
|
.jstree li a .ui-icon { text-indent: 0px !important; }
|
||||||
|
|
||||||
|
.cms table.ss-gridfield-table tbody td { width: auto; }
|
||||||
.cms table.ss-gridfield-table tr th.extra span input { height: 23px; }
|
.cms table.ss-gridfield-table tr th.extra span input { height: 23px; }
|
||||||
|
|
||||||
.ss-gridfield-button-filter.ss-ui-button { margin: -1px -5px; background: #e6e6e6 url(../images/filter-icons.png) no-repeat -40px 6px; filter: none; }
|
.ss-gridfield-button-filter.ss-ui-button { margin: -1px -5px; background: #e6e6e6 url(../images/filter-icons.png) no-repeat -40px 6px; filter: none; }
|
||||||
|
@ -35,7 +35,7 @@ If more variables exist in the future, consider creating a variables file.*/
|
|||||||
/** ---------------------------------------------------- Double tone borders http://daverupert.com/2011/06/two-tone-borders-with-css3/ ----------------------------------------------------- */
|
/** ---------------------------------------------------- Double tone borders http://daverupert.com/2011/06/two-tone-borders-with-css3/ ----------------------------------------------------- */
|
||||||
/** ----------------------------- Sprite images ----------------------------- */
|
/** ----------------------------- Sprite images ----------------------------- */
|
||||||
/** Helper SCSS file for generating sprites for the interface. */
|
/** Helper SCSS file for generating sprites for the interface. */
|
||||||
.btn-icon-sprite, .ui-state-default .btn-icon-accept, .ui-state-default .btn-icon-accept_disabled, .ui-state-default .btn-icon-add, .ui-state-default .btn-icon-add_disabled, .ui-state-default .btn-icon-addpage, .ui-state-default .btn-icon-addpage_disabled, .ui-state-default .btn-icon-arrow-circle-135-left, .ui-state-default .btn-icon-back, .ui-state-default .btn-icon-back_disabled, .ui-state-default .btn-icon-chain--arrow, .ui-state-default .btn-icon-chain--exclamation, .ui-state-default .btn-icon-chain--minus, .ui-state-default .btn-icon-chain--pencil, .ui-state-default .btn-icon-chain--plus, .ui-state-default .btn-icon-chain-small, .ui-state-default .btn-icon-chain-unchain, .ui-state-default .btn-icon-chain, .ui-state-default .btn-icon-cross-circle, .ui-state-default .btn-icon-cross-circle_disabled, .ui-state-default .btn-icon-decline, .ui-state-default .btn-icon-decline_disabled, .ui-state-default .btn-icon-download-csv, .ui-state-default .btn-icon-drive-upload, .ui-state-default .btn-icon-drive-upload_disabled, .ui-state-default .btn-icon-magnifier, .ui-state-default .btn-icon-minus-circle, .ui-state-default .btn-icon-minus-circle_disabled, .ui-state-default .btn-icon-navigation, .ui-state-default .btn-icon-navigation_disabled, .ui-state-default .btn-icon-network-cloud, .ui-state-default .btn-icon-network-cloud_disabled, .ui-state-default .btn-icon-pencil, .ui-state-default .btn-icon-pencil_disabled, .ui-state-default .btn-icon-plug-disconnect-prohibition, .ui-state-default .btn-icon-plug-disconnect-prohibition_disabled, .ui-state-default .btn-icon-preview, .ui-state-default .btn-icon-preview_disabled, .ui-state-default .btn-icon-settings, .ui-state-default .btn-icon-settings_disabled, .ui-state-default .btn-icon-unpublish, .ui-state-default .btn-icon-unpublish_disabled { background: url('../images/btn-icon-sb5d07676ff.png') no-repeat; }
|
.btn-icon-sprite, .ui-state-default .btn-icon-accept, .ui-state-default .btn-icon-accept_disabled, .ui-state-default .btn-icon-add, .ui-state-default .btn-icon-add_disabled, .ui-state-default .btn-icon-addpage, .ui-state-default .btn-icon-addpage_disabled, .ui-state-default .btn-icon-arrow-circle-135-left, .ui-state-default .btn-icon-back, .ui-state-default .btn-icon-back_disabled, .ui-state-default .btn-icon-chain--arrow, .ui-state-default .btn-icon-chain--exclamation, .ui-state-default .btn-icon-chain--minus, .ui-state-default .btn-icon-chain--pencil, .ui-state-default .btn-icon-chain--plus, .ui-state-default .btn-icon-chain-small, .ui-state-default .btn-icon-chain-unchain, .ui-state-default .btn-icon-chain, .ui-state-default .btn-icon-cross-circle, .ui-state-default .btn-icon-cross-circle_disabled, .ui-state-default .btn-icon-decline, .ui-state-default .btn-icon-decline_disabled, .ui-state-default .btn-icon-download-csv, .ui-state-default .btn-icon-drive-upload, .ui-state-default .btn-icon-drive-upload_disabled, .ui-state-default .btn-icon-magnifier, .ui-state-default .btn-icon-minus-circle, .ui-state-default .btn-icon-minus-circle_disabled, .ui-state-default .btn-icon-navigation, .ui-state-default .btn-icon-navigation_disabled, .ui-state-default .btn-icon-network-cloud, .ui-state-default .btn-icon-network-cloud_disabled, .ui-state-default .btn-icon-pencil, .ui-state-default .btn-icon-pencil_disabled, .ui-state-default .btn-icon-plug-disconnect-prohibition, .ui-state-default .btn-icon-plug-disconnect-prohibition_disabled, .ui-state-default .btn-icon-preview, .ui-state-default .btn-icon-preview_disabled, .ui-state-default .btn-icon-settings, .ui-state-default .btn-icon-settings_disabled, .ui-state-default .btn-icon-unpublish, .ui-state-default .btn-icon-unpublish_disabled { background: url('../images/btn-icon-sc495ceeeca.png') no-repeat; }
|
||||||
|
|
||||||
.ui-state-default .btn-icon-accept { background-position: 0 0; }
|
.ui-state-default .btn-icon-accept { background-position: 0 0; }
|
||||||
.ui-state-default .btn-icon-accept_disabled { background-position: 0 -17px; }
|
.ui-state-default .btn-icon-accept_disabled { background-position: 0 -17px; }
|
||||||
@ -45,39 +45,39 @@ If more variables exist in the future, consider creating a variables file.*/
|
|||||||
.ui-state-default .btn-icon-addpage_disabled { background-position: 0 -88px; }
|
.ui-state-default .btn-icon-addpage_disabled { background-position: 0 -88px; }
|
||||||
.ui-state-default .btn-icon-arrow-circle-135-left { background-position: 0 -104px; }
|
.ui-state-default .btn-icon-arrow-circle-135-left { background-position: 0 -104px; }
|
||||||
.ui-state-default .btn-icon-back { background-position: 0 -120px; }
|
.ui-state-default .btn-icon-back { background-position: 0 -120px; }
|
||||||
.ui-state-default .btn-icon-back_disabled { background-position: 0 -135px; }
|
.ui-state-default .btn-icon-back_disabled { background-position: 0 -136px; }
|
||||||
.ui-state-default .btn-icon-chain--arrow { background-position: 0 -150px; }
|
.ui-state-default .btn-icon-chain--arrow { background-position: 0 -151px; }
|
||||||
.ui-state-default .btn-icon-chain--exclamation { background-position: 0 -166px; }
|
.ui-state-default .btn-icon-chain--exclamation { background-position: 0 -167px; }
|
||||||
.ui-state-default .btn-icon-chain--minus { background-position: 0 -182px; }
|
.ui-state-default .btn-icon-chain--minus { background-position: 0 -183px; }
|
||||||
.ui-state-default .btn-icon-chain--pencil { background-position: 0 -198px; }
|
.ui-state-default .btn-icon-chain--pencil { background-position: 0 -199px; }
|
||||||
.ui-state-default .btn-icon-chain--plus { background-position: 0 -214px; }
|
.ui-state-default .btn-icon-chain--plus { background-position: 0 -215px; }
|
||||||
.ui-state-default .btn-icon-chain-small { background-position: 0 -230px; }
|
.ui-state-default .btn-icon-chain-small { background-position: 0 -231px; }
|
||||||
.ui-state-default .btn-icon-chain-unchain { background-position: 0 -246px; }
|
.ui-state-default .btn-icon-chain-unchain { background-position: 0 -247px; }
|
||||||
.ui-state-default .btn-icon-chain { background-position: 0 -262px; }
|
.ui-state-default .btn-icon-chain { background-position: 0 -263px; }
|
||||||
.ui-state-default .btn-icon-cross-circle { background-position: 0 -278px; }
|
.ui-state-default .btn-icon-cross-circle { background-position: 0 -279px; }
|
||||||
.ui-state-default .btn-icon-cross-circle_disabled { background-position: 0 -294px; }
|
.ui-state-default .btn-icon-cross-circle_disabled { background-position: 0 -295px; }
|
||||||
.ui-state-default .btn-icon-decline { background-position: 0 -310px; }
|
.ui-state-default .btn-icon-decline { background-position: 0 -311px; }
|
||||||
.ui-state-default .btn-icon-decline_disabled { background-position: 0 -327px; }
|
.ui-state-default .btn-icon-decline_disabled { background-position: 0 -328px; }
|
||||||
.ui-state-default .btn-icon-download-csv { background-position: 0 -344px; }
|
.ui-state-default .btn-icon-download-csv { background-position: 0 -345px; }
|
||||||
.ui-state-default .btn-icon-drive-upload { background-position: 0 -362px; }
|
.ui-state-default .btn-icon-drive-upload { background-position: 0 -363px; }
|
||||||
.ui-state-default .btn-icon-drive-upload_disabled { background-position: 0 -378px; }
|
.ui-state-default .btn-icon-drive-upload_disabled { background-position: 0 -379px; }
|
||||||
.ui-state-default .btn-icon-magnifier { background-position: 0 -394px; }
|
.ui-state-default .btn-icon-magnifier { background-position: 0 -395px; }
|
||||||
.ui-state-default .btn-icon-minus-circle { background-position: 0 -410px; }
|
.ui-state-default .btn-icon-minus-circle { background-position: 0 -411px; }
|
||||||
.ui-state-default .btn-icon-minus-circle_disabled { background-position: 0 -426px; }
|
.ui-state-default .btn-icon-minus-circle_disabled { background-position: 0 -427px; }
|
||||||
.ui-state-default .btn-icon-navigation { background-position: 0 -442px; }
|
.ui-state-default .btn-icon-navigation { background-position: 0 -443px; }
|
||||||
.ui-state-default .btn-icon-navigation_disabled { background-position: 0 -458px; }
|
.ui-state-default .btn-icon-navigation_disabled { background-position: 0 -459px; }
|
||||||
.ui-state-default .btn-icon-network-cloud { background-position: 0 -474px; }
|
.ui-state-default .btn-icon-network-cloud { background-position: 0 -475px; }
|
||||||
.ui-state-default .btn-icon-network-cloud_disabled { background-position: 0 -490px; }
|
.ui-state-default .btn-icon-network-cloud_disabled { background-position: 0 -491px; }
|
||||||
.ui-state-default .btn-icon-pencil { background-position: 0 -506px; }
|
.ui-state-default .btn-icon-pencil { background-position: 0 -507px; }
|
||||||
.ui-state-default .btn-icon-pencil_disabled { background-position: 0 -522px; }
|
.ui-state-default .btn-icon-pencil_disabled { background-position: 0 -523px; }
|
||||||
.ui-state-default .btn-icon-plug-disconnect-prohibition { background-position: 0 -538px; }
|
.ui-state-default .btn-icon-plug-disconnect-prohibition { background-position: 0 -539px; }
|
||||||
.ui-state-default .btn-icon-plug-disconnect-prohibition_disabled { background-position: 0 -554px; }
|
.ui-state-default .btn-icon-plug-disconnect-prohibition_disabled { background-position: 0 -555px; }
|
||||||
.ui-state-default .btn-icon-preview { background-position: 0 -570px; }
|
.ui-state-default .btn-icon-preview { background-position: 0 -571px; }
|
||||||
.ui-state-default .btn-icon-preview_disabled { background-position: 0 -587px; }
|
.ui-state-default .btn-icon-preview_disabled { background-position: 0 -588px; }
|
||||||
.ui-state-default .btn-icon-settings { background-position: 0 -604px; }
|
.ui-state-default .btn-icon-settings { background-position: 0 -605px; }
|
||||||
.ui-state-default .btn-icon-settings_disabled { background-position: 0 -620px; }
|
.ui-state-default .btn-icon-settings_disabled { background-position: 0 -621px; }
|
||||||
.ui-state-default .btn-icon-unpublish { background-position: 0 -636px; }
|
.ui-state-default .btn-icon-unpublish { background-position: 0 -637px; }
|
||||||
.ui-state-default .btn-icon-unpublish_disabled { background-position: 0 -654px; }
|
.ui-state-default .btn-icon-unpublish_disabled { background-position: 0 -655px; }
|
||||||
|
|
||||||
.icon { text-indent: -9999px; border: none; outline: none; }
|
.icon { text-indent: -9999px; border: none; outline: none; }
|
||||||
.icon.icon-24 { width: 24px; height: 24px; background: url('../images/menu-icons/24x24-s546fcae8fd.png'); }
|
.icon.icon-24 { width: 24px; height: 24px; background: url('../images/menu-icons/24x24-s546fcae8fd.png'); }
|
||||||
@ -178,7 +178,7 @@ form.small .field input.text, form.small .field textarea, form.small .field sele
|
|||||||
.cms input.loading, .cms button.loading, .cms input.ui-state-default.loading, .cms .ui-widget-content input.ui-state-default.loading, .cms .ui-widget-header input.ui-state-default.loading { color: #525252; border-color: #d5d3d3; cursor: default; }
|
.cms input.loading, .cms button.loading, .cms input.ui-state-default.loading, .cms .ui-widget-content input.ui-state-default.loading, .cms .ui-widget-header input.ui-state-default.loading { color: #525252; border-color: #d5d3d3; cursor: default; }
|
||||||
.cms input.loading .ui-icon, .cms button.loading .ui-icon, .cms input.ui-state-default.loading .ui-icon, .cms .ui-widget-content input.ui-state-default.loading .ui-icon, .cms .ui-widget-header input.ui-state-default.loading .ui-icon { background: transparent url(../../images/network-save.gif) no-repeat 0 0; }
|
.cms input.loading .ui-icon, .cms button.loading .ui-icon, .cms input.ui-state-default.loading .ui-icon, .cms .ui-widget-content input.ui-state-default.loading .ui-icon, .cms .ui-widget-header input.ui-state-default.loading .ui-icon { background: transparent url(../../images/network-save.gif) no-repeat 0 0; }
|
||||||
.cms input.loading.ss-ui-action-constructive .ui-icon, .cms button.loading.ss-ui-action-constructive .ui-icon { background: transparent url(../../images/network-save-constructive.gif) no-repeat 0 0; }
|
.cms input.loading.ss-ui-action-constructive .ui-icon, .cms button.loading.ss-ui-action-constructive .ui-icon { background: transparent url(../../images/network-save-constructive.gif) no-repeat 0 0; }
|
||||||
.cms .ss-ui-button { font-weight: bold; text-decoration: none; line-height: 16px; color: #393939; border: 1px solid #c0c0c2; border-bottom: 1px solid #a6a6a9; cursor: pointer; text-shadow: white 0 1px 1px; background-color: #e6e6e6; background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjUwJSIgeTE9IjAlIiB4Mj0iNTAlIiB5Mj0iMTAwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2Q5ZDlkOSIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA=='); background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ffffff), color-stop(100%, #d9d9d9)); background: -webkit-linear-gradient(#ffffff, #d9d9d9); background: -moz-linear-gradient(#ffffff, #d9d9d9); background: -o-linear-gradient(#ffffff, #d9d9d9); background: -ms-linear-gradient(#ffffff, #d9d9d9); background: linear-gradient(#ffffff, #d9d9d9); /* constructive */ /* destructive */ }
|
.cms .ss-ui-button { margin-top: 0px; font-weight: bold; text-decoration: none; line-height: 16px; color: #393939; border: 1px solid #c0c0c2; border-bottom: 1px solid #a6a6a9; cursor: pointer; text-shadow: white 0 1px 1px; background-color: #e6e6e6; background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjUwJSIgeTE9IjAlIiB4Mj0iNTAlIiB5Mj0iMTAwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2Q5ZDlkOSIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA=='); background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ffffff), color-stop(100%, #d9d9d9)); background: -webkit-linear-gradient(#ffffff, #d9d9d9); background: -moz-linear-gradient(#ffffff, #d9d9d9); background: -o-linear-gradient(#ffffff, #d9d9d9); background: -ms-linear-gradient(#ffffff, #d9d9d9); background: linear-gradient(#ffffff, #d9d9d9); /* constructive */ /* destructive */ }
|
||||||
.cms .ss-ui-button.buttonset { margin: 0 -1px; }
|
.cms .ss-ui-button.buttonset { margin: 0 -1px; }
|
||||||
.cms .ss-ui-button.ui-state-hover, .cms .ss-ui-button:hover { text-decoration: none; background-color: white; background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjUwJSIgeTE9IjAlIiB4Mj0iNTAlIiB5Mj0iMTAwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2U2ZTZlNiIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA=='); background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ffffff), color-stop(100%, #e6e6e6)); background: -webkit-linear-gradient(#ffffff, #e6e6e6); background: -moz-linear-gradient(#ffffff, #e6e6e6); background: -o-linear-gradient(#ffffff, #e6e6e6); background: -ms-linear-gradient(#ffffff, #e6e6e6); background: linear-gradient(#ffffff, #e6e6e6); -moz-box-shadow: 0 0 5px #b3b3b3; -webkit-box-shadow: 0 0 5px #b3b3b3; -o-box-shadow: 0 0 5px #b3b3b3; box-shadow: 0 0 5px #b3b3b3; }
|
.cms .ss-ui-button.ui-state-hover, .cms .ss-ui-button:hover { text-decoration: none; background-color: white; background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjUwJSIgeTE9IjAlIiB4Mj0iNTAlIiB5Mj0iMTAwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2U2ZTZlNiIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA=='); background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ffffff), color-stop(100%, #e6e6e6)); background: -webkit-linear-gradient(#ffffff, #e6e6e6); background: -moz-linear-gradient(#ffffff, #e6e6e6); background: -o-linear-gradient(#ffffff, #e6e6e6); background: -ms-linear-gradient(#ffffff, #e6e6e6); background: linear-gradient(#ffffff, #e6e6e6); -moz-box-shadow: 0 0 5px #b3b3b3; -webkit-box-shadow: 0 0 5px #b3b3b3; -o-box-shadow: 0 0 5px #b3b3b3; box-shadow: 0 0 5px #b3b3b3; }
|
||||||
.cms .ss-ui-button:active, .cms .ss-ui-button:focus, .cms .ss-ui-button.ui-state-active, .cms .ss-ui-button.ui-state-focus { border: 1px solid #b3b3b3; background-color: white; background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjUwJSIgeTE9IjAlIiB4Mj0iNTAlIiB5Mj0iMTAwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2U2ZTZlNiIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA=='); background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ffffff), color-stop(100%, #e6e6e6)); background: -webkit-linear-gradient(#ffffff, #e6e6e6); background: -moz-linear-gradient(#ffffff, #e6e6e6); background: -o-linear-gradient(#ffffff, #e6e6e6); background: -ms-linear-gradient(#ffffff, #e6e6e6); background: linear-gradient(#ffffff, #e6e6e6); -moz-box-shadow: 0 0 5px #b3b3b3 inset; -webkit-box-shadow: 0 0 5px #b3b3b3 inset; -o-box-shadow: 0 0 5px #b3b3b3 inset; box-shadow: 0 0 5px #b3b3b3 inset; }
|
.cms .ss-ui-button:active, .cms .ss-ui-button:focus, .cms .ss-ui-button.ui-state-active, .cms .ss-ui-button.ui-state-focus { border: 1px solid #b3b3b3; background-color: white; background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjUwJSIgeTE9IjAlIiB4Mj0iNTAlIiB5Mj0iMTAwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2U2ZTZlNiIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA=='); background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ffffff), color-stop(100%, #e6e6e6)); background: -webkit-linear-gradient(#ffffff, #e6e6e6); background: -moz-linear-gradient(#ffffff, #e6e6e6); background: -o-linear-gradient(#ffffff, #e6e6e6); background: -ms-linear-gradient(#ffffff, #e6e6e6); background: linear-gradient(#ffffff, #e6e6e6); -moz-box-shadow: 0 0 5px #b3b3b3 inset; -webkit-box-shadow: 0 0 5px #b3b3b3 inset; -o-box-shadow: 0 0 5px #b3b3b3 inset; box-shadow: 0 0 5px #b3b3b3 inset; }
|
||||||
@ -256,13 +256,13 @@ body.cms { overflow: hidden; }
|
|||||||
.cms-content-header { padding: 0px 8px 8px; height: 32px; z-index: 60; background-image: url(../images/textures/cms_content_header.png); background-repeat: repeat; }
|
.cms-content-header { padding: 0px 8px 8px; height: 32px; z-index: 60; background-image: url(../images/textures/cms_content_header.png); background-repeat: repeat; }
|
||||||
.cms-content-header a { color: #1556b2; }
|
.cms-content-header a { color: #1556b2; }
|
||||||
.cms-content-header .backlink { float: left; margin-top: 7px; }
|
.cms-content-header .backlink { float: left; margin-top: 7px; }
|
||||||
.cms-content-header .backlink span.btn-icon-back { height: 15px; }
|
.cms-content-header .backlink span.btn-icon-back { height: 16px; }
|
||||||
.cms-content-header h2 { float: left; padding: 8px 8px 0 8px; font-size: 14px; line-height: 24px; font-weight: bold; text-shadow: #bfcad2 1px 1px 0; max-width: 400px; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; o-text-overflow: ellipsis; }
|
.cms-content-header h2 { float: left; padding: 8px 8px 0 8px; font-size: 14px; line-height: 24px; font-weight: bold; text-shadow: #bfcad2 1px 1px 0; max-width: 400px; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; o-text-overflow: ellipsis; }
|
||||||
.cms-content-header > div { width: 9999em; overflow: hidden; }
|
.cms-content-header > div { width: 9999em; overflow: hidden; }
|
||||||
.cms-content-header .cms-content-header-tabs { position: fixed; right: 40px; }
|
.cms-content-header .cms-content-header-tabs { position: fixed; right: 40px; }
|
||||||
.cms-content-header .cms-content-header-tabs .ui-tabs-nav li a { font-weight: bold; line-height: 16px; padding: 12px 20px 11px; }
|
.cms-content-header .cms-content-header-tabs .ui-tabs-nav li a { font-weight: bold; line-height: 16px; padding: 12px 20px 12px; }
|
||||||
.cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-state-default, .cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-widget-content .ui-state-default, .cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-widget-header .ui-state-default { border-top: none; }
|
.cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-state-default, .cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-widget-content .ui-state-default, .cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-widget-header .ui-state-default { border-top: none; }
|
||||||
.cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-state-active, .cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-widget-content .ui-state-active, .cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-widget-header .ui-state-active { border-top: none; }
|
.cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-state-active, .cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-widget-content .ui-state-active, .cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-widget-header .ui-state-active { border-top: none; padding-bottom: 0px; }
|
||||||
.cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-corner-all, .cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-corner-top, .cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-corner-right, .cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-corner-tr { border-radius: 0; }
|
.cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-corner-all, .cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-corner-top, .cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-corner-right, .cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-corner-tr { border-radius: 0; }
|
||||||
.cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-corner-all, .cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-corner-top, .cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-corner-left, .cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-corner-tl { border-radius: 0; }
|
.cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-corner-all, .cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-corner-top, .cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-corner-left, .cms-content-header .cms-content-header-tabs .ui-tabs-nav .ui-corner-tl { border-radius: 0; }
|
||||||
|
|
||||||
@ -312,6 +312,9 @@ body.cms { overflow: hidden; }
|
|||||||
/** -------------------------------------------- "Add page" dialog -------------------------------------------- */
|
/** -------------------------------------------- "Add page" dialog -------------------------------------------- */
|
||||||
.cms-page-add-form-dialog { display: none; }
|
.cms-page-add-form-dialog { display: none; }
|
||||||
|
|
||||||
|
.cms-add-form .step-label .flyout { height: 17px; padding-top: 5px; }
|
||||||
|
.cms-add-form .step-label .title { padding-top: 5px; font-weight: bold; text-shadow: 1px 1px 0 white; }
|
||||||
|
.cms-add-form ul.SelectionGroup { padding-left: 28px; }
|
||||||
.cms-add-form .parent-mode { padding: 8px; overflow: auto; }
|
.cms-add-form .parent-mode { padding: 8px; overflow: auto; }
|
||||||
.cms-add-form #PageType li { float: none; width: 100%; padding: 9px 0 9px 15px; overflow: hidden; border-bottom-width: 2px; border-bottom: 2px groove rgba(255, 255, 255, 0.8); -webkit-border-image: url(../images/textures/bg_fieldset_elements_border.png) 2 stretch stretch; border-image: url(../images/textures/bg_fieldset_elements_border.png) 2 stretch stretch; }
|
.cms-add-form #PageType li { float: none; width: 100%; padding: 9px 0 9px 15px; overflow: hidden; border-bottom-width: 2px; border-bottom: 2px groove rgba(255, 255, 255, 0.8); -webkit-border-image: url(../images/textures/bg_fieldset_elements_border.png) 2 stretch stretch; border-image: url(../images/textures/bg_fieldset_elements_border.png) 2 stretch stretch; }
|
||||||
.cms-add-form #PageType li:last-child { border-bottom: none; }
|
.cms-add-form #PageType li:last-child { border-bottom: none; }
|
||||||
@ -394,6 +397,12 @@ body.cms { overflow: hidden; }
|
|||||||
.cms-preview-header { background-color: #FFBE66; padding: 10px; font-weight: bold; }
|
.cms-preview-header { background-color: #FFBE66; padding: 10px; font-weight: bold; }
|
||||||
|
|
||||||
/** -------------------------------------------- Member Profile -------------------------------------------- */
|
/** -------------------------------------------- Member Profile -------------------------------------------- */
|
||||||
|
form.member-profile-form { padding: 0 16px 0 0; }
|
||||||
|
form.member-profile-form .ui-tabs-nav .ui-state-default, form.member-profile-form .ui-tabs-nav .ui-widget-content .ui-state-default, form.member-profile-form .ui-tabs-nav .ui-widget-header .ui-state-default { border-top: none; }
|
||||||
|
form.member-profile-form #Root_Permissions { clear: both; padding: 16px; }
|
||||||
|
form.member-profile-form #Root_Main { clear: both; padding: 16px; }
|
||||||
|
form.member-profile-form #Root_Main .cms-help-toggle { text-indent: -9999em; display: inline-block; width: 20px; background: url(../images/question.png) no-repeat 0px 0px; }
|
||||||
|
form.member-profile-form #FavouritePageID { margin-top: 8px; }
|
||||||
form.member-profile-form #CsvFile .middleColumn { background: none !important; }
|
form.member-profile-form #CsvFile .middleColumn { background: none !important; }
|
||||||
form.member-profile-form .advanced h4 { margin-bottom: .5em; }
|
form.member-profile-form .advanced h4 { margin-bottom: .5em; }
|
||||||
form.member-profile-form .Actions { text-align: left; border: 0; }
|
form.member-profile-form .Actions { text-align: left; border: 0; }
|
||||||
@ -406,12 +415,15 @@ form.member-profile-form #Groups .middleColumn { margin-left: 0; width: 100%; }
|
|||||||
form.member-profile-form #Groups .middleColumn .TreeDropdownField { width: 90%; max-width: 90%; }
|
form.member-profile-form #Groups .middleColumn .TreeDropdownField { width: 90%; max-width: 90%; }
|
||||||
form.member-profile-form #Permissions .optionset li { float: none; width: auto; }
|
form.member-profile-form #Permissions .optionset li { float: none; width: auto; }
|
||||||
form.member-profile-form .ui-tabs-nav li { margin: 0 0 -1px 0; }
|
form.member-profile-form .ui-tabs-nav li { margin: 0 0 -1px 0; }
|
||||||
form.member-profile-form .ui-corner-all, form.member-profile-form .ui-corner-top, form.member-profile-form .ui-corner-right, form.member-profile-form .ui-corner-tr { border-radius: 0; }
|
form.member-profile-form .ui-tabs-nav .ui-corner-all, form.member-profile-form .ui-tabs-nav .ui-corner-top, form.member-profile-form .ui-tabs-nav .ui-corner-right, form.member-profile-form .ui-tabs-nav .ui-corner-tr { border-radius: 0; }
|
||||||
form.member-profile-form .ui-corner-all, form.member-profile-form .ui-corner-top, form.member-profile-form .ui-corner-left, form.member-profile-form .ui-corner-tl { border-radius: 0; }
|
form.member-profile-form .ui-tabs-nav .ui-corner-all, form.member-profile-form .ui-tabs-nav .ui-corner-top, form.member-profile-form .ui-tabs-nav .ui-corner-left, form.member-profile-form .ui-tabs-nav .ui-corner-tl { border-radius: 0; }
|
||||||
|
|
||||||
.cms .cms-content { border-right: 1px solid rgba(201, 205, 206, 0.8); -moz-box-shadow: 3px 0 4px rgba(0, 0, 0, 0.15); -webkit-box-shadow: 3px 0 4px rgba(0, 0, 0, 0.15); -o-box-shadow: 3px 0 4px rgba(0, 0, 0, 0.15); box-shadow: 3px 0 4px rgba(0, 0, 0, 0.15); -moz-border-radius: 0; -webkit-border-radius: 0; -o-border-radius: 0; -ms-border-radius: 0; -khtml-border-radius: 0; border-radius: 0; }
|
.cms .cms-content { border-right: 1px solid rgba(201, 205, 206, 0.8); -moz-box-shadow: 3px 0 4px rgba(0, 0, 0, 0.15); -webkit-box-shadow: 3px 0 4px rgba(0, 0, 0, 0.15); -o-box-shadow: 3px 0 4px rgba(0, 0, 0, 0.15); box-shadow: 3px 0 4px rgba(0, 0, 0, 0.15); -moz-border-radius: 0; -webkit-border-radius: 0; -o-border-radius: 0; -ms-border-radius: 0; -khtml-border-radius: 0; border-radius: 0; }
|
||||||
.cms .cms-content-fields { /* always show a y scroll bar as popups like TreeDropdowns can trigger longer pages and the extra scroll bar doesn't fire our sizing bar */ overflow-y: auto; overflow-x: auto; background: none; width: 100%; }
|
.cms .cms-content-fields { overflow-y: auto; overflow-x: auto; background: none; width: 100%; }
|
||||||
.cms .cms-content-fields .aligned-right-label { margin-left: 184px; padding: 8px 0; }
|
.cms .cms-content-fields #Root_Main .confirmedpassword { border-bottom: none; box-shadow: none; }
|
||||||
|
.cms .cms-content-fields #Root_Main .customFormat { max-width: 80px; }
|
||||||
|
.cms .cms-content-fields #Root_Main .cms-help-toggle { text-indent: -9999em; display: inline-block; width: 20px; background: url(../images/question.png) no-repeat 0px 0px; }
|
||||||
|
.cms .cms-content-fields #Root_Permissions ul.optionset li { float: none; }
|
||||||
|
|
||||||
/** -------------------------------------------- "Settings" Form -------------------------------------------- */
|
/** -------------------------------------------- "Settings" Form -------------------------------------------- */
|
||||||
#CanViewType .optionset li, #CanEditType .optionset li, #CanCreateTopLevelType .optionset li { float: none; width: auto; white-space: nowrap; }
|
#CanViewType .optionset li, #CanEditType .optionset li, #CanCreateTopLevelType .optionset li { float: none; width: auto; white-space: nowrap; }
|
||||||
@ -450,6 +462,8 @@ form.member-profile-form .ui-corner-all, form.member-profile-form .ui-corner-top
|
|||||||
|
|
||||||
.cms .ui-widget-overlay { background-color: #000; background-image: none; }
|
.cms .ui-widget-overlay { background-color: #000; background-image: none; }
|
||||||
|
|
||||||
|
.cms .ui-dialog .ss-ui-dialog.ui-dialog-content { padding-top: 0px; }
|
||||||
|
|
||||||
.ui-dialog { background: url("../images/textures/bg_cms_main_content.png") repeat left top #f0f3f4; border: 3px solid #000 !important; border-radius: 8px; overflow: visible; padding: 0; }
|
.ui-dialog { background: url("../images/textures/bg_cms_main_content.png") repeat left top #f0f3f4; border: 3px solid #000 !important; border-radius: 8px; overflow: visible; padding: 0; }
|
||||||
.ui-dialog .ui-dialog-titlebar.ui-widget-header { font-size: 14px; background-color: #92a5b2; padding: 4px 4px 4px 16px; border-bottom: 2px solid #8399a7; background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjUwJSIgeTE9IjAlIiB4Mj0iNTAlIiB5Mj0iMTAwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2NlZDdkYyIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzkyYTViMiIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA=='); background-size: 100%; background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ced7dc), color-stop(100%, #92a5b2)); background-image: -webkit-linear-gradient(#ced7dc, #92a5b2); background-image: -moz-linear-gradient(#ced7dc, #92a5b2); background-image: -o-linear-gradient(#ced7dc, #92a5b2); background-image: -ms-linear-gradient(#ced7dc, #92a5b2); background-image: linear-gradient(#ced7dc, #92a5b2); }
|
.ui-dialog .ui-dialog-titlebar.ui-widget-header { font-size: 14px; background-color: #92a5b2; padding: 4px 4px 4px 16px; border-bottom: 2px solid #8399a7; background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjUwJSIgeTE9IjAlIiB4Mj0iNTAlIiB5Mj0iMTAwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2NlZDdkYyIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzkyYTViMiIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA=='); background-size: 100%; background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ced7dc), color-stop(100%, #92a5b2)); background-image: -webkit-linear-gradient(#ced7dc, #92a5b2); background-image: -moz-linear-gradient(#ced7dc, #92a5b2); background-image: -o-linear-gradient(#ced7dc, #92a5b2); background-image: -ms-linear-gradient(#ced7dc, #92a5b2); background-image: linear-gradient(#ced7dc, #92a5b2); }
|
||||||
.ui-dialog.loading { background-image: url(../images/spinner.gif); background-position: 50% 50%; background-repeat: no-repeat; }
|
.ui-dialog.loading { background-image: url(../images/spinner.gif); background-position: 50% 50%; background-repeat: no-repeat; }
|
||||||
@ -461,7 +475,7 @@ body.cms-dialog { overflow: auto; background: url("../images/textures/bg_cms_mai
|
|||||||
.cms-dialog-content .ss-tabset { z-index: 60; -moz-border-radius: none; -webkit-border-radius: none; -o-border-radius: none; -ms-border-radius: none; -khtml-border-radius: none; border-radius: none; }
|
.cms-dialog-content .ss-tabset { z-index: 60; -moz-border-radius: none; -webkit-border-radius: none; -o-border-radius: none; -ms-border-radius: none; -khtml-border-radius: none; border-radius: none; }
|
||||||
.cms-dialog-content .ss-tabset .tab { background: none; overflow-y: auto; }
|
.cms-dialog-content .ss-tabset .tab { background: none; overflow-y: auto; }
|
||||||
.cms-dialog-content .ss-tabset.ui-tabs { background: none; }
|
.cms-dialog-content .ss-tabset.ui-tabs { background: none; }
|
||||||
.cms-dialog-content .ss-tabset.ui-tabs .ui-tabs-nav { padding: 8px 0 0 0; border: none; }
|
.cms-dialog-content .ss-tabset.ui-tabs .ui-tabs-nav { border: none; padding: 0 40px 0 0; float: right; }
|
||||||
.cms-dialog-content .ss-tabset.ui-tabs .ui-tabs-nav li { font-weight: bold; line-height: 16px; padding: 11px 12px 9px; border-bottom: 2px solid #B3B3B3; }
|
.cms-dialog-content .ss-tabset.ui-tabs .ui-tabs-nav li { font-weight: bold; line-height: 16px; padding: 11px 12px 9px; border-bottom: 2px solid #B3B3B3; }
|
||||||
.cms-dialog-content .ss-tabset.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: -1px; }
|
.cms-dialog-content .ss-tabset.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: -1px; }
|
||||||
.cms-dialog-content .ss-tabset.ui-tabs .ui-tabs-nav li:first-child { margin-left: 15px; }
|
.cms-dialog-content .ss-tabset.ui-tabs .ui-tabs-nav li:first-child { margin-left: 15px; }
|
||||||
@ -517,6 +531,9 @@ form.import-form ul li { margin-left: 20px; }
|
|||||||
form.import-form p { margin-bottom: 5px; }
|
form.import-form p { margin-bottom: 5px; }
|
||||||
form.import-form label.left { width: 250px; }
|
form.import-form label.left { width: 250px; }
|
||||||
|
|
||||||
|
/** -------------------------------------------- Page Edit Controller -------------------------------------------- */
|
||||||
|
.cms-container .CMSMain.CMSPageEditController { margin-left: -1px; }
|
||||||
|
|
||||||
/** This file defines the jstree base styling (see http://jstree.com), as well as any customizations (see bottom of file). The styles are usually added through jstree.js on DOM load, but we need it earlier in order to correctly display the uninitialized tree. */
|
/** This file defines the jstree base styling (see http://jstree.com), as well as any customizations (see bottom of file). The styles are usually added through jstree.js on DOM load, but we need it earlier in order to correctly display the uninitialized tree. */
|
||||||
.cms .jstree ul, .TreeDropdownField .treedropdownfield-panel .jstree ul { display: block; margin: 0; padding: 0; background: none; list-style-type: none; }
|
.cms .jstree ul, .TreeDropdownField .treedropdownfield-panel .jstree ul { display: block; margin: 0; padding: 0; background: none; list-style-type: none; }
|
||||||
.cms .jstree li, .TreeDropdownField .treedropdownfield-panel .jstree li { display: block; margin: 0; padding: 0; list-style-type: none; display: block; min-height: 18px; line-height: 18px; white-space: nowrap; margin-left: 18px; min-width: 18px; }
|
.cms .jstree li, .TreeDropdownField .treedropdownfield-panel .jstree li { display: block; margin: 0; padding: 0; list-style-type: none; display: block; min-height: 18px; line-height: 18px; white-space: nowrap; margin-left: 18px; min-width: 18px; }
|
||||||
@ -605,8 +622,8 @@ form.import-form label.left { width: 250px; }
|
|||||||
.tree-holder.jstree-apple li, .cms-tree.jstree-apple li { padding: 0px; clear: left; }
|
.tree-holder.jstree-apple li, .cms-tree.jstree-apple li { padding: 0px; clear: left; }
|
||||||
.tree-holder.jstree-apple ins, .cms-tree.jstree-apple ins { background-color: transparent; background-image: url(../images/sitetree_ss_default_icons.png); }
|
.tree-holder.jstree-apple ins, .cms-tree.jstree-apple ins { background-color: transparent; background-image: url(../images/sitetree_ss_default_icons.png); }
|
||||||
.tree-holder.jstree-apple li.jstree-checked > a, .tree-holder.jstree-apple li.jstree-checked > a:link, .cms-tree.jstree-apple li.jstree-checked > a, .cms-tree.jstree-apple li.jstree-checked > a:link { background-color: #efe999; }
|
.tree-holder.jstree-apple li.jstree-checked > a, .tree-holder.jstree-apple li.jstree-checked > a:link, .cms-tree.jstree-apple li.jstree-checked > a, .cms-tree.jstree-apple li.jstree-checked > a:link { background-color: #efe999; }
|
||||||
.tree-holder.jstree-apple .jstree-closed > ins, .cms-tree.jstree-apple .jstree-closed > ins { background-position: 0 0; }
|
.tree-holder.jstree-apple .jstree-closed > ins, .cms-tree.jstree-apple .jstree-closed > ins { background-position: 0 0; cursor: pointer; }
|
||||||
.tree-holder.jstree-apple .jstree-open > ins, .cms-tree.jstree-apple .jstree-open > ins { background-position: -20px 0; }
|
.tree-holder.jstree-apple .jstree-open > ins, .cms-tree.jstree-apple .jstree-open > ins { background-position: -20px 0; cursor: pointer; }
|
||||||
|
|
||||||
a .jstree-pageicon { display: block; float: left; width: 16px; height: 16px; margin-right: 4px; background-color: transparent; background-image: url(../images/sitetree_ss_pageclass_icons_default.png); background-repeat: no-repeat; }
|
a .jstree-pageicon { display: block; float: left; width: 16px; height: 16px; margin-right: 4px; background-color: transparent; background-image: url(../images/sitetree_ss_pageclass_icons_default.png); background-repeat: no-repeat; }
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 18 KiB |
BIN
admin/images/btn-icon-sc495ceeeca.png
Normal file
After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 761 B After Width: | Height: | Size: 3.2 KiB |
BIN
admin/images/btn-icon/back.png
Normal file → Executable file
Before Width: | Height: | Size: 742 B After Width: | Height: | Size: 779 B |
BIN
admin/images/question.png
Executable file
After Width: | Height: | Size: 343 B |
@ -142,6 +142,11 @@
|
|||||||
var formData = form.serializeArray();
|
var formData = form.serializeArray();
|
||||||
// add button action
|
// add button action
|
||||||
formData.push({name: $(button).attr('name'), value:'1'});
|
formData.push({name: $(button).attr('name'), value:'1'});
|
||||||
|
// Artificial HTTP referer, IE doesn't submit them via ajax.
|
||||||
|
// Also rewrites anchors to their page counterparts, which is important
|
||||||
|
// as automatic browser ajax response redirects seem to discard the hash/fragment.
|
||||||
|
formData.push({name: 'BackURL', value:History.getPageUrl()});
|
||||||
|
|
||||||
jQuery.ajax(jQuery.extend({
|
jQuery.ajax(jQuery.extend({
|
||||||
url: form.attr('action'),
|
url: form.attr('action'),
|
||||||
data: formData,
|
data: formData,
|
||||||
@ -159,12 +164,6 @@
|
|||||||
self.submitForm_responseHandler(form, xmlhttp.responseText, status, xmlhttp, formData);
|
self.submitForm_responseHandler(form, xmlhttp.responseText, status, xmlhttp, formData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simulates a redirect on an ajax response - just exchange the URL without re-requesting it
|
|
||||||
if(window.History.enabled) {
|
|
||||||
var url = xmlhttp.getResponseHeader('X-ControllerURL');
|
|
||||||
if(url) window.history.replaceState({}, '', url);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Re-init tabs (in case the form tag itself is a tabset)
|
// Re-init tabs (in case the form tag itself is a tabset)
|
||||||
if(self.hasClass('ss-tabset')) self.removeClass('ss-tabset').addClass('ss-tabset');
|
if(self.hasClass('ss-tabset')) self.removeClass('ss-tabset').addClass('ss-tabset');
|
||||||
|
|
||||||
@ -287,7 +286,7 @@
|
|||||||
var url = $(node).find('a:first').attr('href');
|
var url = $(node).find('a:first').attr('href');
|
||||||
if(url && url != '#') {
|
if(url && url != '#') {
|
||||||
|
|
||||||
if($(node).find('a:first').is(':internal')) url = url = $.path.makeUrlAbsolute(url, $('base').attr('href'));
|
if($.path.isExternal($(node).find('a:first'))) url = url = $.path.makeUrlAbsolute(url, $('base').attr('href'));
|
||||||
// Reload only edit form if it exists (side-by-side view of tree and edit view), otherwise reload whole panel
|
// Reload only edit form if it exists (side-by-side view of tree and edit view), otherwise reload whole panel
|
||||||
if(container.find('.cms-edit-form').length) {
|
if(container.find('.cms-edit-form').length) {
|
||||||
url += '?cms-view-form=1';
|
url += '?cms-view-form=1';
|
||||||
@ -311,4 +310,4 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
@ -207,16 +207,16 @@
|
|||||||
onclick: function(e) {
|
onclick: function(e) {
|
||||||
// Only catch left clicks, in order to allow opening in tabs.
|
// Only catch left clicks, in order to allow opening in tabs.
|
||||||
// Ignore external links, fallback to standard link behaviour
|
// Ignore external links, fallback to standard link behaviour
|
||||||
if(e.which > 1 || this.is(':external')) return;
|
var isExternal = $.path.isExternal(this.attr('href'));
|
||||||
|
if(e.which > 1 || isExternal) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var item = this.getMenuItem();
|
var item = this.getMenuItem();
|
||||||
|
|
||||||
var url = this.attr('href');
|
var url = this.attr('href');
|
||||||
if(this.is(':internal')) url = $('base').attr('href') + url;
|
if(!isExternal) url = $('base').attr('href') + url;
|
||||||
|
|
||||||
var children = item.find('li');
|
var children = item.find('li');
|
||||||
|
|
||||||
if(children.length) {
|
if(children.length) {
|
||||||
children.first().find('a').click();
|
children.first().find('a').click();
|
||||||
} else {
|
} else {
|
||||||
@ -261,8 +261,4 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Internal Helper
|
|
||||||
$.expr[':'].internal = function(obj){return obj.href.match(/^mailto\:/) || (obj.hostname == location.hostname);};
|
|
||||||
$.expr[':'].external = function(obj){return !$(obj).is(':internal');};
|
|
||||||
}(jQuery));
|
}(jQuery));
|
@ -18,12 +18,28 @@ jQuery.noConflict();
|
|||||||
spinner.show();
|
spinner.show();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// apply an select element only when it is ready, ie. when it is rendered into a template
|
||||||
|
// with css applied and got a width value.
|
||||||
|
var applyChosen = function(el){
|
||||||
|
if(el.outerWidth()){
|
||||||
|
el.chosen().addClass("has-chzn");
|
||||||
|
// Copy over title attribute if required
|
||||||
|
if(el.attr('title')) el.siblings('.chzn-container').attr('title', el.attr('title'));
|
||||||
|
} else {
|
||||||
|
setTimeout(function() {applyChosen(el);},500);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
$(window).bind('resize', positionLoadingSpinner).trigger('resize');
|
$(window).bind('resize', positionLoadingSpinner).trigger('resize');
|
||||||
|
|
||||||
// global ajax error handlers
|
// global ajax error handlers
|
||||||
$.ajaxSetup({
|
$.ajaxSetup({
|
||||||
error: function(xmlhttp, status, error) {
|
error: function(xmlhttp, status, error) {
|
||||||
var msg = (xmlhttp.getResponseHeader('X-Status')) ? xmlhttp.getResponseHeader('X-Status') : xmlhttp.statusText;
|
if(xmlhttp.status < 200 || xmlhttp.status > 399) {
|
||||||
|
var msg = (xmlhttp.getResponseHeader('X-Status')) ? xmlhttp.getResponseHeader('X-Status') : xmlhttp.statusText;
|
||||||
|
} else {
|
||||||
|
msg = error;
|
||||||
|
}
|
||||||
statusMessage(msg, 'bad');
|
statusMessage(msg, 'bad');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -72,7 +88,8 @@ jQuery.noConflict();
|
|||||||
|
|
||||||
$('.cms-edit-form').live('reloadeditform', function(e, data) {
|
$('.cms-edit-form').live('reloadeditform', function(e, data) {
|
||||||
// Simulates a redirect on an ajax response - just exchange the URL without re-requesting it
|
// Simulates a redirect on an ajax response - just exchange the URL without re-requesting it
|
||||||
if(window.History.enabled) {
|
// Causes non-pushState browser to re-request the URL, so ignore for those.
|
||||||
|
if(window.History.enabled && !History.emulated.pushState) {
|
||||||
var url = data.xmlhttp.getResponseHeader('X-ControllerURL');
|
var url = data.xmlhttp.getResponseHeader('X-ControllerURL');
|
||||||
if(url) window.history.replaceState({}, '', url);
|
if(url) window.history.replaceState({}, '', url);
|
||||||
}
|
}
|
||||||
@ -207,12 +224,13 @@ jQuery.noConflict();
|
|||||||
var layoutClasses = ['east', 'west', 'center', 'north', 'south'];
|
var layoutClasses = ['east', 'west', 'center', 'north', 'south'];
|
||||||
var elemClasses = contentEl.attr('class');
|
var elemClasses = contentEl.attr('class');
|
||||||
|
|
||||||
var origLayoutClasses = $.grep(
|
var origLayoutClasses = [];
|
||||||
elemClasses.split(' '),
|
if(elemClasses) {
|
||||||
function(val) {
|
origLayoutClasses = $.grep(
|
||||||
return ($.inArray(val, layoutClasses) >= 0);
|
elemClasses.split(' '),
|
||||||
}
|
function(val) { return ($.inArray(val, layoutClasses) >= 0);}
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
newContentEl
|
newContentEl
|
||||||
.removeClass(layoutClasses.join(' '))
|
.removeClass(layoutClasses.join(' '))
|
||||||
@ -233,12 +251,13 @@ jQuery.noConflict();
|
|||||||
newContentEl.css('visibility', 'visible');
|
newContentEl.css('visibility', 'visible');
|
||||||
newContentEl.removeClass('loading');
|
newContentEl.removeClass('loading');
|
||||||
|
|
||||||
// Simulates a redirect on an ajax response - just exchange the URL without re-requesting it
|
// Simulates a redirect on an ajax response - just exchange the URL without re-requesting it.
|
||||||
if(window.History.enabled) {
|
// Causes non-pushState browser to re-request the URL, so ignore for those.
|
||||||
|
if(window.History.enabled && !History.emulated.pushState) {
|
||||||
var url = xhr.getResponseHeader('X-ControllerURL');
|
var url = xhr.getResponseHeader('X-ControllerURL');
|
||||||
if(url) window.history.replaceState({}, '', url);
|
if(url) window.History.replaceState({}, '', url);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.trigger('afterstatechange', {data: data, status: status, xhr: xhr, element: newContentEl});
|
self.trigger('afterstatechange', {data: data, status: status, xhr: xhr, element: newContentEl});
|
||||||
},
|
},
|
||||||
error: function(xhr, status, e) {
|
error: function(xhr, status, e) {
|
||||||
@ -452,8 +471,8 @@ jQuery.noConflict();
|
|||||||
// Explicitly disable default placeholder if no custom one is defined
|
// Explicitly disable default placeholder if no custom one is defined
|
||||||
if(!this.data('placeholder')) this.data('placeholder', ' ');
|
if(!this.data('placeholder')) this.data('placeholder', ' ');
|
||||||
|
|
||||||
// Apply chosen
|
// Apply Chosen
|
||||||
this.chosen().addClass("has-chzn");
|
applyChosen(this);
|
||||||
|
|
||||||
this._super();
|
this._super();
|
||||||
}
|
}
|
||||||
@ -538,4 +557,4 @@ var statusMessage = function(text, type) {
|
|||||||
|
|
||||||
var errorMessage = function(text) {
|
var errorMessage = function(text) {
|
||||||
jQuery.noticeAdd({text: text, type: 'error'});
|
jQuery.noticeAdd({text: text, type: 'error'});
|
||||||
};
|
};
|
||||||
|
@ -4,6 +4,13 @@
|
|||||||
|
|
||||||
(function($) {
|
(function($) {
|
||||||
$.entwine('ss', function($){
|
$.entwine('ss', function($){
|
||||||
|
$('#cms-content-tools #Form_SearchForm').entwine({
|
||||||
|
onsubmit: function(e) {
|
||||||
|
//We need to trigger handleStateChange() explicitly, otherwise handleStageChange()
|
||||||
|
//doesn't called if landing from another section of cms
|
||||||
|
this.trigger('beforeSubmit');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class: .importSpec
|
* Class: .importSpec
|
||||||
@ -21,6 +28,5 @@
|
|||||||
this._super();
|
this._super();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
})(jQuery);
|
})(jQuery);
|
@ -232,8 +232,4 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
$.path = path;
|
$.path = path;
|
||||||
|
|
||||||
// Internal Helper
|
|
||||||
$.expr[':'].internal = function(obj){return obj.href.match(/^mailto\:/) || (obj.hostname == location.hostname);};
|
|
||||||
$.expr[':'].external = function(obj){return !$(obj).is(':internal')};
|
|
||||||
}(jQuery));
|
}(jQuery));
|
@ -275,7 +275,7 @@ form.small .field, .field.small {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.ss-ui-button {
|
.ss-ui-button {
|
||||||
|
margin-top:0px;
|
||||||
&.buttonset {
|
&.buttonset {
|
||||||
margin: 0 -1px; // hack to avoid double borders
|
margin: 0 -1px; // hack to avoid double borders
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ body.cms {
|
|||||||
float:left;
|
float:left;
|
||||||
margin-top:$grid-x - 1;
|
margin-top:$grid-x - 1;
|
||||||
span.btn-icon-back {
|
span.btn-icon-back {
|
||||||
height:15px;
|
height:16px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ body.cms {
|
|||||||
a {
|
a {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
line-height: $grid-y * 2;
|
line-height: $grid-y * 2;
|
||||||
padding: ($grid-y * 2 - 4) ($grid-x * 2 + 4) $grid-y + 3;
|
padding: $grid-y*1.5 $grid-x*2.5 $grid-y*1.5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,6 +147,7 @@ body.cms {
|
|||||||
border: {
|
border: {
|
||||||
top:none;
|
top:none;
|
||||||
}
|
}
|
||||||
|
padding-bottom:0px;
|
||||||
}
|
}
|
||||||
.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr {
|
.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr {
|
||||||
border-radius:0;
|
border-radius:0;
|
||||||
@ -407,6 +408,20 @@ body.cms {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.cms-add-form {
|
.cms-add-form {
|
||||||
|
.step-label {
|
||||||
|
.flyout {
|
||||||
|
height:17px; //centres number within the grey arrow
|
||||||
|
padding-top:5px;
|
||||||
|
}
|
||||||
|
.title {
|
||||||
|
padding-top:5px; //aligns label with point of arrow
|
||||||
|
font-weight:bold; //to match pagetype label
|
||||||
|
@include text-shadow(1px 1px 0 $color-text-shadow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ul.SelectionGroup {
|
||||||
|
padding-left:28px;
|
||||||
|
}
|
||||||
.parent-mode {
|
.parent-mode {
|
||||||
padding: $grid-x;
|
padding: $grid-x;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
@ -822,7 +837,37 @@ body.cms {
|
|||||||
* -------------------------------------------- */
|
* -------------------------------------------- */
|
||||||
|
|
||||||
form.member-profile-form {
|
form.member-profile-form {
|
||||||
|
padding: 0 $grid-x*2 0 0;
|
||||||
|
.ui-tabs-nav {
|
||||||
|
.ui-state-default,
|
||||||
|
.ui-widget-content .ui-state-default,
|
||||||
|
.ui-widget-header .ui-state-default {
|
||||||
|
border: {
|
||||||
|
top:none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Root_Permissions {
|
||||||
|
clear:both;
|
||||||
|
padding: $grid-x*2;
|
||||||
|
}
|
||||||
|
|
||||||
|
#Root_Main {
|
||||||
|
clear:both;
|
||||||
|
padding: $grid-x*2;
|
||||||
|
.cms-help-toggle {
|
||||||
|
text-indent: -9999em;
|
||||||
|
display: inline-block;
|
||||||
|
width: 20px;
|
||||||
|
background:url(../images/question.png) no-repeat 0px 0px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#FavouritePageID {
|
||||||
|
margin-top:$grid-y;
|
||||||
|
}
|
||||||
|
|
||||||
#CsvFile .middleColumn {
|
#CsvFile .middleColumn {
|
||||||
background: none !important;
|
background: none !important;
|
||||||
}
|
}
|
||||||
@ -888,13 +933,13 @@ form.member-profile-form {
|
|||||||
li {
|
li {
|
||||||
margin:0 0 -1px 0;
|
margin:0 0 -1px 0;
|
||||||
}
|
}
|
||||||
}
|
.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr {
|
||||||
.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr {
|
border-radius:0;
|
||||||
border-radius:0;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl {
|
.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl {
|
||||||
border-radius:0;
|
border-radius:0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -907,17 +952,32 @@ form.member-profile-form {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.cms-content-fields {
|
.cms-content-fields {
|
||||||
/* always show a y scroll bar as popups like TreeDropdowns
|
// always show a y scroll bar as popups like TreeDropdowns
|
||||||
can trigger longer pages and the extra scroll bar doesn't
|
// can trigger longer pages and the extra scroll bar doesn't fire our sizing bar
|
||||||
fire our sizing bar */
|
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
background: none;
|
background: none;
|
||||||
width:100%;
|
width:100%;
|
||||||
.aligned-right-label {
|
#Root_Main {
|
||||||
margin-left:$grid-x*23;
|
.confirmedpassword {
|
||||||
padding:$grid-x 0;
|
border-bottom:none;
|
||||||
|
box-shadow:none;
|
||||||
|
}
|
||||||
|
.customFormat {
|
||||||
|
max-width:80px;
|
||||||
|
}
|
||||||
|
.cms-help-toggle {
|
||||||
|
text-indent: -9999em;
|
||||||
|
display: inline-block;
|
||||||
|
width: 20px;
|
||||||
|
background:url(../images/question.png) no-repeat 0px 0px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
#Root_Permissions{
|
||||||
|
ul.optionset li {
|
||||||
|
float:none;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1092,6 +1152,10 @@ form.member-profile-form {
|
|||||||
background-image: none;
|
background-image: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cms .ui-dialog .ss-ui-dialog.ui-dialog-content {
|
||||||
|
padding-top: 0px; //removes padding so that tabs are flush with header
|
||||||
|
}
|
||||||
|
|
||||||
// Elements with this class can either frame inline markup or an iframe,
|
// Elements with this class can either frame inline markup or an iframe,
|
||||||
// most styles should be applied to .cms-dialog instead (which declares the content in the frame)
|
// most styles should be applied to .cms-dialog instead (which declares the content in the frame)
|
||||||
.ui-dialog {
|
.ui-dialog {
|
||||||
@ -1147,8 +1211,9 @@ body.cms-dialog {
|
|||||||
background: none;
|
background: none;
|
||||||
|
|
||||||
.ui-tabs-nav {
|
.ui-tabs-nav {
|
||||||
padding: $grid-x 0 0 0;
|
|
||||||
border: none;
|
border: none;
|
||||||
|
padding: 0 $grid-x*5 0 0; //allows for 40px gap to the right of tabs to match the tabs on main CMS
|
||||||
|
float: right;
|
||||||
|
|
||||||
li {
|
li {
|
||||||
&.ui-tabs-selected {
|
&.ui-tabs-selected {
|
||||||
@ -1391,5 +1456,14 @@ form.import-form {
|
|||||||
label.left {
|
label.left {
|
||||||
width: 250px;
|
width: 250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** --------------------------------------------
|
||||||
|
* Page Edit Controller
|
||||||
|
* -------------------------------------------- */
|
||||||
|
|
||||||
|
.cms-container .CMSMain.CMSPageEditController {
|
||||||
|
// Fix pixel gap between nav tree and main page header
|
||||||
|
margin-left:-1px;
|
||||||
|
}
|
||||||
|
@ -24,8 +24,14 @@
|
|||||||
min-height: 18px;
|
min-height: 18px;
|
||||||
line-height: 18px;
|
line-height: 18px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
margin-left: 18px;
|
|
||||||
min-width: 18px;
|
min-width: 18px;
|
||||||
|
|
||||||
|
li {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
li li {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ins {
|
ins {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@ -240,7 +246,7 @@
|
|||||||
}
|
}
|
||||||
li.jstree-open > ul {
|
li.jstree-open > ul {
|
||||||
display: block;
|
display: block;
|
||||||
margin-left:-13px;
|
|
||||||
li ul {
|
li ul {
|
||||||
margin-left:2px;
|
margin-left:2px;
|
||||||
}
|
}
|
||||||
@ -535,11 +541,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
& .jstree-closed > ins {
|
& .jstree-closed > ins {
|
||||||
background-position:0 0;
|
background-position:0 0;
|
||||||
|
cursor:pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
& .jstree-open > ins {
|
& .jstree-open > ins {
|
||||||
background-position:-20px 0;
|
background-position:-20px 0;
|
||||||
|
cursor:pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,10 +68,16 @@ html {
|
|||||||
text-indent: 0px !important;
|
text-indent: 0px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
//fix for filter and reset icons on datagrid
|
.cms table.ss-gridfield-table {
|
||||||
|
tbody td {
|
||||||
.cms table.ss-gridfield-table tr th.extra span input {
|
// Overrule width: 100% setting to trigger "shrink fit"
|
||||||
height:23px;
|
// of button row, which IE7 doesn't support
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
tr th.extra span input {
|
||||||
|
//fix for filter and reset icons on datagrid
|
||||||
|
height:23px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.ss-gridfield-button-filter.ss-ui-button {
|
.ss-gridfield-button-filter.ss-ui-button {
|
||||||
|
@ -7,69 +7,69 @@
|
|||||||
/** -----------------------------------------------
|
/** -----------------------------------------------
|
||||||
* Colours
|
* Colours
|
||||||
* ------------------------------------------------ */
|
* ------------------------------------------------ */
|
||||||
$color-base: #b0bec7;
|
$color-base: #b0bec7 !default;
|
||||||
$color-widget-bg: lighten($color-base, 20%);
|
$color-widget-bg: lighten($color-base, 20%) !default;
|
||||||
|
|
||||||
$color-dark-bg: #003050;
|
$color-dark-bg: #003050 !default;
|
||||||
$color-dark-separator: #19435c;
|
$color-dark-separator: #19435c !default;
|
||||||
$color-medium-separator: #808080;
|
$color-medium-separator: #808080 !default;
|
||||||
$color-light-separator: rgba(201, 205, 206, 0.8);
|
$color-light-separator: rgba(201, 205, 206, 0.8) !default;
|
||||||
|
|
||||||
$color-tab: #d9d9d9;
|
$color-tab: #d9d9d9 !default;
|
||||||
$color-dark-grey: #7B8C91;
|
$color-dark-grey: #7B8C91 !default;
|
||||||
|
|
||||||
$color-shadow-light: rgba(201, 205, 206, 0.8);
|
$color-shadow-light: rgba(201, 205, 206, 0.8) !default;
|
||||||
$color-shadow-dark: rgba(107, 120, 123, 0.5);
|
$color-shadow-dark: rgba(107, 120, 123, 0.5) !default;
|
||||||
|
|
||||||
$color-highlight: #FFFF66;
|
$color-highlight: #FFFF66 !default;
|
||||||
$color-highlight-opacity: rgba(255, 255, 102, 0.3);
|
$color-highlight-opacity: rgba(255, 255, 102, 0.3) !default;
|
||||||
|
|
||||||
$color-menu-button: #338DC1;
|
$color-menu-button: #338DC1 !default;
|
||||||
$color-menu-background: #c6d7df;
|
$color-menu-background: #c6d7df !default;
|
||||||
$color-menu-border: #8c99a1;
|
$color-menu-border: #8c99a1 !default;
|
||||||
|
|
||||||
$color-text: #444;
|
$color-text: #444 !default;
|
||||||
$color-text-light: white;
|
$color-text-light: white !default;
|
||||||
$color-text-light-link: white;
|
$color-text-light-link: white !default;
|
||||||
$color-text-disabled: #aaa;
|
$color-text-disabled: #aaa !default;
|
||||||
$color-text-dark: #1f1f1f;
|
$color-text-dark: #1f1f1f !default;
|
||||||
$color-text-dark-link: #3EBAE0;
|
$color-text-dark-link: #3EBAE0 !default;
|
||||||
$color-text-blue-link:#1556B2;
|
$color-text-blue-link:#1556B2 !default;
|
||||||
$color-text-shadow: white;
|
$color-text-shadow: white !default;
|
||||||
|
|
||||||
|
|
||||||
$color-button-generic: #e6e6e6;
|
$color-button-generic: #e6e6e6 !default;
|
||||||
$color-button-generic-border: #c0c0c2;
|
$color-button-generic-border: #c0c0c2 !default;
|
||||||
|
|
||||||
$color-button-highlight: #e6e6e6;
|
$color-button-highlight: #e6e6e6 !default;
|
||||||
$color-button-highlight-border: #708284;
|
$color-button-highlight-border: #708284 !default;
|
||||||
|
|
||||||
$color-button-constructive: #669933;
|
$color-button-constructive: #669933 !default;
|
||||||
$color-button-constructive-border: #78a127;
|
$color-button-constructive-border: #78a127 !default;
|
||||||
|
|
||||||
$color-button-destructive: #f00;
|
$color-button-destructive: #f00 !default;
|
||||||
|
|
||||||
$color-button-disabled: #eeeded;
|
$color-button-disabled: #eeeded !default;
|
||||||
|
|
||||||
$color-warning: #FF9300;
|
$color-warning: #FF9300 !default;
|
||||||
$color-error: #FF9300;
|
$color-error: #FF9300 !default;
|
||||||
$color-notice: #FF9300;
|
$color-notice: #FF9300 !default;
|
||||||
$color-good: $color-button-constructive;
|
$color-good: $color-button-constructive !default;
|
||||||
|
|
||||||
$color-cms-batchactions-menu-background: #f5f5f5;
|
$color-cms-batchactions-menu-background: #f5f5f5 !default;
|
||||||
$color-cms-batchactions-menu-selected-background: #efe999;
|
$color-cms-batchactions-menu-selected-background: #efe999 !default;
|
||||||
|
|
||||||
/** -----------------------------------------------
|
/** -----------------------------------------------
|
||||||
* Textures
|
* Textures
|
||||||
* ----------------------------------------------- */
|
* ----------------------------------------------- */
|
||||||
$tab-panel-texture-color: #f0f3f4;
|
$tab-panel-texture-color: #f0f3f4 !default;
|
||||||
$tab-panel-texture-background: $tab-panel-texture-color url(../images/textures/bg_cms_main_content.png) repeat top left;
|
$tab-panel-texture-background: $tab-panel-texture-color url(../images/textures/bg_cms_main_content.png) repeat top left !default;
|
||||||
|
|
||||||
/** -----------------------------------------------
|
/** -----------------------------------------------
|
||||||
* Typography.
|
* Typography.
|
||||||
* ------------------------------------------------ */
|
* ------------------------------------------------ */
|
||||||
$font-family: Arial, sans-serif;
|
$font-family: Arial, sans-serif !default;
|
||||||
$font-base-size: 12px;
|
$font-base-size: 12px !default;
|
||||||
|
|
||||||
/** -----------------------------------------------
|
/** -----------------------------------------------
|
||||||
* Grid Units (px)
|
* Grid Units (px)
|
||||||
@ -78,10 +78,10 @@ $font-base-size: 12px;
|
|||||||
* both x (=horizontal) and y (=vertical). All internal padding and
|
* both x (=horizontal) and y (=vertical). All internal padding and
|
||||||
* margins are scaled to this and accounting for paragraphs
|
* margins are scaled to this and accounting for paragraphs
|
||||||
* ------------------------------------------------ */
|
* ------------------------------------------------ */
|
||||||
$grid-y: 8px;
|
$grid-y: 8px !default;
|
||||||
$grid-x: 8px;
|
$grid-x: 8px !default;
|
||||||
|
|
||||||
/** -----------------------------------------------
|
/** -----------------------------------------------
|
||||||
* Application Logo (CMS Logo) Must be 24px x 24px
|
* Application Logo (CMS Logo) Must be 24px x 24px
|
||||||
* ------------------------------------------------ */
|
* ------------------------------------------------ */
|
||||||
$application-logo-small: url("../images/logo_small.png");
|
$application-logo-small: url("../images/logo_small.png") !default;
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li class="last <% if Top.class == 'CMSPageAddController' %>current<% end_if %>" id="Menu-CMSPageAddController">
|
<li class="last <% if Top.class == 'CMSPageAddController' %>current<% end_if %>" id="Menu-CMSPageAddController">
|
||||||
<a href="admin/page/add/?ParentID=$Top.CurrentPageID">
|
<a href="admin/page/add/?ParentID=$Top.CurrentPageID">
|
||||||
<span class="text">Add pages</span>
|
<span class="text">Add page</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
2
admin/thirdparty/chosen/.piston.yml
vendored
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
format: 1
|
format: 1
|
||||||
handler:
|
handler:
|
||||||
commit: 880a30dcb49555996a875cf4474999a2341aa055
|
commit: f584bc49d6de7cf68475c3e51baa4cf2008a130e
|
||||||
branch: master
|
branch: master
|
||||||
lock: false
|
lock: false
|
||||||
repository_class: Piston::Git::Repository
|
repository_class: Piston::Git::Repository
|
||||||
|
2
admin/thirdparty/chosen/VERSION
vendored
@ -1 +1 @@
|
|||||||
0.9.7
|
0.9.8
|
||||||
|
BIN
admin/thirdparty/chosen/chosen/chosen-sprite.png
vendored
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 559 B |
7
admin/thirdparty/chosen/chosen/chosen.css
vendored
@ -51,6 +51,9 @@
|
|||||||
color: #444444;
|
color: #444444;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
.chzn-container-single .chzn-default {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
.chzn-container-single .chzn-single span {
|
.chzn-container-single .chzn-single span {
|
||||||
margin-right: 26px;
|
margin-right: 26px;
|
||||||
display: block;
|
display: block;
|
||||||
@ -68,7 +71,7 @@
|
|||||||
width: 12px;
|
width: 12px;
|
||||||
height: 13px;
|
height: 13px;
|
||||||
font-size: 1px;
|
font-size: 1px;
|
||||||
background: url(chosen-sprite.png) right top no-repeat;
|
background: url('chosen-sprite.png') right top no-repeat;
|
||||||
}
|
}
|
||||||
.chzn-container-single .chzn-single abbr:hover {
|
.chzn-container-single .chzn-single abbr:hover {
|
||||||
background-position: right -11px;
|
background-position: right -11px;
|
||||||
@ -206,7 +209,7 @@
|
|||||||
width: 12px;
|
width: 12px;
|
||||||
height: 13px;
|
height: 13px;
|
||||||
font-size: 1px;
|
font-size: 1px;
|
||||||
background: url(chosen-sprite.png) right top no-repeat;
|
background: url('chosen-sprite.png') right top no-repeat;
|
||||||
}
|
}
|
||||||
.chzn-container-multi .chzn-choices .search-choice .search-choice-close:hover {
|
.chzn-container-multi .chzn-choices .search-choice .search-choice-close:hover {
|
||||||
background-position: right -11px;
|
background-position: right -11px;
|
||||||
|
35
admin/thirdparty/chosen/chosen/chosen.jquery.js
vendored
@ -1,5 +1,15 @@
|
|||||||
//based on version 0.9.7 and applied a very simple patch that fix percentaage width support on select tag
|
// Chosen, a Select Box Enhancer for jQuery and Protoype
|
||||||
//the patch has been documented https://github.com/harvesthq/chosen/issues/300.
|
// by Patrick Filler for Harvest, http://getharvest.com
|
||||||
|
//
|
||||||
|
// Version 0.9.8
|
||||||
|
// Full source at https://github.com/harvesthq/chosen
|
||||||
|
// Copyright (c) 2011 Harvest http://getharvest.com
|
||||||
|
|
||||||
|
// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
||||||
|
// This file is generated by `cake build`, do not edit it by hand.
|
||||||
|
|
||||||
|
// based on version 0.9.7, applied a very simple patch that fix percentaage width support on select tag
|
||||||
|
// the patch has been documented https://github.com/harvesthq/chosen/issues/300.
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var SelectParser;
|
var SelectParser;
|
||||||
@ -123,6 +133,7 @@ Copyright (c) 2011 by Harvest
|
|||||||
this.result_single_selected = null;
|
this.result_single_selected = null;
|
||||||
this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
|
this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
|
||||||
this.disable_search_threshold = this.options.disable_search_threshold || 0;
|
this.disable_search_threshold = this.options.disable_search_threshold || 0;
|
||||||
|
this.search_contains = this.options.search_contains || false;
|
||||||
this.choices = 0;
|
this.choices = 0;
|
||||||
return this.results_none_found = this.options.no_results_text || "No results match";
|
return this.results_none_found = this.options.no_results_text || "No results match";
|
||||||
};
|
};
|
||||||
@ -303,7 +314,7 @@ Copyright (c) 2011 by Harvest
|
|||||||
if (this.is_multiple) {
|
if (this.is_multiple) {
|
||||||
container_div.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');
|
container_div.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');
|
||||||
} else {
|
} else {
|
||||||
container_div.html('<a href="javascript:void(0)" class="chzn-single"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>');
|
container_div.html('<a href="javascript:void(0)" class="chzn-single chzn-default"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>');
|
||||||
}
|
}
|
||||||
this.form_field_jq.hide().after(container_div);
|
this.form_field_jq.hide().after(container_div);
|
||||||
this.container = $('#' + this.container_id);
|
this.container = $('#' + this.container_id);
|
||||||
@ -411,7 +422,9 @@ Copyright (c) 2011 by Harvest
|
|||||||
var target_closelink;
|
var target_closelink;
|
||||||
if (!this.is_disabled) {
|
if (!this.is_disabled) {
|
||||||
target_closelink = evt != null ? ($(evt.target)).hasClass("search-choice-close") : false;
|
target_closelink = evt != null ? ($(evt.target)).hasClass("search-choice-close") : false;
|
||||||
if (evt && evt.type === "mousedown") evt.stopPropagation();
|
if (evt && evt.type === "mousedown" && !this.results_showing) {
|
||||||
|
evt.stopPropagation();
|
||||||
|
}
|
||||||
if (!this.pending_destroy_click && !target_closelink) {
|
if (!this.pending_destroy_click && !target_closelink) {
|
||||||
if (!this.active_field) {
|
if (!this.active_field) {
|
||||||
if (this.is_multiple) this.search_field.val("");
|
if (this.is_multiple) this.search_field.val("");
|
||||||
@ -498,7 +511,7 @@ Copyright (c) 2011 by Harvest
|
|||||||
if (data.selected && this.is_multiple) {
|
if (data.selected && this.is_multiple) {
|
||||||
this.choice_build(data);
|
this.choice_build(data);
|
||||||
} else if (data.selected && !this.is_multiple) {
|
} else if (data.selected && !this.is_multiple) {
|
||||||
this.selected_item.find("span").text(data.text);
|
this.selected_item.removeClass("chzn-default").find("span").text(data.text);
|
||||||
if (this.allow_single_deselect) this.single_deselect_control_build();
|
if (this.allow_single_deselect) this.single_deselect_control_build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -544,7 +557,8 @@ Copyright (c) 2011 by Harvest
|
|||||||
};
|
};
|
||||||
|
|
||||||
Chosen.prototype.results_show = function() {
|
Chosen.prototype.results_show = function() {
|
||||||
var dd_top;
|
//patch applied: https://github.com/harvesthq/chosen/issues/300, add variable declaration dd_width
|
||||||
|
var dd_top, dd_width;
|
||||||
if (!this.is_multiple) {
|
if (!this.is_multiple) {
|
||||||
this.selected_item.addClass("chzn-single-with-drop");
|
this.selected_item.addClass("chzn-single-with-drop");
|
||||||
if (this.result_single_selected) {
|
if (this.result_single_selected) {
|
||||||
@ -552,6 +566,8 @@ Copyright (c) 2011 by Harvest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dd_top = this.is_multiple ? this.container.height() : this.container.height() - 1;
|
dd_top = this.is_multiple ? this.container.height() : this.container.height() - 1;
|
||||||
|
//patch applied: https://github.com/harvesthq/chosen/issues/300, add variable assignment dd_width
|
||||||
|
dd_width = this.container.width() - get_side_border_padding(this.dropdown);
|
||||||
this.dropdown.css({
|
this.dropdown.css({
|
||||||
"top": dd_top + "px",
|
"top": dd_top + "px",
|
||||||
"left": 0
|
"left": 0
|
||||||
@ -662,6 +678,7 @@ Copyright (c) 2011 by Harvest
|
|||||||
Chosen.prototype.results_reset = function(evt) {
|
Chosen.prototype.results_reset = function(evt) {
|
||||||
this.form_field.options[0].selected = true;
|
this.form_field.options[0].selected = true;
|
||||||
this.selected_item.find("span").text(this.default_text);
|
this.selected_item.find("span").text(this.default_text);
|
||||||
|
if (!this.is_multiple) this.selected_item.addClass("chzn-default");
|
||||||
this.show_search_field_default();
|
this.show_search_field_default();
|
||||||
$(evt.target).remove();
|
$(evt.target).remove();
|
||||||
this.form_field_jq.trigger("change");
|
this.form_field_jq.trigger("change");
|
||||||
@ -679,6 +696,7 @@ Copyright (c) 2011 by Harvest
|
|||||||
} else {
|
} else {
|
||||||
this.search_results.find(".result-selected").removeClass("result-selected");
|
this.search_results.find(".result-selected").removeClass("result-selected");
|
||||||
this.result_single_selected = high;
|
this.result_single_selected = high;
|
||||||
|
this.selected_item.removeClass("chzn-default");
|
||||||
}
|
}
|
||||||
high.addClass("result-selected");
|
high.addClass("result-selected");
|
||||||
position = high_id.substr(high_id.lastIndexOf("_") + 1);
|
position = high_id.substr(high_id.lastIndexOf("_") + 1);
|
||||||
@ -726,11 +744,12 @@ Copyright (c) 2011 by Harvest
|
|||||||
};
|
};
|
||||||
|
|
||||||
Chosen.prototype.winnow_results = function() {
|
Chosen.prototype.winnow_results = function() {
|
||||||
var found, option, part, parts, regex, result, result_id, results, searchText, startpos, text, zregex, _i, _j, _len, _len2, _ref;
|
var found, option, part, parts, regex, regexAnchor, result, result_id, results, searchText, startpos, text, zregex, _i, _j, _len, _len2, _ref;
|
||||||
this.no_results_clear();
|
this.no_results_clear();
|
||||||
results = 0;
|
results = 0;
|
||||||
searchText = this.search_field.val() === this.default_text ? "" : $('<div/>').text($.trim(this.search_field.val())).html();
|
searchText = this.search_field.val() === this.default_text ? "" : $('<div/>').text($.trim(this.search_field.val())).html();
|
||||||
regex = new RegExp('^' + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
|
regexAnchor = this.search_contains ? "" : "^";
|
||||||
|
regex = new RegExp(regexAnchor + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
|
||||||
zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
|
zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
|
||||||
_ref = this.results_data;
|
_ref = this.results_data;
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
// Chosen, a Select Box Enhancer for jQuery and Protoype
|
// Chosen, a Select Box Enhancer for jQuery and Protoype
|
||||||
// by Patrick Filler for Harvest, http://getharvest.com
|
// by Patrick Filler for Harvest, http://getharvest.com
|
||||||
//
|
//
|
||||||
// Version 0.9.7
|
// Version 0.9.8
|
||||||
// Full source at https://github.com/harvesthq/chosen
|
// Full source at https://github.com/harvesthq/chosen
|
||||||
// Copyright (c) 2011 Harvest http://getharvest.com
|
// Copyright (c) 2011 Harvest http://getharvest.com
|
||||||
|
|
||||||
// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
||||||
// This file is generated by `cake build`, do not edit it by hand.
|
// This file is generated by `cake build`, do not edit it by hand.
|
||||||
((function(){var a;a=function(){function a(){this.options_index=0,this.parsed=[]}return a.prototype.add_node=function(a){return a.nodeName==="OPTGROUP"?this.add_group(a):this.add_option(a)},a.prototype.add_group=function(a){var b,c,d,e,f,g;b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:a.label,children:0,disabled:a.disabled}),f=a.childNodes,g=[];for(d=0,e=f.length;d<e;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},a.prototype.add_option=function(a,b,c){if(a.nodeName==="OPTION")return a.text!==""?(b!=null&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},a}(),a.select_to_array=function(b){var c,d,e,f,g;d=new a,g=b.childNodes;for(e=0,f=g.length;e<f;e++)c=g[e],d.add_node(c);return d.parsed},this.SelectParser=a})).call(this),function(){var a,b;b=this,a=function(){function a(a,b){this.form_field=a,this.options=b!=null?b:{},this.set_default_values(),this.is_multiple=this.form_field.multiple,this.default_text_default=this.is_multiple?"Select Some Options":"Select an Option",this.setup(),this.set_up_html(),this.register_observers(),this.finish_setup()}return a.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=this.options.allow_single_deselect!=null&&this.form_field.options[0]!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.choices=0,this.results_none_found=this.options.no_results_text||"No results match"},a.prototype.mouse_enter=function(){return this.mouse_on_container=!0},a.prototype.mouse_leave=function(){return this.mouse_on_container=!1},a.prototype.input_focus=function(a){var b=this;if(!this.active_field)return setTimeout(function(){return b.container_mousedown()},50)},a.prototype.input_blur=function(a){var b=this;if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(){return b.blur_test()},100)},a.prototype.result_add_option=function(a){var b,c;return a.disabled?"":(a.dom_id=this.container_id+"_o_"+a.array_index,b=a.selected&&this.is_multiple?[]:["active-result"],a.selected&&b.push("result-selected"),a.group_array_index!=null&&b.push("group-option"),a.classes!==""&&b.push(a.classes),c=a.style.cssText!==""?' style="'+a.style+'"':"",'<li id="'+a.dom_id+'" class="'+b.join(" ")+'"'+c+">"+a.html+"</li>")},a.prototype.results_update_field=function(){return this.result_clear_highlight(),this.result_single_selected=null,this.results_build()},a.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},a.prototype.results_search=function(a){return this.results_showing?this.winnow_results():this.results_show()},a.prototype.keyup_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale();switch(b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:a.preventDefault();if(this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},a.prototype.generate_field_id=function(){var a;return a=this.generate_random_id(),this.form_field.id=a,a},a.prototype.generate_random_char=function(){var a,b,c;return a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ",c=Math.floor(Math.random()*a.length),b=a.substring(c,c+1)},a}(),b.AbstractChosen=a}.call(this),function(){var a,b,c,d,e=Object.prototype.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};d=this,a=jQuery,a.fn.extend({chosen:function(c){return!a.browser.msie||a.browser.version!=="6.0"&&a.browser.version!=="7.0"?a(this).each(function(d){if(!a(this).hasClass("chzn-done"))return new b(this,c)}):this}}),b=function(b){function e(){e.__super__.constructor.apply(this,arguments)}return f(e,b),e.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.is_rtl=this.form_field_jq.hasClass("chzn-rtl")},e.prototype.finish_setup=function(){return this.form_field_jq.addClass("chzn-done")},e.prototype.set_up_html=function(){var b,d,e,f;return this.container_id=this.form_field.id.length?this.form_field.id.replace(/(:|\.)/g,"_"):this.generate_field_id(),this.container_id+="_chzn",this.f_width=this.form_field_jq.outerWidth(),this.default_text=this.form_field_jq.data("placeholder")?this.form_field_jq.data("placeholder"):this.default_text_default,b=a("<div />",{id:this.container_id,"class":"chzn-container"+(this.is_rtl?" chzn-rtl":""),style:"width: "+this.f_width+"px;"}),this.is_multiple?b.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'):b.html('<a href="javascript:void(0)" class="chzn-single"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'),this.form_field_jq.hide().after(b),this.container=a("#"+this.container_id),this.container.addClass("chzn-container-"+(this.is_multiple?"multi":"single")),this.dropdown=this.container.find("div.chzn-drop").first(),d=this.container.height(),e=this.f_width-c(this.dropdown),this.dropdown.css({width:e+"px",top:d+"px"}),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chzn-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chzn-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chzn-search").first(),this.selected_item=this.container.find(".chzn-single").first(),f=e-c(this.search_container)-c(this.search_field),this.search_field.css({width:f+"px"})),this.results_build(),this.set_tab_index(),this.form_field_jq.trigger("liszt:ready",{chosen:this})},e.prototype.register_observers=function(){var a=this;return this.container.mousedown(function(b){return a.container_mousedown(b)}),this.container.mouseup(function(b){return a.container_mouseup(b)}),this.container.mouseenter(function(b){return a.mouse_enter(b)}),this.container.mouseleave(function(b){return a.mouse_leave(b)}),this.search_results.mouseup(function(b){return a.search_results_mouseup(b)}),this.search_results.mouseover(function(b){return a.search_results_mouseover(b)}),this.search_results.mouseout(function(b){return a.search_results_mouseout(b)}),this.form_field_jq.bind("liszt:updated",function(b){return a.results_update_field(b)}),this.search_field.blur(function(b){return a.input_blur(b)}),this.search_field.keyup(function(b){return a.keyup_checker(b)}),this.search_field.keydown(function(b){return a.keydown_checker(b)}),this.is_multiple?(this.search_choices.click(function(b){return a.choices_click(b)}),this.search_field.focus(function(b){return a.input_focus(b)})):this.container.click(function(a){return a.preventDefault()})},e.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq[0].disabled;if(this.is_disabled)return this.container.addClass("chzn-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus",this.activate_action),this.close_field();this.container.removeClass("chzn-disabled"),this.search_field[0].disabled=!1;if(!this.is_multiple)return this.selected_item.bind("focus",this.activate_action)},e.prototype.container_mousedown=function(b){var c;if(!this.is_disabled)return c=b!=null?a(b.target).hasClass("search-choice-close"):!1,b&&b.type==="mousedown"&&b.stopPropagation(),!this.pending_destroy_click&&!c?(this.active_field?!this.is_multiple&&b&&(a(b.target)[0]===this.selected_item[0]||a(b.target).parents("a.chzn-single").length)&&(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(document).click(this.click_test_action),this.results_show()),this.activate_field()):this.pending_destroy_click=!1},e.prototype.container_mouseup=function(a){if(a.target.nodeName==="ABBR")return this.results_reset(a)},e.prototype.blur_test=function(a){if(!this.active_field&&this.container.hasClass("chzn-container-active"))return this.close_field()},e.prototype.close_field=function(){return a(document).unbind("click",this.click_test_action),this.is_multiple||(this.selected_item.attr("tabindex",this.search_field.attr("tabindex")),this.search_field.attr("tabindex",-1)),this.active_field=!1,this.results_hide(),this.container.removeClass("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},e.prototype.activate_field=function(){return!this.is_multiple&&!this.active_field&&(this.search_field.attr("tabindex",this.selected_item.attr("tabindex")),this.selected_item.attr("tabindex",-1)),this.container.addClass("chzn-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},e.prototype.test_active_click=function(b){return a(b.target).parents("#"+this.container_id).length?this.active_field=!0:this.close_field()},e.prototype.results_build=function(){var a,b,c,e,f;this.parsing=!0,this.results_data=d.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.find("li.search-choice").remove(),this.choices=0):this.is_multiple||(this.selected_item.find("span").text(this.default_text),this.form_field.options.length<=this.disable_search_threshold?this.container.addClass("chzn-container-single-nosearch"):this.container.removeClass("chzn-container-single-nosearch")),a="",f=this.results_data;for(c=0,e=f.length;c<e;c++)b=f[c],b.group?a+=this.result_add_group(b):b.empty||(a+=this.result_add_option(b),b.selected&&this.is_multiple?this.choice_build(b):b.selected&&!this.is_multiple&&(this.selected_item.find("span").text(b.text),this.allow_single_deselect&&this.single_deselect_control_build()));return this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.search_results.html(a),this.parsing=!1},e.prototype.result_add_group=function(b){return b.disabled?"":(b.dom_id=this.container_id+"_g_"+b.array_index,'<li id="'+b.dom_id+'" class="group-result">'+a("<div />").text(b.label).html()+"</li>")},e.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight();if(b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(c<f)return this.search_results.scrollTop(c)}},e.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},e.prototype.results_show=function(){var a;return this.is_multiple||(this.selected_item.addClass("chzn-single-with-drop"),this.result_single_selected&&this.result_do_highlight(this.result_single_selected)),a=this.is_multiple?this.container.height():this.container.height()-1,this.dropdown.css({top:a+"px",left:0}),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results()},e.prototype.results_hide=function(){return this.is_multiple||this.selected_item.removeClass("chzn-single-with-drop"),this.result_clear_highlight(),this.dropdown.css({left:"-9000px"}),this.results_showing=!1},e.prototype.set_tab_index=function(a){var b;if(this.form_field_jq.attr("tabindex"))return b=this.form_field_jq.attr("tabindex"),this.form_field_jq.attr("tabindex",-1),this.is_multiple?this.search_field.attr("tabindex",b):(this.selected_item.attr("tabindex",b),this.search_field.attr("tabindex",-1))},e.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},e.prototype.search_results_mouseup=function(b){var c;c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first();if(c.length)return this.result_highlight=c,this.result_select(b)},e.prototype.search_results_mouseover=function(b){var c;c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first();if(c)return this.result_do_highlight(c)},e.prototype.search_results_mouseout=function(b){if(a(b.target).hasClass("active-result"))return this.result_clear_highlight()},e.prototype.choices_click=function(b){b.preventDefault();if(this.active_field&&!a(b.target).hasClass("search-choice")&&!this.results_showing)return this.results_show()},e.prototype.choice_build=function(b){var c,d,e=this;return c=this.container_id+"_c_"+b.array_index,this.choices+=1,this.search_container.before('<li class="search-choice" id="'+c+'"><span>'+b.html+'</span><a href="javascript:void(0)" class="search-choice-close" rel="'+b.array_index+'"></a></li>'),d=a("#"+c).find("a").first(),d.click(function(a){return e.choice_destroy_link_click(a)})},e.prototype.choice_destroy_link_click=function(b){return b.preventDefault(),this.is_disabled?b.stopPropagation:(this.pending_destroy_click=!0,this.choice_destroy(a(b.target)))},e.prototype.choice_destroy=function(a){return this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.val().length<1&&this.results_hide(),this.result_deselect(a.attr("rel")),a.parents("li").first().remove()},e.prototype.results_reset=function(b){this.form_field.options[0].selected=!0,this.selected_item.find("span").text(this.default_text),this.show_search_field_default(),a(b.target).remove(),this.form_field_jq.trigger("change");if(this.active_field)return this.results_hide()},e.prototype.result_select=function(a){var b,c,d,e;if(this.result_highlight)return b=this.result_highlight,c=b.attr("id"),this.result_clear_highlight(),this.is_multiple?this.result_deactivate(b):(this.search_results.find(".result-selected").removeClass("result-selected"),this.result_single_selected=b),b.addClass("result-selected"),e=c.substr(c.lastIndexOf("_")+1),d=this.results_data[e],d.selected=!0,this.form_field.options[d.options_index].selected=!0,this.is_multiple?this.choice_build(d):(this.selected_item.find("span").first().text(d.text),this.allow_single_deselect&&this.single_deselect_control_build()),(!a.metaKey||!this.is_multiple)&&this.results_hide(),this.search_field.val(""),this.form_field_jq.trigger("change"),this.search_field_scale()},e.prototype.result_activate=function(a){return a.addClass("active-result")},e.prototype.result_deactivate=function(a){return a.removeClass("active-result")},e.prototype.result_deselect=function(b){var c,d;return d=this.results_data[b],d.selected=!1,this.form_field.options[d.options_index].selected=!1,c=a("#"+this.container_id+"_o_"+b),c.removeClass("result-selected").addClass("active-result").show(),this.result_clear_highlight(),this.winnow_results(),this.form_field_jq.trigger("change"),this.search_field_scale()},e.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&this.selected_item.find("abbr").length<1)return this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>')},e.prototype.winnow_results=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;this.no_results_clear(),i=0,j=this.search_field.val()===this.default_text?"":a("<div/>").text(a.trim(this.search_field.val())).html(),f=new RegExp("^"+j.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),m=new RegExp(j.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),r=this.results_data;for(n=0,p=r.length;n<p;n++){c=r[n];if(!c.disabled&&!c.empty)if(c.group)a("#"+c.dom_id).css("display","none");else if(!this.is_multiple||!c.selected){b=!1,h=c.dom_id,g=a("#"+h);if(f.test(c.html))b=!0,i+=1;else if(c.html.indexOf(" ")>=0||c.html.indexOf("[")===0){e=c.html.replace(/\[|\]/g,"").split(" ");if(e.length)for(o=0,q=e.length;o<q;o++)d=e[o],f.test(d)&&(b=!0,i+=1)}b?(j.length?(k=c.html.search(m),l=c.html.substr(0,k+j.length)+"</em>"+c.html.substr(k+j.length),l=l.substr(0,k)+"<em>"+l.substr(k)):l=c.html,g.html(l),this.result_activate(g),c.group_array_index!=null&&a("#"+this.results_data[c.group_array_index].dom_id).css("display","list-item")):(this.result_highlight&&h===this.result_highlight.attr("id")&&this.result_clear_highlight(),this.result_deactivate(g))}}return i<1&&j.length?this.no_results(j):this.winnow_results_set_highlight()},e.prototype.winnow_results_clear=function(){var b,c,d,e,f;this.search_field.val(""),c=this.search_results.find("li"),f=[];for(d=0,e=c.length;d<e;d++)b=c[d],b=a(b),b.hasClass("group-result")?f.push(b.css("display","auto")):!this.is_multiple||!b.hasClass("result-selected")?f.push(this.result_activate(b)):f.push(void 0);return f},e.prototype.winnow_results_set_highlight=function(){var a,b;if(!this.result_highlight){b=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),a=b.length?b.first():this.search_results.find(".active-result").first();if(a!=null)return this.result_do_highlight(a)}},e.prototype.no_results=function(b){var c;return c=a('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),c.find("span").first().html(b),this.search_results.append(c)},e.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},e.prototype.keydown_arrow=function(){var b,c;this.result_highlight?this.results_showing&&(c=this.result_highlight.nextAll("li.active-result").first(),c&&this.result_do_highlight(c)):(b=this.search_results.find("li.active-result").first(),b&&this.result_do_highlight(a(b)));if(!this.results_showing)return this.results_show()},e.prototype.keyup_arrow=function(){var a;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight)return a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices>0&&this.results_hide(),this.result_clear_highlight())},e.prototype.keydown_backstroke=function(){return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(this.pending_backstroke=this.search_container.siblings("li.search-choice").last(),this.pending_backstroke.addClass("search-choice-focus"))},e.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},e.prototype.keydown_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale(),b!==8&&this.pending_backstroke&&this.clear_backstroke();switch(b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},e.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(i=0,j=g.length;i<j;i++)e=g[i],f+=e+":"+this.search_field.css(e)+";";return c=a("<div />",{style:f}),c.text(this.search_field.val()),a("body").append(c),h=c.width()+25,c.remove(),h>this.f_width-10&&(h=this.f_width-10),this.search_field.css({width:h+"px"}),b=this.container.height(),this.dropdown.css({top:b+"px"})}},e.prototype.generate_random_id=function(){var b;b="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();while(a("#"+b).length>0)b+=this.generate_random_char();return b},e}(AbstractChosen),c=function(a){var b;return b=a.outerWidth()-a.width()},d.get_side_border_padding=c}.call(this)
|
((function(){var a;a=function(){function a(){this.options_index=0,this.parsed=[]}return a.prototype.add_node=function(a){return a.nodeName==="OPTGROUP"?this.add_group(a):this.add_option(a)},a.prototype.add_group=function(a){var b,c,d,e,f,g;b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:a.label,children:0,disabled:a.disabled}),f=a.childNodes,g=[];for(d=0,e=f.length;d<e;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},a.prototype.add_option=function(a,b,c){if(a.nodeName==="OPTION")return a.text!==""?(b!=null&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},a}(),a.select_to_array=function(b){var c,d,e,f,g;d=new a,g=b.childNodes;for(e=0,f=g.length;e<f;e++)c=g[e],d.add_node(c);return d.parsed},this.SelectParser=a})).call(this),function(){var a,b;b=this,a=function(){function a(a,b){this.form_field=a,this.options=b!=null?b:{},this.set_default_values(),this.is_multiple=this.form_field.multiple,this.default_text_default=this.is_multiple?"Select Some Options":"Select an Option",this.setup(),this.set_up_html(),this.register_observers(),this.finish_setup()}return a.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=this.options.allow_single_deselect!=null&&this.form_field.options[0]!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.search_contains=this.options.search_contains||!1,this.choices=0,this.results_none_found=this.options.no_results_text||"No results match"},a.prototype.mouse_enter=function(){return this.mouse_on_container=!0},a.prototype.mouse_leave=function(){return this.mouse_on_container=!1},a.prototype.input_focus=function(a){var b=this;if(!this.active_field)return setTimeout(function(){return b.container_mousedown()},50)},a.prototype.input_blur=function(a){var b=this;if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(){return b.blur_test()},100)},a.prototype.result_add_option=function(a){var b,c;return a.disabled?"":(a.dom_id=this.container_id+"_o_"+a.array_index,b=a.selected&&this.is_multiple?[]:["active-result"],a.selected&&b.push("result-selected"),a.group_array_index!=null&&b.push("group-option"),a.classes!==""&&b.push(a.classes),c=a.style.cssText!==""?' style="'+a.style+'"':"",'<li id="'+a.dom_id+'" class="'+b.join(" ")+'"'+c+">"+a.html+"</li>")},a.prototype.results_update_field=function(){return this.result_clear_highlight(),this.result_single_selected=null,this.results_build()},a.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},a.prototype.results_search=function(a){return this.results_showing?this.winnow_results():this.results_show()},a.prototype.keyup_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale();switch(b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:a.preventDefault();if(this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},a.prototype.generate_field_id=function(){var a;return a=this.generate_random_id(),this.form_field.id=a,a},a.prototype.generate_random_char=function(){var a,b,c;return a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ",c=Math.floor(Math.random()*a.length),b=a.substring(c,c+1)},a}(),b.AbstractChosen=a}.call(this),function(){var a,b,c,d,e=Object.prototype.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};d=this,a=jQuery,a.fn.extend({chosen:function(c){return!a.browser.msie||a.browser.version!=="6.0"&&a.browser.version!=="7.0"?a(this).each(function(d){if(!a(this).hasClass("chzn-done"))return new b(this,c)}):this}}),b=function(b){function e(){e.__super__.constructor.apply(this,arguments)}return f(e,b),e.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.is_rtl=this.form_field_jq.hasClass("chzn-rtl")},e.prototype.finish_setup=function(){return this.form_field_jq.addClass("chzn-done")},e.prototype.set_up_html=function(){var b,d,e,f;return this.container_id=this.form_field.id.length?this.form_field.id.replace(/(:|\.)/g,"_"):this.generate_field_id(),this.container_id+="_chzn",this.f_width=this.form_field_jq.outerWidth(),this.default_text=this.form_field_jq.data("placeholder")?this.form_field_jq.data("placeholder"):this.default_text_default,b=a("<div />",{id:this.container_id,"class":"chzn-container"+(this.is_rtl?" chzn-rtl":""),style:"width: "+this.f_width+"px;"}),this.is_multiple?b.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'):b.html('<a href="javascript:void(0)" class="chzn-single chzn-default"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'),this.form_field_jq.hide().after(b),this.container=a("#"+this.container_id),this.container.addClass("chzn-container-"+(this.is_multiple?"multi":"single")),this.dropdown=this.container.find("div.chzn-drop").first(),d=this.container.height(),e=this.f_width-c(this.dropdown),this.dropdown.css({width:e+"px",top:d+"px"}),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chzn-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chzn-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chzn-search").first(),this.selected_item=this.container.find(".chzn-single").first(),f=e-c(this.search_container)-c(this.search_field),this.search_field.css({width:f+"px"})),this.results_build(),this.set_tab_index(),this.form_field_jq.trigger("liszt:ready",{chosen:this})},e.prototype.register_observers=function(){var a=this;return this.container.mousedown(function(b){return a.container_mousedown(b)}),this.container.mouseup(function(b){return a.container_mouseup(b)}),this.container.mouseenter(function(b){return a.mouse_enter(b)}),this.container.mouseleave(function(b){return a.mouse_leave(b)}),this.search_results.mouseup(function(b){return a.search_results_mouseup(b)}),this.search_results.mouseover(function(b){return a.search_results_mouseover(b)}),this.search_results.mouseout(function(b){return a.search_results_mouseout(b)}),this.form_field_jq.bind("liszt:updated",function(b){return a.results_update_field(b)}),this.search_field.blur(function(b){return a.input_blur(b)}),this.search_field.keyup(function(b){return a.keyup_checker(b)}),this.search_field.keydown(function(b){return a.keydown_checker(b)}),this.is_multiple?(this.search_choices.click(function(b){return a.choices_click(b)}),this.search_field.focus(function(b){return a.input_focus(b)})):this.container.click(function(a){return a.preventDefault()})},e.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq[0].disabled;if(this.is_disabled)return this.container.addClass("chzn-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus",this.activate_action),this.close_field();this.container.removeClass("chzn-disabled"),this.search_field[0].disabled=!1;if(!this.is_multiple)return this.selected_item.bind("focus",this.activate_action)},e.prototype.container_mousedown=function(b){var c;if(!this.is_disabled)return c=b!=null?a(b.target).hasClass("search-choice-close"):!1,b&&b.type==="mousedown"&&!this.results_showing&&b.stopPropagation(),!this.pending_destroy_click&&!c?(this.active_field?!this.is_multiple&&b&&(a(b.target)[0]===this.selected_item[0]||a(b.target).parents("a.chzn-single").length)&&(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(document).click(this.click_test_action),this.results_show()),this.activate_field()):this.pending_destroy_click=!1},e.prototype.container_mouseup=function(a){if(a.target.nodeName==="ABBR")return this.results_reset(a)},e.prototype.blur_test=function(a){if(!this.active_field&&this.container.hasClass("chzn-container-active"))return this.close_field()},e.prototype.close_field=function(){return a(document).unbind("click",this.click_test_action),this.is_multiple||(this.selected_item.attr("tabindex",this.search_field.attr("tabindex")),this.search_field.attr("tabindex",-1)),this.active_field=!1,this.results_hide(),this.container.removeClass("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},e.prototype.activate_field=function(){return!this.is_multiple&&!this.active_field&&(this.search_field.attr("tabindex",this.selected_item.attr("tabindex")),this.selected_item.attr("tabindex",-1)),this.container.addClass("chzn-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},e.prototype.test_active_click=function(b){return a(b.target).parents("#"+this.container_id).length?this.active_field=!0:this.close_field()},e.prototype.results_build=function(){var a,b,c,e,f;this.parsing=!0,this.results_data=d.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.find("li.search-choice").remove(),this.choices=0):this.is_multiple||(this.selected_item.find("span").text(this.default_text),this.form_field.options.length<=this.disable_search_threshold?this.container.addClass("chzn-container-single-nosearch"):this.container.removeClass("chzn-container-single-nosearch")),a="",f=this.results_data;for(c=0,e=f.length;c<e;c++)b=f[c],b.group?a+=this.result_add_group(b):b.empty||(a+=this.result_add_option(b),b.selected&&this.is_multiple?this.choice_build(b):b.selected&&!this.is_multiple&&(this.selected_item.removeClass("chzn-default").find("span").text(b.text),this.allow_single_deselect&&this.single_deselect_control_build()));return this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.search_results.html(a),this.parsing=!1},e.prototype.result_add_group=function(b){return b.disabled?"":(b.dom_id=this.container_id+"_g_"+b.array_index,'<li id="'+b.dom_id+'" class="group-result">'+a("<div />").text(b.label).html()+"</li>")},e.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight();if(b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(c<f)return this.search_results.scrollTop(c)}},e.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},e.prototype.results_show=function(){var a;return this.is_multiple||(this.selected_item.addClass("chzn-single-with-drop"),this.result_single_selected&&this.result_do_highlight(this.result_single_selected)),a=this.is_multiple?this.container.height():this.container.height()-1,this.dropdown.css({top:a+"px",left:0}),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results()},e.prototype.results_hide=function(){return this.is_multiple||this.selected_item.removeClass("chzn-single-with-drop"),this.result_clear_highlight(),this.dropdown.css({left:"-9000px"}),this.results_showing=!1},e.prototype.set_tab_index=function(a){var b;if(this.form_field_jq.attr("tabindex"))return b=this.form_field_jq.attr("tabindex"),this.form_field_jq.attr("tabindex",-1),this.is_multiple?this.search_field.attr("tabindex",b):(this.selected_item.attr("tabindex",b),this.search_field.attr("tabindex",-1))},e.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},e.prototype.search_results_mouseup=function(b){var c;c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first();if(c.length)return this.result_highlight=c,this.result_select(b)},e.prototype.search_results_mouseover=function(b){var c;c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first();if(c)return this.result_do_highlight(c)},e.prototype.search_results_mouseout=function(b){if(a(b.target).hasClass("active-result"))return this.result_clear_highlight()},e.prototype.choices_click=function(b){b.preventDefault();if(this.active_field&&!a(b.target).hasClass("search-choice")&&!this.results_showing)return this.results_show()},e.prototype.choice_build=function(b){var c,d,e=this;return c=this.container_id+"_c_"+b.array_index,this.choices+=1,this.search_container.before('<li class="search-choice" id="'+c+'"><span>'+b.html+'</span><a href="javascript:void(0)" class="search-choice-close" rel="'+b.array_index+'"></a></li>'),d=a("#"+c).find("a").first(),d.click(function(a){return e.choice_destroy_link_click(a)})},e.prototype.choice_destroy_link_click=function(b){return b.preventDefault(),this.is_disabled?b.stopPropagation:(this.pending_destroy_click=!0,this.choice_destroy(a(b.target)))},e.prototype.choice_destroy=function(a){return this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.val().length<1&&this.results_hide(),this.result_deselect(a.attr("rel")),a.parents("li").first().remove()},e.prototype.results_reset=function(b){this.form_field.options[0].selected=!0,this.selected_item.find("span").text(this.default_text),this.is_multiple||this.selected_item.addClass("chzn-default"),this.show_search_field_default(),a(b.target).remove(),this.form_field_jq.trigger("change");if(this.active_field)return this.results_hide()},e.prototype.result_select=function(a){var b,c,d,e;if(this.result_highlight)return b=this.result_highlight,c=b.attr("id"),this.result_clear_highlight(),this.is_multiple?this.result_deactivate(b):(this.search_results.find(".result-selected").removeClass("result-selected"),this.result_single_selected=b,this.selected_item.removeClass("chzn-default")),b.addClass("result-selected"),e=c.substr(c.lastIndexOf("_")+1),d=this.results_data[e],d.selected=!0,this.form_field.options[d.options_index].selected=!0,this.is_multiple?this.choice_build(d):(this.selected_item.find("span").first().text(d.text),this.allow_single_deselect&&this.single_deselect_control_build()),(!a.metaKey||!this.is_multiple)&&this.results_hide(),this.search_field.val(""),this.form_field_jq.trigger("change"),this.search_field_scale()},e.prototype.result_activate=function(a){return a.addClass("active-result")},e.prototype.result_deactivate=function(a){return a.removeClass("active-result")},e.prototype.result_deselect=function(b){var c,d;return d=this.results_data[b],d.selected=!1,this.form_field.options[d.options_index].selected=!1,c=a("#"+this.container_id+"_o_"+b),c.removeClass("result-selected").addClass("active-result").show(),this.result_clear_highlight(),this.winnow_results(),this.form_field_jq.trigger("change"),this.search_field_scale()},e.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&this.selected_item.find("abbr").length<1)return this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>')},e.prototype.winnow_results=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;this.no_results_clear(),j=0,k=this.search_field.val()===this.default_text?"":a("<div/>").text(a.trim(this.search_field.val())).html(),g=this.search_contains?"":"^",f=new RegExp(g+k.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),n=new RegExp(k.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),s=this.results_data;for(o=0,q=s.length;o<q;o++){c=s[o];if(!c.disabled&&!c.empty)if(c.group)a("#"+c.dom_id).css("display","none");else if(!this.is_multiple||!c.selected){b=!1,i=c.dom_id,h=a("#"+i);if(f.test(c.html))b=!0,j+=1;else if(c.html.indexOf(" ")>=0||c.html.indexOf("[")===0){e=c.html.replace(/\[|\]/g,"").split(" ");if(e.length)for(p=0,r=e.length;p<r;p++)d=e[p],f.test(d)&&(b=!0,j+=1)}b?(k.length?(l=c.html.search(n),m=c.html.substr(0,l+k.length)+"</em>"+c.html.substr(l+k.length),m=m.substr(0,l)+"<em>"+m.substr(l)):m=c.html,h.html(m),this.result_activate(h),c.group_array_index!=null&&a("#"+this.results_data[c.group_array_index].dom_id).css("display","list-item")):(this.result_highlight&&i===this.result_highlight.attr("id")&&this.result_clear_highlight(),this.result_deactivate(h))}}return j<1&&k.length?this.no_results(k):this.winnow_results_set_highlight()},e.prototype.winnow_results_clear=function(){var b,c,d,e,f;this.search_field.val(""),c=this.search_results.find("li"),f=[];for(d=0,e=c.length;d<e;d++)b=c[d],b=a(b),b.hasClass("group-result")?f.push(b.css("display","auto")):!this.is_multiple||!b.hasClass("result-selected")?f.push(this.result_activate(b)):f.push(void 0);return f},e.prototype.winnow_results_set_highlight=function(){var a,b;if(!this.result_highlight){b=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),a=b.length?b.first():this.search_results.find(".active-result").first();if(a!=null)return this.result_do_highlight(a)}},e.prototype.no_results=function(b){var c;return c=a('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),c.find("span").first().html(b),this.search_results.append(c)},e.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},e.prototype.keydown_arrow=function(){var b,c;this.result_highlight?this.results_showing&&(c=this.result_highlight.nextAll("li.active-result").first(),c&&this.result_do_highlight(c)):(b=this.search_results.find("li.active-result").first(),b&&this.result_do_highlight(a(b)));if(!this.results_showing)return this.results_show()},e.prototype.keyup_arrow=function(){var a;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight)return a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices>0&&this.results_hide(),this.result_clear_highlight())},e.prototype.keydown_backstroke=function(){return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(this.pending_backstroke=this.search_container.siblings("li.search-choice").last(),this.pending_backstroke.addClass("search-choice-focus"))},e.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},e.prototype.keydown_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale(),b!==8&&this.pending_backstroke&&this.clear_backstroke();switch(b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},e.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(i=0,j=g.length;i<j;i++)e=g[i],f+=e+":"+this.search_field.css(e)+";";return c=a("<div />",{style:f}),c.text(this.search_field.val()),a("body").append(c),h=c.width()+25,c.remove(),h>this.f_width-10&&(h=this.f_width-10),this.search_field.css({width:h+"px"}),b=this.container.height(),this.dropdown.css({top:b+"px"})}},e.prototype.generate_random_id=function(){var b;b="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();while(a("#"+b).length>0)b+=this.generate_random_char();return b},e}(AbstractChosen),c=function(a){var b;return b=a.outerWidth()-a.width()},d.get_side_border_padding=c}.call(this)
|
||||||
|
|
||||||
|
16
admin/thirdparty/chosen/chosen/chosen.proto.js
vendored
@ -1,7 +1,7 @@
|
|||||||
// Chosen, a Select Box Enhancer for jQuery and Protoype
|
// Chosen, a Select Box Enhancer for jQuery and Protoype
|
||||||
// by Patrick Filler for Harvest, http://getharvest.com
|
// by Patrick Filler for Harvest, http://getharvest.com
|
||||||
//
|
//
|
||||||
// Version 0.9.7
|
// Version 0.9.8
|
||||||
// Full source at https://github.com/harvesthq/chosen
|
// Full source at https://github.com/harvesthq/chosen
|
||||||
// Copyright (c) 2011 Harvest http://getharvest.com
|
// Copyright (c) 2011 Harvest http://getharvest.com
|
||||||
|
|
||||||
@ -129,6 +129,7 @@ Copyright (c) 2011 by Harvest
|
|||||||
this.result_single_selected = null;
|
this.result_single_selected = null;
|
||||||
this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
|
this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
|
||||||
this.disable_search_threshold = this.options.disable_search_threshold || 0;
|
this.disable_search_threshold = this.options.disable_search_threshold || 0;
|
||||||
|
this.search_contains = this.options.search_contains || false;
|
||||||
this.choices = 0;
|
this.choices = 0;
|
||||||
return this.results_none_found = this.options.no_results_text || "No results match";
|
return this.results_none_found = this.options.no_results_text || "No results match";
|
||||||
};
|
};
|
||||||
@ -281,7 +282,7 @@ Copyright (c) 2011 by Harvest
|
|||||||
|
|
||||||
Chosen.prototype.set_default_values = function() {
|
Chosen.prototype.set_default_values = function() {
|
||||||
Chosen.__super__.set_default_values.call(this);
|
Chosen.__super__.set_default_values.call(this);
|
||||||
this.single_temp = new Template('<a href="javascript:void(0)" class="chzn-single"><span>#{default}</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>');
|
this.single_temp = new Template('<a href="javascript:void(0)" class="chzn-single chzn-default"><span>#{default}</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>');
|
||||||
this.multi_temp = new Template('<ul class="chzn-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');
|
this.multi_temp = new Template('<ul class="chzn-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');
|
||||||
this.choice_temp = new Template('<li class="search-choice" id="#{id}"><span>#{choice}</span><a href="javascript:void(0)" class="search-choice-close" rel="#{position}"></a></li>');
|
this.choice_temp = new Template('<li class="search-choice" id="#{id}"><span>#{choice}</span><a href="javascript:void(0)" class="search-choice-close" rel="#{position}"></a></li>');
|
||||||
return this.no_results_temp = new Template('<li class="no-results">' + this.results_none_found + ' "<span>#{terms}</span>"</li>');
|
return this.no_results_temp = new Template('<li class="no-results">' + this.results_none_found + ' "<span>#{terms}</span>"</li>');
|
||||||
@ -407,7 +408,7 @@ Copyright (c) 2011 by Harvest
|
|||||||
var target_closelink;
|
var target_closelink;
|
||||||
if (!this.is_disabled) {
|
if (!this.is_disabled) {
|
||||||
target_closelink = evt != null ? evt.target.hasClassName("search-choice-close") : false;
|
target_closelink = evt != null ? evt.target.hasClassName("search-choice-close") : false;
|
||||||
if (evt && evt.type === "mousedown") evt.stop();
|
if (evt && evt.type === "mousedown" && !this.results_showing) evt.stop();
|
||||||
if (!this.pending_destroy_click && !target_closelink) {
|
if (!this.pending_destroy_click && !target_closelink) {
|
||||||
if (!this.active_field) {
|
if (!this.active_field) {
|
||||||
if (this.is_multiple) this.search_field.clear();
|
if (this.is_multiple) this.search_field.clear();
|
||||||
@ -493,7 +494,7 @@ Copyright (c) 2011 by Harvest
|
|||||||
if (data.selected && this.is_multiple) {
|
if (data.selected && this.is_multiple) {
|
||||||
this.choice_build(data);
|
this.choice_build(data);
|
||||||
} else if (data.selected && !this.is_multiple) {
|
} else if (data.selected && !this.is_multiple) {
|
||||||
this.selected_item.down("span").update(data.html);
|
this.selected_item.removeClassName("chzn-default").down("span").update(data.html);
|
||||||
if (this.allow_single_deselect) this.single_deselect_control_build();
|
if (this.allow_single_deselect) this.single_deselect_control_build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -659,6 +660,7 @@ Copyright (c) 2011 by Harvest
|
|||||||
Chosen.prototype.results_reset = function(evt) {
|
Chosen.prototype.results_reset = function(evt) {
|
||||||
this.form_field.options[0].selected = true;
|
this.form_field.options[0].selected = true;
|
||||||
this.selected_item.down("span").update(this.default_text);
|
this.selected_item.down("span").update(this.default_text);
|
||||||
|
if (!this.is_multiple) this.selected_item.addClassName("chzn-default");
|
||||||
this.show_search_field_default();
|
this.show_search_field_default();
|
||||||
evt.target.remove();
|
evt.target.remove();
|
||||||
if (typeof Event.simulate === 'function') this.form_field.simulate("change");
|
if (typeof Event.simulate === 'function') this.form_field.simulate("change");
|
||||||
@ -674,6 +676,7 @@ Copyright (c) 2011 by Harvest
|
|||||||
this.result_deactivate(high);
|
this.result_deactivate(high);
|
||||||
} else {
|
} else {
|
||||||
this.search_results.descendants(".result-selected").invoke("removeClassName", "result-selected");
|
this.search_results.descendants(".result-selected").invoke("removeClassName", "result-selected");
|
||||||
|
this.selected_item.removeClassName("chzn-default");
|
||||||
this.result_single_selected = high;
|
this.result_single_selected = high;
|
||||||
}
|
}
|
||||||
high.addClassName("result-selected");
|
high.addClassName("result-selected");
|
||||||
@ -726,11 +729,12 @@ Copyright (c) 2011 by Harvest
|
|||||||
};
|
};
|
||||||
|
|
||||||
Chosen.prototype.winnow_results = function() {
|
Chosen.prototype.winnow_results = function() {
|
||||||
var found, option, part, parts, regex, result_id, results, searchText, startpos, text, zregex, _i, _j, _len, _len2, _ref;
|
var found, option, part, parts, regex, regexAnchor, result_id, results, searchText, startpos, text, zregex, _i, _j, _len, _len2, _ref;
|
||||||
this.no_results_clear();
|
this.no_results_clear();
|
||||||
results = 0;
|
results = 0;
|
||||||
searchText = this.search_field.value === this.default_text ? "" : this.search_field.value.strip().escapeHTML();
|
searchText = this.search_field.value === this.default_text ? "" : this.search_field.value.strip().escapeHTML();
|
||||||
regex = new RegExp('^' + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
|
regexAnchor = this.search_contains ? "" : "^";
|
||||||
|
regex = new RegExp(regexAnchor + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
|
||||||
zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
|
zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
|
||||||
_ref = this.results_data;
|
_ref = this.results_data;
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
// Chosen, a Select Box Enhancer for jQuery and Protoype
|
// Chosen, a Select Box Enhancer for jQuery and Protoype
|
||||||
// by Patrick Filler for Harvest, http://getharvest.com
|
// by Patrick Filler for Harvest, http://getharvest.com
|
||||||
//
|
//
|
||||||
// Version 0.9.7
|
// Version 0.9.8
|
||||||
// Full source at https://github.com/harvesthq/chosen
|
// Full source at https://github.com/harvesthq/chosen
|
||||||
// Copyright (c) 2011 Harvest http://getharvest.com
|
// Copyright (c) 2011 Harvest http://getharvest.com
|
||||||
|
|
||||||
// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
||||||
// This file is generated by `cake build`, do not edit it by hand.
|
// This file is generated by `cake build`, do not edit it by hand.
|
||||||
((function(){var a;a=function(){function a(){this.options_index=0,this.parsed=[]}return a.prototype.add_node=function(a){return a.nodeName==="OPTGROUP"?this.add_group(a):this.add_option(a)},a.prototype.add_group=function(a){var b,c,d,e,f,g;b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:a.label,children:0,disabled:a.disabled}),f=a.childNodes,g=[];for(d=0,e=f.length;d<e;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},a.prototype.add_option=function(a,b,c){if(a.nodeName==="OPTION")return a.text!==""?(b!=null&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},a}(),a.select_to_array=function(b){var c,d,e,f,g;d=new a,g=b.childNodes;for(e=0,f=g.length;e<f;e++)c=g[e],d.add_node(c);return d.parsed},this.SelectParser=a})).call(this),function(){var a,b;b=this,a=function(){function a(a,b){this.form_field=a,this.options=b!=null?b:{},this.set_default_values(),this.is_multiple=this.form_field.multiple,this.default_text_default=this.is_multiple?"Select Some Options":"Select an Option",this.setup(),this.set_up_html(),this.register_observers(),this.finish_setup()}return a.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=this.options.allow_single_deselect!=null&&this.form_field.options[0]!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.choices=0,this.results_none_found=this.options.no_results_text||"No results match"},a.prototype.mouse_enter=function(){return this.mouse_on_container=!0},a.prototype.mouse_leave=function(){return this.mouse_on_container=!1},a.prototype.input_focus=function(a){var b=this;if(!this.active_field)return setTimeout(function(){return b.container_mousedown()},50)},a.prototype.input_blur=function(a){var b=this;if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(){return b.blur_test()},100)},a.prototype.result_add_option=function(a){var b,c;return a.disabled?"":(a.dom_id=this.container_id+"_o_"+a.array_index,b=a.selected&&this.is_multiple?[]:["active-result"],a.selected&&b.push("result-selected"),a.group_array_index!=null&&b.push("group-option"),a.classes!==""&&b.push(a.classes),c=a.style.cssText!==""?' style="'+a.style+'"':"",'<li id="'+a.dom_id+'" class="'+b.join(" ")+'"'+c+">"+a.html+"</li>")},a.prototype.results_update_field=function(){return this.result_clear_highlight(),this.result_single_selected=null,this.results_build()},a.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},a.prototype.results_search=function(a){return this.results_showing?this.winnow_results():this.results_show()},a.prototype.keyup_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale();switch(b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:a.preventDefault();if(this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},a.prototype.generate_field_id=function(){var a;return a=this.generate_random_id(),this.form_field.id=a,a},a.prototype.generate_random_char=function(){var a,b,c;return a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ",c=Math.floor(Math.random()*a.length),b=a.substring(c,c+1)},a}(),b.AbstractChosen=a}.call(this),function(){var a,b,c,d=Object.prototype.hasOwnProperty,e=function(a,b){function e(){this.constructor=a}for(var c in b)d.call(b,c)&&(a[c]=b[c]);return e.prototype=b.prototype,a.prototype=new e,a.__super__=b.prototype,a};c=this,a=function(a){function d(){d.__super__.constructor.apply(this,arguments)}return e(d,a),d.prototype.setup=function(){return this.is_rtl=this.form_field.hasClassName("chzn-rtl")},d.prototype.finish_setup=function(){return this.form_field.addClassName("chzn-done")},d.prototype.set_default_values=function(){return d.__super__.set_default_values.call(this),this.single_temp=new Template('<a href="javascript:void(0)" class="chzn-single"><span>#{default}</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'),this.multi_temp=new Template('<ul class="chzn-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'),this.choice_temp=new Template('<li class="search-choice" id="#{id}"><span>#{choice}</span><a href="javascript:void(0)" class="search-choice-close" rel="#{position}"></a></li>'),this.no_results_temp=new Template('<li class="no-results">'+this.results_none_found+' "<span>#{terms}</span>"</li>')},d.prototype.set_up_html=function(){var a,c,d,e,f;return this.container_id=this.form_field.identify().replace(/(:|\.)/g,"_")+"_chzn",this.f_width=this.form_field.getStyle("width")?parseInt(this.form_field.getStyle("width"),10):this.form_field.getWidth(),c={id:this.container_id,"class":"chzn-container"+(this.is_rtl?" chzn-rtl":""),style:"width: "+this.f_width+"px"},this.default_text=this.form_field.readAttribute("data-placeholder")?this.form_field.readAttribute("data-placeholder"):this.default_text_default,a=this.is_multiple?(new Element("div",c)).update(this.multi_temp.evaluate({"default":this.default_text})):(new Element("div",c)).update(this.single_temp.evaluate({"default":this.default_text})),this.form_field.hide().insert({after:a}),this.container=$(this.container_id),this.container.addClassName("chzn-container-"+(this.is_multiple?"multi":"single")),this.dropdown=this.container.down("div.chzn-drop"),d=this.container.getHeight(),e=this.f_width-b(this.dropdown),this.dropdown.setStyle({width:e+"px",top:d+"px"}),this.search_field=this.container.down("input"),this.search_results=this.container.down("ul.chzn-results"),this.search_field_scale(),this.search_no_results=this.container.down("li.no-results"),this.is_multiple?(this.search_choices=this.container.down("ul.chzn-choices"),this.search_container=this.container.down("li.search-field")):(this.search_container=this.container.down("div.chzn-search"),this.selected_item=this.container.down(".chzn-single"),f=e-b(this.search_container)-b(this.search_field),this.search_field.setStyle({width:f+"px"})),this.results_build(),this.set_tab_index(),this.form_field.fire("liszt:ready",{chosen:this})},d.prototype.register_observers=function(){var a=this;return this.container.observe("mousedown",function(b){return a.container_mousedown(b)}),this.container.observe("mouseup",function(b){return a.container_mouseup(b)}),this.container.observe("mouseenter",function(b){return a.mouse_enter(b)}),this.container.observe("mouseleave",function(b){return a.mouse_leave(b)}),this.search_results.observe("mouseup",function(b){return a.search_results_mouseup(b)}),this.search_results.observe("mouseover",function(b){return a.search_results_mouseover(b)}),this.search_results.observe("mouseout",function(b){return a.search_results_mouseout(b)}),this.form_field.observe("liszt:updated",function(b){return a.results_update_field(b)}),this.search_field.observe("blur",function(b){return a.input_blur(b)}),this.search_field.observe("keyup",function(b){return a.keyup_checker(b)}),this.search_field.observe("keydown",function(b){return a.keydown_checker(b)}),this.is_multiple?(this.search_choices.observe("click",function(b){return a.choices_click(b)}),this.search_field.observe("focus",function(b){return a.input_focus(b)})):this.container.observe("click",function(a){return a.preventDefault()})},d.prototype.search_field_disabled=function(){this.is_disabled=this.form_field.disabled;if(this.is_disabled)return this.container.addClassName("chzn-disabled"),this.search_field.disabled=!0,this.is_multiple||this.selected_item.stopObserving("focus",this.activate_action),this.close_field();this.container.removeClassName("chzn-disabled"),this.search_field.disabled=!1;if(!this.is_multiple)return this.selected_item.observe("focus",this.activate_action)},d.prototype.container_mousedown=function(a){var b;if(!this.is_disabled)return b=a!=null?a.target.hasClassName("search-choice-close"):!1,a&&a.type==="mousedown"&&a.stop(),!this.pending_destroy_click&&!b?(this.active_field?!this.is_multiple&&a&&(a.target===this.selected_item||a.target.up("a.chzn-single"))&&this.results_toggle():(this.is_multiple&&this.search_field.clear(),document.observe("click",this.click_test_action),this.results_show()),this.activate_field()):this.pending_destroy_click=!1},d.prototype.container_mouseup=function(a){if(a.target.nodeName==="ABBR")return this.results_reset(a)},d.prototype.blur_test=function(a){if(!this.active_field&&this.container.hasClassName("chzn-container-active"))return this.close_field()},d.prototype.close_field=function(){return document.stopObserving("click",this.click_test_action),this.is_multiple||(this.selected_item.tabIndex=this.search_field.tabIndex,this.search_field.tabIndex=-1),this.active_field=!1,this.results_hide(),this.container.removeClassName("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},d.prototype.activate_field=function(){return!this.is_multiple&&!this.active_field&&(this.search_field.tabIndex=this.selected_item.tabIndex,this.selected_item.tabIndex=-1),this.container.addClassName("chzn-container-active"),this.active_field=!0,this.search_field.value=this.search_field.value,this.search_field.focus()},d.prototype.test_active_click=function(a){return a.target.up("#"+this.container_id)?this.active_field=!0:this.close_field()},d.prototype.results_build=function(){var a,b,d,e,f;this.parsing=!0,this.results_data=c.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.select("li.search-choice").invoke("remove"),this.choices=0):this.is_multiple||(this.selected_item.down("span").update(this.default_text),this.form_field.options.length<=this.disable_search_threshold?this.container.addClassName("chzn-container-single-nosearch"):this.container.removeClassName("chzn-container-single-nosearch")),a="",f=this.results_data;for(d=0,e=f.length;d<e;d++)b=f[d],b.group?a+=this.result_add_group(b):b.empty||(a+=this.result_add_option(b),b.selected&&this.is_multiple?this.choice_build(b):b.selected&&!this.is_multiple&&(this.selected_item.down("span").update(b.html),this.allow_single_deselect&&this.single_deselect_control_build()));return this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.search_results.update(a),this.parsing=!1},d.prototype.result_add_group=function(a){return a.disabled?"":(a.dom_id=this.container_id+"_g_"+a.array_index,'<li id="'+a.dom_id+'" class="group-result">'+a.label.escapeHTML()+"</li>")},d.prototype.result_do_highlight=function(a){var b,c,d,e,f;this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClassName("highlighted"),d=parseInt(this.search_results.getStyle("maxHeight"),10),f=this.search_results.scrollTop,e=d+f,c=this.result_highlight.positionedOffset().top,b=c+this.result_highlight.getHeight();if(b>=e)return this.search_results.scrollTop=b-d>0?b-d:0;if(c<f)return this.search_results.scrollTop=c},d.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClassName("highlighted"),this.result_highlight=null},d.prototype.results_show=function(){var a;return this.is_multiple||(this.selected_item.addClassName("chzn-single-with-drop"),this.result_single_selected&&this.result_do_highlight(this.result_single_selected)),a=this.is_multiple?this.container.getHeight():this.container.getHeight()-1,this.dropdown.setStyle({top:a+"px",left:0}),this.results_showing=!0,this.search_field.focus(),this.search_field.value=this.search_field.value,this.winnow_results()},d.prototype.results_hide=function(){return this.is_multiple||this.selected_item.removeClassName("chzn-single-with-drop"),this.result_clear_highlight(),this.dropdown.setStyle({left:"-9000px"}),this.results_showing=!1},d.prototype.set_tab_index=function(a){var b;if(this.form_field.tabIndex)return b=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.is_multiple?this.search_field.tabIndex=b:(this.selected_item.tabIndex=b,this.search_field.tabIndex=-1)},d.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices<1&&!this.active_field?(this.search_field.value=this.default_text,this.search_field.addClassName("default")):(this.search_field.value="",this.search_field.removeClassName("default"))},d.prototype.search_results_mouseup=function(a){var b;b=a.target.hasClassName("active-result")?a.target:a.target.up(".active-result");if(b)return this.result_highlight=b,this.result_select(a)},d.prototype.search_results_mouseover=function(a){var b;b=a.target.hasClassName("active-result")?a.target:a.target.up(".active-result");if(b)return this.result_do_highlight(b)},d.prototype.search_results_mouseout=function(a){if(a.target.hasClassName("active-result")||a.target.up(".active-result"))return this.result_clear_highlight()},d.prototype.choices_click=function(a){a.preventDefault();if(this.active_field&&!a.target.hasClassName("search-choice")&&!a.target.up(".search-choice")&&!this.results_showing)return this.results_show()},d.prototype.choice_build=function(a){var b,c,d=this;return b=this.container_id+"_c_"+a.array_index,this.choices+=1,this.search_container.insert({before:this.choice_temp.evaluate({id:b,choice:a.html,position:a.array_index})}),c=$(b).down("a"),c.observe("click",function(a){return d.choice_destroy_link_click(a)})},d.prototype.choice_destroy_link_click=function(a){a.preventDefault();if(!this.is_disabled)return this.pending_destroy_click=!0,this.choice_destroy(a.target)},d.prototype.choice_destroy=function(a){return this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.value.length<1&&this.results_hide(),this.result_deselect(a.readAttribute("rel")),a.up("li").remove()},d.prototype.results_reset=function(a){this.form_field.options[0].selected=!0,this.selected_item.down("span").update(this.default_text),this.show_search_field_default(),a.target.remove(),typeof Event.simulate=="function"&&this.form_field.simulate("change");if(this.active_field)return this.results_hide()},d.prototype.result_select=function(a){var b,c,d;if(this.result_highlight)return b=this.result_highlight,this.result_clear_highlight(),this.is_multiple?this.result_deactivate(b):(this.search_results.descendants(".result-selected").invoke("removeClassName","result-selected"),this.result_single_selected=b),b.addClassName("result-selected"),d=b.id.substr(b.id.lastIndexOf("_")+1),c=this.results_data[d],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.is_multiple?this.choice_build(c):(this.selected_item.down("span").update(c.html),this.allow_single_deselect&&this.single_deselect_control_build()),(!a.metaKey||!this.is_multiple)&&this.results_hide(),this.search_field.value="",typeof Event.simulate=="function"&&this.form_field.simulate("change"),this.search_field_scale()},d.prototype.result_activate=function(a){return a.addClassName("active-result")},d.prototype.result_deactivate=function(a){return a.removeClassName("active-result")},d.prototype.result_deselect=function(a){var b,c;return c=this.results_data[a],c.selected=!1,this.form_field.options[c.options_index].selected=!1,b=$(this.container_id+"_o_"+a),b.removeClassName("result-selected").addClassName("active-result").show(),this.result_clear_highlight(),this.winnow_results(),typeof Event.simulate=="function"&&this.form_field.simulate("change"),this.search_field_scale()},d.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&!this.selected_item.down("abbr"))return this.selected_item.down("span").insert({after:'<abbr class="search-choice-close"></abbr>'})},d.prototype.winnow_results=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;this.no_results_clear(),g=0,h=this.search_field.value===this.default_text?"":this.search_field.value.strip().escapeHTML(),e=new RegExp("^"+h.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),k=new RegExp(h.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),p=this.results_data;for(l=0,n=p.length;l<n;l++){b=p[l];if(!b.disabled&&!b.empty)if(b.group)$(b.dom_id).hide();else if(!this.is_multiple||!b.selected){a=!1,f=b.dom_id;if(e.test(b.html))a=!0,g+=1;else if(b.html.indexOf(" ")>=0||b.html.indexOf("[")===0){d=b.html.replace(/\[|\]/g,"").split(" ");if(d.length)for(m=0,o=d.length;m<o;m++)c=d[m],e.test(c)&&(a=!0,g+=1)}a?(h.length?(i=b.html.search(k),j=b.html.substr(0,i+h.length)+"</em>"+b.html.substr(i+h.length),j=j.substr(0,i)+"<em>"+j.substr(i)):j=b.html,$(f).innerHTML!==j&&$(f).update(j),this.result_activate($(f)),b.group_array_index!=null&&$(this.results_data[b.group_array_index].dom_id).setStyle({display:"list-item"})):($(f)===this.result_highlight&&this.result_clear_highlight(),this.result_deactivate($(f)))}}return g<1&&h.length?this.no_results(h):this.winnow_results_set_highlight()},d.prototype.winnow_results_clear=function(){var a,b,c,d,e;this.search_field.clear(),b=this.search_results.select("li"),e=[];for(c=0,d=b.length;c<d;c++)a=b[c],a.hasClassName("group-result")?e.push(a.show()):!this.is_multiple||!a.hasClassName("result-selected")?e.push(this.result_activate(a)):e.push(void 0);return e},d.prototype.winnow_results_set_highlight=function(){var a;if(!this.result_highlight){this.is_multiple||(a=this.search_results.down(".result-selected.active-result")),a==null&&(a=this.search_results.down(".active-result"));if(a!=null)return this.result_do_highlight(a)}},d.prototype.no_results=function(a){return this.search_results.insert(this.no_results_temp.evaluate({terms:a}))},d.prototype.no_results_clear=function(){var a,b;a=null,b=[];while(a=this.search_results.down(".no-results"))b.push(a.remove());return b},d.prototype.keydown_arrow=function(){var a,b,c;a=this.search_results.select("li.active-result");if(a.length){this.result_highlight?this.results_showing&&(c=this.result_highlight.nextSiblings(),b=c.intersect(a),b.length&&this.result_do_highlight(b.first())):this.result_do_highlight(a.first());if(!this.results_showing)return this.results_show()}},d.prototype.keyup_arrow=function(){var a,b,c;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight)return c=this.result_highlight.previousSiblings(),a=this.search_results.select("li.active-result"),b=c.intersect(a),b.length?this.result_do_highlight(b.first()):(this.choices>0&&this.results_hide(),this.result_clear_highlight())},d.prototype.keydown_backstroke=function(){return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.down("a")),this.clear_backstroke()):(this.pending_backstroke=this.search_container.siblings("li.search-choice").last(),this.pending_backstroke.addClassName("search-choice-focus"))},d.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClassName("search-choice-focus"),this.pending_backstroke=null},d.prototype.keydown_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale(),b!==8&&this.pending_backstroke&&this.clear_backstroke();switch(b){case 8:this.backstroke_length=this.search_field.value.length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},d.prototype.search_field_scale=function(){var a,b,c,d,e,f,g,h,i;if(this.is_multiple){c=0,g=0,e="position:absolute; left: -1000px; top: -1000px; display:none;",f=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(h=0,i=f.length;h<i;h++)d=f[h],e+=d+":"+this.search_field.getStyle(d)+";";return b=(new Element("div",{style:e})).update(this.search_field.value.escapeHTML()),document.body.appendChild(b),g=Element.measure(b,"width")+25,b.remove(),g>this.f_width-10&&(g=this.f_width-10),this.search_field.setStyle({width:g+"px"}),a=this.container.getHeight(),this.dropdown.setStyle({top:a+"px"})}},d}(AbstractChosen),c.Chosen=a,Prototype.Browser.IE&&/MSIE (\d+\.\d+);/.test(navigator.userAgent)&&(Prototype.BrowserFeatures.Version=new Number(RegExp.$1)),b=function(a){var b,c;return b=new Element.Layout(a),c=b.get("border-left")+b.get("border-right")+b.get("padding-left")+b.get("padding-right")},c.get_side_border_padding=b}.call(this)
|
((function(){var a;a=function(){function a(){this.options_index=0,this.parsed=[]}return a.prototype.add_node=function(a){return a.nodeName==="OPTGROUP"?this.add_group(a):this.add_option(a)},a.prototype.add_group=function(a){var b,c,d,e,f,g;b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:a.label,children:0,disabled:a.disabled}),f=a.childNodes,g=[];for(d=0,e=f.length;d<e;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},a.prototype.add_option=function(a,b,c){if(a.nodeName==="OPTION")return a.text!==""?(b!=null&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},a}(),a.select_to_array=function(b){var c,d,e,f,g;d=new a,g=b.childNodes;for(e=0,f=g.length;e<f;e++)c=g[e],d.add_node(c);return d.parsed},this.SelectParser=a})).call(this),function(){var a,b;b=this,a=function(){function a(a,b){this.form_field=a,this.options=b!=null?b:{},this.set_default_values(),this.is_multiple=this.form_field.multiple,this.default_text_default=this.is_multiple?"Select Some Options":"Select an Option",this.setup(),this.set_up_html(),this.register_observers(),this.finish_setup()}return a.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=this.options.allow_single_deselect!=null&&this.form_field.options[0]!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.search_contains=this.options.search_contains||!1,this.choices=0,this.results_none_found=this.options.no_results_text||"No results match"},a.prototype.mouse_enter=function(){return this.mouse_on_container=!0},a.prototype.mouse_leave=function(){return this.mouse_on_container=!1},a.prototype.input_focus=function(a){var b=this;if(!this.active_field)return setTimeout(function(){return b.container_mousedown()},50)},a.prototype.input_blur=function(a){var b=this;if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(){return b.blur_test()},100)},a.prototype.result_add_option=function(a){var b,c;return a.disabled?"":(a.dom_id=this.container_id+"_o_"+a.array_index,b=a.selected&&this.is_multiple?[]:["active-result"],a.selected&&b.push("result-selected"),a.group_array_index!=null&&b.push("group-option"),a.classes!==""&&b.push(a.classes),c=a.style.cssText!==""?' style="'+a.style+'"':"",'<li id="'+a.dom_id+'" class="'+b.join(" ")+'"'+c+">"+a.html+"</li>")},a.prototype.results_update_field=function(){return this.result_clear_highlight(),this.result_single_selected=null,this.results_build()},a.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},a.prototype.results_search=function(a){return this.results_showing?this.winnow_results():this.results_show()},a.prototype.keyup_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale();switch(b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:a.preventDefault();if(this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},a.prototype.generate_field_id=function(){var a;return a=this.generate_random_id(),this.form_field.id=a,a},a.prototype.generate_random_char=function(){var a,b,c;return a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ",c=Math.floor(Math.random()*a.length),b=a.substring(c,c+1)},a}(),b.AbstractChosen=a}.call(this),function(){var a,b,c,d=Object.prototype.hasOwnProperty,e=function(a,b){function e(){this.constructor=a}for(var c in b)d.call(b,c)&&(a[c]=b[c]);return e.prototype=b.prototype,a.prototype=new e,a.__super__=b.prototype,a};c=this,a=function(a){function d(){d.__super__.constructor.apply(this,arguments)}return e(d,a),d.prototype.setup=function(){return this.is_rtl=this.form_field.hasClassName("chzn-rtl")},d.prototype.finish_setup=function(){return this.form_field.addClassName("chzn-done")},d.prototype.set_default_values=function(){return d.__super__.set_default_values.call(this),this.single_temp=new Template('<a href="javascript:void(0)" class="chzn-single chzn-default"><span>#{default}</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'),this.multi_temp=new Template('<ul class="chzn-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'),this.choice_temp=new Template('<li class="search-choice" id="#{id}"><span>#{choice}</span><a href="javascript:void(0)" class="search-choice-close" rel="#{position}"></a></li>'),this.no_results_temp=new Template('<li class="no-results">'+this.results_none_found+' "<span>#{terms}</span>"</li>')},d.prototype.set_up_html=function(){var a,c,d,e,f;return this.container_id=this.form_field.identify().replace(/(:|\.)/g,"_")+"_chzn",this.f_width=this.form_field.getStyle("width")?parseInt(this.form_field.getStyle("width"),10):this.form_field.getWidth(),c={id:this.container_id,"class":"chzn-container"+(this.is_rtl?" chzn-rtl":""),style:"width: "+this.f_width+"px"},this.default_text=this.form_field.readAttribute("data-placeholder")?this.form_field.readAttribute("data-placeholder"):this.default_text_default,a=this.is_multiple?(new Element("div",c)).update(this.multi_temp.evaluate({"default":this.default_text})):(new Element("div",c)).update(this.single_temp.evaluate({"default":this.default_text})),this.form_field.hide().insert({after:a}),this.container=$(this.container_id),this.container.addClassName("chzn-container-"+(this.is_multiple?"multi":"single")),this.dropdown=this.container.down("div.chzn-drop"),d=this.container.getHeight(),e=this.f_width-b(this.dropdown),this.dropdown.setStyle({width:e+"px",top:d+"px"}),this.search_field=this.container.down("input"),this.search_results=this.container.down("ul.chzn-results"),this.search_field_scale(),this.search_no_results=this.container.down("li.no-results"),this.is_multiple?(this.search_choices=this.container.down("ul.chzn-choices"),this.search_container=this.container.down("li.search-field")):(this.search_container=this.container.down("div.chzn-search"),this.selected_item=this.container.down(".chzn-single"),f=e-b(this.search_container)-b(this.search_field),this.search_field.setStyle({width:f+"px"})),this.results_build(),this.set_tab_index(),this.form_field.fire("liszt:ready",{chosen:this})},d.prototype.register_observers=function(){var a=this;return this.container.observe("mousedown",function(b){return a.container_mousedown(b)}),this.container.observe("mouseup",function(b){return a.container_mouseup(b)}),this.container.observe("mouseenter",function(b){return a.mouse_enter(b)}),this.container.observe("mouseleave",function(b){return a.mouse_leave(b)}),this.search_results.observe("mouseup",function(b){return a.search_results_mouseup(b)}),this.search_results.observe("mouseover",function(b){return a.search_results_mouseover(b)}),this.search_results.observe("mouseout",function(b){return a.search_results_mouseout(b)}),this.form_field.observe("liszt:updated",function(b){return a.results_update_field(b)}),this.search_field.observe("blur",function(b){return a.input_blur(b)}),this.search_field.observe("keyup",function(b){return a.keyup_checker(b)}),this.search_field.observe("keydown",function(b){return a.keydown_checker(b)}),this.is_multiple?(this.search_choices.observe("click",function(b){return a.choices_click(b)}),this.search_field.observe("focus",function(b){return a.input_focus(b)})):this.container.observe("click",function(a){return a.preventDefault()})},d.prototype.search_field_disabled=function(){this.is_disabled=this.form_field.disabled;if(this.is_disabled)return this.container.addClassName("chzn-disabled"),this.search_field.disabled=!0,this.is_multiple||this.selected_item.stopObserving("focus",this.activate_action),this.close_field();this.container.removeClassName("chzn-disabled"),this.search_field.disabled=!1;if(!this.is_multiple)return this.selected_item.observe("focus",this.activate_action)},d.prototype.container_mousedown=function(a){var b;if(!this.is_disabled)return b=a!=null?a.target.hasClassName("search-choice-close"):!1,a&&a.type==="mousedown"&&!this.results_showing&&a.stop(),!this.pending_destroy_click&&!b?(this.active_field?!this.is_multiple&&a&&(a.target===this.selected_item||a.target.up("a.chzn-single"))&&this.results_toggle():(this.is_multiple&&this.search_field.clear(),document.observe("click",this.click_test_action),this.results_show()),this.activate_field()):this.pending_destroy_click=!1},d.prototype.container_mouseup=function(a){if(a.target.nodeName==="ABBR")return this.results_reset(a)},d.prototype.blur_test=function(a){if(!this.active_field&&this.container.hasClassName("chzn-container-active"))return this.close_field()},d.prototype.close_field=function(){return document.stopObserving("click",this.click_test_action),this.is_multiple||(this.selected_item.tabIndex=this.search_field.tabIndex,this.search_field.tabIndex=-1),this.active_field=!1,this.results_hide(),this.container.removeClassName("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},d.prototype.activate_field=function(){return!this.is_multiple&&!this.active_field&&(this.search_field.tabIndex=this.selected_item.tabIndex,this.selected_item.tabIndex=-1),this.container.addClassName("chzn-container-active"),this.active_field=!0,this.search_field.value=this.search_field.value,this.search_field.focus()},d.prototype.test_active_click=function(a){return a.target.up("#"+this.container_id)?this.active_field=!0:this.close_field()},d.prototype.results_build=function(){var a,b,d,e,f;this.parsing=!0,this.results_data=c.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.select("li.search-choice").invoke("remove"),this.choices=0):this.is_multiple||(this.selected_item.down("span").update(this.default_text),this.form_field.options.length<=this.disable_search_threshold?this.container.addClassName("chzn-container-single-nosearch"):this.container.removeClassName("chzn-container-single-nosearch")),a="",f=this.results_data;for(d=0,e=f.length;d<e;d++)b=f[d],b.group?a+=this.result_add_group(b):b.empty||(a+=this.result_add_option(b),b.selected&&this.is_multiple?this.choice_build(b):b.selected&&!this.is_multiple&&(this.selected_item.removeClassName("chzn-default").down("span").update(b.html),this.allow_single_deselect&&this.single_deselect_control_build()));return this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.search_results.update(a),this.parsing=!1},d.prototype.result_add_group=function(a){return a.disabled?"":(a.dom_id=this.container_id+"_g_"+a.array_index,'<li id="'+a.dom_id+'" class="group-result">'+a.label.escapeHTML()+"</li>")},d.prototype.result_do_highlight=function(a){var b,c,d,e,f;this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClassName("highlighted"),d=parseInt(this.search_results.getStyle("maxHeight"),10),f=this.search_results.scrollTop,e=d+f,c=this.result_highlight.positionedOffset().top,b=c+this.result_highlight.getHeight();if(b>=e)return this.search_results.scrollTop=b-d>0?b-d:0;if(c<f)return this.search_results.scrollTop=c},d.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClassName("highlighted"),this.result_highlight=null},d.prototype.results_show=function(){var a;return this.is_multiple||(this.selected_item.addClassName("chzn-single-with-drop"),this.result_single_selected&&this.result_do_highlight(this.result_single_selected)),a=this.is_multiple?this.container.getHeight():this.container.getHeight()-1,this.dropdown.setStyle({top:a+"px",left:0}),this.results_showing=!0,this.search_field.focus(),this.search_field.value=this.search_field.value,this.winnow_results()},d.prototype.results_hide=function(){return this.is_multiple||this.selected_item.removeClassName("chzn-single-with-drop"),this.result_clear_highlight(),this.dropdown.setStyle({left:"-9000px"}),this.results_showing=!1},d.prototype.set_tab_index=function(a){var b;if(this.form_field.tabIndex)return b=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.is_multiple?this.search_field.tabIndex=b:(this.selected_item.tabIndex=b,this.search_field.tabIndex=-1)},d.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices<1&&!this.active_field?(this.search_field.value=this.default_text,this.search_field.addClassName("default")):(this.search_field.value="",this.search_field.removeClassName("default"))},d.prototype.search_results_mouseup=function(a){var b;b=a.target.hasClassName("active-result")?a.target:a.target.up(".active-result");if(b)return this.result_highlight=b,this.result_select(a)},d.prototype.search_results_mouseover=function(a){var b;b=a.target.hasClassName("active-result")?a.target:a.target.up(".active-result");if(b)return this.result_do_highlight(b)},d.prototype.search_results_mouseout=function(a){if(a.target.hasClassName("active-result")||a.target.up(".active-result"))return this.result_clear_highlight()},d.prototype.choices_click=function(a){a.preventDefault();if(this.active_field&&!a.target.hasClassName("search-choice")&&!a.target.up(".search-choice")&&!this.results_showing)return this.results_show()},d.prototype.choice_build=function(a){var b,c,d=this;return b=this.container_id+"_c_"+a.array_index,this.choices+=1,this.search_container.insert({before:this.choice_temp.evaluate({id:b,choice:a.html,position:a.array_index})}),c=$(b).down("a"),c.observe("click",function(a){return d.choice_destroy_link_click(a)})},d.prototype.choice_destroy_link_click=function(a){a.preventDefault();if(!this.is_disabled)return this.pending_destroy_click=!0,this.choice_destroy(a.target)},d.prototype.choice_destroy=function(a){return this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.value.length<1&&this.results_hide(),this.result_deselect(a.readAttribute("rel")),a.up("li").remove()},d.prototype.results_reset=function(a){this.form_field.options[0].selected=!0,this.selected_item.down("span").update(this.default_text),this.is_multiple||this.selected_item.addClassName("chzn-default"),this.show_search_field_default(),a.target.remove(),typeof Event.simulate=="function"&&this.form_field.simulate("change");if(this.active_field)return this.results_hide()},d.prototype.result_select=function(a){var b,c,d;if(this.result_highlight)return b=this.result_highlight,this.result_clear_highlight(),this.is_multiple?this.result_deactivate(b):(this.search_results.descendants(".result-selected").invoke("removeClassName","result-selected"),this.selected_item.removeClassName("chzn-default"),this.result_single_selected=b),b.addClassName("result-selected"),d=b.id.substr(b.id.lastIndexOf("_")+1),c=this.results_data[d],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.is_multiple?this.choice_build(c):(this.selected_item.down("span").update(c.html),this.allow_single_deselect&&this.single_deselect_control_build()),(!a.metaKey||!this.is_multiple)&&this.results_hide(),this.search_field.value="",typeof Event.simulate=="function"&&this.form_field.simulate("change"),this.search_field_scale()},d.prototype.result_activate=function(a){return a.addClassName("active-result")},d.prototype.result_deactivate=function(a){return a.removeClassName("active-result")},d.prototype.result_deselect=function(a){var b,c;return c=this.results_data[a],c.selected=!1,this.form_field.options[c.options_index].selected=!1,b=$(this.container_id+"_o_"+a),b.removeClassName("result-selected").addClassName("active-result").show(),this.result_clear_highlight(),this.winnow_results(),typeof Event.simulate=="function"&&this.form_field.simulate("change"),this.search_field_scale()},d.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&!this.selected_item.down("abbr"))return this.selected_item.down("span").insert({after:'<abbr class="search-choice-close"></abbr>'})},d.prototype.winnow_results=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;this.no_results_clear(),h=0,i=this.search_field.value===this.default_text?"":this.search_field.value.strip().escapeHTML(),f=this.search_contains?"":"^",e=new RegExp(f+i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),l=new RegExp(i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),q=this.results_data;for(m=0,o=q.length;m<o;m++){b=q[m];if(!b.disabled&&!b.empty)if(b.group)$(b.dom_id).hide();else if(!this.is_multiple||!b.selected){a=!1,g=b.dom_id;if(e.test(b.html))a=!0,h+=1;else if(b.html.indexOf(" ")>=0||b.html.indexOf("[")===0){d=b.html.replace(/\[|\]/g,"").split(" ");if(d.length)for(n=0,p=d.length;n<p;n++)c=d[n],e.test(c)&&(a=!0,h+=1)}a?(i.length?(j=b.html.search(l),k=b.html.substr(0,j+i.length)+"</em>"+b.html.substr(j+i.length),k=k.substr(0,j)+"<em>"+k.substr(j)):k=b.html,$(g).innerHTML!==k&&$(g).update(k),this.result_activate($(g)),b.group_array_index!=null&&$(this.results_data[b.group_array_index].dom_id).setStyle({display:"list-item"})):($(g)===this.result_highlight&&this.result_clear_highlight(),this.result_deactivate($(g)))}}return h<1&&i.length?this.no_results(i):this.winnow_results_set_highlight()},d.prototype.winnow_results_clear=function(){var a,b,c,d,e;this.search_field.clear(),b=this.search_results.select("li"),e=[];for(c=0,d=b.length;c<d;c++)a=b[c],a.hasClassName("group-result")?e.push(a.show()):!this.is_multiple||!a.hasClassName("result-selected")?e.push(this.result_activate(a)):e.push(void 0);return e},d.prototype.winnow_results_set_highlight=function(){var a;if(!this.result_highlight){this.is_multiple||(a=this.search_results.down(".result-selected.active-result")),a==null&&(a=this.search_results.down(".active-result"));if(a!=null)return this.result_do_highlight(a)}},d.prototype.no_results=function(a){return this.search_results.insert(this.no_results_temp.evaluate({terms:a}))},d.prototype.no_results_clear=function(){var a,b;a=null,b=[];while(a=this.search_results.down(".no-results"))b.push(a.remove());return b},d.prototype.keydown_arrow=function(){var a,b,c;a=this.search_results.select("li.active-result");if(a.length){this.result_highlight?this.results_showing&&(c=this.result_highlight.nextSiblings(),b=c.intersect(a),b.length&&this.result_do_highlight(b.first())):this.result_do_highlight(a.first());if(!this.results_showing)return this.results_show()}},d.prototype.keyup_arrow=function(){var a,b,c;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight)return c=this.result_highlight.previousSiblings(),a=this.search_results.select("li.active-result"),b=c.intersect(a),b.length?this.result_do_highlight(b.first()):(this.choices>0&&this.results_hide(),this.result_clear_highlight())},d.prototype.keydown_backstroke=function(){return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.down("a")),this.clear_backstroke()):(this.pending_backstroke=this.search_container.siblings("li.search-choice").last(),this.pending_backstroke.addClassName("search-choice-focus"))},d.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClassName("search-choice-focus"),this.pending_backstroke=null},d.prototype.keydown_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale(),b!==8&&this.pending_backstroke&&this.clear_backstroke();switch(b){case 8:this.backstroke_length=this.search_field.value.length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},d.prototype.search_field_scale=function(){var a,b,c,d,e,f,g,h,i;if(this.is_multiple){c=0,g=0,e="position:absolute; left: -1000px; top: -1000px; display:none;",f=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(h=0,i=f.length;h<i;h++)d=f[h],e+=d+":"+this.search_field.getStyle(d)+";";return b=(new Element("div",{style:e})).update(this.search_field.value.escapeHTML()),document.body.appendChild(b),g=Element.measure(b,"width")+25,b.remove(),g>this.f_width-10&&(g=this.f_width-10),this.search_field.setStyle({width:g+"px"}),a=this.container.getHeight(),this.dropdown.setStyle({top:a+"px"})}},d}(AbstractChosen),c.Chosen=a,Prototype.Browser.IE&&/MSIE (\d+\.\d+);/.test(navigator.userAgent)&&(Prototype.BrowserFeatures.Version=new Number(RegExp.$1)),b=function(a){var b,c;return b=new Element.Layout(a),c=b.get("border-left")+b.get("border-right")+b.get("padding-left")+b.get("padding-right")},c.get_side_border_padding=b}.call(this)
|
@ -40,7 +40,7 @@ class Chosen extends AbstractChosen
|
|||||||
if @is_multiple
|
if @is_multiple
|
||||||
container_div.html '<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + @default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'
|
container_div.html '<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + @default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'
|
||||||
else
|
else
|
||||||
container_div.html '<a href="javascript:void(0)" class="chzn-single"><span>' + @default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'
|
container_div.html '<a href="javascript:void(0)" class="chzn-single chzn-default"><span>' + @default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'
|
||||||
|
|
||||||
@form_field_jq.hide().after container_div
|
@form_field_jq.hide().after container_div
|
||||||
@container = ($ '#' + @container_id)
|
@container = ($ '#' + @container_id)
|
||||||
@ -108,7 +108,7 @@ class Chosen extends AbstractChosen
|
|||||||
container_mousedown: (evt) ->
|
container_mousedown: (evt) ->
|
||||||
if !@is_disabled
|
if !@is_disabled
|
||||||
target_closelink = if evt? then ($ evt.target).hasClass "search-choice-close" else false
|
target_closelink = if evt? then ($ evt.target).hasClass "search-choice-close" else false
|
||||||
if evt and evt.type is "mousedown"
|
if evt and evt.type is "mousedown" and not @results_showing
|
||||||
evt.stopPropagation()
|
evt.stopPropagation()
|
||||||
if not @pending_destroy_click and not target_closelink
|
if not @pending_destroy_click and not target_closelink
|
||||||
if not @active_field
|
if not @active_field
|
||||||
@ -187,7 +187,7 @@ class Chosen extends AbstractChosen
|
|||||||
if data.selected and @is_multiple
|
if data.selected and @is_multiple
|
||||||
this.choice_build data
|
this.choice_build data
|
||||||
else if data.selected and not @is_multiple
|
else if data.selected and not @is_multiple
|
||||||
@selected_item.find("span").text data.text
|
@selected_item.removeClass("chzn-default").find("span").text data.text
|
||||||
this.single_deselect_control_build() if @allow_single_deselect
|
this.single_deselect_control_build() if @allow_single_deselect
|
||||||
|
|
||||||
this.search_field_disabled()
|
this.search_field_disabled()
|
||||||
@ -315,6 +315,7 @@ class Chosen extends AbstractChosen
|
|||||||
results_reset: (evt) ->
|
results_reset: (evt) ->
|
||||||
@form_field.options[0].selected = true
|
@form_field.options[0].selected = true
|
||||||
@selected_item.find("span").text @default_text
|
@selected_item.find("span").text @default_text
|
||||||
|
@selected_item.addClass("chzn-default") if not @is_multiple
|
||||||
this.show_search_field_default()
|
this.show_search_field_default()
|
||||||
$(evt.target).remove();
|
$(evt.target).remove();
|
||||||
@form_field_jq.trigger "change"
|
@form_field_jq.trigger "change"
|
||||||
@ -332,6 +333,7 @@ class Chosen extends AbstractChosen
|
|||||||
else
|
else
|
||||||
@search_results.find(".result-selected").removeClass "result-selected"
|
@search_results.find(".result-selected").removeClass "result-selected"
|
||||||
@result_single_selected = high
|
@result_single_selected = high
|
||||||
|
@selected_item.removeClass("chzn-default")
|
||||||
|
|
||||||
high.addClass "result-selected"
|
high.addClass "result-selected"
|
||||||
|
|
||||||
@ -383,7 +385,8 @@ class Chosen extends AbstractChosen
|
|||||||
results = 0
|
results = 0
|
||||||
|
|
||||||
searchText = if @search_field.val() is @default_text then "" else $('<div/>').text($.trim(@search_field.val())).html()
|
searchText = if @search_field.val() is @default_text then "" else $('<div/>').text($.trim(@search_field.val())).html()
|
||||||
regex = new RegExp('^' + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i')
|
regexAnchor = if @search_contains then "" else "^"
|
||||||
|
regex = new RegExp(regexAnchor + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i')
|
||||||
zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i')
|
zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i')
|
||||||
|
|
||||||
for option in @results_data
|
for option in @results_data
|
||||||
|
@ -16,7 +16,7 @@ class Chosen extends AbstractChosen
|
|||||||
super()
|
super()
|
||||||
|
|
||||||
# HTML Templates
|
# HTML Templates
|
||||||
@single_temp = new Template('<a href="javascript:void(0)" class="chzn-single"><span>#{default}</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>')
|
@single_temp = new Template('<a href="javascript:void(0)" class="chzn-single chzn-default"><span>#{default}</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>')
|
||||||
@multi_temp = new Template('<ul class="chzn-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>')
|
@multi_temp = new Template('<ul class="chzn-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>')
|
||||||
@choice_temp = new Template('<li class="search-choice" id="#{id}"><span>#{choice}</span><a href="javascript:void(0)" class="search-choice-close" rel="#{position}"></a></li>')
|
@choice_temp = new Template('<li class="search-choice" id="#{id}"><span>#{choice}</span><a href="javascript:void(0)" class="search-choice-close" rel="#{position}"></a></li>')
|
||||||
@no_results_temp = new Template('<li class="no-results">' + @results_none_found + ' "<span>#{terms}</span>"</li>')
|
@no_results_temp = new Template('<li class="no-results">' + @results_none_found + ' "<span>#{terms}</span>"</li>')
|
||||||
@ -101,7 +101,7 @@ class Chosen extends AbstractChosen
|
|||||||
container_mousedown: (evt) ->
|
container_mousedown: (evt) ->
|
||||||
if !@is_disabled
|
if !@is_disabled
|
||||||
target_closelink = if evt? then evt.target.hasClassName "search-choice-close" else false
|
target_closelink = if evt? then evt.target.hasClassName "search-choice-close" else false
|
||||||
if evt and evt.type is "mousedown"
|
if evt and evt.type is "mousedown" and not @results_showing
|
||||||
evt.stop()
|
evt.stop()
|
||||||
if not @pending_destroy_click and not target_closelink
|
if not @pending_destroy_click and not target_closelink
|
||||||
if not @active_field
|
if not @active_field
|
||||||
@ -179,7 +179,7 @@ class Chosen extends AbstractChosen
|
|||||||
if data.selected and @is_multiple
|
if data.selected and @is_multiple
|
||||||
this.choice_build data
|
this.choice_build data
|
||||||
else if data.selected and not @is_multiple
|
else if data.selected and not @is_multiple
|
||||||
@selected_item.down("span").update( data.html )
|
@selected_item.removeClassName("chzn-default").down("span").update( data.html )
|
||||||
this.single_deselect_control_build() if @allow_single_deselect
|
this.single_deselect_control_build() if @allow_single_deselect
|
||||||
|
|
||||||
this.search_field_disabled()
|
this.search_field_disabled()
|
||||||
@ -308,6 +308,7 @@ class Chosen extends AbstractChosen
|
|||||||
results_reset: (evt) ->
|
results_reset: (evt) ->
|
||||||
@form_field.options[0].selected = true
|
@form_field.options[0].selected = true
|
||||||
@selected_item.down("span").update(@default_text)
|
@selected_item.down("span").update(@default_text)
|
||||||
|
@selected_item.addClassName("chzn-default") if not @is_multiple
|
||||||
this.show_search_field_default()
|
this.show_search_field_default()
|
||||||
evt.target.remove()
|
evt.target.remove()
|
||||||
@form_field.simulate("change") if typeof Event.simulate is 'function'
|
@form_field.simulate("change") if typeof Event.simulate is 'function'
|
||||||
@ -322,6 +323,7 @@ class Chosen extends AbstractChosen
|
|||||||
this.result_deactivate high
|
this.result_deactivate high
|
||||||
else
|
else
|
||||||
@search_results.descendants(".result-selected").invoke "removeClassName", "result-selected"
|
@search_results.descendants(".result-selected").invoke "removeClassName", "result-selected"
|
||||||
|
@selected_item.removeClassName("chzn-default")
|
||||||
@result_single_selected = high
|
@result_single_selected = high
|
||||||
|
|
||||||
high.addClassName("result-selected")
|
high.addClassName("result-selected")
|
||||||
@ -374,7 +376,8 @@ class Chosen extends AbstractChosen
|
|||||||
results = 0
|
results = 0
|
||||||
|
|
||||||
searchText = if @search_field.value is @default_text then "" else @search_field.value.strip().escapeHTML()
|
searchText = if @search_field.value is @default_text then "" else @search_field.value.strip().escapeHTML()
|
||||||
regex = new RegExp('^' + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i')
|
regexAnchor = if @search_contains then "" else "^"
|
||||||
|
regex = new RegExp(regexAnchor + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i')
|
||||||
zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i')
|
zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i')
|
||||||
|
|
||||||
for option in @results_data
|
for option in @results_data
|
||||||
|
@ -29,6 +29,7 @@ class AbstractChosen
|
|||||||
@result_single_selected = null
|
@result_single_selected = null
|
||||||
@allow_single_deselect = if @options.allow_single_deselect? and @form_field.options[0]? and @form_field.options[0].text is "" then @options.allow_single_deselect else false
|
@allow_single_deselect = if @options.allow_single_deselect? and @form_field.options[0]? and @form_field.options[0].text is "" then @options.allow_single_deselect else false
|
||||||
@disable_search_threshold = @options.disable_search_threshold || 0
|
@disable_search_threshold = @options.disable_search_threshold || 0
|
||||||
|
@search_contains = @options.search_contains || false
|
||||||
@choices = 0
|
@choices = 0
|
||||||
@results_none_found = @options.no_results_text or "No results match"
|
@results_none_found = @options.no_results_text or "No results match"
|
||||||
|
|
||||||
|
2
admin/thirdparty/chosen/example.proto.html
vendored
@ -1343,7 +1343,7 @@ orgia and The South Sandwich Islands">South Georgia and The South Sandwich Islan
|
|||||||
<p>Using Chosen is easy as can be.</p>
|
<p>Using Chosen is easy as can be.</p>
|
||||||
<ol>
|
<ol>
|
||||||
<li>Download the plugin and copy the chosen files to your app.</li>
|
<li>Download the plugin and copy the chosen files to your app.</li>
|
||||||
<li>Activate the plugin by creating a new instance of Chosen: New Chosen(<em>some_form_field</em>);</li>
|
<li>Activate the plugin by creating a new instance of Chosen: new Chosen(<em>some_form_field</em>);</li>
|
||||||
<li><a href="http://youtu.be/pS-RsIzb78U?t=57s">Disco</a>.</li>
|
<li><a href="http://youtu.be/pS-RsIzb78U?t=57s">Disco</a>.</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
|
2
admin/thirdparty/chosen/package.json
vendored
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"author": "harvest",
|
"author": "harvest",
|
||||||
"name": "chosen",
|
"name": "chosen",
|
||||||
"version": "0.9.7",
|
"version": "0.9.8",
|
||||||
"description": "Chosen is a JavaScript plugin that makes long, unwieldy select boxes much more user-friendly. It is currently available in both jQuery and Prototype flavors.",
|
"description": "Chosen is a JavaScript plugin that makes long, unwieldy select boxes much more user-friendly. It is currently available in both jQuery and Prototype flavors.",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -429,7 +429,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create State
|
// Create State
|
||||||
currentState = History.extractState(History.getFullUrl(currentHash||document.location.href,false),true);
|
// MODIFIED ischommer: URL normalization needs to respect our <base> tag,
|
||||||
|
// otherwise will go into infinite loops
|
||||||
|
currentState = History.extractState(History.getFullUrl(currentHash||document.location.href,true),true);
|
||||||
|
// END MODIFIED
|
||||||
|
|
||||||
// Check if we are the same state
|
// Check if we are the same state
|
||||||
if ( History.isLastSavedState(currentState) ) {
|
if ( History.isLastSavedState(currentState) ) {
|
||||||
|
@ -92,28 +92,28 @@ class Convert {
|
|||||||
return str_replace(array("\\", '"', "\n", "\r", "'"), array("\\\\", '\"', '\n', '\r', "\\'"), $val);
|
return str_replace(array("\\", '"', "\n", "\r", "'"), array("\\\\", '\"', '\n', '\r', "\\'"), $val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uses the PHP 5.2 native json_encode function if available,
|
* Encode a value as a JSON encoded string.
|
||||||
* otherwise falls back to the Services_JSON class.
|
|
||||||
*
|
|
||||||
* @see http://pear.php.net/pepr/pepr-proposal-show.php?id=198
|
|
||||||
* @uses Director::baseFolder()
|
|
||||||
* @uses Services_JSON
|
|
||||||
*
|
*
|
||||||
* @param mixed $val
|
* @param mixed $val Value to be encoded
|
||||||
* @return string JSON safe string
|
* @return string JSON encoded string
|
||||||
*/
|
*/
|
||||||
static function raw2json($val) {
|
static function raw2json($val) {
|
||||||
if(function_exists('json_encode')) {
|
return json_encode($val);
|
||||||
return json_encode($val);
|
|
||||||
} else {
|
|
||||||
require_once(Director::baseFolder() . '/sapphire/thirdparty/json/JSON.php');
|
|
||||||
$json = new Services_JSON();
|
|
||||||
return $json->encode($val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encode an array as a JSON encoded string.
|
||||||
|
* THis is an alias to {@link raw2json()}
|
||||||
|
*
|
||||||
|
* @param array $val Array to convert
|
||||||
|
* @return string JSON encoded string
|
||||||
|
*/
|
||||||
|
static function array2json($val) {
|
||||||
|
return self::raw2json($val);
|
||||||
|
}
|
||||||
|
|
||||||
static function raw2sql($val) {
|
static function raw2sql($val) {
|
||||||
if(is_array($val)) {
|
if(is_array($val)) {
|
||||||
foreach($val as $k => $v) $val[$k] = self::raw2sql($v);
|
foreach($val as $k => $v) $val[$k] = self::raw2sql($v);
|
||||||
@ -138,41 +138,15 @@ class Convert {
|
|||||||
else return html_entity_decode($val, ENT_QUOTES, 'UTF-8');
|
else return html_entity_decode($val, ENT_QUOTES, 'UTF-8');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert an array into a JSON encoded string.
|
|
||||||
*
|
|
||||||
* @see http://pear.php.net/pepr/pepr-proposal-show.php?id=198
|
|
||||||
* @uses Director::baseFolder()
|
|
||||||
* @uses Services_JSON
|
|
||||||
*
|
|
||||||
* @param array $val Array to convert
|
|
||||||
* @return string JSON encoded string
|
|
||||||
*/
|
|
||||||
static function array2json($val) {
|
|
||||||
if(function_exists('json_encode')) {
|
|
||||||
return json_encode($val);
|
|
||||||
} else {
|
|
||||||
require_once(Director::baseFolder() . '/sapphire/thirdparty/json/JSON.php');
|
|
||||||
$json = new Services_JSON();
|
|
||||||
return $json->encode($val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a JSON encoded string into an object.
|
* Convert a JSON encoded string into an object.
|
||||||
*
|
|
||||||
* @see http://pear.php.net/pepr/pepr-proposal-show.php?id=198
|
|
||||||
* @uses Director::baseFolder()
|
|
||||||
* @uses Services_JSON
|
|
||||||
*
|
*
|
||||||
* @param string $val
|
* @param string $val
|
||||||
* @return mixed JSON safe string
|
* @return object|boolean
|
||||||
*/
|
*/
|
||||||
static function json2obj($val) {
|
static function json2obj($val) {
|
||||||
require_once(Director::baseFolder() . '/sapphire/thirdparty/json/JSON.php');
|
return json_decode($val);
|
||||||
$json = new Services_JSON();
|
|
||||||
return $json->decode($val);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -183,15 +157,7 @@ class Convert {
|
|||||||
* @return array|boolean
|
* @return array|boolean
|
||||||
*/
|
*/
|
||||||
static function json2array($val) {
|
static function json2array($val) {
|
||||||
$json = self::json2obj($val);
|
return json_decode($val, true);
|
||||||
if(!$json) return false;
|
|
||||||
|
|
||||||
$arr = array();
|
|
||||||
foreach($json as $k => $v) {
|
|
||||||
$arr[$k] = $v;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $arr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,21 +38,8 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// ENVIRONMENT CONFIG
|
// ENVIRONMENT CONFIG
|
||||||
|
|
||||||
if(defined('E_DEPRECATED')) error_reporting(E_ALL & ~(E_DEPRECATED | E_STRICT));
|
if(defined('E_DEPRECATED')) error_reporting(E_ALL & ~(E_STRICT));
|
||||||
else error_reporting(E_ALL);
|
else error_reporting(E_ALL);
|
||||||
/*
|
|
||||||
* This is for versions of PHP prior to version 5.2
|
|
||||||
* Creating this here will allow both web requests and cron jobs to inherit it.
|
|
||||||
*/
|
|
||||||
if (!function_exists('array_fill_keys')) {
|
|
||||||
function array_fill_keys($keys,$value) {
|
|
||||||
//Sometimes we get passed an empty array, and if that's the case, you'll get an error message
|
|
||||||
if(sizeof($keys)==0)
|
|
||||||
return Array();
|
|
||||||
else
|
|
||||||
return array_combine($keys,array_fill(0,count($keys),$value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Include _ss_environment.php files
|
* Include _ss_environment.php files
|
||||||
|
@ -800,7 +800,7 @@ class Diff
|
|||||||
if(is_array($content)) $content = implode(',', $content);
|
if(is_array($content)) $content = implode(',', $content);
|
||||||
|
|
||||||
$content = str_replace(array(" ","<", ">"),array(" "," <", "> "),$content);
|
$content = str_replace(array(" ","<", ">"),array(" "," <", "> "),$content);
|
||||||
$candidateChunks = split("[\t\r\n ]+", $content);
|
$candidateChunks = preg_split("/[\t\r\n ]+/", $content);
|
||||||
while(list($i,$item) = each($candidateChunks)) {
|
while(list($i,$item) = each($candidateChunks)) {
|
||||||
if(isset($item[0]) && $item[0] == "<") {
|
if(isset($item[0]) && $item[0] == "<") {
|
||||||
$newChunk = $item;
|
$newChunk = $item;
|
||||||
|
@ -85,4 +85,4 @@ class SS_ClassLoader {
|
|||||||
return class_exists($class, false) || $this->getManifest()->getItemPath($class);
|
return class_exists($class, false) || $this->getManifest()->getItemPath($class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
/** ----------------------------------------------- Application Logo (CMS Logo) Must be 24px x 24px ------------------------------------------------ */
|
/** ----------------------------------------------- Application Logo (CMS Logo) Must be 24px x 24px ------------------------------------------------ */
|
||||||
#AssetUploadField { border-bottom: 0; -moz-box-shadow: none; -webkit-box-shadow: none; -o-box-shadow: none; box-shadow: none; }
|
#AssetUploadField { border-bottom: 0; -moz-box-shadow: none; -webkit-box-shadow: none; -o-box-shadow: none; box-shadow: none; }
|
||||||
|
|
||||||
|
body.cms.ss-uploadfield-edit-iframe { padding: 16px; overflow: auto; }
|
||||||
|
|
||||||
.ss-assetuploadfield h3 { border-bottom: 1px solid rgba(201, 205, 206, 0.8); -moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8); -webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8); -o-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8); margin: 0 0 8px; padding: 0 0 7px; clear: both; }
|
.ss-assetuploadfield h3 { border-bottom: 1px solid rgba(201, 205, 206, 0.8); -moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8); -webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8); -o-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8); margin: 0 0 8px; padding: 0 0 7px; clear: both; }
|
||||||
.ss-assetuploadfield .field { border-bottom: 0; }
|
.ss-assetuploadfield .field { border-bottom: 0; }
|
||||||
.ss-assetuploadfield .ss-uploadfield-files { margin: 0; padding: 0; }
|
.ss-assetuploadfield .ss-uploadfield-files { margin: 0; padding: 0; }
|
||||||
@ -30,7 +32,7 @@
|
|||||||
.ss-assetuploadfield .ss-uploadfield-files .ss-uploadfield-item-cancel { position: absolute; top: 7px; right: 7px; }
|
.ss-assetuploadfield .ss-uploadfield-files .ss-uploadfield-item-cancel { position: absolute; top: 7px; right: 7px; }
|
||||||
.ss-assetuploadfield .ss-uploadfield-files .ss-uploadfield-item-cancel button { display: block; overflow: hidden; text-indent: -9999px; padding: 0; margin: 0; border: 0; width: 16px; height: 16px; cursor: pointer; -moz-box-shadow: none; -webkit-box-shadow: none; -o-box-shadow: none; box-shadow: none; }
|
.ss-assetuploadfield .ss-uploadfield-files .ss-uploadfield-item-cancel button { display: block; overflow: hidden; text-indent: -9999px; padding: 0; margin: 0; border: 0; width: 16px; height: 16px; cursor: pointer; -moz-box-shadow: none; -webkit-box-shadow: none; -o-box-shadow: none; box-shadow: none; }
|
||||||
.ss-assetuploadfield .ss-uploadfield-files .ss-uploadfield-item-editform { /* don't use display none, for it will break jQuery('iframe').contents().height() */ height: 0; overflow: hidden; clear: both; }
|
.ss-assetuploadfield .ss-uploadfield-files .ss-uploadfield-item-editform { /* don't use display none, for it will break jQuery('iframe').contents().height() */ height: 0; overflow: hidden; clear: both; }
|
||||||
.ss-assetuploadfield .ss-uploadfield-files .ss-uploadfield-item-editform iframe { margin: 16px; width: 100%; }
|
.ss-assetuploadfield .ss-uploadfield-files .ss-uploadfield-item-editform iframe { width: 100%; }
|
||||||
.ss-assetuploadfield .ss-uploadfield-addfile .ss-uploadfield-item-info { float: left; margin: 19px 0 0; }
|
.ss-assetuploadfield .ss-uploadfield-addfile .ss-uploadfield-item-info { float: left; margin: 19px 0 0; }
|
||||||
.ss-assetuploadfield .ss-uploadfield-addfile .ss-uploadfield-fromcomputer { position: relative; overflow: hidden; display: block; margin: 0 10px 0 0; }
|
.ss-assetuploadfield .ss-uploadfield-addfile .ss-uploadfield-fromcomputer { position: relative; overflow: hidden; display: block; margin: 0 10px 0 0; }
|
||||||
.ss-assetuploadfield .ss-uploadfield-addfile .ss-uploadfield-item-uploador { float: left; font-weight: bold; font-size: 22px; padding: 0 20px; line-height: 70px; display: none; }
|
.ss-assetuploadfield .ss-uploadfield-addfile .ss-uploadfield-item-uploador { float: left; font-weight: bold; font-size: 22px; padding: 0 20px; line-height: 70px; display: none; }
|
||||||
|
@ -12,11 +12,12 @@
|
|||||||
.cms table.ss-gridfield-table thead { color: #1d2224; background: transparent; }
|
.cms table.ss-gridfield-table thead { color: #1d2224; background: transparent; }
|
||||||
.cms table.ss-gridfield-table thead tr.filter-header .fieldgroup { max-width: 512px; }
|
.cms table.ss-gridfield-table thead tr.filter-header .fieldgroup { max-width: 512px; }
|
||||||
.cms table.ss-gridfield-table tbody { background: #FFF; }
|
.cms table.ss-gridfield-table tbody { background: #FFF; }
|
||||||
|
.cms table.ss-gridfield-table tbody td { width: 100%; }
|
||||||
|
.cms table.ss-gridfield-table tbody td.col-buttons { width: auto; text-align: right; white-space: nowrap; }
|
||||||
.cms table.ss-gridfield-table tbody td button { border: none; background: none; margin: 0 0 0 2px; padding: 0; width: auto; text-shadow: none; }
|
.cms table.ss-gridfield-table tbody td button { border: none; background: none; margin: 0 0 0 2px; padding: 0; width: auto; text-shadow: none; }
|
||||||
.cms table.ss-gridfield-table tbody td button.ui-state-hover { background: none; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; }
|
.cms table.ss-gridfield-table tbody td button.ui-state-hover { background: none; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; }
|
||||||
.cms table.ss-gridfield-table tbody td button.ui-state-active { border: none; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; }
|
.cms table.ss-gridfield-table tbody td button.ui-state-active { border: none; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; }
|
||||||
.cms table.ss-gridfield-table tbody td a.edit-link { display: inline-block; width: 16px; height: 20px; text-indent: -9999em; background: url(../images/icons/document--pencil.png) no-repeat 0 1px; }
|
.cms table.ss-gridfield-table tbody td a.edit-link { display: inline-block; width: 16px; height: 20px; text-indent: 9999em; background: url(../images/icons/document--pencil.png) no-repeat 0 1px; }
|
||||||
.cms table.ss-gridfield-table tbody td.col-buttons { white-space: nowrap; }
|
|
||||||
.cms table.ss-gridfield-table tfoot { color: #1d2224; }
|
.cms table.ss-gridfield-table tfoot { color: #1d2224; }
|
||||||
.cms table.ss-gridfield-table tfoot tr td { background: #95a5ab; padding: .7em; border-bottom: 1px solid rgba(0, 0, 0, 0.1); }
|
.cms table.ss-gridfield-table tfoot tr td { background: #95a5ab; padding: .7em; border-bottom: 1px solid rgba(0, 0, 0, 0.1); }
|
||||||
.cms table.ss-gridfield-table tr.title { -moz-border-radius-topleft: 7px; -webkit-border-top-left-radius: 7px; -o-border-top-left-radius: 7px; -ms-border-top-left-radius: 7px; -khtml-border-top-left-radius: 7px; border-top-left-radius: 7px; -moz-border-radius-topright: 7px; -webkit-border-top-right-radius: 7px; -o-border-top-right-radius: 7px; -ms-border-top-right-radius: 7px; -khtml-border-top-right-radius: 7px; border-top-right-radius: 7px; }
|
.cms table.ss-gridfield-table tr.title { -moz-border-radius-topleft: 7px; -webkit-border-top-left-radius: 7px; -o-border-top-left-radius: 7px; -ms-border-top-left-radius: 7px; -khtml-border-top-left-radius: 7px; border-top-left-radius: 7px; -moz-border-radius-topright: 7px; -webkit-border-top-right-radius: 7px; -o-border-top-right-radius: 7px; -ms-border-top-right-radius: 7px; -khtml-border-top-right-radius: 7px; border-top-right-radius: 7px; }
|
||||||
@ -45,6 +46,7 @@
|
|||||||
.cms table.ss-gridfield-table tr th.action { border-right: 0; }
|
.cms table.ss-gridfield-table tr th.action { border-right: 0; }
|
||||||
.cms table.ss-gridfield-table tr th.first { -moz-border-radius-topleft: 7px; -webkit-border-top-left-radius: 7px; -o-border-top-left-radius: 7px; -ms-border-top-left-radius: 7px; -khtml-border-top-left-radius: 7px; border-top-left-radius: 7px; }
|
.cms table.ss-gridfield-table tr th.first { -moz-border-radius-topleft: 7px; -webkit-border-top-left-radius: 7px; -o-border-top-left-radius: 7px; -ms-border-top-left-radius: 7px; -khtml-border-top-left-radius: 7px; border-top-left-radius: 7px; }
|
||||||
.cms table.ss-gridfield-table tr th.last { -moz-border-radius-topright: 7px; -webkit-border-top-right-radius: 7px; -o-border-top-right-radius: 7px; -ms-border-top-right-radius: 7px; -khtml-border-top-right-radius: 7px; border-top-right-radius: 7px; }
|
.cms table.ss-gridfield-table tr th.last { -moz-border-radius-topright: 7px; -webkit-border-top-right-radius: 7px; -o-border-top-right-radius: 7px; -ms-border-top-right-radius: 7px; -khtml-border-top-right-radius: 7px; border-top-right-radius: 7px; }
|
||||||
|
.cms table.ss-gridfield-table tr th button#action_gridfield_relationadd:hover { color: #444 !important; /* Not sure why IE think it needs this */ }
|
||||||
.cms table.ss-gridfield-table tr th button:hover { color: #ccc !important; /* Not sure why IE think it needs this */ }
|
.cms table.ss-gridfield-table tr th button:hover { color: #ccc !important; /* Not sure why IE think it needs this */ }
|
||||||
.cms table.ss-gridfield-table tr th button.ss-gridfield-sort:hover { color: #fff !important; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; }
|
.cms table.ss-gridfield-table tr th button.ss-gridfield-sort:hover { color: #fff !important; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; }
|
||||||
.cms table.ss-gridfield-table tr th button.ss-gridfield-sort { background: transparent url(../images/arrows.png) no-repeat right 6px; border: none; width: 100%; text-align: left; padding: 4px 0; text-shadow: rgba(0, 0, 0, 0.3) 0px -1px 0; color: #fff; -moz-border-radius: 0; -webkit-border-radius: 0; -o-border-radius: 0; -ms-border-radius: 0; -khtml-border-radius: 0; border-radius: 0; }
|
.cms table.ss-gridfield-table tr th button.ss-gridfield-sort { background: transparent url(../images/arrows.png) no-repeat right 6px; border: none; width: 100%; text-align: left; padding: 4px 0; text-shadow: rgba(0, 0, 0, 0.3) 0px -1px 0; color: #fff; -moz-border-radius: 0; -webkit-border-radius: 0; -o-border-radius: 0; -ms-border-radius: 0; -khtml-border-radius: 0; border-radius: 0; }
|
||||||
|
@ -697,6 +697,8 @@ function errorHandler($errno, $errstr, $errfile, $errline) {
|
|||||||
|
|
||||||
case E_NOTICE:
|
case E_NOTICE:
|
||||||
case E_USER_NOTICE:
|
case E_USER_NOTICE:
|
||||||
|
case E_DEPRECATED:
|
||||||
|
case E_USER_DEPRECATED:
|
||||||
Debug::noticeHandler($errno, $errstr, $errfile, $errline, null);
|
Debug::noticeHandler($errno, $errstr, $errfile, $errline, null);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,14 @@ class DebugView extends Object {
|
|||||||
'title' => 'User Notice',
|
'title' => 'User Notice',
|
||||||
'class' => 'notice'
|
'class' => 'notice'
|
||||||
),
|
),
|
||||||
|
E_DEPRECATED => array(
|
||||||
|
'title' => 'Deprecation',
|
||||||
|
'class' => 'notice'
|
||||||
|
),
|
||||||
|
E_USER_DEPRECATED => array(
|
||||||
|
'title' => 'Deprecation',
|
||||||
|
'class' => 'notice'
|
||||||
|
),
|
||||||
E_CORE_ERROR => array(
|
E_CORE_ERROR => array(
|
||||||
'title' => 'Core Error',
|
'title' => 'Core Error',
|
||||||
'class' => 'error'
|
'class' => 'error'
|
||||||
|
@ -143,6 +143,9 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
|||||||
i18n::set_date_format(null);
|
i18n::set_date_format(null);
|
||||||
i18n::set_time_format(null);
|
i18n::set_time_format(null);
|
||||||
|
|
||||||
|
// Set default timezone consistently to avoid NZ-specific dependencies
|
||||||
|
date_default_timezone_set('UTC');
|
||||||
|
|
||||||
// Remove password validation
|
// Remove password validation
|
||||||
$this->originalMemberPasswordValidator = Member::password_validator();
|
$this->originalMemberPasswordValidator = Member::password_validator();
|
||||||
$this->originalRequirements = Requirements::backend();
|
$this->originalRequirements = Requirements::backend();
|
||||||
@ -272,6 +275,9 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
|||||||
// which is used in DatabaseAdmin->doBuild()
|
// which is used in DatabaseAdmin->doBuild()
|
||||||
global $_SINGLETONS;
|
global $_SINGLETONS;
|
||||||
$_SINGLETONS = array();
|
$_SINGLETONS = array();
|
||||||
|
|
||||||
|
// Set default timezone consistently to avoid NZ-specific dependencies
|
||||||
|
date_default_timezone_set('UTC');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -765,7 +771,10 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
|||||||
// Disable PHPUnit error handling
|
// Disable PHPUnit error handling
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
|
|
||||||
// Create a temporary database
|
// Create a temporary database, and force the connection to use UTC for time
|
||||||
|
global $databaseConfig;
|
||||||
|
$databaseConfig['timezone'] = '+0:00';
|
||||||
|
DB::connect($databaseConfig);
|
||||||
$dbConn = DB::getConn();
|
$dbConn = DB::getConn();
|
||||||
$prefix = defined('SS_DATABASE_PREFIX') ? SS_DATABASE_PREFIX : 'ss_';
|
$prefix = defined('SS_DATABASE_PREFIX') ? SS_DATABASE_PREFIX : 'ss_';
|
||||||
$dbname = strtolower(sprintf('%stmpdb', $prefix)) . rand(1000000,9999999);
|
$dbname = strtolower(sprintf('%stmpdb', $prefix)) . rand(1000000,9999999);
|
||||||
|
@ -402,9 +402,9 @@ class InstallRequirements {
|
|||||||
$this->requireDateTimezone(array('PHP Configuration', 'date.timezone set and valid', 'date.timezone option in php.ini must be set in PHP 5.3.0+', ini_get('date.timezone')));
|
$this->requireDateTimezone(array('PHP Configuration', 'date.timezone set and valid', 'date.timezone option in php.ini must be set in PHP 5.3.0+', ini_get('date.timezone')));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->suggestPHPSetting('asp_tags', array(''), array('PHP Configuration', 'asp_tags option turned off', 'This should be turned off as it can cause issues with SilverStripe'));
|
$this->suggestPHPSetting('asp_tags', array(false,0,''), array('PHP Configuration', 'asp_tags option turned off', 'This should be turned off as it can cause issues with SilverStripe'));
|
||||||
$this->suggestPHPSetting('magic_quotes_gpc', array(''), array('PHP Configuration', 'magic_quotes_gpc option turned off', 'This should be turned off, as it can cause issues with cookies. More specifically, unserializing data stored in cookies.'));
|
$this->suggestPHPSetting('magic_quotes_gpc', array(false,0,''), array('PHP Configuration', 'magic_quotes_gpc option turned off', 'This should be turned off, as it can cause issues with cookies. More specifically, unserializing data stored in cookies.'));
|
||||||
$this->suggestPHPSetting('display_errors', array(''), array('PHP Configuration', 'display_errors option turned off', 'Unless you\'re in a development environment, this should be turned off, as it can expose sensitive data to website users.'));
|
$this->suggestPHPSetting('display_errors', array(false,0,''), array('PHP Configuration', 'display_errors option turned off', 'Unless you\'re in a development environment, this should be turned off, as it can expose sensitive data to website users.'));
|
||||||
|
|
||||||
// Check memory allocation
|
// Check memory allocation
|
||||||
$this->requireMemory(32*1024*1024, 64*1024*1024, array("PHP Configuration", "Memory allocated (PHP config option 'memory_limit')", "SilverStripe needs a minimum of 32M allocated to PHP, but recommends 64M.", ini_get("memory_limit")));
|
$this->requireMemory(32*1024*1024, 64*1024*1024, array("PHP Configuration", "Memory allocated (PHP config option 'memory_limit')", "SilverStripe needs a minimum of 32M allocated to PHP, but recommends 64M.", ini_get("memory_limit")));
|
||||||
@ -414,7 +414,6 @@ class InstallRequirements {
|
|||||||
|
|
||||||
function suggestPHPSetting($settingName, $settingValues, $testDetails) {
|
function suggestPHPSetting($settingName, $settingValues, $testDetails) {
|
||||||
$this->testing($testDetails);
|
$this->testing($testDetails);
|
||||||
|
|
||||||
$val = ini_get($settingName);
|
$val = ini_get($settingName);
|
||||||
if(!in_array($val, $settingValues) && $val != $settingValues) {
|
if(!in_array($val, $settingValues) && $val != $settingValues) {
|
||||||
$testDetails[2] = "$settingName is set to '$val' in php.ini. $testDetails[2]";
|
$testDetails[2] = "$settingName is set to '$val' in php.ini. $testDetails[2]";
|
||||||
|
@ -113,6 +113,38 @@ As with any SilverStripe upgrade, we recommend database backups before calling `
|
|||||||
See [mysql.com](http://dev.mysql.com/doc/refman/5.5/en/converting-tables-to-innodb.html) for details on the conversion.
|
See [mysql.com](http://dev.mysql.com/doc/refman/5.5/en/converting-tables-to-innodb.html) for details on the conversion.
|
||||||
Note: MySQL has made InnoDB the default engine in its [5.5 release](http://dev.mysql.com/doc/refman/5.5/en/innodb-storage-engine.html).
|
Note: MySQL has made InnoDB the default engine in its [5.5 release](http://dev.mysql.com/doc/refman/5.5/en/innodb-storage-engine.html).
|
||||||
|
|
||||||
|
### Convert::json2array() changes ###
|
||||||
|
|
||||||
|
Convert JSON functions have been changed to use built-in json PHP functions `json_decode()` and `json_encode()`
|
||||||
|
|
||||||
|
Because `json_decode()` will convert nested JSON structures to arrays as well, this has changed the way it worked,
|
||||||
|
as before nested structures would be converted to an object instead.
|
||||||
|
|
||||||
|
So, given the following JSON input to `Convert::json2array()`:
|
||||||
|
|
||||||
|
{"Joe":"Bloggs","Tom":"Jones","My":{"Complicated":"Structure"}}
|
||||||
|
|
||||||
|
Here's the output from SilverStripe 2.4, with nested JSON as objects:
|
||||||
|
|
||||||
|
array(
|
||||||
|
'Joe' => 'Bloggs'
|
||||||
|
'Tom' => 'Jones',
|
||||||
|
'My' => stdObject(
|
||||||
|
Complicated => 'Structure' // property on object
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
Now in SilverStripe 3.x, nested structures are arrays:
|
||||||
|
|
||||||
|
array(
|
||||||
|
'Joe' => 'Bloggs',
|
||||||
|
'Tom' => 'Jones',
|
||||||
|
'My' => array(
|
||||||
|
'Complicated' => 'Structure' // key value on nested array
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
### GridField: Replacement for TableListField and ComplexTableField ###
|
### GridField: Replacement for TableListField and ComplexTableField ###
|
||||||
|
|
||||||
We have a new component for managing lists of objects: The `[GridField](/topics/grid-field)`.
|
We have a new component for managing lists of objects: The `[GridField](/topics/grid-field)`.
|
||||||
|
@ -26,7 +26,7 @@ SilverStripe core is currently hosted on [github.com/silverstripe](http://github
|
|||||||
* The `installer` project ([github.com/silverstripe/silverstripe-installer](http://github.com/silverstripe/silverstripe-installer))
|
* The `installer` project ([github.com/silverstripe/silverstripe-installer](http://github.com/silverstripe/silverstripe-installer))
|
||||||
* The `sapphire` module ([github.com/silverstripe/sapphire](http://github.com/silverstripe/sapphire))
|
* The `sapphire` module ([github.com/silverstripe/sapphire](http://github.com/silverstripe/sapphire))
|
||||||
* The `cms` module ([github.com/silverstripe/silverstripe-cms](http://github.com/silverstripe/silverstripe-cms))
|
* The `cms` module ([github.com/silverstripe/silverstripe-cms](http://github.com/silverstripe/silverstripe-cms))
|
||||||
* A sample theme called `blackcandy` ([github.com/silverstripe-themes/silverstripe-blackcandy](http://github.com/silverstripe-themes/silverstripe-blackcandy))
|
* A sample theme called `simple` ([github.com/silverstripe-themes/silverstripe-simple](http://github.com/silverstripe-themes/silverstripe-simple))
|
||||||
|
|
||||||
First, you'll have to decide what you want to do with your project:
|
First, you'll have to decide what you want to do with your project:
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ Run the following command to download all core dependencies via [Piston](http://
|
|||||||
cd my-silverstripe-project/
|
cd my-silverstripe-project/
|
||||||
tools/new-project
|
tools/new-project
|
||||||
|
|
||||||
This will add `sapphire`, `cms` and the `blackcandy` theme to your project.
|
This will add `sapphire`, `cms` and the `simple` theme to your project.
|
||||||
|
|
||||||
As a fallback solution, you can simply download all necessary files without any dependency management through piston.
|
As a fallback solution, you can simply download all necessary files without any dependency management through piston.
|
||||||
This is handy if you have an existing project in version control, and want a one-off snapshot
|
This is handy if you have an existing project in version control, and want a one-off snapshot
|
||||||
@ -146,8 +146,7 @@ Please replace `<username>` below with your github username.
|
|||||||
cd my-silverstripe-project
|
cd my-silverstripe-project
|
||||||
git clone git@github.com:<username>/sapphire.git sapphire
|
git clone git@github.com:<username>/sapphire.git sapphire
|
||||||
git clone git@github.com:<username>/silverstripe-cms.git cms
|
git clone git@github.com:<username>/silverstripe-cms.git cms
|
||||||
rm -rf themes
|
git clone git@github.com:<username>/silverstripe-simple.git themes/simple
|
||||||
git clone git@github.com:<username>/silverstripe-blackcandy.git themes
|
|
||||||
|
|
||||||
Now you need to add the original repository as `upstream`, so you can keep your fork updated later on.
|
Now you need to add the original repository as `upstream`, so you can keep your fork updated later on.
|
||||||
|
|
||||||
@ -155,7 +154,7 @@ Now you need to add the original repository as `upstream`, so you can keep your
|
|||||||
(git remote add upstream git://github.com/silverstripe/silverstripe-installer.git && git fetch upstream)
|
(git remote add upstream git://github.com/silverstripe/silverstripe-installer.git && git fetch upstream)
|
||||||
(cd sapphire && git remote add upstream git://github.com/silverstripe/sapphire.git && git fetch upstream)
|
(cd sapphire && git remote add upstream git://github.com/silverstripe/sapphire.git && git fetch upstream)
|
||||||
(cd cms && git remote add upstream git://github.com/silverstripe/silverstripe-cms.git && git fetch upstream)
|
(cd cms && git remote add upstream git://github.com/silverstripe/silverstripe-cms.git && git fetch upstream)
|
||||||
(cd themes/blackcandy && git remote add upstream git://github.com/silverstripe-themes/silverstripe-blackcandy.git)
|
(cd themes/simple && git remote add upstream git://github.com/silverstripe-themes/silverstripe-simple.git)
|
||||||
|
|
||||||
Now that you're set up, please read our ["Collaboration on Git"](../misc/collaboration-on-git) guide,
|
Now that you're set up, please read our ["Collaboration on Git"](../misc/collaboration-on-git) guide,
|
||||||
as well as our general ["Contributor guidelines"](../misc/contributing).
|
as well as our general ["Contributor guidelines"](../misc/contributing).
|
||||||
@ -175,7 +174,7 @@ You can optionally select a ["release branch"](https://github.com/silverstripe/s
|
|||||||
git checkout -b 2.4 origin/2.4
|
git checkout -b 2.4 origin/2.4
|
||||||
(cd sapphire && git checkout -b 2.4 origin/2.4)
|
(cd sapphire && git checkout -b 2.4 origin/2.4)
|
||||||
(cd cms && git checkout -b 2.4 origin/2.4)
|
(cd cms && git checkout -b 2.4 origin/2.4)
|
||||||
(cd themes/blackcandy && git checkout -b 2.4 origin/2.4)
|
(cd themes/simple && git checkout -b 2.4 origin/2.4)
|
||||||
# repeat for all modules in your project...
|
# repeat for all modules in your project...
|
||||||
|
|
||||||
After creating the local branch, you can simply switch between branches:
|
After creating the local branch, you can simply switch between branches:
|
||||||
@ -184,7 +183,7 @@ After creating the local branch, you can simply switch between branches:
|
|||||||
git checkout 2.4
|
git checkout 2.4
|
||||||
(cd sapphire && git checkout 2.4)
|
(cd sapphire && git checkout 2.4)
|
||||||
(cd cms && git checkout 2.4)
|
(cd cms && git checkout 2.4)
|
||||||
(cd themes/blackcandy && git checkout 2.4)
|
(cd themes/simple && git checkout 2.4)
|
||||||
# repeat for all modules in your project...
|
# repeat for all modules in your project...
|
||||||
|
|
||||||
To switch back to master:
|
To switch back to master:
|
||||||
@ -193,7 +192,7 @@ To switch back to master:
|
|||||||
git checkout master
|
git checkout master
|
||||||
(cd sapphire && git checkout master)
|
(cd sapphire && git checkout master)
|
||||||
(cd cms && git checkout master)
|
(cd cms && git checkout master)
|
||||||
(cd themes/blackcandy && git checkout master)
|
(cd themes/simple && git checkout master)
|
||||||
# repeat for all modules in your project...
|
# repeat for all modules in your project...
|
||||||
|
|
||||||
You can't switch branches if your working copy has local changes (typically in `mysite/_config.php`).
|
You can't switch branches if your working copy has local changes (typically in `mysite/_config.php`).
|
||||||
|
@ -87,7 +87,6 @@ We'll start with the *ArticlePage* page type. First we create the model, a class
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
||||||
Here we've created our data object/controller pair, but we haven't actually extended them at all. Don't worry about the
|
Here we've created our data object/controller pair, but we haven't actually extended them at all. Don't worry about the
|
||||||
@ -116,8 +115,6 @@ Let's create the *ArticleHolder* page type.
|
|||||||
class ArticleHolder_Controller extends Page_Controller {
|
class ArticleHolder_Controller extends Page_Controller {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
||||||
Here we have done something interesting: the *$allowed_children* field. This is one of a number of static fields we can
|
Here we have done something interesting: the *$allowed_children* field. This is one of a number of static fields we can
|
||||||
@ -249,7 +246,7 @@ Let's walk through these changes.
|
|||||||
*$dateField* is added only to the DateField in order to change the configuration.
|
*$dateField* is added only to the DateField in order to change the configuration.
|
||||||
|
|
||||||
:::php
|
:::php
|
||||||
$dateField->setConfig('showCalendar', true);
|
$dateField->setConfig('showcalendar', true);
|
||||||
|
|
||||||
Set *showCalendar* to true to have a calendar appear underneath the Date field when you click on the field.
|
Set *showCalendar* to true to have a calendar appear underneath the Date field when you click on the field.
|
||||||
|
|
||||||
@ -424,44 +421,6 @@ This will change the icons for the pages in the CMS.
|
|||||||
|
|
||||||
![](_images/icons2.jpg)
|
![](_images/icons2.jpg)
|
||||||
|
|
||||||
### Allowing comments on news articles
|
|
||||||
|
|
||||||
A handy feature built into SilverStripe is the ability for guests to your site to leave comments on pages. We can turn
|
|
||||||
this on for an article simply by ticking the box in the behaviour tab of a page in the CMS. Enable this for all your
|
|
||||||
*ArticlePage*s.
|
|
||||||
|
|
||||||
![](_images/comments.jpg)
|
|
||||||
|
|
||||||
We then need to include *$PageComments* in our template, which will insert the comment form as well as all comments left
|
|
||||||
on the page.
|
|
||||||
|
|
||||||
**themes/tutorial/templates/Layout/ArticlePage.ss**
|
|
||||||
|
|
||||||
:::html
|
|
||||||
...
|
|
||||||
<div class="newsDetails">
|
|
||||||
Posted on $Date.Nice by $Author
|
|
||||||
</div>
|
|
||||||
$PageComments
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
You should also prepare the *Page* template in the same manner, so comments can be enabled at a later point on any page.
|
|
||||||
|
|
||||||
![](_images/news-comments.jpg)
|
|
||||||
|
|
||||||
It would be nice to have comments on for all articles by default. We can do this with the *$defaults* array. Add this to
|
|
||||||
the *ArticlePage* class:
|
|
||||||
|
|
||||||
:::php
|
|
||||||
static $defaults = array(
|
|
||||||
'ProvideComments' => true
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
You can set defaults for any of the fields in your data object. *ProvideComments* is defined in *SiteTree*, so it is
|
|
||||||
part of our *ArticlePage* data object.
|
|
||||||
|
|
||||||
## Showing the latest news on the homepage
|
## Showing the latest news on the homepage
|
||||||
|
|
||||||
It would be nice to greet page visitors with a summary of the latest news when they visit the homepage. This requires a
|
It would be nice to greet page visitors with a summary of the latest news when they visit the homepage. This requires a
|
||||||
|
@ -316,10 +316,13 @@ class File extends DataObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the fields to power the edit screen of files in the CMS
|
* Returns the fields to power the edit screen of files in the CMS.
|
||||||
|
* You can modify this FieldList by subclassing folder, or by creating a {@link DataExtension}
|
||||||
|
* and implemeting updateCMSFields(FieldList $fields) on that extension.
|
||||||
|
*
|
||||||
* @return FieldList
|
* @return FieldList
|
||||||
*/
|
*/
|
||||||
function getCMSFields() {
|
function getCMSFields($params = null) {
|
||||||
// Preview
|
// Preview
|
||||||
if($this instanceof Image) {
|
if($this instanceof Image) {
|
||||||
$formattedImage = $this->getFormattedImage('SetWidth', Image::$asset_preview_width);
|
$formattedImage = $this->getFormattedImage('SetWidth', Image::$asset_preview_width);
|
||||||
@ -383,6 +386,9 @@ class File extends DataObject {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Folder has its own updateCMSFields hook
|
||||||
|
if(!($this instanceof Folder)) $this->extend('updateCMSFields', $fields);
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -816,8 +822,8 @@ class File extends DataObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function flushCache() {
|
public function flushCache($persistant = true) {
|
||||||
parent::flushCache();
|
parent::flushCache($persistant);
|
||||||
|
|
||||||
self::$cache_file_fields = null;
|
self::$cache_file_fields = null;
|
||||||
}
|
}
|
||||||
|
@ -406,7 +406,7 @@ class Folder extends File {
|
|||||||
* You can modify this FieldList by subclassing folder, or by creating a {@link DataExtension}
|
* You can modify this FieldList by subclassing folder, or by creating a {@link DataExtension}
|
||||||
* and implemeting updateCMSFields(FieldList $fields) on that extension.
|
* and implemeting updateCMSFields(FieldList $fields) on that extension.
|
||||||
*/
|
*/
|
||||||
function getCMSFields() {
|
function getCMSFields($param = null) {
|
||||||
// Hide field on root level, which can't be renamed
|
// Hide field on root level, which can't be renamed
|
||||||
if(!$this->ID || $this->ID === "root") {
|
if(!$this->ID || $this->ID === "root") {
|
||||||
$titleField = new HiddenField("Name");
|
$titleField = new HiddenField("Name");
|
||||||
|
@ -64,6 +64,11 @@ class GD extends Object {
|
|||||||
$width = round($width);
|
$width = round($width);
|
||||||
$height = round($height);
|
$height = round($height);
|
||||||
|
|
||||||
|
// Check that a resize is actually necessary.
|
||||||
|
if ($width == $this->width && $height == $this->height) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
$newGD = imagecreatetruecolor($width, $height);
|
$newGD = imagecreatetruecolor($width, $height);
|
||||||
|
|
||||||
// Preserves transparency between images
|
// Preserves transparency between images
|
||||||
@ -125,6 +130,11 @@ class GD extends Object {
|
|||||||
$width = round($width);
|
$width = round($width);
|
||||||
$height = round($height);
|
$height = round($height);
|
||||||
|
|
||||||
|
// Check that a resize is actually necessary.
|
||||||
|
if ($width == $this->width && $height == $this->height) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
if(!$width && !$height) user_error("No dimensions given", E_USER_ERROR);
|
if(!$width && !$height) user_error("No dimensions given", E_USER_ERROR);
|
||||||
if(!$width) user_error("Width not given", E_USER_ERROR);
|
if(!$width) user_error("Width not given", E_USER_ERROR);
|
||||||
if(!$height) user_error("Height not given", E_USER_ERROR);
|
if(!$height) user_error("Height not given", E_USER_ERROR);
|
||||||
@ -299,6 +309,10 @@ class GD extends Object {
|
|||||||
$width = round($width);
|
$width = round($width);
|
||||||
$height = round($height);
|
$height = round($height);
|
||||||
|
|
||||||
|
// Check that a resize is actually necessary.
|
||||||
|
if ($width == $this->width && $height == $this->height) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
$newGD = imagecreatetruecolor($width, $height);
|
$newGD = imagecreatetruecolor($width, $height);
|
||||||
|
|
||||||
|
@ -196,8 +196,13 @@ class DateField extends TextField {
|
|||||||
// Setting in correct locale
|
// Setting in correct locale
|
||||||
if(is_array($val) && $this->validateArrayValue($val)) {
|
if(is_array($val) && $this->validateArrayValue($val)) {
|
||||||
// set() gets confused with custom date formats when using array notation
|
// set() gets confused with custom date formats when using array notation
|
||||||
$this->valueObj = new Zend_Date($val, null, $this->locale);
|
if(!(empty($val['day']) || empty($val['month']) || empty($val['year']))) {
|
||||||
$this->value = $this->valueObj->toArray();
|
$this->valueObj = new Zend_Date($val, null, $this->locale);
|
||||||
|
$this->value = $this->valueObj->toArray();
|
||||||
|
} else {
|
||||||
|
$this->value = $val;
|
||||||
|
$this->valueObj = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// load ISO date from database (usually through Form->loadDataForm())
|
// load ISO date from database (usually through Form->loadDataForm())
|
||||||
else if(!empty($val) && Zend_Date::isDate($val, $this->getConfig('datavalueformat'), $this->locale)) {
|
else if(!empty($val) && Zend_Date::isDate($val, $this->getConfig('datavalueformat'), $this->locale)) {
|
||||||
|
@ -28,10 +28,10 @@
|
|||||||
*
|
*
|
||||||
* <code>
|
* <code>
|
||||||
* //Database request for the object
|
* //Database request for the object
|
||||||
* $myDoSet = DataObject::get("FooBars","");
|
* $myDoSet = DataList::create("FooBars","");
|
||||||
* if($myDoSet){
|
* if($myDoSet){
|
||||||
* // This returns an array of ID => Title
|
* // This returns an array of ID => Title
|
||||||
* $map = $myDoSet->toDropDownMap();
|
* $map = $myDoSet->map();
|
||||||
*
|
*
|
||||||
* // Instantiate the OptionsetField
|
* // Instantiate the OptionsetField
|
||||||
* $FieldList = new FieldList(
|
* $FieldList = new FieldList(
|
||||||
|
@ -343,7 +343,7 @@ class TreeDropdownField extends FormField {
|
|||||||
class TreeDropdownField_Readonly extends TreeDropdownField {
|
class TreeDropdownField_Readonly extends TreeDropdownField {
|
||||||
protected $readonly = true;
|
protected $readonly = true;
|
||||||
|
|
||||||
function Field() {
|
function Field($properties = array()) {
|
||||||
$fieldName = $this->labelField;
|
$fieldName = $this->labelField;
|
||||||
if($this->value) {
|
if($this->value) {
|
||||||
$keyObj = $this->objectForKey($this->value);
|
$keyObj = $this->objectForKey($this->value);
|
||||||
@ -361,4 +361,4 @@ class TreeDropdownField_Readonly extends TreeDropdownField {
|
|||||||
$field->setForm($this->form);
|
$field->setForm($this->form);
|
||||||
return $field->Field();
|
return $field->Field();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -782,8 +782,8 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
|
|||||||
return {
|
return {
|
||||||
'src' : this.find(':input[name=URL]').val(),
|
'src' : this.find(':input[name=URL]').val(),
|
||||||
'alt' : this.find(':input[name=AltText]').val(),
|
'alt' : this.find(':input[name=AltText]').val(),
|
||||||
'width' : width ? parseInt(width, 10) + "px" : null,
|
'width' : width ? parseInt(width, 10) : null,
|
||||||
'height' : height ? parseInt(height, 10) + "px" : null,
|
'height' : height ? parseInt(height, 10) : null,
|
||||||
'title' : this.find(':input[name=Title]').val(),
|
'title' : this.find(':input[name=Title]').val(),
|
||||||
'class' : this.find(':input[name=CSSClass]').val()
|
'class' : this.find(':input[name=CSSClass]').val()
|
||||||
};
|
};
|
||||||
|
@ -11,6 +11,7 @@ if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
|
|||||||
'UNIQUEFIELD.CANNOTLEAVEEMPTY': 'This field cannot be left empty',
|
'UNIQUEFIELD.CANNOTLEAVEEMPTY': 'This field cannot be left empty',
|
||||||
'RESTRICTEDTEXTFIELD.CHARCANTBEUSED': "The character '%s' cannot be used in this field",
|
'RESTRICTEDTEXTFIELD.CHARCANTBEUSED': "The character '%s' cannot be used in this field",
|
||||||
'UPDATEURL.CONFIRM': 'Would you like me to change the URL to:\n\n%s/\n\nClick Ok to change the URL, click Cancel to leave it as:\n\n%s',
|
'UPDATEURL.CONFIRM': 'Would you like me to change the URL to:\n\n%s/\n\nClick Ok to change the URL, click Cancel to leave it as:\n\n%s',
|
||||||
|
'UPDATEURL.CONFIRMURLCHANGED':'The URL has been changed to\n"%s"',
|
||||||
'FILEIFRAMEFIELD.DELETEFILE': 'Delete File',
|
'FILEIFRAMEFIELD.DELETEFILE': 'Delete File',
|
||||||
'FILEIFRAMEFIELD.UNATTACHFILE': 'Un-Attach File',
|
'FILEIFRAMEFIELD.UNATTACHFILE': 'Un-Attach File',
|
||||||
'FILEIFRAMEFIELD.DELETEIMAGE': 'Delete Image',
|
'FILEIFRAMEFIELD.DELETEIMAGE': 'Delete Image',
|
||||||
|
@ -90,7 +90,7 @@ class Aggregate extends ViewableData {
|
|||||||
* This gets the aggregate function
|
* This gets the aggregate function
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function XML_val($name, $args) {
|
public function XML_val($name, $args = null, $cache = false) {
|
||||||
$func = strtoupper( strpos($name, 'get') === 0 ? substr($name, 3) : $name );
|
$func = strtoupper( strpos($name, 'get') === 0 ? substr($name, 3) : $name );
|
||||||
$attribute = $args ? $args[0] : 'ID';
|
$attribute = $args ? $args[0] : 'ID';
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ abstract class DataExtension extends Extension {
|
|||||||
* @return array Returns a map where the keys are db, has_one, etc, and
|
* @return array Returns a map where the keys are db, has_one, etc, and
|
||||||
* the values are additional fields/relations to be defined.
|
* the values are additional fields/relations to be defined.
|
||||||
*/
|
*/
|
||||||
function extraStatics($class=null, $extension=null) {
|
function extraStatics($class = null, $extension = null) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -658,7 +658,7 @@ class DataList extends ViewableData implements SS_List, SS_Filterable, SS_Sortab
|
|||||||
*
|
*
|
||||||
* Example: Get members from all Groups:
|
* Example: Get members from all Groups:
|
||||||
*
|
*
|
||||||
* DataObject::get("Group")->relation("Members")
|
* DataList::Create("Group")->relation("Members")
|
||||||
*
|
*
|
||||||
* @param string $relationName
|
* @param string $relationName
|
||||||
* @return HasManyList|ManyManyList
|
* @return HasManyList|ManyManyList
|
||||||
@ -668,6 +668,10 @@ class DataList extends ViewableData implements SS_List, SS_Filterable, SS_Sortab
|
|||||||
return singleton($this->dataClass)->$relationName()->forForeignID($ids);
|
return singleton($this->dataClass)->$relationName()->forForeignID($ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dbObject($fieldName) {
|
||||||
|
return singleton($this->dataClass)->dbObject($fieldName);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a number of items to the component set.
|
* Add a number of items to the component set.
|
||||||
*
|
*
|
||||||
|
@ -309,7 +309,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
else $passed = "The value '$record'";
|
else $passed = "The value '$record'";
|
||||||
|
|
||||||
user_error("DataObject::__construct passed $passed. It's supposed to be passed an array,
|
user_error("DataObject::__construct passed $passed. It's supposed to be passed an array,
|
||||||
taken straight from the database. Perhaps you should use DataObject::get_one instead?", E_USER_WARNING);
|
taken straight from the database. Perhaps you should use DataList::create()->First(); instead?", E_USER_WARNING);
|
||||||
$record = null;
|
$record = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2404,7 +2404,12 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
// Traverse dot syntax
|
// Traverse dot syntax
|
||||||
$component = $this;
|
$component = $this;
|
||||||
foreach($parts as $relation) {
|
foreach($parts as $relation) {
|
||||||
$component = $component->$relation();
|
if($component instanceof SS_List) {
|
||||||
|
if(method_exists($component,$relation)) $component = $component->$relation();
|
||||||
|
else $component = $component->relation($relation);
|
||||||
|
} else {
|
||||||
|
$component = $component->$relation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$object = $component->dbObject($fieldName);
|
$object = $component->dbObject($fieldName);
|
||||||
@ -2436,7 +2441,12 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
// Traverse dot syntax
|
// Traverse dot syntax
|
||||||
$component = $this;
|
$component = $this;
|
||||||
foreach($parts as $relation) {
|
foreach($parts as $relation) {
|
||||||
$component = $component->$relation();
|
if($component instanceof SS_List) {
|
||||||
|
if(method_exists($component,$relation)) $component = $component->$relation();
|
||||||
|
else $component = $component->relation($relation);
|
||||||
|
} else {
|
||||||
|
$component = $component->$relation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $component->$fieldName;
|
return $component->$fieldName;
|
||||||
@ -2469,10 +2479,10 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated 3.0 Use DataObject::get and DataList to do your querying
|
* @deprecated 3.0 Use DataList::create and DataList to do your querying
|
||||||
*/
|
*/
|
||||||
public function buildSQL($filter = "", $sort = "", $limit = "", $join = "", $restrictClasses = true, $having = "") {
|
public function buildSQL($filter = "", $sort = "", $limit = "", $join = "", $restrictClasses = true, $having = "") {
|
||||||
Deprecation::notice('3.0', 'Use DataObject::get and DataList to do your querying instead.');
|
Deprecation::notice('3.0', 'Use DataList::create and DataList to do your querying instead.');
|
||||||
return $this->extendedSQL($filter, $sort, $limit, $join, $having);
|
return $this->extendedSQL($filter, $sort, $limit, $join, $having);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2483,10 +2493,10 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
private static $cache_buildSQL_query;
|
private static $cache_buildSQL_query;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated 3.0 Use DataObject::get and DataList to do your querying
|
* @deprecated 3.0 Use DataList::create and DataList to do your querying
|
||||||
*/
|
*/
|
||||||
public function extendedSQL($filter = "", $sort = "", $limit = "", $join = ""){
|
public function extendedSQL($filter = "", $sort = "", $limit = "", $join = ""){
|
||||||
Deprecation::notice('3.0', 'Use DataObject::get and DataList to do your querying instead.');
|
Deprecation::notice('3.0', 'Use DataList::create and DataList to do your querying instead.');
|
||||||
$dataList = DataObject::get($this->class, $filter, $sort, $join, $limit);
|
$dataList = DataObject::get($this->class, $filter, $sort, $join, $limit);
|
||||||
return $dataList->dataQuery()->query();
|
return $dataList->dataQuery()->query();
|
||||||
}
|
}
|
||||||
@ -2521,10 +2531,10 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated 3.0 Use DataObject::get and DataList to do your querying
|
* @deprecated 3.0 Use DataList::create and DataList to do your querying
|
||||||
*/
|
*/
|
||||||
public function Aggregate($class = null) {
|
public function Aggregate($class = null) {
|
||||||
Deprecation::notice('3.0', 'Use DataObject::get and DataList to do your querying instead.');
|
Deprecation::notice('3.0', 'Use DataList::create and DataList to do your querying instead.');
|
||||||
|
|
||||||
if($class) {
|
if($class) {
|
||||||
$list = new DataList($class);
|
$list = new DataList($class);
|
||||||
@ -2538,19 +2548,18 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated 3.0 Use DataObject::get and DataList to do your querying
|
* @deprecated 3.0 Use DataList::create and DataList to do your querying
|
||||||
*/
|
*/
|
||||||
public function RelationshipAggregate($relationship) {
|
public function RelationshipAggregate($relationship) {
|
||||||
Deprecation::notice('3.0', 'Use DataObject::get and DataList to do your querying instead.');
|
Deprecation::notice('3.0', 'Use DataList::create and DataList to do your querying instead.');
|
||||||
|
|
||||||
return $this->$relationship();
|
return $this->$relationship();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The internal function that actually performs the querying for get().
|
* DataList::create("Table")->where("filter") is the same as singleton("Table")->instance_get("filter")
|
||||||
* DataObject::get("Table","filter") is the same as singleton("Table")->instance_get("filter")
|
|
||||||
*
|
*
|
||||||
* @deprecated 3.0 Use DataObject::get and DataList to do your querying
|
* @deprecated 3.0 Use DataList::create and DataList to do your querying
|
||||||
*
|
*
|
||||||
* @param string $filter A filter to be inserted into the WHERE clause.
|
* @param string $filter A filter to be inserted into the WHERE clause.
|
||||||
* @param string $sort A sort expression to be inserted into the ORDER BY clause. If omitted, self::$default_sort will be used.
|
* @param string $sort A sort expression to be inserted into the ORDER BY clause. If omitted, self::$default_sort will be used.
|
||||||
@ -2561,7 +2570,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
* @return mixed The objects matching the filter, in the class specified by $containerClass
|
* @return mixed The objects matching the filter, in the class specified by $containerClass
|
||||||
*/
|
*/
|
||||||
public function instance_get($filter = "", $sort = "", $join = "", $limit="", $containerClass = "DataObjectSet") {
|
public function instance_get($filter = "", $sort = "", $join = "", $limit="", $containerClass = "DataObjectSet") {
|
||||||
Deprecation::notice('3.0', 'Use DataObject::get and DataList to do your querying instead.');
|
Deprecation::notice('3.0', 'Use DataList::create and DataList to do your querying instead.');
|
||||||
return self::get($this->class, $filter, $sort, $join, $limit, $containerClass);
|
return self::get($this->class, $filter, $sort, $join, $limit, $containerClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2655,7 +2664,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
* When false will just clear session-local cached data
|
* When false will just clear session-local cached data
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function flushCache($persistant=true) {
|
public function flushCache($persistant = true) {
|
||||||
if($persistant) Aggregate::flushCache($this->class);
|
if($persistant) Aggregate::flushCache($this->class);
|
||||||
|
|
||||||
if($this->class == 'DataObject') {
|
if($this->class == 'DataObject') {
|
||||||
@ -2693,7 +2702,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
/**
|
/**
|
||||||
* Does the hard work for get_one()
|
* Does the hard work for get_one()
|
||||||
*
|
*
|
||||||
* @deprecated 3.0 Use DataObject::get_one() instead
|
* @deprecated 3.0 Use DataList::create($this->class)->where($filter)->sort($orderby)->First() instead
|
||||||
*
|
*
|
||||||
* @uses DataExtension->augmentSQL()
|
* @uses DataExtension->augmentSQL()
|
||||||
*
|
*
|
||||||
@ -2702,7 +2711,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
* @return DataObject The first item matching the query
|
* @return DataObject The first item matching the query
|
||||||
*/
|
*/
|
||||||
public function instance_get_one($filter, $orderby = null) {
|
public function instance_get_one($filter, $orderby = null) {
|
||||||
Deprecation::notice('3.0', 'Use DataObject::get_one() instead.');
|
Deprecation::notice('3.0', 'Use DataList::create($this->class)->where($filter)->sort($orderby)->First() instead.');
|
||||||
return DataObject::get_one($this->class, $filter, true, $orderby);
|
return DataObject::get_one($this->class, $filter, true, $orderby);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3343,4 +3352,4 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ class DataQuery {
|
|||||||
if($this->dataClass != $baseClass) {
|
if($this->dataClass != $baseClass) {
|
||||||
// Get the ClassName values to filter to
|
// Get the ClassName values to filter to
|
||||||
$classNames = ClassInfo::subclassesFor($this->dataClass);
|
$classNames = ClassInfo::subclassesFor($this->dataClass);
|
||||||
if(!$classNames) user_error("DataObject::get() Can't find data sub-classes for '$callerClass'");
|
if(!$classNames) user_error("DataList::create() Can't find data sub-classes for '$callerClass'");
|
||||||
$query->where[] = "\"$baseClass\".\"ClassName\" IN ('" . implode("','", $classNames) . "')";
|
$query->where[] = "\"$baseClass\".\"ClassName\" IN ('" . implode("','", $classNames) . "')";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -674,12 +674,12 @@ class Hierarchy extends DataExtension {
|
|||||||
self::$expanded = array();
|
self::$expanded = array();
|
||||||
self::$treeOpened = array();
|
self::$treeOpened = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
function reset() {
|
public static function reset() {
|
||||||
self::$marked = array();
|
self::$marked = array();
|
||||||
self::$expanded = array();
|
self::$expanded = array();
|
||||||
self::$treeOpened = array();
|
self::$treeOpened = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,8 +73,8 @@ class Image extends File {
|
|||||||
parent::defineMethods();
|
parent::defineMethods();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCMSFields() {
|
function getCMSFields($params = null) {
|
||||||
$fields = parent::getCMSFields();
|
$fields = parent::getCMSFields($params);
|
||||||
|
|
||||||
$urlLink = "<div class='field readonly'>";
|
$urlLink = "<div class='field readonly'>";
|
||||||
$urlLink .= "<label class='left'>"._t('AssetTableField.URL','URL')."</label>";
|
$urlLink .= "<label class='left'>"._t('AssetTableField.URL','URL')."</label>";
|
||||||
|
@ -554,7 +554,7 @@ class SQLQuery {
|
|||||||
* Return the number of rows in this query if the limit were removed. Useful in paged data sets.
|
* Return the number of rows in this query if the limit were removed. Useful in paged data sets.
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function unlimitedRowCount( $column = null) {
|
function unlimitedRowCount($column = null) {
|
||||||
// we can't clear the select if we're relying on its output by a HAVING clause
|
// we can't clear the select if we're relying on its output by a HAVING clause
|
||||||
if(count($this->having)) {
|
if(count($this->having)) {
|
||||||
$records = $this->execute();
|
$records = $this->execute();
|
||||||
|
@ -132,7 +132,7 @@ class Versioned extends DataExtension {
|
|||||||
* Augment the the SQLQuery that is created by the DataQuery
|
* Augment the the SQLQuery that is created by the DataQuery
|
||||||
* @todo Should this all go into VersionedDataQuery?
|
* @todo Should this all go into VersionedDataQuery?
|
||||||
*/
|
*/
|
||||||
function augmentSQL(SQLQuery &$query, DataQuery &$dataQuery) {
|
function augmentSQL(SQLQuery &$query, DataQuery &$dataQuery = null) {
|
||||||
$baseTable = ClassInfo::baseDataClass($dataQuery->dataClass());
|
$baseTable = ClassInfo::baseDataClass($dataQuery->dataClass());
|
||||||
|
|
||||||
switch($dataQuery->getQueryParam('Versioned.mode')) {
|
switch($dataQuery->getQueryParam('Versioned.mode')) {
|
||||||
@ -1006,7 +1006,7 @@ class Versioned extends DataExtension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the equivalent of a DataObject::get() call, querying the latest
|
* Return the equivalent of a DataList::create() call, querying the latest
|
||||||
* version of each page stored in the (class)_versions tables.
|
* version of each page stored in the (class)_versions tables.
|
||||||
*
|
*
|
||||||
* In particular, this will query deleted records as well as active ones.
|
* In particular, this will query deleted records as well as active ones.
|
||||||
|
@ -41,7 +41,7 @@ class Currency extends Decimal {
|
|||||||
else return $val;
|
else return $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setValue($value) {
|
function setValue($value, $record = null) {
|
||||||
$matches = null;
|
$matches = null;
|
||||||
if(is_numeric($value)) {
|
if(is_numeric($value)) {
|
||||||
$this->value = $value;
|
$this->value = $value;
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
class Date extends DBField {
|
class Date extends DBField {
|
||||||
|
|
||||||
function setValue($value) {
|
function setValue($value, $record = null) {
|
||||||
if($value === false || $value === null || (is_string($value) && !strlen($value))) {
|
if($value === false || $value === null || (is_string($value) && !strlen($value))) {
|
||||||
// don't try to evaluate empty values with strtotime() below, as it returns "1970-01-01" when it should be saved as NULL in database
|
// don't try to evaluate empty values with strtotime() below, as it returns "1970-01-01" when it should be saved as NULL in database
|
||||||
$this->value = null;
|
$this->value = null;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
class SS_Datetime extends Date {
|
class SS_Datetime extends Date {
|
||||||
|
|
||||||
function setValue($value) {
|
function setValue($value, $record = null) {
|
||||||
if($value === false || $value === null || (is_string($value) && !strlen($value))) {
|
if($value === false || $value === null || (is_string($value) && !strlen($value))) {
|
||||||
// don't try to evaluate empty values with strtotime() below, as it returns "1970-01-01" when it should be saved as NULL in database
|
// don't try to evaluate empty values with strtotime() below, as it returns "1970-01-01" when it should be saved as NULL in database
|
||||||
$this->value = null;
|
$this->value = null;
|
||||||
|
@ -136,7 +136,7 @@ class HTMLText extends Text {
|
|||||||
return new HtmlEditorField($this->name, $title);
|
return new HtmlEditorField($this->name, $title);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scaffoldSearchField($title = null) {
|
public function scaffoldSearchField($title = null, $params = null) {
|
||||||
return new TextField($this->name, $title);
|
return new TextField($this->name, $title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,11 @@
|
|||||||
@include box-shadow(none);
|
@include box-shadow(none);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body.cms.ss-uploadfield-edit-iframe {
|
||||||
|
padding: $grid-x*2;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.ss-assetuploadfield {
|
.ss-assetuploadfield {
|
||||||
h3 {
|
h3 {
|
||||||
border-bottom: 1px solid $color-shadow-light;
|
border-bottom: 1px solid $color-shadow-light;
|
||||||
@ -162,7 +167,6 @@
|
|||||||
clear: both;
|
clear: both;
|
||||||
|
|
||||||
iframe {
|
iframe {
|
||||||
margin: $grid-x*2;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,6 +98,16 @@ $gf_grid_x: 16px;
|
|||||||
tbody {
|
tbody {
|
||||||
background: #FFF;
|
background: #FFF;
|
||||||
td {
|
td {
|
||||||
|
// Give browser some hints on which cols take priority:
|
||||||
|
// The last column (buttons) should always shrink to fit.
|
||||||
|
// Overwritten for IE7, which doesn't support this.
|
||||||
|
width: 100%;
|
||||||
|
&.col-buttons {
|
||||||
|
width: auto;
|
||||||
|
text-align: right;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
border: none;
|
border: none;
|
||||||
background: none;
|
background: none;
|
||||||
@ -118,13 +128,9 @@ $gf_grid_x: 16px;
|
|||||||
display:inline-block;
|
display:inline-block;
|
||||||
width:$gf_grid_x;
|
width:$gf_grid_x;
|
||||||
height:20px; //min height to fit the edit icon
|
height:20px; //min height to fit the edit icon
|
||||||
text-indent:-9999em;
|
text-indent:9999em;
|
||||||
background: url(../images/icons/document--pencil.png) no-repeat 0 1px;
|
background: url(../images/icons/document--pencil.png) no-repeat 0 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.col-buttons {
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,6 +271,9 @@ $gf_grid_x: 16px;
|
|||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
|
&#action_gridfield_relationadd:hover {
|
||||||
|
color: #444 !important; /* Not sure why IE think it needs this */
|
||||||
|
}
|
||||||
&:hover {
|
&:hover {
|
||||||
color: #ccc !important; /* Not sure why IE think it needs this */
|
color: #ccc !important; /* Not sure why IE think it needs this */
|
||||||
}
|
}
|
||||||
|
@ -37,9 +37,8 @@ abstract class Authenticator extends Object {
|
|||||||
* @return bool|Member Returns FALSE if authentication fails, otherwise
|
* @return bool|Member Returns FALSE if authentication fails, otherwise
|
||||||
* the member object
|
* the member object
|
||||||
*/
|
*/
|
||||||
public abstract static function authenticate($RAW_data,
|
public static function authenticate($RAW_data, Form $form = null) {
|
||||||
Form $form = null);
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method that creates the login form for this authentication method
|
* Method that creates the login form for this authentication method
|
||||||
@ -49,7 +48,8 @@ abstract class Authenticator extends Object {
|
|||||||
* @return Form Returns the login form to use with this authentication
|
* @return Form Returns the login form to use with this authentication
|
||||||
* method
|
* method
|
||||||
*/
|
*/
|
||||||
public abstract static function get_login_form(Controller $controller);
|
public static function get_login_form(Controller $controller) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -57,7 +57,8 @@ abstract class Authenticator extends Object {
|
|||||||
*
|
*
|
||||||
* @return string Returns the name of the authentication method.
|
* @return string Returns the name of the authentication method.
|
||||||
*/
|
*/
|
||||||
public abstract static function get_name();
|
public static function get_name() {
|
||||||
|
}
|
||||||
|
|
||||||
public static function register($authenticator) {
|
public static function register($authenticator) {
|
||||||
self::register_authenticator($authenticator);
|
self::register_authenticator($authenticator);
|
||||||
|
@ -59,7 +59,7 @@ class Group extends DataObject {
|
|||||||
*
|
*
|
||||||
* @return FieldList
|
* @return FieldList
|
||||||
*/
|
*/
|
||||||
public function getCMSFields() {
|
public function getCMSFields($params = null) {
|
||||||
Requirements::javascript(SAPPHIRE_DIR . '/javascript/PermissionCheckboxSetField.js');
|
Requirements::javascript(SAPPHIRE_DIR . '/javascript/PermissionCheckboxSetField.js');
|
||||||
|
|
||||||
$fields = new FieldList(
|
$fields = new FieldList(
|
||||||
@ -85,7 +85,10 @@ class Group extends DataObject {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$parentidfield->setRightTitle('<span class="aligned-right-label">' . _t('Group.GroupReminder', 'If you choose a parent group, this group will take all it\'s roles') . '</span>');
|
$parentidfield->setAttribute(
|
||||||
|
'title',
|
||||||
|
_t('Group.GroupReminder', 'If you choose a parent group, this group will take all it\'s roles')
|
||||||
|
);
|
||||||
|
|
||||||
// Filter permissions
|
// Filter permissions
|
||||||
// TODO SecurityAdmin coupling, not easy to get to the form fields through GridFieldDetailForm
|
// TODO SecurityAdmin coupling, not easy to get to the form fields through GridFieldDetailForm
|
||||||
@ -334,17 +337,21 @@ class Group extends DataObject {
|
|||||||
if(!$this->Code) $this->setCode($this->Title);
|
if(!$this->Code) $this->setCode($this->Title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onAfterDelete() {
|
function onBeforeDelete() {
|
||||||
parent::onAfterDelete();
|
parent::onBeforeDelete();
|
||||||
|
|
||||||
|
// if deleting this group, delete it's children as well
|
||||||
|
foreach($this->Groups() as $group) {
|
||||||
|
$group->delete();
|
||||||
|
}
|
||||||
|
|
||||||
// Delete associated permissions
|
// Delete associated permissions
|
||||||
$permissions = $this->Permissions();
|
foreach($this->Permissions() as $permission) {
|
||||||
foreach ( $permissions as $permission ) {
|
|
||||||
$permission->delete();
|
$permission->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks for permission-code CMS_ACCESS_SecurityAdmin.
|
* Checks for permission-code CMS_ACCESS_SecurityAdmin.
|
||||||
* If the group has ADMIN permissions, it requires the user to have ADMIN permissions as well.
|
* If the group has ADMIN permissions, it requires the user to have ADMIN permissions as well.
|
||||||
|
@ -1084,7 +1084,7 @@ class Member extends DataObject implements TemplateGlobalProvider {
|
|||||||
* @return FieldList Return a FieldList of fields that would appropriate for
|
* @return FieldList Return a FieldList of fields that would appropriate for
|
||||||
* editing this member.
|
* editing this member.
|
||||||
*/
|
*/
|
||||||
public function getCMSFields() {
|
public function getCMSFields($params = null) {
|
||||||
require_once('Zend/Date.php');
|
require_once('Zend/Date.php');
|
||||||
|
|
||||||
$fields = parent::getCMSFields();
|
$fields = parent::getCMSFields();
|
||||||
|
@ -139,13 +139,7 @@ class PasswordEncryptor_PHPHash extends PasswordEncryptor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function encrypt($password, $salt = null, $member = null) {
|
function encrypt($password, $salt = null, $member = null) {
|
||||||
if(function_exists('hash')) {
|
return hash($this->algorithm, $password . $salt);
|
||||||
// Available in PHP 5.1+ only
|
|
||||||
return hash($this->algorithm, $password . $salt);
|
|
||||||
} else {
|
|
||||||
// Fallback to global built-in methods
|
|
||||||
return call_user_func($this->algorithm, $password . $salt);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,8 +33,8 @@ class PermissionRole extends DataObject {
|
|||||||
|
|
||||||
static $plural_name = 'Roles';
|
static $plural_name = 'Roles';
|
||||||
|
|
||||||
function getCMSFields() {
|
function getCMSFields($params = null) {
|
||||||
$fields = parent::getCMSFields();
|
$fields = parent::getCMSFields($params);
|
||||||
|
|
||||||
$fields->removeFieldFromTab('Root', 'Codes');
|
$fields->removeFieldFromTab('Root', 'Codes');
|
||||||
$fields->removeFieldFromTab('Root', 'Groups');
|
$fields->removeFieldFromTab('Root', 'Groups');
|
||||||
|
@ -329,7 +329,7 @@ class RequestHandlingTest_Controller extends Controller implements TestOnly {
|
|||||||
$this->httpError(404, 'This page does not exist.');
|
$this->httpError(404, 'This page does not exist.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getViewer(){
|
public function getViewer($action) {
|
||||||
return new SSViewer('BlankPage');
|
return new SSViewer('BlankPage');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -384,7 +384,7 @@ class RequestHandlingTest_FormActionController extends Controller {
|
|||||||
return 'formactionInAllowedActions';
|
return 'formactionInAllowedActions';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getViewer(){
|
public function getViewer($action = null) {
|
||||||
return new SSViewer('BlankPage');
|
return new SSViewer('BlankPage');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,6 +101,7 @@ class ConvertTest extends SapphireTest {
|
|||||||
$this->assertEquals(3, count($decoded), '3 items in the decoded array');
|
$this->assertEquals(3, count($decoded), '3 items in the decoded array');
|
||||||
$this->assertContains('Bloggs', $decoded, 'Contains "Bloggs" value in decoded array');
|
$this->assertContains('Bloggs', $decoded, 'Contains "Bloggs" value in decoded array');
|
||||||
$this->assertContains('Jones', $decoded, 'Contains "Jones" value in decoded array');
|
$this->assertContains('Jones', $decoded, 'Contains "Jones" value in decoded array');
|
||||||
|
$this->assertContains('Structure', $decoded['My']['Complicated']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testJSON2Obj() {
|
function testJSON2Obj() {
|
||||||
@ -121,4 +122,4 @@ class ConvertTest extends SapphireTest {
|
|||||||
$this->assertEquals('foos-bar-2', Convert::raw2url('foo\'s [bar] (2)'));
|
$this->assertEquals('foos-bar-2', Convert::raw2url('foo\'s [bar] (2)'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,18 @@ class DateFieldTest extends SapphireTest {
|
|||||||
// $f = new DateField('Date', 'Date', array('day' => 9999, 'month' => 9999, 'year' => 9999));
|
// $f = new DateField('Date', 'Date', array('day' => 9999, 'month' => 9999, 'year' => 9999));
|
||||||
// $this->assertFalse($f->validate(new RequiredFields()));
|
// $this->assertFalse($f->validate(new RequiredFields()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testValidateEmptyArrayValuesSetsNullForValueObject() {
|
||||||
|
$f = new DateField('Date', 'Date');
|
||||||
|
$f->setConfig('dmyfields', true);
|
||||||
|
|
||||||
|
$f->setValue(array('day' => '', 'month' => '', 'year' => ''));
|
||||||
|
$this->assertNull($f->dataValue());
|
||||||
|
|
||||||
|
$f->setValue(array('day' => null, 'month' => null, 'year' => null));
|
||||||
|
$this->assertNull($f->dataValue());
|
||||||
|
}
|
||||||
|
|
||||||
function testValidateArrayValue() {
|
function testValidateArrayValue() {
|
||||||
$f = new DateField('Date', 'Date');
|
$f = new DateField('Date', 'Date');
|
||||||
$this->assertTrue($f->validateArrayValue(array('day' => 29, 'month' => 03, 'year' => 2003)));
|
$this->assertTrue($f->validateArrayValue(array('day' => 29, 'month' => 03, 'year' => 2003)));
|
||||||
|
@ -128,11 +128,13 @@ class FormScaffolderTest_ArticleExtension extends DataExtension implements TestO
|
|||||||
static $db = array(
|
static $db = array(
|
||||||
'ExtendedField' => 'Varchar'
|
'ExtendedField' => 'Varchar'
|
||||||
);
|
);
|
||||||
function updateCMSFields(&$fields) {
|
|
||||||
|
function updateCMSFields(FieldList $fields) {
|
||||||
$fields->addFieldToTab('Root.Main',
|
$fields->addFieldToTab('Root.Main',
|
||||||
new TextField('AddedExtensionField')
|
new TextField('AddedExtensionField')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DataObject::add_extension('FormScaffolderTest_Article', 'FormScaffolderTest_ArticleExtension');
|
DataObject::add_extension('FormScaffolderTest_Article', 'FormScaffolderTest_ArticleExtension');
|
||||||
|
@ -468,7 +468,7 @@ class FormTest_Controller extends Controller implements TestOnly {
|
|||||||
return $this->redirectBack();
|
return $this->redirectBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getViewer(){
|
function getViewer($action = null) {
|
||||||
return new SSViewer('BlankPage');
|
return new SSViewer('BlankPage');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -505,7 +505,7 @@ class FormTest_ControllerWithSecurityToken extends Controller implements TestOnl
|
|||||||
return $this->redirectBack();
|
return $this->redirectBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getViewer(){
|
function getViewer($action = null) {
|
||||||
return new SSViewer('BlankPage');
|
return new SSViewer('BlankPage');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class GridFieldAddExistingAutocompleterTest extends FunctionalTest {
|
|||||||
);
|
);
|
||||||
$this->assertFalse($response->isError());
|
$this->assertFalse($response->isError());
|
||||||
$result = Convert::json2array($response->getBody());
|
$result = Convert::json2array($response->getBody());
|
||||||
$this->assertFalse($result);
|
$this->assertEmpty($result, 'The output is either an empty array or boolean FALSE');
|
||||||
}
|
}
|
||||||
|
|
||||||
function testAdd() {
|
function testAdd() {
|
||||||
@ -80,4 +80,4 @@ class GridFieldAddExistingAutocompleterTest_Controller extends Controller implem
|
|||||||
$field = new GridField('testfield', 'testfield', $player->Teams(), $config);
|
$field = new GridField('testfield', 'testfield', $player->Teams(), $config);
|
||||||
return new Form($this, 'Form', new FieldList($field), new FieldList());
|
return new Form($this, 'Form', new FieldList($field), new FieldList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ class GridFieldDeleteActionTest extends SapphireTest {
|
|||||||
// Check that there are content
|
// Check that there are content
|
||||||
$this->assertEquals(4, count($content->getBySelector('.ss-gridfield-item')));
|
$this->assertEquals(4, count($content->getBySelector('.ss-gridfield-item')));
|
||||||
// Make sure that there are no delete buttons
|
// Make sure that there are no delete buttons
|
||||||
$this->assertEmpty($content->getBySelector('.gridfield-button-delete'), 'Delete buttons should not show when not logged in.');
|
$this->assertEquals(0, count($content->getBySelector('.gridfield-button-delete')), 'Delete buttons should not show when not logged in.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testShowDeleteButtonsWithAdminPermission() {
|
public function testShowDeleteButtonsWithAdminPermission() {
|
||||||
|
@ -140,8 +140,8 @@ class GridFieldDetailFormTest_Person extends DataObject implements TestOnly {
|
|||||||
'Categories' => 'GridFieldDetailFormTest_Category'
|
'Categories' => 'GridFieldDetailFormTest_Category'
|
||||||
);
|
);
|
||||||
|
|
||||||
function getCMSFields() {
|
function getCMSFields($params = null) {
|
||||||
$fields = parent::getCMSFields();
|
$fields = parent::getCMSFields($params);
|
||||||
// TODO No longer necessary once FormScaffolder uses GridField
|
// TODO No longer necessary once FormScaffolder uses GridField
|
||||||
$fields->replaceField('Categories',
|
$fields->replaceField('Categories',
|
||||||
Object::create('GridField', 'Categories', 'Categories',
|
Object::create('GridField', 'Categories', 'Categories',
|
||||||
@ -162,8 +162,8 @@ class GridFieldDetailFormTest_PeopleGroup extends DataObject implements TestOnly
|
|||||||
'People' => 'GridFieldDetailFormTest_Person'
|
'People' => 'GridFieldDetailFormTest_Person'
|
||||||
);
|
);
|
||||||
|
|
||||||
function getCMSFields() {
|
function getCMSFields($params = null) {
|
||||||
$fields = parent::getCMSFields();
|
$fields = parent::getCMSFields($params);
|
||||||
// TODO No longer necessary once FormScaffolder uses GridField
|
// TODO No longer necessary once FormScaffolder uses GridField
|
||||||
$fields->replaceField('People',
|
$fields->replaceField('People',
|
||||||
Object::create('GridField', 'People', 'People',
|
Object::create('GridField', 'People', 'People',
|
||||||
@ -184,8 +184,8 @@ class GridFieldDetailFormTest_Category extends DataObject implements TestOnly {
|
|||||||
'People' => 'GridFieldDetailFormTest_Person'
|
'People' => 'GridFieldDetailFormTest_Person'
|
||||||
);
|
);
|
||||||
|
|
||||||
function getCMSFields() {
|
function getCMSFields($params = null) {
|
||||||
$fields = parent::getCMSFields();
|
$fields = parent::getCMSFields($params);
|
||||||
// TODO No longer necessary once FormScaffolder uses GridField
|
// TODO No longer necessary once FormScaffolder uses GridField
|
||||||
$fields->replaceField('People',
|
$fields->replaceField('People',
|
||||||
Object::create('GridField', 'People', 'People',
|
Object::create('GridField', 'People', 'People',
|
||||||
|
@ -32,7 +32,7 @@ class GridFieldEditButtonTest extends SapphireTest {
|
|||||||
// Check that there are content
|
// Check that there are content
|
||||||
$this->assertEquals(3, count($content->getBySelector('.ss-gridfield-item')));
|
$this->assertEquals(3, count($content->getBySelector('.ss-gridfield-item')));
|
||||||
// Make sure that there are no edit links
|
// Make sure that there are no edit links
|
||||||
$this->assertEmpty($content->getBySelector('.edit-link'), 'Edit links should not show when not logged in.');
|
$this->assertEquals(0, count($content->getBySelector('.edit-link')), 'Edit links should not show when not logged in.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testShowEditLinksWithAdminPermission() {
|
public function testShowEditLinksWithAdminPermission() {
|
||||||
|
@ -567,21 +567,21 @@ static $many_many = array(
|
|||||||
|
|
||||||
class UploadFieldTest_FileExtension extends DataExtension implements TestOnly {
|
class UploadFieldTest_FileExtension extends DataExtension implements TestOnly {
|
||||||
|
|
||||||
function extraStatics() {
|
function extraStatics($class = null, $extension = null) {
|
||||||
return array(
|
return array(
|
||||||
'has_one' => array('Record' => 'UploadFieldTest_Record')
|
'has_one' => array('Record' => 'UploadFieldTest_Record')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function canDelete() {
|
function canDelete($member = null) {
|
||||||
if($this->owner->Name == 'nodelete.txt') return false;
|
if($this->owner->Name == 'nodelete.txt') return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function canEdit() {
|
function canEdit($member = null) {
|
||||||
if($this->owner->Name == 'noedit.txt') return false;
|
if($this->owner->Name == 'noedit.txt') return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function canView() {
|
function canView($member = null) {
|
||||||
if($this->owner->Name == 'noview.txt') return false;
|
if($this->owner->Name == 'noview.txt') return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -655,4 +655,4 @@ class UploadFieldTest_Controller extends Controller implements TestOnly {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -73,13 +73,15 @@ class AggregateTest extends SapphireTest {
|
|||||||
* Test basic aggregation on a passed type
|
* Test basic aggregation on a passed type
|
||||||
*/
|
*/
|
||||||
function testTypeSpecifiedAggregate() {
|
function testTypeSpecifiedAggregate() {
|
||||||
|
$foo = $this->objFromFixture('AggregateTest_Foo', 'foo1');
|
||||||
|
|
||||||
// Template style access
|
// Template style access
|
||||||
$this->assertEquals(DataObject::Aggregate('AggregateTest_Foo')->XML_val('Max', array('Foo')), 9);
|
$this->assertEquals($foo->Aggregate('AggregateTest_Foo')->XML_val('Max', array('Foo')), 9);
|
||||||
$this->assertEquals(DataObject::Aggregate('AggregateTest_Fab')->XML_val('Max', array('Fab')), 3);
|
$this->assertEquals($foo->Aggregate('AggregateTest_Fab')->XML_val('Max', array('Fab')), 3);
|
||||||
|
|
||||||
// PHP style access
|
// PHP style access
|
||||||
$this->assertEquals(DataObject::Aggregate('AggregateTest_Foo')->Max('Foo'), 9);
|
$this->assertEquals($foo->Aggregate('AggregateTest_Foo')->Max('Foo'), 9);
|
||||||
$this->assertEquals(DataObject::Aggregate('AggregateTest_Fab')->Max('Fab'), 3);
|
$this->assertEquals($foo->Aggregate('AggregateTest_Fab')->Max('Fab'), 3);
|
||||||
}
|
}
|
||||||
/* */
|
/* */
|
||||||
|
|
||||||
@ -90,7 +92,7 @@ class AggregateTest extends SapphireTest {
|
|||||||
function testAutoTypeAggregate() {
|
function testAutoTypeAggregate() {
|
||||||
$foo = $this->objFromFixture('AggregateTest_Foo', 'foo1');
|
$foo = $this->objFromFixture('AggregateTest_Foo', 'foo1');
|
||||||
$fab = $this->objFromFixture('AggregateTest_Fab', 'fab1');
|
$fab = $this->objFromFixture('AggregateTest_Fab', 'fab1');
|
||||||
|
|
||||||
// Template style access
|
// Template style access
|
||||||
$this->assertEquals($foo->Aggregate()->XML_val('Max', array('Foo')), 9);
|
$this->assertEquals($foo->Aggregate()->XML_val('Max', array('Foo')), 9);
|
||||||
$this->assertEquals($fab->Aggregate()->XML_val('Max', array('Fab')), 3);
|
$this->assertEquals($fab->Aggregate()->XML_val('Max', array('Fab')), 3);
|
||||||
@ -106,13 +108,15 @@ class AggregateTest extends SapphireTest {
|
|||||||
* @return unknown_type
|
* @return unknown_type
|
||||||
*/
|
*/
|
||||||
function testBaseFieldAggregate() {
|
function testBaseFieldAggregate() {
|
||||||
|
$foo = $this->objFromFixture('AggregateTest_Foo', 'foo1');
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$this->formatDate(DataObject::Aggregate('AggregateTest_Foo')->Max('LastEdited')),
|
$this->formatDate($foo->Aggregate('AggregateTest_Foo')->Max('LastEdited')),
|
||||||
$this->formatDate(DataObject::get_one('AggregateTest_Foo', '', '', '"LastEdited" DESC')->LastEdited)
|
$this->formatDate(DataObject::get_one('AggregateTest_Foo', '', '', '"LastEdited" DESC')->LastEdited)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$this->formatDate(DataObject::Aggregate('AggregateTest_Foo')->Max('Created')),
|
$this->formatDate($foo->Aggregate('AggregateTest_Foo')->Max('Created')),
|
||||||
$this->formatDate(DataObject::get_one('AggregateTest_Foo', '', '', '"Created" DESC')->Created)
|
$this->formatDate(DataObject::get_one('AggregateTest_Foo', '', '', '"Created" DESC')->Created)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -122,13 +126,14 @@ class AggregateTest extends SapphireTest {
|
|||||||
* Test aggregation takes place on the passed type & it's children only
|
* Test aggregation takes place on the passed type & it's children only
|
||||||
*/
|
*/
|
||||||
function testChildAggregate() {
|
function testChildAggregate() {
|
||||||
|
$foo = $this->objFromFixture('AggregateTest_Foo', 'foo1');
|
||||||
|
|
||||||
// For base classes, aggregate is calculcated on it and all children classes
|
// For base classes, aggregate is calculcated on it and all children classes
|
||||||
$this->assertEquals(DataObject::Aggregate('AggregateTest_Foo')->Max('Foo'), 9);
|
$this->assertEquals($foo->Aggregate('AggregateTest_Foo')->Max('Foo'), 9);
|
||||||
|
|
||||||
// For subclasses, aggregate is calculated for that subclass and it's children only
|
// For subclasses, aggregate is calculated for that subclass and it's children only
|
||||||
$this->assertEquals(DataObject::Aggregate('AggregateTest_Fab')->Max('Foo'), 9);
|
$this->assertEquals($foo->Aggregate('AggregateTest_Fab')->Max('Foo'), 9);
|
||||||
$this->assertEquals(DataObject::Aggregate('AggregateTest_Fac')->Max('Foo'), 6);
|
$this->assertEquals($foo->Aggregate('AggregateTest_Fac')->Max('Foo'), 6);
|
||||||
|
|
||||||
}
|
}
|
||||||
/* */
|
/* */
|
||||||
@ -145,35 +150,35 @@ class AggregateTest extends SapphireTest {
|
|||||||
* Test cache is correctly flushed on write
|
* Test cache is correctly flushed on write
|
||||||
*/
|
*/
|
||||||
function testCacheFlushing() {
|
function testCacheFlushing() {
|
||||||
|
$foo = $this->objFromFixture('AggregateTest_Foo', 'foo1');
|
||||||
|
$fab = $this->objFromFixture('AggregateTest_Fab', 'fab1');
|
||||||
|
|
||||||
// For base classes, aggregate is calculcated on it and all children classes
|
// For base classes, aggregate is calculcated on it and all children classes
|
||||||
$this->assertEquals(DataObject::Aggregate('AggregateTest_Foo')->Max('Foo'), 9);
|
$this->assertEquals($fab->Aggregate('AggregateTest_Foo')->Max('Foo'), 9);
|
||||||
|
|
||||||
// For subclasses, aggregate is calculated for that subclass and it's children only
|
// For subclasses, aggregate is calculated for that subclass and it's children only
|
||||||
$this->assertEquals(DataObject::Aggregate('AggregateTest_Fab')->Max('Foo'), 9);
|
$this->assertEquals($fab->Aggregate('AggregateTest_Fab')->Max('Foo'), 9);
|
||||||
$this->assertEquals(DataObject::Aggregate('AggregateTest_Fac')->Max('Foo'), 6);
|
$this->assertEquals($fab->Aggregate('AggregateTest_Fac')->Max('Foo'), 6);
|
||||||
|
|
||||||
$foo = $this->objFromFixture('AggregateTest_Foo', 'foo1');
|
|
||||||
$foo->Foo = 12;
|
$foo->Foo = 12;
|
||||||
$foo->write();
|
$foo->write();
|
||||||
|
|
||||||
// For base classes, aggregate is calculcated on it and all children classes
|
// For base classes, aggregate is calculcated on it and all children classes
|
||||||
$this->assertEquals(DataObject::Aggregate('AggregateTest_Foo')->Max('Foo'), 12);
|
$this->assertEquals($fab->Aggregate('AggregateTest_Foo')->Max('Foo'), 12);
|
||||||
|
|
||||||
// For subclasses, aggregate is calculated for that subclass and it's children only
|
// For subclasses, aggregate is calculated for that subclass and it's children only
|
||||||
$this->assertEquals(DataObject::Aggregate('AggregateTest_Fab')->Max('Foo'), 9);
|
$this->assertEquals($fab->Aggregate('AggregateTest_Fab')->Max('Foo'), 9);
|
||||||
$this->assertEquals(DataObject::Aggregate('AggregateTest_Fac')->Max('Foo'), 6);
|
$this->assertEquals($fab->Aggregate('AggregateTest_Fac')->Max('Foo'), 6);
|
||||||
|
|
||||||
$fab = $this->objFromFixture('AggregateTest_Fab', 'fab1');
|
|
||||||
$fab->Foo = 15;
|
$fab->Foo = 15;
|
||||||
$fab->write();
|
$fab->write();
|
||||||
|
|
||||||
// For base classes, aggregate is calculcated on it and all children classes
|
// For base classes, aggregate is calculcated on it and all children classes
|
||||||
$this->assertEquals(DataObject::Aggregate('AggregateTest_Foo')->Max('Foo'), 15);
|
$this->assertEquals($fab->Aggregate('AggregateTest_Foo')->Max('Foo'), 15);
|
||||||
|
|
||||||
// For subclasses, aggregate is calculated for that subclass and it's children only
|
// For subclasses, aggregate is calculated for that subclass and it's children only
|
||||||
$this->assertEquals(DataObject::Aggregate('AggregateTest_Fab')->Max('Foo'), 15);
|
$this->assertEquals($fab->Aggregate('AggregateTest_Fab')->Max('Foo'), 15);
|
||||||
$this->assertEquals(DataObject::Aggregate('AggregateTest_Fac')->Max('Foo'), 6);
|
$this->assertEquals($fab->Aggregate('AggregateTest_Fac')->Max('Foo'), 6);
|
||||||
}
|
}
|
||||||
/* */
|
/* */
|
||||||
|
|
||||||
|
@ -62,8 +62,8 @@ class DataDifferencerTest_Object extends DataObject implements TestOnly {
|
|||||||
'HasOneRelation' => 'DataDifferencerTest_HasOneRelationObject'
|
'HasOneRelation' => 'DataDifferencerTest_HasOneRelationObject'
|
||||||
);
|
);
|
||||||
|
|
||||||
function getCMSFields() {
|
function getCMSFields($params = null) {
|
||||||
$fields = parent::getCMSFields();
|
$fields = parent::getCMSFields($params);
|
||||||
$choices = array(
|
$choices = array(
|
||||||
'a' => 'a',
|
'a' => 'a',
|
||||||
'b' => 'b',
|
'b' => 'b',
|
||||||
@ -103,4 +103,4 @@ class DataDifferencerTest_MockImage extends Image implements TestOnly {
|
|||||||
// Skip aktual generation
|
// Skip aktual generation
|
||||||
return $gd;
|
return $gd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,16 +32,16 @@ class DateTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testNiceDate() {
|
function testNiceDate() {
|
||||||
$this->assertEquals('01/04/2008', DBField::create('Date', 1206968400)->Nice(),
|
$this->assertEquals('31/03/2008', DBField::create('Date', 1206968400)->Nice(),
|
||||||
"Date->Nice() works with timestamp integers"
|
"Date->Nice() works with timestamp integers"
|
||||||
);
|
);
|
||||||
$this->assertEquals('31/03/2008', DBField::create('Date', 1206882000)->Nice(),
|
$this->assertEquals('30/03/2008', DBField::create('Date', 1206882000)->Nice(),
|
||||||
"Date->Nice() works with timestamp integers"
|
"Date->Nice() works with timestamp integers"
|
||||||
);
|
);
|
||||||
$this->assertEquals('01/04/2008', DBField::create('Date', '1206968400')->Nice(),
|
$this->assertEquals('31/03/2008', DBField::create('Date', '1206968400')->Nice(),
|
||||||
"Date->Nice() works with timestamp strings"
|
"Date->Nice() works with timestamp strings"
|
||||||
);
|
);
|
||||||
$this->assertEquals('31/03/2008', DBField::create('Date', '1206882000')->Nice(),
|
$this->assertEquals('30/03/2008', DBField::create('Date', '1206882000')->Nice(),
|
||||||
"Date->Nice() works with timestamp strings"
|
"Date->Nice() works with timestamp strings"
|
||||||
);
|
);
|
||||||
$this->assertEquals('04/03/2003', DBField::create('Date', '4/3/03')->Nice(),
|
$this->assertEquals('04/03/2003', DBField::create('Date', '4/3/03')->Nice(),
|
||||||
@ -74,16 +74,16 @@ class DateTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testLongDate() {
|
function testLongDate() {
|
||||||
$this->assertEquals('1 April 2008', DBField::create('Date', 1206968400)->Long(),
|
$this->assertEquals('31 March 2008', DBField::create('Date', 1206968400)->Long(),
|
||||||
"Date->Long() works with numeric timestamp"
|
"Date->Long() works with numeric timestamp"
|
||||||
);
|
);
|
||||||
$this->assertEquals('1 April 2008', DBField::create('Date', '1206968400')->Long(),
|
$this->assertEquals('31 March 2008', DBField::create('Date', '1206968400')->Long(),
|
||||||
"Date->Long() works with string timestamp"
|
"Date->Long() works with string timestamp"
|
||||||
);
|
);
|
||||||
$this->assertEquals('31 March 2008', DBField::create('Date', 1206882000)->Long(),
|
$this->assertEquals('30 March 2008', DBField::create('Date', 1206882000)->Long(),
|
||||||
"Date->Long() works with numeric timestamp"
|
"Date->Long() works with numeric timestamp"
|
||||||
);
|
);
|
||||||
$this->assertEquals('31 March 2008', DBField::create('Date', '1206882000')->Long(),
|
$this->assertEquals('30 March 2008', DBField::create('Date', '1206882000')->Long(),
|
||||||
"Date->Long() works with numeric timestamp"
|
"Date->Long() works with numeric timestamp"
|
||||||
);
|
);
|
||||||
$this->assertEquals('3 April 2003', DBField::create('Date', '2003-4-3')->Long(),
|
$this->assertEquals('3 April 2003', DBField::create('Date', '2003-4-3')->Long(),
|
||||||
|
@ -35,8 +35,6 @@ class SS_DatetimeTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testSetNullAndZeroValues() {
|
function testSetNullAndZeroValues() {
|
||||||
date_default_timezone_set('UTC');
|
|
||||||
|
|
||||||
$date = DBField::create('SS_Datetime', '');
|
$date = DBField::create('SS_Datetime', '');
|
||||||
$this->assertNull($date->getValue(), 'Empty string evaluates to NULL');
|
$this->assertNull($date->getValue(), 'Empty string evaluates to NULL');
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@ class DbDatetimeTest extends FunctionalTest {
|
|||||||
E_USER_ERROR => 1800,
|
E_USER_ERROR => 1800,
|
||||||
E_USER_NOTICE => 5,
|
E_USER_NOTICE => 5,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
private $adapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if dates match more or less. This takes into the account the db query
|
* Check if dates match more or less. This takes into the account the db query
|
||||||
|
@ -94,15 +94,6 @@ class GroupTest extends FunctionalTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDelete() {
|
|
||||||
$adminGroup = $this->objFromFixture('Group', 'admingroup');
|
|
||||||
|
|
||||||
$adminGroup->delete();
|
|
||||||
|
|
||||||
$this->assertEquals(0, DataObject::get('Group', "\"ID\"={$adminGroup->ID}")->count(), 'Group is removed');
|
|
||||||
$this->assertEquals(0, DataObject::get('Permission',"\"GroupID\"={$adminGroup->ID}")->count(), 'Permissions removed along with the group');
|
|
||||||
}
|
|
||||||
|
|
||||||
function testCollateAncestorIDs() {
|
function testCollateAncestorIDs() {
|
||||||
$parentGroup = $this->objFromFixture('Group', 'parentgroup');
|
$parentGroup = $this->objFromFixture('Group', 'parentgroup');
|
||||||
$childGroup = $this->objFromFixture('Group', 'childgroup');
|
$childGroup = $this->objFromFixture('Group', 'childgroup');
|
||||||
@ -128,11 +119,24 @@ class GroupTest extends FunctionalTest {
|
|||||||
'Orphaned nodes dont contain invalid parent IDs'
|
'Orphaned nodes dont contain invalid parent IDs'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testDelete() {
|
||||||
|
$group = $this->objFromFixture('Group', 'parentgroup');
|
||||||
|
$groupID = $group->ID;
|
||||||
|
$childGroupID = $this->idFromFixture('Group', 'childgroup');
|
||||||
|
$group->delete();
|
||||||
|
|
||||||
|
$this->assertEquals(0, DataObject::get('Group', "\"ID\" = {$groupID}")->Count(), 'Group is removed');
|
||||||
|
$this->assertEquals(0, DataObject::get('Permission', "\"GroupID\" = {$groupID}")->Count(), 'Permissions removed along with the group');
|
||||||
|
$this->assertEquals(0, DataObject::get('Group', "\"ParentID\" = {$groupID}")->Count(), 'Child groups are removed');
|
||||||
|
$this->assertEquals(0, DataObject::get('Group', "\"ParentID\" = {$childGroupID}")->Count(), 'Grandchild groups are removed');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class GroupTest_Member extends Member implements TestOnly {
|
class GroupTest_Member extends Member implements TestOnly {
|
||||||
|
|
||||||
function getCMSFields() {
|
function getCMSFields($params = null) {
|
||||||
$groups = DataObject::get('Group');
|
$groups = DataObject::get('Group');
|
||||||
$groupsMap = ($groups) ? $groups->map() : false;
|
$groupsMap = ($groups) ? $groups->map() : false;
|
||||||
$fields = new FieldList(
|
$fields = new FieldList(
|
||||||
|
@ -6,6 +6,9 @@ Group:
|
|||||||
childgroup:
|
childgroup:
|
||||||
Code: childgroup
|
Code: childgroup
|
||||||
Parent: =>Group.parentgroup
|
Parent: =>Group.parentgroup
|
||||||
|
grandchildgroup:
|
||||||
|
Code: grandchildgroup
|
||||||
|
Parent: =>Group.childgroup
|
||||||
group1:
|
group1:
|
||||||
Title: Group 1
|
Title: Group 1
|
||||||
group2:
|
group2:
|
||||||
@ -26,4 +29,4 @@ GroupTest_Member:
|
|||||||
Permission:
|
Permission:
|
||||||
admincode:
|
admincode:
|
||||||
Code: ADMIN
|
Code: ADMIN
|
||||||
Group: =>Group.admingroup
|
Group: =>Group.admingroup
|
||||||
|
@ -591,29 +591,29 @@ class MemberTest extends FunctionalTest {
|
|||||||
}
|
}
|
||||||
class MemberTest_ViewingAllowedExtension extends DataExtension implements TestOnly {
|
class MemberTest_ViewingAllowedExtension extends DataExtension implements TestOnly {
|
||||||
|
|
||||||
public function canView() {
|
public function canView($member = null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
class MemberTest_ViewingDeniedExtension extends DataExtension implements TestOnly {
|
class MemberTest_ViewingDeniedExtension extends DataExtension implements TestOnly {
|
||||||
|
|
||||||
public function canView() {
|
public function canView($member = null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
class MemberTest_EditingAllowedDeletingDeniedExtension extends DataExtension implements TestOnly {
|
class MemberTest_EditingAllowedDeletingDeniedExtension extends DataExtension implements TestOnly {
|
||||||
|
|
||||||
public function canView() {
|
public function canView($member = null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canEdit() {
|
public function canEdit($member = null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canDelete() {
|
public function canDelete($member = null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -930,7 +930,7 @@ class SSViewerTestFixture extends ViewableData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function XML_val($fieldName, $arguments = null) {
|
function XML_val($fieldName, $arguments = null, $cache = false) {
|
||||||
if(preg_match('/NotSet/i', $fieldName)) {
|
if(preg_match('/NotSet/i', $fieldName)) {
|
||||||
return '';
|
return '';
|
||||||
} else if(preg_match('/Raw/i', $fieldName)) {
|
} else if(preg_match('/Raw/i', $fieldName)) {
|
||||||
@ -940,7 +940,7 @@ class SSViewerTestFixture extends ViewableData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasValue($fieldName, $arguments = null) {
|
function hasValue($fieldName, $arguments = null, $cache = true) {
|
||||||
return (bool)$this->XML_val($fieldName, $arguments);
|
return (bool)$this->XML_val($fieldName, $arguments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1021,4 +1021,4 @@ class SSViewerTest_GlobalProvider implements TemplateGlobalProvider, TestOnly {
|
|||||||
return 'z' . implode(':', $args) . 'z';
|
return 'z' . implode(':', $args) . 'z';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
8
thirdparty/json/.piston.yml
vendored
@ -1,8 +0,0 @@
|
|||||||
---
|
|
||||||
format: 1
|
|
||||||
handler:
|
|
||||||
piston:remote-revision: 93520
|
|
||||||
piston:uuid: 467b73ca-7a2a-4603-9d3b-597d59a354a9
|
|
||||||
lock: false
|
|
||||||
repository_class: Piston::Svn::Repository
|
|
||||||
repository_url: http://svn.silverstripe.com/open/thirdparty/json/tags/1.31
|
|
806
thirdparty/json/JSON.php
vendored
@ -1,806 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts to and from JSON format.
|
|
||||||
*
|
|
||||||
* JSON (JavaScript Object Notation) is a lightweight data-interchange
|
|
||||||
* format. It is easy for humans to read and write. It is easy for machines
|
|
||||||
* to parse and generate. It is based on a subset of the JavaScript
|
|
||||||
* Programming Language, Standard ECMA-262 3rd Edition - December 1999.
|
|
||||||
* This feature can also be found in Python. JSON is a text format that is
|
|
||||||
* completely language independent but uses conventions that are familiar
|
|
||||||
* to programmers of the C-family of languages, including C, C++, C#, Java,
|
|
||||||
* JavaScript, Perl, TCL, and many others. These properties make JSON an
|
|
||||||
* ideal data-interchange language.
|
|
||||||
*
|
|
||||||
* This package provides a simple encoder and decoder for JSON notation. It
|
|
||||||
* is intended for use with client-side Javascript applications that make
|
|
||||||
* use of HTTPRequest to perform server communication functions - data can
|
|
||||||
* be encoded into JSON notation for use in a client-side javascript, or
|
|
||||||
* decoded from incoming Javascript requests. JSON format is native to
|
|
||||||
* Javascript, and can be directly eval()'ed with no further parsing
|
|
||||||
* overhead
|
|
||||||
*
|
|
||||||
* All strings should be in ASCII or UTF-8 format!
|
|
||||||
*
|
|
||||||
* LICENSE: Redistribution and use in source and binary forms, with or
|
|
||||||
* without modification, are permitted provided that the following
|
|
||||||
* conditions are met: Redistributions of source code must retain the
|
|
||||||
* above copyright notice, this list of conditions and the following
|
|
||||||
* disclaimer. Redistributions in binary form must reproduce the above
|
|
||||||
* copyright notice, this list of conditions and the following disclaimer
|
|
||||||
* in the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
||||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
|
||||||
* NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
||||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
|
||||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
|
||||||
* DAMAGE.
|
|
||||||
*
|
|
||||||
* @category
|
|
||||||
* @package Services_JSON
|
|
||||||
* @author Michal Migurski <mike-json@teczno.com>
|
|
||||||
* @author Matt Knapp <mdknapp[at]gmail[dot]com>
|
|
||||||
* @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
|
|
||||||
* @copyright 2005 Michal Migurski
|
|
||||||
* @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
|
|
||||||
* @license http://www.opensource.org/licenses/bsd-license.php
|
|
||||||
* @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
|
||||||
*/
|
|
||||||
define('SERVICES_JSON_SLICE', 1);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
|
||||||
*/
|
|
||||||
define('SERVICES_JSON_IN_STR', 2);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
|
||||||
*/
|
|
||||||
define('SERVICES_JSON_IN_ARR', 3);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
|
||||||
*/
|
|
||||||
define('SERVICES_JSON_IN_OBJ', 4);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
|
||||||
*/
|
|
||||||
define('SERVICES_JSON_IN_CMT', 5);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Behavior switch for Services_JSON::decode()
|
|
||||||
*/
|
|
||||||
define('SERVICES_JSON_LOOSE_TYPE', 16);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Behavior switch for Services_JSON::decode()
|
|
||||||
*/
|
|
||||||
define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts to and from JSON format.
|
|
||||||
*
|
|
||||||
* Brief example of use:
|
|
||||||
*
|
|
||||||
* <code>
|
|
||||||
* // create a new instance of Services_JSON
|
|
||||||
* $json = new Services_JSON();
|
|
||||||
*
|
|
||||||
* // convert a complexe value to JSON notation, and send it to the browser
|
|
||||||
* $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
|
|
||||||
* $output = $json->encode($value);
|
|
||||||
*
|
|
||||||
* print($output);
|
|
||||||
* // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
|
|
||||||
*
|
|
||||||
* // accept incoming POST data, assumed to be in JSON notation
|
|
||||||
* $input = file_get_contents('php://input', 1000000);
|
|
||||||
* $value = $json->decode($input);
|
|
||||||
* </code>
|
|
||||||
*/
|
|
||||||
class Services_JSON
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* constructs a new JSON instance
|
|
||||||
*
|
|
||||||
* @param int $use object behavior flags; combine with boolean-OR
|
|
||||||
*
|
|
||||||
* possible values:
|
|
||||||
* - SERVICES_JSON_LOOSE_TYPE: loose typing.
|
|
||||||
* "{...}" syntax creates associative arrays
|
|
||||||
* instead of objects in decode().
|
|
||||||
* - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
|
|
||||||
* Values which can't be encoded (e.g. resources)
|
|
||||||
* appear as NULL instead of throwing errors.
|
|
||||||
* By default, a deeply-nested resource will
|
|
||||||
* bubble up with an error, so all return values
|
|
||||||
* from encode() should be checked with isError()
|
|
||||||
*/
|
|
||||||
function Services_JSON($use = 0)
|
|
||||||
{
|
|
||||||
$this->use = $use;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* convert a string from one UTF-16 char to one UTF-8 char
|
|
||||||
*
|
|
||||||
* Normally should be handled by mb_convert_encoding, but
|
|
||||||
* provides a slower PHP-only method for installations
|
|
||||||
* that lack the multibye string extension.
|
|
||||||
*
|
|
||||||
* @param string $utf16 UTF-16 character
|
|
||||||
* @return string UTF-8 character
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function utf162utf8($utf16)
|
|
||||||
{
|
|
||||||
// oh please oh please oh please oh please oh please
|
|
||||||
if(function_exists('mb_convert_encoding')) {
|
|
||||||
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
|
|
||||||
}
|
|
||||||
|
|
||||||
$bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
|
|
||||||
|
|
||||||
switch(true) {
|
|
||||||
case ((0x7F & $bytes) == $bytes):
|
|
||||||
// this case should never be reached, because we are in ASCII range
|
|
||||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
|
||||||
return chr(0x7F & $bytes);
|
|
||||||
|
|
||||||
case (0x07FF & $bytes) == $bytes:
|
|
||||||
// return a 2-byte UTF-8 character
|
|
||||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
|
||||||
return chr(0xC0 | (($bytes >> 6) & 0x1F))
|
|
||||||
. chr(0x80 | ($bytes & 0x3F));
|
|
||||||
|
|
||||||
case (0xFFFF & $bytes) == $bytes:
|
|
||||||
// return a 3-byte UTF-8 character
|
|
||||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
|
||||||
return chr(0xE0 | (($bytes >> 12) & 0x0F))
|
|
||||||
. chr(0x80 | (($bytes >> 6) & 0x3F))
|
|
||||||
. chr(0x80 | ($bytes & 0x3F));
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignoring UTF-32 for now, sorry
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* convert a string from one UTF-8 char to one UTF-16 char
|
|
||||||
*
|
|
||||||
* Normally should be handled by mb_convert_encoding, but
|
|
||||||
* provides a slower PHP-only method for installations
|
|
||||||
* that lack the multibye string extension.
|
|
||||||
*
|
|
||||||
* @param string $utf8 UTF-8 character
|
|
||||||
* @return string UTF-16 character
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function utf82utf16($utf8)
|
|
||||||
{
|
|
||||||
// oh please oh please oh please oh please oh please
|
|
||||||
if(function_exists('mb_convert_encoding')) {
|
|
||||||
return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(strlen($utf8)) {
|
|
||||||
case 1:
|
|
||||||
// this case should never be reached, because we are in ASCII range
|
|
||||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
|
||||||
return $utf8;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
// return a UTF-16 character from a 2-byte UTF-8 char
|
|
||||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
|
||||||
return chr(0x07 & (ord($utf8{0}) >> 2))
|
|
||||||
. chr((0xC0 & (ord($utf8{0}) << 6))
|
|
||||||
| (0x3F & ord($utf8{1})));
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
// return a UTF-16 character from a 3-byte UTF-8 char
|
|
||||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
|
||||||
return chr((0xF0 & (ord($utf8{0}) << 4))
|
|
||||||
| (0x0F & (ord($utf8{1}) >> 2)))
|
|
||||||
. chr((0xC0 & (ord($utf8{1}) << 6))
|
|
||||||
| (0x7F & ord($utf8{2})));
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignoring UTF-32 for now, sorry
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* encodes an arbitrary variable into JSON format
|
|
||||||
*
|
|
||||||
* @param mixed $var any number, boolean, string, array, or object to be encoded.
|
|
||||||
* see argument 1 to Services_JSON() above for array-parsing behavior.
|
|
||||||
* if var is a strng, note that encode() always expects it
|
|
||||||
* to be in ASCII or UTF-8 format!
|
|
||||||
*
|
|
||||||
* @return mixed JSON string representation of input var or an error if a problem occurs
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function encode($var)
|
|
||||||
{
|
|
||||||
switch (gettype($var)) {
|
|
||||||
case 'boolean':
|
|
||||||
return $var ? 'true' : 'false';
|
|
||||||
|
|
||||||
case 'NULL':
|
|
||||||
return 'null';
|
|
||||||
|
|
||||||
case 'integer':
|
|
||||||
return (int) $var;
|
|
||||||
|
|
||||||
case 'double':
|
|
||||||
case 'float':
|
|
||||||
return (float) $var;
|
|
||||||
|
|
||||||
case 'string':
|
|
||||||
// STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
|
|
||||||
$ascii = '';
|
|
||||||
$strlen_var = strlen($var);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Iterate over every character in the string,
|
|
||||||
* escaping with a slash or encoding to UTF-8 where necessary
|
|
||||||
*/
|
|
||||||
for ($c = 0; $c < $strlen_var; ++$c) {
|
|
||||||
|
|
||||||
$ord_var_c = ord($var{$c});
|
|
||||||
|
|
||||||
switch (true) {
|
|
||||||
case $ord_var_c == 0x08:
|
|
||||||
$ascii .= '\b';
|
|
||||||
break;
|
|
||||||
case $ord_var_c == 0x09:
|
|
||||||
$ascii .= '\t';
|
|
||||||
break;
|
|
||||||
case $ord_var_c == 0x0A:
|
|
||||||
$ascii .= '\n';
|
|
||||||
break;
|
|
||||||
case $ord_var_c == 0x0C:
|
|
||||||
$ascii .= '\f';
|
|
||||||
break;
|
|
||||||
case $ord_var_c == 0x0D:
|
|
||||||
$ascii .= '\r';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case $ord_var_c == 0x22:
|
|
||||||
case $ord_var_c == 0x2F:
|
|
||||||
case $ord_var_c == 0x5C:
|
|
||||||
// double quote, slash, slosh
|
|
||||||
$ascii .= '\\'.$var{$c};
|
|
||||||
break;
|
|
||||||
|
|
||||||
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
|
|
||||||
// characters U-00000000 - U-0000007F (same as ASCII)
|
|
||||||
$ascii .= $var{$c};
|
|
||||||
break;
|
|
||||||
|
|
||||||
case (($ord_var_c & 0xE0) == 0xC0):
|
|
||||||
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
|
||||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
|
||||||
$char = pack('C*', $ord_var_c, ord($var{$c + 1}));
|
|
||||||
$c += 1;
|
|
||||||
$utf16 = $this->utf82utf16($char);
|
|
||||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case (($ord_var_c & 0xF0) == 0xE0):
|
|
||||||
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
|
||||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
|
||||||
$char = pack('C*', $ord_var_c,
|
|
||||||
ord($var{$c + 1}),
|
|
||||||
ord($var{$c + 2}));
|
|
||||||
$c += 2;
|
|
||||||
$utf16 = $this->utf82utf16($char);
|
|
||||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case (($ord_var_c & 0xF8) == 0xF0):
|
|
||||||
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
|
||||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
|
||||||
$char = pack('C*', $ord_var_c,
|
|
||||||
ord($var{$c + 1}),
|
|
||||||
ord($var{$c + 2}),
|
|
||||||
ord($var{$c + 3}));
|
|
||||||
$c += 3;
|
|
||||||
$utf16 = $this->utf82utf16($char);
|
|
||||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case (($ord_var_c & 0xFC) == 0xF8):
|
|
||||||
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
|
||||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
|
||||||
$char = pack('C*', $ord_var_c,
|
|
||||||
ord($var{$c + 1}),
|
|
||||||
ord($var{$c + 2}),
|
|
||||||
ord($var{$c + 3}),
|
|
||||||
ord($var{$c + 4}));
|
|
||||||
$c += 4;
|
|
||||||
$utf16 = $this->utf82utf16($char);
|
|
||||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case (($ord_var_c & 0xFE) == 0xFC):
|
|
||||||
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
|
||||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
|
||||||
$char = pack('C*', $ord_var_c,
|
|
||||||
ord($var{$c + 1}),
|
|
||||||
ord($var{$c + 2}),
|
|
||||||
ord($var{$c + 3}),
|
|
||||||
ord($var{$c + 4}),
|
|
||||||
ord($var{$c + 5}));
|
|
||||||
$c += 5;
|
|
||||||
$utf16 = $this->utf82utf16($char);
|
|
||||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return '"'.$ascii.'"';
|
|
||||||
|
|
||||||
case 'array':
|
|
||||||
/*
|
|
||||||
* As per JSON spec if any array key is not an integer
|
|
||||||
* we must treat the the whole array as an object. We
|
|
||||||
* also try to catch a sparsely populated associative
|
|
||||||
* array with numeric keys here because some JS engines
|
|
||||||
* will create an array with empty indexes up to
|
|
||||||
* max_index which can cause memory issues and because
|
|
||||||
* the keys, which may be relevant, will be remapped
|
|
||||||
* otherwise.
|
|
||||||
*
|
|
||||||
* As per the ECMA and JSON specification an object may
|
|
||||||
* have any string as a property. Unfortunately due to
|
|
||||||
* a hole in the ECMA specification if the key is a
|
|
||||||
* ECMA reserved word or starts with a digit the
|
|
||||||
* parameter is only accessible using ECMAScript's
|
|
||||||
* bracket notation.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// treat as a JSON object
|
|
||||||
if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
|
|
||||||
$properties = array_map(array($this, 'name_value'),
|
|
||||||
array_keys($var),
|
|
||||||
array_values($var));
|
|
||||||
|
|
||||||
foreach($properties as $property) {
|
|
||||||
if(Services_JSON::isError($property)) {
|
|
||||||
return $property;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return '{' . join(',', $properties) . '}';
|
|
||||||
}
|
|
||||||
|
|
||||||
// treat it like a regular array
|
|
||||||
$elements = array_map(array($this, 'encode'), $var);
|
|
||||||
|
|
||||||
foreach($elements as $element) {
|
|
||||||
if(Services_JSON::isError($element)) {
|
|
||||||
return $element;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return '[' . join(',', $elements) . ']';
|
|
||||||
|
|
||||||
case 'object':
|
|
||||||
$vars = get_object_vars($var);
|
|
||||||
|
|
||||||
$properties = array_map(array($this, 'name_value'),
|
|
||||||
array_keys($vars),
|
|
||||||
array_values($vars));
|
|
||||||
|
|
||||||
foreach($properties as $property) {
|
|
||||||
if(Services_JSON::isError($property)) {
|
|
||||||
return $property;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return '{' . join(',', $properties) . '}';
|
|
||||||
|
|
||||||
default:
|
|
||||||
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
|
|
||||||
? 'null'
|
|
||||||
: new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* array-walking function for use in generating JSON-formatted name-value pairs
|
|
||||||
*
|
|
||||||
* @param string $name name of key to use
|
|
||||||
* @param mixed $value reference to an array element to be encoded
|
|
||||||
*
|
|
||||||
* @return string JSON-formatted name-value pair, like '"name":value'
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function name_value($name, $value)
|
|
||||||
{
|
|
||||||
$encoded_value = $this->encode($value);
|
|
||||||
|
|
||||||
if(Services_JSON::isError($encoded_value)) {
|
|
||||||
return $encoded_value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->encode(strval($name)) . ':' . $encoded_value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* reduce a string by removing leading and trailing comments and whitespace
|
|
||||||
*
|
|
||||||
* @param $str string string value to strip of comments and whitespace
|
|
||||||
*
|
|
||||||
* @return string string value stripped of comments and whitespace
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function reduce_string($str)
|
|
||||||
{
|
|
||||||
$str = preg_replace(array(
|
|
||||||
|
|
||||||
// eliminate single line comments in '// ...' form
|
|
||||||
'#^\s*//(.+)$#m',
|
|
||||||
|
|
||||||
// eliminate multi-line comments in '/* ... */' form, at start of string
|
|
||||||
'#^\s*/\*(.+)\*/#Us',
|
|
||||||
|
|
||||||
// eliminate multi-line comments in '/* ... */' form, at end of string
|
|
||||||
'#/\*(.+)\*/\s*$#Us'
|
|
||||||
|
|
||||||
), '', $str);
|
|
||||||
|
|
||||||
// eliminate extraneous space
|
|
||||||
return trim($str);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* decodes a JSON string into appropriate variable
|
|
||||||
*
|
|
||||||
* @param string $str JSON-formatted string
|
|
||||||
*
|
|
||||||
* @return mixed number, boolean, string, array, or object
|
|
||||||
* corresponding to given JSON input string.
|
|
||||||
* See argument 1 to Services_JSON() above for object-output behavior.
|
|
||||||
* Note that decode() always returns strings
|
|
||||||
* in ASCII or UTF-8 format!
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function decode($str)
|
|
||||||
{
|
|
||||||
$str = $this->reduce_string($str);
|
|
||||||
|
|
||||||
switch (strtolower($str)) {
|
|
||||||
case 'true':
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case 'false':
|
|
||||||
return false;
|
|
||||||
|
|
||||||
case 'null':
|
|
||||||
return null;
|
|
||||||
|
|
||||||
default:
|
|
||||||
$m = array();
|
|
||||||
|
|
||||||
if (is_numeric($str)) {
|
|
||||||
// Lookie-loo, it's a number
|
|
||||||
|
|
||||||
// This would work on its own, but I'm trying to be
|
|
||||||
// good about returning integers where appropriate:
|
|
||||||
// return (float)$str;
|
|
||||||
|
|
||||||
// Return float or int, as appropriate
|
|
||||||
return ((float)$str == (integer)$str)
|
|
||||||
? (integer)$str
|
|
||||||
: (float)$str;
|
|
||||||
|
|
||||||
} elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
|
|
||||||
// STRINGS RETURNED IN UTF-8 FORMAT
|
|
||||||
$delim = substr($str, 0, 1);
|
|
||||||
$chrs = substr($str, 1, -1);
|
|
||||||
$utf8 = '';
|
|
||||||
$strlen_chrs = strlen($chrs);
|
|
||||||
|
|
||||||
for ($c = 0; $c < $strlen_chrs; ++$c) {
|
|
||||||
|
|
||||||
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
|
||||||
$ord_chrs_c = ord($chrs{$c});
|
|
||||||
|
|
||||||
switch (true) {
|
|
||||||
case $substr_chrs_c_2 == '\b':
|
|
||||||
$utf8 .= chr(0x08);
|
|
||||||
++$c;
|
|
||||||
break;
|
|
||||||
case $substr_chrs_c_2 == '\t':
|
|
||||||
$utf8 .= chr(0x09);
|
|
||||||
++$c;
|
|
||||||
break;
|
|
||||||
case $substr_chrs_c_2 == '\n':
|
|
||||||
$utf8 .= chr(0x0A);
|
|
||||||
++$c;
|
|
||||||
break;
|
|
||||||
case $substr_chrs_c_2 == '\f':
|
|
||||||
$utf8 .= chr(0x0C);
|
|
||||||
++$c;
|
|
||||||
break;
|
|
||||||
case $substr_chrs_c_2 == '\r':
|
|
||||||
$utf8 .= chr(0x0D);
|
|
||||||
++$c;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case $substr_chrs_c_2 == '\\"':
|
|
||||||
case $substr_chrs_c_2 == '\\\'':
|
|
||||||
case $substr_chrs_c_2 == '\\\\':
|
|
||||||
case $substr_chrs_c_2 == '\\/':
|
|
||||||
if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
|
|
||||||
($delim == "'" && $substr_chrs_c_2 != '\\"')) {
|
|
||||||
$utf8 .= $chrs{++$c};
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
|
|
||||||
// single, escaped unicode character
|
|
||||||
$utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
|
|
||||||
. chr(hexdec(substr($chrs, ($c + 4), 2)));
|
|
||||||
$utf8 .= $this->utf162utf8($utf16);
|
|
||||||
$c += 5;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
|
|
||||||
$utf8 .= $chrs{$c};
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ($ord_chrs_c & 0xE0) == 0xC0:
|
|
||||||
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
|
||||||
//see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
|
||||||
$utf8 .= substr($chrs, $c, 2);
|
|
||||||
++$c;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ($ord_chrs_c & 0xF0) == 0xE0:
|
|
||||||
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
|
||||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
|
||||||
$utf8 .= substr($chrs, $c, 3);
|
|
||||||
$c += 2;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ($ord_chrs_c & 0xF8) == 0xF0:
|
|
||||||
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
|
||||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
|
||||||
$utf8 .= substr($chrs, $c, 4);
|
|
||||||
$c += 3;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ($ord_chrs_c & 0xFC) == 0xF8:
|
|
||||||
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
|
||||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
|
||||||
$utf8 .= substr($chrs, $c, 5);
|
|
||||||
$c += 4;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ($ord_chrs_c & 0xFE) == 0xFC:
|
|
||||||
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
|
||||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
|
||||||
$utf8 .= substr($chrs, $c, 6);
|
|
||||||
$c += 5;
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return $utf8;
|
|
||||||
|
|
||||||
} elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
|
|
||||||
// array, or object notation
|
|
||||||
|
|
||||||
if ($str{0} == '[') {
|
|
||||||
$stk = array(SERVICES_JSON_IN_ARR);
|
|
||||||
$arr = array();
|
|
||||||
} else {
|
|
||||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
|
||||||
$stk = array(SERVICES_JSON_IN_OBJ);
|
|
||||||
$obj = array();
|
|
||||||
} else {
|
|
||||||
$stk = array(SERVICES_JSON_IN_OBJ);
|
|
||||||
$obj = new stdClass();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
array_push($stk, array('what' => SERVICES_JSON_SLICE,
|
|
||||||
'where' => 0,
|
|
||||||
'delim' => false));
|
|
||||||
|
|
||||||
$chrs = substr($str, 1, -1);
|
|
||||||
$chrs = $this->reduce_string($chrs);
|
|
||||||
|
|
||||||
if ($chrs == '') {
|
|
||||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
|
||||||
return $arr;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
return $obj;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//print("\nparsing {$chrs}\n");
|
|
||||||
|
|
||||||
$strlen_chrs = strlen($chrs);
|
|
||||||
|
|
||||||
for ($c = 0; $c <= $strlen_chrs; ++$c) {
|
|
||||||
|
|
||||||
$top = end($stk);
|
|
||||||
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
|
||||||
|
|
||||||
if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
|
|
||||||
// found a comma that is not inside a string, array, etc.,
|
|
||||||
// OR we've reached the end of the character list
|
|
||||||
$slice = substr($chrs, $top['where'], ($c - $top['where']));
|
|
||||||
array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
|
|
||||||
//print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
|
||||||
|
|
||||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
|
||||||
// we are in an array, so just push an element onto the stack
|
|
||||||
array_push($arr, $this->decode($slice));
|
|
||||||
|
|
||||||
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
|
|
||||||
// we are in an object, so figure
|
|
||||||
// out the property name and set an
|
|
||||||
// element in an associative array,
|
|
||||||
// for now
|
|
||||||
$parts = array();
|
|
||||||
|
|
||||||
if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
|
|
||||||
// "name":value pair
|
|
||||||
$key = $this->decode($parts[1]);
|
|
||||||
$val = $this->decode($parts[2]);
|
|
||||||
|
|
||||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
|
||||||
$obj[$key] = $val;
|
|
||||||
} else {
|
|
||||||
$obj->$key = $val;
|
|
||||||
}
|
|
||||||
} elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
|
|
||||||
// name:value pair, where name is unquoted
|
|
||||||
$key = $parts[1];
|
|
||||||
$val = $this->decode($parts[2]);
|
|
||||||
|
|
||||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
|
||||||
$obj[$key] = $val;
|
|
||||||
} else {
|
|
||||||
$obj->$key = $val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
|
|
||||||
// found a quote, and we are not inside a string
|
|
||||||
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
|
|
||||||
//print("Found start of string at {$c}\n");
|
|
||||||
|
|
||||||
} elseif (($chrs{$c} == $top['delim']) &&
|
|
||||||
($top['what'] == SERVICES_JSON_IN_STR) &&
|
|
||||||
((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
|
|
||||||
// found a quote, we're in a string, and it's not escaped
|
|
||||||
// we know that it's not escaped becase there is _not_ an
|
|
||||||
// odd number of backslashes at the end of the string so far
|
|
||||||
array_pop($stk);
|
|
||||||
//print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
|
|
||||||
|
|
||||||
} elseif (($chrs{$c} == '[') &&
|
|
||||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
|
||||||
// found a left-bracket, and we are in an array, object, or slice
|
|
||||||
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
|
|
||||||
//print("Found start of array at {$c}\n");
|
|
||||||
|
|
||||||
} elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
|
|
||||||
// found a right-bracket, and we're in an array
|
|
||||||
array_pop($stk);
|
|
||||||
//print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
|
||||||
|
|
||||||
} elseif (($chrs{$c} == '{') &&
|
|
||||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
|
||||||
// found a left-brace, and we are in an array, object, or slice
|
|
||||||
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
|
|
||||||
//print("Found start of object at {$c}\n");
|
|
||||||
|
|
||||||
} elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
|
|
||||||
// found a right-brace, and we're in an object
|
|
||||||
array_pop($stk);
|
|
||||||
//print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
|
||||||
|
|
||||||
} elseif (($substr_chrs_c_2 == '/*') &&
|
|
||||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
|
||||||
// found a comment start, and we are in an array, object, or slice
|
|
||||||
array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
|
|
||||||
$c++;
|
|
||||||
//print("Found start of comment at {$c}\n");
|
|
||||||
|
|
||||||
} elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
|
|
||||||
// found a comment end, and we're in one now
|
|
||||||
array_pop($stk);
|
|
||||||
$c++;
|
|
||||||
|
|
||||||
for ($i = $top['where']; $i <= $c; ++$i)
|
|
||||||
$chrs = substr_replace($chrs, ' ', $i, 1);
|
|
||||||
|
|
||||||
//print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
|
||||||
return $arr;
|
|
||||||
|
|
||||||
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
|
|
||||||
return $obj;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @todo Ultimately, this should just call PEAR::isError()
|
|
||||||
*/
|
|
||||||
function isError($data, $code = null)
|
|
||||||
{
|
|
||||||
if (class_exists('pear')) {
|
|
||||||
return PEAR::isError($data, $code);
|
|
||||||
} elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
|
|
||||||
is_subclass_of($data, 'services_json_error'))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (class_exists('PEAR_Error')) {
|
|
||||||
|
|
||||||
class Services_JSON_Error extends PEAR_Error
|
|
||||||
{
|
|
||||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
|
||||||
$mode = null, $options = null, $userinfo = null)
|
|
||||||
{
|
|
||||||
parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @todo Ultimately, this class shall be descended from PEAR_Error
|
|
||||||
*/
|
|
||||||
class Services_JSON_Error
|
|
||||||
{
|
|
||||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
|
||||||
$mode = null, $options = null, $userinfo = null)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
21
thirdparty/json/LICENSE
vendored
@ -1,21 +0,0 @@
|
|||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are
|
|
||||||
met:
|
|
||||||
|
|
||||||
Redistributions of source code must retain the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
||||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
|
||||||
NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
|
||||||
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
||||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
||||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
521
thirdparty/json/Test-JSON.php
vendored
@ -1,521 +0,0 @@
|
|||||||
<?php
|
|
||||||
// $Id: Test-JSON.php,v 1.28 2006/06/28 05:54:17 migurski Exp $
|
|
||||||
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unit tests for Services_JSON.
|
|
||||||
* @see JSON.php
|
|
||||||
*
|
|
||||||
* @category
|
|
||||||
* @package Services_JSON
|
|
||||||
* @author Michal Migurski <mike-json@teczno.com>
|
|
||||||
* @author Matt Knapp <mdknapp[at]gmail[dot]com>
|
|
||||||
* @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
|
|
||||||
* @copyright 2005 Michal Migurski
|
|
||||||
* @version CVS: $Id: Test-JSON.php,v 1.28 2006/06/28 05:54:17 migurski Exp $
|
|
||||||
* @license http://www.opensource.org/licenses/bsd-license.php
|
|
||||||
* @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
|
|
||||||
*/
|
|
||||||
|
|
||||||
error_reporting(E_ALL);
|
|
||||||
|
|
||||||
require_once 'PHPUnit.php';
|
|
||||||
require_once 'JSON.php';
|
|
||||||
|
|
||||||
class Services_JSON_EncDec_TestCase extends PHPUnit_TestCase {
|
|
||||||
|
|
||||||
function Services_JSON_EncDec_TestCase($name) {
|
|
||||||
$this->PHPUnit_TestCase($name);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setUp() {
|
|
||||||
$this->json = new Services_JSON();
|
|
||||||
|
|
||||||
$obj = new stdClass();
|
|
||||||
$obj->a_string = '"he":llo}:{world';
|
|
||||||
$obj->an_array = array(1, 2, 3);
|
|
||||||
$obj->obj = new stdClass();
|
|
||||||
$obj->obj->a_number = 123;
|
|
||||||
|
|
||||||
$this->obj = $obj;
|
|
||||||
$this->obj_j = '{"a_string":"\"he\":llo}:{world","an_array":[1,2,3],"obj":{"a_number":123}}';
|
|
||||||
$this->obj_d = 'object with properties, nested object and arrays';
|
|
||||||
|
|
||||||
$this->arr = array(null, true, array(1, 2, 3), "hello\"],[world!");
|
|
||||||
$this->arr_j = '[null,true,[1,2,3],"hello\"],[world!"]';
|
|
||||||
$this->arr_d = 'array with elements and nested arrays';
|
|
||||||
|
|
||||||
$this->str1 = 'hello world';
|
|
||||||
$this->str1_j = '"hello world"';
|
|
||||||
$this->str1_j_ = "'hello world'";
|
|
||||||
$this->str1_d = 'hello world';
|
|
||||||
$this->str1_d_ = 'hello world, double quotes';
|
|
||||||
|
|
||||||
$this->str2 = "hello\t\"world\"";
|
|
||||||
$this->str2_j = '"hello\\t\\"world\\""';
|
|
||||||
$this->str2_d = 'hello world, with tab, double-quotes';
|
|
||||||
|
|
||||||
$this->str3 = "\\\r\n\t\"/";
|
|
||||||
$this->str3_j = '"\\\\\\r\\n\\t\\"\\/"';
|
|
||||||
$this->str3_d = 'backslash, return, newline, tab, double-quote';
|
|
||||||
|
|
||||||
$this->str4 = 'héllö wørłd';
|
|
||||||
$this->str4_j = '"h\u00e9ll\u00f6 w\u00f8r\u0142d"';
|
|
||||||
$this->str4_j_ = '"héllö wørłd"';
|
|
||||||
$this->str4_d = 'hello world, with unicode';
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_to_JSON()
|
|
||||||
{
|
|
||||||
$this->assertEquals('null', $this->json->encode(null), 'type case: null');
|
|
||||||
$this->assertEquals('true', $this->json->encode(true), 'type case: boolean true');
|
|
||||||
$this->assertEquals('false', $this->json->encode(false), 'type case: boolean false');
|
|
||||||
|
|
||||||
$this->assertEquals('1', $this->json->encode(1), 'numeric case: 1');
|
|
||||||
$this->assertEquals('-1', $this->json->encode(-1), 'numeric case: -1');
|
|
||||||
$this->assertEquals('1.000000', $this->json->encode(1.0), 'numeric case: 1.0');
|
|
||||||
$this->assertEquals('1.100000', $this->json->encode(1.1), 'numeric case: 1.1');
|
|
||||||
|
|
||||||
$this->assertEquals($this->str1_j, $this->json->encode($this->str1), "string case: {$this->str1_d}");
|
|
||||||
$this->assertEquals($this->str2_j, $this->json->encode($this->str2), "string case: {$this->str2_d}");
|
|
||||||
$this->assertEquals($this->str3_j, $this->json->encode($this->str3), "string case: {$this->str3_d}");
|
|
||||||
$this->assertEquals($this->str4_j, $this->json->encode($this->str4), "string case: {$this->str4_d}");
|
|
||||||
|
|
||||||
$this->assertEquals($this->arr_j, $this->json->encode($this->arr), "array case: {$this->arr_d}");
|
|
||||||
$this->assertEquals($this->obj_j, $this->json->encode($this->obj), "object case: {$this->obj_d}");
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_from_JSON()
|
|
||||||
{
|
|
||||||
$this->assertEquals(null, $this->json->decode('null'), 'type case: null');
|
|
||||||
$this->assertEquals(true, $this->json->decode('true'), 'type case: boolean true');
|
|
||||||
$this->assertEquals(false, $this->json->decode('false'), 'type case: boolean false');
|
|
||||||
|
|
||||||
$this->assertEquals(1, $this->json->decode('1'), 'numeric case: 1');
|
|
||||||
$this->assertEquals(-1, $this->json->decode('-1'), 'numeric case: -1');
|
|
||||||
$this->assertEquals(1.0, $this->json->decode('1.0'), 'numeric case: 1.0');
|
|
||||||
$this->assertEquals(1.1, $this->json->decode('1.1'), 'numeric case: 1.1');
|
|
||||||
|
|
||||||
$this->assertEquals(11.0, $this->json->decode('1.1e1'), 'numeric case: 1.1e1');
|
|
||||||
$this->assertEquals(11.0, $this->json->decode('1.10e+1'), 'numeric case: 1.10e+1');
|
|
||||||
$this->assertEquals(0.11, $this->json->decode('1.1e-1'), 'numeric case: 1.1e-1');
|
|
||||||
$this->assertEquals(-0.11, $this->json->decode('-1.1e-1'), 'numeric case: -1.1e-1');
|
|
||||||
|
|
||||||
$this->assertEquals($this->str1, $this->json->decode($this->str1_j), "string case: {$this->str1_d}");
|
|
||||||
$this->assertEquals($this->str1, $this->json->decode($this->str1_j_), "string case: {$this->str1_d_}");
|
|
||||||
$this->assertEquals($this->str2, $this->json->decode($this->str2_j), "string case: {$this->str2_d}");
|
|
||||||
$this->assertEquals($this->str3, $this->json->decode($this->str3_j), "string case: {$this->str3_d}");
|
|
||||||
$this->assertEquals($this->str4, $this->json->decode($this->str4_j), "string case: {$this->str4_d}");
|
|
||||||
$this->assertEquals($this->str4, $this->json->decode($this->str4_j_), "string case: {$this->str4_d}");
|
|
||||||
|
|
||||||
$this->assertEquals($this->arr, $this->json->decode($this->arr_j), "array case: {$this->arr_d}");
|
|
||||||
$this->assertEquals($this->obj, $this->json->decode($this->obj_j), "object case: {$this->obj_d}");
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_to_then_from_JSON()
|
|
||||||
{
|
|
||||||
$this->assertEquals(null, $this->json->decode($this->json->encode(null)), 'type case: null');
|
|
||||||
$this->assertEquals(true, $this->json->decode($this->json->encode(true)), 'type case: boolean true');
|
|
||||||
$this->assertEquals(false, $this->json->decode($this->json->encode(false)), 'type case: boolean false');
|
|
||||||
|
|
||||||
$this->assertEquals(1, $this->json->decode($this->json->encode(1)), 'numeric case: 1');
|
|
||||||
$this->assertEquals(-1, $this->json->decode($this->json->encode(-1)), 'numeric case: -1');
|
|
||||||
$this->assertEquals(1.0, $this->json->decode($this->json->encode(1.0)), 'numeric case: 1.0');
|
|
||||||
$this->assertEquals(1.1, $this->json->decode($this->json->encode(1.1)), 'numeric case: 1.1');
|
|
||||||
|
|
||||||
$this->assertEquals($this->str1, $this->json->decode($this->json->encode($this->str1)), "string case: {$this->str1_d}");
|
|
||||||
$this->assertEquals($this->str2, $this->json->decode($this->json->encode($this->str2)), "string case: {$this->str2_d}");
|
|
||||||
$this->assertEquals($this->str3, $this->json->decode($this->json->encode($this->str3)), "string case: {$this->str3_d}");
|
|
||||||
$this->assertEquals($this->str4, $this->json->decode($this->json->encode($this->str4)), "string case: {$this->str4_d}");
|
|
||||||
|
|
||||||
$this->assertEquals($this->arr, $this->json->decode($this->json->encode($this->arr)), "array case: {$this->arr_d}");
|
|
||||||
$this->assertEquals($this->obj, $this->json->decode($this->json->encode($this->obj)), "object case: {$this->obj_d}");
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_from_then_to_JSON()
|
|
||||||
{
|
|
||||||
$this->assertEquals('null', $this->json->encode($this->json->decode('null')), 'type case: null');
|
|
||||||
$this->assertEquals('true', $this->json->encode($this->json->decode('true')), 'type case: boolean true');
|
|
||||||
$this->assertEquals('false', $this->json->encode($this->json->decode('false')), 'type case: boolean false');
|
|
||||||
|
|
||||||
$this->assertEquals('1', $this->json->encode($this->json->decode('1')), 'numeric case: 1');
|
|
||||||
$this->assertEquals('-1', $this->json->encode($this->json->decode('-1')), 'numeric case: -1');
|
|
||||||
$this->assertEquals('1.0', $this->json->encode($this->json->decode('1.0')), 'numeric case: 1.0');
|
|
||||||
$this->assertEquals('1.1', $this->json->encode($this->json->decode('1.1')), 'numeric case: 1.1');
|
|
||||||
|
|
||||||
$this->assertEquals($this->str1_j, $this->json->encode($this->json->decode($this->str1_j)), "string case: {$this->str1_d}");
|
|
||||||
$this->assertEquals($this->str2_j, $this->json->encode($this->json->decode($this->str2_j)), "string case: {$this->str2_d}");
|
|
||||||
$this->assertEquals($this->str3_j, $this->json->encode($this->json->decode($this->str3_j)), "string case: {$this->str3_d}");
|
|
||||||
$this->assertEquals($this->str4_j, $this->json->encode($this->json->decode($this->str4_j)), "string case: {$this->str4_d}");
|
|
||||||
$this->assertEquals($this->str4_j, $this->json->encode($this->json->decode($this->str4_j_)), "string case: {$this->str4_d}");
|
|
||||||
|
|
||||||
$this->assertEquals($this->arr_j, $this->json->encode($this->json->decode($this->arr_j)), "array case: {$this->arr_d}");
|
|
||||||
$this->assertEquals($this->obj_j, $this->json->encode($this->json->decode($this->obj_j)), "object case: {$this->obj_d}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Services_JSON_AssocArray_TestCase extends PHPUnit_TestCase {
|
|
||||||
|
|
||||||
function Services_JSON_AssocArray_TestCase($name) {
|
|
||||||
$this->PHPUnit_TestCase($name);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setUp() {
|
|
||||||
$this->json_l = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
|
|
||||||
$this->json_s = new Services_JSON();
|
|
||||||
|
|
||||||
$this->arr = array('car1'=> array('color'=> 'tan', 'model' => 'sedan'),
|
|
||||||
'car2' => array('color' => 'red', 'model' => 'sports'));
|
|
||||||
$this->arr_jo = '{"car1":{"color":"tan","model":"sedan"},"car2":{"color":"red","model":"sports"}}';
|
|
||||||
$this->arr_d = 'associative array with nested associative arrays';
|
|
||||||
|
|
||||||
$this->arn = array(0=> array(0=> 'tan\\', 'model\\' => 'sedan'), 1 => array(0 => 'red', 'model' => 'sports'));
|
|
||||||
$this->arn_ja = '[{"0":"tan\\\\","model\\\\":"sedan"},{"0":"red","model":"sports"}]';
|
|
||||||
$this->arn_d = 'associative array with nested associative arrays, and some numeric keys thrown in';
|
|
||||||
|
|
||||||
$this->arrs = array (1 => 'one', 2 => 'two', 5 => 'five');
|
|
||||||
$this->arrs_jo = '{"1":"one","2":"two","5":"five"}';
|
|
||||||
$this->arrs_d = 'associative array numeric keys which are not fully populated in a range of 0 to length-1';
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_type()
|
|
||||||
{
|
|
||||||
$this->assertEquals('array', gettype($this->json_l->decode($this->arn_ja)), "loose type should be array");
|
|
||||||
$this->assertEquals('array', gettype($this->json_s->decode($this->arn_ja)), "strict type should be array");
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_to_JSON()
|
|
||||||
{
|
|
||||||
// both strict and loose JSON should result in an object
|
|
||||||
$this->assertEquals($this->arr_jo, $this->json_l->encode($this->arr), "array case - loose: {$this->arr_d}");
|
|
||||||
$this->assertEquals($this->arr_jo, $this->json_s->encode($this->arr), "array case - strict: {$this->arr_d}");
|
|
||||||
|
|
||||||
// ...unless the input array has some numeric indeces, in which case the behavior is to degrade to a regular array
|
|
||||||
$this->assertEquals($this->arn_ja, $this->json_s->encode($this->arn), "array case - strict: {$this->arn_d}");
|
|
||||||
|
|
||||||
// Test a sparsely populated numerically indexed associative array
|
|
||||||
$this->assertEquals($this->arrs_jo, $this->json_l->encode($this->arrs), "sparse numeric assoc array: {$this->arrs_d}");
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_to_then_from_JSON()
|
|
||||||
{
|
|
||||||
// these tests motivated by a bug in which strings that end
|
|
||||||
// with backslashes followed by quotes were incorrectly decoded.
|
|
||||||
|
|
||||||
foreach(array('\\"', '\\\\"', '\\"\\"', '\\""\\""', '\\\\"\\\\"') as $v) {
|
|
||||||
$this->assertEquals(array($v), $this->json_l->decode($this->json_l->encode(array($v))));
|
|
||||||
$this->assertEquals(array('a' => $v), $this->json_l->decode($this->json_l->encode(array('a' => $v))));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Services_JSON_NestedArray_TestCase extends PHPUnit_TestCase {
|
|
||||||
|
|
||||||
function Services_JSON_NestedArray_TestCase($name) {
|
|
||||||
$this->PHPUnit_TestCase($name);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setUp() {
|
|
||||||
$this->json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
|
|
||||||
|
|
||||||
$this->str1 = '[{"this":"that"}]';
|
|
||||||
$this->arr1 = array(array('this' => 'that'));
|
|
||||||
|
|
||||||
$this->str2 = '{"this":["that"]}';
|
|
||||||
$this->arr2 = array('this' => array('that'));
|
|
||||||
|
|
||||||
$this->str3 = '{"params":[{"foo":["1"],"bar":"1"}]}';
|
|
||||||
$this->arr3 = array('params' => array(array('foo' => array('1'), 'bar' => '1')));
|
|
||||||
|
|
||||||
$this->str4 = '{"0": {"foo": "bar", "baz": "winkle"}}';
|
|
||||||
$this->arr4 = array('0' => array('foo' => 'bar', 'baz' => 'winkle'));
|
|
||||||
|
|
||||||
$this->str5 = '{"params":[{"options": {"old": [ ], "new": {"0": {"elements": {"old": [], "new": {"0": {"elementName": "aa", "isDefault": false, "elementRank": "0", "priceAdjust": "0", "partNumber": ""}}}, "optionName": "aa", "isRequired": false, "optionDesc": null}}}}]}';
|
|
||||||
$this->arr5 = array (
|
|
||||||
'params' => array (
|
|
||||||
0 => array (
|
|
||||||
'options' =>
|
|
||||||
array (
|
|
||||||
'old' => array(),
|
|
||||||
'new' => array (
|
|
||||||
0 => array (
|
|
||||||
'elements' => array (
|
|
||||||
'old' => array(),
|
|
||||||
'new' => array (
|
|
||||||
0 => array (
|
|
||||||
'elementName' => 'aa',
|
|
||||||
'isDefault' => false,
|
|
||||||
'elementRank' => '0',
|
|
||||||
'priceAdjust' => '0',
|
|
||||||
'partNumber' => '',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'optionName' => 'aa',
|
|
||||||
'isRequired' => false,
|
|
||||||
'optionDesc' => NULL,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_type()
|
|
||||||
{
|
|
||||||
$this->assertEquals('array', gettype($this->json->decode($this->str1)), "loose type should be array");
|
|
||||||
$this->assertEquals('array', gettype($this->json->decode($this->str2)), "loose type should be array");
|
|
||||||
$this->assertEquals('array', gettype($this->json->decode($this->str3)), "loose type should be array");
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_from_JSON()
|
|
||||||
{
|
|
||||||
$this->assertEquals($this->arr1, $this->json->decode($this->str1), "simple compactly-nested array");
|
|
||||||
$this->assertEquals($this->arr2, $this->json->decode($this->str2), "simple compactly-nested array");
|
|
||||||
$this->assertEquals($this->arr3, $this->json->decode($this->str3), "complex compactly nested array");
|
|
||||||
$this->assertEquals($this->arr4, $this->json->decode($this->str4), "complex compactly nested array");
|
|
||||||
$this->assertEquals($this->arr5, $this->json->decode($this->str5), "super complex compactly nested array");
|
|
||||||
}
|
|
||||||
|
|
||||||
function _test_from_JSON()
|
|
||||||
{
|
|
||||||
$super = '{"params":[{"options": {"old": {}, "new": {"0": {"elements": {"old": {}, "new": {"0": {"elementName": "aa", "isDefault": false, "elementRank": "0", "priceAdjust": "0", "partNumber": ""}}}, "optionName": "aa", "isRequired": false, "optionDesc": ""}}}}]}';
|
|
||||||
print("trying {$super}...\n");
|
|
||||||
print var_export($this->json->decode($super));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Services_JSON_Object_TestCase extends PHPUnit_TestCase {
|
|
||||||
|
|
||||||
function Services_JSON_Object_TestCase($name) {
|
|
||||||
$this->PHPUnit_TestCase($name);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setUp() {
|
|
||||||
$this->json_l = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
|
|
||||||
$this->json_s = new Services_JSON();
|
|
||||||
|
|
||||||
$this->obj_j = '{"a_string":"\"he\":llo}:{world","an_array":[1,2,3],"obj":{"a_number":123}}';
|
|
||||||
|
|
||||||
$this->obj1->car1->color = 'tan';
|
|
||||||
$this->obj1->car1->model = 'sedan';
|
|
||||||
$this->obj1->car2->color = 'red';
|
|
||||||
$this->obj1->car2->model = 'sports';
|
|
||||||
$this->obj1_j = '{"car1":{"color":"tan","model":"sedan"},"car2":{"color":"red","model":"sports"}}';
|
|
||||||
$this->obj1_d = 'Object with nested objects';
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_type()
|
|
||||||
{
|
|
||||||
$this->assertEquals('object', gettype($this->json_s->decode($this->obj_j)), "checking whether decoded type is object");
|
|
||||||
$this->assertEquals('array', gettype($this->json_l->decode($this->obj_j)), "checking whether decoded type is array");
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_to_JSON()
|
|
||||||
{
|
|
||||||
$this->assertEquals($this->obj1_j, $this->json_s->encode($this->obj1), "object - strict: {$this->obj1_d}");
|
|
||||||
$this->assertEquals($this->obj1_j, $this->json_l->encode($this->obj1), "object - loose: {$this->obj1_d}");
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_from_then_to_JSON()
|
|
||||||
{
|
|
||||||
$this->assertEquals($this->obj_j, $this->json_s->encode($this->json_s->decode($this->obj_j)), "object case");
|
|
||||||
$this->assertEquals($this->obj_j, $this->json_l->encode($this->json_l->decode($this->obj_j)), "array case");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Services_JSON_Spaces_Comments_TestCase extends PHPUnit_TestCase {
|
|
||||||
|
|
||||||
function Services_JSON_Spaces_Comments_TestCase($name) {
|
|
||||||
$this->PHPUnit_TestCase($name);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setUp() {
|
|
||||||
$this->json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
|
|
||||||
|
|
||||||
$this->obj_j = '{"a_string":"\"he\":llo}:{world","an_array":[1,2,3],"obj":{"a_number":123}}';
|
|
||||||
|
|
||||||
$this->obj_js = '{"a_string": "\"he\":llo}:{world",
|
|
||||||
"an_array":[1, 2, 3],
|
|
||||||
"obj": {"a_number":123}}';
|
|
||||||
|
|
||||||
$this->obj_jc1 = '{"a_string": "\"he\":llo}:{world",
|
|
||||||
// here is a comment, hoorah
|
|
||||||
"an_array":[1, 2, 3],
|
|
||||||
"obj": {"a_number":123}}';
|
|
||||||
|
|
||||||
$this->obj_jc2 = '/* this here is the sneetch */ "the sneetch"
|
|
||||||
// this has been the sneetch.';
|
|
||||||
|
|
||||||
$this->obj_jc3 = '{"a_string": "\"he\":llo}:{world",
|
|
||||||
/* here is a comment, hoorah */
|
|
||||||
"an_array":[1, 2, 3 /* and here is another */],
|
|
||||||
"obj": {"a_number":123}}';
|
|
||||||
|
|
||||||
$this->obj_jc4 = '{\'a_string\': "\"he\":llo}:{world",
|
|
||||||
/* here is a comment, hoorah */
|
|
||||||
\'an_array\':[1, 2, 3 /* and here is another */],
|
|
||||||
"obj": {"a_number":123}}';
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_spaces()
|
|
||||||
{
|
|
||||||
$this->assertEquals($this->json->decode($this->obj_j), $this->json->decode($this->obj_js), "checking whether notation with spaces works");
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_comments()
|
|
||||||
{
|
|
||||||
$this->assertEquals($this->json->decode($this->obj_j), $this->json->decode($this->obj_jc1), "checking whether notation with single line comments works");
|
|
||||||
$this->assertEquals('the sneetch', $this->json->decode($this->obj_jc2), "checking whether notation with multiline comments works");
|
|
||||||
$this->assertEquals($this->json->decode($this->obj_j), $this->json->decode($this->obj_jc3), "checking whether notation with multiline comments works");
|
|
||||||
$this->assertEquals($this->json->decode($this->obj_j), $this->json->decode($this->obj_jc4), "checking whether notation with single-quotes and multiline comments works");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Services_JSON_Empties_TestCase extends PHPUnit_TestCase {
|
|
||||||
|
|
||||||
function Services_JSON_Empties_TestCase($name) {
|
|
||||||
$this->PHPUnit_TestCase($name);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setUp() {
|
|
||||||
$this->json_l = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
|
|
||||||
$this->json_s = new Services_JSON();
|
|
||||||
|
|
||||||
$this->obj0_j = '{}';
|
|
||||||
$this->arr0_j = '[]';
|
|
||||||
|
|
||||||
$this->obj1_j = '{ }';
|
|
||||||
$this->arr1_j = '[ ]';
|
|
||||||
|
|
||||||
$this->obj2_j = '{ /* comment inside */ }';
|
|
||||||
$this->arr2_j = '[ /* comment inside */ ]';
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_type()
|
|
||||||
{
|
|
||||||
$this->assertEquals('array', gettype($this->json_l->decode($this->arr0_j)), "should be array");
|
|
||||||
$this->assertEquals('object', gettype($this->json_s->decode($this->obj0_j)), "should be object");
|
|
||||||
|
|
||||||
$this->assertEquals(0, count($this->json_l->decode($this->arr0_j)), "should be empty array");
|
|
||||||
$this->assertEquals(0, count(get_object_vars($this->json_s->decode($this->obj0_j))), "should be empty object");
|
|
||||||
|
|
||||||
$this->assertEquals('array', gettype($this->json_l->decode($this->arr1_j)), "should be array, even with space");
|
|
||||||
$this->assertEquals('object', gettype($this->json_s->decode($this->obj1_j)), "should be object, even with space");
|
|
||||||
|
|
||||||
$this->assertEquals(0, count($this->json_l->decode($this->arr1_j)), "should be empty array, even with space");
|
|
||||||
$this->assertEquals(0, count(get_object_vars($this->json_s->decode($this->obj1_j))), "should be empty object, even with space");
|
|
||||||
|
|
||||||
$this->assertEquals('array', gettype($this->json_l->decode($this->arr2_j)), "should be array, despite comment");
|
|
||||||
$this->assertEquals('object', gettype($this->json_s->decode($this->obj2_j)), "should be object, despite comment");
|
|
||||||
|
|
||||||
$this->assertEquals(0, count($this->json_l->decode($this->arr2_j)), "should be empty array, despite comment");
|
|
||||||
$this->assertEquals(0, count(get_object_vars($this->json_s->decode($this->obj2_j))), "should be empty object, despite commentt");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Services_JSON_UnquotedKeys_TestCase extends PHPUnit_TestCase {
|
|
||||||
|
|
||||||
function Services_JSON_UnquotedKeys_TestCase($name) {
|
|
||||||
$this->PHPUnit_TestCase($name);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setUp() {
|
|
||||||
$this->json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
|
|
||||||
|
|
||||||
$this->arn = array(0=> array(0=> 'tan', 'model' => 'sedan'), 1 => array(0 => 'red', 'model' => 'sports'));
|
|
||||||
$this->arn_ja = '[{0:"tan","model":"sedan"},{"0":"red",model:"sports"}]';
|
|
||||||
$this->arn_d = 'associative array with unquoted keys, nested associative arrays, and some numeric keys thrown in';
|
|
||||||
|
|
||||||
$this->arrs = array (1 => 'one', 2 => 'two', 5 => 'fi"ve');
|
|
||||||
$this->arrs_jo = '{"1":"one",2:"two","5":\'fi"ve\'}';
|
|
||||||
$this->arrs_d = 'associative array with unquoted keys, single-quoted values, numeric keys which are not fully populated in a range of 0 to length-1';
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_from_JSON()
|
|
||||||
{
|
|
||||||
// ...unless the input array has some numeric indeces, in which case the behavior is to degrade to a regular array
|
|
||||||
$this->assertEquals($this->arn, $this->json->decode($this->arn_ja), "array case - strict: {$this->arn_d}");
|
|
||||||
|
|
||||||
// Test a sparsely populated numerically indexed associative array
|
|
||||||
$this->assertEquals($this->arrs, $this->json->decode($this->arrs_jo), "sparse numeric assoc array: {$this->arrs_d}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Services_JSON_ErrorSuppression_TestCase extends PHPUnit_TestCase {
|
|
||||||
|
|
||||||
function Services_JSON_ErrorSuppression_TestCase($name) {
|
|
||||||
$this->PHPUnit_TestCase($name);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setUp() {
|
|
||||||
$this->json = new Services_JSON();
|
|
||||||
$this->json_ = new Services_JSON(SERVICES_JSON_SUPPRESS_ERRORS);
|
|
||||||
|
|
||||||
$this->res = tmpfile();
|
|
||||||
$this->res_j_ = 'null';
|
|
||||||
$this->res_d = 'naked resource';
|
|
||||||
|
|
||||||
$this->arr = array('a', 1, tmpfile());
|
|
||||||
$this->arr_j_ = '["a",1,null]';
|
|
||||||
$this->arr_d = 'array with string, number and resource';
|
|
||||||
|
|
||||||
$obj = new stdClass();
|
|
||||||
$obj->a_string = '"he":llo}:{world';
|
|
||||||
$obj->an_array = array(1, 2, 3);
|
|
||||||
$obj->resource = tmpfile();
|
|
||||||
|
|
||||||
$this->obj = $obj;
|
|
||||||
$this->obj_j_ = '{"a_string":"\"he\":llo}:{world","an_array":[1,2,3],"resource":null}';
|
|
||||||
$this->obj_d = 'object with properties, array, and nested resource';
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_to_JSON()
|
|
||||||
{
|
|
||||||
$this->assertTrue(Services_JSON::isError($this->json->encode($this->res)), "resource case: {$this->res_d}");
|
|
||||||
$this->assertTrue(Services_JSON::isError($this->json->encode($this->arr)), "array case: {$this->arr_d}");
|
|
||||||
$this->assertTrue(Services_JSON::isError($this->json->encode($this->obj)), "object case: {$this->obj_d}");
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_to_JSON_suppressed()
|
|
||||||
{
|
|
||||||
$this->assertEquals($this->res_j_, $this->json_->encode($this->res), "resource case: {$this->res_d}");
|
|
||||||
$this->assertEquals($this->arr_j_, $this->json_->encode($this->arr), "array case: {$this->arr_d}");
|
|
||||||
$this->assertEquals($this->obj_j_, $this->json_->encode($this->obj), "object case: {$this->obj_d}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$suite = new PHPUnit_TestSuite('Services_JSON_EncDec_TestCase');
|
|
||||||
$result = PHPUnit::run($suite);
|
|
||||||
echo $result->toString();
|
|
||||||
|
|
||||||
$suite = new PHPUnit_TestSuite('Services_JSON_AssocArray_TestCase');
|
|
||||||
$result = PHPUnit::run($suite);
|
|
||||||
echo $result->toString();
|
|
||||||
|
|
||||||
$suite = new PHPUnit_TestSuite('Services_JSON_NestedArray_TestCase');
|
|
||||||
$result = PHPUnit::run($suite);
|
|
||||||
echo $result->toString();
|
|
||||||
|
|
||||||
$suite = new PHPUnit_TestSuite('Services_JSON_Object_TestCase');
|
|
||||||
$result = PHPUnit::run($suite);
|
|
||||||
echo $result->toString();
|
|
||||||
|
|
||||||
$suite = new PHPUnit_TestSuite('Services_JSON_Spaces_Comments_TestCase');
|
|
||||||
$result = PHPUnit::run($suite);
|
|
||||||
echo $result->toString();
|
|
||||||
|
|
||||||
$suite = new PHPUnit_TestSuite('Services_JSON_Empties_TestCase');
|
|
||||||
$result = PHPUnit::run($suite);
|
|
||||||
echo $result->toString();
|
|
||||||
|
|
||||||
$suite = new PHPUnit_TestSuite('Services_JSON_UnquotedKeys_TestCase');
|
|
||||||
$result = PHPUnit::run($suite);
|
|
||||||
echo $result->toString();
|
|
||||||
|
|
||||||
$suite = new PHPUnit_TestSuite('Services_JSON_ErrorSuppression_TestCase');
|
|
||||||
$result = PHPUnit::run($suite);
|
|
||||||
echo $result->toString();
|
|
||||||
|
|
||||||
?>
|
|
6
thirdparty/simpletest/form.php
vendored
@ -172,7 +172,7 @@ class SimpleForm {
|
|||||||
*/
|
*/
|
||||||
function _addRadioButton(&$tag) {
|
function _addRadioButton(&$tag) {
|
||||||
if (! isset($this->_radios[$tag->getName()])) {
|
if (! isset($this->_radios[$tag->getName()])) {
|
||||||
$this->_widgets[] = &new SimpleRadioGroup();
|
$this->_widgets[] = new SimpleRadioGroup();
|
||||||
$this->_radios[$tag->getName()] = count($this->_widgets) - 1;
|
$this->_radios[$tag->getName()] = count($this->_widgets) - 1;
|
||||||
}
|
}
|
||||||
$this->_widgets[$this->_radios[$tag->getName()]]->addWidget($tag);
|
$this->_widgets[$this->_radios[$tag->getName()]]->addWidget($tag);
|
||||||
@ -191,7 +191,7 @@ class SimpleForm {
|
|||||||
$index = $this->_checkboxes[$tag->getName()];
|
$index = $this->_checkboxes[$tag->getName()];
|
||||||
if (! SimpleTestCompatibility::isA($this->_widgets[$index], 'SimpleCheckboxGroup')) {
|
if (! SimpleTestCompatibility::isA($this->_widgets[$index], 'SimpleCheckboxGroup')) {
|
||||||
$previous = &$this->_widgets[$index];
|
$previous = &$this->_widgets[$index];
|
||||||
$this->_widgets[$index] = &new SimpleCheckboxGroup();
|
$this->_widgets[$index] = new SimpleCheckboxGroup();
|
||||||
$this->_widgets[$index]->addWidget($previous);
|
$this->_widgets[$index]->addWidget($previous);
|
||||||
}
|
}
|
||||||
$this->_widgets[$index]->addWidget($tag);
|
$this->_widgets[$index]->addWidget($tag);
|
||||||
@ -352,4 +352,4 @@ class SimpleForm {
|
|||||||
return $this->_encode();
|
return $this->_encode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
14
thirdparty/simpletest/http.php
vendored
@ -98,9 +98,9 @@ class SimpleRoute {
|
|||||||
*/
|
*/
|
||||||
function &_createSocket($scheme, $host, $port, $timeout) {
|
function &_createSocket($scheme, $host, $port, $timeout) {
|
||||||
if (in_array($scheme, array('https'))) {
|
if (in_array($scheme, array('https'))) {
|
||||||
$socket = &new SimpleSecureSocket($host, $port, $timeout);
|
$socket = new SimpleSecureSocket($host, $port, $timeout);
|
||||||
} else {
|
} else {
|
||||||
$socket = &new SimpleSocket($host, $port, $timeout);
|
$socket = new SimpleSocket($host, $port, $timeout);
|
||||||
}
|
}
|
||||||
return $socket;
|
return $socket;
|
||||||
}
|
}
|
||||||
@ -279,7 +279,7 @@ class SimpleHttpRequest {
|
|||||||
* @access protected
|
* @access protected
|
||||||
*/
|
*/
|
||||||
function &_createResponse(&$socket) {
|
function &_createResponse(&$socket) {
|
||||||
$response = &new SimpleHttpResponse(
|
$response = new SimpleHttpResponse(
|
||||||
$socket,
|
$socket,
|
||||||
$this->_route->getUrl(),
|
$this->_route->getUrl(),
|
||||||
$this->_encoding);
|
$this->_encoding);
|
||||||
@ -516,13 +516,13 @@ class SimpleHttpResponse extends SimpleStickyError {
|
|||||||
function _parse($raw) {
|
function _parse($raw) {
|
||||||
if (! $raw) {
|
if (! $raw) {
|
||||||
$this->_setError('Nothing fetched');
|
$this->_setError('Nothing fetched');
|
||||||
$this->_headers = &new SimpleHttpHeaders('');
|
$this->_headers = new SimpleHttpHeaders('');
|
||||||
} elseif (! strstr($raw, "\r\n\r\n")) {
|
} elseif (! strstr($raw, "\r\n\r\n")) {
|
||||||
$this->_setError('Could not split headers from content');
|
$this->_setError('Could not split headers from content');
|
||||||
$this->_headers = &new SimpleHttpHeaders($raw);
|
$this->_headers = new SimpleHttpHeaders($raw);
|
||||||
} else {
|
} else {
|
||||||
list($headers, $this->_content) = split("\r\n\r\n", $raw, 2);
|
list($headers, $this->_content) = split("\r\n\r\n", $raw, 2);
|
||||||
$this->_headers = &new SimpleHttpHeaders($headers);
|
$this->_headers = new SimpleHttpHeaders($headers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -621,4 +621,4 @@ class SimpleHttpResponse extends SimpleStickyError {
|
|||||||
return ! $packet;
|
return ! $packet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
10
thirdparty/simpletest/page.php
vendored
@ -163,7 +163,7 @@ class SimplePageBuilder extends SimpleSaxListener {
|
|||||||
* @access protected
|
* @access protected
|
||||||
*/
|
*/
|
||||||
function &_createPage($response) {
|
function &_createPage($response) {
|
||||||
$page = &new SimplePage($response);
|
$page = new SimplePage($response);
|
||||||
return $page;
|
return $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ class SimplePageBuilder extends SimpleSaxListener {
|
|||||||
* @access protected
|
* @access protected
|
||||||
*/
|
*/
|
||||||
function &_createParser(&$listener) {
|
function &_createParser(&$listener) {
|
||||||
$parser = &new SimpleHtmlSaxParser($listener);
|
$parser = new SimpleHtmlSaxParser($listener);
|
||||||
return $parser;
|
return $parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ class SimplePageBuilder extends SimpleSaxListener {
|
|||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function startElement($name, $attributes) {
|
function startElement($name, $attributes) {
|
||||||
$factory = &new SimpleTagBuilder();
|
$factory = new SimpleTagBuilder();
|
||||||
$tag = $factory->createTag($name, $attributes);
|
$tag = $factory->createTag($name, $attributes);
|
||||||
if (! $tag) {
|
if (! $tag) {
|
||||||
return true;
|
return true;
|
||||||
@ -641,7 +641,7 @@ class SimplePage {
|
|||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function acceptFormStart(&$tag) {
|
function acceptFormStart(&$tag) {
|
||||||
$this->_open_forms[] = &new SimpleForm($tag, $this);
|
$this->_open_forms[] = new SimpleForm($tag, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -980,4 +980,4 @@ class SimplePage {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
6
thirdparty/simpletest/parser.php
vendored
@ -197,7 +197,7 @@ class SimpleLexer {
|
|||||||
$this->_case = $case;
|
$this->_case = $case;
|
||||||
$this->_regexes = array();
|
$this->_regexes = array();
|
||||||
$this->_parser = &$parser;
|
$this->_parser = &$parser;
|
||||||
$this->_mode = &new SimpleStateStack($start);
|
$this->_mode = new SimpleStateStack($start);
|
||||||
$this->_mode_handlers = array($start => $start);
|
$this->_mode_handlers = array($start => $start);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -579,7 +579,7 @@ class SimpleHtmlSaxParser {
|
|||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
function &createLexer(&$parser) {
|
function &createLexer(&$parser) {
|
||||||
$lexer = &new SimpleHtmlLexer($parser);
|
$lexer = new SimpleHtmlLexer($parser);
|
||||||
return $lexer;
|
return $lexer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -761,4 +761,4 @@ class SimpleSaxListener {
|
|||||||
function addContent($text) {
|
function addContent($text) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
8
thirdparty/simpletest/url.php
vendored
@ -106,7 +106,7 @@ class SimpleUrl {
|
|||||||
}
|
}
|
||||||
if (preg_match('/^([^\/]*)@(.*)/', $url, $matches)) {
|
if (preg_match('/^([^\/]*)@(.*)/', $url, $matches)) {
|
||||||
$url = $prefix . $matches[2];
|
$url = $prefix . $matches[2];
|
||||||
$parts = split(":", $matches[1]);
|
$parts = preg_split('/:/', $matches[1]);
|
||||||
return array(
|
return array(
|
||||||
urldecode($parts[0]),
|
urldecode($parts[0]),
|
||||||
isset($parts[1]) ? urldecode($parts[1]) : false);
|
isset($parts[1]) ? urldecode($parts[1]) : false);
|
||||||
@ -184,7 +184,7 @@ class SimpleUrl {
|
|||||||
function _parseRequest($raw) {
|
function _parseRequest($raw) {
|
||||||
$this->_raw = $raw;
|
$this->_raw = $raw;
|
||||||
$request = new SimpleGetEncoding();
|
$request = new SimpleGetEncoding();
|
||||||
foreach (split("&", $raw) as $pair) {
|
foreach (preg_split('/&/', $raw) as $pair) {
|
||||||
if (preg_match('/(.*?)=(.*)/', $pair, $matches)) {
|
if (preg_match('/(.*?)=(.*)/', $pair, $matches)) {
|
||||||
$request->add($matches[1], urldecode($matches[2]));
|
$request->add($matches[1], urldecode($matches[2]));
|
||||||
} elseif ($pair) {
|
} elseif ($pair) {
|
||||||
@ -379,7 +379,7 @@ class SimpleUrl {
|
|||||||
*/
|
*/
|
||||||
function clearRequest() {
|
function clearRequest() {
|
||||||
$this->_raw = false;
|
$this->_raw = false;
|
||||||
$this->_request = &new SimpleGetEncoding();
|
$this->_request = new SimpleGetEncoding();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -525,4 +525,4 @@ class SimpleUrl {
|
|||||||
return 'com|edu|net|org|gov|mil|int|biz|info|name|pro|aero|coop|museum';
|
return 'com|edu|net|org|gov|mil|int|biz|info|name|pro|aero|coop|museum';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|