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

Changeset 10693


Ignore:
Timestamp:
Feb 8, 2009, 7:26:47 PM (11 years ago)
Author:
ogawa
Message:

#3607:added pne_url2a() to be called from cmd scripts

Location:
OpenPNE3/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/trunk/lib/helper/opUtilHelper.php

    r10584 r10693  
    256256    return str_replace('&', '&', op_auto_link_text(str_replace('&', '&', $url)));
    257257  }
     258
     259  sfContext::getInstance()->getResponse()->addJavascript('util');
    258260
    259261  $public_path = _compute_public_path($file, 'cmd', 'js');
  • OpenPNE3/trunk/web/js/util.js

    r10593 r10693  
    123123  }
    124124};
     125
     126/**
     127 * Trims a long url and displays a link to the url
     128 *
     129 * @param string url
     130 */
     131function pne_url2a(url)
     132{
     133  var urlstr;
     134
     135  if (url.length > 57)
     136  {
     137    var _url = url.replace("&", "&");
     138
     139    if (_url.length > 57)
     140    {
     141      _url = _url.substr(0, 57) + '...';
     142      urlstr = _url.replace("&", "&");
     143    }
     144  }
     145
     146  if (!urlstr)
     147  {
     148    urlstr = url;
     149  }
     150
     151  document.write('<a href="'+url+'" target="_blank">'+urlstr+'</a>');
     152}
Note: See TracChangeset for help on using the changeset viewer.