From af1e48df80680dfa2b6e1367752a41aee750c308 Mon Sep 17 00:00:00 2001 From: Jakob Sack Date: Sat, 16 Apr 2011 17:49:57 +0200 Subject: [PATCH 1/4] Changes in the user experience --- admin/appinfo/app.php | 14 ++--- admin/apps.php | 39 ++++++++++++++ admin/js/users.js | 101 +++++++++++++++++++++++++++++++++++ files/appinfo/app.php | 2 +- help/appinfo/app.php | 6 +++ help/index.php | 33 ++++++++++++ help/templates/index.php | 8 +++ img/layout/back.png | Bin 0 -> 670 bytes img/layout/help.png | Bin 0 -> 670 bytes img/layout/logout.png | Bin 0 -> 670 bytes img/layout/settings.png | Bin 0 -> 670 bytes lib/app.php | 15 +++++- lib/template.php | 18 +++++-- log/appinfo/app.php | 2 +- log/index.php | 2 +- plugins/blacklist.txt | 1 + settings/img/information.png | Bin 0 -> 803 bytes settings/index.php | 21 +------- settings/templates/index.php | 18 +------ templates/layout.admin.php | 16 +++--- templates/layout.user.php | 12 ++--- 21 files changed, 239 insertions(+), 69 deletions(-) create mode 100644 admin/apps.php create mode 100644 admin/js/users.js create mode 100644 help/appinfo/app.php create mode 100644 help/index.php create mode 100644 help/templates/index.php create mode 100644 img/layout/back.png create mode 100644 img/layout/help.png create mode 100644 img/layout/logout.png create mode 100644 img/layout/settings.png create mode 100644 settings/img/information.png diff --git a/admin/appinfo/app.php b/admin/appinfo/app.php index 9e39a05244..2426adc9f8 100644 --- a/admin/appinfo/app.php +++ b/admin/appinfo/app.php @@ -1,14 +1,10 @@ 1, "id" => "admin", "name" => "Administration" )); -if( OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )) -{ - OC_APP::addNavigationEntry( array( "id" => "admin_index", "order" => 1, "href" => OC_HELPER::linkTo( "admin", "index.php" ), "icon" => OC_HELPER::imagePath( "admin", "navicon.png" ), "name" => "Administration" )); -} -OC_APP::addAdminPage( array( "id" => "core_basic", "order" => 1, "href" => OC_HELPER::linkTo( "admin", "basic.php" ), "name" => "Basic Settings" )); -OC_APP::addAdminPage( array( "id" => "core_system", "order" => 2, "href" => OC_HELPER::linkTo( "admin", "system.php" ), "name" => "System settings" )); -OC_APP::addAdminPage( array( "id" => "core_users", "order" => 3, "href" => OC_HELPER::linkTo( "admin", "users.php" ), "name" => "Users" )); -OC_APP::addAdminPage( array( "id" => "core_apps", "order" => 4, "href" => OC_HELPER::linkTo( "admin", "apps.php" ), "name" => "Apps" )); -OC_APP::addAdminPage( array( "id" => "core_plugins", "order" => 5, "href" => OC_HELPER::linkTo( "admin", "plugins.php" ), "name" => "Plugins" )); + +OC_APP::addAdminPage( array( "id" => "core_system", "order" => 2, "href" => OC_HELPER::linkTo( "admin", "system.php" ), "name" => "System settings", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" ))); +OC_APP::addAdminPage( array( "id" => "core_users", "order" => 3, "href" => OC_HELPER::linkTo( "admin", "users.php" ), "name" => "Users", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" ))); +OC_APP::addAdminPage( array( "id" => "core_apps", "order" => 4, "href" => OC_HELPER::linkTo( "admin", "apps.php" ), "name" => "Apps", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" ))); +OC_APP::addAdminPage( array( "id" => "core_plugins", "order" => 5, "href" => OC_HELPER::linkTo( "admin", "plugins.php" ), "name" => "Plugins", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" ))); ?> diff --git a/admin/apps.php b/admin/apps.php new file mode 100644 index 0000000000..10bfd83c9b --- /dev/null +++ b/admin/apps.php @@ -0,0 +1,39 @@ +. +* +*/ + +require_once('../lib/base.php'); +require( 'template.php' ); +if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){ + header( "Location: ".OC_HELPER::linkTo( "index.php" )); + exit(); +} + +// We have some javascript foo! +OC_UTIL::addScript( "admin", "apps" ); + + +$tmpl = new OC_TEMPLATE( "admin", "apps", "admin" ); +$tmpl->printPage(); + +?> + diff --git a/admin/js/users.js b/admin/js/users.js new file mode 100644 index 0000000000..6d59a2efb7 --- /dev/null +++ b/admin/js/users.js @@ -0,0 +1,101 @@ +$(document).ready(function(){ + // Dialog for adding users + $( "#adduser-form" ).dialog({ + autoOpen: false, + height: 300, + width: 350, + modal: true, + buttons: { + "Create an account": function() { + $( this ).dialog( "close" ); + }, + Cancel: function() { + $( this ).dialog( "close" ); + } + }, + close: function() { + allFields.val( "" ).removeClass( "ui-state-error" ); + } + }); + + $( "#adduser-button" ) + .click(function() { + $( "#adduser-form" ).dialog( "open" ); + return false; + }); + + // Dialog for adding users + $( "#edituser-form" ).dialog({ + autoOpen: false, + height: 300, + width: 350, + modal: true, + buttons: { + "Edit password": function() { + $( this ).dialog( "close" ); + }, + Cancel: function() { + $( this ).dialog( "close" ); + } + }, + close: function() { + allFields.val( "" ).removeClass( "ui-state-error" ); + } + }); + + $( ".edituser-button" ) + .click(function() { + $( "#edituser-form" ).dialog( "open" ); + return false; + }); + + // Dialog for adding users + $( "#removeuser-form" ).dialog({ + autoOpen: false, + height: 300, + width: 350, + modal: true, + buttons: { + "Remove user": function() { + $( this ).dialog( "close" ); + }, + Cancel: function() { + $( this ).dialog( "close" ); + } + }, + close: function() { + allFields.val( "" ).removeClass( "ui-state-error" ); + } + }); + + $( ".removeuser-button" ) + .click(function() { + $( "#removeuser-form" ).dialog( "open" ); + return false; + }); + + // Dialog for adding users + $( "#removegroup-form" ).dialog({ + autoOpen: false, + height: 300, + width: 350, + modal: true, + buttons: { + "Remove group": function() { + $( this ).dialog( "close" ); + }, + Cancel: function() { + $( this ).dialog( "close" ); + } + }, + close: function() { + allFields.val( "" ).removeClass( "ui-state-error" ); + } + }); + + $( ".removegroup-button" ) + .click(function() { + $( "#removegroup-form" ).dialog( "open" ); + return false; + }); +} ); diff --git a/files/appinfo/app.php b/files/appinfo/app.php index a3532e805d..eff45cbe6e 100644 --- a/files/appinfo/app.php +++ b/files/appinfo/app.php @@ -3,6 +3,6 @@ OC_APP::register( array( "order" => 2, "id" => "files", "name" => "Files" )); OC_APP::addNavigationEntry( array( "id" => "files_index", "order" => 1, "href" => OC_HELPER::linkTo( "files", "index.php" ), "icon" => OC_HELPER::imagePath( "files", "navicon.png" ), "name" => "Files" )); -OC_APP::addAdminPage( array( "order" => 1, "href" => OC_HELPER::linkTo( "files", "admin.php" ), "name" => "Files" )); +OC_APP::addSettingsPage( array( "order" => 1, "href" => OC_HELPER::linkTo( "files", "admin.php" ), "name" => "Files" )); ?> diff --git a/help/appinfo/app.php b/help/appinfo/app.php new file mode 100644 index 0000000000..184f4d345b --- /dev/null +++ b/help/appinfo/app.php @@ -0,0 +1,6 @@ + "help", "name" => "Help" )); +OC_APP::addPersonalMenuEntry( array( "order" => 2, "href" => OC_HELPER::linkTo( "help", "index.php" ), "name" => "Help" )); + +?> diff --git a/help/index.php b/help/index.php new file mode 100644 index 0000000000..0a54ddb9cf --- /dev/null +++ b/help/index.php @@ -0,0 +1,33 @@ +assign( "settings", $settings ); +$tmpl->printPage(); + +?> diff --git a/help/templates/index.php b/help/templates/index.php new file mode 100644 index 0000000000..945969d88c --- /dev/null +++ b/help/templates/index.php @@ -0,0 +1,8 @@ + +

Help

+ +Help. \ No newline at end of file diff --git a/img/layout/back.png b/img/layout/back.png new file mode 100644 index 0000000000000000000000000000000000000000..a2d5c841335d19c0f64b9b6aafdc275dd09a2bb7 GIT binary patch literal 670 zcmV;P0%84$P)Xv3uhk}A4@St@FDuqBY z@z6!Pbq@8?B?>%skB*%Tx^+@hT?sgPKY=)=c>=-o~w@3}lakcL_nQWH%g^d^b{^F3LLZ7_cKfv7w z52+_M2aGKZGIHhyqg|uCX?{g}>&xrnsko!Cetz8gu-wAU!7G%~Jv5xZ#X(6^j1AWA z;nx%|tTUILWu$$8_3T@scm$w8fUV4YA&MC(G z#<6;j^kcPsYU^^SqT?9pIB4UPpAPMZe0*2Ys82BQb%N8+1@G2oxHo%|OEZGa^yXSJ zpi4+8@m!aD>=2aCzUR`pGf3bcBNM`239=!)_W+MaiGckh%5m&dD@U;;=&&o4PtTWW z!reZu&5!czSB7wDXw?jx$BG1ll#X3cbp@INS&ntnyE={K2v}KO_zsW=IDk@;hQOnm zuLPbpXibF>0@w4Y4OHfPG=%}xgfIj`U^Hkz0A9U-a$Qn%_U#~4E2BPsbh7=c@FfmD)we&2q`e+T~F>(&Mk4*5c! zLh*ovx=UmtklEeYBHG(#Be%`x)o=Vyu@ti(MLz(31JF;k9rOM+qW}N^07*qoM6N<$ Ef@xJQ3IG5A literal 0 HcmV?d00001 diff --git a/img/layout/help.png b/img/layout/help.png new file mode 100644 index 0000000000000000000000000000000000000000..a2d5c841335d19c0f64b9b6aafdc275dd09a2bb7 GIT binary patch literal 670 zcmV;P0%84$P)Xv3uhk}A4@St@FDuqBY z@z6!Pbq@8?B?>%skB*%Tx^+@hT?sgPKY=)=c>=-o~w@3}lakcL_nQWH%g^d^b{^F3LLZ7_cKfv7w z52+_M2aGKZGIHhyqg|uCX?{g}>&xrnsko!Cetz8gu-wAU!7G%~Jv5xZ#X(6^j1AWA z;nx%|tTUILWu$$8_3T@scm$w8fUV4YA&MC(G z#<6;j^kcPsYU^^SqT?9pIB4UPpAPMZe0*2Ys82BQb%N8+1@G2oxHo%|OEZGa^yXSJ zpi4+8@m!aD>=2aCzUR`pGf3bcBNM`239=!)_W+MaiGckh%5m&dD@U;;=&&o4PtTWW z!reZu&5!czSB7wDXw?jx$BG1ll#X3cbp@INS&ntnyE={K2v}KO_zsW=IDk@;hQOnm zuLPbpXibF>0@w4Y4OHfPG=%}xgfIj`U^Hkz0A9U-a$Qn%_U#~4E2BPsbh7=c@FfmD)we&2q`e+T~F>(&Mk4*5c! zLh*ovx=UmtklEeYBHG(#Be%`x)o=Vyu@ti(MLz(31JF;k9rOM+qW}N^07*qoM6N<$ Ef@xJQ3IG5A literal 0 HcmV?d00001 diff --git a/img/layout/logout.png b/img/layout/logout.png new file mode 100644 index 0000000000000000000000000000000000000000..a2d5c841335d19c0f64b9b6aafdc275dd09a2bb7 GIT binary patch literal 670 zcmV;P0%84$P)Xv3uhk}A4@St@FDuqBY z@z6!Pbq@8?B?>%skB*%Tx^+@hT?sgPKY=)=c>=-o~w@3}lakcL_nQWH%g^d^b{^F3LLZ7_cKfv7w z52+_M2aGKZGIHhyqg|uCX?{g}>&xrnsko!Cetz8gu-wAU!7G%~Jv5xZ#X(6^j1AWA z;nx%|tTUILWu$$8_3T@scm$w8fUV4YA&MC(G z#<6;j^kcPsYU^^SqT?9pIB4UPpAPMZe0*2Ys82BQb%N8+1@G2oxHo%|OEZGa^yXSJ zpi4+8@m!aD>=2aCzUR`pGf3bcBNM`239=!)_W+MaiGckh%5m&dD@U;;=&&o4PtTWW z!reZu&5!czSB7wDXw?jx$BG1ll#X3cbp@INS&ntnyE={K2v}KO_zsW=IDk@;hQOnm zuLPbpXibF>0@w4Y4OHfPG=%}xgfIj`U^Hkz0A9U-a$Qn%_U#~4E2BPsbh7=c@FfmD)we&2q`e+T~F>(&Mk4*5c! zLh*ovx=UmtklEeYBHG(#Be%`x)o=Vyu@ti(MLz(31JF;k9rOM+qW}N^07*qoM6N<$ Ef@xJQ3IG5A literal 0 HcmV?d00001 diff --git a/img/layout/settings.png b/img/layout/settings.png new file mode 100644 index 0000000000000000000000000000000000000000..a2d5c841335d19c0f64b9b6aafdc275dd09a2bb7 GIT binary patch literal 670 zcmV;P0%84$P)Xv3uhk}A4@St@FDuqBY z@z6!Pbq@8?B?>%skB*%Tx^+@hT?sgPKY=)=c>=-o~w@3}lakcL_nQWH%g^d^b{^F3LLZ7_cKfv7w z52+_M2aGKZGIHhyqg|uCX?{g}>&xrnsko!Cetz8gu-wAU!7G%~Jv5xZ#X(6^j1AWA z;nx%|tTUILWu$$8_3T@scm$w8fUV4YA&MC(G z#<6;j^kcPsYU^^SqT?9pIB4UPpAPMZe0*2Ys82BQb%N8+1@G2oxHo%|OEZGa^yXSJ zpi4+8@m!aD>=2aCzUR`pGf3bcBNM`239=!)_W+MaiGckh%5m&dD@U;;=&&o4PtTWW z!reZu&5!czSB7wDXw?jx$BG1ll#X3cbp@INS&ntnyE={K2v}KO_zsW=IDk@;hQOnm zuLPbpXibF>0@w4Y4OHfPG=%}xgfIj`U^Hkz0A9U-a$Qn%_U#~4E2BPsbh7=c@FfmD)we&2q`e+T~F>(&Mk4*5c! zLh*ovx=UmtklEeYBHG(#Be%`x)o=Vyu@ti(MLz(31JF;k9rOM+qW}N^07*qoM6N<$ Ef@xJQ3IG5A literal 0 HcmV?d00001 diff --git a/lib/app.php b/lib/app.php index 9f1ce6f104..b08733e04d 100644 --- a/lib/app.php +++ b/lib/app.php @@ -53,7 +53,7 @@ class OC_APP{ } // Our very own core apps are hardcoded - foreach( array( "admin", "files", "log", "settings" ) as $app ){ + foreach( array( "admin", "files", "log", "help", "settings" ) as $app ){ require( "$app/appinfo/app.php" ); } @@ -165,11 +165,22 @@ class OC_APP{ * property from all other entries. The templates can use this for * highlighting the current position of the user. */ - public static function activateNavigationEntry( $id ){ + public static function setActiveNavigationEntry( $id ){ self::$activeapp = $id; return true; } + /** + * @brief gets the active Menu entry + * @returns id or empty string + * + * This function returns the id of the active navigation entry (set by + * setActiveNavigationEntry + */ + public static function getActiveNavigationEntry(){ + return self::$activeapp; + } + /** * @brief adds an entry to the personal menu * @param $data array containing the data diff --git a/lib/template.php b/lib/template.php index c36b1e7a36..fcf6334b95 100644 --- a/lib/template.php +++ b/lib/template.php @@ -190,11 +190,25 @@ class OC_TEMPLATE{ { $page = new OC_TEMPLATE( "core", "layout.user" ); // Add menu data + + // Add navigation entry and personal menu + $page->assign( "navigation", OC_APP::getNavigation()); + $page->assign( "personalmenu", OC_APP::getPersonalMenu()); } elseif( $this->renderas == "admin" ) { $page = new OC_TEMPLATE( "core", "layout.admin" ); // Add menu data + $navigation = array(); + if( OC_GROUP::inGroup( $_SESSION["user_id"], "admin" )){ + foreach( OC_APP::getAdminPages() as $i ){ + $navigation[] = $i; + } + } + foreach( OC_APP::getSettingsPages() as $i ){ + $navigation[] = $i; + } + $page->assign( "navigation", $navigation ); } else { @@ -210,10 +224,6 @@ class OC_TEMPLATE{ $page->append( "cssfiles", "$WEBROOT/$style.css" ); } - // Add navigation entry and personal menu - $page->assign( "navigation", OC_APP::getNavigation()); - $page->assign( "personalmenu", OC_APP::getPersonalMenu()); - // Add css files and js files $page->assign( "content", $data ); return $page->fetchPage(); diff --git a/log/appinfo/app.php b/log/appinfo/app.php index d3e848e960..fd53d1ec22 100644 --- a/log/appinfo/app.php +++ b/log/appinfo/app.php @@ -1,6 +1,6 @@ 1, "id" => "log", "name" => "Log" )); -OC_APP::addPersonalMenuEntry( array( "order" => 2, "href" => OC_HELPER::linkTo( "log", "index.php" ), "name" => "Log" )); +OC_APP::addSettingsPage( array( "order" => 2, "href" => OC_HELPER::linkTo( "log", "index.php" ), "name" => "Log", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" ))); ?> diff --git a/log/index.php b/log/index.php index a401a38fa1..23194f18a6 100644 --- a/log/index.php +++ b/log/index.php @@ -37,7 +37,7 @@ foreach( $logs as &$i ){ $i["action"] = OC_LOG::$TYPE[$i['type']]; } -$tmpl = new OC_TEMPLATE( "log", "index", "user" ); +$tmpl = new OC_TEMPLATE( "log", "index", "admin" ); $tmpl->assign( "logs", $logs ); $tmpl->printPage(); diff --git a/plugins/blacklist.txt b/plugins/blacklist.txt index 08c79e5e75..e113a39d0b 100644 --- a/plugins/blacklist.txt +++ b/plugins/blacklist.txt @@ -2,3 +2,4 @@ audioplayer ldap test textviewer +publiclink diff --git a/settings/img/information.png b/settings/img/information.png new file mode 100644 index 0000000000000000000000000000000000000000..cbabb0e54a5f50e447982e63d9b9777c1bab64c0 GIT binary patch literal 803 zcmV+;1Kj+HP)L(6P11}VMGLGia&@7AA~~c zv4hkH5ae7|Q7Gea0-*Z|?7h!~w(D3>HcT55O20oXh&9xm3f(LlcTbfj@UW;`z4 zQe3^WvbZSVRY*Kx8d}nrtt$6-^t2rw1K|A6Kss=4uuJw8b+;d{SF0*RP!$=XY&kAs zx`DToi;kuz21X($yM)O)gR&F7x3*Sp@4Iul8CuGQzGB0#$`BZtEQ)*zww0=Q`EeF= z^U?d?htEdMGw#8j+k70)hr2tN6>a z1(wYWt`3evJfX(dS&LUu0EyP;3`ou85(NEWA`vdKP++9z7z(sL7zJTieS@k(0I)Er zxl%%r^%5`_$&?MMILIM;aH#toKJ^}jAeE(X-7NIw4D@6Yv4ja^ZNMfHW#9TWa`0w+ zVrH>|C>|)@AZQ=}N);p$2?)lbCb$C^Sb)V(M~E|VHvMdgLg2C=aMBfwi!I5+dsM)Y zunJWHBISd*Kw1av^c*<(E{Sv^6>~u3e6ylL>u*8d)E4z{T|j95i+eL#AgS)k@eC0_@%Ssh$O3 z<_{!i(sdpC1wKDH%Q&kBYatCcT2vn$0+qv7#_@=%67blR;g@Av?ao-=`%VAGjYu_@ h!lKH)3`VgD{{WW=EM6)QLJR-^002ovPDHLkV1f)8Uxokx literal 0 HcmV?d00001 diff --git a/settings/index.php b/settings/index.php index 85e4281c91..31db326f6b 100644 --- a/settings/index.php +++ b/settings/index.php @@ -7,27 +7,8 @@ if( !OC_USER::isLoggedIn()){ exit(); } -$settings = array(); -// Do the work ... -if( $_POST["submit"] ) -{ - if( $_POST["newpassword"] != $_POST["newpasswordconfirm"] ){ - // Say "Passwords not equal" - } - else{ - if( OC_USER::checkPassword( $_SESSION["username"], $_POST["password"] )){ - // Set password - OC_USER::setPassord( $_SESSION["username"], $_POST["newpassword"] ); - } - else{ - // Say "old password bad" - } - } -} - -$tmpl = new OC_TEMPLATE( "settings", "index", "user" ); -$tmpl->assign( "settings", $settings ); +$tmpl = new OC_TEMPLATE( "settings", "index", "admin" ); $tmpl->printPage(); ?> diff --git a/settings/templates/index.php b/settings/templates/index.php index 20410e06d1..106d313c01 100644 --- a/settings/templates/index.php +++ b/settings/templates/index.php @@ -5,20 +5,4 @@ ?>

Settings

-
-

- New password: - -

-

- Confirm new password: - -

-

- Old password: - -

-

- -

-
+Welcome to the settings! Bla bla bla \ No newline at end of file diff --git a/templates/layout.admin.php b/templates/layout.admin.php index 85eba13827..ea352a0fb7 100644 --- a/templates/layout.admin.php +++ b/templates/layout.admin.php @@ -22,20 +22,20 @@ " title="" id="owncloud">" alt="ownCloud" />
diff --git a/templates/layout.user.php b/templates/layout.user.php index 9fc4f97e1d..be14cc0fc0 100644 --- a/templates/layout.user.php +++ b/templates/layout.user.php @@ -22,12 +22,12 @@ " title="" id="owncloud">" alt="ownCloud" />
From f2e37e0018506f8dcb692131404839bb3421c689 Mon Sep 17 00:00:00 2001 From: Jakob Sack Date: Sat, 16 Apr 2011 18:06:23 +0200 Subject: [PATCH 2/4] Completely removing personalMenu --- help/appinfo/app.php | 1 - help/index.php | 1 + lib/app.php | 35 ----------------------------------- lib/template.php | 3 +-- settings/appinfo/app.php | 1 - 5 files changed, 2 insertions(+), 39 deletions(-) diff --git a/help/appinfo/app.php b/help/appinfo/app.php index 184f4d345b..661b554f41 100644 --- a/help/appinfo/app.php +++ b/help/appinfo/app.php @@ -1,6 +1,5 @@ "help", "name" => "Help" )); -OC_APP::addPersonalMenuEntry( array( "order" => 2, "href" => OC_HELPER::linkTo( "help", "index.php" ), "name" => "Help" )); ?> diff --git a/help/index.php b/help/index.php index 0a54ddb9cf..dafbd05cf3 100644 --- a/help/index.php +++ b/help/index.php @@ -7,6 +7,7 @@ if( !OC_USER::isLoggedIn()){ exit(); } +OC_APP::setActiveNavigationEntry( "help" ); $settings = array(); // Do the work ... diff --git a/lib/app.php b/lib/app.php index b08733e04d..5db3e047fd 100644 --- a/lib/app.php +++ b/lib/app.php @@ -34,7 +34,6 @@ class OC_APP{ static private $settingspages = array(); static private $navigation = array(); static private $subnavigation = array(); - static private $personalmenu = array(); /** * @brief loads all apps @@ -181,28 +180,6 @@ class OC_APP{ return self::$activeapp; } - /** - * @brief adds an entry to the personal menu - * @param $data array containing the data - * @returns true/false - * - * This function adds a new entry to the personal menu visible to users - * only. $data is an associative array. - * The following keys are required: - * - id: unique id for this entry ("logout") - * - href: link to the page - * - name: Human readable name ("Logout") - * - * The following keys are optional: - * - order: integer, that influences the position of your application in - * the personal menu. Lower values come first. - */ - public static function addPersonalMenuEntry( $data ){ - // TODO: write function - OC_APP::$personalmenu[] = $data; - return true; - } - /** * @brief registers an admin page * @param $data array containing the data @@ -266,18 +243,6 @@ class OC_APP{ return OC_APP::$navigation; } - /** - * @brief Returns the personal menu - * @returns associative array - * - * This function returns an array containing all personal menu entries - * added. The entries are sorted by the key "order" ascending. - */ - public static function getPersonalMenu(){ - // TODO: write function - return OC_APP::$personalmenu; - } - /** * @brief Returns the admin pages * @returns associative array diff --git a/lib/template.php b/lib/template.php index fcf6334b95..0e1c268efa 100644 --- a/lib/template.php +++ b/lib/template.php @@ -191,9 +191,8 @@ class OC_TEMPLATE{ $page = new OC_TEMPLATE( "core", "layout.user" ); // Add menu data - // Add navigation entry and personal menu + // Add navigation entry $page->assign( "navigation", OC_APP::getNavigation()); - $page->assign( "personalmenu", OC_APP::getPersonalMenu()); } elseif( $this->renderas == "admin" ) { diff --git a/settings/appinfo/app.php b/settings/appinfo/app.php index a781389303..5f78b83dc2 100644 --- a/settings/appinfo/app.php +++ b/settings/appinfo/app.php @@ -1,6 +1,5 @@ "settings", "name" => "Settings" )); -OC_APP::addPersonalMenuEntry( array( "order" => 1, "href" => OC_HELPER::linkTo( "settings", "index.php" ), "name" => "Settings" )); ?> From 964a55033adba52d3004ec90a82cdb5d521a7a97 Mon Sep 17 00:00:00 2001 From: Jakob Sack Date: Sat, 16 Apr 2011 18:08:40 +0200 Subject: [PATCH 3/4] never ever call a function you just removed --- lib/base.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/base.php b/lib/base.php index 31d4142900..712ea54d70 100644 --- a/lib/base.php +++ b/lib/base.php @@ -104,7 +104,6 @@ if(!$error and !$RUNTIME_NOSETUPFS ){ } // Add the stuff we need always -OC_APP::addPersonalMenuEntry( array( "order" => 1000, "href" => OC_HELPER::linkTo( "", "index.php?logout=1" ), "name" => "Logout" )); OC_UTIL::addScript( "jquery-1.5.min" ); OC_UTIL::addScript( "jquery-ui-1.8.10.custom.min" ); OC_UTIL::addScript( "js" ); @@ -233,14 +232,14 @@ class OC_UTIL { $CONFIG_BACKUPDIRECTORY = OC_CONFIG::getValue( "backupdirectory", "$SERVERROOT/backup" ); $CONFIG_INSTALLED = OC_CONFIG::getValue( "installed", false ); $errors=array(); - + //check for database drivers if(!is_callable('sqlite_open') and !is_callable('mysql_connect')){ $errors[]='No database drivers (sqlite or mysql) installed.
'; } $CONFIG_DBTYPE = OC_CONFIG::getValue( "dbtype", "sqlite" ); $CONFIG_DBNAME = OC_CONFIG::getValue( "dbname", "owncloud" ); - + //check for correct file permissions if(!stristr(PHP_OS, 'WIN')){ if($CONFIG_DBTYPE=='sqlite'){ @@ -283,9 +282,9 @@ class OC_UTIL { if(!is_writable($CONFIG_DATADIRECTORY_ROOT)){ $errors[]='Data directory ('.$CONFIG_BACKUPDIRECTORY.') not writable by ownCloud
'; } - + //TODO: check for php modules - + return $errors; } } From f0e59b9043292a5abfb0b0d21763a0cd7306dad7 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sat, 16 Apr 2011 18:26:13 +0200 Subject: [PATCH 4/4] better display for server configuration errors --- css/styles.css | 15 +++++++++++++++ lib/base.php | 26 +++++++++++++++++++------- templates/error.php | 6 ++++-- 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/css/styles.css b/css/styles.css index 4fc5a39b8c..d6e5ea8fcc 100644 --- a/css/styles.css +++ b/css/styles.css @@ -633,3 +633,18 @@ p.actions a.delete border: 1px solid #CCC; text-align: right; } + +li.error{ + list-style:none; + width: 640px; + margin: 4em auto; + padding: 1em 1em 1em 4em; + background-color: #FEE; + background-image: url(../img/task-attention.png); + background-position: 0.8em 0.8em; + background-repeat: no-repeat; + border: 1px solid #CCC; + -moz-border-radius: 10px; + -webkit-border-radius: 10px; + border-radius: 10px; +} \ No newline at end of file diff --git a/lib/base.php b/lib/base.php index 712ea54d70..dbeba1dd1f 100644 --- a/lib/base.php +++ b/lib/base.php @@ -222,7 +222,7 @@ class OC_UTIL { /** * check if the current server configuration is suitable for ownCloud - * @return array with error messages + * @return array arrays with error messages and hints */ public static function checkServer(){ global $SERVERROOT; @@ -235,11 +235,23 @@ class OC_UTIL { //check for database drivers if(!is_callable('sqlite_open') and !is_callable('mysql_connect')){ - $errors[]='No database drivers (sqlite or mysql) installed.
'; + $errors[]=array('error'=>'No database drivers (sqlite or mysql) installed.
','hint'=>'');//TODO: sane hint } $CONFIG_DBTYPE = OC_CONFIG::getValue( "dbtype", "sqlite" ); $CONFIG_DBNAME = OC_CONFIG::getValue( "dbname", "owncloud" ); - + + //try to get the username the httpd server runs on, used in hints + $stat=stat($_SERVER['DOCUMENT_ROOT']); + if(is_callable('posix_getpwuid')){ + $serverUser=posix_getpwuid($stat['uid']); + $serverUser='\''.$serverUser['name'].'\''; + }else{ + $serverUser='\'www-data\' for ubuntu/debian';//TODO: try to detect the distro and give a guess based on that + } + + //common hint for all file permissons error messages + $permissionsHint="Permissions can usually be fixed by setting the owner of the directory to the user the web server runs as ($serverUser)"; + //check for correct file permissions if(!stristr(PHP_OS, 'WIN')){ if($CONFIG_DBTYPE=='sqlite'){ @@ -251,7 +263,7 @@ class OC_UTIL { clearstatcache(); $prems=substr(decoct(fileperms($file)),-3); if(substr($prems,2,1)!='0'){ - $errors[]='SQLite database file ('.$file.') is readable from the web
'; + $errors[]=array('error'=>'SQLite database file ('.$file.') is readable from the web
','hint'=>$permissionsHint); } } } @@ -262,7 +274,7 @@ class OC_UTIL { clearstatcache(); $prems=substr(decoct(fileperms($CONFIG_DATADIRECTORY_ROOT)),-3); if(substr($prems,2,1)!='0'){ - $errors[]='Data directory ('.$CONFIG_DATADIRECTORY_ROOT.') is readable from the web
'; + $errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY_ROOT.') is readable from the web
','hint'=>$permissionsHint); } } if( OC_CONFIG::getValue( "enablebackup", false )){ @@ -272,7 +284,7 @@ class OC_UTIL { clearstatcache(); $prems=substr(decoct(fileperms($CONFIG_BACKUPDIRECTORY)),-3); if(substr($prems,2,1)!='0'){ - $errors[]='Data directory ('.$CONFIG_BACKUPDIRECTORY.') is readable from the web
'; + $errors[]=array('error'=>'Data directory ('.$CONFIG_BACKUPDIRECTORY.') is readable from the web
','hint'=>$permissionsHint); } } } @@ -280,7 +292,7 @@ class OC_UTIL { //TODO: premisions checks for windows hosts } if(!is_writable($CONFIG_DATADIRECTORY_ROOT)){ - $errors[]='Data directory ('.$CONFIG_BACKUPDIRECTORY.') not writable by ownCloud
'; + $errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY_ROOT.') not writable by ownCloud
','hint'=>$permissionsHint); } //TODO: check for php modules diff --git a/templates/error.php b/templates/error.php index e8f56d63bd..5b71c1ef75 100644 --- a/templates/error.php +++ b/templates/error.php @@ -5,10 +5,12 @@ ?>
" alt="ownCloud" /> -



    -
  • +
  • +
    +

    +