[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/fckeditor/plugins/linktonode/jscripts/ -> utils.js (source)

   1  if ( !FCKConfig.LinkDlgHideTarget )
   2      window.parent.SetTabVisibility( 'Target', true ) ;
   3  
   4  // Overwrite linktocontent function
   5  //<!-- linktonode START -->
   6  function selectRow(row) {
   7      if (!row) {
   8          return;
   9      }
  10      $('#nodelist tbody tr').each(function() {
  11          $(this).css({background: '#ffffff'});
  12          selectedNode = null;
  13      });
  14      selectedNode = row;
  15      $(row).css({background: '#dadfe9'});
  16  
  17      GetE('txtUrlPath').value = selectedNode.cells[0].firstChild.nodeValue;
  18      GetE('txtUrlInternal').value = 'internal:' + selectedNode.cells[4].firstChild.nodeValue;
  19      SaveDrupalUrls();
  20  }
  21  //<!-- linktonode END -->
  22  
  23  // save node/path urls
  24  function SaveDrupalUrls()
  25  {
  26      if ((!FCKConfig.DrupalLinkToContentSelect && FCKConfig.DrupalPathFilter) || GetE('cmbDrupalProtocol').value == 'internal') {
  27          GetE('txtUrl').value = GetE('txtUrlInternal').value;
  28      }
  29      else {
  30          GetE('txtUrl').value = GetE('txtUrlPath').value;
  31      }
  32  }
  33  
  34  //#### The OK button was hit.
  35  function Ok()
  36  {
  37      var sUri, sInnerHtml ;
  38      var sUri = GetE('txtUrl').value;
  39  
  40      oEditor.FCKUndo.SaveUndoStep() ;
  41  
  42      // If no link is selected, create a new one (it may result in more than one link creation - #220).
  43      var aLinks = oLink ? [ oLink ] : oEditor.FCK.CreateLink( sUri, true ) ;
  44  
  45      // If no selection, no links are created, so use the uri as the link text (by dom, 2006-05-26)
  46      var aHasSelection = ( aLinks.length > 0 ) ;
  47      if ( !aHasSelection )
  48      {
  49          // Create a new (empty) anchor.
  50          aLinks = [ oEditor.FCK.InsertElement( 'a' ) ] ;
  51      }
  52  
  53      // overwrite current selection
  54      sInnerHtml = selectedNode.cells[1].firstChild.nodeValue;
  55  
  56      for ( var i = 0 ; i < aLinks.length ; i++ )
  57      {
  58          oLink = aLinks[i] ;
  59  
  60          if ( aHasSelection )
  61              sInnerHtml = oLink.innerHTML ;        // Save the innerHTML (IE changes it if it is like an URL).
  62  
  63          oLink.href = sUri ;
  64          SetAttribute( oLink, '_fcksavedurl', sUri ) ;
  65  
  66          var onclick;
  67          // Accessible popups
  68          if( GetE('cmbTarget').value == 'popup' )
  69          {
  70              onclick = BuildOnClickPopup() ;
  71              // Encode the attribute
  72              onclick = encodeURIComponent( " onclick=\"" + onclick + "\"" )  ;
  73              SetAttribute( oLink, 'onclick_fckprotectedatt', onclick ) ;
  74          }
  75          else
  76          {
  77              // Check if the previous onclick was for a popup:
  78              // In that case remove the onclick handler.
  79              onclick = oLink.getAttribute( 'onclick_fckprotectedatt' ) ;
  80              if ( onclick )
  81              {
  82                  // Decode the protected string
  83                  onclick = decodeURIComponent( onclick ) ;
  84  
  85                  if( oRegex.OnClickPopup.test( onclick ) )
  86                      SetAttribute( oLink, 'onclick_fckprotectedatt', '' ) ;
  87              }
  88          }
  89  
  90          oLink.innerHTML = sInnerHtml ;        // Set (or restore) the innerHTML
  91  
  92          // Target
  93          if( GetE('cmbTarget').value != 'popup' )
  94              SetAttribute( oLink, 'target', GetE('txtTargetFrame').value ) ;
  95          else
  96              SetAttribute( oLink, 'target', null ) ;
  97  
  98          // Let's set the "id" only for the first link to avoid duplication.
  99          if ( i == 0 )
 100              SetAttribute( oLink, 'id', GetE('txtAttId').value ) ;
 101  
 102          // Advances Attributes
 103          SetAttribute( oLink, 'name'        , GetE('txtAttName').value ) ;
 104          SetAttribute( oLink, 'dir'        , GetE('cmbAttLangDir').value ) ;
 105          SetAttribute( oLink, 'lang'        , GetE('txtAttLangCode').value ) ;
 106          SetAttribute( oLink, 'accesskey', GetE('txtAttAccessKey').value ) ;
 107          SetAttribute( oLink, 'tabindex'    , ( GetE('txtAttTabIndex').value > 0 ? GetE('txtAttTabIndex').value : null ) ) ;
 108          SetAttribute( oLink, 'title'    , GetE('txtAttTitle').value ) ;
 109          SetAttribute( oLink, 'type'        , GetE('txtAttContentType').value ) ;
 110          SetAttribute( oLink, 'charset'    , GetE('txtAttCharSet').value ) ;
 111  
 112          if ( oEditor.FCKBrowserInfo.IsIE )
 113          {
 114              var sClass = GetE('txtAttClasses').value ;
 115              // If it's also an anchor add an internal class
 116              if ( GetE('txtAttName').value.length != 0 )
 117                  sClass += ' FCK__AnchorC' ;
 118              SetAttribute( oLink, 'className', sClass ) ;
 119  
 120              oLink.style.cssText = GetE('txtAttStyle').value ;
 121          }
 122          else
 123          {
 124              SetAttribute( oLink, 'class', GetE('txtAttClasses').value ) ;
 125              SetAttribute( oLink, 'style', GetE('txtAttStyle').value ) ;
 126          }
 127      }
 128      // Select the (first) link.
 129      oEditor.FCKSelection.SelectNode( aLinks[0] );
 130  
 131      return true ;
 132  }


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7