Follow-up to 15691: Javascript Error in taskcenter
authorSteffen Kamper <info@sk-typo3.de>
Thu, 23 Sep 2010 21:15:22 +0000 (21:15 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Thu, 23 Sep 2010 21:15:22 +0000 (21:15 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/branches/TYPO3_4-4@8865 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/taskcenter/res/tasklist.js [new file with mode: 0644]
typo3/sysext/taskcenter/task/index.php

index 8b26919..6292b1f 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-09-23  Steffen Kamper  <steffen@typo3.org>
+
+       * Follow-up to 15691: Javascript Error in taskcenter
+
 2010-09-22  Ernesto Baschny <ernst@cron-it.de>
 
        * Fixed bug #15685: Enhancement of t3lib_div::testInt (#15020) introduced a different behaviour. This restores original behaviour. (Thanks to Helmut Hummel)
diff --git a/typo3/sysext/taskcenter/res/tasklist.js b/typo3/sysext/taskcenter/res/tasklist.js
new file mode 100644 (file)
index 0000000..60a9d08
--- /dev/null
@@ -0,0 +1,46 @@
+Event.observe(document, "dom:loaded", function(){\r
+       var changeEffect;\r
+       Sortable.create("task-list", { handles:$$("#task-list .drag"), tag: "li", ghosting:false, overlap:"vertical", constraint:false,\r
+        onChange: function(item) {\r
+                var list = Sortable.options(item).element;\r
+                // deactivate link\r
+               $$("#task-list a").each(function(link) {\r
+                       link.writeAttribute("onclick","return false;");\r
+               });\r
+\r
+        },\r
+\r
+        onUpdate: function(list) {\r
+                new Ajax.Request("ajax.php", {\r
+                        method: "post",\r
+                        parameters: { ajaxID :"Taskcenter::saveSortingState", data:  Sortable.serialize(list)}\r
+                });\r
+                       // activate link\r
+                Event.observe(window,"mouseup",function(){\r
+                       $$("#task-list a").each(function(link) {\r
+                               link.writeAttribute("onclick","");\r
+                       });\r
+               });\r
+\r
+        }\r
+       });\r
+\r
+       $$("#taskcenter-menu .down").invoke("observe", "click", function(event){\r
+               var item = Event.element(event);\r
+               var itemParent = item.up();\r
+               item = item.next("div").next("div").next("div").next("div");\r
+\r
+               if (itemParent.hasClassName("expanded")) {\r
+                       itemParent.removeClassName("expanded").addClassName("collapsed");\r
+                       Effect.BlindUp(item, {duration : 0.5});\r
+                       state = 1;\r
+               } else {\r
+                       itemParent.removeClassName("collapsed").addClassName("expanded");\r
+                       Effect.BlindDown(item, {duration : 0.5});\r
+                       state = 0;\r
+               }\r
+               new Ajax.Request("ajax.php", {\r
+                       parameters : "ajaxID=Taskcenter::saveCollapseState&item=" + itemParent.id + "&state=" + state\r
+               });\r
+       });\r
+});\r
index ab3a127..3d43d29 100755 (executable)
@@ -96,54 +96,6 @@ class SC_mod_user_task_index extends t3lib_SCbase {
                        function jumpToUrl(URL) {
                                document.location = URL;
                        }
-                       if ($("#task-list")) {
-                               Event.observe(document, "dom:loaded", function(){
-                                       var changeEffect;
-                                       Sortable.create("task-list", { handles:$$("#task-list .drag"), tag: "li", ghosting:false, overlap:"vertical", constraint:false,
-                                        onChange: function(item) {
-                                                var list = Sortable.options(item).element;
-                                                // deactivate link
-                                               $$("#task-list a").each(function(link) {
-                                                       link.writeAttribute("onclick","return false;");
-                                               });
-
-                                        },
-
-                                        onUpdate: function(list) {
-                                                new Ajax.Request("ajax.php", {
-                                                        method: "post",
-                                                        parameters: { ajaxID :"Taskcenter::saveSortingState", data:  Sortable.serialize(list)}
-                                                });
-                                                       // activate link
-                                                Event.observe(window,"mouseup",function(){
-                                                       $$("#task-list a").each(function(link) {
-                                                               link.writeAttribute("onclick","");
-                                                       });
-                                               });
-
-                                        }
-                                       });
-
-                                       $$("#taskcenter-menu .down").invoke("observe", "click", function(event){
-                                               var item = Event.element(event);
-                                               var itemParent = item.up();
-                                               item = item.next("div").next("div").next("div").next("div");
-
-                                               if (itemParent.hasClassName("expanded")) {
-                                                       itemParent.removeClassName("expanded").addClassName("collapsed");
-                                                       Effect.BlindUp(item, {duration : 0.5});
-                                                       state = 1;
-                                               } else {
-                                                       itemParent.removeClassName("collapsed").addClassName("expanded");
-                                                       Effect.BlindDown(item, {duration : 0.5});
-                                                       state = 0;
-                                               }
-                                               new Ajax.Request("ajax.php", {
-                                                       parameters : "ajaxID=Taskcenter::saveCollapseState&item=" + itemParent.id + "&state=" + state
-                                               });
-                                       });
-                               });
-                       }
                ';
                $this->doc->postCode='
                        <script language="javascript" type="text/javascript">
@@ -311,6 +263,7 @@ class SC_mod_user_task_index extends t3lib_SCbase {
 
                        // change the sorting of items to the user's one
                if ($mainMenu) {
+                       $this->doc->getPageRenderer()->addJsFile(t3lib_extMgm::extRelPath('taskcenter') . 'res/tasklist.js');
                        $userSorting = unserialize($GLOBALS['BE_USER']->uc['taskcenter']['sorting']);
                        if (is_array($userSorting)) {
                                $newSorting = array();