[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/design/standard/javascript/lib/ -> ezjslibcookiesupport.js (source)

   1  //
   2  // Created on: <14-Jul-2004 14:18:58 dl>
   3  //
   4  // SOFTWARE NAME: eZ publish
   5  // SOFTWARE RELEASE: 3.9.0
   6  // BUILD VERSION: 17785
   7  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
   8  // SOFTWARE LICENSE: GNU General Public License v2.0
   9  // NOTICE: >
  10  //   This program is free software; you can redistribute it and/or
  11  //   modify it under the terms of version 2.0  of the GNU General
  12  //   Public License as published by the Free Software Foundation.
  13  //
  14  //   This program is distributed in the hope that it will be useful,
  15  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  16  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17  //   GNU General Public License for more details.
  18  //
  19  //   You should have received a copy of version 2.0 of the GNU General
  20  //   Public License along with this program; if not, write to the Free
  21  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  22  //   MA 02110-1301, USA.
  23  //
  24  //
  25              
  26  /*! \file ezjslibcookiesupport.js 
  27  */
  28  
  29  /*!    
  30      \brief
  31      Functions which works direct with cookie:
  32          ezjslib_setCookie,
  33          ezjslib_getCookie,
  34          ezjslib_setCookieFromArray,
  35          ezjslib_getCookieToArray.
  36          
  37  */
  38  
  39  
  40  /*!
  41      Sets cookie with \a name, \a value and \a expires date.
  42  */
  43  function ezjslib_setCookie( name, value, expires ) 
  44  {
  45      document.cookie = name + '=' + escape(value) + (( !expires ) ? "" : ('; expires=' + expires.toUTCString())) + '; path=/';
  46  } 
  47  
  48  /*!
  49      \return a value of cookie with name \a name.
  50  */
  51  function ezjslib_getCookie( name ) 
  52  {
  53      var cookie  = document.cookie;
  54      
  55      var startPos = cookie.indexOf( name );
  56      if ( startPos != -1 )
  57      {
  58          startPos += name.length + 1;
  59  
  60          var endPos = cookie.indexOf( ";", startPos );
  61          if ( endPos == -1 )
  62              endPos = cookie.length;
  63  
  64          return unescape( cookie.substring(startPos, endPos) );
  65      }
  66  
  67      return null;
  68  } 
  69  
  70  /*!
  71      Converts array \a valueArray to string using as delimiter \a delimiter.
  72      Resulting string stores in the cookie with name \a name and expire date
  73      \a expires.
  74  */
  75  function ezjslib_setCookieFromArray( name, valuesArray, expires, delimiter )
  76  {
  77      var strCookie = valuesArray.join( delimiter );
  78      ezjslib_setCookie( name, strCookie, expires );
  79  }
  80  
  81  /*!
  82      Retrieves string from cookie \a name and converts it to array using
  83      \a delimiter as delimiter.
  84  */
  85  function ezjslib_getCookieToArray( name, delimiter )
  86  {
  87      var valuesArray = new Array( 0 );
  88      var strCookie = ezjslib_getCookie( name );
  89      if ( strCookie )
  90      {
  91          valuesArray = strCookie.split( delimiter );
  92      }
  93  
  94      return valuesArray;
  95  }
  96  


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7