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

Conflicts:
	apps/files_sharing/js/share.js
This commit is contained in:
Michael Gapczynski 2011-08-11 11:15:17 -04:00
commit 2af0269eb9
42 changed files with 638 additions and 383 deletions

View File

@ -28,6 +28,9 @@ if( in_array( $username, OC_User::getUsers())){
// Return Success story
if( OC_User::createUser( $username, $password )){
foreach( $groups as $i ){
if(!OC_Group::groupExists($i)){
OC_Group::createGroup($i);
}
OC_Group::addToGroup( $username, $i );
}
echo json_encode( array( "status" => "success", "data" => array( "username" => $username, "groups" => implode( ", ", OC_Group::getUserGroups( $username )))));

View File

@ -19,11 +19,19 @@ $action = "add";
$username = $_POST["username"];
$group = $_POST["group"];
if(!OC_Group::groupExists($group)){
OC_Group::createGroup($group);
}
// Toggle group
if( OC_Group::inGroup( $username, $group )){
$action = "remove";
$error = "remove user from";
$success = OC_Group::removeFromGroup( $username, $group );
$usersInGroup=OC_Group::usersInGroup($group);
if(count($usersInGroup)==0){
OC_Group::deleteGroup($group);
}
}
else{
$success = OC_Group::addToGroup( $username, $group );

View File

@ -33,11 +33,16 @@ OC_Util::addScript( "admin", "apps" );
$registeredApps=OC_App::getAllApps();
$apps=array();
$blacklist=array('files_imageviewer','files_textviewer');//we dont want to show configuration for these
foreach($registeredApps as $app){
$info=OC_App::getAppInfo($app);
$active=(OC_Appconfig::getValue($app,'enabled','no')=='yes')?true:false;
$info['active']=$active;
$apps[]=$info;
if(array_search($app,$blacklist)===false){
$info=OC_App::getAppInfo($app);
$active=(OC_Appconfig::getValue($app,'enabled','no')=='yes')?true:false;
$info['active']=$active;
$apps[]=$info;
}
}
$categories=OC_OCSClient::getCategories();

View File

@ -1,5 +1,12 @@
form {display:inline}
td.remove>img,td.select>input{display:none;cursor:pointer}
td.select,td.remove{width:1em}
tr:hover>td.remove>img{display:inline}
li.selected{background-color:#ddd}
form { display:inline; }
td.password>img, td.remove>img{ display:none;cursor:pointer; }
td.password>span { margin-right:1.2em; }
td.password { width:12em; }
td.password>img { float:right; }
td.remove { width:1em }
tr:hover>td.password>span{ margin:0; }
tr:hover>td.remove>img, tr:hover>td.password>img { display:inline; }
li.selected { background-color:#ddd; }
#content>table { margin-top:6.5em; }
table { width:100%; }

View File

@ -1,5 +1,37 @@
$(document).ready(function(){
$('select[multiple]').chosen();
function applyMultiplySelect(element){
var checked=[];
var user=element.data('username')
if(element.data('userGroups')){
checked=element.data('userGroups').split(', ');
}
if(user){
var checkHandeler=function(group){
if(user==OC.currentUser && group=='admin'){
return false;
}
$.post(
OC.filePath('admin','ajax','togglegroups.php'),
{
username:user,
group:group
},
function(){}
);
}
}else{
checkHandeler=false;
}
element.multiSelect({
createText:'add group',
checked:checked,
oncheck:checkHandeler,
onuncheck:checkHandeler
});
}
$('select[multiple]').each(function(index,element){
applyMultiplySelect($(element));
});
$('td.remove>img').live('click',function(event){
var uid=$(this).parent().parent().data('uid');
@ -13,11 +45,38 @@ $(document).ready(function(){
$(this).parent().parent().remove();
});
$('td.password>img').live('click',function(event){
var img=$(this);
var uid=img.parent().parent().data('uid');
var input=$('<input type="password">');
img.css('display','none');
img.parent().children('span').replaceWith(input);
input.focus();
input.keypress(function(event) {
if(event.keyCode == 13) {
if($(this).val().length>0){
$.post(
OC.filePath('admin','ajax','changepassword.php'),
{username:uid,password:$(this).val()},
function(result){}
);
input.blur();
}else{
input.blur();
}
}
});
input.blur(function(){
$(this).replaceWith($('<span>●●●●●●●</span>'));
img.css('display','');
});
});
$('#newuser').submit(function(event){
event.preventDefault();
var username=$('#newusername').val();
var password=$('#newuserpassword').val();
var groups=$('#newusergroups').val();
var groups=$('#newusergroups').prev().children('div').data('settings').checked;
$.post(
OC.filePath('admin','ajax','createuser.php'),
{
@ -29,72 +88,21 @@ $(document).ready(function(){
}
);
var tr=$('#rightcontent tr').first().clone();
var tr=$('#content table tr').first().clone();
tr.attr('data-uid',username);
tr.find('td.name').text(username);
tr.find('td.groups').text(groups.join(', '));
$('#rightcontent tr').first().after(tr);
if(groups.indexOf($('#leftcontent li.selected').text().trim())!=-1){
tr.find('td.select input').attr('checked','checked');
}
});
$('#newgroup').submit(function(event){
event.preventDefault();
var name=$('#newgroupname').val();
$.post(
OC.filePath('admin','ajax','creategroup.php'),
{groupname:name},
function(result){
}
);
$('#newusergroups').append('<option value="'+name+'">'+name+'</option>');
$('select[multiple]').trigger("liszt:updated");
var li=$('#leftcontent li').first().next().clone();
li.text(name);
$('#leftcontent li').first().after(li);
});
$('#leftcontent li').live('click',function(event){
$('#leftcontent li').removeClass('selected');
$(this).addClass('selected');
$('#rightcontent tr td.select input').show();
$('#rightcontent tr td.select input').removeAttr('checked');
var group=$(this).text().trim();
var rows=$('#rightcontent tr').filter(function(i,tr){
return ($(tr).children('td.groups').text().split(', ').indexOf(group)>-1);
var select=$('<select multiple="multiple" data-placehoder="Groups" title="Groups">');
select.data('username',username);
select.data('userGroups',groups.join(', '));
tr.find('td.groups').empty();
$.each($('#content table').data('groups').split(', '),function(i,group){
select.append($('<option value="'+group+'">'+group+'</option>'));
});
rows.find('td.select input').attr('checked','checked');
});
$('#rightcontent tr td.select input').live('change',function(event){
var group=$('#leftcontent li.selected').text().trim();
var user=$(this).parent().parent().children('td.name').text().trim();
if(group=='admin' && user==OC.currentUser){
event.preventDefault();
$(this).attr('checked','checked');
return false;
}
if(group){
$.post(
OC.filePath('admin','ajax','togglegroups.php'),
{
username:user,
group:group
},
function(result){
}
);
var groups=$(this).parent().parent().children('td.groups').text().trim().split(', ');
if(groups[0]=='') groups.pop();
var index=groups.indexOf(group);
if(index==-1){
groups.push(group);
}else{
groups.splice(index,1);
}
$(this).parent().parent().children('td.groups').text(groups.join(', '));
tr.find('td.groups').append(select);
if(tr.find('td.remve img').length==0){
tr.find('td.remove').append($('<img alt="Remove" title="'+t('admin','Remove')+'" class="svg" src="'+OC.imagePath('core','actions/delete')+'"/>'));
}
applyMultiplySelect(select);
$('#content table tr').last().after(tr);
});
});

View File

@ -1,8 +1,4 @@
<div id="controls">
<form id="newgroup">
<input id="newgroupname" placeholder="<?php echo $l->t('Name')?>"></input>
<input type="submit" value="<?php echo $l->t('Create')?>"></input>
</form>
<form id="newuser">
<input id="newusername" placeholder="<?php echo $l->t('Name')?>"></input>
<input type="password" id="newuserpassword" placeholder="<?php echo $l->t('Password')?>"></input>
@ -14,29 +10,32 @@
<input type="submit" value="<?php echo $l->t('Create')?>"></input>
</form>
</div>
<ul id="leftcontent">
<?php foreach($_["groups"] as $group): ?>
<li data-gid="<?php echo $group["name"]; ?>">
<?php echo $group["name"] ?>
</li>
<?php
$allGroups=array();
foreach($_["groups"] as $group){
$allGroups[]=$group['name'];
}
?>
<table data-groups="<?php echo implode(', ',$allGroups);?>">
<?php foreach($_["users"] as $user): ?>
<tr data-uid="<?php echo $user["name"] ?>">
<td class="name"><?php echo $user["name"]; ?></td>
<td class="password">
<span>●●●●●●●</span>
<img class="svg" src="<?php echo image_path('core','actions/rename.svg')?>"/>
</td>
<td class="groups">
<select data-username="<?php echo $user['name'] ;?>" data-user-groups="<?php echo $user['groups'] ;?>" data-placeholder="groups" title="<?php echo $l->t('Groups')?>" multiple="multiple">
<?php foreach($_["groups"] as $group): ?>
<option value="<?php echo $group['name'];?>"><?php echo $group['name'];?></option>
<?php endforeach;?>
</select>
</td>
<td class="remove">
<?php if($user['name']!=OC_User::getUser()):?>
<img alt="Remove" title="<?php echo $l->t('Remove')?>" class='svg' src='<?php echo image_path('core','actions/delete.svg') ?>'/>
<?php endif;?>
</td>
</tr>
<?php endforeach; ?>
</ul>
<div id="rightcontent">
<table>
<?php foreach($_["users"] as $user): ?>
<tr data-uid="<?php echo $user["name"] ?>">
<td class="select"><input type="checkbox"></input></td>
<td class="name"><?php echo $user["name"]; ?></td>
<td class="groups"><?php if( $user["groups"] ){ echo $user["groups"]; }else{echo "&nbsp";} ?></td>
<td class="remove">
<?php if($user['name']!=OC_User::getUser()):?>
<img alt="Remove" title="<?php echo $l->t('Remove')?>" class='svg' src='<?php echo image_path('core','actions/delete.svg') ?>'/>
<?php endif;?>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
<div id="#selecteduser">
</div>
</table>

View File

@ -38,12 +38,7 @@ $users = array();
$groups = array();
foreach( OC_User::getUsers() as $i ){
// Do some more work here soon
$ingroups = array();
foreach( OC_Group::getUserGroups( $i ) as $userGroup ){
$ingroups[] = $userGroup;
}
$users[] = array( "name" => $i, "groups" => join( ", ", $ingroups ));
$users[] = array( "name" => $i, "groups" => join( ", ", OC_Group::getUserGroups( $i ) ));
}
foreach( OC_Group::getGroups() as $i ){

View File

@ -32,8 +32,8 @@ $carddavBackend = new OC_Connector_Sabre_CardDAV();
// Root nodes
$nodes = array(
new Sabre_DAVACL_PrincipalCollection($principalBackend),
new Sabre_CardDAV_AddressBookRoot($principalBackend, $carddavBackend),
new Sabre_DAVACL_PrincipalCollection($principalBackend),
new Sabre_CardDAV_AddressBookRoot($principalBackend, $carddavBackend),
);
// Fire up server

View File

@ -4,12 +4,12 @@ $(document).ready(function(){
return false;
});*/
$('#contacts_contacts li').live('click',function(){
$('#leftcontent li').live('click',function(){
var id = $(this).data('id');
$.getJSON('ajax/getdetails.php',{'id':id},function(jsondata){
if(jsondata.status == 'success'){
$('#contacts_details').data('id',jsondata.data.id);
$('#contacts_details').html(jsondata.data.page);
$('#rightcontent').data('id',jsondata.data.id);
$('#rightcontent').html(jsondata.data.page);
}
else{
alert(jsondata.data.message);
@ -19,12 +19,12 @@ $(document).ready(function(){
});
$('#contacts_deletecard').live('click',function(){
var id = $('#contacts_details').data('id');
var id = $('#rightcontent').data('id');
$.getJSON('ajax/deletecard.php',{'id':id},function(jsondata){
if(jsondata.status == 'success'){
$('#contacts_contacts [data-id="'+jsondata.data.id+'"]').remove();
$('#contacts_details').data('id','');
$('#contacts_details').html('');
$('#leftcontent [data-id="'+jsondata.data.id+'"]').remove();
$('#rightcontent').data('id','');
$('#rightcontent').html('');
}
else{
alert(jsondata.data.message);
@ -34,10 +34,10 @@ $(document).ready(function(){
});
$('#contacts_addproperty').live('click',function(){
var id = $('#contacts_details').data('id');
var id = $('#rightcontent').data('id');
$.getJSON('ajax/showaddproperty.php',{'id':id},function(jsondata){
if(jsondata.status == 'success'){
$('#contacts_details').append(jsondata.data.page);
$('#rightcontent').append(jsondata.data.page);
}
else{
alert(jsondata.data.message);
@ -79,8 +79,8 @@ $(document).ready(function(){
$('#contacts_newcontact').click(function(){
$.getJSON('ajax/showaddcard.php',{},function(jsondata){
if(jsondata.status == 'success'){
$('#contacts_details').data('id','');
$('#contacts_details').html(jsondata.data.page);
$('#rightcontent').data('id','');
$('#rightcontent').html(jsondata.data.page);
}
else{
alert(jsondata.data.message);
@ -92,8 +92,8 @@ $(document).ready(function(){
$('#contacts_addcardform input[type="submit"]').live('click',function(){
$.post('ajax/addcard.php',$('#contacts_addcardform').serialize(),function(jsondata){
if(jsondata.status == 'success'){
$('#contacts_details').data('id',jsondata.data.id);
$('#contacts_details').html(jsondata.data.page);
$('#rightcontent').data('id',jsondata.data.id);
$('#rightcontent').html(jsondata.data.page);
}
else{
alert(jsondata.data.message);
@ -103,7 +103,7 @@ $(document).ready(function(){
});
$('.contacts_property [data-use="edit"]').live('click',function(){
var id = $('#contacts_details').data('id');
var id = $('#rightcontent').data('id');
var checksum = $(this).parent().parent().data('checksum');
$.getJSON('ajax/showsetproperty.php',{'id': id, 'checksum': checksum },function(jsondata){
if(jsondata.status == 'success'){
@ -129,7 +129,7 @@ $(document).ready(function(){
});
$('.contacts_property [data-use="delete"]').live('click',function(){
var id = $('#contacts_details').data('id');
var id = $('#rightcontent').data('id');
var checksum = $(this).parent().parent().data('checksum');
$.getJSON('ajax/deleteproperty.php',{'id': id, 'checksum': checksum },function(jsondata){
if(jsondata.status == 'success'){

View File

@ -120,10 +120,10 @@ class OC_Contacts_Addressbook{
}
public static function deleteAddressbook($id){
$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE id = ?' );
$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_addressbooks WHERE id = ?' );
$stmt->execute(array($id));
$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_addressbooks WHERE addressbookid = ?' );
$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE addressbookid = ?' );
$stmt->execute(array($id));
return true;

View File

@ -3,15 +3,15 @@ OC_Util::addScript('contacts','interface');
OC_Util::addStyle('contacts','styles');
?>
<div id="contacts_contacts" class="leftcontent">
<div id="leftcontent" class="leftcontent">
<ul>
<?php echo $this->inc("part.contacts"); ?>
</ul>
<a id="contacts_newcontact"><?php echo $l->t('Add Contact'); ?></a>
</div>
<div id="contacts_details" class="rightcontent" data-id="<?php echo $_['id']; ?>">
<div id="rightcontent" class="rightcontent" data-id="<?php echo $_['id']; ?>">
<?php echo $this->inc("part.details"); ?>
</div>
<?php if(count($_['addressbooks']) == 1 ): ?>
<?php echo $l->t('The path to this addressbook is %s', array(OC::$WEBROOT.'/apps/contacts/carddav.php/addressbooks/'.$_['addressbooks'][0]['uri'])); ?>
<?php echo $l->t('The path to this addressbook is %s', array(OC::$WEBROOT.'/apps/contacts/carddav.php/addressbooks/'.OC_User::getUser().'/'.$_['addressbooks'][0]['uri'])); ?>
<?php endif; ?>

View File

@ -31,11 +31,13 @@ $(document).ready(function() {
if(token){
var html="<tr class='link' id='"+token+"'>";
html+="<td class='path'>"+path+"</td>";
html+="<td class='link'><a href='get.php?token="+token+"'>"+$('#baseUrl').val()+"?token="+token+"</a></td>"
html+="<td class='link'><input type='text' value='"+$('#baseUrl').val()+"?token="+token+"' /></td>"
html+="<td><input type='submit' class='delete' data-token='"+token+" value='Delete' /></td>"
html+="</tr>"
$(html).insertAfter($('#newlink_row'));
$('#path').val('');
$('#'+token+' input').focus();
$('#'+token+' input').select();
}
}
});

View File

@ -1,18 +1,20 @@
<input type="hidden" id="baseUrl" value="<?php echo $_['baseUrl'];?>"/>
<table id="linklist">
<tbody>
<thead id="controls">
<tr id="newlink_row">
<form action="#" id="newlink">
<td class="path"><input placeholder="Path" id="path"/></td>
<td><input type="submit" value="Share" /></td>
</form>
</tr>
</thead>
<tbody>
<?php foreach($_['links'] as $link):?>
<tr class="link" id="<?php echo $link['token'];?>">
<td class="path"><?php echo $link['path'];?></td>
<td class="link"><a href="get.php?token=<?php echo $link['token'];?>"><?php echo $_['baseUrl'];?>?token=<?php echo $link['token'];?></a></td>
<td><input type="submit" class="delete" data-token="<?php echo $link['token'];?>" value="<?php echo $l->t( 'Delete' ); ?>" /></td>
</tr>
<tr class="link" id="<?php echo $link['token'];?>">
<td class="path"><?php echo $link['path'];?></td>
<td class="link"><input type="text" value="<?php echo $_['baseUrl'];?>?token=<?php echo $link['token'];?>" /></td>
<td><input type="submit" class="delete" data-token="<?php echo $link['token'];?>" value="<?php echo $l->t( 'Delete' ); ?>" /></td>
</tr>
<?php endforeach;?>
</tbody>
</table>

View File

@ -1,4 +0,0 @@
<a href="<?php echo link_to("files_publiclink", "get.php?token=".$_['token']); ?>"><img src="<?php echo image_path("", "actions/go-home.png"); ?>" alt="Root" /></a>
<?php foreach($_["breadcrumb"] as $crumb): ?>
<a href="<?php echo link_to("files_publiclink", "get.php?token=".$_['token']."&path=".$crumb["dir"]); ?>"><?php echo htmlspecialchars($crumb["name"]); ?></a>
<?php endforeach; ?>

View File

@ -1,9 +0,0 @@
<?php foreach($_["files"] as $file): ?>
<tr>
<td class="selection"><input type="checkbox" /></td>
<td class="filename"><a style="background-image:url(<?php if($file["type"] == "dir") echo mimetype_icon("dir"); else echo mimetype_icon($file["mime"]); ?>)" href="<?php if($file["type"] == "dir") echo link_to("files_publiclink", "get.php?token=".$_['token']."&path=".$file["directory"]."/".$file["name"]); else echo link_to("files_publiclink", "get.php?token=".$_['token']."&path=".$file["directory"]."/".$file["name"]); ?>" title=""><?php echo htmlspecialchars($file["name"]); ?></a></td>
<td class="filesize"><?php echo human_file_size($file["size"]); ?></td>
<td class="date"><?php if($file["type"] != "dir") echo $file["date"]; ?></td>
<td class="fileaction"><a href="" title=""></a></td>
</tr>
<?php endforeach; ?>

View File

@ -1,17 +0,0 @@
<p class="nav">
<?php echo($_['breadcrumb']); ?>
</p>
<table cellspacing="0">
<thead>
<tr>
<th><input type="checkbox" id="select_all" /></th>
<th><?php echo $l->t( 'Name' ); ?></th>
<th><?php echo $l->t( 'Size' ); ?></th>
<th><?php echo $l->t( 'Modified' ); ?></th>
<th></th>
</tr>
</thead>
<tbody id="fileList">
<?php echo($_['fileList']); ?>
</tbody>
</table>

View File

@ -1,8 +1,10 @@
$(document).ready(function() {
FileActions.register('all', 'Share', OC.imagePath('core', 'actions/share'), function(filename) {
createDropdown(filename, $('#dir').val()+'/'+filename);
});
if (typeof FileActions !== 'undefined') {
FileActions.register('all', 'Share', OC.imagePath('core', 'actions/share'), function(filename) {
createDropdown(filename, $('#dir').val()+'/'+filename);
});
};
$('.share').click(function(event) {
event.preventDefault();
var filenames = getSelectedFiles('name');
@ -13,6 +15,17 @@ $(document).ready(function() {
}
createDropdown(false, files);
});
$(this).click(function(event) {
if ($(event.target).parents().index($('#dropdown')) == -1) {
if ($('#dropdown').is(':visible')) {
$('#dropdown').hide('blind', function() {
$('#dropdown').remove();
$('tr').removeClass('mouseOver');
});
}
}
});
$(this).click(function(event) {
if ($(event.target).parents().index($('#dropdown')) == -1) {
@ -182,6 +195,6 @@ function addUser(uid_shared_with, permissions, parentFolder) {
user += "<a href='' title='Unshare' class='unshare' style='display:none;'><img class='svg' src='"+OC.imagePath('core','actions/delete')+"'/></a></li>";
}
$('#share_with option[value="'+uid_shared_with+'"]').remove();
$('share_with').trigger('liszt:updated');
$('#share_with').trigger('liszt:updated');
$(user).appendTo('#shared_list');
}

View File

@ -1,6 +1,6 @@
<fieldset>
<legend>Your Shared Files</legend>
<table id='itemlist'>
<table id="itemlist">
<thead>
<tr>
<th>Item</th>
@ -10,19 +10,19 @@
</thead>
<tbody>
<?php foreach($_['shared_items'] as $item):?>
<tr class='item'>
<td class='source'><?php echo substr($item['source'], strlen("/".$_SESSION['user_id']."/files/"));?></td>
<td class='uid_shared_with'><?php echo $item['uid_shared_with'];?></td>
<td class='permissions'><?php echo "Read"; echo($item['permissions'] & OC_SHARE::WRITE ? ", Edit" : ""); echo($item['permissions'] & OC_SHARE::DELETE ? ", Delete" : "");?></td>
<td><button class='delete fancybutton' data-source='<?php echo $item['source'];?>' data-uid_shared_with='<?php echo $item['uid_shared_with'];?>'>Delete</button></td>
<tr class="item">
<td class="source"><?php echo substr($item['source'], strlen("/".$_SESSION['user_id']."/files/"));?></td>
<td class="uid_shared_with"><?php echo $item['uid_shared_with'];?></td>
<td class="permissions"><?php echo "Read"; echo($item['permissions'] & OC_SHARE::WRITE ? ", Edit" : ""); echo($item['permissions'] & OC_SHARE::DELETE ? ", Delete" : "");?></td>
<td><button class="delete" data-source="<?php echo $item['source'];?>" data-uid_shared_with="<?php echo $item['uid_shared_with'];?>">Delete</button></td>
</tr>
<?php endforeach;?>
<tr id='share_item_row'>
<form action='#' id='share_item'>
<td class='source'><input placeholder='Item' id='source'/></td>
<td class='uid_shared_with'><input placeholder='Share With' id='uid_shared_with'/></td>
<td class='permissions'><input placeholder='Permissions' id='permissions'/></td>
<td><input type='submit' value='Share'/></td>
<tr id="share_item_row">
<form action="#" id="share_item">
<td class="source"><input placeholder="Item" id="source" /></td>
<td class="uid_shared_with"><input placeholder="Share With" id="uid_shared_with" /></td>
<td class="permissions"><input placeholder="Permissions" id="permissions" /></td>
<td><input type="submit" value="Share" /></td>
</form>
</tr>
</tbody>

View File

@ -3,17 +3,13 @@
li button.right.prettybutton{font-size:1em;}
#collection{padding-top:1em;position:relative;width:70ex;float:left;}
#collection li.album,#collection li.song{margin-left:3ex;}
#playlist{border-spacing:0;}
#playlist th{background-color:#ccc; text-align:left; font-size:1.2em; padding:0.2em}
#playlist tr.selected{background-color:#eee;}
#playlist tr.current{background-color:#ccc;}
#playlist td.time, #playlist th.time{text-align:right; padding-right:1em;}
#leftcontent img.remove { display:none; float:right; cursor:pointer; }
#leftcontent li:hover img.remove { display:inline; }
#collection li button{float:right;}
#collection li,#playlist li{list-style-type:none;}
.template{display:none}
#collection li{padding-right:10px;}
img.remove{float:right;}
#searchresults input.play, #searchresults input.add{float:right; height:16px; width:16px;}
#collection tr.collapsed td.album, #collection tr.collapsed td.title{color:#ddd}
a.expander{float:right;display:block}

View File

@ -30,7 +30,7 @@ var PlayList={
if(PlayList.player){
if(PlayList.player.data('jPlayer').options.supplied!=PlayList.items[index].type){//the the audio type changes we need to reinitialize jplayer
PlayList.player.jPlayer("destroy");
PlayList.init(PlayList.items[index].type,function(){PlayList.play(null,time,eady)});
PlayList.init(PlayList.items[index].type,function(){PlayList.play(null,time,ready)});
}else{
PlayList.player.jPlayer("setMedia", PlayList.items[PlayList.current]);
PlayList.items[index].playcount++;
@ -73,7 +73,7 @@ var PlayList={
PlayList.render();
return false;
});
PlayList.player=$('#jp-interface div.player');
PlayList.player=$('#controls div.player');
}
$(PlayList.player).jPlayer({
ended:PlayList.next,
@ -91,7 +91,7 @@ var PlayList={
}
},
volume:PlayList.volume,
cssSelectorAncestor:'#jp-interface',
cssSelectorAncestor:'#controls',
swfPath:OC.linkTo('media','js'),
});
},

View File

@ -2,49 +2,21 @@ PlayList.render=function(){
$('#playlist').show();
PlayList.parent.empty();
for(var i=0;i<PlayList.items.length;i++){
var tr=PlayList.template.clone();
var item=PlayList.items[i];
if(i==PlayList.current){
tr.addClass('current');
}
tr.removeClass('template');
tr.data('name',item.name);
tr.data('artist',item.artist);
tr.children('td.name').children('span').text(item.name);
tr.children('td.artist').text(item.artist);
tr.children('td.album').text(item.album);
tr.data('index',i);
tr.click(function(){
PlayList.play($(this).data('index'));
PlayList.render();
});
tr.hover(function(){
var button=$('<img class="remove" title="'+t('media','Remove')+'"/>');
button.attr('src',OC.imagePath('core','actions/delete'));
$(this).children().last().append(button);
button.click(function(event){
event.stopPropagation();
event.preventDefault();
var index=$(this).parent().parent().data('index');
PlayList.remove(index);
});
},function(){
$(this).children().last().children('img.remove').remove();
});
tr.children('td.name').children('input').click(function(event){
var li=$('<li/>');
li.append(item.name);
var img=$('<img class="remove" src="'+OC.imagePath('core','actions/delete')+'"/>');
img.click(function(event){
event.stopPropagation();
if($(this).attr('checked')){
$(this).parent().parent().addClass('selected');
if($('tbody td.name input:checkbox').length==$('tbody td.name input:checkbox:checked').length){
$('#selectAll').attr('checked',true);
}
}else{
$(this).parent().parent().removeClass('selected');
$('#selectAll').attr('checked',false);
}
procesSelection();
PlayList.remove($(this).parent().data('index'));
});
PlayList.parent.append(tr);
li.click(function(event){
PlayList.play($(this).data('index'));
});
li.append(img)
li.data('index',i);
li.addClass('song');
PlayList.parent.append(li);
}
}
PlayList.getSelected=function(){
@ -55,78 +27,16 @@ PlayList.hide=function(){
}
$(document).ready(function(){
PlayList.parent=$('#playlist tbody');
PlayList.template=$('#playlist tr.template');
PlayList.parent=$('#leftcontent');
$('#selectAll').click(function(){
if($(this).attr('checked')){
// Check all
$('tbody td.name input:checkbox').attr('checked', true);
$('tbody td.name input:checkbox').parent().parent().addClass('selected');
$('#leftcontent li.song input:checkbox').attr('checked', true);
$('#leftcontent li.song input:checkbox').parent().addClass('selected');
}else{
// Uncheck all
$('tbody td.name input:checkbox').attr('checked', false);
$('tbody td.name input:checkbox').parent().parent().removeClass('selected');
$('#leftcontent li.song input:checkbox').attr('checked', false);
$('#leftcontent li.song input:checkbox').parent().removeClass('selected');
}
procesSelection();
});
});
function procesSelection(){
var selected=PlayList.getSelected();
if(selected.length==0){
$('th.name span').text(t('media','Name'));
$('th.artist').text(t('media','Artist'));
$('th.album').text(t('media','Album'));
$('th.time').text(t('media','Time'));
$('th.plays').empty();
$('th.plays').text(t('media','Plays'));
}else{
var name=selected.length+' '+t('media','selected');
var artist=$(selected[0]).data('artist');
var album=$(selected[0]).data('album');
var time=$(selected[0]).data('time');
var plays=$(selected[0]).data('plays');
for(var i=1;i<selected.length;i++){
var item=$(selected[i]);
if(artist!='mixed' && item.data('artist')!==artist){
artist='mixed'
}
if(album!='mixed' && item.data('album')!==album){
album='mixed'
}
if(time!='mixed' && item.data('time')!==time){
time='mixed'
}
if(plays!='mixed' && item.data('plays')!==plays){
plays='mixed'
}
}
$('th.name span').text(name);
$('th.artist').text(artist);
$('th.album').text(album);
if(time!='mixed'){
var secconds=(time%60);
if(secconds<10){
secconds='0'+secconds;
}
var time=Math.floor(time/60)+':'+secconds;
}
$('th.time').text(time);
$('th.plays').text(plays);
var button=$('<img class="remove" title="Remove"/>');
button.attr('src',OC.imagePath('core','actions/delete'));
$('th.plays').append(button);
button.click(function(event){
event.stopPropagation();
event.preventDefault();
PlayList.getSelected().each(function(index,element){
var index=$(element).data('index');
PlayList.items[index]=null;
});
PlayList.items=PlayList.items.filter(function(item){return item!==null});
PlayList.render();
PlayList.save();
procesSelection();
});
}
}

View File

@ -20,32 +20,7 @@
<div class="player" id="jp-player"></div>
</div>
<div id="leftcontent">
<table id="playlist">
<thead>
<tr>
<th class="name"><input id="selectAll" type="checkbox"><?php echo $l->t('Name')?></th>
<th class="artist"><?php echo $l->t('Artist')?></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<?php echo $l->t('The playlist is empty')?>
</td>
</tr>
</tbody>
<tfoot>
<tr class="template">
<td class="name">
<input type="checkbox">
<span></span>
</td>
<td class="artist"></td>
</tr>
</tfoot>
</table>
</div>
<ul id="leftcontent"></ul>
<div id="rightcontent">
<div id="scan">

6
core/css/multiselect.css Normal file
View File

@ -0,0 +1,6 @@
ul.multiselectoptions { z-index:49; position:absolute; background-color:#fff; padding-top:.5em; border-bottom-left-radius:.5em; border-bottom-right-radius:.5em; border:1px solid #ddd; border-top:none; }
div.multiselect { padding-right:.6em; display:inline; position:relative; display:inline-block }
div.multiselect.active { background-color:#fff; border-bottom:none; border-bottom-left-radius:0; border-bottom-right-radius:0; z-index:50; position:relative }
div.multiselect>span:first-child { margin-right:2em; }
div.multiselect>span:last-child { float:right; position:relative }
ul.multiselectoptions input.new{ margin:0; padding-bottom:0.2em; padding-top:0.2em; border-top-left-radius:0; border-top-right-radius:0; }

View File

@ -15,7 +15,7 @@ body { background:#fefefe; font:normal 80%/1.6em "Lucida Grande", Arial, Verdana
/* HEADERS */
#body-user #header, #body-settings #header { position:fixed; top:0; z-index:300; width:100%; height:2.5em; padding:.5em; background:#1d2d44; -moz-box-shadow:0 0 10px #000, inset 0 -2px 10px #222; -webkit-box-shadow:0 0 10px #000, inset 0 -2px 10px #222; box-shadow:0 0 10px #000, inset 0 -2px 10px #222; }
#body-user #header, #body-settings #header { position:fixed; top:0; z-index:100; width:100%; height:2.5em; padding:.5em; background:#1d2d44; -moz-box-shadow:0 0 10px #000, inset 0 -2px 10px #222; -webkit-box-shadow:0 0 10px #000, inset 0 -2px 10px #222; box-shadow:0 0 10px #000, inset 0 -2px 10px #222; }
#body-login #header { margin:-2em auto 0; text-align:center; height:10em;
-moz-box-shadow:0 0 1em #000; -webkit-box-shadow:0 0 1em #000; box-shadow:0 0 1em #000;
background: #1d2d44; /* Old browsers */
@ -33,12 +33,12 @@ h1 { margin:1em 3em 1em 0; border-bottom:1px solid #666; text-transform:uppercas
/* INPUTS */
input[type="text"], input[type="password"] { cursor:text; }
input, select { font-size:1em; width:10em; margin:.3em; padding:.6em .5em .4em; background:#fff; color:#333; border:1px solid #ddd; -moz-box-shadow:0 1px 1px #fff, 0 2px 0 #bbb inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; }
input, select, .button { font-size:1em; width:10em; margin:.3em; padding:.6em .5em .4em; background:#fff; color:#333; border:1px solid #ddd; -moz-box-shadow:0 1px 1px #fff, 0 2px 0 #bbb inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; }
input[type="text"], input[type="password"] { background:#f8f8f8; color:#555; cursor:text; }
input[type="text"]:hover, input[type="text"]:focus, input[type="password"]:hover, input[type="password"]:focus { background:#fff; color:#333; }
input[type="submit"], input[type="button"] { width:auto; padding:.4em; border:1px solid #ddd; font-weight:bold; cursor:pointer; background:#f8f8f8; color:#555; text-shadow:#fff 0 1px 0; -moz-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; }
input[type="submit"]:hover, input[type="submit"]:focus, input[type="button"]:hover, input[type="button"]:focus { background:#fff; color:#333; }
input[type="submit"], input[type="button"], .button { width:auto; padding:.4em; border:1px solid #ddd; font-weight:bold; cursor:pointer; background:#f8f8f8; color:#555; text-shadow:#fff 0 1px 0; -moz-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; }
input[type="submit"]:hover, input[type="submit"]:focus, input[type="button"]:hover, input[type="button"]:focus, .button:hover { background:#fff; color:#333; }
input[type="checkbox"] { width:auto; }
#body-login input { font-size:1.5em; }
@ -49,12 +49,6 @@ radius:1em; border-radius:1em; }
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; }
form#user_settings { max-width:600px; }
form#user_settings p label { display:block; float:left; width:35%; padding:.4em .5em 0 0; text-align:right; }
form p { padding:.5em 4em .5em .5em; text-align:left; }
form p.form_footer { margin:1em 0 0 0; text-align:right; }
form label { cursor:pointer; }
#body-settings fieldset { padding:1em; width:40em; margin:1em;
border:1px solid #ddd; font-weight:bold; background:#f2f2f2; color:#555; text-shadow:#fff 0 1px 0; -moz-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em;}
@ -62,10 +56,10 @@ legend { padding:.2em; font-size:1.2em; }
.template{display:none;}
/* CONTENT ------------------------------------------------------------------ */
#controls { width:100%; top:3.5em; height:2.8em; margin:0; background:#f7f7f7; border-bottom:1px solid #eee; position:fixed; z-index:200; -moz-box-shadow:0 -3px 7px #000; -webkit-box-shadow:0 -3px 7px #000; box-shadow:0 -3px 7px #000; }
#controls { 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; }
#content { margin:3.5em 0 0 12.5em; padding-bottom:10em; }
#leftcontent { position:absolute; top:6.5em; width:20em; background:#f8f8f8; height:100%; border-right:1px solid #ddd; }
#rightcontent { position:absolute; top:6.5em; left:33em; }
#leftcontent { position:absolute; top:6.4em; width:20em; background:#f8f8f8; height:100%; border-right:1px solid #ddd; }
#rightcontent { position:absolute; top:6.4em; left:33em; }
/* LOG IN & INSTALLATION ------------------------------------------------------------ */
#body-login { background:#ddd; }
@ -78,26 +72,19 @@ legend { padding:.2em; font-size:1.2em; }
#login form fieldset legend { font-weight:bold; }
#login form label { position:absolute; margin:.8em .8em; font-size:1.5em; color:#666; }
#login form label#directorylabel { display:block; margin:.95em 0 .8em -5.5em; }
#login form input[type="checkbox"]+label { position:relative; margin:0; font-size:1em; text-shadow:#fff 0 1px 0; }
#login form ul.errors { background:#fed7d7; border:1px solid #f00; list-style-indent:inside; margin:0 0 4em 0; padding:1em 1em 1em 5em; }
/* META NAVIGATION (Settings, Log out) ---------------------------------------------------------------- */
#metanav { float:right; position:relative; top:.5em; right:1em; margin:0; padding:0; }
#metanav li { display:inline; }
#metanav li a { margin:.2em; padding:.7em; }
#metanav li a:hover, #metanav li a:focus { background:rgba(0,0,0,.5); -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:#555 0 1px 0; -moz-box-shadow:#555 0 1px 0; -webkit-box-shadow:#555 0 1px 0; }
#metanav li a img { vertical-align:middle; }
/* NAVIGATION ------------------------------------------------------------- */
#navigation { position:fixed; top:3.5em; float:left; width:12.5em; padding:0; z-index:250; height:100%; background:#eee; border-right: 1px #ccc solid; -moz-box-shadow: -3px 0 7px #000; -webkit-box-shadow: -3px 0 7px #000; box-shadow: -3px 0 7px #000; } }
#navigation ul { border-top:1px solid #ccc; }
#navigation a { display:block; padding:.6em .5em .4em 2.5em; background:1em center no-repeat; border-bottom:1px solid #ddd; border-top:1px solid #fff; text-decoration:none; font-size:1.2em; color:#666; text-shadow:#f8f8f8 0 1px 0; }
#navigation a.active, #navigation a:hover, #navigation a:focus, #navigation a.selected { background-color:#ccc; border-top:1px solid #c8c8c8; border-bottom:1px solid #ccc; color:#000; }
#navigation { position:fixed; top:3.5em; float:left; width:12.5em; padding:0; z-index:75; height:100%; background:#eee; border-right: 1px #ccc solid; -moz-box-shadow: -3px 0 7px #000; -webkit-box-shadow: -3px 0 7px #000; box-shadow: -3px 0 7px #000; }
#navigation a { display:block; padding:.6em .5em .4em 2.5em; background:#eee 1em center no-repeat; border-bottom:1px solid #ddd; border-top:1px solid #fff; text-decoration:none; font-size:1.2em; color:#666; text-shadow:#f8f8f8 0 1px 0; }
#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; }
#logout { position:absolute; right:0; top:0; padding:1.2em 2em .55em 1.2em; }
#logout:hover, #logout:focus { background:rgba(0,0,0,.5); }
/* USER SETTINGS ------------------------------------------------------------ */
#quota_indicator { margin:0 4em 1em 0; padding:0; border:1px solid #ccc; border-radius:10px; -webkit-border-radius:10px; -moz-border-radius:10px; }
@ -105,3 +92,6 @@ legend { padding:.2em; font-size:1.2em; }
li.error { width:640px; margin:4em auto; padding:1em 1em 1em 4em; background:#fee url('../img/task-attention.png') .8em .8em no-repeat; border:1px solid #ccc; -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; }
.hidden{ display:none; }
#notification{ z-index:101; background-color:#fc4; border:0; padding:0 .7em .3em; display:block; 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; }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1012 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="11"
height="36"
id="svg2"
version="1.1"
inkscape:version="0.48.1 r9760"
sodipodi:docname="New document 1">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="18.657977"
inkscape:cx="2.6788772"
inkscape:cy="16.807262"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:window-width="1280"
inkscape:window-height="776"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid3760"
empspacing="5"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1016.3622)">
<path
transform="translate(0,1016.3622)"
style="fill:#dddddd;fill-opacity:1;stroke:none"
d="M 0,0 11,18 0,36 z"
id="rect3757"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
core/img/breadcrumb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

77
core/img/breadcrumb.svg Normal file
View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="11"
height="36"
id="svg2"
version="1.1"
inkscape:version="0.48.1 r9760"
sodipodi:docname="breadcrumb.svg"
inkscape:export-filename="/home/jancborchardt/breadcrumb.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="26.386364"
inkscape:cx="1.7139473"
inkscape:cy="25.655289"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:window-width="1280"
inkscape:window-height="776"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid3760"
empspacing="5"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1016.3622)">
<path
transform="translate(0,1016.3622)"
style="fill:#dddddd;fill-opacity:1;stroke:#dddddd;stroke-width:0.89999998000000003;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:31.20000076000000178;stroke-opacity:1;stroke-dasharray:none;marker-start:none"
d="m 0.5,0 10,18 -10,18 10,-18 z"
id="rect3757"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc"
inkscape:export-filename="/home/jancborchardt/breadcrumb-start.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -275,7 +275,29 @@ $(document).ready(function(){
})
});
if (!Array.prototype.map){
Array.prototype.map = function(fun /*, thisp */){
"use strict";
if (this === void 0 || this === null)
throw new TypeError();
var t = Object(this);
var len = t.length >>> 0;
if (typeof fun !== "function")
throw new TypeError();
var res = new Array(len);
var thisp = arguments[1];
for (var i = 0; i < len; i++){
if (i in t){
res[i] = fun.call(thisp, t[i], i, t);
}
}
return res;
};
}
/*

160
core/js/multiselect.js Normal file
View File

@ -0,0 +1,160 @@
(function( $ ){
var multiSelectId=-1;
$.fn.multiSelect=function(options){
multiSelectId++;
var settings = {
'createCallback':false,
'createText':false,
'title':this.attr('title'),
'checked':[],
'oncheck':false,
'onuncheck':false,
};
$.extend(settings,options);
var button=$('<div class="multiselect button"><span>'+settings.title+'</span><span>▾</span></div>');
if(settings.checked.length>0){
button.children('span').first().text(settings.checked.join(', '));
}
var span=$('<span/>');
span.append(button);
button.data('id',multiSelectId);
button.selectedItems=[];
this.hide();
this.before(span);
settings.minWidth=button.width();
button.css('min-width',settings.minWidth);
settings.minOuterWidth=button.outerWidth()-2;
button.data('settings',settings);
button.click(function(event){
var button=$(this);
if(button.parent().children('ul').length>0){
button.parent().children('ul').slideUp(400,function(){
button.parent().children('ul').remove();
button.removeClass('active');
});
return;
}
var lists=$('ul.multiselectoptions');
lists.slideUp(400,function(){
lists.remove();
$('div.multiselect').removeClass('active');
button.addClass('active');
});
button.addClass('active');
event.stopPropagation();
var options=$(this).parent().next().children().map(function(){return $(this).val()});
var list=$('<ul class="multiselectoptions"/>').hide().appendTo($(this).parent());
function createItem(item,checked){
var id='ms'+multiSelectId+'-option-'+item;
var input=$('<input id="'+id+'" type="checkbox"/>');
var label=$('<label for="'+id+'">'+item+'</label>');
if(settings.checked.indexOf(item)!=-1 || checked){
input.attr('checked','checked');
}
if(checked){
settings.checked.push(item);
}
input.change(function(){
var groupname=$(this).next().text();
if($(this).attr('checked')){
settings.checked.push(groupname);
if(settings.oncheck){
if(settings.oncheck(groupname)===false){
$(this).removeAttr('checked');
return;
}
}
}else{
var index=settings.checked.indexOf(groupname);
settings.checked.splice(index,1);
if(settings.onuncheck){
if(settings.onuncheck(groupname)===false){
$(this).attr('checked','checked');
return;
}
}
}
var oldWidth=button.width();
if(settings.checked.length>0){
button.children('span').first().text(settings.checked.join(', '));
}else{
button.children('span').first().text(settings.title);
}
var newOuterWidth=Math.max((button.outerWidth()-2),settings.minOuterWidth)+'px'
var newWidth=Math.max(button.width(),settings.minWidth);
button.css('height',button.height());
button.css('white-space','nowrap');
button.css('width',oldWidth);
button.animate({'width':newWidth},undefined,undefined,function(){
button.css('width','');
});
list.animate({'width':newOuterWidth});
});
var li=$('<li></li>');
li.append(input).append(label);
return li;
}
$.each(options,function(index,item){
list.append(createItem(item));
});
button.parent().data('preventHide',false);
if(settings.createText){
var li=$('<li>+ <em>'+settings.createText+'<em></li>');
li.click(function(event){
li.empty();
var input=$('<input class="new">');
li.append(input);
input.focus();
input.css('width',button.width());
button.parent().data('preventHide',true);
input.keypress(function(event) {
if(event.keyCode == 13) {
event.preventDefault();
event.stopPropagation();
var li=$(this).parent();
$(this).remove();
li.text('+ '+settings.createText);
li.before(createItem($(this).val()));
li.prev().children('input').trigger('click');
button.parent().data('preventHide',false);
var select=button.parent().next();
select.append($('<option value="'+$(this).val()+'">'+$(this).val()+'</option>'));
if(settings.createCallback){
settings.createCallback();
}
}
});
input.blur(function(){
event.preventDefault();
event.stopPropagation();
$(this).remove();
li.text('+ '+settings.createText);
setTimeout(function(){
button.parent().data('preventHide',false);
},100);
});
});
list.append(li);
}
var pos=button.position();
list.css('top',pos.top+button.outerHeight()-5);
list.css('left',pos.left+3);
list.css('width',(button.outerWidth()-2)+'px');
list.slideDown();
list.click(function(event){
event.stopPropagation();
});
});
$(window).click(function(){
if(!button.parent().data('preventHide')){
button.parent().children('ul').slideUp(400,function(){
button.parent().children('ul').remove();
button.removeClass('active');
});
}
});
return span;
};
})( jQuery );

View File

@ -30,10 +30,10 @@
<body id="<?php echo $_['bodyid'];?>">
<header><div id="header">
<a href="<?php echo link_to('', 'index.php'); ?>" title="" id="owncloud"><img src="<?php echo image_path('', 'owncloud-logo-small-white.png'); ?>" alt="ownCloud" /></a>
<?php echo $_['searchbox']?>
<ul id="metanav">
<li><a href="<?php echo link_to('', 'index.php'); ?>?logout=true" title="<?php echo $l->t('Log out');?>"><img class='svg' src="<?php echo image_path('', 'actions/logout.svg'); ?>" /></a></li>
</ul>
<form class="searchbox" action="#" method="post">
<input id='searchbox' type="search" name="query" value="<?php if(isset($_POST['query'])){echo $_POST['query'];};?>" class="prettybutton" autocomplete="off" />
</form>
<a id="logout" href="<?php echo link_to('', 'index.php'); ?>?logout=true" title="<?php echo $l->t('Log out');?>"><img class='svg' src="<?php echo image_path('', 'actions/logout.svg'); ?>" /></a>
</div></header>
<nav><div id="navigation">

View File

@ -1,3 +0,0 @@
<form class="searchbox" action="#" method="post">
<input id='searchbox' type="search" name="query" value="<?php if(isset($_POST['query'])){echo $_POST['query'];};?>" class="prettybutton" autocomplete="off" />
</form>

View File

@ -1,19 +1,25 @@
/* Copyright (c) 2011, Jan-Christoph Borchardt
This file is licensed under the Affero General Public License version 3 or later.
See the COPYING-README file. */
/* FILE MENU */
.actions { padding:.6em; float:right; margin-right:13em; }
.actions input { margin:0; padding:.3em; }
#file_menu { right:0; position:absolute; top:0; }
#file_menu a { display:block; float:left; background-image:none; text-decoration:none; }
.file_upload_form, #file_newfolder_form { display:inline; }
.file_upload_form, #file_newfolder_form { display:inline; float: left;}
#fileSelector, #file_upload_submit, #file_newfolder_submit { display:none; }
.file_upload_wrapper, #file_newfolder_name { background-repeat:no-repeat; background-position:.5em .3em; padding-left:2em; }
.file_upload_wrapper { background:url("../img/file.png"); font-weight:bold; position:relative; top:-1.2em; left:-2em; display:-moz-inline-box; /* fallback for older firefox versions*/ display:inline-block; width:8em; }
.file_upload_start { opacity:0; filter:alpha(opacity=0); }
.file_upload_wrapper { font-weight:bold; display:-moz-inline-box; /* fallback for older firefox versions*/ display:inline-block; padding-left:0; overflow:hidden; position:relative; margin-right:1.5em;}
#file_newfolder_name { background-image:url("../img/folder.png"); font-weight:bold; width:8em; }
.file_upload_start, .file_upload_filename { position:absolute; top:0; left:0; font-size:1em; }
.file_upload_start, .file_upload_filename { font-size:1em; }
#file_newfolder_submit, #file_upload_submit { width:3em; }
.file_upload_target { display:none; }
.file_upload_start { opacity:0; filter:alpha(opacity=0); z-index:1; position:absolute; left:0; top:0; width:100%; cursor:pointer;}
.file_upload_filename { z-index:100; cursor:pointer;}
/* FILE TABLE */
span#emptyfolder { position:absolute; margin:10em 0 0 10em; font-size:1.5em; font-weight:bold; color:#888; text-shadow:#fff 0 1px 0; }
table { position:relative; top:37px; width:100%; }
@ -39,8 +45,7 @@ table td.filename a, table td.login, table td.logout, table td.download, table t
table td.filename .nametext, .modified { float:left; padding:.3em 0; }
table td.filename .nametext { width:60%; }
table td.filename form { float:left; font-size:.85em; }
/* #fileList tr.selected td.filename a, #fileList tr:hover td.filename a { background-image:none !important } */
table thead.fixed tr{position:fixed; top:6.4em;z-index:100;}
table thead.fixed tr{position:fixed; top:6.3em; z-index:49; -moz-box-shadow:0 -3px 7px #000; -webkit-box-shadow:0 -3px 7px #000; box-shadow:0 -3px 7px #000;}
table thead.fixed {height:2em}
#fileList tr td.filename>input[type=checkbox]:first-child { display:none; float:left; margin:.7em 0 0 1em; /* bigger clickable area doesnt work in FF width:2.8em; height:2.4em;*/ }
#fileList tr td.filename>input[type=checkbox]:checked:first-child, #fileList tr:hover td.filename>input[type=checkbox]:first-child { display:inline; }
@ -52,7 +57,4 @@ table thead.fixed {height:2em}
.selectedActions a:hover, a.file_action:hover { background:#fff; -moz-box-shadow:0 0 10px #fff; -webkit-box-shadow:0 0 10px #fff; box-shadow:0 0 10px #fff; -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; }
/* 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; }
#notification{ z-index:150; background-color:#fc4; border:0; padding:0 .7em .3em; display:block; 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; }
#navigation>ul>li:first-child { background:url('../../core/img/breadcrumb-start.png') no-repeat 12.5em 0px; width:12.5em; padding-right:1em; }

View File

@ -1,5 +1,5 @@
<?php foreach($_["breadcrumb"] as $crumb): ?>
<div class='crumb' data-dir='<?php echo $crumb["dir"];?>' style='background-image:url("<?php echo image_path('core','breadcrumb-divider.png');?>")'>
<div class="crumb svg" data-dir='<?php echo $crumb["dir"];?>' style='background-image:url("<?php echo image_path('core','breadcrumb.png');?>")'>
<a href="<?php echo link_to("files", "index.php?dir=".$crumb["dir"]); ?>"><?php echo htmlspecialchars($crumb["name"]); ?></a>
</div>
<?php endforeach; ?>
<?php endforeach; ?>

View File

@ -149,9 +149,11 @@ OC_Group::setBackend( OC_Config::getValue( "groupbackend", "database" ));
OC_Util::addScript( "jquery-1.6.2.min" );
OC_Util::addScript( "jquery-ui-1.8.14.custom.min" );
OC_Util::addScript( "js" );
OC_Util::addScript( "multiselect" );
OC_Util::addScript('search','result');
OC_Util::addStyle( "jquery-ui-1.8.14.custom" );
OC_Util::addStyle( "styles" );
OC_Util::addStyle( "multiselect" );
// Load Apps
// This includes plugins for users and filesystems as well

View File

@ -171,11 +171,11 @@ class OC_Group {
*/
public static function addToGroup( $uid, $gid ){
// Does the user exist?
if( !in_array( $uid, OC_User::getUsers())){
if( !OC_User::userExists($uid)){
return false;
}
// Does the group exist?
if( !in_array( $gid, self::getGroups())){
if( !OC_Group::groupExists($gid)){
return false;
}
@ -234,4 +234,21 @@ class OC_Group {
public static function getGroups(){
return self::$_backend->getGroups();
}
/**
* check if a group exists
* @param string $gid
* @return bool
*/
public static function groupExists($gid){
return in_array( $gid, self::getGroups());
}
/**
* @brief get a list of all users in a group
* @returns array with user ids
*/
public static function usersInGroup($gid){
return self::$_backend->usersInGroup();
}
}

View File

@ -93,4 +93,10 @@ abstract class OC_Group_Backend {
* Returns a list with all groups
*/
public static function getGroups(){}
/**
* @brief get a list of all users in a group
* @returns array with user ids
*/
public static function usersInGroup($gid){}
}

View File

@ -53,7 +53,7 @@ class OC_Group_Database extends OC_Group_Backend {
*/
public static function createGroup( $gid ){
// Check for existence
$query = OC_DB::prepare( "SELECT * FROM `*PREFIX*groups` WHERE gid = ?" );
$query = OC_DB::prepare( "SELECT gid FROM `*PREFIX*groups` WHERE gid = ?" );
$result = $query->execute( array( $gid ));
if( $result->numRows() > 0 ){
@ -98,7 +98,7 @@ class OC_Group_Database extends OC_Group_Backend {
*/
public static function inGroup( $uid, $gid ){
// check
$query = OC_DB::prepare( "SELECT * FROM `*PREFIX*group_user` WHERE gid = ? AND uid = ?" );
$query = OC_DB::prepare( "SELECT uid FROM `*PREFIX*group_user` WHERE gid = ? AND uid = ?" );
$result = $query->execute( array( $gid, $uid ));
return $result->numRows() > 0 ? true : false;
@ -146,7 +146,7 @@ class OC_Group_Database extends OC_Group_Backend {
*/
public static function getUserGroups( $uid ){
// No magic!
$query = OC_DB::prepare( "SELECT * FROM `*PREFIX*group_user` WHERE uid = ?" );
$query = OC_DB::prepare( "SELECT gid FROM `*PREFIX*group_user` WHERE uid = ?" );
$result = $query->execute( array( $uid ));
$groups = array();
@ -164,7 +164,7 @@ class OC_Group_Database extends OC_Group_Backend {
* Returns a list with all groups
*/
public static function getGroups(){
$query = OC_DB::prepare( "SELECT * FROM `*PREFIX*groups`" );
$query = OC_DB::prepare( "SELECT gid FROM `*PREFIX*groups`" );
$result = $query->execute();
$groups = array();
@ -174,4 +174,18 @@ class OC_Group_Database extends OC_Group_Backend {
return $groups;
}
/**
* @brief get a list of all users in a group
* @returns array with user ids
*/
public static function usersInGroup($gid){
$query=OC_DB::prepare('SELECT uid FROM *PREFIX*group_user WHERE gid=?');
$users=array();
$result=$query->execute(array($gid));
while($row=$result->fetchRow()){
$users[]=$row['uid'];
}
return $users;
}
}

View File

@ -230,9 +230,7 @@ class OC_Template{
// Decide which page we show
if( $this->renderas == "user" ){
$page = new OC_Template( "core", "layout.user" );
$search=new OC_Template( 'core', 'part.searchbox');
$search->assign('searchurl',OC_Helper::linkTo( 'search', 'index.php' ));
$page->assign('searchbox', $search->fetchPage());
$page->assign('searchurl',OC_Helper::linkTo( 'search', 'index.php' ));
if(array_search(OC_APP::getCurrentApp(),array('settings','admin','help'))!==false){
$page->assign('bodyid','body-settings');
}else{

View File

@ -1,4 +1,4 @@
#searchresults { list-style:none; position:fixed; top:3.5em; right:0; z-index:100; background-color:#fff; overflow:hidden; text-overflow:ellipsis; max-height:80%; width:26.5em; padding-bottom:1em; -moz-box-shadow:0 0 10px #000; -webkit-box-shadow:0 0 10px #000; box-shadow:0 0 10px #000; -moz-border-radius-bottomleft:1em; -webkit-border-bottom-left-radius:1em; border-bottom-left-radius:1em; }
#searchresults { list-style:none; position:fixed; top:3.5em; right:0; z-index:75; background-color:#fff; overflow:hidden; text-overflow:ellipsis; max-height:80%; width:26.5em; padding-bottom:1em; -moz-box-shadow:0 0 10px #000; -webkit-box-shadow:0 0 10px #000; box-shadow:0 0 10px #000; -moz-border-radius-bottomleft:1em; -webkit-border-bottom-left-radius:1em; border-bottom-left-radius:1em; }
#searchresults li.resultHeader { font-size:1.2em; font-weight:bold; border-bottom:solid 1px #CCC; padding:.2em; background-color:#eee; }
#searchresults li.result { margin-left:2em; }
#searchresults table { width:100%; table-layout:fixed; top:0; border-spacing:0; }