Silverstripe 3 / Tabset / Special Chars / Issue - tabs

I'm extending SiteConfig and create a new Tabset. I can't get it to work properly ; when using special chars in tabnames, the layout is mixed up.
I also tried it with _t('MyClass.MyMainTab','Public') and a german language-yml without success. (also no success with & Ouml ;)
How can i use SpecialChars in tab names (Tabset - names)?
yml:
SiteConfig:
extensions:
- MyClass
MyClass:
class MyClass extends DataExtension{
public function updateCMSFields(FieldList $fields){
$set = new TabSet(
'ÖffentlicherBereich', // PROBLEM !!!!!
new Tab(
'Einstellungen',
new LiteralField('Bla', 'Blabla')
),
new Tab(
'OtherTab',
new LiteralField('Blabla', 'Bla')
),
new Tab(
'AnotherTab',
new LiteralField('Blabla', 'Bla')
)
);
$fields->addFieldToTab('Root.Main.Main', $set);
}
}

I'd try to use ->setTitle() to add the title containing Umlauts if
the formfield ID has problems with umlauts.
add the tabset to the Root tab directly, as it should be on the same level as Root.Main
Use Tabset::create() instead instead of new Tabset() for daisy chaining (and possible use of Injector)
Modified, untested code:
$set = TabSet::create(
'OpeningTimes', // PROBLEM !!!!!
Tab::create(
'Einstellungen',
new LiteralField('Bla', 'Blabla')
),
Tab::create(
'OtherTab',
new LiteralField('Blabla', 'Bla')
),
Tab::create(
'AnotherTab',
new LiteralField('Blabla', 'Bla')
)
)->setTitle('Öffnungszeiten');
$fields->addFieldToTab('Root', $set);

Related

How can gulp-load-plugins replace all gulp- to g

Default gulp-load-plugins remove all plugin name gulp-
But how can make gulp-load-plugins default replace all plugin name which start with gulp- to g?
For example
gulp-sass
other-gulp-plugin
rename to
gSass
other-gulp-plugin
From gulp-load-plugins options :
pattern: ['gulp-', 'gulp.', '#/gulp{-,.}'], // the glob(s) to search for
replaceString: /^gulp(-|.)/, // what to remove from the name of the module when adding it to the context
renameFn: function (name) { ... }, // a function to handle the renaming of plugins (the default works)
So you would need something like this (i.e., untested)
var plugins = require("gulp-load-plugins")({
renameFn: function(name) {
// if only it were as easy as the below : the simple case
// return name.replace(/^#*gulp(-|.)(.)/, 'g\U$2\E');
// but try this
return name.replace(/^#*gulp(-|.)(.)/, function (match, p1, p2) {
return "g" + p2.toUpperCase(); })
// p2 is the second capture group
}
});
The simple case:
/#*gulp(-|.) : find the patterns #gulp-, #gulp., gulp- and gulp.
(.) : capture the next character
g\U$2\E : replace only the 2nd capture group (.) with
'g' followed by capitalized \U 2nd capture group $2 and
end capitalizations of 2nd capture group \E [not really needed in your case since you only want one character].
I left the simple case in for instruction but you probably need the longer uncommented version in node/gulp.

Example: Tablesorter Output widget difference between download and popup special characters

I am using the output widget of tablesorter to get my table as csv (for excel). The table has no problems with special chars. If I export the data as output its all fine. If I use download option special characters like & are shown as & (seen in Notepad++) so Excel decides to separate it as there is a ;
Any help?
UPDATE:
http://jsfiddle.net/abkNM/6503/
Thanks!
Ok, I ended up adding a new callback function output_formatContent*. Use it as follows (demo):
output_formatContent: function (config, widgetOptions, data) {
// data.isHeader (boolean) = true if processing a header cell
// data.$cell = jQuery object of the cell currently being processed
// data.content = processed cell content
// (spaces trimmed, quotes added/replaced, etc)
// **********
// use data.$cell.html() to get the original cell content
return data.content.replace(/&/g, '&');
}
if you want to replace all HTML codes, then check out Mathias Bynens he which would work as follows:
output_formatContent : function( c, wo, data ) {
// replace all HTML shortcut codes
// (e.g. 'foo © bar ≠ baz 𝌆 qux' becomes 'foo © bar ≠ baz 𝌆 qux' )
return he.decode( data.content );
}
* Note: the new output widget callback is currently only available in the master branch of the tablesorter repository. It will be included in the next update.

Tabris UI Controls Demo Indication error on IPad and IPhone

I'm validating the Tabris framework at the moment and stumbled about a few indication errors when I tried the UI Control Code Snippets.
I added the VisualGuideDemo.java to my HelloWorld-Project and added a table to the display with the createTable function. In my browser it is displaying the expected output with 3 columns and 128 rows. When I test the application on an IPad mini or the IPhone Simulator ...
only the first Column is displayed,
it is not possible to scroll through the whole list (i can scroll about 60 items down, then the list "jumps" back)
and the width of the table does not adjust to the fullwidth of the screen.
See attached Screenshots
I also tried to add a TabFolder which uses the full width of the screen. I used the 'createTabFolder' method:
private void createTabFolder() {
final Shell shell = new Shell( display, SWT.NONE );
shell.setLayout( new FillLayout() );
final TabFolder tabFolder = new TabFolder( shell, SWT.NONE );
final TabItem tab0 = new TabItem( tabFolder, SWT.NONE );
tab0.setText( "Tab0" );
final TabItem tab1 = new TabItem( tabFolder, SWT.NONE );
tab1.setText( "Tab1" );
final TabItem tab2 = new TabItem( tabFolder, SWT.NONE );
tab2.setText( "Tab2" );
//shell.setSize( 300, 100 );
shell.open();
}
I uncommented the setSize function, but the TabFolder does not adjust to the full width of the screen (not in browser or on iOS device).
I'm new to SWT, RAP/Tabris so I am wondering if I miss something basic.
EDIT:
I guess several columns in one table are not supported in the mobile clients, but maybe it would be a nice feature to add the missing columns to the end of the list, seperated by listdividers. Is my assumption correct?
I found the solution to the width problem, I just had to call shell.setMaximized(true);

Html/CSS results page / scorecard for cricket in WordPress

I'm new to web-design and in process of creating a sports website based on the WordPress platform.
One of the sports that the site will be covering is cricket. My site is almost done, but I'm stuck at few very important CSS/Html tables for data. I would really appreciate if someone here could guide/help me on how to create tables like the ones in the links bellow or whether there is anyway someone can copy html/css from an existing site and style it.
I just need a copy of the tables, sorting options are not needed
Similar scorecard as light as possible would be great
Are these things possible with CSS/html in Wordpress or is there any better option for such tables?
Here are two solutions you could use:
Solution #1: TabPress Plugin
Through a graphical panel, you can fully customize your table. You can set your own CSS, you can have colspan, rowspan or all together. Check out the demo. If you don't want to spend too much time in coding, give it a try.
Solution #2: WP_List_Table
It's available since WordPress 3.1. WP 3.1 uses it to build the tables you can see in the admin panel. The table who displays the posts for instance uses this class. However, you can disable some features such as sorting, bulk operations etc.
Here is a sample code taken from one of my blogs. I wanted to display a table of statistics with no sorting option. Call ff_show_stats() to display the table from your PHP code.
if( ! class_exists( 'WP_List_Table' ) ) {
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
}
class FFStatsTable extends WP_List_Table {
function __construct(){
}
function get_columns(){
$columns = array(
'id' => 'ID',
'creation' => 'Creation',
'country' => 'Country'
// Add as much column as you want
// 'column_name_in_query' => 'Displayed column name'
);
return $columns;
}
function column_default( $item, $column_name ) {
switch( $column_name ) {
case 'id':
case 'creation':
case 'country':
return $item[ $column_name ];
default:
return print_r( $item, true ) ; //Show the whole array for debugging purposes
}
}
function prepare_items() {
global $wpdb;
$columns = $this->get_columns();
$hidden = array();
$sortable = array();//Empty array for disabling sorting
$this->_column_headers = array($columns, $hidden, $sortable);
$this->items = $wpdb->get_results(
"SELECT id,creation,country FROM wp_my_table WHERE my_condtion=TRUE",
ARRAY_A
);
}
}
function ff_show_stats() {
$myListTable = new FFStatsTable();
echo '<div class="wrap"><h2>Stats</h2>';
$myListTable->prepare_items();
$myListTable->display();
echo '</div>';
}
You can have a more detailed sample code here : http://plugins.svn.wordpress.org/custom-list-table-example/tags/1.2/list-table-example.php

Painting checkbox icons in a custom JComponent :Scala

I'm creating a custom scala component which needs an unchecked icon at (100,100) and checked icon at (200,100), the same icons used by swing. My code below works, but looks quite weird because I need to create dummy checkboxes. Is there a standard way to accomplish this ? ( No I'm not trying to add components to container etc etc...this is not a layout management problem...am trying to create a custom component )
val comp = new JComponent() {
override def paintComponent(g:Graphics) {
val cb1 = new JCheckBox()
val cb2 = new JCheckBox()
cb2.setSelected( true )
val icon = UIManager.getIcon("CheckBox.icon")
icon.paintIcon( cb1, g, 100,100)
icon.paintIcon( cb2, g, 200,100)
}
}
val f = new JFrame
f.getContentPane().setLayout( new BorderLayout )
f.getContentPane().add( comp , BorderLayout.CENTER )
f.pack
f.show
You shouldn't define components within paintComponent. Define them in the component's constructor so that they're not re-defined each time the component is redrawn.
The standard thing to do if you don't want the user to change the values of checkboxes would be to use setEnabled(false).
Also, have you tried using the scala.swing package?