Projet

Général

Profil

Révision 98df731a

Ajouté par Assos Assos il y a plus de 7 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/media/includes/media.fields.inc
134 134
  elseif (module_exists('translation') && $element['#entity_type'] == 'node' && translation_supported_type($element['#entity']->type)) {
135 135
    $element['#media_parent_entity_form_langcode'] = $element['#entity']->language;
136 136
    $element['#media_parent_entity_source_langcode'] = $element['#entity']->language;
137
  } elseif ($element['#entity_type'] == 'field_collection_item') {
137
  } elseif ($element['#entity_type'] == 'field_collection_item' && property_exists($form['#entity'], 'language')) {
138 138
    $element['#media_parent_entity_form_langcode'] = $form['#entity']->language;
139 139
  }
140 140

  
drupal7/sites/all/modules/media/media.info
24 24
; We have to add a fake version so Git checkouts do not fail Media dependencies
25 25
version = 7.x-2.x-dev
26 26

  
27
; Information added by Drupal.org packaging script on 2016-12-07
28
version = "7.x-2.0-beta13"
27
; Information added by Drupal.org packaging script on 2016-12-09
28
version = "7.x-2.0-beta14"
29 29
core = "7.x"
30 30
project = "media"
31
datestamp = "1481140093"
31
datestamp = "1481300289"
32 32

  
drupal7/sites/all/modules/media/modules/media_bulk_upload/media_bulk_upload.info
13 13
files[] = includes/MediaBrowserBulkUpload.inc
14 14
files[] = tests/media_bulk_upload.test
15 15

  
16
; Information added by Drupal.org packaging script on 2016-12-07
17
version = "7.x-2.0-beta13"
16
; Information added by Drupal.org packaging script on 2016-12-09
17
version = "7.x-2.0-beta14"
18 18
core = "7.x"
19 19
project = "media"
20
datestamp = "1481140093"
20
datestamp = "1481300289"
21 21

  
drupal7/sites/all/modules/media/modules/media_internet/media_internet.info
12 12
files[] = includes/MediaInternetValidationException.inc
13 13
files[] = tests/media_internet.test
14 14

  
15
; Information added by Drupal.org packaging script on 2016-12-07
16
version = "7.x-2.0-beta13"
15
; Information added by Drupal.org packaging script on 2016-12-09
16
version = "7.x-2.0-beta14"
17 17
core = "7.x"
18 18
project = "media"
19
datestamp = "1481140093"
19
datestamp = "1481300289"
20 20

  
drupal7/sites/all/modules/media/modules/media_internet/tests/media_internet_test.info
7 7
files[] = includes/MediaInternetTestStreamWrapper.inc
8 8
files[] = includes/MediaInternetTestHandler.inc
9 9

  
10
; Information added by Drupal.org packaging script on 2016-12-07
11
version = "7.x-2.0-beta13"
10
; Information added by Drupal.org packaging script on 2016-12-09
11
version = "7.x-2.0-beta14"
12 12
core = "7.x"
13 13
project = "media"
14
datestamp = "1481140093"
14
datestamp = "1481300289"
15 15

  
drupal7/sites/all/modules/media/modules/media_migrate_file_types/media_migrate_file_types.info
8 8

  
9 9
configure = admin/structure/file-types/upgrade
10 10

  
11
; Information added by Drupal.org packaging script on 2016-12-07
12
version = "7.x-2.0-beta13"
11
; Information added by Drupal.org packaging script on 2016-12-09
12
version = "7.x-2.0-beta14"
13 13
core = "7.x"
14 14
project = "media"
15
datestamp = "1481140093"
15
datestamp = "1481300289"
16 16

  
drupal7/sites/all/modules/media/modules/media_wysiwyg/js/media_wysiwyg.format_form.js
30 30
  }
31 31
};
32 32

  
33
Drupal.media.formatForm.getEditorContent = function(fieldKey) {
34
  // This is the default implementation of an overridable function: 
35
  // Each javascript rich-text editor module should provide an override implementation 
36
  // of this function which fetches content from the appropriate editor-specific variable.
37
  
38
  // This current implementation explicitly handles the editors from the
39
  // WYSIWYG and Media CKEditor modules: it should be modified to remove that
40
  // as soon as each module has been confirmed to provide their own implementation.
41

  
42
  if (Drupal.wysiwyg && Drupal.wysiwyg.instances[fieldKey]) {
43
    // Retrieve the content from the editor provided by the WYSIWYG Module.
44
    // Remove this case once the WYSIWYG module provides an override for this function.
45
    return Drupal.wysiwyg.instances[fieldKey].getContent();
46
  }
47
  else if (typeof CKEDITOR !== 'undefined' && CKEDITOR.instances[fieldKey]) {
48
    // Retrieve the content from the editor provided by the Media CKEditor Module.
49
    // Remove this case once the Media CKEditor module provides an override for this function.
50
    return CKEDITOR.instances[fieldKey].getData();
51
  }
52
  else {
53
    // Default case => no known WYSIWYG editor.
54
    return null;
55
  }
56
}
57

  
33 58
Drupal.media.formatForm.getOptions = function () {
34 59
  // Get all the values
35 60
  var ret = {};
......
51 76

  
52 77
    ret[field.name] = field.value;
53 78

  
54
    // When a field uses a WYSIWYG format, the value needs to be extracted.
79
    // When a field uses a WYSIWYG format, the value needs to be extracted and encoded.
55 80
    if (field.name.match(/\[format\]/i)) {
56 81
      field.name = field.name.replace(/\[format\]/i, '[value]');
57
      field.key  = 'edit-' + field.name.replace(/[_\[]/g, '-').replace(/[\]]/g, '');
82
      field.key = 'edit-' + field.name.replace(/[_\[]/g, '-').replace(/[\]]/g, '');
58 83

  
59
      if (Drupal.wysiwyg && Drupal.wysiwyg.instances[field.key]) {
60
        // Retrieve the content from the WYSIWYG instance.
61
        ret[field.name] = Drupal.wysiwyg.instances[field.key].getContent();
62

  
63
        // Encode the content to play nicely within JSON.
64
        ret[field.name] = encodeURIComponent(ret[field.name]);
84
      // Attempt to retrieve content for this field from any associated javascript rich-text editor.
85
      var editorContent = Drupal.media.formatForm.getEditorContent(field.key);
86
      if (editorContent) {
87
        // Replace the already-cached value with the value from the editor.
88
        ret[field.name] = editorContent;
89
      }
90
      else {
91
        // An editor was not used for this field - either because none was configured for the selected format,
92
        // or possibly because the user chose to revert to the plain-text editor (CKEditor allows that).
93
        // Replace the already-cached value with the raw value from the long-text field value.
94
        // (Replacment is needed because this function may be invoked multiple times on the same field,
95
        // and so the cached value may already have been encoded - we don't want to double-encode it!)
96
        ret[field.name] = $('#' + field.key).val();
65 97
      }
98

  
99
      // Encode the formatted value to play nicely within JSON.
100
      // (It could contain HTML and other quoted entities, no matter what sort of editor was used)
101
      ret[field.name] = encodeURIComponent(ret[field.name]);
66 102
    }
67 103
  });
68 104

  
drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.info
15 15

  
16 16
configure = admin/config/media/browser
17 17

  
18
; Information added by Drupal.org packaging script on 2016-12-07
19
version = "7.x-2.0-beta13"
18
; Information added by Drupal.org packaging script on 2016-12-09
19
version = "7.x-2.0-beta14"
20 20
core = "7.x"
21 21
project = "media"
22
datestamp = "1481140093"
22
datestamp = "1481300289"
23 23

  
drupal7/sites/all/modules/media/modules/media_wysiwyg_view_mode/media_wysiwyg_view_mode.info
3 3
package = Media
4 4
core = 7.x
5 5

  
6
; Information added by Drupal.org packaging script on 2016-12-07
7
version = "7.x-2.0-beta13"
6
; Information added by Drupal.org packaging script on 2016-12-09
7
version = "7.x-2.0-beta14"
8 8
core = "7.x"
9 9
project = "media"
10
datestamp = "1481140093"
10
datestamp = "1481300289"
11 11

  
drupal7/sites/all/modules/media/modules/mediafield/mediafield.info
4 4
core = 7.x
5 5
dependencies[] = media
6 6

  
7
; Information added by Drupal.org packaging script on 2016-12-07
8
version = "7.x-2.0-beta13"
7
; Information added by Drupal.org packaging script on 2016-12-09
8
version = "7.x-2.0-beta14"
9 9
core = "7.x"
10 10
project = "media"
11
datestamp = "1481140093"
11
datestamp = "1481300289"
12 12

  
drupal7/sites/all/modules/media/tests/media_module_test.info
6 6

  
7 7
files[] = includes/MediaModuleTest.inc
8 8

  
9
; Information added by Drupal.org packaging script on 2016-12-07
10
version = "7.x-2.0-beta13"
9
; Information added by Drupal.org packaging script on 2016-12-09
10
version = "7.x-2.0-beta14"
11 11
core = "7.x"
12 12
project = "media"
13
datestamp = "1481140093"
13
datestamp = "1481300289"
14 14

  
drupal7/sites/all/modules/media_ckeditor/js/media_ckeditor.format_form.js
12 12
}
13 13

  
14 14
/**
15
 * This overrides, and is mostly a copy of, a function from the following file:
16
 * media/modules/media_wysiwyg/js/media_wysiwyg.format_form.js
15
 * This overrides the function of the same name from media/modules/media_wysiwyg/js/media_wysiwyg.format_form.js
16
 * It provides an implementation of that function that knows how to extract content from CKEditor instances.
17 17
 */
18
Drupal.media.formatForm.getOptions = function () {
19
  // Get all the values
20
  var ret = {};
21

  
22
  $.each($('#media-wysiwyg-format-form .fieldset-wrapper *').serializeArray(), function (i, field) {
23
    // When a field uses a WYSIWYG format, the value needs to be extracted.
24
    if (field.name.match(/\[format\]/i)) {
25
      // Only fields containing HTML need to be encoded.
26
      ret[field.name] = encodeURIComponent(field.value);
27
      field.name = field.name.replace(/\[format\]/i, '[value]');
28
      field.key  = 'edit-' + field.name.replace(/[_\[]/g, '-').replace(/[\]]/g, '');
29

  
30
      if (typeof CKEDITOR !== 'undefined') {
31
        if (CKEDITOR.instances[field.key]) {
32
          ret[field.name] = CKEDITOR.instances[field.key].getData();
33
          ret[field.name] = encodeURIComponent(ret[field.name]);
34
        }
35
      }
36
    }
37
    else {
38
      ret[field.name] = field.value;
39
    }
40
  });
41

  
42
  return ret;
43

  
18
Drupal.media.formatForm.getEditorContent = function(fieldKey) {
19
  if (typeof CKEDITOR !== 'undefined' && CKEDITOR.instances[fieldKey]) {
20
    return CKEDITOR.instances[fieldKey].getData();
21
  }
22
  else {
23
    // Default case => no CKEditor instance for this field.
24
    return null;
25
  }
44 26
};
45 27

  
46 28
})(jQuery);
drupal7/sites/all/modules/media_ckeditor/js/plugins/media/plugin.js
13 13
  var mediaPluginDefinition = {
14 14
    icons: 'media',
15 15
    requires: ['button'],
16
    // Check if this instance has widget support. All the default distributions
17
    // of the editor have the widget plugin disabled by default.
18
    hasWidgetSupport: typeof(CKEDITOR.plugins.registered.widget) != 'undefined',
16
    // All the default distributions of the editor have the widget plugin
17
    // disabled by default.
18
    hasWidgetSupport: false,
19 19
    mediaLegacyWrappers: false,
20
    onLoad: function() {
21
      // Check if this instance has widget support.
22
      mediaPluginDefinition.hasWidgetSupport = typeof(CKEDITOR.plugins.registered.widget) != 'undefined';
23
      // Add dependency to widget plugin if possible.
24
      if (parseFloat(CKEDITOR.version) >= 4.3 && mediaPluginDefinition.hasWidgetSupport) {
25
        mediaPluginDefinition.requires.push('widget');
26
      }
27
    },
20 28

  
21 29
    // Wrap Drupal plugin in a proxy plugin.
22 30
    init: function(editor){
......
52 60
        }
53 61
      });
54 62

  
63
      // Add a Ckeditor context menu item for editing already-inserted media.
64
      if (editor.contextMenu) {
65
        editor.addCommand('mediaConfigure', {
66
          exec: function (editor) {
67
            editor.execCommand('media');
68
          },
69
        });
70

  
71
        editor.addMenuGroup('mediaGroup');
72
        editor.addMenuItem('mediaConfigureItem', {
73
          label: Drupal.t('Media settings'),
74
          icon: this.path + 'images/icon.gif',
75
          command: 'mediaConfigure',
76
          group: 'mediaGroup'
77
        });
78

  
79
        editor.contextMenu.addListener(function(element) {
80
          if (element.getAttribute('data-media-element') ||
81
              element.find('[data-media-element]').count()) {
82
            return { mediaConfigureItem: CKEDITOR.TRISTATE_OFF };
83
          };
84
        });
85
      }
86

  
87
      // Add the toolbar button.
55 88
      editor.ui.addButton( 'Media',
56 89
      {
57 90
        label: 'Add media',
......
83 116
        CKEDITOR.dtd.$object['mediawrapper'] = 1;
84 117
      }
85 118
      function prepareDataForWysiwygMode(data) {
86
        data = Drupal.media.filter.replaceTokenWithPlaceholder(data);
119
        if (typeof Drupal.media !== 'undefined') {
120
          data = Drupal.media.filter.replaceTokenWithPlaceholder(data);
121
        }
87 122
        // Legacy media wrapper.
88 123
        mediaPluginDefinition.mediaLegacyWrappers = (data.indexOf("<!--MEDIA-WRAPPER-START-") !== -1);
89 124
        if (mediaPluginDefinition.mediaLegacyWrappers) {
......
98 133
          replacement = '<!--MEDIA-WRAPPER-START-$1-->$2<!--MEDIA-WRAPPER-END-$1-->';
99 134
        }
100 135
        data = data.replace(/<mediawrapper data="(.*?)">(.*?)<\/mediawrapper>/gi, replacement);
101
        data = Drupal.media.filter.replacePlaceholderWithToken(data);
136
        if (typeof Drupal.media !== 'undefined') {
137
          data = Drupal.media.filter.replacePlaceholderWithToken(data);
138
        }
102 139
        return data;
103 140
      }
104 141

  
......
126 163
              return new CKEDITOR.htmlParser.text(token);
127 164
            }
128 165
            return false;
166
          },
167

  
168
          init: function() {
169
            // Add double-click functionality to the widget.
170
            this.on('doubleclick', function(evt) {
171
              editor.execCommand('media');
172
            }, null, null, 5 );
129 173
          }
130 174
        });
131 175
      }
......
214 258
      }
215 259
    }
216 260
  };
217
  // Add dependency to widget plugin if possible.
218
  if (parseFloat(CKEDITOR.version) >= 4.3 && mediaPluginDefinition.hasWidgetSupport) {
219
    mediaPluginDefinition.requires.push('widget');
220
  }
261

  
221 262
  CKEDITOR.plugins.add( 'media', mediaPluginDefinition);
222 263
} )();
drupal7/sites/all/modules/media_ckeditor/media_ckeditor.info
15 15
test_dependencies[] = views
16 16
test_dependencies[] = ctools
17 17

  
18
; Information added by Drupal.org packaging script on 2016-11-24
19
version = "7.x-2.0-alpha3"
18
; Information added by Drupal.org packaging script on 2016-12-09
19
version = "7.x-2.0-alpha4"
20 20
core = "7.x"
21 21
project = "media_ckeditor"
22
datestamp = "1480000683"
22
datestamp = "1481300314"
23 23

  
drupal7/sites/all/modules/media_ckeditor/media_ckeditor.install
1
<?php
2

  
3
/**
4
 * @file
5
 * Install tasks for media_ckeditor.
6
 */
7

  
8
/**
9
 * Implements hook_install().
10
 */
11
function media_ckeditor_install() {
12
  // Get all the CKEditor profiles for a site.
13
  $ckeditor_profiles = db_query("SELECT * FROM {ckeditor_settings}
14
    WHERE name <> :name",
15
    array(':name' => 'CKEditor Global Profile'))
16
    ->fetchAllAssoc('name');
17
  // Get the path to the module.
18
  $mod_path = drupal_get_path('module', 'media_ckeditor');
19
  foreach ((array) $ckeditor_profiles as $profile) {
20
    // Get the name of the profile.
21
    $name = $profile->name;
22
    // Unserialize all the settings for that profile.
23
    $profile_settings = unserialize($profile->settings);
24
    // Check to see if the profile is using plugins.
25
    if (isset($profile_settings['loadPlugins'])) {
26
      // Loop over each plugin.
27
      foreach ((array) $profile_settings['loadPlugins'] as $i => $plugin) {
28
        // Check if the media plugin is used.
29
        if ($i === 'media') {
30
          // Update the path variable to the new path.
31
          $plugin['path'] = '%base_path%' . $mod_path . '/js/plugins/media/';
32
          // Update the plugin with the new path overriding anything that was there before.
33
          $profile_settings['loadPlugins'][$i] = $plugin;
34
        }
35
      }
36
    }
37
    // Serialize the settings array before saving back into the database.
38
    $profile_settings = serialize($profile_settings);
39
    // Update the ckeditor settings for that profile name.
40
    db_query("UPDATE {ckeditor_settings} set settings = :settings WHERE name = :name",
41
      array(
42
        ':settings' => $profile_settings,
43
        ':name' => $name,
44
      ));
45
  }
46
}
47

  
48
/**
49
 * Updates the path to the Media plugin if used. *.
50
 */
51
function media_ckeditor_update_7201() {
52
  // Get all the CKEditor profiles for a site.
53
  $ckeditor_profiles = db_query("SELECT * FROM {ckeditor_settings}
54
    WHERE name <> :name",
55
    array(':name' => 'CKEditor Global Profile'))
56
    ->fetchAllAssoc('name');
57
  // Get the path to the module.
58
  $mod_path = drupal_get_path('module', 'media_ckeditor');
59
  foreach ((array) $ckeditor_profiles as $profile) {
60
    // Get the name of the profile.
61
    $name = $profile->name;
62
    // Unserialize all the settings for that profile.
63
    $profile_settings = unserialize($profile->settings);
64
    // Check to see if the profile is using plugins.
65
    if (isset($profile_settings['loadPlugins'])) {
66
      // Loop over each plugin.
67
      foreach ((array) $profile_settings['loadPlugins'] as $i => $plugin) {
68
        // Check if the media plugin is used.
69
        if ($i === 'media') {
70
          // Update the path variable to the new path.
71
          $plugin['path'] = '%base_path%' . $mod_path . '/js/plugins/media/';
72
          // Update the plugin with the new path overriding anything that was there before.
73
          $profile_settings['loadPlugins'][$i] = $plugin;
74
        }
75
      }
76
    }
77
    // Serialize the settings array before saving back into the database.
78
    $profile_settings = serialize($profile_settings);
79
    // Update the ckeditor settings for that profile name.
80
    db_query("UPDATE {ckeditor_settings} set settings = :settings WHERE name = :name",
81
      array(
82
        ':settings' => $profile_settings,
83
        ':name' => $name,
84
      ));
85
  }
86
}
drupal7/sites/all/modules/media_ckeditor/tests/media_ckeditor_test.info
5 5
hidden = FALSE
6 6

  
7 7

  
8
; Information added by Drupal.org packaging script on 2016-11-24
9
version = "7.x-2.0-alpha3"
8
; Information added by Drupal.org packaging script on 2016-12-09
9
version = "7.x-2.0-alpha4"
10 10
core = "7.x"
11 11
project = "media_ckeditor"
12
datestamp = "1480000683"
12
datestamp = "1481300314"
13 13

  

Formats disponibles : Unified diff