diff --git a/apps/files_external/settings.php b/apps/files_external/settings.php
index 4c87360486a7..e49eba06731b 100644
--- a/apps/files_external/settings.php
+++ b/apps/files_external/settings.php
@@ -25,8 +25,8 @@
OCP\Util::addScript('files_external', 'settings');
OCP\Util::addStyle('files_external', 'settings');
-OCP\Util::addScript('files_external', '../3rdparty/select2/select2');
-OCP\Util::addStyle('files_external', '../3rdparty/select2/select2');
+OCP\Util::addScript('core', 'select2/select2');
+OCP\Util::addStyle('core', 'select2/select2');
$backends = OC_Mount_Config::getBackends();
$personal_backends = array();
diff --git a/apps/files_external/3rdparty/select2/select2-spinner.gif b/core/css/select2/select2-spinner.gif
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2-spinner.gif
rename to core/css/select2/select2-spinner.gif
diff --git a/apps/files_external/3rdparty/select2/select2.css b/core/css/select2/select2.css
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2.css
rename to core/css/select2/select2.css
diff --git a/apps/files_external/3rdparty/select2/select2.png b/core/css/select2/select2.png
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2.png
rename to core/css/select2/select2.png
diff --git a/apps/files_external/3rdparty/select2/select2x2.png b/core/css/select2/select2x2.png
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2x2.png
rename to core/css/select2/select2x2.png
diff --git a/core/css/styles.css b/core/css/styles.css
index 64b37c89b0b2..952e935ec465 100644
--- a/core/css/styles.css
+++ b/core/css/styles.css
@@ -139,6 +139,18 @@ input[type="time"] {
-moz-box-sizing: border-box; box-sizing: border-box;
}
+.select2-choices {
+ border: 1px solid #ddd;
+ border-radius: 3px;
+ color: #333;
+ background-image: none;
+}
+.select2-dropdown-open .select2-choices {
+ border-bottom-left-radius: 0;
+ border-bottom-right-radius: 0;
+ border: 1px solid #3875d7;
+}
+
/* correctly align images inside of buttons */
input img, button img, .button img {
vertical-align: text-bottom;
diff --git a/apps/files_external/3rdparty/select2/LICENSE b/core/js/select2/LICENSE
similarity index 100%
rename from apps/files_external/3rdparty/select2/LICENSE
rename to core/js/select2/LICENSE
diff --git a/apps/files_external/3rdparty/select2/README.md b/core/js/select2/README.md
similarity index 100%
rename from apps/files_external/3rdparty/select2/README.md
rename to core/js/select2/README.md
diff --git a/apps/files_external/3rdparty/select2/bower.json b/core/js/select2/bower.json
similarity index 100%
rename from apps/files_external/3rdparty/select2/bower.json
rename to core/js/select2/bower.json
diff --git a/apps/files_external/3rdparty/select2/component.json b/core/js/select2/component.json
similarity index 100%
rename from apps/files_external/3rdparty/select2/component.json
rename to core/js/select2/component.json
diff --git a/apps/files_external/3rdparty/select2/composer.json b/core/js/select2/composer.json
similarity index 100%
rename from apps/files_external/3rdparty/select2/composer.json
rename to core/js/select2/composer.json
diff --git a/apps/files_external/3rdparty/select2/package.json b/core/js/select2/package.json
similarity index 100%
rename from apps/files_external/3rdparty/select2/package.json
rename to core/js/select2/package.json
diff --git a/apps/files_external/3rdparty/select2/release.sh b/core/js/select2/release.sh
similarity index 100%
rename from apps/files_external/3rdparty/select2/release.sh
rename to core/js/select2/release.sh
diff --git a/apps/files_external/3rdparty/select2/select2-bootstrap.css b/core/js/select2/select2-bootstrap.css
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2-bootstrap.css
rename to core/js/select2/select2-bootstrap.css
diff --git a/apps/files_external/3rdparty/select2/select2.jquery.json b/core/js/select2/select2.jquery.json
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2.jquery.json
rename to core/js/select2/select2.jquery.json
diff --git a/apps/files_external/3rdparty/select2/select2.js b/core/js/select2/select2.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2.js
rename to core/js/select2/select2.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_ar.js b/core/js/select2/select2_locale_ar.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_ar.js
rename to core/js/select2/select2_locale_ar.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_bg.js b/core/js/select2/select2_locale_bg.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_bg.js
rename to core/js/select2/select2_locale_bg.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_ca.js b/core/js/select2/select2_locale_ca.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_ca.js
rename to core/js/select2/select2_locale_ca.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_cs.js b/core/js/select2/select2_locale_cs.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_cs.js
rename to core/js/select2/select2_locale_cs.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_da.js b/core/js/select2/select2_locale_da.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_da.js
rename to core/js/select2/select2_locale_da.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_de.js b/core/js/select2/select2_locale_de.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_de.js
rename to core/js/select2/select2_locale_de.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_el.js b/core/js/select2/select2_locale_el.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_el.js
rename to core/js/select2/select2_locale_el.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_en.js.template b/core/js/select2/select2_locale_en.js.template
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_en.js.template
rename to core/js/select2/select2_locale_en.js.template
diff --git a/apps/files_external/3rdparty/select2/select2_locale_es.js b/core/js/select2/select2_locale_es.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_es.js
rename to core/js/select2/select2_locale_es.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_et.js b/core/js/select2/select2_locale_et.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_et.js
rename to core/js/select2/select2_locale_et.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_eu.js b/core/js/select2/select2_locale_eu.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_eu.js
rename to core/js/select2/select2_locale_eu.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_fa.js b/core/js/select2/select2_locale_fa.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_fa.js
rename to core/js/select2/select2_locale_fa.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_fi.js b/core/js/select2/select2_locale_fi.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_fi.js
rename to core/js/select2/select2_locale_fi.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_fr.js b/core/js/select2/select2_locale_fr.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_fr.js
rename to core/js/select2/select2_locale_fr.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_gl.js b/core/js/select2/select2_locale_gl.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_gl.js
rename to core/js/select2/select2_locale_gl.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_he.js b/core/js/select2/select2_locale_he.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_he.js
rename to core/js/select2/select2_locale_he.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_hr.js b/core/js/select2/select2_locale_hr.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_hr.js
rename to core/js/select2/select2_locale_hr.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_hu.js b/core/js/select2/select2_locale_hu.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_hu.js
rename to core/js/select2/select2_locale_hu.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_id.js b/core/js/select2/select2_locale_id.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_id.js
rename to core/js/select2/select2_locale_id.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_is.js b/core/js/select2/select2_locale_is.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_is.js
rename to core/js/select2/select2_locale_is.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_it.js b/core/js/select2/select2_locale_it.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_it.js
rename to core/js/select2/select2_locale_it.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_ja.js b/core/js/select2/select2_locale_ja.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_ja.js
rename to core/js/select2/select2_locale_ja.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_ka.js b/core/js/select2/select2_locale_ka.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_ka.js
rename to core/js/select2/select2_locale_ka.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_ko.js b/core/js/select2/select2_locale_ko.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_ko.js
rename to core/js/select2/select2_locale_ko.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_lt.js b/core/js/select2/select2_locale_lt.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_lt.js
rename to core/js/select2/select2_locale_lt.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_lv.js b/core/js/select2/select2_locale_lv.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_lv.js
rename to core/js/select2/select2_locale_lv.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_mk.js b/core/js/select2/select2_locale_mk.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_mk.js
rename to core/js/select2/select2_locale_mk.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_ms.js b/core/js/select2/select2_locale_ms.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_ms.js
rename to core/js/select2/select2_locale_ms.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_nl.js b/core/js/select2/select2_locale_nl.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_nl.js
rename to core/js/select2/select2_locale_nl.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_no.js b/core/js/select2/select2_locale_no.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_no.js
rename to core/js/select2/select2_locale_no.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_pl.js b/core/js/select2/select2_locale_pl.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_pl.js
rename to core/js/select2/select2_locale_pl.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_pt-BR.js b/core/js/select2/select2_locale_pt-BR.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_pt-BR.js
rename to core/js/select2/select2_locale_pt-BR.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_pt-PT.js b/core/js/select2/select2_locale_pt-PT.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_pt-PT.js
rename to core/js/select2/select2_locale_pt-PT.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_ro.js b/core/js/select2/select2_locale_ro.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_ro.js
rename to core/js/select2/select2_locale_ro.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_rs.js b/core/js/select2/select2_locale_rs.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_rs.js
rename to core/js/select2/select2_locale_rs.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_ru.js b/core/js/select2/select2_locale_ru.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_ru.js
rename to core/js/select2/select2_locale_ru.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_sk.js b/core/js/select2/select2_locale_sk.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_sk.js
rename to core/js/select2/select2_locale_sk.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_sv.js b/core/js/select2/select2_locale_sv.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_sv.js
rename to core/js/select2/select2_locale_sv.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_th.js b/core/js/select2/select2_locale_th.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_th.js
rename to core/js/select2/select2_locale_th.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_tr.js b/core/js/select2/select2_locale_tr.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_tr.js
rename to core/js/select2/select2_locale_tr.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_uk.js b/core/js/select2/select2_locale_uk.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_uk.js
rename to core/js/select2/select2_locale_uk.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_vi.js b/core/js/select2/select2_locale_vi.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_vi.js
rename to core/js/select2/select2_locale_vi.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_zh-CN.js b/core/js/select2/select2_locale_zh-CN.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_zh-CN.js
rename to core/js/select2/select2_locale_zh-CN.js
diff --git a/apps/files_external/3rdparty/select2/select2_locale_zh-TW.js b/core/js/select2/select2_locale_zh-TW.js
similarity index 100%
rename from apps/files_external/3rdparty/select2/select2_locale_zh-TW.js
rename to core/js/select2/select2_locale_zh-TW.js
diff --git a/settings/admin.php b/settings/admin.php
index 65deed6b8835..6b93e6e3f03c 100755
--- a/settings/admin.php
+++ b/settings/admin.php
@@ -7,10 +7,13 @@
OC_Util::checkAdminUser();
-OC_Util::addStyle( "settings", "settings" );
+OCP\Util::addStyle('settings', 'settings');
+OCP\Util::addScript('settings', 'settings');
OC_Util::addScript( "settings", "admin" );
OC_Util::addScript( "settings", "log" );
OC_Util::addScript( 'core', 'multiselect' );
+OCP\Util::addScript('core', 'select2/select2');
+OCP\Util::addStyle('core', 'select2/select2');
OC_App::setActiveNavigationEntry( "admin" );
$tmpl = new OC_Template( 'settings', 'admin', 'user');
@@ -54,22 +57,9 @@
$tmpl->assign('shareEnforceExpireDate', OC_Appconfig::getValue('core', 'shareapi_enforce_expire_date', 'no'));
$excludeGroups = OC_Appconfig::getValue('core', 'shareapi_exclude_groups', 'no') === 'yes' ? true : false;
$tmpl->assign('shareExcludeGroups', $excludeGroups);
-$allGroups = OC_Group::getGroups();
$excludedGroupsList = OC_Appconfig::getValue('core', 'shareapi_exclude_groups_list', '');
-$excludedGroups = $excludedGroupsList !== '' ? explode(',', $excludedGroupsList) : array();
-$groups = array();
-foreach ($allGroups as $group) {
- if (in_array($group, $excludedGroups)) {
- $groups[$group] = array('gid' => $group,
- 'excluded' => true);
- } else {
- $groups[$group] = array('gid' => $group,
- 'excluded' => false);
- }
-}
-ksort($groups);
-$tmpl->assign('groups', $groups);
-
+$excludedGroupsList = explode(',', $excludedGroupsList); // FIXME: this should be JSON!
+$tmpl->assign('shareExcludedGroupsList', implode('|', $excludedGroupsList));
// Check if connected using HTTPS
$tmpl->assign('isConnectedViaHTTPS', OC_Request::serverProtocol() === 'https');
diff --git a/settings/ajax/excludegroups.php b/settings/ajax/excludegroups.php
deleted file mode 100644
index c3488c5bae7e..000000000000
--- a/settings/ajax/excludegroups.php
+++ /dev/null
@@ -1,18 +0,0 @@
-assign('apps', $combinedApps);
-$tmpl->assign('groups', $groups);
$appid = (isset($_GET['appid'])?strip_tags($_GET['appid']):'');
diff --git a/settings/js/admin.js b/settings/js/admin.js
index 56dc1b987166..95be13d22886 100644
--- a/settings/js/admin.js
+++ b/settings/js/admin.js
@@ -1,42 +1,3 @@
-var SharingGroupList = {
- applyMultipleSelect: function(element) {
- var checked = [];
- if ($(element).hasClass('groupsselect')) {
- if (element.data('userGroups')) {
- checked = element.data('userGroups');
- }
- var checkHandeler = function(group) {
- $.post(OC.filePath('settings', 'ajax', 'excludegroups.php'),
- {changedGroup: group, selectedGroups: JSON.stringify(checked)},
- function() {});
- };
-
-
- var addGroup = function(select, group) {
- $(this).each(function(index, element) {
- if ($(element).find('option[value="' + group + '"]').length === 0 &&
- select.data('msid') !== $(element).data('msid')) {
- $(element).append('');
- }
- });
- };
-
- var label = null;
- element.multiSelect({
- createCallback: addGroup,
- createText: label,
- selectedFirst: true,
- checked: checked,
- oncheck: checkHandeler,
- onuncheck: checkHandeler,
- minWidth: 100
- });
-
- }
- }
-};
-
$(document).ready(function(){
var params = OC.Util.History.parseUrlQuery();
@@ -57,8 +18,17 @@ $(document).ready(function(){
}
- $('select#excludedGroups[multiple]').each(function (index, element) {
- SharingGroupList.applyMultipleSelect($(element));
+ $('#excludedGroups').each(function (index, element) {
+ OC.Settings.setupGroupsSelect($(element));
+ $(element).change(function(ev) {
+ var groups = ev.val || [];
+ if (groups.length > 0) {
+ groups = ev.val.join(','); // FIXME: make this JSON
+ } else {
+ groups = '';
+ }
+ OC.AppConfig.setValue('core', $(this).attr('name'), groups);
+ });
});
@@ -81,7 +51,7 @@ $(document).ready(function(){
$('#shareAPI p:not(#enable)').toggleClass('hidden', !this.checked);
});
- $('#shareAPI input').change(function() {
+ $('#shareAPI input:not(#excludedGroups)').change(function() {
if ($(this).attr('type') === 'checkbox') {
if (this.checked) {
var value = 'yes';
diff --git a/settings/js/apps.js b/settings/js/apps.js
index e808e51e936d..22bac1eaf3eb 100644
--- a/settings/js/apps.js
+++ b/settings/js/apps.js
@@ -7,6 +7,11 @@
OC.Settings = OC.Settings || {};
OC.Settings.Apps = OC.Settings.Apps || {
+ setupGroupsSelect: function() {
+ OC.Settings.setupGroupsSelect($('#group_select'), {
+ placeholder: t('core', 'All')
+ });
+ },
loadApp:function(app) {
var page = $('#app-content');
page.find('p.license').show();
@@ -112,23 +117,16 @@ OC.Settings.Apps = OC.Settings.Apps || {
page.find(".warning").hide();
}
- page.find("div.multiselect").parent().remove();
if(OC.Settings.Apps.isType(app, 'filesystem') || OC.Settings.Apps.isType(app, 'prelogin') ||
OC.Settings.Apps.isType(app, 'authentication') || OC.Settings.Apps.isType(app, 'logging')) {
page.find("#groups_enable").hide();
page.find("label[for='groups_enable']").hide();
page.find("#groups_enable").attr('checked', null);
} else {
- $('#group_select > option').each(function (i, el) {
- if (app.groups.length === 0 || app.groups.indexOf(el.value) >= 0) {
- $(el).attr('selected', 'selected');
- } else {
- $(el).attr('selected', null);
- }
- });
if (app.active) {
if (app.groups.length) {
- $('#group_select').multiSelect();
+ OC.Settings.Apps.setupGroupsSelect();
+ $('#group_select').select2('val', app.groups || []);
page.find("#groups_enable").attr('checked','checked');
} else {
page.find("#groups_enable").attr('checked', null);
@@ -380,9 +378,10 @@ $(document).ready(function(){
}
});
- $('#group_select').change(function() {
+ $('#group_select').change(function(ev) {
var element = $('#app-content input.enable');
- var groups = $(this).val();
+ // getting an array of values from select2
+ var groups = ev.val || [];
var appid = element.data('appid');
if (appid) {
OC.Settings.Apps.enableApp(appid, false, element, groups);
@@ -404,14 +403,14 @@ $(document).ready(function(){
}
$("#groups_enable").change(function() {
+ var $select = $('#group_select');
+ $select.val('');
if (this.checked) {
- $("div.multiselect").parent().remove();
- $('#group_select').multiSelect();
- } else {
- $('#group_select').hide().val(null);
- $("div.multiselect").parent().remove();
+ OC.Settings.Apps.setupGroupsSelect();
}
-
- $('#group_select').change();
+ else {
+ $select.select2('destroy');
+ }
+ $select.change();
});
});
diff --git a/settings/js/settings.js b/settings/js/settings.js
new file mode 100644
index 000000000000..13c56a8f53aa
--- /dev/null
+++ b/settings/js/settings.js
@@ -0,0 +1,98 @@
+/**
+ * Copyright (c) 2014, Vincent Petry
-
+
t('These groups will still be able to receive shares, but not to initiate them.')); ?>