ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 10593


Ignore:
Timestamp:
Feb 2, 2009, 11:40:37 PM (12 years ago)
Author:
ebihara
Message:

#3555:added ability to store the current gadget's folding status

Location:
OpenPNE3/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/trunk/apps/pc_frontend/modules/community/templates/_joinListBox.php

    r10368 r10593  
    99  'col' => $col,
    1010);
    11 op_include_parts('nineTable', 'communityList', $options);
     11op_include_parts('nineTable', 'communityList_'.$gadget->getId(), $options);
  • OpenPNE3/trunk/apps/pc_frontend/modules/default/templates/_informationBox.php

    r10350 r10593  
    11<?php
    2 op_include_parts('informationBox', 'information', array('body' => $sf_data->getRaw('gadget')->getConfig('value')))
     2op_include_parts('informationBox', 'information_'.$gadget->getId(), array('body' => $sf_data->getRaw('gadget')->getConfig('value')))
    33?>
  • OpenPNE3/trunk/apps/pc_frontend/modules/default/templates/_memberImageBox.php

    r10368 r10593  
    88  ),
    99);
    10 op_include_parts('memberImageBox', 'memberImageBox', $options);
     10op_include_parts('memberImageBox', 'memberImageBox_'.$gadget->getId(), $options);
  • OpenPNE3/trunk/apps/pc_frontend/modules/default/templates/_searchBox.php

    r10368 r10593  
    1 <?php op_include_parts('searchFormLine', 'searchLine', array(
     1<?php op_include_parts('searchFormLine', 'searchLine_'.$gadget->getId(), array(
    22  'button' => __('Search'),
    33  'items' => array(
  • OpenPNE3/trunk/apps/pc_frontend/modules/friend/templates/_friendListBox.php

    r10468 r10593  
    1515}
    1616
    17 op_include_parts('nineTable', 'frendList', $options);
     17op_include_parts('nineTable', 'frendList_'.$gadget->getId(), $options);
  • OpenPNE3/trunk/apps/pc_frontend/modules/member/config/view.yml

    r10489 r10593  
    11homeSuccess:
     2  javascripts: [%SF_PROTOTYPE_WEB_DIR%/js/prototype, util]
    23  layout: layoutA
    34  customize:
  • OpenPNE3/trunk/apps/pc_frontend/modules/member/templates/homeSuccess.php

    r10591 r10593  
    4444
    4545<?php echo javascript_tag('
     46function foldObj(obj, display)
     47{
     48  Element.childElements(obj.parentNode).each(function(child, index){
     49    if (!child.hasClassName("partsHeading")) {
     50      if (display == null) {
     51        child.toggle();
     52      } else {
     53        if (display == "true") {
     54          child.show();
     55        } else {
     56          child.hide();
     57        }
     58      }
     59
     60      var size = Element.childElements(obj.parentNode).length;
     61      if (size == index + 1) {  // It is a last loop maybe
     62        var id = child.parentNode.parentNode.id;
     63        var expires = new Date();
     64        expires.setTime((new Date()).getTime() + (10 * 12 * 30 * 24 * 60 * 60 * 1000));
     65        opCookie.set("HomeGadget_"+id+"_toggle", child.visible(), expires);
     66      }
     67    }
     68  });
     69}
     70
    4671$$(".partsHeading").each(function(obj){
    4772  // folding
    4873  Event.observe(obj, "dblclick", function(e){
    49     Event.element(e).parentNode.childElements().each(function(child){
    50       if (!child.hasClassName("partsHeading")) {
    51         child.toggle();
    52       }
    53     });
     74    foldObj(obj);
    5475  });
     76  var id = obj.parentNode.parentNode.id;
     77  var display = opCookie.get("HomeGadget_"+id+"_toggle");
     78  if (display != null) {
     79    foldObj(obj, display);
     80  }
    5581});
     82
    5683') ?>
  • OpenPNE3/trunk/web/js/util.js

    r10250 r10593  
     1/**
     2 * This file is part of the OpenPNE package.
     3 * (c) OpenPNE Project (http://www.openpne.jp/)
     4 *
     5 * For the full copyright and license information, please view the LICENSE
     6 * file and the NOTICE file that were distributed with this source code.
     7 */
     8
     9/**
     10 * OpenPNE utility JavaScript library
     11 *
     12 * @author Kousuke Ebihara <ebihara@tejimaya.com>
     13 * @author Shogo Kawahara <kawahara@tejimaya.net>
     14 */
     15
    116function getCenterMuchScreen(element)
    217{
     
    1732  return {"left": left + "px", "top" : top + "px"};
    1833}
     34
     35/**
     36 * opCookie class
     37 */
     38var opCookie = {
     39
     40 /**
     41  * Sets a cookie data
     42  *
     43  * This method imitates of PHP's setcookie() function
     44  *
     45  * @params string name
     46  * @params string value
     47  * @params Date   expires
     48  * @params string path
     49  * @params string domain
     50  * @params bool   secure
     51  * @params bool   httponly
     52  */
     53  set: function(name, value, expires, path, domain, secure, httponly)
     54  {
     55    var result = '';
     56
     57    if (value == undefined || (value instanceof String && !value))  // deletes cookie
     58    {
     59      var expires = new Date();
     60      expires.setTime((new Date()).getTime() - (12 * 30 * 24 * 60 * 60 * 1000));  // 1 year
     61      result = name + '=deleted; expires=' + expires.toUTCString();
     62    }
     63    else
     64    {
     65      if (!expires || !(expires instanceof Date))
     66      {
     67        var expires = new Date();
     68        console.debug(expires);
     69        expires.setTime((new Date()).getTime() + (60 * 60 * 1000));  // 1 hour
     70      }
     71
     72      value = encodeURIComponent(value);
     73      result = name + "=" + value + "; expires=" + expires.toUTCString();
     74    }
     75
     76    if (path && path.length)
     77    {
     78      result = result + "; path=" + path;
     79    }
     80    if (domain && domain.length)
     81    {
     82      result = result + "; domain=" + domain;
     83    }
     84    if (secure)
     85    {
     86      result = result + "; secure";
     87    }
     88    if (httponly)
     89    {
     90      result = result + "; secure";
     91    }
     92
     93    document.cookie = result;
     94  },
     95
     96 /**
     97  * Gets a cookie data
     98  *
     99  * @params string name
     100  */
     101  get: function(name)
     102  {
     103    var value = null;
     104
     105    if (document.cookie && document.cookie.length)
     106    {
     107      var _cookie = document.cookie;
     108
     109      var cookies = _cookie.split(';');
     110      for (var i = 0; i < cookies.length; i++)
     111      {
     112        var _cookie = cookies[i];
     113        var valuePos = name.length + 1;
     114        if (_cookie.substr(0, valuePos + 1).strip() == (name + '='))
     115        {
     116          value = decodeURIComponent(_cookie.substr(valuePos + 1)).strip();
     117          break;
     118        }
     119      }
     120    }
     121
     122    return value;
     123  }
     124};
Note: See TracChangeset for help on using the changeset viewer.