[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

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


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