[FEATURE] Make CSS for sysext form configurable
authorLorenz Ulrich <lorenz.ulrich@visol.ch>
Wed, 1 Aug 2012 10:54:31 +0000 (12:54 +0200)
committerSusanne Moog <typo3@susannemoog.de>
Fri, 17 Aug 2012 17:06:51 +0000 (19:06 +0200)
Move the default styles of ext:form to TS in
plugin.tx_form._CSS_DEFAULT_STYLE. This way it can be disabled with
TypoScript either via plugin.tx_form._CSS_DEFAULT_STYLE >, and also
respects the config.removeDefaultCss setting.

Change-Id: Ie2b0c397124f06ec32114983e78dd60b4229ce97
Resolves: #32480
Releases: 6.0
Reviewed-on: http://review.typo3.org/11932
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
typo3/sysext/form/Classes/View/Confirmation/Confirmation.php
typo3/sysext/form/Classes/View/Form/Form.php
typo3/sysext/form/Configuration/TypoScript/setup.txt
typo3/sysext/form/Resources/Public/CSS/Confirmation.css [deleted file]
typo3/sysext/form/Resources/Public/CSS/Form.css [deleted file]

index 373b0f8..69df809 100644 (file)
@@ -92,7 +92,6 @@ class tx_form_View_Confirmation extends tx_form_View_Confirmation_Element_Contai
         * @return string XHTML string containing the whole form
         */
        public function get() {
-               $this->setCss();
                $message = $this->getMessage();
 
                $node = $this->render('element', FALSE);
@@ -165,18 +164,5 @@ class tx_form_View_Confirmation extends tx_form_View_Confirmation_Element_Contai
 
                return $confirmationButtons;
        }
-
-       /**
-        * Add the form CSS file as additional header data
-        *
-        * @return void
-        */
-       protected function setCss() {
-               $GLOBALS['TSFE']->additionalHeaderData['tx_form_css'] =
-                       '<link rel="stylesheet" type="text/css" href="' .
-                       t3lib_extMgm::siteRelPath('form') .
-                       'Resources/Public/CSS/Confirmation.css' .
-                       '" media="all" />';
-       }
 }
 ?>
\ No newline at end of file
index bb86a32..c19f630 100644 (file)
@@ -63,24 +63,10 @@ class tx_form_View_Form extends tx_form_View_Form_Element_Container {
         * @return string XHTML string containing the whole form
         */
        public function get() {
-               $this->setCss();
                $node = $this->render('element', FALSE);
                $content = chr(10) . html_entity_decode($node->saveXML($node->firstChild), ENT_QUOTES, 'UTF-8') . chr(10);
 
                return $content;
        }
-
-       /**
-        * Add the form CSS file as additional header data
-        *
-        * @return void
-        */
-       protected function setCss() {
-               $GLOBALS['TSFE']->additionalHeaderData['tx_form_css'] =
-                       '<link rel="stylesheet" type="text/css" href="' .
-                       t3lib_extMgm::siteRelPath('form') .
-                       'Resources/Public/CSS/Form.css' .
-                       '" media="all" />';
-       }
 }
 ?>
\ No newline at end of file
index 393f171..efaf893 100644 (file)
@@ -53,4 +53,210 @@ tt_content.mailform.20 {
 #              id = mailformsubmit
 #              value = login
 #      }
-#}
\ No newline at end of file
+#}
+
+
+plugin.tx_form._CSS_DEFAULT_STYLE (
+       div.csc-mailform ol,
+       div.csc-mailform ol li {
+               margin: 0;
+               padding: 0;
+       }
+
+       div.csc-mailform ol li {
+               overflow: hidden;
+       }
+
+       div.csc-mailform fieldset {
+               margin: 0;
+               padding: 0;
+               position: relative;
+       }
+
+       div.csc-mailform legend {
+               margin-left: 1em;
+               color: #000000;
+               font-weight: bold;
+       }
+
+       div.csc-mailform fieldset ol {
+               padding: 1em 1em 0 1em;
+       }
+
+       div.csc-mailform fieldset li {
+               padding: 0.5em;
+               margin-bottom: 0.5em;
+               list-style: none;
+       }
+
+       div.csc-mailform fieldset.submit {
+               border-style: none;
+       }
+
+       /**
+        * Normal label
+        * Left aligned, in front of input
+        */
+       div.csc-mailform li label {
+               float: left;
+               width: 13em;
+               margin-right: 1em;
+               vertical-align: baseline;
+       }
+
+       div.csc-mailform li input + label,
+       div.csc-mailform li textarea + label,
+       div.csc-mailform li select + label {
+               float: none;
+               width: auto;
+               margin-right: 0;
+               margin-left: 1em;
+       }
+
+       div.csc-mailform li textarea + label {
+               vertical-align: top;
+       }
+
+       label em,
+       legend em {
+               display: block;
+               color: #060;
+               font-size: 85%;
+               font-style: normal;
+               text-transform: uppercase;
+       }
+
+       legend em {
+               position: absolute;
+       }
+
+       label strong,
+       legend strong {
+               display: block;
+               color: #C00;
+               font-size: 85%;
+               font-weight: normal;
+               text-transform: uppercase;
+       }
+
+       legend strong {
+               position: absolute;
+               top: 1.4em;
+       }
+
+       /**
+        * Labels alignment right
+        */
+       .labels-alignment-right label,
+       .labels-alignment-right .fieldset-subgroup legend,
+       .labels-alignment-right.fieldset-subgroup legend {
+               text-align: right;
+       }
+
+       /**
+        * Horizontal fieldset
+        */
+       fieldset.fieldset-horizontal {
+               border-width: 0;
+       }
+
+       fieldset.fieldset-horizontal ol {
+               padding: 0;
+       }
+
+       fieldset.fieldset-horizontal li {
+               float: left;
+               padding: 0;
+               margin-right: 1em;
+       }
+
+       fieldset.fieldset-horizontal.label-below label {
+               display: block;
+               margin-left: 0;
+               margin-top: 0.2em;
+               font-size: 90%;
+               color: #999999;
+               text-align: left;
+       }
+
+       fieldset.fieldset-horizontal label em {
+               display: inline;
+       }
+
+       /**
+        * Subgroup fieldset
+        */
+       fieldset.fieldset-subgroup {
+               margin-bottom: -2em;
+               border-style: none;
+       }
+
+       fieldset.fieldset-subgroup legend {
+               margin-left: 0;
+               padding: 0;
+               font-weight: normal;
+               width: 13em;
+       }
+
+       fieldset.fieldset-subgroup ol {
+               position: relative;
+               top: -1.4em;
+               margin: 0 0 0 14em;
+               padding: 0;
+       }
+
+       fieldset.fieldset-subgroup li {
+               padding: 0;
+       }
+
+       fieldset.fieldset-subgroup input + label {
+               float: none;
+               width: auto;
+               display: inline;
+               margin: 0 0 0 1em;
+       }
+
+       /**
+        * Labels as block
+        * Labels displayed above or below the input fields
+        */
+       .labels-block label {
+               display: block;
+               float: none;
+               margin: 0 0 0.5em;
+               width: auto;
+       }
+
+       .labels-block input + label,
+       .labels-block textarea + label {
+               margin: 0.5em 0 0;
+       }
+
+       .labels-block fieldset.fieldset-subgroup,
+       fieldset.labels-block.fieldset-subgroup {
+               margin-bottom: 0;
+       }
+
+       .labels-block .fieldset-subgroup legend,
+       .labels-block.fieldset-subgroup legend {
+               width: auto;
+       }
+
+       .labels-block .fieldset-subgroup legend em,
+       .labels-block.fieldset-subgroup legend em {
+               position: relative;
+       }
+
+       .labels-block .fieldset-subgroup legend strong,
+       .labels-block.fieldset-subgroup legend strong {
+               position: relative;
+               top: 0;
+       }
+
+       .labels-block .fieldset-subgroup ol,
+       .labels-block.fieldset-subgroup ol {
+               top: 0;
+               margin: 0;
+               padding: 0.5em 0 0;
+       }
+)
\ No newline at end of file
diff --git a/typo3/sysext/form/Resources/Public/CSS/Confirmation.css b/typo3/sysext/form/Resources/Public/CSS/Confirmation.css
deleted file mode 100644 (file)
index 4bfa208..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-@charset "UTF-8";
-
-div.csc-mailform ol,
-div.csc-mailform ol li {
-       margin: 0;
-       padding: 0;
-}
-
-div.csc-mailform ol li {
-       overflow: hidden;
-}
-
-div.csc-mailform fieldset {
-       margin: 0;
-       padding: 0;
-       position: relative;
-}
-
-div.csc-mailform legend {
-       margin-left: 1em;
-       color: #000000;
-       font-weight: bold;
-}
-
-div.csc-mailform fieldset ol {
-       padding: 1em 1em 0 1em;
-}
-
-div.csc-mailform fieldset li {
-       padding: 0.5em;
-       margin-bottom: 0.5em;
-       list-style: none;
-}
-
-div.csc-mailform fieldset.submit {
-       border-style: none;
-}
-
-/**
- * Normal label
- * Left aligned, in front of input
- */
-div.csc-mailform li label {
-       float: left;
-       width: 13em;
-       margin-right: 1em;
-       vertical-align: baseline;
-}
-
-div.csc-mailform li input + label,
-div.csc-mailform li textarea + label,
-div.csc-mailform li select + label {
-       float: none;
-       width: auto;
-       margin-right: 0;
-       margin-left: 1em;
-}
-
-div.csc-mailform li textarea + label {
-       vertical-align: top;
-}
-
-label em,
-legend em {
-       display: block;
-       color: #060;
-       font-size: 85%;
-       font-style: normal;
-       text-transform: uppercase;
-}
-
-legend em {
-       position: absolute;
-}
-
-label strong,
-legend strong {
-       display: block;
-       color: #C00;
-       font-size: 85%;
-       font-weight: normal;
-       text-transform: uppercase;
-}
-
-legend strong {
-       position: absolute;
-       top: 1.4em;
-}
-
-/**
- * Labels alignment right
- */
-.labels-alignment-right label,
-.labels-alignment-right .fieldset-subgroup legend,
-.labels-alignment-right.fieldset-subgroup legend {
-       text-align: right;
-}
-
-/**
- * Horizontal fieldset
- */
-fieldset.fieldset-horizontal {
-       border-width: 0;
-}
-
-fieldset.fieldset-horizontal ol {
-       padding: 0;
-}
-
-fieldset.fieldset-horizontal li {
-       float: left;
-       padding: 0;
-       margin-right: 1em;
-}
-
-fieldset.fieldset-horizontal.label-below label {
-       display: block;
-       margin-left: 0;
-       margin-top: 0.2em;
-       font-size: 90%;
-       color: #999999;
-       text-align: left;
-}
-
-fieldset.fieldset-horizontal label em {
-       display: inline;
-}
-
-/**
- * Subgroup fieldset
- */
-fieldset.fieldset-subgroup {
-       margin-bottom: -2em;
-       border-style: none;
-}
-
-fieldset.fieldset-subgroup legend {
-       margin-left: 0;
-       padding: 0;
-       font-weight: normal;
-       width: 13em;
-}
-
-fieldset.fieldset-subgroup ol {
-       position: relative;
-       top: -1.4em;
-       margin: 0 0 0 14em;
-       padding: 0;
-}
-
-fieldset.fieldset-subgroup li {
-       padding: 0;
-}
-
-fieldset.fieldset-subgroup input + label {
-       float: none;
-       width: auto;
-       display: inline;
-       margin: 0 0 0 1em;
-}
-
-/**
- * Labels as block
- * Labels displayed above or below the input fields
- */
-.labels-block label {
-       display: block;
-       float: none;
-       margin: 0 0 0.5em;
-       width: auto;
-}
-
-.labels-block input + label,
-.labels-block textarea + label {
-       margin: 0.5em 0 0;
-}
-
-.labels-block fieldset.fieldset-subgroup,
-fieldset.labels-block.fieldset-subgroup {
-       margin-bottom: 0;
-}
-
-.labels-block .fieldset-subgroup legend,
-.labels-block.fieldset-subgroup legend {
-       width: auto;
-}
-
-.labels-block .fieldset-subgroup legend em,
-.labels-block.fieldset-subgroup legend em {
-       position: relative;
-}
-
-.labels-block .fieldset-subgroup legend strong,
-.labels-block.fieldset-subgroup legend strong {
-       position: relative;
-       top: 0;
-}
-
-.labels-block .fieldset-subgroup ol,
-.labels-block.fieldset-subgroup ol {
-       top: 0;
-       margin: 0;
-       padding: 0.5em 0 0;
-}
\ No newline at end of file
diff --git a/typo3/sysext/form/Resources/Public/CSS/Form.css b/typo3/sysext/form/Resources/Public/CSS/Form.css
deleted file mode 100644 (file)
index 4bfa208..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-@charset "UTF-8";
-
-div.csc-mailform ol,
-div.csc-mailform ol li {
-       margin: 0;
-       padding: 0;
-}
-
-div.csc-mailform ol li {
-       overflow: hidden;
-}
-
-div.csc-mailform fieldset {
-       margin: 0;
-       padding: 0;
-       position: relative;
-}
-
-div.csc-mailform legend {
-       margin-left: 1em;
-       color: #000000;
-       font-weight: bold;
-}
-
-div.csc-mailform fieldset ol {
-       padding: 1em 1em 0 1em;
-}
-
-div.csc-mailform fieldset li {
-       padding: 0.5em;
-       margin-bottom: 0.5em;
-       list-style: none;
-}
-
-div.csc-mailform fieldset.submit {
-       border-style: none;
-}
-
-/**
- * Normal label
- * Left aligned, in front of input
- */
-div.csc-mailform li label {
-       float: left;
-       width: 13em;
-       margin-right: 1em;
-       vertical-align: baseline;
-}
-
-div.csc-mailform li input + label,
-div.csc-mailform li textarea + label,
-div.csc-mailform li select + label {
-       float: none;
-       width: auto;
-       margin-right: 0;
-       margin-left: 1em;
-}
-
-div.csc-mailform li textarea + label {
-       vertical-align: top;
-}
-
-label em,
-legend em {
-       display: block;
-       color: #060;
-       font-size: 85%;
-       font-style: normal;
-       text-transform: uppercase;
-}
-
-legend em {
-       position: absolute;
-}
-
-label strong,
-legend strong {
-       display: block;
-       color: #C00;
-       font-size: 85%;
-       font-weight: normal;
-       text-transform: uppercase;
-}
-
-legend strong {
-       position: absolute;
-       top: 1.4em;
-}
-
-/**
- * Labels alignment right
- */
-.labels-alignment-right label,
-.labels-alignment-right .fieldset-subgroup legend,
-.labels-alignment-right.fieldset-subgroup legend {
-       text-align: right;
-}
-
-/**
- * Horizontal fieldset
- */
-fieldset.fieldset-horizontal {
-       border-width: 0;
-}
-
-fieldset.fieldset-horizontal ol {
-       padding: 0;
-}
-
-fieldset.fieldset-horizontal li {
-       float: left;
-       padding: 0;
-       margin-right: 1em;
-}
-
-fieldset.fieldset-horizontal.label-below label {
-       display: block;
-       margin-left: 0;
-       margin-top: 0.2em;
-       font-size: 90%;
-       color: #999999;
-       text-align: left;
-}
-
-fieldset.fieldset-horizontal label em {
-       display: inline;
-}
-
-/**
- * Subgroup fieldset
- */
-fieldset.fieldset-subgroup {
-       margin-bottom: -2em;
-       border-style: none;
-}
-
-fieldset.fieldset-subgroup legend {
-       margin-left: 0;
-       padding: 0;
-       font-weight: normal;
-       width: 13em;
-}
-
-fieldset.fieldset-subgroup ol {
-       position: relative;
-       top: -1.4em;
-       margin: 0 0 0 14em;
-       padding: 0;
-}
-
-fieldset.fieldset-subgroup li {
-       padding: 0;
-}
-
-fieldset.fieldset-subgroup input + label {
-       float: none;
-       width: auto;
-       display: inline;
-       margin: 0 0 0 1em;
-}
-
-/**
- * Labels as block
- * Labels displayed above or below the input fields
- */
-.labels-block label {
-       display: block;
-       float: none;
-       margin: 0 0 0.5em;
-       width: auto;
-}
-
-.labels-block input + label,
-.labels-block textarea + label {
-       margin: 0.5em 0 0;
-}
-
-.labels-block fieldset.fieldset-subgroup,
-fieldset.labels-block.fieldset-subgroup {
-       margin-bottom: 0;
-}
-
-.labels-block .fieldset-subgroup legend,
-.labels-block.fieldset-subgroup legend {
-       width: auto;
-}
-
-.labels-block .fieldset-subgroup legend em,
-.labels-block.fieldset-subgroup legend em {
-       position: relative;
-}
-
-.labels-block .fieldset-subgroup legend strong,
-.labels-block.fieldset-subgroup legend strong {
-       position: relative;
-       top: 0;
-}
-
-.labels-block .fieldset-subgroup ol,
-.labels-block.fieldset-subgroup ol {
-       top: 0;
-       margin: 0;
-       padding: 0.5em 0 0;
-}
\ No newline at end of file