diff --git a/_config.php b/_config.php index 178ff9bf5..fc16de167 100755 --- a/_config.php +++ b/_config.php @@ -54,7 +54,7 @@ Object::useCustomClass('Datetime', 'SS_Datetime', true); /** * The root directory of TinyMCE */ -define('MCE_ROOT', 'jsparty/tiny_mce/'); +define('MCE_ROOT', 'sapphire/thirdparty/tinymce/'); /** * The secret key that needs to be sent along with pings to /Email_BounceHandler diff --git a/core/Core.php b/core/Core.php index d4edc8a54..f54570229 100755 --- a/core/Core.php +++ b/core/Core.php @@ -100,7 +100,7 @@ define('BASE_PATH', rtrim(dirname(dirname($_SERVER['SCRIPT_FILENAME'])), DIRECTO define('BASE_URL', rtrim(dirname(dirname($_SERVER['SCRIPT_NAME'])), DIRECTORY_SEPARATOR)); define('MODULES_DIR', 'modules'); define('MODULES_PATH', BASE_PATH . '/' . MODULES_DIR); -define('THIRDPARTY_DIR', 'jsparty'); +define('THIRDPARTY_DIR', 'sapphire/thirdparty'); define('THIRDPARTY_PATH', BASE_PATH . '/' . THIRDPARTY_DIR); define('THEMES_DIR', 'themes'); define('THEMES_PATH', BASE_PATH . '/' . THEMES_DIR); diff --git a/core/Requirements.php b/core/Requirements.php index e6a24e373..cdf612650 100644 --- a/core/Requirements.php +++ b/core/Requirements.php @@ -137,7 +137,7 @@ class Requirements { * Register the given stylesheet file as required. * See {@link Requirements_Backend::css()} * - * @param $file String Filenames should be relative to the base, eg, 'jsparty/tree/tree.css' + * @param $file String Filenames should be relative to the base, eg, 'sapphire/javascript/tree/tree.css' * @param $media String Comma-separated list of media-types (e.g. "screen,projector") * @see http://www.w3.org/TR/REC-CSS2/media.html */ @@ -476,7 +476,7 @@ class Requirements_Backend { /** * Register the given stylesheet file as required. * - * @param $file String Filenames should be relative to the base, eg, 'jsparty/tree/tree.css' + * @param $file String Filenames should be relative to the base, eg, 'sapphire/javascript/tree/tree.css' * @param $media String Comma-separated list of media-types (e.g. "screen,projector") * @see http://www.w3.org/TR/REC-CSS2/media.html */ diff --git a/core/control/ContentController.php b/core/control/ContentController.php index c908c58a3..f2a7744fc 100755 --- a/core/control/ContentController.php +++ b/core/control/ContentController.php @@ -290,8 +290,8 @@ class ContentController extends Controller { if(Director::isDev() || Permission::check('CMS_ACCESS_CMSMain')) { Requirements::css(SAPPHIRE_DIR . '/css/SilverStripeNavigator.css'); - Requirements::javascript(THIRDPARTY_DIR . '/behaviour.js'); - // Requirements::javascript(THIRDPARTY_DIR . '/prototype.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js'); + // Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js'); Requirements::customScript(<<form->getRecord() && $this->form->getRecord()->exists()) { return $this->createTag ( @@ -97,7 +97,7 @@ class FileIFrameField extends FileField { // clear the requirements added by any parent controllers Requirements::clear(); Requirements::add_i18n_javascript('sapphire/javascript/lang'); - Requirements::javascript('jsparty/jquery/jquery-latest.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js'); Requirements::javascript('sapphire/javascript/FileIFrameField.js'); Requirements::css('cms/css/typography.css'); diff --git a/forms/HtmlEditorConfig.php b/forms/HtmlEditorConfig.php index 0324ac2a3..9a38358ca 100644 --- a/forms/HtmlEditorConfig.php +++ b/forms/HtmlEditorConfig.php @@ -78,14 +78,15 @@ class HtmlEditorConfig { 'safari_warning' => false, 'relative_urls' => true, - 'verify_html' => true + 'verify_html' => true, + ); /** * Holder list of enabled plugins */ protected $plugins = array( - 'contextmenu', 'table', 'emotions', 'paste', '../../tinymce_advcode', 'spellchecker' + 'contextmenu', 'table', 'emotions', 'paste', '../../tinymce-advcode', 'spellchecker' ); /** diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index c55493ab3..f5952d86f 100755 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -200,7 +200,7 @@ class HtmlEditorField_Toolbar extends RequestHandler { * @return Form */ function LinkForm() { - Requirements::javascript(THIRDPARTY_DIR . "/behaviour.js"); + Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js"); Requirements::javascript(THIRDPARTY_DIR . "/tiny_mce_improvements.js"); $form = new Form( @@ -253,12 +253,12 @@ class HtmlEditorField_Toolbar extends RequestHandler { * @return Form */ function ImageForm() { - Requirements::javascript(THIRDPARTY_DIR . "/behaviour.js"); + Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js"); Requirements::javascript(THIRDPARTY_DIR . "/tiny_mce_improvements.js"); Requirements::css('cms/css/TinyMCEImageEnhancement.css'); Requirements::javascript('cms/javascript/TinyMCEImageEnhancement.js'); Requirements::javascript(CMS_DIR . '/javascript/Upload.js'); - Requirements::javascript(THIRDPARTY_DIR . '/SWFUpload/SWFUpload.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/swfupload/swfupload.js'); /** * @todo Adding folders via this screen is not enabled just yet as it is still @@ -322,10 +322,10 @@ class HtmlEditorField_Toolbar extends RequestHandler { } function FlashForm() { - Requirements::javascript(THIRDPARTY_DIR . "/behaviour.js"); + Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js"); Requirements::javascript(THIRDPARTY_DIR . "/tiny_mce_improvements.js"); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/swfupload/swfupload.js'); Requirements::javascript(CMS_DIR . '/javascript/Upload.js'); - Requirements::javascript(THIRDPARTY_DIR . '/SWFUpload/SWFUpload.js'); $form = new Form( $this->controller, diff --git a/forms/ImageFormAction.php b/forms/ImageFormAction.php index 613c708e0..9331dc012 100755 --- a/forms/ImageFormAction.php +++ b/forms/ImageFormAction.php @@ -22,8 +22,8 @@ class ImageFormAction extends FormAction { parent::__construct($action, $title, $form); } function Field() { - Requirements::javascript(THIRDPARTY_DIR . '/prototype.js'); - Requirements::javascript(THIRDPARTY_DIR . '/behaviour.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js'); Requirements::javascript(SAPPHIRE_DIR . '/javascript/ImageFormAction.js'); $classClause = ''; diff --git a/forms/SelectionGroup.php b/forms/SelectionGroup.php index bb0d08f53..5a8fb8184 100755 --- a/forms/SelectionGroup.php +++ b/forms/SelectionGroup.php @@ -79,8 +79,9 @@ class SelectionGroup extends CompositeField { } function FieldHolder() { - Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); - Requirements::javascript(THIRDPARTY_DIR . '/jquery/plugins/livequery/jquery.livequery.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js'); + Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js'); Requirements::javascript(SAPPHIRE_DIR . '/javascript/SelectionGroup.js'); Requirements::css(SAPPHIRE_DIR . '/css/SelectionGroup.css'); diff --git a/forms/TabSet.php b/forms/TabSet.php index cc3e077d4..ae66b9663 100644 --- a/forms/TabSet.php +++ b/forms/TabSet.php @@ -49,23 +49,23 @@ class TabSet extends CompositeField { * The HTML is a standardised format, containing a <ul; */ public function FieldHolder() { - Requirements::javascript(THIRDPARTY_DIR . "/jquery/jquery-latest.js"); - Requirements::javascript(THIRDPARTY_DIR . "/jquery/jquery_improvements.js"); - Requirements::javascript(THIRDPARTY_DIR . '/jquery/ui/jquery-ui.js'); - Requirements::javascript(THIRDPARTY_DIR . '/jquery/ui/ui.core.js'); - Requirements::javascript(THIRDPARTY_DIR . '/jquery/ui/ui.tabs.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js'); + Requirements::javascript(SAPPHIRE_DIR . "/javascript/jquery_improvements.js"); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-ui/jquery-ui.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-ui/ui.core.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-ui/ui.tabs.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery/plugins/fitheighttoparent/jquery.fitheighttoparent.js'); - Requirements::css(THIRDPARTY_DIR . '/jquery/themes/smoothness/ui.all.css'); - Requirements::css(THIRDPARTY_DIR . '/jquery/themes/smoothness/ui.tabs.css'); + Requirements::css(SAPPHIRE_DIR . '/thirdparty/jquery-ui-themes/smoothness/ui.all.css'); + Requirements::css(SAPPHIRE_DIR . '/thirdparty/jquery-ui-themes/smoothness/ui.tabs.css'); // concrete - Requirements::javascript(THIRDPARTY_DIR . '/jquery/plugins/concrete/jquery.class.js'); - Requirements::javascript(THIRDPARTY_DIR . '/jquery/plugins/concrete/jquery.selector.js'); - Requirements::javascript(THIRDPARTY_DIR . '/jquery/plugins/concrete/jquery.selector.specifity.js'); - Requirements::javascript(THIRDPARTY_DIR . '/jquery/plugins/concrete/jquery.selector.matches.js'); - Requirements::javascript(THIRDPARTY_DIR . '/jquery/plugins/concrete/jquery.dat.js'); - Requirements::javascript(THIRDPARTY_DIR . '/jquery/plugins/concrete/jquery.concrete.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-concrete/jquery.class.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-concrete/jquery.selector.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-concrete/jquery.selector.specifity.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-concrete/jquery.selector.matches.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-concrete/jquery.dat.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-concrete/jquery.concrete.js'); Requirements::javascript(SAPPHIRE_DIR . '/javascript/TabSet.js'); diff --git a/forms/TableField.php b/forms/TableField.php index cdb6ed3b3..4b256be35 100644 --- a/forms/TableField.php +++ b/forms/TableField.php @@ -500,10 +500,10 @@ class TableField extends TableListField { * Sets the template to be rendered with */ function FieldHolder() { - Requirements::javascript(THIRDPARTY_DIR . '/prototype.js'); - Requirements::javascript(THIRDPARTY_DIR . '/behaviour.js'); - Requirements::javascript(THIRDPARTY_DIR . '/prototype_improvements.js'); - Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/effects.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js'); + Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/scriptaculous/effects.js'); Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang'); Requirements::javascript(SAPPHIRE_DIR . '/javascript/TableListField.js'); Requirements::javascript(SAPPHIRE_DIR . '/javascript/TableField.js'); diff --git a/forms/TableListField.php b/forms/TableListField.php index 2133ec299..997891276 100755 --- a/forms/TableListField.php +++ b/forms/TableListField.php @@ -284,10 +284,10 @@ class TableListField extends FormField { } function FieldHolder() { - Requirements::javascript(THIRDPARTY_DIR . '/prototype.js'); - Requirements::javascript(THIRDPARTY_DIR . '/behaviour.js'); - Requirements::javascript(THIRDPARTY_DIR . '/prototype_improvements.js'); - Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/effects.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js'); + Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/scriptaculous/effects.js'); Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang'); Requirements::javascript(SAPPHIRE_DIR . '/javascript/TableListField.js'); Requirements::css(SAPPHIRE_DIR . '/css/TableListField.css'); diff --git a/forms/ToggleCompositeField.php b/forms/ToggleCompositeField.php index 7f6a92b58..a63bb851c 100755 --- a/forms/ToggleCompositeField.php +++ b/forms/ToggleCompositeField.php @@ -21,9 +21,9 @@ class ToggleCompositeField extends CompositeField { } public function FieldHolder() { - Requirements::javascript(THIRDPARTY_DIR . "/prototype.js"); - Requirements::javascript(THIRDPARTY_DIR . "/behaviour.js"); - Requirements::javascript(THIRDPARTY_DIR . "/prototype_improvements.js"); + Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/prototype/prototype.js"); + Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js"); + Requirements::javascript(SAPPHIRE_DIR . "/javascript/prototype_improvements.js"); Requirements::javascript(SAPPHIRE_DIR . "/javascript/ToggleCompositeField.js"); return $this->renderWith("ToggleCompositeField"); diff --git a/forms/ToggleField.php b/forms/ToggleField.php index faf07e8d8..fb36cecb7 100755 --- a/forms/ToggleField.php +++ b/forms/ToggleField.php @@ -49,9 +49,9 @@ class ToggleField extends ReadonlyField { function Field() { $content = ''; - Requirements::javascript(THIRDPARTY_DIR . "/prototype.js"); - Requirements::javascript(THIRDPARTY_DIR . "/behaviour.js"); - Requirements::javascript(THIRDPARTY_DIR . "/prototype_improvements.js"); + Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/prototype/prototype.js"); + Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js"); + Requirements::javascript(SAPPHIRE_DIR . "/javascript/prototype_improvements.js"); Requirements::javascript(SAPPHIRE_DIR . "/javascript/ToggleField.js"); if($this->startClosed) $this->addExtraClass('startClosed'); diff --git a/forms/TreeDropdownField.php b/forms/TreeDropdownField.php index 044f581ec..2dd6d4784 100755 --- a/forms/TreeDropdownField.php +++ b/forms/TreeDropdownField.php @@ -38,16 +38,6 @@ class TreeDropdownField extends FormField { ); } - Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang'); - - Requirements::javascript(THIRDPARTY_DIR . '/prototype.js'); - Requirements::javascript(THIRDPARTY_DIR . '/behaviour.js'); - Requirements::javascript(THIRDPARTY_DIR . '/tree/tree.js'); - Requirements::javascript(SAPPHIRE_DIR . '/javascript/TreeSelectorField.js'); - - Requirements::css(THIRDPARTY_DIR . '/tree/tree.css'); - Requirements::css(SAPPHIRE_DIR . '/css/TreeDropdownField.css'); - parent::__construct($name, $title); } @@ -77,6 +67,14 @@ class TreeDropdownField extends FormField { * @return string */ public function Field() { + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour.js'); + Requirements::css(SAPPHIRE_DIR . '/css/TreeDropdownField.css'); + Requirements::javascript(SAPPHIRE_DIR . "/javascript/tree/tree.js"); + Requirements::css(SAPPHIRE_DIR . "/javascript/tree/tree.css"); + Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang'); + Requirements::javascript(SAPPHIRE_DIR . "/javascript/TreeSelectorField.js"); + if($this->Value() && $record = $this->objectForKey($this->Value())) { $title = $record->{$this->labelField}; } else { diff --git a/forms/Validator.php b/forms/Validator.php index 88f5aca8e..9bcd66cd2 100755 --- a/forms/Validator.php +++ b/forms/Validator.php @@ -172,9 +172,9 @@ abstract class Validator extends Object { function includeJavascriptValidation() { if($this->getJavascriptValidationHandler() == 'prototype') { - Requirements::javascript(THIRDPARTY_DIR . "/prototype.js"); - Requirements::javascript(THIRDPARTY_DIR . "/behaviour.js"); - Requirements::javascript(THIRDPARTY_DIR . "/prototype_improvements.js"); + Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/prototype/prototype.js"); + Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js"); + Requirements::javascript(SAPPHIRE_DIR . "/javascript/prototype_improvements.js"); Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang'); Requirements::javascript(SAPPHIRE_DIR . "/javascript/Validator.js"); diff --git a/security/Member.php b/security/Member.php index c8f6a5662..43a8e8a71 100644 --- a/security/Member.php +++ b/security/Member.php @@ -1320,11 +1320,11 @@ class Member_ProfileForm extends Form { Requirements::clear(); Requirements::css(CMS_DIR . '/css/typography.css'); Requirements::css(CMS_DIR . '/css/cms_right.css'); - Requirements::javascript(THIRDPARTY_DIR . "/prototype.js"); - Requirements::javascript(THIRDPARTY_DIR . "/behaviour.js"); - Requirements::javascript(THIRDPARTY_DIR . "/prototype_improvements.js"); - Requirements::javascript(THIRDPARTY_DIR . "/scriptaculous/scriptaculous.js"); - Requirements::javascript(THIRDPARTY_DIR . "/scriptaculous/controls.js"); + Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/prototype/prototype.js"); + Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js"); + Requirements::javascript(SAPPHIRE_DIR . "/javascript/prototype_improvements.js"); + Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/scriptaculous/scriptaculous.js"); + Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/scriptaculous/controls.js"); Requirements::javascript(THIRDPARTY_DIR . "/layout_helpers.js"); Requirements::css(SAPPHIRE_DIR . "/css/Form.css"); diff --git a/security/Security.php b/security/Security.php index 0209de037..8a56b65db 100644 --- a/security/Security.php +++ b/security/Security.php @@ -338,19 +338,19 @@ class Security extends Controller { // with the tabstrip library otherwise $link_base = Director::absoluteURL($this->Link("login")); - Requirements::javascript(THIRDPARTY_DIR . "/jquery/jquery-latest.js"); - Requirements::javascript(THIRDPARTY_DIR . "/jquery/jquery_improvements.js"); - Requirements::javascript(THIRDPARTY_DIR . '/jquery/ui/jquery-ui.js'); - Requirements::javascript(THIRDPARTY_DIR . '/jquery/ui/ui.core.js'); - Requirements::javascript(THIRDPARTY_DIR . '/jquery/ui/ui.tabs.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js'); + Requirements::javascript(SAPPHIRE_DIR . "/javascript/jquery_improvements.js"); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-ui/jquery-ui.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-ui/ui.core.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-ui/ui.tabs.js'); // concrete - Requirements::javascript(THIRDPARTY_DIR . '/jquery/plugins/concrete/jquery.class.js'); - Requirements::javascript(THIRDPARTY_DIR . '/jquery/plugins/concrete/jquery.selector.js'); - Requirements::javascript(THIRDPARTY_DIR . '/jquery/plugins/concrete/jquery.selector.specifity.js'); - Requirements::javascript(THIRDPARTY_DIR . '/jquery/plugins/concrete/jquery.selector.matches.js'); - Requirements::javascript(THIRDPARTY_DIR . '/jquery/plugins/concrete/jquery.dat.js'); - Requirements::javascript(THIRDPARTY_DIR . '/jquery/plugins/concrete/jquery.concrete.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-concrete/jquery.class.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-concrete/jquery.selector.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-concrete/jquery.selector.specifity.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-concrete/jquery.selector.matches.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-concrete/jquery.dat.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-concrete/jquery.concrete.js'); Requirements::css(THIRDPARTY_DIR . '/jquery/themes/smoothness/ui.all.css'); Requirements::css(THIRDPARTY_DIR . '/jquery/themes/smoothness/ui.tabs.css'); @@ -407,11 +407,11 @@ class Security extends Controller { * @return string Returns the "lost password" page as HTML code. */ public function lostpassword() { - Requirements::javascript(THIRDPARTY_DIR . '/prototype.js'); - Requirements::javascript(THIRDPARTY_DIR . '/behaviour.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js'); Requirements::javascript(THIRDPARTY_DIR . '/loader.js'); - Requirements::javascript(THIRDPARTY_DIR . '/prototype_improvements.js'); - Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/effects.js'); + Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/scriptaculous/effects.js'); $tmpPage = new Page(); $tmpPage->Title = _t('Security.LOSTPASSWORDHEADER', 'Lost Password'); @@ -466,11 +466,11 @@ class Security extends Controller { * @return string Returns the "password sent" page as HTML code. */ public function passwordsent($request) { - Requirements::javascript(THIRDPARTY_DIR . '/behaviour.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js'); Requirements::javascript(THIRDPARTY_DIR . '/loader.js'); - Requirements::javascript(THIRDPARTY_DIR . '/prototype.js'); - Requirements::javascript(THIRDPARTY_DIR . '/prototype_improvements.js'); - Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/effects.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js'); + Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/scriptaculous/effects.js'); $tmpPage = new Page(); $tmpPage->Title = _t('Security.LOSTPASSWORDHEADER'); diff --git a/tasks/RemoveOrphanedPagesTask.php b/tasks/RemoveOrphanedPagesTask.php index 45301eab3..19c7e2d9f 100644 --- a/tasks/RemoveOrphanedPagesTask.php +++ b/tasks/RemoveOrphanedPagesTask.php @@ -61,7 +61,7 @@ in the other stage:
} function index() { - Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery-latest.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js'); Requirements::customCSS('#OrphanIDs .middleColumn {width: auto;}'); Requirements::customCSS('#OrphanIDs label {display: inline;}'); diff --git a/thirdparty/greybox/greybox.js b/thirdparty/greybox/greybox.js new file mode 100755 index 000000000..268851c8c --- /dev/null +++ b/thirdparty/greybox/greybox.js @@ -0,0 +1,455 @@ +/**** + Last Modified: 25/08/06 20:52:59 + + CAUTION: Modified Version to suit Silverstripe CMS (www.silverstripe.com). + Original at http://orangoo.com/labs/uploads/GreyBox_v3_46.zip + + GreyBox - Smart pop-up window + Copyright Amir Salihefendic 2006 + AUTHOR + 4mir Salihefendic (http://amix.dk) - amix@amix.dk + VERSION + 3.46 + LICENSE + GPL (read more in GPL.txt) + SITE + http://orangoo.com/labs/GreyBox/ +****/ +var GB_CURRENT = null; +var GB_ONLY_ONE = null; +// modified 2006-01-06 by Silverstripe Ltd. +try { + var theBaseHref = document.getElementsByTagName("base")[0].href; + var GB_IMG_DIR = theBaseHref + "sapphire/thirdparty/greybox/"; +} catch(err) { + var GB_IMG_DIR = "sapphire/thirdparty/greybox/"; +} + +function GreyBox() { + //Use mutator functions (since the internal stuff may change in the future) + this.type = "page"; + this.overlay_click_close = true; + + if(GB_IMG_DIR) + this.img_dir = GB_IMG_DIR; + else + this.img_dir = "greybox/"; + + this.overlay_color = "dark"; + + this.center_window = false; + + this.g_window = null; + this.g_container = null; + this.iframe = null; + this.overlay = null; + this.timeout = null; + + this.defaultSize(); + this.showCloseImage(true); + + this.url = ""; + this.caption = ""; + + this.callback_fn = []; + this.reload_on_close = false; +} + +//// +// Configuration functions (the functions you can call) +// +/** + Set the width and height of the GreyBox window. + Images and notifications are auto-set. + **/ +GreyBox.prototype.setDimension = function(width, height) { + this.height = height; + this.width = width; +} + +GreyBox.prototype.setFullScreen = function(bool) { + this.full_screen = bool; +} + +/** + Type can be: page, image + **/ +GreyBox.prototype.setType = function(type) { + this.type = type; +} + +/** + If bool is true the window will be centered vertically also + **/ +GreyBox.prototype.setCenterWindow = function(bool) { + this.center_window = bool; +} + +/** + Set the path where images can be found. + Can be relative: greybox/ + Or absolute: http://yoursite.com/greybox/ + **/ +GreyBox.prototype.setImageDir = function(dir) { + this.img_dir = dir; +} + +GreyBox.prototype.showCloseImage = function(bool) { + this.show_close_img = bool; +} + +/** + If bool is true the grey overlay click will close greybox. + **/ +GreyBox.prototype.setOverlayCloseClick = function(bool) { + this.overlay_click_close = bool; +} + +/** + Overlay can either be "light" or "dark". + **/ +GreyBox.prototype.setOverlayColor = function(color) { + this.overlay_color = color; +} + +/** + Set a function that will be called when GreyBox closes + **/ +GreyBox.prototype.setCallback = function(fn) { + if(fn) + this.callback_fn.push(fn); +} + + +//// +// Show hide functions +// +/** + Show the GreyBox with a caption and an url + **/ +GreyBox.prototype.show = function(caption, url) { + GB_CURRENT = this; + + this.url = url; + this.caption = caption; + + //Be sure that the old loader and dummy_holder are removed + AJS.map(AJS.$bytc("div", "GB_dummy"), function(elm) { AJS.removeElement(elm) }); + AJS.map(AJS.$bytc("div", "GB_loader"), function(elm) { AJS.removeElement(elm) }); + + //If ie, hide select, in others hide flash + if(AJS.isIe()) + AJS.map(AJS.$bytc("select"), function(elm) {elm.style.visibility = "hidden"}); + AJS.map(AJS.$bytc("object"), function(elm) {elm.style.visibility = "hidden"}); + + this.initOverlayIfNeeded(); + + this.setOverlayDimension(); + AJS.showElement(this.overlay); + this.setFullScreenOption(); + + this.initIfNeeded(); + + AJS.hideElement(this.g_window); + + AJS.ACN(this.g_container, this.iframe); + + if(caption == "") + caption = " "; + this.div_caption.innerHTML = caption; + + AJS.showElement(this.g_window) + + this.setVerticalPosition(); + this.setWidthNHeight(); + this.setTopNLeft(); + + GB_CURRENT.startLoading(); + + return false; +} + +GreyBox.prototype.hide = function() { + AJS.hideElement(this.g_window, this.overlay); + + try{ AJS.removeElement(this.iframe); } + catch(e) {} + + this.iframe = null; + + if(this.type == "image") { + this.width = 200; + this.height = 200; + } + + if(AJS.isIe()) + AJS.map(AJS.$bytc("select"), function(elm) {elm.style.visibility = "visible"}); + AJS.map(AJS.$bytc("object"), function(elm) {elm.style.visibility = "visible"}); + + var c_bs = GB_CURRENT.callback_fn; + if(c_bs != []) { + AJS.map(c_bs, function(fn) { + fn(); + }); + } + + GB_CURRENT = null; + + if(this.reload_on_close) + window.location.reload(); +} + +/** + If you only use one instance of GreyBox + **/ +GB_initOneIfNeeded = function() { + if(!GB_ONLY_ONE) { + GB_ONLY_ONE = new GreyBox(); + } +} + +GB_show = function(caption, url, /* optional */ height, width, callback_fn) { + GB_initOneIfNeeded(); + GB_ONLY_ONE.defaultSize(); + GB_ONLY_ONE.setFullScreen(false); + GB_ONLY_ONE.setType("page"); + GB_ONLY_ONE.setCallback(callback_fn); + GB_ONLY_ONE.setDimension(width, height); + GB_ONLY_ONE.show(caption, url); + return false; +} + +GB_showFullScreen = function(caption, url, /* optional */ callback_fn) { + GB_initOneIfNeeded(); + GB_ONLY_ONE.defaultSize(); + GB_ONLY_ONE.setType("page"); + + GB_ONLY_ONE.setCallback(callback_fn); + GB_ONLY_ONE.setFullScreen(true); + GB_ONLY_ONE.show(caption, url); + return false; +} + +GB_showImage = function(caption, url) { + GB_initOneIfNeeded(); + GB_ONLY_ONE.defaultSize(); + GB_ONLY_ONE.setFullScreen(false); + GB_ONLY_ONE.setType("image"); + + GB_ONLY_ONE.show(caption, url); + return false; +} + +GB_hide = function() { + GB_CURRENT.hide(); +} + +/** + Preload all the images used by GreyBox. Static function + **/ +GreyBox.preloadGreyBoxImages = function(img_dir) { + var pics = []; + + if(!img_dir) + img_dir = GB_IMG_DIR; + + var fn = function(path) { + var pic = new Image(); + pic.src = GB_IMG_DIR + path; + pics.push(pic); + }; + AJS.map(['indicator.gif', 'blank.gif', 'close.gif', 'header_bg.gif', 'overlay_light.png', 'overlay_dark.png'], AJS.$b(fn, this)); +} + + +//// +// Internal functions +// +GreyBox.prototype.getOverlayImage = function() { + return "overlay_" + this.overlay_color + ".png"; +}; + +/** + Init functions + **/ +GreyBox.prototype.initOverlayIfNeeded = function() { + //Create the overlay + this.overlay = AJS.DIV({'id': 'GB_overlay'}); + if(AJS.isIe()) { + this.overlay.style.backgroundColor = "#000000"; + this.overlay.style.backgroundColor = "transparent"; + this.overlay.style.backgroundImage = "url("+ this.img_dir +"blank.gif)"; + this.overlay.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.img_dir + this.getOverlayImage() + "',sizingMethod='scale')"; + } + else + this.overlay.style.backgroundImage = "url("+ this.img_dir + this.getOverlayImage() +")"; + + if(this.overlay_click_close) + AJS.AEV(this.overlay, "click", GB_hide); + + AJS.getBody().insertBefore(this.overlay, AJS.getBody().firstChild); +}; + +GreyBox.prototype.initIfNeeded = function() { + this.init(); + this.setWidthNHeight = AJS.$b(this.setWidthNHeight, this); + this.setTopNLeft = AJS.$b(this.setTopNLeft, this); + this.setFullScreenOption = AJS.$b(this.setFullScreenOption, this); + this.setOverlayDimension = AJS.$b(this.setOverlayDimension, this); + + GreyBox.addOnWinResize(this.setWidthNHeight, this.setTopNLeft, this.setFullScreenOption, this.setOverlayDimension); + + this.g_container.style.marginBottom = "-3px"; + + var fn = function() { + this.setOverlayDimension(); + this.setVerticalPosition(); + this.setTopNLeft(); + this.setWidthNHeight(); + }; + AJS.AEV(window, "scroll", AJS.$b(fn, this)); + + if(!this.iframe) { + var new_frame; + var d = {'name': 'GB_frame', 'class': 'GB_frame', 'frameBorder': 0}; + new_frame = AJS.IFRAME(d); + this.iframe = new_frame; + AJS.hideElement(this.iframe); + } +} + +GreyBox.prototype.init = function() { + //Create the window + this.g_window = AJS.DIV({'id': 'GB_window'}); + + //Create the table structure + var table = AJS.TABLE({'class': 'GB_t_frame', 'frameborder': 0}); + var tbody = AJS.TBODY(); + AJS.ACN(table, tbody); + + //Midlle + var td_middle_m = AJS.TD({'class': 'GB_content'}); + this.td_middle_m = td_middle_m; + + AJS.ACN(tbody, AJS.TR(td_middle_m)); + + //Append caption and close + var header = AJS.TABLE({'class': 'GB_header'}); + this.header = header; + + var caption = AJS.TD({'class': 'GB_caption'}); + this.div_caption = caption; + + /*header.style.backgroundImage = "url("+ this.img_dir +"header_bg.gif)";*/ + + tbody_header = AJS.TBODY(); + var close = AJS.TD({'class': 'GB_close'}); + + if(this.show_close_img) { + var img_close = AJS.IMG({'src': this.img_dir + 'close.gif'}); + AJS.ACN(close, img_close, "Close"); + AJS.AEV(close, "click", GB_hide); + } + AJS.ACN(tbody_header, AJS.TR(caption, close)); + + AJS.ACN(header, tbody_header); + + AJS.ACN(td_middle_m, header); + + //Container + this.g_container = AJS.DIV({'class': 'GB_container'}); + AJS.ACN(td_middle_m, this.g_container); + + AJS.ACN(this.g_window, table); + + AJS.getBody().insertBefore(this.g_window, this.overlay.nextSibling); +} + +GreyBox.prototype.startLoading = function() { + //Start preloading the object + this.iframe.src = this.img_dir + 'loader_frame.html'; + AJS.showElement(this.iframe); +} + +/** + Set dimension functions + **/ +GreyBox.prototype.setIframeWidthNHeight = function() { + try{ + AJS.setWidth(this.iframe, this.width); + AJS.setHeight(this.iframe, this.height); + } + catch(e) { + } +} + +GreyBox.prototype.setOverlayDimension = function() { + var page_size = AJS.getWindowSize(); + if((navigator.userAgent.toLowerCase().indexOf("firefox") != -1)) + AJS.setWidth(this.overlay, "100%"); + else + AJS.setWidth(this.overlay, page_size.w); + + var max_height = Math.max(AJS.getScrollTop()+page_size.h, AJS.getScrollTop()+this.height); + if(max_height < AJS.getScrollTop()) + AJS.setHeight(this.overlay, max_height); + else + AJS.setHeight(this.overlay, AJS.getScrollTop()+page_size.h); +} + +GreyBox.prototype.setWidthNHeight = function() { + //Set size + AJS.setWidth(this.g_window, this.width); + AJS.setHeight(this.g_window, this.height); + + AJS.setWidth(this.g_container, this.width); + AJS.setHeight(this.g_container, this.height); + + this.setIframeWidthNHeight(); + + //Set size on components + AJS.setWidth(this.td_middle_m, this.width+10); +} + +/** + * Modified 2006-10-08 by Silverstripe + */ +GreyBox.prototype.setTopNLeft = function() { + var page_size = AJS.getWindowSize(); + AJS.setLeft(this.g_window, ((page_size.w - this.width)/2)-13); + + var fl = ((page_size.h - this.height) /2) - 15 + AJS.getScrollTop(); + AJS.setTop(this.g_window, fl); +} + +GreyBox.prototype.setVerticalPosition = function() { + var page_size = AJS.getWindowSize(); + var st = AJS.getScrollTop(); + if(this.g_window.offsetWidth <= page_size.h || st <= this.g_window.offsetTop) { + AJS.setTop(this.g_window, st); + } +} + +GreyBox.prototype.setFullScreenOption = function() { + if(this.full_screen) { + var page_size = AJS.getWindowSize(); + + overlay_h = page_size.h; + + this.width = Math.round(this.overlay.offsetWidth - (this.overlay.offsetWidth/100)*10); + this.height = Math.round(overlay_h - (overlay_h/100)*10); + } +} + +GreyBox.prototype.defaultSize = function() { + this.width = 300; + this.height = 300; +} + +//// +// Misc. +// +GreyBox.addOnWinResize = function(funcs) { + funcs = AJS.$A(funcs); + AJS.map(funcs, function(fn) { AJS.AEV(window, "resize", fn); }); +}