Working Copy
authorwunschtacho <wunschtacho@735d13b6-9817-0410-8766-e36946ffe9aa>
Wed, 17 Oct 2012 11:05:47 +0000 (11:05 +0000)
committerwunschtacho <wunschtacho@735d13b6-9817-0410-8766-e36946ffe9aa>
Wed, 17 Oct 2012 11:05:47 +0000 (11:05 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/powermail_cond/trunk@67182 735d13b6-9817-0410-8766-e36946ffe9aa

.idea/workspace.xml
Classes/Utility/EidGetFieldlist.php
Classes/Utility/EidSaveInSession.php [new file with mode: 0644]
Resources/Public/Js/PowermailCond.js
ext_emconf.php
ext_localconf.php

index 78e4c7b..4c0d653 100644 (file)
@@ -2,10 +2,11 @@
 <project version="4">\r
   <component name="ChangeListManager">\r
     <list default="true" readonly="true" id="500e5988-e13b-4ba1-8a60-e63a97f737a1" name="Default" comment="">\r
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/Classes/Utility/Div.php" />\r
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/Classes/Utility/EidGetFieldlist.php" />\r
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/Classes/Utility/EidSaveInSession.php" />\r
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />\r
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/Classes/Utility/EidGetFieldlist.php" afterPath="$PROJECT_DIR$/Classes/Utility/EidGetFieldlist.php" />\r
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/Resources/Public/Js/PowermailCond.js" afterPath="$PROJECT_DIR$/Resources/Public/Js/PowermailCond.js" />\r
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/ext_emconf.php" afterPath="$PROJECT_DIR$/ext_emconf.php" />\r
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/ext_localconf.php" afterPath="$PROJECT_DIR$/ext_localconf.php" />\r
     </list>\r
     <ignored path="powermail_cond@powermailt347.in2code.de.iws" />\r
   </component>\r
   <component name="FileEditorManager">\r
     <leaf>\r
-      <file leaf-file-name="EidGetFieldlist.php" pinned="false" current="true" current-in-tab="true">\r
-        <entry file="file://$PROJECT_DIR$/Classes/Utility/EidGetFieldlist.php">\r
-          <provider selected="true" editor-type-id="text-editor">\r
-            <state line="78" column="0" selection-start="2731" selection-end="2731" vertical-scroll-proportion="0.2836485">\r
-              <folding>\r
-                <element signature="e#6#984#0" expanded="true" />\r
-              </folding>\r
-            </state>\r
-          </provider>\r
-        </entry>\r
-      </file>\r
-      <file leaf-file-name="Div.php" pinned="false" current="false" current-in-tab="false">\r
-        <entry file="file://$PROJECT_DIR$/Classes/Utility/Div.php">\r
-          <provider selected="true" editor-type-id="text-editor">\r
-            <state line="32" column="34" selection-start="1188" selection-end="1216" vertical-scroll-proportion="-13.076923">\r
-              <folding>\r
-                <element signature="e#6#984#0" expanded="true" />\r
-              </folding>\r
-            </state>\r
-          </provider>\r
-        </entry>\r
-      </file>\r
-      <file leaf-file-name="class.tx_powermailcond_div.php" pinned="false" current="false" current-in-tab="false">\r
-        <entry file="file://$PROJECT_DIR$/oldLib/class.tx_powermailcond_div.php">\r
+      <file leaf-file-name="PowermailCond.js" pinned="false" current="false" current-in-tab="false">\r
+        <entry file="file://$PROJECT_DIR$/Resources/Public/Js/PowermailCond.js">\r
           <provider selected="true" editor-type-id="text-editor">\r
-            <state line="106" column="5" selection-start="1219" selection-end="3352" vertical-scroll-proportion="-26.576923">\r
+            <state line="16" column="0" selection-start="968" selection-end="968" vertical-scroll-proportion="0.0">\r
               <folding />\r
             </state>\r
           </provider>\r
         </entry>\r
       </file>\r
-      <file leaf-file-name="ext_tables.sql" pinned="false" current="false" current-in-tab="false">\r
-        <entry file="file://$PROJECT_DIR$/ext_tables.sql">\r
+      <file leaf-file-name="ext_localconf.php" pinned="false" current="false" current-in-tab="false">\r
+        <entry file="file://$PROJECT_DIR$/ext_localconf.php">\r
           <provider selected="true" editor-type-id="text-editor">\r
-            <state line="33" column="63" selection-start="957" selection-end="991" vertical-scroll-proportion="0.0">\r
+            <state line="15" column="77" selection-start="368" selection-end="395" vertical-scroll-proportion="-9.807693">\r
               <folding />\r
             </state>\r
           </provider>\r
         </entry>\r
       </file>\r
-      <file leaf-file-name="ext_localconf.php" pinned="false" current="false" current-in-tab="false">\r
-        <entry file="file://$PROJECT_DIR$/ext_localconf.php">\r
+      <file leaf-file-name="EidSaveInSession.php" pinned="false" current="true" current-in-tab="true">\r
+        <entry file="file://$PROJECT_DIR$/Classes/Utility/EidSaveInSession.php">\r
           <provider selected="true" editor-type-id="text-editor">\r
-            <state line="18" column="134" selection-start="689" selection-end="689" vertical-scroll-proportion="-11.769231">\r
-              <folding />\r
+            <state line="72" column="40" selection-start="2199" selection-end="2199" vertical-scroll-proportion="0.33333334">\r
+              <folding>\r
+                <element signature="e#1285#1516#0" expanded="false" />\r
+              </folding>\r
             </state>\r
           </provider>\r
         </entry>\r
       </file>\r
-      <file leaf-file-name="PowermailCond.js" pinned="false" current="false" current-in-tab="false">\r
-        <entry file="file://$PROJECT_DIR$/Resources/Public/Js/PowermailCond.js">\r
+      <file leaf-file-name="EidGetFieldlist.php" pinned="false" current="false" current-in-tab="false">\r
+        <entry file="file://$PROJECT_DIR$/Classes/Utility/EidGetFieldlist.php">\r
           <provider selected="true" editor-type-id="text-editor">\r
-            <state line="22" column="96" selection-start="694" selection-end="694" vertical-scroll-proportion="0.0">\r
-              <folding />\r
+            <state line="39" column="46" selection-start="1616" selection-end="1656" vertical-scroll-proportion="-25.5">\r
+              <folding>\r
+                <element signature="e#6#984#0" expanded="true" />\r
+              </folding>\r
             </state>\r
           </provider>\r
         </entry>\r
@@ -96,8 +79,6 @@
   <component name="IdeDocumentHistory">\r
     <option name="changedFiles">\r
       <list>\r
-        <option value="$PROJECT_DIR$/Configuration/TCA/Rules.php" />\r
-        <option value="$PROJECT_DIR$/Configuration/TCA/Conditions.php" />\r
         <option value="$PROJECT_DIR$/ext_tables.sql" />\r
         <option value="$PROJECT_DIR$/Configuration/TCA/Condition.php" />\r
         <option value="$PROJECT_DIR$/Resources/Private/Language/locallang_db.xml" />\r
         <option value="$PROJECT_DIR$/oldFiles/static/setup.txt" />\r
         <option value="$PROJECT_DIR$/ext_tables.php" />\r
         <option value="$PROJECT_DIR$/Configuration/TypoScript/setup.txt" />\r
-        <option value="$PROJECT_DIR$/ext_localconf.php" />\r
-        <option value="$PROJECT_DIR$/Resources/Public/Js/PowermailCond.js" />\r
         <option value="$PROJECT_DIR$/Classes/Utility/Div.php" />\r
         <option value="$PROJECT_DIR$/Classes/Utility/EidGetFieldlist.php" />\r
+        <option value="$PROJECT_DIR$/ext_emconf.php" />\r
+        <option value="$PROJECT_DIR$/Resources/Public/Js/PowermailCond.js" />\r
+        <option value="$PROJECT_DIR$/ext_localconf.php" />\r
+        <option value="$PROJECT_DIR$/Classes/Utility/EidSaveInSession.php" />\r
       </list>\r
     </option>\r
   </component>\r
               <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />\r
             </PATH_ELEMENT>\r
             <PATH_ELEMENT>\r
-              <option name="myItemId" value="oldFiles" />\r
-              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />\r
-            </PATH_ELEMENT>\r
-            <PATH_ELEMENT>\r
-              <option name="myItemId" value="static" />\r
-              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />\r
-            </PATH_ELEMENT>\r
-          </PATH>\r
-          <PATH>\r
-            <PATH_ELEMENT>\r
-              <option name="myItemId" value="powermail_cond@powermailt347.in2code.de" />\r
-              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />\r
-            </PATH_ELEMENT>\r
-            <PATH_ELEMENT>\r
-              <option name="myItemId" value="powermail_cond@powermailt347.in2code.de" />\r
-              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />\r
-            </PATH_ELEMENT>\r
-            <PATH_ELEMENT>\r
-              <option name="myItemId" value="oldFiles" />\r
-              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />\r
-            </PATH_ELEMENT>\r
-            <PATH_ELEMENT>\r
-              <option name="myItemId" value="js" />\r
-              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />\r
-            </PATH_ELEMENT>\r
-          </PATH>\r
-          <PATH>\r
-            <PATH_ELEMENT>\r
-              <option name="myItemId" value="powermail_cond@powermailt347.in2code.de" />\r
-              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />\r
-            </PATH_ELEMENT>\r
-            <PATH_ELEMENT>\r
-              <option name="myItemId" value="powermail_cond@powermailt347.in2code.de" />\r
-              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />\r
-            </PATH_ELEMENT>\r
-            <PATH_ELEMENT>\r
               <option name="myItemId" value="Configuration" />\r
               <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />\r
             </PATH_ELEMENT>\r
     <property name="options.splitter.main.proportions" value="0.3" />\r
     <property name="WebServerToolWindowFactoryState" value="true" />\r
     <property name="options.lastSelected" value="reference.settings.deploy.options" />\r
-    <property name="options.splitter.details.proportions" value="0.2" />\r
     <property name="options.searchVisible" value="true" />\r
+    <property name="options.splitter.details.proportions" value="0.2" />\r
   </component>\r
   <component name="PublishConfig" serverName="in2code" serverId="3ca6b370-8a73-4525-bbbd-e6d3cdda1d7f" autoUpload="true" autoUploadExternalChanges="true">\r
     <servers>\r
       <created>1350404233102</created>\r
       <updated>1350404233102</updated>\r
     </task>\r
-    <option name="localTasksCounter" value="5" />\r
+    <task id="LOCAL-00005" summary="Working Copy">\r
+      <created>1350460050102</created>\r
+      <updated>1350460050102</updated>\r
+    </task>\r
+    <option name="localTasksCounter" value="6" />\r
     <servers />\r
   </component>\r
   <component name="ToolWindowManager">\r
       <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />\r
       <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />\r
       <window_info id="Remote Host" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />\r
-      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.1755603" sideWeight="0.67082036" order="0" side_tool="false" content_ui="combo" />\r
+      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.14727855" sideWeight="0.67082036" order="0" side_tool="false" content_ui="combo" />\r
       <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />\r
       <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />\r
       <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />\r
     <breakpoint-manager />\r
   </component>\r
   <component name="editorHistoryManager">\r
-    <entry file="file://D:/SVN/powermail@forge/ext_tables.sql">\r
-      <provider selected="true" editor-type-id="text-editor">\r
-        <state line="3" column="44" selection-start="79" selection-end="110" vertical-scroll-proportion="-0.054371003" />\r
-      </provider>\r
-    </entry>\r
-    <entry file="file://$PROJECT_DIR$/Configuration/TCA/Rule.php">\r
+    <entry file="file://$PROJECT_DIR$/oldFiles/static/setup.txt">\r
       <provider selected="true" editor-type-id="text-editor">\r
-        <state line="43" column="35" selection-start="1404" selection-end="1422" vertical-scroll-proportion="0.5294772" />\r
+        <state line="4" column="39" selection-start="0" selection-end="300" vertical-scroll-proportion="0.089709766" />\r
       </provider>\r
     </entry>\r
-    <entry file="file://$PROJECT_DIR$/oldLib/class.tx_powermailcond_pidContainer.php">\r
+    <entry file="file://$PROJECT_DIR$/ext_tables.php">\r
       <provider selected="true" editor-type-id="text-editor">\r
-        <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />\r
+        <state line="11" column="63" selection-start="318" selection-end="318" vertical-scroll-proportion="0.26008344" />\r
       </provider>\r
     </entry>\r
-    <entry file="file://$PROJECT_DIR$/Configuration/TypoScript/setup.txt">\r
+    <entry file="file://$PROJECT_DIR$/Classes/Utility/FieldlistingBackend.php">\r
       <provider selected="true" editor-type-id="text-editor">\r
-        <state line="6" column="93" selection-start="300" selection-end="300" vertical-scroll-proportion="0.13456464" />\r
+        <state line="32" column="50" selection-start="1196" selection-end="1240" vertical-scroll-proportion="0.114035085" />\r
       </provider>\r
     </entry>\r
-    <entry file="file://$PROJECT_DIR$/oldFiles/static/setup.txt">\r
+    <entry file="file://$PROJECT_DIR$/oldLib/class.tx_powermailcond_ajaxFieldList_eid.php">\r
       <provider selected="true" editor-type-id="text-editor">\r
-        <state line="4" column="39" selection-start="0" selection-end="300" vertical-scroll-proportion="0.089709766" />\r
+        <state line="0" column="0" selection-start="0" selection-end="12383" vertical-scroll-proportion="-0.0" />\r
       </provider>\r
     </entry>\r
-    <entry file="file://$PROJECT_DIR$/ext_tables.php">\r
+    <entry file="file://$PROJECT_DIR$/ext_tables.sql">\r
       <provider selected="true" editor-type-id="text-editor">\r
-        <state line="11" column="63" selection-start="318" selection-end="318" vertical-scroll-proportion="0.26008344" />\r
+        <state line="33" column="63" selection-start="957" selection-end="991" vertical-scroll-proportion="0.0" />\r
       </provider>\r
     </entry>\r
-    <entry file="file://$PROJECT_DIR$/oldFiles/js/powermail_cond.js">\r
+    <entry file="file://D:/SVN/powermail@forge/Classes/Utility/Div.php">\r
       <provider selected="true" editor-type-id="text-editor">\r
-        <state line="54" column="27" selection-start="2261" selection-end="2261" vertical-scroll-proportion="-0.108742006" />\r
+        <state line="0" column="0" selection-start="0" selection-end="30724" vertical-scroll-proportion="0.0" />\r
       </provider>\r
     </entry>\r
-    <entry file="file://$PROJECT_DIR$/Classes/Utility/FieldlistingBackend.php">\r
+    <entry file="file://$PROJECT_DIR$/Classes/Utility/Div.php">\r
       <provider selected="true" editor-type-id="text-editor">\r
-        <state line="32" column="50" selection-start="1196" selection-end="1240" vertical-scroll-proportion="0.114035085">\r
-          <folding />\r
+        <state line="32" column="34" selection-start="1188" selection-end="1216" vertical-scroll-proportion="0.37280703">\r
+          <folding>\r
+            <element signature="e#6#984#0" expanded="true" />\r
+          </folding>\r
         </state>\r
       </provider>\r
     </entry>\r
-    <entry file="file://$PROJECT_DIR$/oldLib/class.tx_powermailcond_ajaxFieldList_eid.php">\r
+    <entry file="file://$PROJECT_DIR$/oldLib/class.tx_powermailcond_div.php">\r
       <provider selected="true" editor-type-id="text-editor">\r
-        <state line="0" column="0" selection-start="0" selection-end="12383" vertical-scroll-proportion="-0.0">\r
-          <folding />\r
-        </state>\r
+        <state line="106" column="5" selection-start="1219" selection-end="3352" vertical-scroll-proportion="0.7576754" />\r
       </provider>\r
     </entry>\r
-    <entry file="file://$PROJECT_DIR$/ext_localconf.php">\r
+    <entry file="file://D:/SVN/powermail@forge/ext_tables.sql">\r
       <provider selected="true" editor-type-id="text-editor">\r
-        <state line="18" column="134" selection-start="689" selection-end="689" vertical-scroll-proportion="-11.769231">\r
-          <folding />\r
-        </state>\r
+        <state line="44" column="44" selection-start="1420" selection-end="1451" vertical-scroll-proportion="0.090618335" />\r
       </provider>\r
     </entry>\r
-    <entry file="file://$PROJECT_DIR$/Resources/Public/Js/PowermailCond.js">\r
+    <entry file="file://$PROJECT_DIR$/ext_emconf.php">\r
       <provider selected="true" editor-type-id="text-editor">\r
-        <state line="22" column="96" selection-start="694" selection-end="694" vertical-scroll-proportion="0.0">\r
+        <state line="36" column="33" selection-start="1146" selection-end="1146" vertical-scroll-proportion="0.5294772">\r
           <folding />\r
         </state>\r
       </provider>\r
     </entry>\r
-    <entry file="file://$PROJECT_DIR$/ext_tables.sql">\r
+    <entry file="file://$PROJECT_DIR$/oldFiles/js/powermail_cond.js">\r
       <provider selected="true" editor-type-id="text-editor">\r
-        <state line="33" column="63" selection-start="957" selection-end="991" vertical-scroll-proportion="0.0">\r
+        <state line="19" column="16" selection-start="1027" selection-end="1031" vertical-scroll-proportion="0.35377875">\r
           <folding />\r
         </state>\r
       </provider>\r
     </entry>\r
-    <entry file="file://D:/SVN/powermail@forge/Classes/Utility/Div.php">\r
+    <entry file="file://$PROJECT_DIR$/oldLib/class.tx_powermailcond_ajaxWriteInSession_eid.php">\r
       <provider selected="true" editor-type-id="text-editor">\r
-        <state line="0" column="0" selection-start="0" selection-end="30724" vertical-scroll-proportion="0.0">\r
+        <state line="0" column="0" selection-start="0" selection-end="5031" vertical-scroll-proportion="0.0">\r
           <folding />\r
         </state>\r
       </provider>\r
     </entry>\r
-    <entry file="file://$PROJECT_DIR$/oldLib/class.tx_powermailcond_div.php">\r
+    <entry file="file://$PROJECT_DIR$/Resources/Public/Js/PowermailCond.js">\r
       <provider selected="true" editor-type-id="text-editor">\r
-        <state line="106" column="5" selection-start="1219" selection-end="3352" vertical-scroll-proportion="-26.576923">\r
+        <state line="16" column="0" selection-start="968" selection-end="968" vertical-scroll-proportion="0.0">\r
           <folding />\r
         </state>\r
       </provider>\r
     </entry>\r
-    <entry file="file://$PROJECT_DIR$/Classes/Utility/Div.php">\r
+    <entry file="file://$PROJECT_DIR$/Classes/Utility/EidGetFieldlist.php">\r
       <provider selected="true" editor-type-id="text-editor">\r
-        <state line="32" column="34" selection-start="1188" selection-end="1216" vertical-scroll-proportion="-13.076923">\r
+        <state line="39" column="46" selection-start="1616" selection-end="1656" vertical-scroll-proportion="-25.5">\r
           <folding>\r
             <element signature="e#6#984#0" expanded="true" />\r
           </folding>\r
         </state>\r
       </provider>\r
     </entry>\r
-    <entry file="file://$PROJECT_DIR$/Classes/Utility/EidGetFieldlist.php">\r
+    <entry file="file://$PROJECT_DIR$/ext_localconf.php">\r
       <provider selected="true" editor-type-id="text-editor">\r
-        <state line="78" column="0" selection-start="2731" selection-end="2731" vertical-scroll-proportion="0.2836485">\r
+        <state line="15" column="77" selection-start="368" selection-end="395" vertical-scroll-proportion="-9.807693">\r
+          <folding />\r
+        </state>\r
+      </provider>\r
+    </entry>\r
+    <entry file="file://$PROJECT_DIR$/Classes/Utility/EidSaveInSession.php">\r
+      <provider selected="true" editor-type-id="text-editor">\r
+        <state line="72" column="40" selection-start="2199" selection-end="2199" vertical-scroll-proportion="0.33333334">\r
           <folding>\r
-            <element signature="e#6#984#0" expanded="true" />\r
+            <element signature="e#1285#1516#0" expanded="false" />\r
           </folding>\r
         </state>\r
       </provider>\r
index 927803d..f1e64b3 100644 (file)
@@ -296,9 +296,9 @@ class Tx_PowermailCond_Utility_EidGetFieldlist extends tslib_pibase {
                }
 
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery (
-                       'tx_powermail_fields.uid',
-                       'tx_powermail_fieldsets LEFT JOIN tx_powermail_fields ON tx_powermail_fieldsets.uid = tx_powermail_fields.fieldset',
-                       $where = 'tx_powermail_fieldsets.uid = ' . intval(str_replace('fieldset:', '', $uid)),
+                       'tx_powermail_domain_model_fields.uid',
+                       'tx_powermail_domain_model_pages LEFT JOIN tx_powermail_domain_model_fields ON tx_powermail_domain_model_pages.uid = tx_powermail_domain_model_fields.pages',
+                       $where = 'tx_powermail_domain_model_pages.uid = ' . intval(str_replace('fieldset:', '', $uid)),
                        $groupBy = '',
                        $orderBy = '',
                        $limit = '1000'
diff --git a/Classes/Utility/EidSaveInSession.php b/Classes/Utility/EidSaveInSession.php
new file mode 100644 (file)
index 0000000..45ff6f9
--- /dev/null
@@ -0,0 +1,150 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010 Alexander Kellner <alexander.kellner@in2code.de>, in2code.
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+require_once(PATH_t3lib . 'class.t3lib_befunc.php');
+require_once(PATH_t3lib . 'stddb/tables.php');
+require_once(t3lib_extMgm::extPath('cms', 'ext_tables.php'));
+require_once(PATH_tslib . 'class.tslib_pibase.php');
+require_once(t3lib_extMgm::extPath('powermail_cond') . 'Classes/Utility/Div.php');
+
+/**
+ * This class is for storing values to the session on every fieldchange (via AJAX)
+ *
+ * @author     Alex Kellner <alexander.kellner@in2code.de>, in2code.
+ * @package    TYPO3
+ * @subpackage tx_powermailcond_ajaxWriteInSession_eid
+ */
+class Tx_PowermailCond_Utility_EidSaveInSession extends tslib_pibase {
+
+       /**
+        * The extension key
+        *
+        * @var string
+        */
+       public $extKey = 'powermail_cond'; // Extension key
+
+       /**
+        * Prefix Id
+        *
+        * @var string
+        */
+       public $prefixId = 'tx_powermailcond_pi1';
+
+       /**
+        * Debug mode
+        *
+        * @var bool
+        */
+       private $debug = false;
+
+       /**
+        * Write values to session - main method called via AJAX
+        *
+        * @return      void
+        */
+       public function main() {
+               return 'lalelu';
+               /*
+               // config
+               $this->getCObj(); // enable TSFE globals
+               $GLOBALS['TSFE']->sesData = tslib_eidtools::initFeUser();
+               $piVars = t3lib_div::_GP($this->prefixId); // GET param
+               $uids = t3lib_div::trimExplode('_', $piVars['uid']);
+               $uid = intval($uids[0]); // uid of current field
+               $value = htmlspecialchars($piVars['value']); // value from current field
+               $this->div = t3lib_div::makeInstance('tx_powermailcond_div'); // Create new instance for div class
+               $ttcontent_uid = $this->div->getTtcontentUid($uid); // get tt_content uid to current field
+
+               // start
+               if ($uid == 0) {
+                       return false;
+               }
+               if (isset($uids[1])) { // second level
+                       $oldSession = array();
+                       $arr['uid' . $uid] = $GLOBALS['TSFE']->fe_user->sesData['powermail_' . $ttcontent_uid]['uid' . $uid];
+                       $arr['uid' . $uid][$uids[1]] = $value;
+                       $this->div->saveInSession($arr, 'powermail_' . $ttcontent_uid); // save values to session
+               } else { // first level
+                       $arr = array(
+                               'uid' . $uid => $value
+                       );
+                       $this->div->saveInSession($arr, 'powermail_' . $ttcontent_uid); // save values to session
+               }
+
+               if ($this->debug) {
+                       t3lib_div::debug($arr, 'powermail_' . $ttcontent_uid);
+               }
+               */
+       }
+
+       /**
+        * Get tt_content UID from field UID
+        *
+        * @param       integer $fuid: UID of tx_powermail_fields
+        * @return      integer $uid: tt_content UID
+        */
+       private function getTtcontentUid($fuid) {
+               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery ( // DB query
+                       'tt_content.uid',
+                       'tx_powermail_fieldsets LEFT JOIN tx_powermail_fields ON tx_powermail_fieldsets.uid = tx_powermail_fields.fieldset LEFT JOIN tt_content ON tx_powermail_fieldsets.tt_content = tt_content.uid',
+                       'tx_powermail_fields.uid = ' . intval($fuid),
+                       '',
+                       '',
+                       1
+               );
+               if (!$res) { // If there is a result
+                       return false;
+               }
+
+               $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
+               return $row['uid'];
+       }
+
+       /**
+        * Initialize cObj and TSFE Globals
+        *
+        * @return      object  cObj
+        */
+       private function getCObj() {
+               $this->div = t3lib_div::makeInstance('tx_powermailcond_div'); // Create new instance for div class
+               $userObj = tslib_eidtools::initFeUser();
+               $temp_TSFEclassName = t3lib_div::makeInstance('tslib_fe');
+               $GLOBALS['TSFE'] = new $temp_TSFEclassName($TYPO3_CONF_VARS, 32, 0, true);
+               $GLOBALS['TSFE']->connectToDB();
+               $GLOBALS['TSFE']->fe_user = $userObj;
+               $GLOBALS['TSFE']->id = t3lib_div::_GET('id');
+               $GLOBALS['TSFE']->determineId();
+               $GLOBALS['TSFE']->getCompressedTCarray();
+               $GLOBALS['TSFE']->initTemplate();
+               $GLOBALS['TSFE']->getConfigArray();
+               $GLOBALS['TSFE']->includeTCA();
+
+               return t3lib_div::makeInstance('tslib_cObj');
+       }
+
+}
+
+$SOBE = t3lib_div::makeInstance('Tx_PowermailCond_Utility_EidSaveInSession'); // make instance
+echo $SOBE->main(); // print content
+?>
\ No newline at end of file
index 8208313..9b4dd2b 100644 (file)
@@ -3,6 +3,35 @@ jQuery(document).ready(function() {
        if ($('form.powermail_form').length > 0) { // only if the powermail form is on the page (not for confirmation page)
                checkConditions(0); // check if something should be changed
        }
+
+       // save values via ajax to session
+       $('.powermail_input, .powermail_textarea, .powermail_select, .powermail_radio, .powermail_checkbox').change(function() {
+               $this = $(this); // caching
+               var pid = 5; // TODO
+               var url = base + '/index.php';
+               var timestamp = Number(new Date()); // timestamp is needed for a internet explorer workarround (always change a parameter)
+               var value = $this.val(); // current value
+               var uid = $this.closest('.powermail_fieldwrap').attr('id').substr(20); // current field uid (without "uid")
+               var name = $this.attr('name');
+               var params = 'eID=' + 'powermailcond_saveToSession' + '&id=' + pid + '&tx_powermailcond_pi1[uid]=' + uid + '&tx_powermailcond_pi1[value]=' + value + '&ts=' + timestamp;
+
+               /*
+
+               $.ajax({
+                       type: 'GET', // type
+                       url: url, // send to this url
+                       data: params, // add params
+                       cache: false, // disable cache (for ie)
+                       success: function(data) { // return values
+                               if (data != '') { // if there is a response
+                                       //alert(data); // alert the response
+                                       $('form.tx_powermail_pi1_form').append('Error in powermail_cond.js in change function:' + data);
+                               }
+                               checkConditions(uid); // check if something should be changed
+                       }
+               });
+               */
+       });
 });
 
 /**
@@ -29,19 +58,17 @@ function checkConditions(uid) {
                        document.body.style.cursor = 'auto'; // normal cursor
                },
                success: function(data) { // return values
-                       $('form.powermail_form').append(data);
-//                     if (data != 'nochange') {
-//                             $('.powermail_select option').show(); // show all options at the beginning
-//                             $('.powermail_select option').removeAttr('disabled'); // enable all options at the beginning
-//                             if (data != '') { // if there is a response
-//                                     if (data.length < 500) { // stop if wrong result (maybe complete t3 page)
-//                                             doAction(data); // hide all given fields
-//                                     }
-//                             } else { // if there is no response
-//                                     $('.tx_powermail_pi1_fieldwrap_html').show(); // show all fields
-//                                     $('.tx-powermail-pi1_fieldset').show(); // show all fieldsets at the beginning
-//                             }
-//                     }
+                       if (data != 'nochange') {
+                               $('.powermail_fieldwrap select option').show(); // show all options at the beginning
+                               $('.powermail_fieldwrap select option').removeAttr('disabled'); // enable all options at the beginning
+                               if (data != '') { // if there is a response
+                                       if (data.length < 1000) { // stop if wrong result (maybe complete t3 page)
+                                               doAction(data); // hide all given fields
+                                       }
+                               } else { // if there is no response
+                                       showAll(); // show all fields and fieldsets at the beginning
+                               }
+                       }
                },
                error: function() {
                        $('form.powermail_form').append('Error in PowermailCond.js in checkCondtions function by opening the given url');
@@ -50,6 +77,103 @@ function checkConditions(uid) {
 }
 
 /**
+ * Do some actions (hide and/or filter)
+ *
+ * @param string       list: commaseparated list with uids (1,2,3)
+ * @return void
+ */
+function doAction(list) {
+       showAll(); // show all fields and fieldsets at the beginning
+
+       var uid = list.split(',');
+       if (uid.length < 1) {
+               return false; // stop process
+       }
+       for (var i=0; i < uid.length; i++) { // one loop for every affected field
+               if (uid[i].indexOf('fieldset:') != '-1') { // fieldset part
+                       hideFieldset(uid[i]);
+               } else if (uid[i].indexOf('filter:') != '-1') { // filter part
+                       filterSelection(uid[i]);
+               } else { // fields part
+                       hideField(uid[i]);
+               }
+       }
+}
+
+/**
+ * Hide a field and clear its value
+ *
+ * @param      integer uid: uid of the element
+ * @return     void
+ */
+function hideField(uid) {
+       $('.powermail_fieldwrap_' + uid).hide(); // hide current field
+       if ($('.powermail_fieldwrap_' + uid + ' .powermail_field').val() != '') { // only if value is not yet empty
+               clearValue('.powermail_fieldwrap_' + uid + ' .powermail_field'); // clear value of current field
+               clearSession(uid); // clear value of current field
+       }
+}
+
+/**
+ * Hide some fields, which are bundled in a fieldset and clear there value
+ *
+ * @param      string  string: mix of uid and values (fieldset:5:12;13;14)
+ * @return     void
+ */
+function hideFieldset(string) {
+       var params = string.split(':'); // filter / uid / values
+       var values = params[2].split(';'); // value1 / value2 / value3
+       $('powermail_fieldset_' + params[1]).hide(); // hide current fieldset
+       for (var k=0; k < values.length; k++) { // one loop for every field inside the fieldset
+               clearValue('.powermail_fieldwrap_' + values[k] + ' .powermail_field'); // clear value of current field
+       }
+}
+
+/**
+ * Hide some fields and clear there value
+ *
+ * @param      string  string: mix of uid and values (filter:123:Value1;Value2;Value3)
+ * @return     void
+ */
+function filterSelection(string) {
+       var params = string.split(':'); // filter / uid / values
+       var values = params[2].split(';'); // value1 / value2 / value3
+       $('.powermail_fieldwrap_' + params[1] + ' .powermail_field > option').hide().attr('disabled', 'disabled'); // disable all options
+
+       for (var j=0; j < values.length; j++) { // one loop for every option in select field
+               $('.powermail_fieldwrap_' + params[1] + ' .powermail_field > option:contains(' + values[j] + ')').show().removeAttr('disabled'); // show this option
+       }
+
+       var valueSelected = $('.powermail_fieldwrap_' + params[1] + ' .powermail_field > option:selected').val(); // give me the value of the selected option
+       if (params[2].indexOf(valueSelected) == '-1') { // if current selected value is one of the not allowed options
+               $('.powermail_fieldwrap_' + params[1] + ' .powermail_field').get(0).selectedIndex = 0; // remove selection (because the selected option is not allowed)
+       }
+}
+
+/**
+ * Show all fields and fieldsets
+ *
+ * @return void
+ */
+function showAll() {
+       $('.powermail_fieldwrap, .powermail_fieldset').show(); // show all fields and fieldsets
+}
+
+/**
+ * Clear value of an inputfield, set selectedIndex to 0 for selection and so on
+ *
+ * @param      string  selection: selection for jQuery (e.g. input.powermail)
+ * @return     void
+ */
+function clearValue(selection) {
+       if ($(selection).attr('type') == 'radio' || $(selection).attr('type') == 'checkbox') {
+               $(selection).attr('checked', false);
+       } else {
+               $(selection).val('');
+       }
+}
+
+/**
  * Read BaseUrl
  *
  * @return string      BaseUrl from Tag in DOM
@@ -60,4 +184,32 @@ function getBaseUrl() {
                base = '';
        }
        return base;
-}
\ No newline at end of file
+}
+
+/**
+ * Clear session of a uid
+ * TODO
+ *
+ * @param      integer uid: uid of the element
+ * @return     void
+ */
+function clearSession(uid) {
+       var pid = 5;
+       var url = base + '/index.php';
+       var timestamp = Number(new Date()); // timestamp is needed for a internet explorer workarround (always change a parameter)
+       var params = 'eID=' + 'powermailcond_saveToSession' + '&id=' + pid + '&tx_powermailcond_pi1[uid]=' + uid + '&tx_powermailcond_pi1[value]=&ts=' + timestamp;
+
+       $.ajax({
+               type: 'GET', // type
+               url: url, // send to this url
+               data: params, // add params
+               cache: false, // disable cache (for ie)
+               success: function(data) { // return values
+                       if (data != '') { // if there is a response
+                               //alert(data); // alert the response
+                               $('form.tx_powermail_pi1_form').append('Error in powermail_cond.js in clearSession function:' + data);
+                       }
+                       checkConditions(uid); // check if something should be changed
+               }
+       });
+};
\ No newline at end of file
index 58ff52c..f2da344 100644 (file)
@@ -34,7 +34,7 @@ $EM_CONF[$_EXTKEY] = array(
        'CGLcompliance_note' => '',
        'constraints' => array(
                'depends' => array(
-                       'powermail' => '1.5.0-0.0.0',
+                       'powermail' => '2.0.3-0.0.0',
                ),
                'conflicts' => array(
                ),
index 960f94a..142908c 100644 (file)
@@ -13,12 +13,9 @@ $TYPO3_CONF_VARS['EXTCONF']['cms']['db_layout']['addTables']['tx_powermailcond_c
 ##### EID Services #####
 
 // EID for storing values in the session (via AJAX)
-//$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['powermailcond_saveToSession'] = 'EXT:powermail_cond/lib/class.tx_powermailcond_ajaxWriteInSession_eid.php';
+$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['powermailcond_saveToSession'] = 'EXT:powermail_cond/Classes/Utility/EidSaveInSession.php';
 
 // EID for telling jQuery which values are allowed and which not (via AJAX)
 $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['powermailcond_getFieldStatus'] = 'EXT:powermail_cond/Classes/Utility/EidGetFieldlist.php';
 
-// Hook to add a pid container
-//$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_FormWrapMarkerHook'][] = 'EXT:powermail_cond/lib/class.tx_powermailcond_pidContainer.php:tx_powermailcond_pidContainer';
-
 ?>
\ No newline at end of file