Permalink
Browse files

Merge branch 'master' of git://github.com/silverstripe/sapphire

Conflicts:
	.gitignore
  • Loading branch information...
2 parents eb5961d + 450bc25 commit 3bf5f6be2da553372e4cad3c52c40a33a7b04fbc @pitchandtone pitchandtone committed May 3, 2012
Showing 2,371 changed files with 50,538 additions and 40,337 deletions.
View
@@ -3,3 +3,6 @@
/.buildpath
/.project
/.settings
+css/GridField_print.css
+admin/thirdparty/chosen/node_modules
+
View
@@ -5,13 +5,13 @@ Requires a [`silverstripe-installer`](http://github.com/silverstripe/silverstrip
## Installation ##
-See [installation on different platforms](http://doc.silverstripe.org/sapphire/en/installation/),
-and [installation from source](http://doc.silverstripe.org/sapphire/en/installation/from-source).
+See [installation on different platforms](http://doc.silverstripe.org/framework/en/installation/),
+and [installation from source](http://doc.silverstripe.org/framework/en/installation/from-source).
## Links ##
- * [Requirements](http://doc.silverstripe.org/sapphire/en/installation/server-requirements)
- * [Changelogs](http://doc.silverstripe.org/sapphire/en/changelogs/)
+ * [Requirements](http://doc.silverstripe.org/framework/en/installation/server-requirements)
+ * [Changelogs](http://doc.silverstripe.org/framework/en/changelogs/)
* [Bugtracker](http://open.silverstripe.org)
* [Forums](http://silverstripe.org/forums)
* [Developer Mailinglist](https://groups.google.com/forum/#!forum/silverstripe-dev)
View
@@ -1,9 +1,9 @@
<?php
/**
- * Sapphire configuration file
+ * Framework configuration file
*
- * Here you can make different settings for the Sapphire module (the core
+ * Here you can make different settings for the Framework module (the core
* module).
*
* For example you can register the authentication methods you wish to use
@@ -13,7 +13,7 @@
* Authenticator::register_authenticator('OpenIDAuthenticator');
* </code>
*
- * @package sapphire
+ * @package framework
* @subpackage core
*/
@@ -42,12 +42,12 @@
Object::useCustomClass('SSDatetime', 'SS_Datetime', true);
Object::useCustomClass('Datetime', 'SS_Datetime', true);
-
-
/**
* The root directory of TinyMCE
*/
-define('MCE_ROOT', 'sapphire/thirdparty/tinymce/');
+define('MCE_ROOT', FRAMEWORK_DIR . '/thirdparty/tinymce/');
+
+ShortcodeParser::get('default')->register('file_link', array('File', 'link_shortcode_handler'));
/**
* The secret key that needs to be sent along with pings to /Email_BounceHandler
@@ -61,12 +61,6 @@
define('EMAIL_BOUNCEHANDLER_KEY', '1aaaf8fb60ea253dbf6efa71baaacbb3');
}
-PasswordEncryptor::register('none', 'PasswordEncryptor_None');
-PasswordEncryptor::register('md5', 'PasswordEncryptor_LegacyPHPHash("md5")');
-PasswordEncryptor::register('sha1','PasswordEncryptor_LegacyPHPHash("sha1")');
-PasswordEncryptor::register('md5_v2.4', 'PasswordEncryptor_PHPHash("md5")');
-PasswordEncryptor::register('sha1_v2.4','PasswordEncryptor_PHPHash("sha1")');
-
// Zend_Cache temp directory setting
$_ENV['TMPDIR'] = TEMP_FOLDER; // for *nix
$_ENV['TMP'] = TEMP_FOLDER; // for Windows
@@ -81,4 +75,4 @@
Deprecation::notification_version('3.0.0');
// TODO Remove once new ManifestBuilder with submodule support is in place
-require_once('admin/_config.php');
+require_once('admin/_config.php');
@@ -0,0 +1,16 @@
+name: PasswordEncryptor
+---
+PasswordEncryptor:
+ encryptors:
+ none:
+ PasswordEncryptor_None:
+ md5:
+ PasswordEncryptor_LegacyPHPHash: md5
+ sha1:
+ PasswordEncryptor_LegacyPHPHash: sha1
+ md5_v2.4:
+ PasswordEncryptor_PHPHash: md5
+ sha1_v2.4:
+ PasswordEncryptor_PHPHash: sha1
+ blowfish:
+ PasswordEncryptor_Blowfish:
@@ -1,12 +1,14 @@
<?php
// Register the SilverStripe provided databases
+$frameworkPath = defined('FRAMEWORK_PATH') ? FRAMEWORK_PATH : FRAMEWORK_NAME;
+
DatabaseAdapterRegistry::register(
array(
'class' => 'MySQLDatabase',
'title' => 'MySQL 5.0+',
- 'helperPath' => 'sapphire/dev/install/MySQLDatabaseConfigurationHelper.php',
- 'supported' => function_exists('mysql_connect'),
+ 'helperPath' => $frameworkPath . '/dev/install/MySQLDatabaseConfigurationHelper.php',
+ 'supported' => class_exists('MySQLi'),
)
);
View
@@ -18,21 +18,21 @@
'body_class' => 'typography',
'document_base_url' => Director::absoluteBaseURL(),
- 'urlconverter_callback' => "nullConverter",
- 'setupcontent_callback' => "sapphiremce_setupcontent",
'cleanup_callback' => "sapphiremce_cleanup",
'use_native_selects' => true, // fancy selects are bug as of SS 2.3.0
'valid_elements' => "@[id|class|style|title],#a[id|rel|rev|dir|tabindex|accesskey|type|name|href|target|title|class],-strong/-b[class],-em/-i[class],-strike[class],-u[class],#p[id|dir|class|align|style],-ol[class],-ul[class],-li[class],br,img[id|dir|longdesc|usemap|class|src|border|alt=|title|width|height|align],-sub[class],-sup[class],-blockquote[dir|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|dir|id|style],-tr[id|dir|class|rowspan|width|height|align|valign|bgcolor|background|bordercolor|style],tbody[id|class|style],thead[id|class|style],tfoot[id|class|style],#td[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],-th[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],caption[id|dir|class],-div[id|dir|class|align|style],-span[class|align|style],-pre[class|align],address[class|align],-h1[id|dir|class|align|style],-h2[id|dir|class|align|style],-h3[id|dir|class|align|style],-h4[id|dir|class|align|style],-h5[id|dir|class|align|style],-h6[id|dir|class|align|style],hr[class],dd[id|class|title|dir],dl[id|class|title|dir],dt[id|class|title|dir],@[id,style,class]",
- 'extended_valid_elements' => "img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|usemap],iframe[src|name|width|height|align|frameborder|marginwidth|marginheight|scrolling],object[width|height|data|type],param[name|value],map[class|name|id],area[shape|coords|href|target|alt]"
+ 'extended_valid_elements' => "img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|usemap],iframe[src|name|width|height|align|frameborder|marginwidth|marginheight|scrolling],object[width|height|data|type],param[name|value],map[class|name|id],area[shape|coords|href|target|alt]",
+ 'spellchecker_rpc_url' => THIRDPARTY_DIR . '/tinymce-spellchecker/rpc.php'
));
HtmlEditorConfig::get('cms')->enablePlugins('media', 'fullscreen');
-HtmlEditorConfig::get('cms')->enablePlugins(array('ssbuttons' => '../../../cms/javascript/tinymce_ssbuttons/editor_plugin_src.js'));
+HtmlEditorConfig::get('cms')->enablePlugins(array('ssbuttons' => sprintf('../../../%s/tinymce_ssbuttons/editor_plugin_src.js', THIRDPARTY_DIR)));
HtmlEditorConfig::get('cms')->insertButtonsBefore('formatselect', 'styleselect');
HtmlEditorConfig::get('cms')->addButtonsToLine(2, 'ssimage', 'ssflash', 'sslink', 'unlink', 'anchor', 'separator','code', 'fullscreen', 'separator');
HtmlEditorConfig::get('cms')->removeButtons('tablecontrols');
HtmlEditorConfig::get('cms')->addButtonsToLine(3, 'tablecontrols');
+CMSMenu::remove_menu_item('CMSProfileController');
@@ -146,4 +146,4 @@ function getParameterFields() {
function canView() {
return true;
}
-}
+}
@@ -68,7 +68,7 @@ function Link() {
function handleAction($request) {
// This method can't be called without ajax.
- if(!$this->parentController->isAjax()) {
+ if(!$request->isAjax()) {
$this->parentController->redirectBack();
return;
}
@@ -81,7 +81,7 @@ function handleAction($request) {
$actionHandler = new $actionClass();
// 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]);
if($ids) {
@@ -111,8 +111,14 @@ function handleAction($request) {
implode(", ", $idsFromLive)
);
$livePages = Versioned::get_by_stage($this->recordClass, 'Live', $sql);
- if($pages) $pages->merge($livePages);
- else $pages = $livePages;
+ if($pages) {
+ // Can't merge into a DataList, need to condense into an actual list first
+ // (which will retrieve all records as objects, so its an expensive operation)
+ $pages = new ArrayList($pages->toArray());
+ $pages->merge($livePages);
+ } else {
+ $pages = $livePages;
+ }
}
}
} else {
@@ -124,12 +130,12 @@ function handleAction($request) {
function handleApplicablePages($request) {
// Find the action handler
- $actions = Object::get_static($this->class, 'batch_actions');
+ $actions = Config::inst()->get($this->class, 'batch_actions', Config::FIRST_SET);
$actionClass = $actions[$request->param('BatchAction')];
$actionHandler = new $actionClass['class']();
// 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;
$ids = array_filter($ids);
@@ -146,12 +152,12 @@ function handleApplicablePages($request) {
function handleConfirmation($request) {
// Find the action handler
- $actions = Object::get_static($this->class, 'batch_actions');
+ $actions = Config::inst()->get($this->class, 'batch_actions', Config::FIRST_SET);
$actionClass = $actions[$request->param('BatchAction')];
$actionHandler = new $actionClass();
// 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;
$ids = array_filter($ids);
@@ -197,12 +203,12 @@ function batchActionList() {
* @return array See {@link register()} for the returned format.
*/
function batchActions() {
- $actions = Object::get_static($this->class, 'batch_actions');
+ $actions = Config::inst()->get($this->class, 'batch_actions', Config::FIRST_SET);
if($actions) foreach($actions as $action) {
if($action['recordClass'] != $this->recordClass) unset($action);
}
return $actions;
}
-}
+}
@@ -59,9 +59,9 @@ public static function add_controller($controllerClass) {
* Return a CMSMenuItem to add the given controller to the CMSMenu
*/
protected static function menuitem_for_controller($controllerClass) {
- $urlBase = Object::get_static($controllerClass, 'url_base');
- $urlSegment = Object::get_static($controllerClass, 'url_segment');
- $menuPriority = Object::get_static($controllerClass, 'menu_priority');
+ $urlBase = Config::inst()->get($controllerClass, 'url_base', Config::FIRST_SET);
+ $urlSegment = Config::inst()->get($controllerClass, 'url_segment', Config::FIRST_SET);
+ $menuPriority = Config::inst()->get($controllerClass, 'menu_priority', Config::FIRST_SET);
// Don't add menu items defined the old way
if($urlSegment === null && $controllerClass != "CMSMain") return;
@@ -81,12 +81,12 @@ protected static function menuitem_for_controller($controllerClass) {
* Add the appropriate Director rules for the given controller.
*/
protected static function add_director_rule_for_controller($controllerClass) {
- $urlBase = Object::get_static($controllerClass, 'url_base');
- $urlSegment = Object::get_static($controllerClass, 'url_segment');
- $urlRule = Object::get_static($controllerClass, 'url_rule');
- $urlPriority = Object::get_static($controllerClass, 'url_priority');
-
- if($urlSegment || $controllerClass == "CMSMain") {
+ $urlBase = Config::inst()->get($controllerClass, 'url_base', Config::FIRST_SET);
+ $urlSegment = Config::inst()->get($controllerClass, 'url_segment', Config::FIRST_SET);
+ $urlRule = Config::inst()->get($controllerClass, 'url_rule', Config::FIRST_SET);
+ $urlPriority = Config::inst()->get($controllerClass, 'url_priority', Config::FIRST_SET);
+
+ if($urlSegment || $controllerClass == 'CMSMain') {
$link = Controller::join_links($urlBase, $urlSegment) . '/';
// Make director rule
@@ -101,7 +101,7 @@ protected static function add_director_rule_for_controller($controllerClass) {
/**
* Add an arbitrary URL to the CMS menu.
*
- * @param string $code A unique identifier (used to create a CSS ID and as it's key in {@link $menu_items}
+ * @param string $code A unique identifier (used to create a CSS ID and its key in {@link $menu_items})
* @param string $menuTitle The link's title in the CMS menu
* @param string $url The url of the link
* @param integer $priority The menu priority (sorting order) of the menu item. Higher priorities will be further left.
@@ -318,9 +318,8 @@ function provideI18nEntities() {
foreach($cmsClasses as $cmsClass) {
$defaultTitle = LeftAndMain::menu_title_for_class($cmsClass);
$ownerModule = i18n::get_owner_module($cmsClass);
- $entities["{$cmsClass}.MENUTITLE"] = array($defaultTitle, PR_HIGH, 'Menu title', $ownerModule);
+ $entities["{$cmsClass}.MENUTITLE"] = array($defaultTitle, 'Menu title', $ownerModule);
}
return $entities;
}
}
-?>
@@ -47,4 +47,3 @@ public function __construct($title, $url, $controller = null, $priority = -1) {
}
}
-?>
@@ -22,4 +22,4 @@ function Link();
*/
function CMSEditLink();
-}
+}
@@ -0,0 +1,35 @@
+<?php
+class CMSProfileController extends LeftAndMain {
+
+ static $url_segment = 'myprofile';
+ static $required_permission_codes = false;
+
+ public function index($request) {
+ $form = $this->Member_ProfileForm();
+ return $this->customise(array(
+ 'Content' => ' ',
+ 'Form' => $form
+ ))->renderWith('CMSDialog');
+ }
+
+ public function Member_ProfileForm() {
+ return new Member_ProfileForm($this, 'Member_ProfileForm', Member::currentUser());
+ }
+
+ function canView($member = null) {
+ if(!$member && $member !== FALSE) $member = Member::currentUser();
+
+ // cms menus only for logged-in members
+ if(!$member) return false;
+
+ // Only check for generic CMS permissions
+ if(
+ !Permission::checkMember($member, "CMS_ACCESS_LeftAndMain")
+ && !Permission::checkMember($member, "CMS_ACCESS_CMSMain")
+ ) {
+ return false;
+ }
+
+ return true;
+ }
+}
@@ -49,13 +49,16 @@ function __construct($controller, $name, $fields = null, $actions = null, $valid
}
if(!$actions) $actions = new FieldList(
- new FormAction('doImport', _t('SecurityAdmin_MemberImportForm.BtnImport', 'Import'))
+ $importAction = new FormAction('doImport', _t('SecurityAdmin_MemberImportForm.BtnImport', 'Import from CSV'))
);
-
+
+ $importAction->addExtraClass('ss-ui-button');
+
if(!$validator) $validator = new RequiredFields('CsvFile');
parent::__construct($controller, $name, $fields, $actions, $validator);
-
+
+ $this->addExtraClass('cms');
$this->addExtraClass('import-form');
}
@@ -67,24 +70,23 @@ function doImport($data, $form) {
// result message
$msgArr = array();
- if($result->CreatedCount()) $msgArr[] = sprintf(
- _t('GroupImportForm.ResultCreated', 'Created %d groups'),
- $result->CreatedCount()
+ if($result->CreatedCount()) $msgArr[] = _t(
+ 'GroupImportForm.ResultCreated', 'Created {count} groups',
+ array('count' => $result->CreatedCount())
);
- if($result->UpdatedCount()) $msgArr[] = sprintf(
- _t('GroupImportForm.ResultUpdated', 'Updated %d groups'),
- $result->UpdatedCount()
+ if($result->UpdatedCount()) $msgArr[] = _t(
+ 'GroupImportForm.ResultUpdated', 'Updated %d groups',
+ array('count' => $result->UpdatedCount())
);
- if($result->DeletedCount()) $msgArr[] = sprintf(
- _t('GroupImportForm.ResultDeleted', 'Deleted %d groups'),
- $result->DeletedCount()
+ if($result->DeletedCount()) $msgArr[] = _t(
+ 'GroupImportForm.ResultDeleted', 'Deleted %d groups',
+ array('count' => $result->DeletedCount())
);
$msg = ($msgArr) ? implode(',', $msgArr) : _t('MemberImportForm.ResultNone', 'No changes');
$this->sessionMessage($msg, 'good');
- $this->redirectBack();
+ $this->controller->redirectBack();
}
}
-?>
Oops, something went wrong. Retry.

0 comments on commit 3bf5f6b

Please sign in to comment.