initial commit of starter install drupal 7

This commit is contained in:
Bachir Soussi Chiadmi
2015-02-21 17:21:40 +01:00
commit eeba51cea6
6113 changed files with 1249218 additions and 0 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

@@ -0,0 +1,53 @@
/**
* @file
* Linkit ckeditor dialog helper.
*/
(function ($) {
// Abort if Drupal.linkit is not defined.
if (typeof Drupal.linkit === 'undefined') {
return ;
}
Drupal.linkit.registerDialogHelper('ckeditor', {
init : function() {},
/**
* Prepare the dialog after init.
*/
afterInit : function () {
var editor = Drupal.settings.linkit.currentInstance.editor;
var element = CKEDITOR.plugins.link.getSelectedLink( editor );
// If we have selected a link element, lets populate the fields in the
// modal with the values from that link element.
if (element) {
link = {
path: element.data('cke-saved-href') || element.getAttribute('href') || '',
attributes: {}
},
// Get all attributes that have fields in the modal.
additionalAttributes = Drupal.linkit.additionalAttributes();
for (var i = 0; i < additionalAttributes.length; i++) {
link.attributes[additionalAttributes[i]] = element.getAttribute(additionalAttributes[i]);
}
// Populate the fields.
Drupal.linkit.populateFields(link);
}
},
/**
* Insert the link into the editor.
*
* @param {Object} link
* The link object.
*/
insertLink : function(link) {
var editor = Drupal.settings.linkit.currentInstance.editor;
CKEDITOR.tools.callFunction(editor._.linkitFnNum, link, editor);
}
});
})(jQuery);
@@ -0,0 +1,188 @@
/**
* @file
* Plugin for inserting links with Linkit.
*/
(function ($) {
CKEDITOR.plugins.add( 'linkit', {
requires : [ 'link' ],
hidpi: true,
icons: 'linkit',
init: function( editor ) {
// Get the major CKeditor verison.
// We do not care about minor versions.
var version = parseInt(CKEDITOR.version);
// Add Button.
editor.ui.addButton( 'linkit', {
label: Drupal.t('Link to content'),
command: 'linkit'
});
// Ckeditor version lower then 4 needs to have a icon path.
if (version < 4) {
editor.ui._.items.linkit.icon = this.path + 'icons/linkit.png';
editor.ui._.items.linkit.args[0].icon = this.path + 'icons/linkit.png';
}
// Add Command.
editor.addCommand( 'linkit', {
// FOR ACF in ckeditor 4.1+, allow everything.
allowedContent: 'a[*]{*}(*)',
exec : function () {
if (typeof Drupal.settings.linkit === 'undefined') {
alert(Drupal.t('Could not find the Linkit profile.'));
return ;
}
// Set the editor object.
Drupal.settings.linkit.currentInstance.editor = editor;
// Set profile.
Drupal.settings.linkit.currentInstance.profile = Drupal.settings.linkit.fields[editor.name].profile;
// Set the name of the source field.
Drupal.settings.linkit.currentInstance.source = editor.name;
// Set the source type.
Drupal.settings.linkit.currentInstance.helper = 'ckeditor';
var selection = editor.getSelection(),
element = null;
// If we have selected a link element, we what to grab its attributes
// so we can inserten them into the Linkit form in the dialog.
if ((element = CKEDITOR.plugins.link.getSelectedLink(editor)) && element.hasAttribute('href')) {
selection.selectElement(element);
}
else {
element = null;
}
// Save the selection.
Drupal.settings.linkit.currentInstance.selection = selection;
// Lock the selecton for IE.
if (CKEDITOR.env.ie && typeof selection !== 'undefined') {
selection.lock();
}
// Save the selected element.
Drupal.settings.linkit.currentInstance.selectedElement = element;
// Create the modal.
Drupal.linkit.createModal();
}
});
// If the "menu" plugin is loaded, register the menu items.
if (editor.addMenuItems) {
// Use the default link menu group weight and subtract one.
var defaultMenuGroup = editor._.menuGroups.link;
editor.addMenuGroup("Linkit", defaultMenuGroup - 1);
editor.addMenuItems({
linkit: {
label: Drupal.t('Link to content'),
command: 'linkit',
group: 'Linkit',
order: 0
}
});
// Remove the default link option.
editor.removeMenuItem('link');
}
// If the "contextmenu" plugin is loaded, register the listeners.
if (editor.contextMenu) {
editor.contextMenu.addListener(function(element, selection) {
if (!element || element.isReadOnly() || (selection.getSelectedText().length < 1 && !element.is('a'))) {
return null;
}
return {linkit: CKEDITOR.TRISTATE_OFF};
});
}
// Add a shortcut. Only CKeditor version 4 has this function.
if (version >= 4) {
editor.setKeystroke( CKEDITOR.CTRL + 76 /*L*/, 'linkit' );
}
// Add event listener.
editor.on( 'doubleclick', function( evt ) {
// Delete the default link dialog.
delete evt.data.dialog;
var element = CKEDITOR.plugins.link.getSelectedLink( editor ) || evt.data.element;
if ( !element.isReadOnly() ) {
if ( element.is( 'a' ) ) {
editor.getSelection().selectElement( element );
if (version >= 4) {
editor.commands.linkit.exec();
}
else if(version == 3) {
editor._.commands.linkit.exec();
}
}
}
});
// Register an extra fucntion, this will be used in the modal.
editor._.linkitFnNum = CKEDITOR.tools.addFunction( insertLink, editor );
}
});
/**
* Create or update a link element in the editor.
*/
function insertLink(data, editor) {
var selection = editor.getSelection();
data.path = CKEDITOR.tools.trim(data.path);
// Browser need the "href" for copy/paste link to work. (CKEDITOR ISSUE #6641)
data.attributes['data-cke-saved-href'] = data.path;
if (!Drupal.settings.linkit.currentInstance.selectedElement) {
// We have not selected any link element so lets create a new one.
var range = selection.getRanges(1)[0];
if (range.collapsed) {
var content = (Drupal.settings.linkit.currentInstance.linkContent) ? Drupal.settings.linkit.currentInstance.linkContent : data.path;
var text = new CKEDITOR.dom.text(content , editor.document );
range.insertNode(text);
range.selectNodeContents(text);
}
// Delete all attributes that are empty.
data.attributes.href = data.path;
for (name in data.attributes) {
data.attributes[name] ? null : delete data.attributes[name];
}
// Apply style.
var style = new CKEDITOR.style({element : 'a', attributes : data.attributes});
style.type = CKEDITOR.STYLE_INLINE;
style.applyToRange(range);
range.select();
}
else {
var element = Drupal.settings.linkit.currentInstance.selectedElement;
// We are editing an existing link, so just overwrite the attributes.
element.setAttribute('href', data.path);
element.setAttribute('data-cke-saved-href', data.path);
for (name in data.attributes) {
data.attributes[name] ?
element.setAttribute(name, data.attributes[name]) :
element.removeAttribute(name);
}
selection.selectElement( element );
}
// Unlock the selection.
if (CKEDITOR.env.ie && typeof selection !== 'undefined') {
selection.unlock();
}
}
})(jQuery);
@@ -0,0 +1,78 @@
/**
* @file
* Plugin for inserting links with Linkit.
*/
(function ($) {
tinymce.create('tinymce.plugins.linkit', {
init : function(editor, url) {
// Register commands
editor.addCommand('mceLinkit', function() {
if (typeof Drupal.settings.linkit === 'undefined') {
alert(Drupal.t('Could not find the Linkit profile.'));
return ;
}
// Set the editor object.
Drupal.settings.linkit.currentInstance.editor = editor;
// Set profile.
Drupal.settings.linkit.currentInstance.profile = Drupal.settings.linkit.fields[editor.id].profile;
// Set the name of the source field..
Drupal.settings.linkit.currentInstance.source = editor.id;
// Set the source type.
Drupal.settings.linkit.currentInstance.helper = 'tinymce';
// Stores the current editor selection for later restoration. This can
// be useful since some browsers looses it's selection if a control
// element is selected/focused inside the dialogs.
editor.windowManager.bookmark = editor.selection.getBookmark(1);
// Create the modal.
Drupal.linkit.createModal();
});
// Register buttons
editor.addButton('linkit', {
title : Drupal.t('Link to content'),
cmd : 'mceLinkit',
image : url + '/images/linkit.png'
});
// We need the real contextmenu in order to make this work.
if (editor && editor.plugins.contextmenu) {
// Contextmenu gets called - this is what we do.
editor.plugins.contextmenu.onContextMenu.add(function(th, m, e, col) {
// Only if selected node is an link do this.
if (e.nodeName == 'A' || !col) {
// Remove all options from standard contextmenu.
m.removeAll();
th._menu.add({
title : Drupal.t('Link to content'),
cmd : 'mceLinkit',
icon : 'linkit'
});
//m.addSeparator();
}
});
}
},
getInfo : function() {
return {
longname : 'Linkit',
author : 'Emil Stjerneman',
authorurl : 'http://www.stjerneman.com',
infourl : 'http://drupal.org/project/linkit',
version : tinymce.majorVersion + "." + tinymce.minorVersion
};
}
});
// Register plugin
tinymce.PluginManager.add('linkit', tinymce.plugins.linkit);
})(jQuery);
Binary file not shown.

After

Width:  |  Height:  |  Size: 608 B

@@ -0,0 +1,102 @@
/**
* @file
* Linkit tinymce dialog helper.
*/
(function ($) {
// Abort if Drupal.linkit is not defined.
if (typeof Drupal.linkit === 'undefined') {
return ;
}
Drupal.linkit.registerDialogHelper('tinymce', {
init : function() {},
/**
* Prepare the dialog after init.
*/
afterInit : function () {
var editor = Drupal.settings.linkit.currentInstance.editor;
var element, link;
// Restore the selection if the browser is IE.
if (tinymce.isIE) {
editor.selection.moveToBookmark(editor.windowManager.bookmark);
}
// If we have selected a link element, lets populate the fields in the
// dialog with the values from that link element.
if (element = editor.dom.getParent(editor.selection.getNode(), 'A')) {
link = {
path: editor.dom.getAttrib(element, 'href'),
attributes: {}
};
// Get all attributes that have fields in the modal.
var additionalAttributes = Drupal.linkit.additionalAttributes();
// Add attributes to the link object, but only those that are enabled in Linkit.
tinymce.each(additionalAttributes, function(attribute) {
var value = editor.dom.getAttrib(element, attribute);
if (value) {
link.attributes[attribute] = value;
}
});
}
// Populate the fields.
Drupal.linkit.populateFields(link);
},
/**
* Insert the link into the editor.
*
* @param {Object} link
* The link object.
*/
insertLink : function(data) {
var editor = Drupal.settings.linkit.currentInstance.editor,
element = editor.dom.getParent(editor.selection.getNode(), 'A');
// Restore the selection if the browser is IE.
if (tinymce.isIE) {
editor.selection.moveToBookmark(editor.windowManager.bookmark);
}
// Set undo begin point.
editor.execCommand("mceBeginUndoLevel");
data.attributes.href = data.path;
// No link element selected, create a new anchor element.
if (element == null) {
// If there is no selection, lets inser a new element.
if (editor.selection.isCollapsed()) {
var content = (Drupal.settings.linkit.currentInstance.linkContent) ? Drupal.settings.linkit.currentInstance.linkContent : data.path;
editor.execCommand('mceInsertContent', false,
editor.dom.createHTML('a', data.attributes, content));
} else {
editor.execCommand("mceInsertLink", false, data.attributes);
}
}
// We are editing an existing link, so just overwrite the attributes.
else {
editor.dom.setAttribs(element, data.attributes);
}
// Don't move caret if selection was image
if(element != null) {
if (element.childNodes.length != 1 || element.firstChild.nodeName != 'IMG') {
editor.focus();
editor.selection.select(element);
editor.selection.collapse(0);
// Restore the selection if the browser is IE.
if (tinymce.isIE) {
editor.selection.moveToBookmark(editor.windowManager.bookmark);
}
}
}
// Set undo end point.
editor.execCommand("mceEndUndoLevel");
}
});
})(jQuery);