aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/ajax/appconfig.php2
-rw-r--r--core/ajax/translations.php2
-rw-r--r--core/ajax/vcategories/delete.php2
-rw-r--r--core/css/oc-vcategories.css7
-rw-r--r--core/css/styles.css27
-rw-r--r--core/img/filetypes/application-sgf.pngbin0 -> 725 bytes
-rw-r--r--core/js/config.js2
-rw-r--r--core/js/eventsource.js12
-rw-r--r--core/js/js.js30
-rw-r--r--core/js/oc-dialogs.js140
-rw-r--r--core/js/oc-vcategories.js40
-rw-r--r--core/js/oc-vcategories.txt9
-rw-r--r--core/lostpassword/index.php7
-rw-r--r--core/strings.php2
-rw-r--r--core/templates/403.php15
-rw-r--r--core/templates/layout.user.php4
-rw-r--r--core/templates/login.php3
17 files changed, 222 insertions, 82 deletions
diff --git a/core/ajax/appconfig.php b/core/ajax/appconfig.php
index 50984ac32b9..f815d710631 100644
--- a/core/ajax/appconfig.php
+++ b/core/ajax/appconfig.php
@@ -11,7 +11,7 @@ $action=isset($_POST['action'])?$_POST['action']:$_GET['action'];
$result=false;
switch($action){
case 'getValue':
- $result=OC_Appconfig::getValue($_GET['app'],$_GET['key'],$_GET['default']);
+ $result=OC_Appconfig::getValue($_GET['app'],$_GET['key'],$_GET['defaultValue']);
break;
case 'setValue':
$result=OC_Appconfig::setValue($_POST['app'],$_POST['key'],$_POST['value']);
diff --git a/core/ajax/translations.php b/core/ajax/translations.php
index 2e436f8d84e..a6433b1964a 100644
--- a/core/ajax/translations.php
+++ b/core/ajax/translations.php
@@ -26,7 +26,7 @@ require_once('../../lib/base.php');
$app = $_POST["app"];
-$l = new OC_L10N( $app );
+$l = OC_L10N::get( $app );
OC_JSON::success(array('data' => $l->getTranslations()));
?>
diff --git a/core/ajax/vcategories/delete.php b/core/ajax/vcategories/delete.php
index 602ee1d74a4..75def433d30 100644
--- a/core/ajax/vcategories/delete.php
+++ b/core/ajax/vcategories/delete.php
@@ -17,7 +17,7 @@ function debug($msg) {
require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
-$app = isset($_GET['app'])?$_GET['app']:null;
+$app = isset($_POST['app'])?$_POST['app']:null;
$categories = isset($_POST['categories'])?$_POST['categories']:null;
if(is_null($app)) {
bailOut(OC_Contacts_App::$l10n->t('Application name not provided.'));
diff --git a/core/css/oc-vcategories.css b/core/css/oc-vcategories.css
deleted file mode 100644
index 68ff832bb06..00000000000
--- a/core/css/oc-vcategories.css
+++ /dev/null
@@ -1,7 +0,0 @@
-#categoryform .scrollarea { position: absolute; left: 10px; top: 10px; right: 10px; bottom: 50px; overflow: auto; border:1px solid #ddd; background: #f8f8f8; }
-#categoryform .bottombuttons { position: absolute; bottom: 10px;}
-#categoryform .bottombuttons * { float: left;}
-/*#categorylist { border:1px solid #ddd;}*/
-#categorylist li { background:#f8f8f8; padding:.3em .8em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; -webkit-transition:background-color 500ms; -moz-transition:background-color 500ms; -o-transition:background-color 500ms; transition:background-color 500ms; }
-#categorylist li:hover, li:active { background:#eee; }
-#category_addinput { width: 10em; }
diff --git a/core/css/styles.css b/core/css/styles.css
index f5a181c4529..89e5c91e3cf 100644
--- a/core/css/styles.css
+++ b/core/css/styles.css
@@ -49,7 +49,7 @@ input[type="checkbox"] { width:auto; }
#body-login input[type="text"], #body-login input[type="password"] { width: 13em; }
#body-login input.login { width: auto; float: right; }
#remember_login { margin:.8em .2em 0 1em; }
-.searchbox input[type="search"] { position:fixed; font-size:1.2em; top:.4em; right:3em; padding:.2em .5em .2em 1.5em; background:#fff url('../img/actions/search.svg') no-repeat .5em center; border:0; -moz-border-radius:1em; -webkit-border-radius:1em; border-radius:1em; opacity:.3; -webkit-transition:opacity 300ms; -moz-transition:opacity 300ms; -o-transition:opacity 300ms; transition:opacity 300ms; }
+.searchbox input[type="search"] { position:fixed; font-size:1.2em; top:.4em; right:3em; padding:.2em .5em .2em 1.5em; background:#fff url('../img/actions/search.svg') no-repeat .5em center; border:0; -moz-border-radius:1em; -webkit-border-radius:1em; border-radius:1em; opacity:.7; -webkit-transition:opacity 300ms; -moz-transition:opacity 300ms; -o-transition:opacity 300ms; transition:opacity 300ms; }
input[type="submit"].enabled { background:#66f866; border:1px solid #5e5; -moz-box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #cfc inset; -webkit-box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #cfc inset; box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #cfc inset; }
input[type="submit"].highlight{ background:#ffc100; border:1px solid #db0; text-shadow:#ffeedd 0 1px 0; -moz-box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #ffeedd inset; -webkit-box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #ffeedd inset; box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #ffeedd inset; }
@@ -95,8 +95,9 @@ label.infield { cursor: text !important; }
#navigation a.active, #navigation a:hover, #navigation a:focus { background-color:#dbdbdb; border-top:1px solid #d4d4d4; border-bottom:1px solid #ccc; color:#333; }
#navigation a.active { background-color:#ddd; }
#navigation #settings { position:absolute; bottom:3.5em; width:100%; }
-#expand { margin:0 0 .2em 1.2em; cursor:pointer; }
-#expand+span { position:relative; bottom:.4em; left:.2em; font-size:1.2em; color:#666; text-shadow:#f8f8f8 0 1px 0; }
+#expand { position:relative; margin-bottom:-.5em; padding:.5em 10.1em .7em 1.2em; cursor:pointer; }
+#expand+span { position:absolute; margin:-1.7em 0 0 2.5em; font-size:1.2em; color:#666; text-shadow:#f8f8f8 0 1px 0; opacity:0; -webkit-transition:opacity 500ms; -moz-transition:opacity 500ms; -o-transition:opacity 500ms; transition:opacity 500ms; }
+#expand:hover+span, #expand+span:hover { opacity:1; cursor:pointer; }
#logout { position:absolute; right:0; top:0; padding:1.2em 2em .55em 1.2em; }
@@ -106,8 +107,9 @@ label.infield { cursor: text !important; }
#notification { z-index:101; cursor:pointer; background-color:#fc4; border:0; padding:0 .7em .3em; display:none; position:fixed; left:50%; top:0; -moz-border-radius-bottomleft:1em; -webkit-border-bottom-left-radius:1em; border-bottom-left-radius:1em; -moz-border-radius-bottomright:1em; -webkit-border-bottom-right-radius:1em; border-bottom-right-radius:1em; }
-.action, .selectedActions a, #logout { opacity:.3; -webkit-transition:opacity 500ms; -moz-transition:opacity 500ms; -o-transition:opacity 500ms; transition:opacity 500ms; }
+.action, .selectedActions a { opacity:.5; -webkit-transition:opacity 500ms; -moz-transition:opacity 500ms; -o-transition:opacity 500ms; transition:opacity 500ms; }
.action { width: 16px; height: 16px; }
+#logout { opacity:.8; }
.action:hover, .selectedActions a:hover, #logout:hover { opacity:1; }
table:not(.nostyle) tr { -webkit-transition:background-color 500ms; -moz-transition:background-color 500ms; -o-transition:background-color 500ms; transition:background-color 500ms; }
@@ -131,3 +133,20 @@ li.error { width:640px; margin:4em auto; padding:1em 1em 1em 4em; background:#ff
.separator { display: inline; border-left: 1px solid #d3d3d3; border-right: 1px solid #fff; height: 10px; width:0px; margin: 4px; }
a.bookmarklet { background-color: #ddd; border:1px solid #ccc; padding: 5px;padding-top: 0px;padding-bottom: 2px; text-decoration: none; margin-top: 5px }
+
+
+/* ---- DIALOGS ---- */
+#dirtree {width: 100%;}
+#filelist {height: 270px; overflow:scroll; background-color: white;}
+.filepicker_element_selected { background-color: lightblue;}
+.filepicker_loader {height: 120px; width: 100%; background-color: #333; opacity: 0.3; visibility: visible; position:absolute; top:0; left:0; text-align:center; padding-top: 150px;}
+
+
+/* ---- CATEGORIES ---- */
+#categoryform .scrollarea { position: absolute; left: 10px; top: 10px; right: 10px; bottom: 50px; overflow: auto; border:1px solid #ddd; background: #f8f8f8; }
+#categoryform .bottombuttons { position: absolute; bottom: 10px;}
+#categoryform .bottombuttons * { float: left;}
+/*#categorylist { border:1px solid #ddd;}*/
+#categorylist li { background:#f8f8f8; padding:.3em .8em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; -webkit-transition:background-color 500ms; -moz-transition:background-color 500ms; -o-transition:background-color 500ms; transition:background-color 500ms; }
+#categorylist li:hover, li:active { background:#eee; }
+#category_addinput { width: 10em; }
diff --git a/core/img/filetypes/application-sgf.png b/core/img/filetypes/application-sgf.png
new file mode 100644
index 00000000000..f171f5579e7
--- /dev/null
+++ b/core/img/filetypes/application-sgf.png
Binary files differ
diff --git a/core/js/config.js b/core/js/config.js
index 500fe072a64..11168f1c483 100644
--- a/core/js/config.js
+++ b/core/js/config.js
@@ -31,7 +31,7 @@ OC.AppConfig={
callback=defaultValue;
defaultValue=null;
}
- OC.AppConfig.getCall('getValue',{app:app,key:key,default:defaultValue},callback);
+ OC.AppConfig.getCall('getValue',{app:app,key:key,defaultValue:defaultValue},callback);
},
setValue:function(app,key,value){
OC.AppConfig.postCall('setValue',{app:app,key:key,value:value});
diff --git a/core/js/eventsource.js b/core/js/eventsource.js
index dece1a69d04..08259e02cae 100644
--- a/core/js/eventsource.js
+++ b/core/js/eventsource.js
@@ -33,8 +33,12 @@
*/
OC.EventSource=function(src,data){
var dataStr='';
- for(name in data){
- dataStr+=name+'='+encodeURIComponent(data[name])+'&';
+ this.typelessListeners=[];
+ this.listeners={};
+ if(data){
+ for(name in data){
+ dataStr+=name+'='+encodeURIComponent(data[name])+'&';
+ }
}
if(!this.useFallBack && typeof EventSource !='undefined'){
this.source=new EventSource(src+'?'+dataStr);
@@ -42,7 +46,7 @@ OC.EventSource=function(src,data){
for(var i=0;i<this.typelessListeners.length;i++){
this.typelessListeners[i](JSON.parse(e.data));
}
- }
+ }.bind(this);
}else{
iframeId='oc_eventsource_iframe_'+OC.EventSource.iframeCount;
OC.EventSource.fallBackSources[OC.EventSource.iframeCount]=this;
@@ -64,7 +68,7 @@ OC.EventSource=function(src,data){
OC.EventSource.fallBackSources=[];
OC.EventSource.iframeCount=0;//number of fallback iframes
OC.EventSource.fallBackCallBack=function(id,type,data){
- OC.EventSource.fallBackSources[id].fallBackCallBack(type,JSON.parse(data));
+ OC.EventSource.fallBackSources[id].fallBackCallBack(type,data);
}
OC.EventSource.prototype={
typelessListeners:[],
diff --git a/core/js/js.js b/core/js/js.js
index df1b5c6ce76..51dcbe5413e 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -69,10 +69,10 @@ OC={
* @param file the name of the image file
* @return string
*
- * if no extention is given for the image, it will automatically decide between .png and .svg based on what the browser supports
+ * if no extension is given for the image, it will automatically decide between .png and .svg based on what the browser supports
*/
imagePath:function(app,file){
- if(file.indexOf('.')==-1){//if no extention is given, use png or svg depending on browser support
+ if(file.indexOf('.')==-1){//if no extension is given, use png or svg depending on browser support
file+=(SVGSupport())?'.svg':'.png';
}
return OC.filePath(app,'img',file);
@@ -126,7 +126,13 @@ OC={
});
}
},
- dialogs:OCdialogs
+ dialogs:OCdialogs,
+ mtime2date:function(mtime) {
+ mtime = parseInt(mtime);
+ var date = new Date(1000*mtime);
+ var ret = date.getDate()+'.'+(date.getMonth()+1)+'.'+date.getFullYear()+', '+date.getHours()+':'+date.getMinutes();
+ return ret;
+ }
};
OC.search.customResults={};
OC.search.currentResult=-1;
@@ -291,7 +297,10 @@ function object(o) {
* Fills height of window. (more precise than height: 100%;)
*/
function fillHeight(selector) {
- var height = parseFloat($(window).height())-parseFloat(selector.css('top'));
+ 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');
@@ -301,8 +310,11 @@ function fillHeight(selector) {
* 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())-parseFloat(selector.css('left'));
+ 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');
@@ -394,9 +406,6 @@ $(document).ready(function(){
$('#settings #expanddiv').click(function(event){
event.stopPropagation();
});
- $('#settings #expand').hover(function(){
- $('#settings #expand+span').fadeToggle();
- });
$(window).click(function(){//hide the settings menu when clicking oustide it
if($('body').attr("id")=="body-user"){
$('#settings #expanddiv').slideUp();
@@ -407,9 +416,10 @@ $(document).ready(function(){
$('.jp-controls .jp-previous').tipsy({gravity:'nw', fade:true, live:true});
$('.jp-controls .jp-next').tipsy({gravity:'n', fade:true, live:true});
$('.password .action').tipsy({gravity:'se', fade:true, live:true});
- $('.file_upload_button_wrapper').tipsy({gravity:'w', fade:true});
- $('.selectedActions a.delete').tipsy({gravity: 'se', fade:true, live:true});
+ $('.file_upload_button_wrapper').tipsy({gravity:'w', fade:true});
$('.selectedActions a').tipsy({gravity:'s', fade:true, live:true});
+ $('a.delete').tipsy({gravity: 'se', fade:true, live:true});
+ $('a.action').tipsy({gravity:'s', fade:true, live:true});
$('#headerSize').tipsy({gravity:'s', fade:true, live:true});
$('td.filesize').tipsy({gravity:'s', fade:true, live:true});
$('td .modified').tipsy({gravity:'s', fade:true, live:true});
diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js
index 9ce2bae1642..a3aa1e8c149 100644
--- a/core/js/oc-dialogs.js
+++ b/core/js/oc-dialogs.js
@@ -2,7 +2,7 @@
* ownCloud
*
* @author Bartek Przybylski
- * @copyright 2012 Bartek Przybylski bart.p.pl@gmail.com
+ * @copyright 2012 Bartek Przybylski bartek@alefzero.eu
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
@@ -17,7 +17,6 @@
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
- * todo(bartek): add select option in form
*/
/**
@@ -30,9 +29,9 @@ OCdialogs = {
* @param title dialog title
* @param callback which will be triggered when user press OK
*/
- alert:function(text, title, callback) {
+ alert:function(text, title, callback, modal) {
var content = '<p><span class="ui-icon ui-icon-alert"></span>'+text+'</p>';
- OCdialogs.message(content, title, OCdialogs.ALERT_DIALOG, OCdialogs.OK_BUTTON, callback);
+ OCdialogs.message(content, title, OCdialogs.ALERT_DIALOG, OCdialogs.OK_BUTTON, callback, modal);
},
/**
* displays info dialog
@@ -40,9 +39,9 @@ OCdialogs = {
* @param title dialog title
* @param callback which will be triggered when user press OK
*/
- info:function(text, title, callback) {
+ info:function(text, title, callback, modal) {
var content = '<p><span class="ui-icon ui-icon-info"></span>'+text+'</p>';
- OCdialogs.message(content, title, OCdialogs.ALERT_DIALOG, OCdialogs.OK_BUTTON, callback);
+ OCdialogs.message(content, title, OCdialogs.ALERT_DIALOG, OCdialogs.OK_BUTTON, callback, modal);
},
/**
* displays confirmation dialog
@@ -50,9 +49,9 @@ OCdialogs = {
* @param title dialog title
* @param callback which will be triggered when user press YES or NO (true or false would be passed to callback respectively)
*/
- confirm:function(text, title, callback) {
+ confirm:function(text, title, callback, modal) {
var content = '<p><span class="ui-icon ui-icon-notice"></span>'+text+'</p>';
- OCdialogs.message(content, title, OCdialogs.ALERT_DIALOG, OCdialogs.YES_NO_BUTTONS, callback);
+ OCdialogs.message(content, title, OCdialogs.ALERT_DIALOG, OCdialogs.YES_NO_BUTTONS, callback, modal);
},
/**
* prompt for user input
@@ -60,33 +59,87 @@ OCdialogs = {
* @param title dialog title
* @param callback which will be triggered when user press OK (input text will be passed to callback)
*/
- prompt:function(text, title, default_value, callback) {
+ prompt:function(text, title, default_value, callback, modal) {
var content = '<p><span class="ui-icon ui-icon-pencil"></span>'+text+':<br/><input type="text" id="oc-dialog-prompt-input" value="'+default_value+'" style="width:90%"></p>';
- OCdialogs.message(content, title, OCdialogs.PROMPT_DIALOG, OCdialogs.OK_CANCEL_BUTTONS, callback);
+ OCdialogs.message(content, title, OCdialogs.PROMPT_DIALOG, OCdialogs.OK_CANCEL_BUTTONS, callback, modal);
},
/**
* prompt user for input with custom form
- * fields should be passed in following format: [{text:'prompt text', name:'return name', type:'input type'},...]
+ * fields should be passed in following format: [{text:'prompt text', name:'return name', type:'input type', value: 'dafault value'},...]
* @param fields to display
* @param title dialog title
* @param callback which will be triggered when user press OK (user answers will be passed to callback in following format: [{name:'return name', value: 'user value'},...])
*/
- form:function(fields, title, callback) {
+ form:function(fields, title, callback, modal) {
var content = '<table>';
for (var a in fields) {
content += '<tr><td>'+fields[a].text+'</td><td>';
var type=fields[a].type;
- if (type == 'text' || type == 'checkbox' || type == 'password')
- content += '<input type="'+type+'" name="'+fields[a].name+'">';
- content += "</td></tr>"
+ if (type == 'text' || type == 'checkbox' || type == 'password') {
+ content += '<input type="'+type+'" name="'+fields[a].name+'"';
+ if (type == 'checkbox') {
+ if (fields[a].value != undefined && fields[a].value == true) {
+ content += ' checked="checked">';
+ } else content += '>';
+ } else if (type == 'text' || type == 'password' && fields[a].value)
+ content += ' value="'+fields[a].value+'">';
+ } else if (type == 'select') {
+ content += '<select name="'+fields[a].name+'"';
+ if (fields[a].value != undefined)
+ content += ' value="'+fields[a].value+'"';
+ content += '>';
+ for (var o in fields[a].options)
+ content += '<option value="'+fields[a].options[o].value+'">'+fields[a].options[o].text+'</option>';
+ content += '</select>';
+ }
+ content += '</td></tr>';
}
- content += "</table>";
- OCdialogs.message(content, title, OCdialogs.FORM_DIALOG, OCdialogs.OK_CANCEL_BUTTONS, callback);
+ content += '</table>';
+ OCdialogs.message(content, title, OCdialogs.FORM_DIALOG, OCdialogs.OK_CANCEL_BUTTONS, callback, modal);
},
- message:function(content, title, dialog_type, buttons, callback) {
+ filepicker:function(title, callback, multiselect, mimetype_filter, modal) {
+ var c_name = 'oc-dialog-'+OCdialogs.dialogs_counter+'-content';
+ var c_id = '#'+c_name;
+ var d = '<div id="'+c_name+'" title="'+title+'"><select id="dirtree"><option value="0">'+OC.currentUser+'</option></select><div id="filelist"></div><div class="filepicker_loader"><img src="'+OC.filePath('gallery','img','loading.gif')+'"></div></div>';
+ if (!modal) modal = false;
+ if (!multiselect) multiselect = false;
+ $('body').append(d);
+ $(c_id + ' #dirtree').focus(function() { var t = $(this); t.data('oldval', t.val())})
+ .change({dcid: c_id}, OC.dialogs.handleTreeListSelect);
+ $(c_id).ready(function(){
+ $.getJSON(OC.webroot+'/files/ajax/rawlist.php', {mimetype: mimetype_filter} ,function(r){OC.dialogs.fillFilePicker(r, c_id, callback)});
+ }).data('multiselect', multiselect).data('mimetype',mimetype_filter);
+ // build buttons
+ var b = [
+ {text: t('dialogs', 'Choose'), click: function(){
+ if (callback != undefined) {
+ var p;
+ if ($(c_id).data('multiselect') == true) {
+ p = [];
+ $(c_id+' .filepicker_element_selected #filename').each(function(i, elem) {
+ p.push(($(c_id).data('path')?$(c_id).data('path'):'')+'/'+$(elem).text());
+ });
+ } else {
+ var p = $(c_id).data('path');
+ if (p == undefined) p = '';
+ p = p+'/'+$(c_id+' .filepicker_element_selected #filename').text()
+ }
+ callback(p);
+ $(c_id).dialog('close');
+ }
+ }
+ },
+ {text: t('dialogs', 'Cancel'), click: function(){$(c_id).dialog('close'); }}
+ ];
+ $(c_id).dialog({width: 4*$(document).width()/9, height: 400, modal: modal, buttons: b});
+ OCdialogs.dialogs_counter++;
+ },
+ // guts, dont use, dont touch
+ message:function(content, title, dialog_type, buttons, callback, modal) {
var c_name = 'oc-dialog-'+OCdialogs.dialogs_counter+'-content';
var c_id = '#'+c_name;
var d = '<div id="'+c_name+'" title="'+title+'">'+content+'</div>';
+ if (modal == undefined) modal = false;
$('body').append(d);
var b = [];
switch (buttons) {
@@ -100,7 +153,7 @@ OCdialogs = {
var f;
switch(dialog_type) {
case OCdialogs.ALERT_DIALOG:
- f = function(){$(c_id).dialog('close'); };
+ f = function(){$(c_id).dialog('close'); callback();};
break;
case OCdialogs.PROMPT_DIALOG:
f = function(){OCdialogs.prompt_ok_handler(callback, c_id)};
@@ -112,7 +165,8 @@ OCdialogs = {
b[0] = {text: t('dialogs', 'Ok'), click: f};
break;
}
- $(c_id).dialog({width: 4*$(document).width()/9, height: $(d).height() + 150, modal: false, buttons: b});
+ var possible_height = ($('tr', d).size()+1)*30;
+ $(c_id).dialog({width: 4*$(document).width()/9, height: possible_height + 120, modal: modal, buttons: b});
OCdialogs.dialogs_counter++;
},
// dialogs buttons types
@@ -127,7 +181,7 @@ OCdialogs = {
dialogs_counter: 0,
determineValue: function(element) {
switch ($(element).attr('type')) {
- case 'checkbox': return $(element).attr('checked') != undefined;
+ case 'checkbox': return element.checked;
}
return $(element).val();
},
@@ -136,7 +190,7 @@ OCdialogs = {
if (callback != undefined) {
var r = [];
var c = 0;
- $(c_id + ' input').each(function(i, elem) {
+ $(c_id + ' input, '+c_id+' select').each(function(i, elem) {
r[c] = {name: $(elem).attr('name'), value: OCdialogs.determineValue(elem)};
c++;
});
@@ -145,5 +199,47 @@ OCdialogs = {
} else {
$(c_id).dialog('close');
}
+ },
+ fillFilePicker:function(r, dialog_content_id) {
+ var entry_template = '<div onclick="javascript:OC.dialogs.handlePickerClick(this, \'*ENTRYNAME*\',\''+dialog_content_id+'\')" data="*ENTRYTYPE*"><img src="*MIMETYPEICON*" style="margin-right:1em;"><span id="filename">*NAME*</span><div style="float:right;margin-right:1em;">*LASTMODDATE*</div></div>';
+ var names = '';
+ for (var a in r.data) {
+ names += entry_template.replace('*LASTMODDATE*', OC.mtime2date(r.data[a].mtime)).replace('*NAME*', r.data[a].name).replace('*MIMETYPEICON*', r.data[a].mimetype_icon).replace('*ENTRYNAME*', r.data[a].name).replace('*ENTRYTYPE*', r.data[a].type);
+ }
+ $(dialog_content_id + ' #filelist').html(names);
+ $(dialog_content_id + ' .filepicker_loader').css('visibility', 'hidden');
+ },
+ handleTreeListSelect:function(event) {
+ var newval = parseInt($(this).val());
+ var oldval = parseInt($(this).data('oldval'));
+ while (newval != oldval && oldval > 0) {
+ $('option:last', this).remove();
+ $('option:last', this).attr('selected','selected');
+ oldval--;
+ }
+ var skip_first = true;
+ var path = '';
+ $(this).children().each(function(i, element) { if (skip_first) {skip_first = false; return; }path += '/'+$(element).text(); });
+ $(event.data.dcid).data('path', path);
+ $(event.data.dcid + ' .filepicker_loader').css('visibility', 'visible');
+ $.getJSON(OC.webroot+'/files/ajax/rawlist.php', {dir: path, mimetype: $(event.data.dcid).data('mimetype')}, function(r){OC.dialogs.fillFilePicker(r, event.data.dcid)});
+ },
+ // this function is in early development state, please dont use it unlsess you know what you are doing
+ handlePickerClick:function(element, name, dcid) {
+ var p = $(dcid).data('path');
+ if (p == undefined) p = '';
+ p = p+'/'+name;
+ if ($(element).attr('data') == 'file'){
+ if ($(dcid).data('multiselect') != true)
+ $(dcid+' .filepicker_element_selected').removeClass('filepicker_element_selected');
+ $(element).toggleClass('filepicker_element_selected');
+ return;
+ }
+ $(dcid).data('path', p);
+ $(dcid + ' #dirtree option:last').removeAttr('selected');
+ var newval = parseInt($(dcid + ' #dirtree option:last').val())+1;
+ $(dcid + ' #dirtree').append('<option selected="selected" value="'+newval+'">'+name+'</option>');
+ $(dcid + ' .filepicker_loader').css('visibility', 'visible');
+ $.getJSON(OC.webroot+'/files/ajax/rawlist.php', {dir: p, mimetype: $(dcid).data('mimetype')}, function(r){OC.dialogs.fillFilePicker(r, dcid)});
}
};
diff --git a/core/js/oc-vcategories.js b/core/js/oc-vcategories.js
index a6dcccf88e0..4d8d010a36f 100644
--- a/core/js/oc-vcategories.js
+++ b/core/js/oc-vcategories.js
@@ -19,7 +19,7 @@ OCCategories={
height: 350, minHeight:200, width: 250, minWidth: 200,
buttons: {
'Delete':function() {
- OCCategories.delete();
+ OCCategories.doDelete();
},
'Rescan':function() {
OCCategories.rescan();
@@ -53,25 +53,21 @@ OCCategories={
}
});
},
- delete:function(){
+ _processDeleteResult:function(jsondata, status, xhr){
+ if(jsondata.status == 'success'){
+ OCCategories._update(jsondata.data.categories);
+ } else {
+ OC.dialogs.alert(jsondata.data.message, 'Error');
+ }
+ },
+ doDelete:function(){
var categories = $('#categorylist').find('input[type="checkbox"]').serialize();
categories += '&app=' + OCCategories.app;
console.log('OCCategories.delete: ' + categories);
- $.post(OC.filePath(OCCategories.app, 'ajax', 'categories/delete.php'),categories,function(jsondata, status, xhr){
- if (status == 'error' && xhr.status == 404) {
- $.post(OC.filePath('core', 'ajax', 'vcategories/delete.php'),categories,function(jsondata, status, xhr){
- if(jsondata.status == 'success'){
- OCCategories._update(jsondata.data.categories);
- } else {
- OC.dialogs.alert(jsondata.data.message, 'Error');
- }
- });
- return;
- }
- if(jsondata.status == 'success'){
- OCCategories._update(jsondata.data.categories);
- } else {
- OC.dialogs.alert(jsondata.data.message, 'Error');
+ $.post(OC.filePath(OCCategories.app, 'ajax', 'categories/delete.php'), categories, OCCategories._processDeleteResult)
+ .error(function(xhr){
+ if (xhr.status == 404) {
+ $.post(OC.filePath('core', 'ajax', 'vcategories/delete.php'), categories, OCCategories._processDeleteResult);
}
});
},
@@ -88,16 +84,16 @@ OCCategories={
},
rescan:function(){
console.log('Categories.rescan');
- $.getJSON(OC.filePath(OCCategories.app, 'ajax', 'categories/rescan.php'),{},function(jsondata, status, xhr){
- if (status == 'error' && xhr.status == 404) {
- OC.dialogs.alert('The required file ' + OC.filePath(Categories.app, 'ajax', 'categories/rescan.php') + ' is not installed!', 'Error');
- return;
- }
+ $.getJSON(OC.filePath(OCCategories.app, 'ajax', 'categories/rescan.php'),function(jsondata, status, xhr){
if(jsondata.status == 'success'){
OCCategories._update(jsondata.data.categories);
} else {
OC.dialogs.alert(jsondata.data.message, 'Error');
}
+ }).error(function(xhr){
+ if (xhr.status == 404) {
+ OC.dialogs.alert('The required file ' + OC.filePath(Categories.app, 'ajax', 'categories/rescan.php') + ' is not installed!', 'Error');
+ }
});
},
_update:function(categories){
diff --git a/core/js/oc-vcategories.txt b/core/js/oc-vcategories.txt
index 76d4245f5eb..31216f80bd3 100644
--- a/core/js/oc-vcategories.txt
+++ b/core/js/oc-vcategories.txt
@@ -17,7 +17,7 @@ Set the app specific values in your javascript file. This is what I've used for
OCCategories.app = 'contacts';
OCCategories.changed = Contacts.UI.Card.categoriesChanged;
-If OCCategories.changed point is set that function will be called each time the categories have been changed
+If OCCategories.changed is set that function will be called each time the categories have been changed
in the editor (add/delete/rescan) to allow the app to update the UI accordingly. The only argument to the function
is an array of the updated categories e.g.:
@@ -25,4 +25,9 @@ OCCategories.changed = function(categories) {
for(var category in categories) {
console.log(categories[category]);
}
-} \ No newline at end of file
+}
+
+To show the categories editor call:
+
+ OCCategories.edit()
+
diff --git a/core/lostpassword/index.php b/core/lostpassword/index.php
index 30caa2d23da..89bb6cfa794 100644
--- a/core/lostpassword/index.php
+++ b/core/lostpassword/index.php
@@ -12,7 +12,7 @@ require_once('../../lib/base.php');
// Someone lost their password:
if (isset($_POST['user'])) {
if (OC_User::userExists($_POST['user'])) {
- $token = sha1($_POST['user']+uniqId());
+ $token = sha1($_POST['user'].md5(uniqid(rand(), true)));
OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', $token);
$email = OC_Preferences::getValue($_POST['user'], 'settings', 'email', '');
if (!empty($email)) {
@@ -20,8 +20,9 @@ if (isset($_POST['user'])) {
$tmpl = new OC_Template('core/lostpassword', 'email');
$tmpl->assign('link', $link);
$msg = $tmpl->fetchPage();
- $l = new OC_L10N('core');
- mail($email, $l->t('Owncloud password reset'), $msg);
+ $l = OC_L10N::get('core');
+ $from = 'lostpassword-noreply@' . $_SERVER['HTTP_HOST'];
+ mail($email, $l->t('Owncloud password reset'), $msg, 'From:' . $from);
}
OC_Template::printGuestPage('core/lostpassword', 'lostpassword', array('error' => false, 'requested' => true));
} else {
diff --git a/core/strings.php b/core/strings.php
index 9b4290db476..8c3f64ef14f 100644
--- a/core/strings.php
+++ b/core/strings.php
@@ -1,7 +1,7 @@
<?php
//some strings that are used in /lib but wont be translatable unless they are in /core too
-$l=new OC_L10N('core');
+$l=OC_L10N::get('core');
$l->t("Personal");
$l->t("Users");
$l->t("Apps");
diff --git a/core/templates/403.php b/core/templates/403.php
new file mode 100644
index 00000000000..cdfef08ac76
--- /dev/null
+++ b/core/templates/403.php
@@ -0,0 +1,15 @@
+<?php
+if(!isset($_)){//also provide standalone error page
+ require_once '../../lib/base.php';
+
+ $tmpl = new OC_Template( '', '403', 'guest' );
+ $tmpl->printPage();
+ exit;
+}
+?>
+<ul>
+ <li class='error'>
+ <?php echo $l->t( 'Access forbidden' ); ?><br/>
+ <p class='hint'><?php if(isset($_['file'])) echo $_['file']?></p>
+ </li>
+</ul>
diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php
index c048653cce9..61eb0de9f42 100644
--- a/core/templates/layout.user.php
+++ b/core/templates/layout.user.php
@@ -31,7 +31,7 @@
<form class="searchbox" action="#" method="post">
<input id="searchbox" class="svg" type="search" name="query" value="<?php if(isset($_POST['query'])){echo $_POST['query'];};?>" autocomplete="off" />
</form>
- <a id="logout" href="<?php echo link_to('', 'index.php'); ?>?logout=true"><img class="svg" alt="<?php echo $l->t('Log out');?>" src="<?php echo image_path('', 'actions/logout.svg'); ?>" /></a>
+ <a id="logout" href="<?php echo link_to('', 'index.php'); ?>?logout=true"><img class="svg" alt="<?php echo $l->t('Log out');?>" title="<?php echo $l->t('Log out');?>" src="<?php echo image_path('', 'actions/logout.svg'); ?>" /></a>
</div></header>
<nav><div id="navigation">
@@ -44,7 +44,7 @@
<ul id="settings" class="svg">
<img id="expand" class="svg" alt="<?php echo $l->t('Settings');?>" src="<?php echo image_path('', 'actions/settings.svg'); ?>" />
- <span style="display:none;"><?php echo $l->t('Settings');?></span>
+ <span><?php echo $l->t('Settings');?></span>
<div id="expanddiv" <?php if($_['bodyid'] == 'body-user') echo 'style="display:none;"'; ?>>
<?php foreach($_['settingsnavigation'] as $entry):?>
<li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title="" <?php if( $entry["active"] ): ?> class="active"<?php endif; ?>><?php echo $entry['name'] ?></a></li>
diff --git a/core/templates/login.php b/core/templates/login.php
index 6c0a7a12227..4ba92221a7d 100644
--- a/core/templates/login.php
+++ b/core/templates/login.php
@@ -1,3 +1,4 @@
+<!--[if IE 8]><style>input[type="checkbox"]{padding:0;}</style><![endif]-->
<form action="index.php" method="post">
<fieldset>
<?php if(!empty($_['redirect'])) { echo '<input type="hidden" name="redirect_url" value="'.$_['redirect'].'" />'; } ?>
@@ -6,7 +7,7 @@
<?php endif; ?>
<p class="infield">
<label for="user" class="infield"><?php echo $l->t( 'Username' ); ?></label>
- <input type="text" name="user" id="user" value="<?php echo !empty($_POST['user'])?$_POST['user'].'"':'" autofocus'; ?> autocomplete="off" required />
+ <input type="text" name="user" id="user" value="<?php echo !empty($_POST['user'])?htmlentities($_POST['user']).'"':'" autofocus'; ?> autocomplete="off" required />
</p>
<p class="infield">
<label for="password" class="infield"><?php echo $l->t( 'Password' ); ?></label>