Changeset 3442

Show
Ignore:
Timestamp:
12/08/11 18:11:37
Author:
johnsa
Message:

public client: subscriptions tree widget in the bedework theme now holds state between requests

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/deployment/webpublic/webapp/resources/demoskins/MainCampus/themes/bedeworkTheme/subscriptions.xsl

    r3441 r3442  
    3737    <script type="text/javascript"> 
    3838            $(document).ready(function(){ 
     39              var openCals = new Array(); 
     40              <xsl:if test="/bedework/appvar[key='opencals']"> 
     41                var openCalsRaw = "<xsl:value-of select="/bedework/appvar[key='opencals']/value"/>"; 
     42                openCals = openCalsRaw.split(","); 
     43              </xsl:if> 
    3944                    $("#subsTree .subsTreeToggle").click(function() { 
    40                       $(this).parent("li").children("ul").toggle("fast"); 
     45                      var curItem = $(this).parent("li"); 
     46                      $(curItem).children("ul").slideToggle("fast", function(){ 
     47                        if ($(this).is(":visible")) { 
     48                          $(this).parent("li").children("span.subsTreeToggle").html("-"); 
     49                    openCals.push($(curItem).attr("id")); 
     50                  } else { 
     51                    var itemIndex = $.inArray($(curItem).attr("id"),openCals); 
     52              $(this).parent("li").children("span.subsTreeToggle").html("+"); 
     53                    openCals.splice(itemIndex,1); 
     54                  } 
     55                   
     56                  $.ajax({ 
     57                    url: '/cal/misc/async.do', 
     58                    data: 'setappvar=opencals(' + openCals.toString() + ')', 
     59                    dataType: 'xml' 
     60                  }); 
     61                      }); 
     62                       
    4163                    }); 
    4264            }); 
     
    5173    <xsl:variable name="summary" select="summary"/> 
    5274    <xsl:variable name="itemId" select="generate-id(path)"/> 
    53     <xsl:variable name="folderState">closed</xsl:variable> 
     75    <xsl:variable name="folderState"> 
     76      <xsl:choose> 
     77        <xsl:when test="contains(/bedework/appvar[key='opencals']/value,$itemId)">open</xsl:when> 
     78        <xsl:otherwise>closed</xsl:otherwise> 
     79      </xsl:choose> 
     80    </xsl:variable> 
    5481    <li id="{$itemId}"> 
    5582      <xsl:if test="calendar and not($isRoot = 'true')"> 
     
    6188                </xsl:choose> 
    6289              </xsl:attribute> 
    63               <span class="subsTreeToggle">+</span> 
     90              <span class="subsTreeToggle"> 
     91                <xsl:choose> 
     92                  <xsl:when test="$folderState = 'closed'">+</xsl:when> 
     93                  <xsl:otherwise>-</xsl:otherwise> 
     94                </xsl:choose> 
     95              </span> 
    6496            </xsl:if> 
    6597            <xsl:if test="not(calendar) and $virtualPath = $curPath">