Fixed bug #15691: Javascript Error in taskcenter
authorSteffen Kamper <info@sk-typo3.de>
Mon, 13 Sep 2010 13:09:47 +0000 (13:09 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Mon, 13 Sep 2010 13:09:47 +0000 (13:09 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@8787 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/taskcenter/task/index.php

index 64df214..f57bfc1 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
-2010-09-12  Steffen Kamper  <steffen@typo3.org>
+2010-09-13  Steffen Kamper  <steffen@typo3.org>
 
+       * Fixed bug #15691: Javascript Error in taskcenter
        * Fixed bug #15677: Wrapper for console only prints first argument
        * Follow-up to bug #15589: Move debug functions to own utility class (missing changes in config_default)
 
index 0f99079..ab3a127 100755 (executable)
@@ -96,53 +96,54 @@ class SC_mod_user_task_index extends t3lib_SCbase {
                        function jumpToUrl(URL) {
                                document.location = URL;
                        }
-
-                       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(){
+                       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","");
+                                                       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
+                                       $$("#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">