aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan-Christoph Borchardt <JanCBorchardt@fsfe.org>2011-04-17 18:00:27 +0200
committerJan-Christoph Borchardt <JanCBorchardt@fsfe.org>2011-04-17 18:00:27 +0200
commit799a1b95390a10a81d1abebe446a00fb06b07ba5 (patch)
tree9540e281bffd181616e92cc7e4de5b6697aad592
parent8dcfd0ee8abc72d5446fb9520c52328ba6cb663a (diff)
parent9b26cb0bfb6c6b3aab03eb3320a9a9917786f1ac (diff)
downloadnextcloud-server-799a1b95390a10a81d1abebe446a00fb06b07ba5.tar.gz
nextcloud-server-799a1b95390a10a81d1abebe446a00fb06b07ba5.zip
Merge branch 'refactoring' of git://anongit.kde.org/owncloud into refactoring
-rw-r--r--admin/templates/app.php2
-rw-r--r--files/ajax/newfolder.php29
-rw-r--r--files/css/files.css4
-rw-r--r--files/js/files.js62
-rw-r--r--files/templates/index.php7
-rw-r--r--help/css/help.css6
-rw-r--r--help/templates/index.php12
-rw-r--r--lib/ocsclient.php3
8 files changed, 105 insertions, 20 deletions
diff --git a/admin/templates/app.php b/admin/templates/app.php
index 4b5740c2bc4..9a788cf64c4 100644
--- a/admin/templates/app.php
+++ b/admin/templates/app.php
@@ -19,7 +19,7 @@ $app=$_['app'];
<td class="description" valign="top">
<?php echo $app["description"]; ?>
<br />
- <?php echo('<a class="description" href="'.$app["detailpage"].'">read more</a><br />'); ?>
+ <?php echo('<a class="description" target="_blank" href="'.$app["detailpage"].'">read more</a><br />'); ?>
</td>
<td width="1" valign="top" class="install"><a href="">INSTALL</a></td>
</tr>
diff --git a/files/ajax/newfolder.php b/files/ajax/newfolder.php
new file mode 100644
index 00000000000..988e7f04012
--- /dev/null
+++ b/files/ajax/newfolder.php
@@ -0,0 +1,29 @@
+<?php
+
+// Init owncloud
+require_once('../../lib/base.php');
+
+// 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" => "Authentication error" )));
+ exit();
+}
+
+// Get the params
+$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
+$foldername = isset( $_GET['foldername'] ) ? $_GET['foldername'] : '';
+
+if($foldername == '') {
+ echo json_encode( array( "status" => "error", "data" => array( "message" => "Empty Foldername" )));
+ exit();
+}
+error_log('try to create ' . $foldername . ' in ' . $dir);
+if(OC_FILES::newFile($dir, $foldername, 'dir')) {
+ echo json_encode( array( "status" => "success", "data" => array()));
+ exit();
+}
+
+echo json_encode( array( "status" => "error", "data" => array( "message" => "Error when creating the folder" ))); \ No newline at end of file
diff --git a/files/css/files.css b/files/css/files.css
index 1d7fb5ef592..4c5bd0427b6 100644
--- a/files/css/files.css
+++ b/files/css/files.css
@@ -23,11 +23,11 @@
display: none;
}
-#file_upload_target {
+#file_newfolder_form {
display: none;
}
-#file_action_panel {
+#file_upload_target {
display: none;
}
diff --git a/files/js/files.js b/files/js/files.js
index 44506763032..313727cedbc 100644
--- a/files/js/files.js
+++ b/files/js/files.js
@@ -1,4 +1,6 @@
$(document).ready(function() {
+ $('#file_action_panel').attr('activeAction', false);
+
// Sets browser table behaviour :
$('.browser tr').hover(
function() {
@@ -37,16 +39,43 @@ $(document).ready(function() {
$('.browser input:checkbox').attr('checked', false);
});
- // Shows and hides file upload form
- $('#file_upload_button').toggle(function() {
- $('#file_upload_form').css({"display":"block"});
- }, function() {
- $('#file_upload_form').css({"display":"none"});
- });
-
$('#file_upload_start').click(function() {
$('#file_upload_target').load(uploadFinished);
});
+
+ $('#file_new_dir_submit').click(function() {
+ $.ajax({
+ url: 'ajax/newfolder.php',
+ data: "dir="+$('#dir').val()+"&foldername="+$('#file_new_dir_name').val(),
+ complete: boolOpFinished
+ });
+ });
+
+ $('.upload').click(function(){
+ if($('#file_action_panel').attr('activeAction') != 'upload') {
+ $('#file_action_panel').attr('activeAction', 'upload');
+ $('#fileSelector').replaceWith('<input type="file" name="file" id="fileSelector">');
+ $('#file_action_panel form').css({"display":"none"});
+ $('#file_upload_form').css({"display":"block"});
+ } else {
+ $('#file_action_panel').attr('activeAction', 'false');
+ $('#file_upload_form').css({"display":"none"})
+ }
+ return false;
+ });
+
+ $('.new-dir').click(function(){
+ if($('#file_action_panel').attr('activeAction') != 'new-dir') {
+ $('#file_action_panel').attr('activeAction', 'new-dir');
+ $('#file_new_dir_name').val('');
+ $('#file_action_panel form').css({"display":"none"});
+ $('#file_newfolder_form').css({"display":"block"})
+ } else {
+ $('#file_newfolder_form').css({"display":"none"})
+ $('#file_action_panel').attr('activeAction', false);
+ }
+ return false;
+ });
});
function uploadFinished() {
@@ -64,6 +93,24 @@ function uploadFinished() {
}
}
+function resetFileActionPanel() {
+ $('#file_action_panel form').css({"display":"none"});
+ $('#file_action_panel').attr('activeAction', false);
+}
+
+function boolOpFinished(data) {
+ result = eval("("+data.responseText+");");
+ if(result.status == 'success'){
+ $.ajax({
+ url: 'ajax/list.php',
+ data: "dir="+$('#dir').val(),
+ complete: refreshContents
+ });
+ } else {
+ alert(result.data.message);
+ }
+}
+
function refreshContents(data) {
result = eval("("+data.responseText+");");
if(typeof(result.data.breadcrumb) != 'undefined'){
@@ -71,6 +118,7 @@ function refreshContents(data) {
}
updateFileList(result.data.files);
$('#file_upload_button').click();
+ resetFileActionPanel();
}
function updateBreadcrumb(breadcrumbHtml) {
diff --git a/files/templates/index.php b/files/templates/index.php
index 28187bcb531..c6dc123cee0 100644
--- a/files/templates/index.php
+++ b/files/templates/index.php
@@ -5,16 +5,15 @@ href="" title="" class="new-dir">New folder</a><a href="" title=""
class="download">Download</a><a href="" title="" class="share">Share</a><a
href="" title="" class="delete">Delete</a>
</p>
- <div id="file_upload_form">
- <form action="ajax/upload.php"
+ <div id="file_action_panel">
+ <form id="file_upload_form" action="ajax/upload.php"
method="post" enctype="multipart/form-data" target="file_upload_target"><input
type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_["uploadMaxFilesize"] ?>" id="max_upload"><input
type="hidden" name="dir" value="<?php echo $_["dir"] ?>" id="dir"><input
type="file" name="file" id="fileSelector"><input type="submit"
id="file_upload_start" value="Upload" /><iframe id="file_upload_target"
name="file_upload_target" src=""></iframe></form>
- </div>
- <div id="file_action_panel">
+ <form id="file_newfolder_form"><input type="text" name="file_new_dir_name" id="file_new_dir_name" />&nbsp;<input type="button" id="file_new_dir_submit" name="file_new_dir_submit" value="OK" /></form>
</div>
</div>
diff --git a/help/css/help.css b/help/css/help.css
index 02bcade3cc2..9e64c28afb4 100644
--- a/help/css/help.css
+++ b/help/css/help.css
@@ -49,16 +49,16 @@ table td.name a
}
-.install a {
+.button a {
padding:0.2em 0.5em;
border:1px solid #ddd;
-moz-border-radius:15px;
-webkit-border-radius:15px;
border-radius:15px;
text-decoration: none;
- font-size:1.5em; color:#666666;
+ font-size:1.3em; color:#666666;
background-color:#F0F0F0;
}
-.install a:hover {
+.button a:hover {
background-color:#DDDDDD;
}
diff --git a/help/templates/index.php b/help/templates/index.php
index 51b673678d3..776d7c00a9e 100644
--- a/help/templates/index.php
+++ b/help/templates/index.php
@@ -1,10 +1,18 @@
+
+<h1>Questions and Answers</h1>
+
<table cellspacing="0">
<tbody>
<?php foreach($_["kbe"] as $kb): ?>
<tr>
- <td width="1"><?php if($kb["preview1"] <> "") { echo('<a href="'.OC_HELPER::linkTo( "help", "index.php" ).'?id='.$kb['id'].'"><img class="preview" border="0" src="'.$kb["preview1"].'" /></a>'); } ?> </a></td>
- <td class="name"><a href="<?php echo(OC_HELPER::linkTo( "help", "index.php" ).'?id='.$kb['id']); ?>" title=""><?php echo $kb["name"]; ?></a><br /><?php echo('<span class="type">'.$kb['description'].'</span>'); ?></td>
+ <td width="1"><?php if($kb["preview1"] <> "") { echo('<img class="preview" border="0" src="'.$kb["preview1"].'" />'); } ?> </a></td>
+ <td class="name"><?php echo $kb["name"]; ?><br /><?php echo('<span class="type">'.$kb['description'].'</span>'); ?><br />
+ <?php if($kb['answer']<>'') echo('<br /><span class="type"><b>Answer:</b></span><br /><span class="type">'.$kb['answer'].'</span>');?>
+ </td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
+<span class="button"><a target="_blank" href="http://apps.owncloud.com/knowledgebase/editquestion.php?action=new">ASK A QUESTION</a></span>
+
+
diff --git a/lib/ocsclient.php b/lib/ocsclient.php
index 994a889aecf..a3c4659c6e4 100644
--- a/lib/ocsclient.php
+++ b/lib/ocsclient.php
@@ -126,7 +126,7 @@ class OC_OCSCLIENT{
* This function returns a list of all the knowledgebase entries from the OCS server
*/
public static function getKnownledgebaseEntries(){
- $url='http://api.apps.owncloud.com/v1/knowledgebase/data?page=0&pagesize=10';
+ $url='http://api.apps.owncloud.com/v1/knowledgebase/data?type=150&page=0&pagesize=10';
$kbe=array();
$xml=file_get_contents($url);
@@ -138,6 +138,7 @@ class OC_OCSCLIENT{
$kb['id']=$tmp[$i]->id;
$kb['name']=$tmp[$i]->name;
$kb['description']=$tmp[$i]->description;
+ $kb['answer']=$tmp[$i]->answer;
$kb['preview1']=$tmp[$i]->smallpreviewpic1;
$kbe[]=$kb;
}