Author: ornicar2
Date: 2010-02-12 17:06:46 +0100 (Fri, 12 Feb 2010)
New Revision: 27951
Added:
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/LICENSE
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/README
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/config/
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/config/dm/
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/config/dm/services.yml
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/config/dmAlternativeHelperPluginConfiguration.class.php
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/lib/
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/lib/helper/
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/lib/view/
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/test/
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/test/unit/
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/test/unit/dmAlternativeHelperTest.php
Log:
[Diem] added dmAlternativePlugin
Added:
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/LICENSE
===================================================================
---
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/LICENSE
(rev 0)
+++
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/LICENSE
2010-02-12 16:06:46 UTC (rev 27951)
@@ -0,0 +1,19 @@
+Copyright (c) 2009 Thibault Duplessis, Daniel Lohse
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
\ No newline at end of file
Property changes on:
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/LICENSE
___________________________________________________________________
Added: svn:executable
+ *
Added:
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/README
===================================================================
---
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/README
(rev 0)
+++
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/README
2010-02-12 16:06:46 UTC (rev 27951)
@@ -0,0 +1,22 @@
+dmAlternativeHelperPlugin
+=================
+
+This plugin is now deprecated.
+
+The dmAlternativeHelperPlugin provides Diem's helper functions (Diem's
class-based and symfony's standard function-based helpers) that normally
require the pound sign (i.e. £, £link, £o etc.) but for people without this
letter on their keyboards to ease template development.
+
+Available helpers are:
+
+ * _tag (= £)
+ * _tagO (= £o)
+ * _tagC (= £c)
+ * _link (= £link)
+ * _media (= £media)
+ * _table (= £table)
+
+The plugin is fully extensible. Only works with Diem 5.0 installed.
+
+Documentation
+-------------
+
+More documentation might be available in the online documentation: [Diem
alternative helper
documentation](http://diem-project.org/plugins/dmalternativehelperplugin)
\ No newline at end of file
Property changes on:
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/README
___________________________________________________________________
Added: svn:executable
+ *
Added:
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/config/dm/services.yml
===================================================================
---
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/config/dm/services.yml
(rev 0)
+++
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/config/dm/services.yml
2010-02-12 16:06:46 UTC (rev 27951)
@@ -0,0 +1,3 @@
+parameters:
+
+ helper.class: dmAlternativeHelper
\ No newline at end of file
Property changes on:
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/config/dm/services.yml
___________________________________________________________________
Added: svn:executable
+ *
Added:
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/config/dmAlternativeHelperPluginConfiguration.class.php
===================================================================
---
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/config/dmAlternativeHelperPluginConfiguration.class.php
(rev 0)
+++
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/config/dmAlternativeHelperPluginConfiguration.class.php
2010-02-12 16:06:46 UTC (rev 27951)
@@ -0,0 +1,19 @@
+<?php
+
+class dmAlternativeHelperPluginConfiguration extends sfPluginConfiguration
+{
+
+ /**
+ * @see sfPluginConfiguration
+ */
+ public function initialize()
+ {
+ $this->enableHelper();
+ }
+
+ protected function enableHelper()
+ {
+ sfConfig::set('sf_standard_helpers',
array_unique(array_merge(sfConfig::get('sf_standard_helpers', array()),
array('DmAlternative'))));
+ }
+
+}
\ No newline at end of file
Property changes on:
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/config/dmAlternativeHelperPluginConfiguration.class.php
___________________________________________________________________
Added: svn:executable
+ *
Added:
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/test/unit/dmAlternativeHelperTest.php
===================================================================
---
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/test/unit/dmAlternativeHelperTest.php
(rev 0)
+++
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/test/unit/dmAlternativeHelperTest.php
2010-02-12 16:06:46 UTC (rev 27951)
@@ -0,0 +1,159 @@
+<?php
+
+$config = getcwd().'/config/ProjectConfiguration.class.php';
+
+require_once $config;
+require_once(dm::getDir().'/dmCorePlugin/test/unit/helper/dmUnitTestHelper.php');
+
+$helper = new dmUnitTestHelper();
+
+$helper->boot('front');
+
+// load both standard and alternative helpers
+dm::loadHelpers(array('Dm', 'DmAlternative', 'I18N'));
+
+$t = new lime_test(30);
+
+/*
+* $helper is the test helper. It acts as a service container
+* and can provide you all services with its get() method.
+* so here we get the 'helper' service which is the template helper instance
+*/
+$templateHelper = $helper->get('helper');
+
+// £ function
+$t->is(£('div', 'content'), _tag('div', 'content'), '£ == _tag');
+
+// £ method
+$t->is($templateHelper->£('div', 'content'), $templateHelper->tag('div',
'content'), '£ == _tag');
+$t->is(£('div', 'content'), _tag('div', 'content'), '£ == _tag');
+
+// £link method
+$t->is((string)$templateHelper->£link()->text('home'),
(string)$templateHelper->link()->text('home'), '£link == _link');
+$t->is((string)£link()->text('home'), (string)_link()->text('home'), '£link ==
_link');
+
+
+$openDiv = '<div>';
+$t->is(£o('div'), _tagO('div'), $openDiv);
+
+$openDiv = '<div class="test_class">';
+$t->is(£o('div.test_class'), _tagO('div.test_class'), $openDiv);
+
+$openDiv = '<div id="test_id" class="test_class other_class">';
+$t->is(£o('div#test_id.test_class.other_class'),
_tagO('div#test_id.test_class.other_class'), $openDiv);
+
+$openDiv = '<div class="test_class other_class" id="test_id">';
+$t->is(
+ £o('div', array('id' => 'test_id', 'class' => 'test_class other_class')),
+ _tagO('div', array('id' => 'test_id', 'class' => 'test_class other_class')),
+ $openDiv
+);
+
+$div = '<div></div>';
+$t->is(£('div'), _tag('div'), $div);
+
+$div = '<div class="'.htmlentities('{"attr":"value"}').'">div content</div>';
+$t->is(
+ $templateHelper->£('div', array('json' => array('attr' => 'value')), 'div
content'),
+ _tag('div', array('json' => array('attr' => 'value')), 'div content'),
+ $div
+);
+$t->is(
+ £('div', array('json' => array('attr' => 'value')), 'div content'),
+ _tag('div', array('json' => array('attr' => 'value')), 'div content'),
+ $div
+);
+
+$a = '<a href="an_href#with_anchor" id="test_id" class="test_class">a
content</a>';
+$t->is(
+ $templateHelper->£('a#test_id.test_class href="an_href#with_anchor"', 'a
content'),
+ _tag('a#test_id.test_class href="an_href#with_anchor"', 'a content'),
+ $a
+);
+$t->is(
+ £('a#test_id.test_class href="an_href#with_anchor"', 'a content'),
+ _tag('a#test_id.test_class href="an_href#with_anchor"', 'a content'),
+ $a
+);
+
+$closeDiv = '</div>';
+$t->is(£c('div'), _tagC('div'), $closeDiv);
+
+$div = '<div title="title with a # inside" id="test_id" class="test_class
other_class"></div>';
+$t->is(
+ $templateHelper->£('div#test_id.test_class.other_class title="title with a #
inside"'),
+ _tag('div#test_id.test_class.other_class title="title with a # inside"'),
+ $div
+);
+$t->is(
+ £('div#test_id.test_class.other_class title="title with a # inside"'),
+ _tag('div#test_id.test_class.other_class title="title with a # inside"'),
+ $div
+);
+
+$div = '<div title="title with a #inside" id="test_id" class="test_class
other_class"></div>';
+$t->is(
+ $templateHelper->£('div#test_id.test_class.other_class title="title with a
#inside"'),
+ _tag('div#test_id.test_class.other_class title="title with a #inside"'),
+ $div
+);
+$t->is(
+ £('div#test_id.test_class.other_class title="title with a #inside"'),
+ _tag('div#test_id.test_class.other_class title="title with a #inside"'),
+ $div
+);
+
+$div = '<div title="title with a #inside" class="test_class
other_class"></div>';
+$t->is(
+ $templateHelper->£('div.test_class.other_class title="title with a
#inside"'),
+ _tag('div.test_class.other_class title="title with a #inside"'),
+ $div
+);
+$t->is(
+ £('div.test_class.other_class title="title with a #inside"'),
+ _tag('div.test_class.other_class title="title with a #inside"'),
+ $div
+);
+
+$div = '<div title="title with a .inside" class="test_class
other_class"></div>';
+$t->is(
+ $templateHelper->£('div.test_class.other_class title="title with a
.inside"'),
+ _tag('div.test_class.other_class title="title with a .inside"'),
+ $div
+);
+$t->is(
+ £('div.test_class.other_class title="title with a .inside"'),
+ _tag('div.test_class.other_class title="title with a .inside"'),
+ $div
+);
+
+$div = '<div lang="c1"></div>';
+$t->is($templateHelper->£('div lang=c1'), _tag('div lang=c1'), $div);
+$t->is(£('div lang=c1'), _tag('div lang=c1'), $div);
+
+$div = '<div></div>';
+$t->is(£('div lang='.$helper->get('user')->getCulture()), $div, $div);
+
+$table = '<table><thead><tr><th>Header 1</th><th>Header
2</th></tr></thead></table>';
+$t->is(
+ £table()->head('Header 1', 'Header 2')->render(),
+ _table()->head('Header 1', 'Header 2')->render(),
+ $table
+);
+$t->is(
+ $templateHelper->£table()->head('Header 1', 'Header 2')->render(),
+ _table()->head('Header 1', 'Header 2')->render(),
+ $table
+);
+
+$table = '<table><thead><tr><th>Header 1</th><th>Header
2</th></tr></thead><tbody><tr class="even"><td>Value 1</td><td>Value
2</td></tr><tr class="odd"><td>Value 3</td><td>Value
4</td></tr></tbody></table>';
+$t->is(
+ $templateHelper->£table()->head('Header 1', 'Header 2')->body('Value 1',
'Value 2')->body('Value 3', 'Value 4')->render(),
+ _table()->head('Header 1', 'Header 2')->body('Value 1', 'Value
2')->body('Value 3', 'Value 4')->render(),
+ $table
+);
+$t->is(
+ £table()->head('Header 1', 'Header 2')->body('Value 1', 'Value
2')->body('Value 3', 'Value 4')->render(),
+ _table()->head('Header 1', 'Header 2')->body('Value 1', 'Value
2')->body('Value 3', 'Value 4')->render(),
+ $table
+);
\ No newline at end of file
Property changes on:
plugins/diemPlugin/trunk/dmCorePlugin/plugins/dmAlternativeHelperPlugin/test/unit/dmAlternativeHelperTest.php
___________________________________________________________________
Added: svn:executable
+ *
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.