ENHANCEMENT Added help texts for MemberImportForm and GroupImportForm

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@98750 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-02-11 02:22:45 +00:00
parent 19de418156
commit 37a914641b
6 changed files with 146 additions and 3 deletions

View File

@ -15,7 +15,28 @@ class GroupImportForm extends Form {
function __construct($controller, $name, $fields = null, $actions = null, $validator = null) { function __construct($controller, $name, $fields = null, $actions = null, $validator = null) {
if(!$fields) { if(!$fields) {
$helpHtml = _t(
'GroupImportForm.Help1',
'<p>Import one or more groups in <em>CSV</em> format (comma-separated values). <small><a href="#" class="toggle-advanced">Show advanced usage</a></small></p>'
);
$helpHtml .= _t(
'GroupImportForm.Help2',
'<div class="advanced">
<h4>Advanced usage</h4>
<ul>
<li>Allowed columns: <em>%s</em></li>
<li>Existing groups are matched by their unique <em>Code</em> value, and updated with any new values from the imported file</li>
<li>Group hierarchies can be created by using a <em>ParentCode</em> column.</li>
<li>Permission codes can be assigned by the <em>PermissionCode</em> column. Existing permission codes are not cleared.</li>
</ul>
</div>');
$importer = new GroupCsvBulkLoader();
$importSpec = $importer->getImportSpec();
$helpHtml = sprintf($helpHtml, implode(', ', array_keys($importSpec['fields'])));
$fields = new FieldSet( $fields = new FieldSet(
new LiteralField('Help', $helpHtml),
$fileField = new FileField( $fileField = new FileField(
'CsvFile', 'CsvFile',
_t( _t(
@ -33,8 +54,9 @@ class GroupImportForm extends Form {
if(!$validator) $validator = new RequiredFields('CsvFile'); if(!$validator) $validator = new RequiredFields('CsvFile');
parent::__construct($controller, $name, $fields, $actions, $validator); parent::__construct($controller, $name, $fields, $actions, $validator);
$this->addExtraClass('import-form');
} }
function doImport($data, $form) { function doImport($data, $form) {

View File

@ -15,7 +15,27 @@ class MemberImportForm extends Form {
function __construct($controller, $name, $fields = null, $actions = null, $validator = null) { function __construct($controller, $name, $fields = null, $actions = null, $validator = null) {
if(!$fields) { if(!$fields) {
$helpHtml = _t(
'MemberImportForm.Help1',
'<p>Import members in <em>CSV format</em> (comma-separated values). <small><a href="#" class="toggle-advanced">Show advanced usage</a></small></p>'
);
$helpHtml .= _t(
'MemberImportForm.Help2',
'<div class="advanced">
<h4>Advanced usage</h4>
<ul>
<li>Allowed columns: <em>%s</em></li>
<li>Existing members are matched by their unique <em>Code</em> property, and updated with any new values from the imported file.</li>
<li>Groups can be assigned by the <em>Groups</em> column. Groups are identified by their <em>Code</em> property, multiple groups can be separated by comma. Existing group memberships are not cleared.</li>
</ul>
</div>');
$importer = new MemberCsvBulkLoader();
$importSpec = $importer->getImportSpec();
$helpHtml = sprintf($helpHtml, implode(', ', array_keys($importSpec['fields'])));
$fields = new FieldSet( $fields = new FieldSet(
new LiteralField('Help', $helpHtml),
$fileField = new FileField( $fileField = new FileField(
'CsvFile', 'CsvFile',
_t( _t(
@ -35,6 +55,9 @@ class MemberImportForm extends Form {
parent::__construct($controller, $name, $fields, $actions, $validator); parent::__construct($controller, $name, $fields, $actions, $validator);
Requirements::javascript(CMS_DIR . '/javascript/MemberImportForm.js');
$this->addExtraClass('import-form');
} }
function doImport($data, $form) { function doImport($data, $form) {

View File

@ -113,7 +113,9 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
Requirements::css(SAPPHIRE_DIR . '/css/Form.css'); Requirements::css(SAPPHIRE_DIR . '/css/Form.css');
Requirements::css(CMS_DIR . '/css/typography.css'); Requirements::css(CMS_DIR . '/css/typography.css');
Requirements::css(CMS_DIR . '/css/cms_right.css'); Requirements::css(CMS_DIR . '/css/cms_right.css');
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js');
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-concrete/dist/jquery.concrete-dist.js');
Requirements::css(CMS_DIR . '/css/MemberImportForm.css');
Requirements::javascript(CMS_DIR . '/javascript/MemberImportForm.js'); Requirements::javascript(CMS_DIR . '/javascript/MemberImportForm.js');
return $this->renderWith('BlankPage', array( return $this->renderWith('BlankPage', array(
@ -142,7 +144,9 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
Requirements::css(SAPPHIRE_DIR . '/css/Form.css'); Requirements::css(SAPPHIRE_DIR . '/css/Form.css');
Requirements::css(CMS_DIR . '/css/typography.css'); Requirements::css(CMS_DIR . '/css/typography.css');
Requirements::css(CMS_DIR . '/css/cms_right.css'); Requirements::css(CMS_DIR . '/css/cms_right.css');
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js');
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-concrete/dist/jquery.concrete-dist.js');
Requirements::css(CMS_DIR . '/css/MemberImportForm.css');
Requirements::javascript(CMS_DIR . '/javascript/MemberImportForm.js'); Requirements::javascript(CMS_DIR . '/javascript/MemberImportForm.js');
return $this->renderWith('BlankPage', array( return $this->renderWith('BlankPage', array(

25
css/MemberImportForm.css Normal file
View File

@ -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;
}

View File

@ -0,0 +1,19 @@
(function($) {
$.concrete('ss', function($){
$('.import-form .advanced').concrete({
onmatch: function() {
this._super();
this.hide();
}
});
$('.import-form a.toggle-advanced').concrete({
onclick: function(e) {
this.parents('form:eq(0)').find('.advanced').toggle();
return false;
}
});
});
}(jQuery));

View File

@ -207,6 +207,20 @@ $lang['en_US']['CommentTableField.ss']['SPAM'] = 'spam';
$lang['en_US']['ComplexTableField']['CLOSEPOPUP'] = 'Close Popup'; $lang['en_US']['ComplexTableField']['CLOSEPOPUP'] = 'Close Popup';
$lang['en_US']['ComplexTableField']['SUCCESSADD'] = 'Added %s %s %s'; $lang['en_US']['ComplexTableField']['SUCCESSADD'] = 'Added %s %s %s';
$lang['en_US']['Folder']['DELSELECTED'] = 'Delete selected files'; $lang['en_US']['Folder']['DELSELECTED'] = 'Delete selected files';
$lang['en_US']['Group']['IMPORTTABTITLE'] = 'Import';
$lang['en_US']['GroupImportForm']['Help1'] = '<p>Import one or more groups in <em>CSV</em> format (comma-separated values). <small><a href="#" class="toggle-advanced">Show advanced usage</a></small></p>';
$lang['en_US']['GroupImportForm']['Help2'] = '<div class="advanced">
<h4>Advanced usage</h4>
<ul>
<li>Allowed columns: <em>%s</em></li>
<li>Existing groups are matched by their unique <em>Code</em> value, and updated with any new values from the imported file</li>
<li>Group hierarchies can be created by using a <em>ParentCode</em> column.</li>
<li>Permission codes can be assigned by the <em>PermissionCode</em> column. Existing permission codes are not cleared.</li>
</ul>
</div>';
$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']['ACTIONS'] = 'actions';
$lang['en_US']['ImageEditor.ss']['ADJUST'] = 'adjust'; $lang['en_US']['ImageEditor.ss']['ADJUST'] = 'adjust';
$lang['en_US']['ImageEditor.ss']['APPLY'] = 'apply'; $lang['en_US']['ImageEditor.ss']['APPLY'] = 'apply';
@ -274,6 +288,39 @@ $lang['en_US']['LeftAndMain.ss']['VIEWINDRAFT'] = 'View the Page in the Draft Si
$lang['en_US']['LeftAndMain.ss']['VIEWINPUBLISHED'] = 'View the Page in the Published 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.ss']['VIEWPAGEIN'] = 'Page view:';
$lang['en_US']['LeftAndMain_right.ss']['WELCOMETO'] = 'Welcome to'; $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';
$lang['en_US']['MathSpamProtection']['FIFTEEN'] = 'fifteen';
$lang['en_US']['MathSpamProtection']['FIVE'] = 'five';
$lang['en_US']['MathSpamProtection']['FOUR'] = 'four';
$lang['en_US']['MathSpamProtection']['FOURTEEN'] = 'fourteen';
$lang['en_US']['MathSpamProtection']['NINE'] = 'nine';
$lang['en_US']['MathSpamProtection']['ONE'] = 'one';
$lang['en_US']['MathSpamProtection']['SEVEN'] = 'seven';
$lang['en_US']['MathSpamProtection']['SEVENTEEN'] = 'seventeen';
$lang['en_US']['MathSpamProtection']['SIX'] = 'six';
$lang['en_US']['MathSpamProtection']['SIXTEEN'] = 'sixteen';
$lang['en_US']['MathSpamProtection']['TEN'] = 'ten';
$lang['en_US']['MathSpamProtection']['THIRTEEN'] = 'thirteen';
$lang['en_US']['MathSpamProtection']['THREE'] = 'three';
$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'] = '<p>Import members in <em>CSV format</em> (comma-separated values). <small><a href="#" class="toggle-advanced">Show advanced usage</a></small></p>';
$lang['en_US']['MemberImportForm']['Help2'] = '<div class="advanced">
<h4>Advanced usage</h4>
<ul>
<li>Allowed columns: <em>%s</em></li>
<li>Existing members are matched by their unique <em>Code</em> property, and updated with any new values from the imported file.</li>
<li>Groups can be assigned by the <em>Groups</em> column. Groups are identified by their <em>Code</em> property, multiple groups can be separated by comma. Existing group memberships are not cleared.</li>
</ul>
</div>';
$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( $lang['en_US']['MemberList.ss']['FILTER'] = array(
'Filter', 'Filter',
50, 50,
@ -416,6 +463,9 @@ $lang['en_US']['SecurityAdmin']['MENUTITLE'] = array(
'Menu title' 'Menu title'
); );
$lang['en_US']['SecurityAdmin']['SGROUPS'] = 'Security Groups'; $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 <small>(Allowed extensions: *.csv)</small>';
$lang['en_US']['SecurityAdmin_left.ss']['BATCHACTIONS'] = array( $lang['en_US']['SecurityAdmin_left.ss']['BATCHACTIONS'] = array(
'Batch Actions', 'Batch Actions',
PR_HIGH PR_HIGH