From 4954e46bb2ba36c749b638111dc90500e12cedf7 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Wed, 15 Aug 2012 17:38:55 +0200 Subject: Use core routes in js too --- core/js/js.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/js/js.js') diff --git a/core/js/js.js b/core/js/js.js index 7bded8e1414..6881090f62e 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -54,9 +54,9 @@ OC={ var isCore=OC.coreApps.indexOf(app)!=-1; var link=OC.webroot; if((file.substring(file.length-3) == 'php' || file.substring(file.length-3) == 'css') && !isCore){ - link+='/?app=' + app; + link+='/index.php/apps/' + app; if (file != 'index.php') { - link+='&getfile='; + link+='/'; if(type){ link+=encodeURI(type + '/'); } -- cgit v1.2.3 From bb136b9adf021cb154ff05222d3439373312bbc5 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Sat, 29 Sep 2012 18:08:54 +0200 Subject: Make the settings ajax calls use the router --- core/js/js.js | 7 ++++- core/routes.php | 14 +-------- settings/ajax/apps/ocs.php | 3 -- settings/ajax/changepassword.php | 2 -- settings/ajax/creategroup.php | 2 -- settings/ajax/createuser.php | 2 -- settings/ajax/disableapp.php | 2 -- settings/ajax/enableapp.php | 2 -- settings/ajax/getlog.php | 3 -- settings/ajax/lostpassword.php | 2 -- settings/ajax/openid.php | 3 -- settings/ajax/removegroup.php | 3 -- settings/ajax/removeuser.php | 3 -- settings/ajax/setlanguage.php | 3 -- settings/ajax/setloglevel.php | 1 - settings/ajax/setquota.php | 3 -- settings/ajax/togglegroups.php | 3 -- settings/ajax/togglesubadmins.php | 5 +--- settings/ajax/userlist.php | 4 +-- settings/js/users.js | 2 +- settings/routes.php | 62 +++++++++++++++++++++++++++++++++++++++ 21 files changed, 72 insertions(+), 59 deletions(-) create mode 100644 settings/routes.php (limited to 'core/js/js.js') diff --git a/core/js/js.js b/core/js/js.js index 39a58a24599..ffe3507a4eb 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -88,7 +88,12 @@ var OC={ } link+=file; }else{ - link+='/'; + if (app == 'settings' && type == 'ajax') { + link+='/index.php/'; + } + else { + link+='/'; + } if(!isCore){ link+='apps/'; } diff --git a/core/routes.php b/core/routes.php index 9a84eb64a3b..b0f41dd2861 100644 --- a/core/routes.php +++ b/core/routes.php @@ -6,19 +6,7 @@ * See the COPYING-README file. */ -// Core settings pages -$this->create('settings_help', '/settings/help') - ->actionInclude('settings/help.php'); -$this->create('settings_personal', '/settings/personal') - ->actionInclude('settings/personal.php'); -$this->create('settings_settings', '/settings') - ->actionInclude('settings/settings.php'); -$this->create('settings_users', '/settings/users') - ->actionInclude('settings/users.php'); -$this->create('settings_apps', '/settings/apps') - ->actionInclude('settings/apps.php'); -$this->create('settings_admin', '/settings/admin') - ->actionInclude('settings/admin.php'); +require_once('settings/routes.php'); // Not specifically routed $this->create('app_css', '/apps/{app}/{file}') diff --git a/settings/ajax/apps/ocs.php b/settings/ajax/apps/ocs.php index fb78cc89248..4d6f1116e7d 100644 --- a/settings/ajax/apps/ocs.php +++ b/settings/ajax/apps/ocs.php @@ -6,9 +6,6 @@ * See the COPYING-README file. */ -// Init owncloud -require_once '../../../lib/base.php'; - OC_JSON::checkAdminUser(); $l = OC_L10N::get('settings'); diff --git a/settings/ajax/changepassword.php b/settings/ajax/changepassword.php index b251fea504b..200fdec26de 100644 --- a/settings/ajax/changepassword.php +++ b/settings/ajax/changepassword.php @@ -1,7 +1,5 @@ OC_Preferences::getValue($user, 'files', 'quota', 'default')); } } -OC_JSON::success(array('data' => $users)); \ No newline at end of file +OC_JSON::success(array('data' => $users)); diff --git a/settings/js/users.js b/settings/js/users.js index 20bd94993bc..81a3181ba59 100644 --- a/settings/js/users.js +++ b/settings/js/users.js @@ -130,7 +130,7 @@ var UserList={ if (typeof UserList.offset === 'undefined') { UserList.offset = $('tbody tr').length; } - $.get(OC.filePath('settings', 'ajax', 'userlist.php'), { offset: UserList.offset }, function(result) { + $.get(OC.filePath('settings', 'ajax', 'userlist'), { offset: UserList.offset }, function(result) { if (result.status === 'success') { $.each(result.data, function(index, user) { var tr = UserList.add(user.name, user.groups, user.subadmin, user.quota, false); diff --git a/settings/routes.php b/settings/routes.php new file mode 100644 index 00000000000..b64a357be0e --- /dev/null +++ b/settings/routes.php @@ -0,0 +1,62 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +// Settings pages +$this->create('settings_help', '/settings/help') + ->actionInclude('settings/help.php'); +$this->create('settings_personal', '/settings/personal') + ->actionInclude('settings/personal.php'); +$this->create('settings_settings', '/settings') + ->actionInclude('settings/settings.php'); +$this->create('settings_users', '/settings/users') + ->actionInclude('settings/users.php'); +$this->create('settings_apps', '/settings/apps') + ->actionInclude('settings/apps.php'); +$this->create('settings_admin', '/settings/admin') + ->actionInclude('settings/admin.php'); +// Settings ajax actions +// users +$this->create('settings_admin', '/settings/ajax/userlist') + ->actionInclude('settings/ajax/userlist.php'); +$this->create('settings_ajax_createuser', '/settings/ajax/createuser.php') + ->actionInclude('settings_ajax_createuser'); +$this->create('settings_ajax_removeuser', '/settings/ajax/removeuser.php') + ->actionInclude('settings/ajax/removeuser.php'); +$this->create('settings_ajax_setquota', '/settings/ajax/setquota.php') + ->actionInclude('settings/ajax/setquota.php'); +$this->create('settings_ajax_creategroup', '/settings/ajax/creategroup.php') + ->actionInclude('settings_ajax_creategroup'); +$this->create('settings_ajax_togglegroups', '/settings/ajax/togglegroups.php') + ->actionInclude('settings/ajax/togglegroups.php'); +$this->create('settings_ajax_togglesubadmins', '/settings/ajax/togglesubadmins.php') + ->actionInclude('settings/ajax/togglesubadmins.php'); +$this->create('settings_ajax_removegroup', '/settings/ajax/removegroup.php') + ->actionInclude('settings/ajax/removegroup.php'); +$this->create('settings_ajax_changepassword', '/settings/ajax/changepassword.php') + ->actionInclude('settings/ajax/changepassword.php'); +// personel +$this->create('settings_ajax_lostpassword', '/settings/ajax/lostpassword.php') + ->actionInclude('settings/ajax/lostpassword.php'); +$this->create('settings_ajax_setlanguage', '/settings/ajax/setlanguage.php') + ->actionInclude('settings/ajax/setlanguage.php'); +// apps +$this->create('settings_ajax_apps_ocs', '/settings/ajax/apps/ocs.php') + ->actionInclude('settings/ajax/apps/ocs.php'); +$this->create('settings_ajax_enableapp', '/settings/ajax/enableapp.php') + ->actionInclude('settings/ajax/enableapp.php'); +$this->create('settings_ajax_disableapp', '/settings/ajax/disableapp.php') + ->actionInclude('settings/ajax/disableapp.php'); +// admin +$this->create('settings_ajax_getlog', '/settings/ajax/getlog.php') + ->actionInclude('settings/ajax/getlog.php'); +$this->create('settings_ajax_setloglevel', '/settings/ajax/setloglevel.php') + ->actionInclude('settings/ajax/setloglevel.php'); + +// apps/user_openid +$this->create('settings_ajax_openid', '/settings/ajax/openid.php') + ->actionInclude('settings/ajax/openid.php'); -- cgit v1.2.3 From de1bfe9d6b50c37c6999ff652a31535b0a2faf41 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Tue, 2 Oct 2012 21:57:51 +0200 Subject: Make the core ajax calls use the router --- core/ajax/appconfig.php | 1 - core/ajax/requesttoken.php | 1 - core/ajax/share.php | 1 - core/ajax/translations.php | 3 --- core/ajax/vcategories/add.php | 1 - core/ajax/vcategories/delete.php | 1 - core/ajax/vcategories/edit.php | 1 - core/js/js.js | 2 +- core/routes.php | 21 +++++++++++++++++++++ 9 files changed, 22 insertions(+), 10 deletions(-) (limited to 'core/js/js.js') diff --git a/core/ajax/appconfig.php b/core/ajax/appconfig.php index 1b43afa74fb..4f26dedc797 100644 --- a/core/ajax/appconfig.php +++ b/core/ajax/appconfig.php @@ -5,7 +5,6 @@ * See the COPYING-README file. */ -require_once "../../lib/base.php"; OC_Util::checkAdminUser(); OCP\JSON::callCheck(); diff --git a/core/ajax/requesttoken.php b/core/ajax/requesttoken.php index 96d5402e621..84089de8b9d 100644 --- a/core/ajax/requesttoken.php +++ b/core/ajax/requesttoken.php @@ -26,7 +26,6 @@ * @return json: success/error state indicator including a fresh request token * @author Christian Reiner */ -require_once '../../lib/base.php'; // don't load apps or filesystem for this task $RUNTIME_NOAPPS = TRUE; diff --git a/core/ajax/share.php b/core/ajax/share.php index 446d4cc32ec..b6f96bfd340 100644 --- a/core/ajax/share.php +++ b/core/ajax/share.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU Affero General Public * License along with this library. If not, see . */ -require_once '../../lib/base.php'; OC_JSON::checkLoggedIn(); OCP\JSON::callCheck(); diff --git a/core/ajax/translations.php b/core/ajax/translations.php index 75679da2c04..e22cbad4708 100644 --- a/core/ajax/translations.php +++ b/core/ajax/translations.php @@ -21,9 +21,6 @@ * */ -// Init owncloud -require_once '../../lib/base.php'; - $app = $_POST["app"]; $l = OC_L10N::get( $app ); diff --git a/core/ajax/vcategories/add.php b/core/ajax/vcategories/add.php index 81fa06dbf19..8d31275dbfb 100644 --- a/core/ajax/vcategories/add.php +++ b/core/ajax/vcategories/add.php @@ -14,7 +14,6 @@ function debug($msg) { OC_Log::write('core', 'ajax/vcategories/add.php: '.$msg, OC_Log::DEBUG); } -require_once '../../../lib/base.php'; OC_JSON::checkLoggedIn(); $category = isset($_GET['category'])?strip_tags($_GET['category']):null; $app = isset($_GET['app'])?$_GET['app']:null; diff --git a/core/ajax/vcategories/delete.php b/core/ajax/vcategories/delete.php index cd46a25b79d..74b0220870c 100644 --- a/core/ajax/vcategories/delete.php +++ b/core/ajax/vcategories/delete.php @@ -15,7 +15,6 @@ function debug($msg) { OC_Log::write('core', 'ajax/vcategories/delete.php: '.$msg, OC_Log::DEBUG); } -require_once '../../../lib/base.php'; OC_JSON::checkLoggedIn(); $app = isset($_POST['app'])?$_POST['app']:null; $categories = isset($_POST['categories'])?$_POST['categories']:null; diff --git a/core/ajax/vcategories/edit.php b/core/ajax/vcategories/edit.php index a0e67841c55..caeebcaa940 100644 --- a/core/ajax/vcategories/edit.php +++ b/core/ajax/vcategories/edit.php @@ -15,7 +15,6 @@ function debug($msg) { OC_Log::write('core', 'ajax/vcategories/edit.php: '.$msg, OC_Log::DEBUG); } -require_once '../../../lib/base.php'; OC_JSON::checkLoggedIn(); $app = isset($_GET['app'])?$_GET['app']:null; diff --git a/core/js/js.js b/core/js/js.js index ffe3507a4eb..8f3b5a6af1e 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -88,7 +88,7 @@ var OC={ } link+=file; }else{ - if (app == 'settings' && type == 'ajax') { + if ((app == 'settings' || app == 'core') && type == 'ajax') { link+='/index.php/'; } else { diff --git a/core/routes.php b/core/routes.php index b0f41dd2861..d396ddd6473 100644 --- a/core/routes.php +++ b/core/routes.php @@ -8,6 +8,27 @@ require_once('settings/routes.php'); +// Core ajax actions +// AppConfig +$this->create('core_ajax_appconfig', '/core/ajax/appconfig.php') + ->actionInclude('core/ajax/appconfig.php'); +// RequestToken +$this->create('core_ajax_requesttoken', '/core/ajax/requesttoken.php') + ->actionInclude('core/ajax/requesttoken.php'); +// Share +$this->create('core_ajax_share', '/core/ajax/share.php') + ->actionInclude('core/ajax/share.php'); +// Translations +$this->create('core_ajax_translations', '/core/ajax/translations.php') + ->actionInclude('core/ajax/translations.php'); +// VCategories +$this->create('core_ajax_vcategories_add', '/core/ajax/vcategories/add.php') + ->actionInclude('core/ajax/vcategories/add.php'); +$this->create('core_ajax_vcategories_delete', '/core/ajax/vcategories/delete.php') + ->actionInclude('core/ajax/vcategories/delete.php'); +$this->create('core_ajax_vcategories_edit', '/core/ajax/vcategories/edit.php') + ->actionInclude('core/ajax/vcategories/edit.php'); + // Not specifically routed $this->create('app_css', '/apps/{app}/{file}') ->requirements(array('file' => '.*.css')) -- cgit v1.2.3 From 41b597e179a694973c709613cdf41e2b379c8df9 Mon Sep 17 00:00:00 2001 From: scambra Date: Fri, 21 Sep 2012 08:33:26 +0200 Subject: Translate formatDate using jquery datepicker --- core/js/js.js | 4 +--- core/l10n/l10n-de.php | 1 + core/l10n/l10n-en.php | 1 + core/l10n/l10n-es.php | 1 + core/templates/layout.user.php | 1 + lib/l10n.php | 2 ++ 6 files changed, 7 insertions(+), 3 deletions(-) (limited to 'core/js/js.js') diff --git a/core/js/js.js b/core/js/js.js index ba8020c89ed..c5e32f3c278 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -667,9 +667,7 @@ function formatDate(date){ if(typeof date=='number'){ date=new Date(date); } - var monthNames = [ t('files','January'), t('files','February'), t('files','March'), t('files','April'), t('files','May'), t('files','June'), - t('files','July'), t('files','August'), t('files','September'), t('files','October'), t('files','November'), t('files','December') ]; - return monthNames[date.getMonth()]+' '+date.getDate()+', '+date.getFullYear()+', '+((date.getHours()<10)?'0':'')+date.getHours()+':'+((date.getMinutes()<10)?'0':'')+date.getMinutes(); + return $.datepicker.formatDate(datepickerFormatDate, date)+' '+date.getHours()+':'+((date.getMinutes()<10)?'0':'')+date.getMinutes(); } /** diff --git a/core/l10n/l10n-de.php b/core/l10n/l10n-de.php index d80c3beb2ba..77d35af4936 100644 --- a/core/l10n/l10n-de.php +++ b/core/l10n/l10n-de.php @@ -1,5 +1,6 @@ 'dd.mm.yy', 'date' => '%d.%m.%Y', 'datetime' => '%d.%m.%Y %H:%M:%S', 'time' => '%H:%M:%S', diff --git a/core/l10n/l10n-en.php b/core/l10n/l10n-en.php index 6268214b503..9ee748bee23 100644 --- a/core/l10n/l10n-en.php +++ b/core/l10n/l10n-en.php @@ -1,5 +1,6 @@ 'MM d, yy', 'date' => '%B %e, %Y', 'datetime' => '%B %e, %Y %H:%M', 'time' => '%H:%M:%S', diff --git a/core/l10n/l10n-es.php b/core/l10n/l10n-es.php index 8798b24d62f..13db2ec5d4c 100644 --- a/core/l10n/l10n-es.php +++ b/core/l10n/l10n-es.php @@ -1,5 +1,6 @@ "d 'de' MM 'de' yy", 'date' => '%e de %B de %Y', 'datetime' => '%e de %B de %Y %H:%M', 'time' => '%H:%M:%S', diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index 92d47cc51f8..1f16fdf7c6c 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -13,6 +13,7 @@ var oc_current_user = ''; var oc_requesttoken = ''; var oc_requestlifespan = ''; + var datepickerFormatDate = l('jsdate')) ?>; var dayNames = t('Sunday'), (string)$l->t('Monday'), (string)$l->t('Tuesday'), (string)$l->t('Wednesday'), (string)$l->t('Thursday'), (string)$l->t('Friday'), (string)$l->t('Saturday'))) ?>; var monthNames = t('January'), (string)$l->t('February'), (string)$l->t('March'), (string)$l->t('April'), (string)$l->t('May'), (string)$l->t('June'), (string)$l->t('July'), (string)$l->t('August'), (string)$l->t('September'), (string)$l->t('October'), (string)$l->t('November'), (string)$l->t('December'))) ?>; var firstDay = l('firstday')) ?>; diff --git a/lib/l10n.php b/lib/l10n.php index 72ac9e353d8..18706e4b4a5 100644 --- a/lib/l10n.php +++ b/lib/l10n.php @@ -58,6 +58,7 @@ class OC_L10N{ * Localization */ private $localizations = array( + 'jsdate' => 'dd.mm.yy', 'date' => '%d.%m.%Y', 'datetime' => '%d.%m.%Y %H:%M:%S', 'time' => '%H:%M:%S', @@ -223,6 +224,7 @@ class OC_L10N{ return strftime($this->localizations[$type], $data); break; case 'firstday': + case 'jsdate': return $this->localizations[$type]; default: return false; -- cgit v1.2.3 From 939b51e46f23fe6f5991a05862da94bb3adff1ab Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Sat, 27 Oct 2012 15:10:21 +0200 Subject: Fix download url generation --- apps/files/js/fileactions.js | 2 +- core/js/js.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'core/js/js.js') diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index 0cf4a052225..1cf80352bef 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -157,7 +157,7 @@ $(document).ready(function(){ var downloadScope = 'file'; } FileActions.register(downloadScope,'Download', OC.PERMISSION_READ, function(){return OC.imagePath('core','actions/download');},function(filename){ - window.location=OC.filePath('files', 'ajax', 'download.php') + '&files='+encodeURIComponent(filename)+'&dir='+encodeURIComponent($('#dir').val()); + window.location=OC.filePath('files', 'ajax', 'download.php') + '?files='+encodeURIComponent(filename)+'&dir='+encodeURIComponent($('#dir').val()); }); }); diff --git a/core/js/js.js b/core/js/js.js index 130d413296e..6ed50b42bd5 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -62,7 +62,7 @@ function escapeHTML(s) { * @return string */ function fileDownloadPath(dir, file) { - return OC.filePath('files', 'ajax', 'download.php')+'&files='+encodeURIComponent(file)+'&dir='+encodeURIComponent(dir); + return OC.filePath('files', 'ajax', 'download.php')+'?files='+encodeURIComponent(file)+'&dir='+encodeURIComponent(dir); } var OC={ -- cgit v1.2.3 From a6f3a570c68440eeb51d8b25cf7a1cef0f723a15 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Sat, 27 Oct 2012 19:42:25 +0200 Subject: dont resize content div with javascript but use css box-sizing to do it --- core/css/styles.css | 9 ++++++++- core/js/js.js | 36 ------------------------------------ 2 files changed, 8 insertions(+), 37 deletions(-) (limited to 'core/js/js.js') diff --git a/core/css/styles.css b/core/css/styles.css index 677d44658e8..1fc958940cc 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -56,7 +56,14 @@ input[type="submit"].highlight{ background:#ffc100; border:1px solid #db0; text- /* CONTENT ------------------------------------------------------------------ */ #controls { padding: 0 0.5em; width:100%; top:3.5em; height:2.8em; margin:0; background:#f7f7f7; border-bottom:1px solid #eee; position:fixed; z-index:50; -moz-box-shadow:0 -3px 7px #000; -webkit-box-shadow:0 -3px 7px #000; box-shadow:0 -3px 7px #000; } #controls .button { display:inline-block; } -#content { top:3.5em; left:64px; position: absolute; } +#content { + height: 100%; + width: 100%; + padding-top: 3.5em; + padding-left: 64px; + box-sizing: border-box; + -moz-box-sizing: border-box; +} #leftcontent, .leftcontent { position:fixed; overflow: auto; top:6.4em; width:20em; background:#f8f8f8; border-right:1px solid #ddd; } #leftcontent li, .leftcontent li { background:#f8f8f8; padding:.5em .8em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; -webkit-transition:background-color 200ms; -moz-transition:background-color 200ms; -o-transition:background-color 200ms; transition:background-color 200ms; } #leftcontent li:hover, #leftcontent li:active, #leftcontent li.active, .leftcontent li:hover, .leftcontent li:active, .leftcontent li.active { background:#eee; } diff --git a/core/js/js.js b/core/js/js.js index c5e32f3c278..3bc988a2b6e 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -464,44 +464,8 @@ function object(o) { } -/** - * Fills height of window. (more precise than height: 100%;) - */ -function fillHeight(selector) { - if (selector.length === 0) { - return; - } - var height = parseFloat($(window).height())-selector.offset().top; - selector.css('height', height + 'px'); - if(selector.outerHeight() > selector.height()){ - selector.css('height', height-(selector.outerHeight()-selector.height()) + 'px'); - } -} - -/** - * Fills height and width of window. (more precise than height: 100%; or width: 100%;) - */ -function fillWindow(selector) { - if (selector.length === 0) { - return; - } - fillHeight(selector); - var width = parseFloat($(window).width())-selector.offset().left; - selector.css('width', width + 'px'); - if(selector.outerWidth() > selector.width()){ - selector.css('width', width-(selector.outerWidth()-selector.width()) + 'px'); - } -} - $(document).ready(function(){ - $(window).resize(function () { - fillHeight($('#leftcontent')); - fillWindow($('#content')); - fillWindow($('#rightcontent')); - }); - $(window).trigger('resize'); - if(!SVGSupport()){ //replace all svg images with png images for browser that dont support svg replaceSVG(); }else{ -- cgit v1.2.3 From 71435ac1ccdceb75342202c86a763b4f3f7c8b0e Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Sun, 28 Oct 2012 16:47:25 +0100 Subject: improve user menu --- core/css/styles.css | 7 ++++--- core/js/js.js | 4 +--- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'core/js/js.js') diff --git a/core/css/styles.css b/core/css/styles.css index 677d44658e8..bacb6367e86 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -106,9 +106,10 @@ label.infield { cursor: text !important; } #expand:hover, #expand:focus, #expand:active { color:#fff; } #expand img { opacity:.5; margin-bottom:-2px; } #expand:hover img, #expand:focus img, #expand:active img { opacity:1; } -#expanddiv { position:absolute; right:0; background-color:rgb(29, 45, 68); } -#expanddiv a { color:#ccc; padding:5px 8px; } -#expanddiv a:hover, #expanddiv a:focus, #expanddiv a:active { color:#fff; } +#expanddiv { position:absolute; right:0; top:45px; background-color:#eee; border-bottom-left-radius:7px; box-shadow: 0 0 20px #888888; z-index:76; } +#expanddiv a { display:block; color:#222; text-shadow:0 1px 0 #fff; padding:0 8px; } +#expanddiv a img { margin-bottom:-3px; } +#expanddiv a:hover, #expanddiv a:focus, #expanddiv a:active { color:#555; background-color:#ddd; } /* VARIOUS REUSABLE SELECTORS */ .hidden { display:none; } diff --git a/core/js/js.js b/core/js/js.js index 6ed50b42bd5..d0399063cfc 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -590,9 +590,7 @@ $(document).ready(function(){ event.stopPropagation(); }); $(window).click(function(){//hide the settings menu when clicking outside it - if($('body').attr("id")==="body-user"){ - $('#settings #expanddiv').slideUp(); - } + $('#settings #expanddiv').slideUp(); }); // all the tipsy stuff needs to be here (in reverse order) to work -- cgit v1.2.3 From c4b8bb10411a4d601b7f4c8758980005f14850ab Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Mon, 29 Oct 2012 01:14:07 +0100 Subject: added old functions again to not break apps, but show a deprecation warning --- core/js/js.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'core/js/js.js') diff --git a/core/js/js.js b/core/js/js.js index ee8bdea7255..a30d66c00b8 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -468,6 +468,36 @@ function object(o) { return new F(); } +/** + * Fills height of window. (more precise than height: 100%;) + */ +function fillHeight(selector) { + if (selector.length === 0) { + return; + } + var height = parseFloat($(window).height())-selector.offset().top; + selector.css('height', height + 'px'); + if(selector.outerHeight() > selector.height()){ + selector.css('height', height-(selector.outerHeight()-selector.height()) + 'px'); + } + console.warn("This function is deprecated! Use CSS instead"); +} + +/** + * Fills height and width of window. (more precise than height: 100%; or width: 100%;) + */ +function fillWindow(selector) { + if (selector.length === 0) { + return; + } + fillHeight(selector); + var width = parseFloat($(window).width())-selector.offset().left; + selector.css('width', width + 'px'); + if(selector.outerWidth() > selector.width()){ + selector.css('width', width-(selector.outerWidth()-selector.width()) + 'px'); + } + console.warn("This function is deprecated! Use CSS instead"); +} $(document).ready(function(){ -- cgit v1.2.3 From ed7accd237bae2bd76df5e6256d8ee2ce2f14308 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Sun, 28 Oct 2012 19:28:44 +0100 Subject: Change search to use routing --- core/js/js.js | 2 +- core/routes.php | 3 +++ search/ajax/search.php | 8 +++----- 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'core/js/js.js') diff --git a/core/js/js.js b/core/js/js.js index 6ed50b42bd5..2073fc4d4b7 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -113,7 +113,7 @@ var OC={ } link+=file; }else{ - if ((app == 'settings' || app == 'core') && type == 'ajax') { + if ((app == 'settings' || app == 'core' || app == 'search') && type == 'ajax') { link+='/index.php/'; } else { diff --git a/core/routes.php b/core/routes.php index 186fa8ae562..5c99c542d48 100644 --- a/core/routes.php +++ b/core/routes.php @@ -9,6 +9,9 @@ require_once 'settings/routes.php'; // Core ajax actions +// Search +$this->create('search_ajax_search', '/search/ajax/search.php') + ->actionInclude('search/ajax/search.php'); // AppConfig $this->create('core_ajax_appconfig', '/core/ajax/appconfig.php') ->actionInclude('core/ajax/appconfig.php'); diff --git a/search/ajax/search.php b/search/ajax/search.php index 41ee9ad5aba..f0ca5752b9a 100644 --- a/search/ajax/search.php +++ b/search/ajax/search.php @@ -21,17 +21,15 @@ * */ - -// Init owncloud -require_once '../../lib/base.php'; - // Check if we are a user OC_JSON::checkLoggedIn(); +OC_App::loadApps(); $query=(isset($_GET['query']))?$_GET['query']:''; if($query) { $result=OC_Search::search($query); OC_JSON::encodedPrint($result); -}else{ +} +else { echo 'false'; } -- cgit v1.2.3 From c2d6ac53b2cbfb59bb9b34025ee1348c67340c39 Mon Sep 17 00:00:00 2001 From: Jörn Friedrich Dreyer Date: Tue, 6 Nov 2012 11:01:02 +0100 Subject: fix human filesize column header --- core/js/js.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/js/js.js') diff --git a/core/js/js.js b/core/js/js.js index 2073fc4d4b7..87d0a172082 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -649,7 +649,7 @@ $.fn.filterAttr = function(attr_name, attr_value) { function humanFileSize(size) { var humanList = ['B', 'kB', 'MB', 'GB', 'TB']; // Calculate Log with base 1024: size = 1024 ** order - var order = Math.floor(Math.log(size) / Math.log(1024)); + var order = size?Math.floor(Math.log(size) / Math.log(1024)):0; // Stay in range of the byte sizes that are defined order = Math.min(humanList.length - 1, order); var readableFormat = humanList[order]; -- cgit v1.2.3 From 50dbb30eb9968cd328915c4632f2742e6e41ad66 Mon Sep 17 00:00:00 2001 From: Alessandro Cosentino Date: Tue, 6 Nov 2012 10:56:42 -0500 Subject: Moved relative_modified_date from file/js to core/js --- apps/files/js/files.js | 21 --------------------- core/js/js.js | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 21 deletions(-) (limited to 'core/js/js.js') diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 2d9ccba424a..7506000d216 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -829,27 +829,6 @@ function getSelectedFiles(property){ return files; } -function relative_modified_date(timestamp) { - var timediff = Math.round((new Date()).getTime() / 1000) - timestamp; - var diffminutes = Math.round(timediff/60); - var diffhours = Math.round(diffminutes/60); - var diffdays = Math.round(diffhours/24); - var diffmonths = Math.round(diffdays/31); - if(timediff < 60) { return t('files','seconds ago'); } - else if(timediff < 120) { return t('files','1 minute ago'); } - else if(timediff < 3600) { return t('files','{minutes} minutes ago',{minutes: diffminutes}); } - //else if($timediff < 7200) { return '1 hour ago'; } - //else if($timediff < 86400) { return $diffhours.' hours ago'; } - else if(timediff < 86400) { return t('files','today'); } - else if(timediff < 172800) { return t('files','yesterday'); } - else if(timediff < 2678400) { return t('files','{days} days ago',{days: diffdays}); } - else if(timediff < 5184000) { return t('files','last month'); } - //else if($timediff < 31556926) { return $diffmonths.' months ago'; } - else if(timediff < 31556926) { return t('files','months ago'); } - else if(timediff < 63113852) { return t('files','last year'); } - else { return t('files','years ago'); } -} - function getMimeIcon(mime, ready){ if(getMimeIcon.cache[mime]){ ready(getMimeIcon.cache[mime]); diff --git a/core/js/js.js b/core/js/js.js index 87d0a172082..2b2a64d25f9 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -675,6 +675,30 @@ function formatDate(date){ return $.datepicker.formatDate(datepickerFormatDate, date)+' '+date.getHours()+':'+((date.getMinutes()<10)?'0':'')+date.getMinutes(); } +/* takes an absolute timestamp and return a string with a human-friendly relative date + * @param int a Unix timestamp + */ +function relative_modified_date(timestamp) { + var timediff = Math.round((new Date()).getTime() / 1000) - timestamp; + var diffminutes = Math.round(timediff/60); + var diffhours = Math.round(diffminutes/60); + var diffdays = Math.round(diffhours/24); + var diffmonths = Math.round(diffdays/31); + if(timediff < 60) { return t('core','seconds ago'); } + else if(timediff < 120) { return t('core','1 minute ago'); } + else if(timediff < 3600) { return t('core','{minutes} minutes ago',{minutes: diffminutes}); } + //else if($timediff < 7200) { return '1 hour ago'; } + //else if($timediff < 86400) { return $diffhours.' hours ago'; } + else if(timediff < 86400) { return t('core','today'); } + else if(timediff < 172800) { return t('core','yesterday'); } + else if(timediff < 2678400) { return t('core','{days} days ago',{days: diffdays}); } + else if(timediff < 5184000) { return t('core','last month'); } + //else if($timediff < 31556926) { return $diffmonths.' months ago'; } + else if(timediff < 31556926) { return t('core','months ago'); } + else if(timediff < 63113852) { return t('core','last year'); } + else { return t('core','years ago'); } +} + /** * get a variable by name * @param string name -- cgit v1.2.3 From aa917cfb1872e77970ffed5571b5a96dc1387525 Mon Sep 17 00:00:00 2001 From: Alessandro Cosentino Date: Tue, 13 Nov 2012 19:18:26 -0500 Subject: uncomment hours entries in relative date functions --- core/js/js.js | 13 +++++++------ lib/template.php | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'core/js/js.js') diff --git a/core/js/js.js b/core/js/js.js index 2b2a64d25f9..cb6b48b095e 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -641,7 +641,7 @@ if (!Array.prototype.map){ /** * Filter Jquery selector by attribute value - **/ + */ $.fn.filterAttr = function(attr_name, attr_value) { return this.filter(function() { return $(this).attr(attr_name) === attr_value; }); }; @@ -675,7 +675,8 @@ function formatDate(date){ return $.datepicker.formatDate(datepickerFormatDate, date)+' '+date.getHours()+':'+((date.getMinutes()<10)?'0':'')+date.getMinutes(); } -/* takes an absolute timestamp and return a string with a human-friendly relative date +/** + * takes an absolute timestamp and return a string with a human-friendly relative date * @param int a Unix timestamp */ function relative_modified_date(timestamp) { @@ -687,14 +688,14 @@ function relative_modified_date(timestamp) { if(timediff < 60) { return t('core','seconds ago'); } else if(timediff < 120) { return t('core','1 minute ago'); } else if(timediff < 3600) { return t('core','{minutes} minutes ago',{minutes: diffminutes}); } - //else if($timediff < 7200) { return '1 hour ago'; } - //else if($timediff < 86400) { return $diffhours.' hours ago'; } + else if($timediff < 7200) { return '1 hour ago'; } + else if($timediff < 86400) { return $diffhours.' hours ago'; } else if(timediff < 86400) { return t('core','today'); } else if(timediff < 172800) { return t('core','yesterday'); } else if(timediff < 2678400) { return t('core','{days} days ago',{days: diffdays}); } else if(timediff < 5184000) { return t('core','last month'); } - //else if($timediff < 31556926) { return $diffmonths.' months ago'; } - else if(timediff < 31556926) { return t('core','months ago'); } + else if($timediff < 31556926) { return $diffmonths.' months ago'; } + //else if(timediff < 31556926) { return t('core','months ago'); } else if(timediff < 63113852) { return t('core','last year'); } else { return t('core','years ago'); } } diff --git a/lib/template.php b/lib/template.php index 3d3589abd1e..48224130fa8 100644 --- a/lib/template.php +++ b/lib/template.php @@ -103,8 +103,8 @@ function relative_modified_date($timestamp) { if($timediff < 60) { return $l->t('seconds ago'); } else if($timediff < 120) { return $l->t('1 minute ago'); } else if($timediff < 3600) { return $l->t('%d minutes ago', $diffminutes); } - //else if($timediff < 7200) { return '1 hour ago'; } - //else if($timediff < 86400) { return $diffhours.' hours ago'; } + else if($timediff < 7200) { return '1 hour ago'; } + else if($timediff < 86400) { return $diffhours.' hours ago'; } else if((date('G')-$diffhours) > 0) { return $l->t('today'); } else if((date('G')-$diffhours) > -24) { return $l->t('yesterday'); } else if($timediff < 2678400) { return $l->t('%d days ago', $diffdays); } -- cgit v1.2.3 From 7d01342babcd3ce699d05bcceac2690ced110562 Mon Sep 17 00:00:00 2001 From: Alessandro Cosentino Date: Tue, 13 Nov 2012 19:32:26 -0500 Subject: fix translation issues with previous commit --- core/js/js.js | 6 +++--- lib/template.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'core/js/js.js') diff --git a/core/js/js.js b/core/js/js.js index cb6b48b095e..164fab80ed4 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -688,13 +688,13 @@ function relative_modified_date(timestamp) { if(timediff < 60) { return t('core','seconds ago'); } else if(timediff < 120) { return t('core','1 minute ago'); } else if(timediff < 3600) { return t('core','{minutes} minutes ago',{minutes: diffminutes}); } - else if($timediff < 7200) { return '1 hour ago'; } - else if($timediff < 86400) { return $diffhours.' hours ago'; } + else if(timediff < 7200) { return t('core','1 hour ago'); } + else if(timediff < 86400) { return t('core','{hours} hours ago',{hours: diffhours}); } else if(timediff < 86400) { return t('core','today'); } else if(timediff < 172800) { return t('core','yesterday'); } else if(timediff < 2678400) { return t('core','{days} days ago',{days: diffdays}); } else if(timediff < 5184000) { return t('core','last month'); } - else if($timediff < 31556926) { return $diffmonths.' months ago'; } + else if(timediff < 31556926) { return t('core','{months} months ago',{months: diffmonths}); } //else if(timediff < 31556926) { return t('core','months ago'); } else if(timediff < 63113852) { return t('core','last year'); } else { return t('core','years ago'); } diff --git a/lib/template.php b/lib/template.php index 48224130fa8..a10cabf5931 100644 --- a/lib/template.php +++ b/lib/template.php @@ -103,13 +103,13 @@ function relative_modified_date($timestamp) { if($timediff < 60) { return $l->t('seconds ago'); } else if($timediff < 120) { return $l->t('1 minute ago'); } else if($timediff < 3600) { return $l->t('%d minutes ago', $diffminutes); } - else if($timediff < 7200) { return '1 hour ago'; } - else if($timediff < 86400) { return $diffhours.' hours ago'; } + else if($timediff < 7200) { return $l->t('1 hour ago'); } + else if($timediff < 86400) { return $l->t('%d hours ago', $diffhours); } else if((date('G')-$diffhours) > 0) { return $l->t('today'); } else if((date('G')-$diffhours) > -24) { return $l->t('yesterday'); } else if($timediff < 2678400) { return $l->t('%d days ago', $diffdays); } else if($timediff < 5184000) { return $l->t('last month'); } - else if((date('n')-$diffmonths) > 0) { return $l->t('months ago'); } + else if((date('n')-$diffmonths) > 0) { return $l->t('%d months ago', $diffmonths); } else if($timediff < 63113852) { return $l->t('last year'); } else { return $l->t('years ago'); } } -- cgit v1.2.3 From b51b9539d074222d01bd4a9836be6fe2f191a31e Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Thu, 15 Nov 2012 19:43:10 +0100 Subject: Very simple js console switcher. --- core/js/js.js | 16 ++++++++++++++++ core/templates/layout.base.php | 1 + core/templates/layout.guest.php | 1 + core/templates/layout.user.php | 1 + 4 files changed, 19 insertions(+) (limited to 'core/js/js.js') diff --git a/core/js/js.js b/core/js/js.js index 164fab80ed4..3b4cabe710b 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1,3 +1,19 @@ +/** + * Disable console output unless DEBUG mode is enabled. + * Add + * define('DEBUG', true); + * To the end of config/config.php to enable debug mode. + */ +if (oc_debug !== true) { + if (!window.console) { + window.console = {}; + } + var methods = ['log', 'debug', 'warn', 'info', 'error', 'assert']; + for (var i = 0; i < methods.length; i++) { + console[methods[i]] = function () { }; + } +} + /** * translate a string * @param app the id of the app for which to translate the string diff --git a/core/templates/layout.base.php b/core/templates/layout.base.php index d8f83058775..47f4b423b3e 100644 --- a/core/templates/layout.base.php +++ b/core/templates/layout.base.php @@ -8,6 +8,7 @@ diff --git a/core/templates/layout.guest.php b/core/templates/layout.guest.php index 8395426e4e4..5b39503474d 100644 --- a/core/templates/layout.guest.php +++ b/core/templates/layout.guest.php @@ -10,7 +10,6 @@