diff --git a/code/GroupImportForm.php b/code/GroupImportForm.php index b5f55eab..a514247d 100644 --- a/code/GroupImportForm.php +++ b/code/GroupImportForm.php @@ -15,7 +15,28 @@ class GroupImportForm extends Form { function __construct($controller, $name, $fields = null, $actions = null, $validator = null) { if(!$fields) { + $helpHtml = _t( + 'GroupImportForm.Help1', + '

Import one or more groups in CSV format (comma-separated values). Show advanced usage

' + ); + $helpHtml .= _t( + 'GroupImportForm.Help2', +'
+

Advanced usage

+ +
'); + + $importer = new GroupCsvBulkLoader(); + $importSpec = $importer->getImportSpec(); + $helpHtml = sprintf($helpHtml, implode(', ', array_keys($importSpec['fields']))); + $fields = new FieldSet( + new LiteralField('Help', $helpHtml), $fileField = new FileField( 'CsvFile', _t( @@ -33,8 +54,9 @@ class GroupImportForm extends Form { if(!$validator) $validator = new RequiredFields('CsvFile'); - parent::__construct($controller, $name, $fields, $actions, $validator); + + $this->addExtraClass('import-form'); } function doImport($data, $form) { diff --git a/code/MemberImportForm.php b/code/MemberImportForm.php index 85da09a8..d3df83c5 100644 --- a/code/MemberImportForm.php +++ b/code/MemberImportForm.php @@ -15,7 +15,27 @@ class MemberImportForm extends Form { function __construct($controller, $name, $fields = null, $actions = null, $validator = null) { if(!$fields) { + $helpHtml = _t( + 'MemberImportForm.Help1', + '

Import members in CSV format (comma-separated values). Show advanced usage

' + ); + $helpHtml .= _t( + 'MemberImportForm.Help2', +'
+

Advanced usage

+ +
'); + + $importer = new MemberCsvBulkLoader(); + $importSpec = $importer->getImportSpec(); + $helpHtml = sprintf($helpHtml, implode(', ', array_keys($importSpec['fields']))); + $fields = new FieldSet( + new LiteralField('Help', $helpHtml), $fileField = new FileField( 'CsvFile', _t( @@ -35,6 +55,9 @@ class MemberImportForm extends Form { parent::__construct($controller, $name, $fields, $actions, $validator); + + Requirements::javascript(CMS_DIR . '/javascript/MemberImportForm.js'); + $this->addExtraClass('import-form'); } function doImport($data, $form) { diff --git a/code/SecurityAdmin.php b/code/SecurityAdmin.php index 17aa4ac4..d14dfc06 100644 --- a/code/SecurityAdmin.php +++ b/code/SecurityAdmin.php @@ -142,7 +142,10 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider { Requirements::css(SAPPHIRE_DIR . '/css/Form.css'); Requirements::css(CMS_DIR . '/css/typography.css'); Requirements::css(CMS_DIR . '/css/cms_right.css'); - + Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); + Requirements::javascript(THIRDPARTY_DIR . '/jquery-livequery/jquery.livequery.js'); + Requirements::javascript(SAPPHIRE_DIR . '/javascript/jquery_improvements.js'); + Requirements::css(CMS_DIR . '/css/MemberImportForm.css'); Requirements::javascript(CMS_DIR . '/javascript/MemberImportForm.js'); return $this->renderWith('BlankPage', array( @@ -171,7 +174,10 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider { Requirements::css(SAPPHIRE_DIR . '/css/Form.css'); Requirements::css(CMS_DIR . '/css/typography.css'); Requirements::css(CMS_DIR . '/css/cms_right.css'); - + Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); + Requirements::javascript(THIRDPARTY_DIR . '/jquery-livequery/jquery.livequery.js'); + Requirements::javascript(SAPPHIRE_DIR . '/javascript/jquery_improvements.js'); + Requirements::css(CMS_DIR . '/css/MemberImportForm.css'); Requirements::javascript(CMS_DIR . '/javascript/MemberImportForm.js'); return $this->renderWith('BlankPage', array( diff --git a/css/MemberImportForm.css b/css/MemberImportForm.css new file mode 100644 index 00000000..16927ddf --- /dev/null +++ b/css/MemberImportForm.css @@ -0,0 +1,25 @@ +* { + font-size:12px; +} + +body { + margin: 0; + padding: 0; +} + +form.import-form { + margin: 0; +} + + form.import-form #CsvFile .middleColumn { + background: none !important; + } + + form.import-form .advanced h4 { + margin-bottom: .5em; + } + + form.import-form .Actions { + text-align: left; + border: 0; + } \ No newline at end of file diff --git a/javascript/MemberImportForm.js b/javascript/MemberImportForm.js new file mode 100644 index 00000000..a8ff81a9 --- /dev/null +++ b/javascript/MemberImportForm.js @@ -0,0 +1,13 @@ +(function($) { +$(document).ready(function() { + $('.import-form .advanced').hide(); + + $('.import-form a.toggle-advanced').livequery( + 'click', + function(e) { + $(this).parents('form:eq(0)').find('.advanced').toggle(); + return false; + } + ); +}); +}(jQuery)); \ No newline at end of file diff --git a/lang/en_US.php b/lang/en_US.php index 66ba2137..3978dd99 100755 --- a/lang/en_US.php +++ b/lang/en_US.php @@ -2,6 +2,7 @@ global $lang; +$lang['en_US']['']['CHOOSEPAGE'] = 'Please choose an item from the left.'; $lang['en_US']['AssetAdmin']['CHOOSEFILE'] = 'Choose file: '; $lang['en_US']['AssetAdmin']['DELETEDX'] = 'Deleted %s files.%s'; $lang['en_US']['AssetAdmin']['FILESREADY'] = 'Files ready to upload:'; @@ -57,6 +58,7 @@ $lang['en_US']['AssetTableField.ss']['DELFILE'] = 'Delete this file'; $lang['en_US']['AssetTableField.ss']['DRAGTOFOLDER'] = 'Drag to folder on left to move file'; $lang['en_US']['AssetTableField.ss']['EDIT'] = 'Edit asset'; $lang['en_US']['AssetTableField.ss']['SHOW'] = 'Show asset'; +$lang['en_US']['BrokenLinksReport']['BROKENLINKS'] = 'Broken links report'; $lang['en_US']['CMSBatchActions']['DELETED_DRAFT_PAGES'] = 'Deleted %d pages from the draft site, %d failures'; $lang['en_US']['CMSBatchActions']['DELETED_PAGES'] = 'Deleted %d pages from the published site, %d failures'; $lang['en_US']['CMSBatchActions']['DELETE_DRAFT_PAGES'] = 'Delete from draft site'; @@ -69,7 +71,7 @@ $lang['en_US']['CMSBatchActions']['PUBLISH_PAGES'] = 'Publish'; $lang['en_US']['CMSMain']['ACCESS'] = array( 'Access to %s', PR_MEDIUM, - 'Item in permission selection identifying the admin section, with title and classname. Example: Access to Files & Images' + 'Item in permission selection identifying the admin section. Example: Access to \'Files & Images\'' ); $lang['en_US']['CMSMain']['ACCESSALLINTERFACES'] = 'Access to all CMS sections'; $lang['en_US']['CMSMain']['CANCEL'] = 'Cancel'; @@ -226,6 +228,20 @@ $lang['en_US']['CommentTableField.ss']['NOITEMSFOUND'] = 'No items found'; $lang['en_US']['CommentTableField.ss']['SPAM'] = 'spam'; $lang['en_US']['ComplexTableField']['CLOSEPOPUP'] = 'Close Popup'; $lang['en_US']['ComplexTableField']['SUCCESSADD'] = 'Added %s %s %s'; +$lang['en_US']['Group']['IMPORTTABTITLE'] = 'Import'; +$lang['en_US']['GroupImportForm']['Help1'] = '

Import one or more groups in CSV format (comma-separated values). Show advanced usage

'; +$lang['en_US']['GroupImportForm']['Help2'] = '
+

Advanced usage

+ +
'; +$lang['en_US']['GroupImportForm']['ResultCreated'] = 'Created %d groups'; +$lang['en_US']['GroupImportForm']['ResultDeleted'] = 'Deleted %d groups'; +$lang['en_US']['GroupImportForm']['ResultUpdated'] = 'Updated %d groups'; $lang['en_US']['ImageEditor.ss']['ACTIONS'] = 'actions'; $lang['en_US']['ImageEditor.ss']['ADJUST'] = 'adjust'; $lang['en_US']['ImageEditor.ss']['APPLY'] = 'apply'; @@ -263,11 +279,6 @@ $lang['en_US']['LeftAndMain']['PLEASESAVE'] = 'Please Save Page: This page could $lang['en_US']['LeftAndMain']['REQUESTERROR'] = 'Error in request'; $lang['en_US']['LeftAndMain']['SAVED'] = 'saved'; $lang['en_US']['LeftAndMain']['SAVEDUP'] = 'Saved'; -$lang['en_US']['LeftAndMain']['SITECONTENTLEFT'] = array( - 'Site Content', - PR_HIGH, - 'Root node on left' -); $lang['en_US']['LeftAndMain']['STATUSPUBLISHEDSUCCESS'] = array( 'Published \'%s\' successfully', PR_MEDIUM, @@ -296,6 +307,7 @@ $lang['en_US']['LeftAndMain.ss']['SSWEB'] = 'Silverstripe Website'; $lang['en_US']['LeftAndMain.ss']['VIEWINDRAFT'] = 'View the Page in the Draft Site'; $lang['en_US']['LeftAndMain.ss']['VIEWINPUBLISHED'] = 'View the Page in the Published Site'; $lang['en_US']['LeftAndMain.ss']['VIEWPAGEIN'] = 'Page view:'; +$lang['en_US']['LeftAndMain_right.ss']['WELCOMETO'] = 'Welcome to'; $lang['en_US']['MathSpamProtection']['EIGHT'] = 'eight'; $lang['en_US']['MathSpamProtection']['EIGHTEEN'] = 'eighteen'; $lang['en_US']['MathSpamProtection']['ELEVEN'] = 'eleven'; @@ -316,6 +328,19 @@ $lang['en_US']['MathSpamProtection']['TWELVE'] = 'twelve'; $lang['en_US']['MathSpamProtection']['TWO'] = 'two'; $lang['en_US']['MathSpamProtection']['WHATIS'] = 'What is %s plus %s?'; $lang['en_US']['MathSpamProtection']['ZERO'] = 'zero'; +$lang['en_US']['MemberImportForm']['Help1'] = '

Import members in CSV format (comma-separated values). Show advanced usage

'; +$lang['en_US']['MemberImportForm']['Help2'] = '
+

Advanced usage

+ +
'; +$lang['en_US']['MemberImportForm']['ResultCreated'] = 'Created %d members'; +$lang['en_US']['MemberImportForm']['ResultDeleted'] = 'Deleted %d members'; +$lang['en_US']['MemberImportForm']['ResultNone'] = 'No changes'; +$lang['en_US']['MemberImportForm']['ResultUpdated'] = 'Updated %d members'; $lang['en_US']['MemberList.ss']['FILTER'] = array( 'Filter', 50, @@ -464,6 +489,9 @@ $lang['en_US']['SecurityAdmin']['MENUTITLE'] = array( $lang['en_US']['SecurityAdmin']['NEWGROUP'] = 'New Group'; $lang['en_US']['SecurityAdmin']['SAVE'] = 'Save'; $lang['en_US']['SecurityAdmin']['SGROUPS'] = 'Security Groups'; +$lang['en_US']['SecurityAdmin']['TABIMPORT'] = 'Import'; +$lang['en_US']['SecurityAdmin_MemberImportForm']['BtnImport'] = 'Import'; +$lang['en_US']['SecurityAdmin_MemberImportForm']['FileFieldLabel'] = 'CSV File (Allowed extensions: *.csv)'; $lang['en_US']['SecurityAdmin_left.ss']['CREATE'] = 'Create'; $lang['en_US']['SecurityAdmin_left.ss']['DEL'] = 'Delete'; $lang['en_US']['SecurityAdmin_left.ss']['DELGROUPS'] = 'Delete the selected groups'; @@ -500,6 +528,9 @@ $lang['en_US']['StaticExporter']['BASEURL'] = 'Base URL'; $lang['en_US']['StaticExporter']['EXPORTTO'] = 'Export to that folder'; $lang['en_US']['StaticExporter']['FOLDEREXPORT'] = 'Folder to export to'; $lang['en_US']['StaticExporter']['NAME'] = 'Static exporter'; +$lang['en_US']['TableListField.ss']['NOITEMSFOUND'] = 'No items found'; +$lang['en_US']['TableListField.ss']['SORTASC'] = 'Sort in ascending order'; +$lang['en_US']['TableListField.ss']['SORTDESC'] = 'Sort in descending order'; $lang['en_US']['TableListField_PageControls.ss']['DISPLAYING'] = 'Displaying'; $lang['en_US']['TableListField_PageControls.ss']['OF'] = 'of'; $lang['en_US']['TableListField_PageControls.ss']['TO'] = 'to'; @@ -518,8 +549,12 @@ $lang['en_US']['ViewArchivedEmail.ss']['HAVEASKED'] = array( 30, 'Followed by a date' ); -$lang['en_US']['WidgetAreaEditor']['ss'] = 'TOADD'; +$lang['en_US']['WidgetAreaEditor.ss']['AVAILABLE'] = 'Available Widgets'; +$lang['en_US']['WidgetAreaEditor.ss']['AVAILWIDGETS'] = 'Click a widget title below to use it on this page.'; +$lang['en_US']['WidgetAreaEditor.ss']['INUSE'] = 'Widgets currently used'; $lang['en_US']['WidgetAreaEditor.ss']['NOAVAIL'] = 'There are currently no widgets available.'; +$lang['en_US']['WidgetAreaEditor.ss']['TOSORT'] = 'To sort currently used widgets on this page, drag them up and down.'; +$lang['en_US']['WidgetDescription.ss']['CLICKTOADDWIDGET'] = 'Click to add this widget'; $lang['en_US']['WidgetEditor.ss']['DELETE'] = 'Delete'; ?> \ No newline at end of file