Merge branch 'master' of git://anongit.kde.org/owncloud

This commit is contained in:
Jakob Sack 2011-08-06 11:38:49 +02:00
commit 501b767e6e
14 changed files with 94 additions and 68 deletions

View File

@ -50,7 +50,7 @@ $(document).ready(function() {
FileActions.setDefault('application/ogg','Play'); FileActions.setDefault('application/ogg','Play');
} }
if(typeof PlayList==='undefined'){ if(typeof PlayList==='undefined'){
if(typeof localStorage !== 'undefined'){ if(typeof localStorage !== 'undefined' && localStorage){
if(localStorage.hasOwnProperty(oc_current_user+'oc_playlist_items') && localStorage.getItem(oc_current_user+'oc_playlist_items')!='[]' && localStorage.getItem(oc_current_user+'oc_playlist_active')!='true'){ if(localStorage.hasOwnProperty(oc_current_user+'oc_playlist_items') && localStorage.getItem(oc_current_user+'oc_playlist_items')!='[]' && localStorage.getItem(oc_current_user+'oc_playlist_active')!='true'){
loadPlayer(); loadPlayer();
} }

View File

@ -143,7 +143,7 @@ var PlayList={
} }
}, },
save:function(){ save:function(){
if(typeof localStorage !== 'undefined'){ if(typeof localStorage !== 'undefined' && localStorage){
localStorage.setItem(oc_current_user+'oc_playlist_items',JSON.stringify(PlayList.items)); localStorage.setItem(oc_current_user+'oc_playlist_items',JSON.stringify(PlayList.items));
localStorage.setItem(oc_current_user+'oc_playlist_current',PlayList.current); localStorage.setItem(oc_current_user+'oc_playlist_current',PlayList.current);
var time=Math.round(PlayList.player.data('jPlayer').status.currentTime); var time=Math.round(PlayList.player.data('jPlayer').status.currentTime);
@ -156,7 +156,7 @@ var PlayList={
} }
}, },
load:function(){ load:function(){
if(typeof localStorage !== 'undefined'){ if(typeof localStorage !== 'undefined' && localStorage){
PlayList.active=true; PlayList.active=true;
localStorage.setItem(oc_current_user+'oc_playlist_active','true'); localStorage.setItem(oc_current_user+'oc_playlist_active','true');
if(localStorage.hasOwnProperty(oc_current_user+'oc_playlist_items')){ if(localStorage.hasOwnProperty(oc_current_user+'oc_playlist_items')){

View File

@ -6,13 +6,21 @@ if (!in_array ('curl', get_loaded_extensions())){
} }
$urlBase=((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST']; $urlBase=((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'];
OC_Util::addHeader('link',array('rel'=>'openid.server', 'href'=>$urlBase.OC_Helper::linkTo( "user_openid", "user.php" ).'/'));
OC_Util::addHeader('link',array('rel'=>'openid.delegate', 'href'=>$urlBase.OC_Helper::linkTo( "user_openid", "user.php" ).'/')); $userName='';
if(strpos($_SERVER["REQUEST_URI"],'?') and !strpos($_SERVER["REQUEST_URI"],'=')){
if(strpos($_SERVER["REQUEST_URI"],'/?')){
$userName=substr($_SERVER["REQUEST_URI"],strpos($_SERVER["REQUEST_URI"],'/?')+2);
}elseif(strpos($_SERVER["REQUEST_URI"],'.php?')){
$userName=substr($_SERVER["REQUEST_URI"],strpos($_SERVER["REQUEST_URI"],'.php?')+5);
}
}
OC_Util::addHeader('link',array('rel'=>'openid.server', 'href'=>$urlBase.OC_Helper::linkTo( "user_openid", "user.php" ).'/'.$userName));
OC_Util::addHeader('link',array('rel'=>'openid.delegate', 'href'=>$urlBase.OC_Helper::linkTo( "user_openid", "user.php" ).'/'.$userName));
require_once 'apps/user_openid/user_openid.php'; require_once 'apps/user_openid/user_openid.php';
OC_App::addSettingsPage( array( "id" => "user_openid_settings", 'order'=>1, "href" => OC_Helper::linkTo( "user_openid", "settings.php" ), "name" => "OpenID"));
//active the openid backend //active the openid backend
OC_User::useBackend('openid'); OC_User::useBackend('openid');

View File

@ -1646,12 +1646,12 @@ $profile['req_url'] = sprintf("%s://%s%s",
// $port,//host already includes the path // $port,//host already includes the path
$_SERVER["REQUEST_URI"]); $_SERVER["REQUEST_URI"]);
$fullId='user.php/'.$USERNAME.'/'; // $fullId='user.php/'.$USERNAME.'/';
$incompleteId='user.php/'; // $incompleteId='user.php/';
if(!strpos($profile['req_url'],$fullId)){ // if(!strpos($profile['req_url'],$fullId)){
$profile['req_url']=str_replace($incompleteId,$fullId,$profile['req_url']); // $profile['req_url']=str_replace($incompleteId,$fullId,$profile['req_url']);
} // }
// error_log('inc id: '.$fullId); // error_log('inc id: '.$fullId);
// error_log('req url: '.$profile['req_url']); // error_log('req url: '.$profile['req_url']);

View File

@ -1,23 +0,0 @@
<?php
require_once('../../lib/base.php');
if( !OC_User::isLoggedIn()){
header( "Location: ".OC_Helper::linkTo( "index.php" ));
exit();
}
if(isset($_POST['input_identity'])){
OC_Preferences::setValue(OC_User::getUser(),'user_openid','identity',$_POST['input_identity']);
}
OC_App::setActiveNavigationEntry( "user_openid_settings" );
$identity=OC_Preferences::getValue(OC_User::getUser(),'user_openid','identity','');
$tmpl = new OC_Template( "user_openid", "settings", "admin");
$tmpl->assign('identity',$identity);
$tmpl->assign('user',OC_User::getUser());
$tmpl->printPage();
?>

View File

@ -1,7 +0,0 @@
<form id="identity" action='#' method='post'>
<fieldset>
<legend><?php echo $l->t( 'OpenID identity' );?></legend>
<label for='input_identity'>OpenID identity for <b><?php echo $_['user'];?></b></label><br/>
<input name='input_identity' id='input_identity' value="<?php echo $_['identity'];?>"/><input type='submit' value='Save'/>
</fieldset>
</form>

View File

@ -8,8 +8,8 @@
.file_upload_filename { background-image:url("../img/file.png"); font-weight:bold; }.file_upload_start { opacity:0;filter:alpha(opacity = 0); } .file_upload_filename { background-image:url("../img/file.png"); font-weight:bold; }.file_upload_start { opacity:0;filter:alpha(opacity = 0); }
input.highlight{ background-color:#ffc100; border:#dda600 1px solid; } input.highlight{ background-color:#ffc100; border:#dda600 1px solid; }
#file_newfolder_name { background-image:url("../img/folder.png"); font-weight:bold; width:11em; } #file_newfolder_name { background-image:url("../img/folder.png"); font-weight:bold; width:12em; }
.file_upload_start, .file_upload_filename { position:absolute; top:0px; left:0px; width:11em; font-size:0.9em; } .file_upload_start, .file_upload_filename { position:absolute; top:0px; left:0px; width:12em; font-size:0.9em; }
.file_upload_wrapper { position:relative; top:-1.2em; left:-2em; display:-moz-inline-box; /* fallback for older firefox versions*/ display:inline-block; width:12em; } .file_upload_wrapper { position:relative; top:-1.2em; left:-2em; display:-moz-inline-box; /* fallback for older firefox versions*/ display:inline-block; width:12em; }
#file_newfolder_submit, #file_upload_submit { width:3em; } #file_newfolder_submit, #file_upload_submit { width:3em; }
.file_upload_target { display:none; } .file_upload_target { display:none; }
@ -52,16 +52,6 @@ table thead.fixed {height:2em}
/* add breadcrumb divider to the File item in navigation panel */ /* add breadcrumb divider to the File item in navigation panel */
#navigation>ul>li:first-child { background:url('../../core/img/breadcrumb-divider-start.png') no-repeat 12.5em 0px; width:12.5em; padding-right:1em; } #navigation>ul>li:first-child { background:url('../../core/img/breadcrumb-divider-start.png') no-repeat 12.5em 0px; width:12.5em; padding-right:1em; }
#notification{ z-index:150; background-color:#fc4; border:0; padding:0 .7em .3em; display:block; position:fixed; left:50%; top:0;
#notification{ -moz-border-radius-bottomleft:1em; -webkit-border-bottom-left-radius:1em; border-bottom-left-radius:1em;
z-index:150; -moz-border-radius-bottomright:1em; -webkit-border-bottom-right-radius:1em; border-bottom-right-radius:1em; }
border-radius:10px;
background-color:#eee;
border:1px solid #ccc;
padding-left:1em;
padding-right:1em;
display:none;
position:fixed;
top:2.8em;
left:40%;
}

View File

@ -168,9 +168,8 @@ FileList={
procesSelection(); procesSelection();
FileList.deleteCanceled=false; FileList.deleteCanceled=false;
FileList.deleteFiles=files; FileList.deleteFiles=files;
$('#notification').text(files.length+' file'+((files.length>1)?'s':'')+' deleted, click here to undo'); $('#notification').text('undo deletion');
$('#notification').fadeIn();
$('#notification').show();
}, },
finishDelete:function(ready,sync){ finishDelete:function(ready,sync){
if(!FileList.deleteCanceled && FileList.deleteFiles){ if(!FileList.deleteCanceled && FileList.deleteFiles){
@ -181,7 +180,7 @@ FileList={
data: "dir="+$('#dir').val()+"&files="+encodeURIComponent(fileNames), data: "dir="+$('#dir').val()+"&files="+encodeURIComponent(fileNames),
complete: function(data){ complete: function(data){
boolOperationFinished(data, function(){ boolOperationFinished(data, function(){
$('#notification').hide(); $('#notification').fadeOut();
$.each(FileList.deleteFiles,function(index,file){ $.each(FileList.deleteFiles,function(index,file){
// alert(file); // alert(file);
FileList.remove(file); FileList.remove(file);
@ -199,9 +198,10 @@ FileList={
} }
$(document).ready(function(){ $(document).ready(function(){
$('#notification').hide();
$('#notification').click(function(){ $('#notification').click(function(){
FileList.deleteCanceled=true; FileList.deleteCanceled=true;
$('#notification').hide(); $('#notification').fadeOut();
$.each(FileList.deleteFiles,function(index,file){ $.each(FileList.deleteFiles,function(index,file){
$('tr[data-file="'+file+'"]').show(); $('tr[data-file="'+file+'"]').show();
// alert(file); // alert(file);

View File

@ -40,6 +40,11 @@ elseif($not_installed OR $install_called) {
require_once('setup.php'); require_once('setup.php');
} }
if($_SERVER['REQUEST_METHOD']=='PROPFIND'){//handle webdav
header('location: '.OC_Helper::linkTo('files','webdav.php'));
exit();
}
// Someone is logged in : // Someone is logged in :
elseif(OC_User::isLoggedIn()) { elseif(OC_User::isLoggedIn()) {
if(isset($_GET["logout"]) and ($_GET["logout"])) { if(isset($_GET["logout"]) and ($_GET["logout"])) {

View File

@ -82,19 +82,19 @@ function relative_modified_date($timestamp) {
$diffdays = round($diffhours/24); $diffdays = round($diffhours/24);
$diffmonths = round($diffdays/31); $diffmonths = round($diffdays/31);
$diffyears = round($diffdays/365); $diffyears = round($diffdays/365);
if($timediff < 60) { return 'seconds ago'; } if($timediff < 60) { return 'seconds ago'; }
else if($timediff < 120) { return '1 minute ago'; } else if($timediff < 120) { return '1 minute ago'; }
else if($timediff < 3600) { return $diffminutes.' minutes ago'; } else if($timediff < 3600) { return $diffminutes.' minutes ago'; }
//else if($timediff < 7200) { return '1 hour ago'; } //else if($timediff < 7200) { return '1 hour ago'; }
//else if($timediff < 86400) { return $diffhours.' hours ago'; } //else if($timediff < 86400) { return $diffhours.' hours ago'; }
else if($timediff < 86400) { return 'today'; } else if((date('G')-$diffhours) > 0) { return 'today'; }
else if($timediff < 172800) { return 'yesterday'; } else if((date('G')-$diffhours) > -24) { return 'yesterday'; }
else if($timediff < 2678400) { return $diffdays.' days ago'; } else if($timediff < 2678400) { return $diffdays.' days ago'; }
else if($timediff < 5184000) { return 'last month'; } else if($timediff < 5184000) { return 'last month'; }
//else if($timediff < 31556926) { return $diffmonths.' months ago'; } else if((date('n')-$diffmonths) > 0) { return 'months ago'; }
else if($timediff < 31556926) { return 'months ago'; }
else if($timediff < 63113852) { return 'last year'; } else if($timediff < 63113852) { return 'last year'; }
else { return $diffyears.' years ago'; } else { return 'years ago'; }
} }

26
settings/ajax/openid.php Normal file
View File

@ -0,0 +1,26 @@
<?php
// Init owncloud
require_once('../../lib/base.php');
$l=new OC_L10N('settings');
// We send json data
header( "Content-Type: application/jsonrequest" );
// Check if we are a user
if( !OC_User::isLoggedIn()){
echo json_encode( array( "status" => "error", "data" => array( "message" => $l->t("Authentication error") )));
exit();
}
// Get data
if( isset( $_POST['identity'] ) ){
$identity=$_POST['identity'];
OC_Preferences::setValue(OC_User::getUser(),'user_openid','identity',$identity);
echo json_encode( array( "status" => "success", "data" => array( "message" => $l->t("OpenID Changed") )));
}else{
echo json_encode( array( "status" => "error", "data" => array( "message" => $l->t("Invalid request") )));
}
?>

View File

@ -29,6 +29,11 @@ $tmpl->assign('usage',OC_Helper::humanFileSize($used));
$tmpl->assign('total_space',OC_Helper::humanFileSize($total)); $tmpl->assign('total_space',OC_Helper::humanFileSize($total));
$tmpl->assign('usage_relative',$relative); $tmpl->assign('usage_relative',$relative);
$tmpl->assign('languages',$languages); $tmpl->assign('languages',$languages);
$tmpl->assign('hasopenid',OC_App::isEnabled( 'user_openid' ));
if(OC_App::isEnabled( 'user_openid' )){
$identity=OC_Preferences::getValue(OC_User::getUser(),'user_openid','identity','');
$tmpl->assign('identity',$identity);
}
$tmpl->printPage(); $tmpl->printPage();
?> ?>

View File

@ -18,7 +18,18 @@ $(document).ready(function(){
}); });
return false; return false;
}); });
$('#openidform').submit(function(event){
event.preventDefault();
var post = $( "#openidform" ).serialize();
$.post( 'ajax/openid.php', post, function(data){
if( data.status == "success" ){
}else{
alert('error while setting OpenID');
}
});
});
$("#languageinput").change( function(){ $("#languageinput").change( function(){
// Serialize the data // Serialize the data
var post = $( "#languageinput" ).serialize(); var post = $( "#languageinput" ).serialize();

View File

@ -29,6 +29,17 @@
</fieldset> </fieldset>
</form> </form>
<?php if($_['hasopenid']):?>
<form id="openidform">
<fieldset>
<legend><?php echo $l->t( 'OpenID' );?></legend>
<p>OpenID identity for <b><?php echo OC_User::getUser();?></b></p>
<p><input name='identity' id='identity' value='<?php echo $_['identity']; ?>'></input></p>
<p><input type='submit' value='Save'></input></p>
</fieldset>
</form>
<?php endif;?>
<form id="languageform"> <form id="languageform">
<fieldset> <fieldset>
<legend><?php echo $l->t( 'Language' );?></legend> <legend><?php echo $l->t( 'Language' );?></legend>