Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/apps.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Hülsmann <fh@cbix.de>2012-06-21 01:08:17 +0400
committerFlorian Hülsmann <fh@cbix.de>2012-06-21 01:08:17 +0400
commit03f281584e7df8ff040bacbb5ffbb28452d515ae (patch)
tree989252c5fc0b3945fcfedcc5041cd969bd3db80d /apptemplate
parent0e4bdf23cad9bd70d915a2b9d57c7e5795812acd (diff)
apptemplate compatible with OC4
Diffstat (limited to 'apptemplate')
-rw-r--r--apptemplate/ajax/seturl.php8
-rw-r--r--apptemplate/appinfo/app.php11
-rw-r--r--apptemplate/appinfo/info.xml2
-rw-r--r--apptemplate/appinfo/version1
-rw-r--r--apptemplate/index.php23
-rw-r--r--apptemplate/js/admin.js4
-rw-r--r--apptemplate/templates/main.php9
-rw-r--r--apptemplate/templates/settings.php6
8 files changed, 24 insertions, 40 deletions
diff --git a/apptemplate/ajax/seturl.php b/apptemplate/ajax/seturl.php
index 832a44569..3c93344ed 100644
--- a/apptemplate/ajax/seturl.php
+++ b/apptemplate/ajax/seturl.php
@@ -1,15 +1,13 @@
<?php
/**
* Copyright (c) 2011, Frank Karlitschek <karlitschek@kde.org>
+ * Copyright (c) 2012, Florian Hülsmann <fh@cbix.de>
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
-OC_Util::checkAdminUser();
+OCP\User::checkAdminUser();
-OC_Config::setValue( 'somesetting', $_POST['somesetting'] );
+OCP\Config::setSystemValue( 'somesetting', $_POST['somesetting'] );
echo 'true';
-
-?>
diff --git a/apptemplate/appinfo/app.php b/apptemplate/appinfo/app.php
index a99a927d2..351c41be2 100644
--- a/apptemplate/appinfo/app.php
+++ b/apptemplate/appinfo/app.php
@@ -4,7 +4,9 @@
* ownCloud - App Template plugin
*
* @author Frank Karlitschek
+* @author Florian Hülsmann
* @copyright 2011 Frank Karlitschek karlitschek@kde.org
+* @copyright 2012 Florian Hülsmann fh@cbix.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
@@ -16,14 +18,11 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
-* You should have received a copy of the GNU Lesser General Public
+* 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/>.
*
*/
-OC_APP::registerAdmin('apptemplate','settings');
-
-OC_App::register( array( 'order' => 70, 'id' => 'apptemplate', 'name' => 'App Template' ));
-
-OC_App::addNavigationEntry( array( 'id' => 'apptemplate', 'order' => 74, 'href' => OC_Helper::linkTo( 'apptemplate', 'index.php' ), 'icon' => OC_Helper::imagePath( 'apptemplate', 'example.png' ), 'name' => 'App Template'));
+OCP\App::registerAdmin( 'apptemplate', 'settings' );
+OCP\App::addNavigationEntry( array( 'id' => 'apptemplate', 'order' => 74, 'href' => OCP\Util::linkTo( 'apptemplate', 'index.php' ), 'icon' => OCP\Util::imagePath( 'apptemplate', 'example.png' ), 'name' => 'App Template'));
diff --git a/apptemplate/appinfo/info.xml b/apptemplate/appinfo/info.xml
index 8cee86cde..c22bca476 100644
--- a/apptemplate/appinfo/info.xml
+++ b/apptemplate/appinfo/info.xml
@@ -6,5 +6,5 @@
<version>1.0</version>
<licence>AGPL</licence>
<author>Frank Karlitschek</author>
- <require>2</require>
+ <require>4</require>
</info>
diff --git a/apptemplate/appinfo/version b/apptemplate/appinfo/version
new file mode 100644
index 000000000..d3827e75a
--- /dev/null
+++ b/apptemplate/appinfo/version
@@ -0,0 +1 @@
+1.0
diff --git a/apptemplate/index.php b/apptemplate/index.php
index 2f807b11c..6beab3153 100644
--- a/apptemplate/index.php
+++ b/apptemplate/index.php
@@ -4,7 +4,9 @@
* ownCloud - App Template Example
*
* @author Frank Karlitschek
+* @author Florian Hülsmann
* @copyright 2011 Frank Karlitschek karlitschek@kde.org
+* @copyright 2012 Florian Hülsmann fh@cbix.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
@@ -16,25 +18,16 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
-* You should have received a copy of the GNU Lesser General Public
+* 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/>.
*
*/
-require_once('../../lib/base.php');
-
// Check if we are a user
-if( !OC_User::isLoggedIn()){
- header( "Location: ".OC_Helper::linkTo( '', 'index.php' ));
- exit();
-}
-
+OCP\User::checkLoggedIn();
-$somesetting=OC_Config::getValue( "somesetting", '' );
-OC_App::setActiveNavigationEntry( 'apptemplate');
-$tmpl = new OC_Template( 'apptemplate', 'main', 'user' );
-$tmpl->assign('somesetting',$somesetting);
+$somesetting = OCP\Config::getSystemValue( "somesetting", '' );
+OCP\App::setActiveNavigationEntry( 'apptemplate' );
+$tmpl = new OCP\Template( 'apptemplate', 'main', 'user' );
+$tmpl->assign( 'somesetting', $somesetting );
$tmpl->printPage();
-
-
-?>
diff --git a/apptemplate/js/admin.js b/apptemplate/js/admin.js
index 4c645d241..24ce190d5 100644
--- a/apptemplate/js/admin.js
+++ b/apptemplate/js/admin.js
@@ -5,7 +5,9 @@ $(document).ready(function(){
$('#somesetting').blur(function(event){
event.preventDefault();
var post = $( "#somesetting" ).serialize();
- $.post( OC.filePath('apptemplate','ajax','seturl.php') , post, function(data){ OC.msg.finishedSaving('#somesetting .msg', data); });
+ $.post( OC.filePath('apptemplate', 'ajax', 'seturl.php') , post, function(data){
+ $('#apptemplate .msg').text('Finished saving: ' + data);
+ });
});
diff --git a/apptemplate/templates/main.php b/apptemplate/templates/main.php
index 8e2eccefa..8052fbe83 100644
--- a/apptemplate/templates/main.php
+++ b/apptemplate/templates/main.php
@@ -1,10 +1,3 @@
-
<h1>This is an example app template</h1>
-<?php echo $l->t('Some Setting');?>
-:"
-<?php echo $_['somesetting']; ?>
-"
-
-
-
+<?php echo $l->t('Some Setting');?>: "<?php echo $_['somesetting']; ?>"
diff --git a/apptemplate/templates/settings.php b/apptemplate/templates/settings.php
index df1bdf707..1a2fc4037 100644
--- a/apptemplate/templates/settings.php
+++ b/apptemplate/templates/settings.php
@@ -2,9 +2,7 @@
<fieldset class="personalblock">
<strong>App Template</strong><br />
<input type="text" name="somesetting" id="somesetting" value="<?php echo $_['url']; ?>" placeholder="<?php echo $l->t('Some Setting');?>" />
- <br />
-
-
-<span class="msg"></span>
+ <br />
+ <span class="msg"></span>
</fieldset>
</form>