diff options
94 files changed, 2274 insertions, 1516 deletions
diff --git a/3rdparty/css/chosen-sprite.png b/3rdparty/css/chosen-sprite.png Binary files differnew file mode 100644 index 00000000000..f20db4439ea --- /dev/null +++ b/3rdparty/css/chosen-sprite.png diff --git a/3rdparty/css/chosen.css b/3rdparty/css/chosen.css new file mode 100644 index 00000000000..247d07bf021 --- /dev/null +++ b/3rdparty/css/chosen.css @@ -0,0 +1,340 @@ +/* @group Base */ +select.chzn-select { + visibility: hidden; + height: 28px !important; + min-height: 28px !important; +} +.chzn-container { + font-size: 13px; + position: relative; + display: inline-block; + zoom: 1; + *display: inline; +} +.chzn-container .chzn-drop { + background: #fff; + border: 1px solid #aaa; + border-top: 0; + position: absolute; + top: 29px; + left: 0; + -webkit-box-shadow: 0 4px 5px rgba(0,0,0,.15); + -moz-box-shadow : 0 4px 5px rgba(0,0,0,.15); + -o-box-shadow : 0 4px 5px rgba(0,0,0,.15); + box-shadow : 0 4px 5px rgba(0,0,0,.15); + z-index: 999; +} +/* @end */ + +/* @group Single Chosen */ +.chzn-container-single .chzn-single { + background-color: #fff; + background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eeeeee), color-stop(0.5, white)); + background-image: -webkit-linear-gradient(center bottom, #eeeeee 0%, white 50%); + background-image: -moz-linear-gradient(center bottom, #eeeeee 0%, white 50%); + background-image: -o-linear-gradient(top, #eeeeee 0%,#ffffff 50%); + background-image: -ms-linear-gradient(top, #eeeeee 0%,#ffffff 50%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#ffffff',GradientType=0 ); + background-image: linear-gradient(top, #eeeeee 0%,#ffffff 50%); + -webkit-border-radius: 4px; + -moz-border-radius : 4px; + border-radius : 4px; + -moz-background-clip : padding; + -webkit-background-clip: padding-box; + background-clip : padding-box; + border: 1px solid #aaa; + display: block; + overflow: hidden; + white-space: nowrap; + position: relative; + height: 26px; + line-height: 26px; + padding: 0 0 0 8px; + color: #444; + text-decoration: none; +} +.chzn-container-single .chzn-single span { + margin-right: 26px; + display: block; + overflow: hidden; + white-space: nowrap; + -o-text-overflow: ellipsis; + -ms-text-overflow: ellipsis; + -moz-binding: url('/xml/ellipsis.xml#ellipsis'); + text-overflow: ellipsis; +} +.chzn-container-single .chzn-single div { + -webkit-border-radius: 0 4px 4px 0; + -moz-border-radius : 0 4px 4px 0; + border-radius : 0 4px 4px 0; + -moz-background-clip : padding; + -webkit-background-clip: padding-box; + background-clip : padding-box; + background: #ccc; + background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #ccc), color-stop(0.6, #eee)); + background-image: -webkit-linear-gradient(center bottom, #ccc 0%, #eee 60%); + background-image: -moz-linear-gradient(center bottom, #ccc 0%, #eee 60%); + background-image: -o-linear-gradient(bottom, #ccc 0%, #eee 60%); + background-image: -ms-linear-gradient(top, #cccccc 0%,#eeeeee 60%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cccccc', endColorstr='#eeeeee',GradientType=0 ); + background-image: linear-gradient(top, #cccccc 0%,#eeeeee 60%); + border-left: 1px solid #aaa; + position: absolute; + right: 0; + top: 0; + display: block; + height: 100%; + width: 18px; +} +.chzn-container-single .chzn-single div b { + background: url('chosen-sprite.png') no-repeat 0 1px; + display: block; + width: 100%; + height: 100%; +} +.chzn-container-single .chzn-search { + padding: 3px 4px; + margin: 0; + white-space: nowrap; +} +.chzn-container-single .chzn-search input { + background: #fff url('chosen-sprite.png') no-repeat 100% -20px; + background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee)); + background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%); + background: url('chosen-sprite.png') no-repeat 100% -20px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%); + background: url('chosen-sprite.png') no-repeat 100% -20px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%); + background: url('chosen-sprite.png') no-repeat 100% -20px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%); + background: url('chosen-sprite.png') no-repeat 100% -20px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%); + background: url('chosen-sprite.png') no-repeat 100% -20px, linear-gradient(top, #ffffff 85%,#eeeeee 99%); + margin: 1px 0; + padding: 4px 20px 4px 5px; + outline: 0; + border: 1px solid #aaa; + font-family: sans-serif; + font-size: 1em; +} +.chzn-container-single .chzn-drop { + -webkit-border-radius: 0 0 4px 4px; + -moz-border-radius : 0 0 4px 4px; + border-radius : 0 0 4px 4px; + -moz-background-clip : padding; + -webkit-background-clip: padding-box; + background-clip : padding-box; +} +/* @end */ + +/* @group Multi Chosen */ +.chzn-container-multi .chzn-choices { + background-color: #fff; + background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee)); + background-image: -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%); + background-image: -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%); + background-image: -o-linear-gradient(bottom, white 85%, #eeeeee 99%); + background-image: -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee',GradientType=0 ); + background-image: linear-gradient(top, #ffffff 85%,#eeeeee 99%); + border: 1px solid #aaa; + margin: 0; + padding: 0; + cursor: text; + overflow: hidden; + height: auto !important; + height: 1%; + position: relative; +} +.chzn-container-multi .chzn-choices li { + float: left; + list-style: none; +} +.chzn-container-multi .chzn-choices .search-field { + white-space: nowrap; + margin: 0; + padding: 0; +} +.chzn-container-multi .chzn-choices .search-field input { + color: #666; + background: transparent !important; + border: 0 !important; + padding: 5px; + margin: 1px 0; + outline: 0; + -webkit-box-shadow: none; + -moz-box-shadow : none; + -o-box-shadow : none; + box-shadow : none; +} +.chzn-container-multi .chzn-choices .search-field .default { + color: #999; +} +.chzn-container-multi .chzn-choices .search-choice { + -webkit-border-radius: 3px; + -moz-border-radius : 3px; + border-radius : 3px; + -moz-background-clip : padding; + -webkit-background-clip: padding-box; + background-clip : padding-box; + background-color: #e4e4e4; + background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #e4e4e4), color-stop(0.7, #eeeeee)); + background-image: -webkit-linear-gradient(center bottom, #e4e4e4 0%, #eeeeee 70%); + background-image: -moz-linear-gradient(center bottom, #e4e4e4 0%, #eeeeee 70%); + background-image: -o-linear-gradient(bottom, #e4e4e4 0%, #eeeeee 70%); + background-image: -ms-linear-gradient(top, #e4e4e4 0%,#eeeeee 70%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e4e4e4', endColorstr='#eeeeee',GradientType=0 ); + background-image: linear-gradient(top, #e4e4e4 0%,#eeeeee 70%); + color: #333; + border: 1px solid #b4b4b4; + line-height: 13px; + padding: 3px 19px 3px 6px; + margin: 3px 0 3px 5px; + position: relative; +} +.chzn-container-multi .chzn-choices .search-choice span { + cursor: default; +} +.chzn-container-multi .chzn-choices .search-choice-focus { + background: #d4d4d4; +} +.chzn-container-multi .chzn-choices .search-choice .search-choice-close { + display: block; + position: absolute; + right: 5px; + top: 6px; + width: 8px; + height: 9px; + font-size: 1px; + background: url(chosen-sprite.png) right top no-repeat; +} +.chzn-container-multi .chzn-choices .search-choice .search-choice-close:hover { + background-position: right -9px; +} +.chzn-container-multi .chzn-choices .search-choice-focus .search-choice-close { + background-position: right -9px; +} +/* @end */ + +/* @group Results */ +.chzn-container .chzn-results { + margin: 0 4px 4px 0; + max-height: 190px; + padding: 0 0 0 4px; + position: relative; + overflow-x: hidden; + overflow-y: auto; +} +.chzn-container-multi .chzn-results { + margin: -1px 0 0; + padding: 0; +} +.chzn-container .chzn-results li { + line-height: 80%; + padding: 7px 7px 8px; + margin: 0; + list-style: none; +} +.chzn-container .chzn-results .active-result { + cursor: pointer; +} +.chzn-container .chzn-results .highlighted { + background: #3875d7; + color: #fff; +} +.chzn-container .chzn-results li em { + background: #feffde; + font-style: normal; +} +.chzn-container .chzn-results .highlighted em { + background: transparent; +} +.chzn-container .chzn-results .no-results { + background: #f4f4f4; +} +.chzn-container .chzn-results .group-result { + cursor: default; + color: #999; + font-weight: bold; +} +.chzn-container .chzn-results .group-option { + padding-left: 20px; +} +.chzn-container-multi .chzn-drop .result-selected { + display: none; +} +/* @end */ + +/* @group Active */ +.chzn-container-active .chzn-single { + -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3); + -moz-box-shadow : 0 0 5px rgba(0,0,0,.3); + -o-box-shadow : 0 0 5px rgba(0,0,0,.3); + box-shadow : 0 0 5px rgba(0,0,0,.3); + border: 1px solid #5897fb; +} +.chzn-container-active .chzn-single-with-drop { + border: 1px solid #aaa; + -webkit-box-shadow: 0 1px 0 #fff inset; + -moz-box-shadow : 0 1px 0 #fff inset; + -o-box-shadow : 0 1px 0 #fff inset; + box-shadow : 0 1px 0 #fff inset; + background-color: #eee; + background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, white), color-stop(0.5, #eeeeee)); + background-image: -webkit-linear-gradient(center bottom, white 0%, #eeeeee 50%); + background-image: -moz-linear-gradient(center bottom, white 0%, #eeeeee 50%); + background-image: -o-linear-gradient(bottom, white 0%, #eeeeee 50%); + background-image: -ms-linear-gradient(top, #ffffff 0%,#eeeeee 50%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee',GradientType=0 ); + background-image: linear-gradient(top, #ffffff 0%,#eeeeee 50%); + -webkit-border-bottom-left-radius : 0; + -webkit-border-bottom-right-radius: 0; + -moz-border-radius-bottomleft : 0; + -moz-border-radius-bottomright: 0; + border-bottom-left-radius : 0; + border-bottom-right-radius: 0; +} +.chzn-container-active .chzn-single-with-drop div { + background: transparent; + border-left: none; +} +.chzn-container-active .chzn-single-with-drop div b { + background-position: -18px 1px; +} +.chzn-container-active .chzn-choices { + -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3); + -moz-box-shadow : 0 0 5px rgba(0,0,0,.3); + -o-box-shadow : 0 0 5px rgba(0,0,0,.3); + box-shadow : 0 0 5px rgba(0,0,0,.3); + border: 1px solid #5897fb; +} +.chzn-container-active .chzn-choices .search-field input { + color: #111 !important; +} +/* @end */ + +/* @group Right to Left */ +.chzn-rtl { direction:rtl;text-align: right; } +.chzn-rtl .chzn-single { padding-left: 0; padding-right: 8px; } +.chzn-rtl .chzn-single span { margin-left: 26px; margin-right: 0; } +.chzn-rtl .chzn-single div { + left: 0; right: auto; + border-left: none; border-right: 1px solid #aaaaaa; + -webkit-border-radius: 4px 0 0 4px; + -moz-border-radius : 4px 0 0 4px; + border-radius : 4px 0 0 4px; +} +.chzn-rtl .chzn-choices li { float: right; } +.chzn-rtl .chzn-choices .search-choice { padding: 3px 6px 3px 19px; margin: 3px 5px 3px 0; } +.chzn-rtl .chzn-choices .search-choice .search-choice-close { left: 5px; right: auto; background-position: right top;} +.chzn-rtl.chzn-container-single .chzn-results { margin-left: 4px; margin-right: 0; padding-left: 0; padding-right: 4px; } +.chzn-rtl .chzn-results .group-option { padding-left: 0; padding-right: 20px; } +.chzn-rtl.chzn-container-active .chzn-single-with-drop div { border-right: none; } +.chzn-rtl .chzn-search input { + background: url('chosen-sprite.png') no-repeat -38px -20px, #ffffff; + background: url('chosen-sprite.png') no-repeat -38px -20px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee)); + background: url('chosen-sprite.png') no-repeat -38px -20px, -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%); + background: url('chosen-sprite.png') no-repeat -38px -20px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%); + background: url('chosen-sprite.png') no-repeat -38px -20px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%); + background: url('chosen-sprite.png') no-repeat -38px -20px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%); + background: url('chosen-sprite.png') no-repeat -38px -20px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%); + background: url('chosen-sprite.png') no-repeat -38px -20px, linear-gradient(top, #ffffff 85%,#eeeeee 99%); + padding: 4px 5px 4px 20px; +} +/* @end */
\ No newline at end of file diff --git a/3rdparty/js/chosen/LICENSE.md b/3rdparty/js/chosen/LICENSE.md new file mode 100644 index 00000000000..80109bba802 --- /dev/null +++ b/3rdparty/js/chosen/LICENSE.md @@ -0,0 +1,24 @@ +# Chosen, a Select Box Enhancer for jQuery and Protoype +## by Patrick Filler for [Harvest](http://getharvest.com) + +Available for use under the [MIT License](http://en.wikipedia.org/wiki/MIT_License) + +Copyright (c) 2011 by Harvest + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE.
\ No newline at end of file diff --git a/3rdparty/js/chosen/README.md b/3rdparty/js/chosen/README.md new file mode 100644 index 00000000000..cee8ed1cc08 --- /dev/null +++ b/3rdparty/js/chosen/README.md @@ -0,0 +1,46 @@ +# Chosen + +Chosen is a library for making long, unwieldy select boxes more user friendly. + +- jQuery support: 1.4+ +- Prototype support: 1.7+ + +For documentation, usage, and examples, see: +http://harvesthq.github.com/chosen + +### Contributing to Chosen + +Contributions and pull requests are very welcome. Please follow these guidelines when submitting new code. + +1. Make all changes in Coffeescript files, **not** JavaScript files. +2. For feature changes, update both jQuery *and* Prototype versions +3. Use 'cake build' to generate Chosen's JavaScript file and minified version. +4. Don't touch the VERSION file +5. Submit a Pull Request using GitHub. + +### Using CoffeeScript & Cake + +First, make sure you have the proper CoffeeScript / Cake set-up in place. + +1. Install Coffeescript: the [CoffeeScript documentation](http://jashkenas.github.com/coffee-script/) provides easy-to-follow instructions. +2. Install UglifyJS: <code>npm -g install uglify-js</code> +3. Verify that your $NODE_PATH is properly configured using <code>echo $NODE_PATH</code> + +Once you're configured, building the JavasScript from the command line is easy: + + cake build # build Chosen from source + cake watch # watch coffee/ for changes and build Chosen + +If you're interested, you can find the recipes in Cakefile. + + +### Chosen Credits + +- Built by [Harvest](http://www.getharvest.com/) +- Concept and development by [Patrick Filler](http://www.patrickfiller.com/) +- Design and CSS by [Matthew Lettini](http://matthewlettini.com/) + +### Notable Forks + +- [Chosen for MooTools](https://github.com/julesjanssen/chosen), by Jules Janssen +- [Chosen Drupal 7 Module](https://github.com/Polzme/chosen), by Pol Dell'Aiera
\ No newline at end of file diff --git a/3rdparty/js/chosen/VERSION b/3rdparty/js/chosen/VERSION new file mode 100644 index 00000000000..f374f6662e9 --- /dev/null +++ b/3rdparty/js/chosen/VERSION @@ -0,0 +1 @@ +0.9.1 diff --git a/admin/ajax/disableapp.php b/admin/ajax/disableapp.php index dce62fa11d4..0cf66a553f8 100644 --- a/admin/ajax/disableapp.php +++ b/admin/ajax/disableapp.php @@ -1,5 +1,4 @@ <?php - // Init owncloud require_once('../../lib/base.php'); header( "Content-Type: application/jsonrequest" ); diff --git a/admin/appinfo/app.php b/admin/appinfo/app.php index 08a36060fe3..80850638f71 100644 --- a/admin/appinfo/app.php +++ b/admin/appinfo/app.php @@ -2,11 +2,4 @@ OC_App::register( array( "order" => 1, "id" => "admin", "name" => "Administration" )); -// OC_App::addAdminPage( array( "id" => "core_system", "order" => 1, "href" => OC_Helper::linkTo( "admin", "system.php" ), "name" =>"System", "icon" => OC_Helper::imagePath( "admin", "administration.png" ))); -OC_App::addAdminPage( array( "id" => "core_users", "order" => 2, "href" => OC_Helper::linkTo( "admin", "users.php" ), "name" => "Users", "icon" => OC_Helper::imagePath( "admin", "users.png" ))); -OC_App::addAdminPage( array( "id" => "core_apps", "order" => 3, "href" => OC_Helper::linkTo( "admin", "apps.php?installed" ), "name" => "Apps", "icon" => OC_Helper::imagePath( "admin", "apps.png" ))); - -// Add subentries for App installer -//OC_App::addNavigationSubEntry( "core_apps", array( "id" => "core_apps_get", "order" => 4, "href" => OC_Helper::linkTo( "admin", "apps.php" ), "name" => "Get new apps", "icon" => OC_Helper::imagePath( "admin", "navicon.png" ))); - ?> diff --git a/admin/apps.php b/admin/apps.php index 4f39feab0c5..de11dccc3d5 100644 --- a/admin/apps.php +++ b/admin/apps.php @@ -53,7 +53,7 @@ if($installed){ $records[]=$record; } - $tmpl = new OC_Template( "admin", "appsinst", "admin" ); + $tmpl = new OC_Template( "admin", "appsinst", "user" ); $tmpl->assign( "apps", $records ); $tmpl->printPage(); unset($tmpl); @@ -63,7 +63,7 @@ if($installed){ if($categories==NULL){ OC_App::setActiveNavigationEntry( "core_apps" ); - $tmpl = new OC_Template( "admin", "app_noconn", "admin" ); + $tmpl = new OC_Template( "admin", "app_noconn", "user" ); $tmpl->printPage(); unset($tmpl); exit(); @@ -82,7 +82,7 @@ if($installed){ } // return template - $tmpl = new OC_Template( "admin", "apps", "admin" ); + $tmpl = new OC_Template( "admin", "apps", "user" ); $tmpl->assign( "categories", $categories ); $tmpl->assign( "apps", $apps ); @@ -94,7 +94,7 @@ if($installed){ $app=OC_OCSClient::getApplication($id); - $tmpl = new OC_Template( "admin", "app", "admin" ); + $tmpl = new OC_Template( "admin", "app", "user" ); $tmpl->assign( "categories", $categories ); $tmpl->assign( "app", $app ); $tmpl->printPage(); diff --git a/admin/css/apps.css b/admin/css/apps.css index c6b4f69ebcb..92ab64df552 100644 --- a/admin/css/apps.css +++ b/admin/css/apps.css @@ -1,9 +1,14 @@ /* APPS TABLE */ -table td.date { width:5em; padding:.5em 1em; text-align:right; } -table td.version, table td.enabled, table td.disabled { padding:.5em 1em; text-align:center; } +table td.date { width:5em; padding:.5em 1em; text-align:left; } +table td.version, table td.enabled, table td.disabled { padding:.5em 1em; text-align:left; } .preview { padding:3px; text-align:left; } -table td.date { width:11em; color:#555555; } -table td.selection, table th.selection, table td.fileaction { width:2em; text-align:center; } -table td.name a { padding:6px; text-decoration:none; color:#555555; } -.type { text-decoration:none; color:#888888; font-size:.8em; } -.description { text-decoration:none; color:#666666; font-size:.9em; } +table td.date { width:11em; color:#555; } +table td.selection, table th.selection, table td.fileaction { width:2em; text-align:left; } +table td.name a { padding:6px; text-decoration:none; color:#555; } +.type { text-decoration:none; color:#888; font-size:.8em; } +.description { text-decoration:none; color:#666; font-size:.9em; } + +#content ul#apps { width:40em; list-style:none; } +#content ul#apps li { display:block; padding:.2em; clear:right; } +#content ul#apps em { color:#555; } +#content ul#apps input { float:right; } diff --git a/admin/css/users.css b/admin/css/users.css new file mode 100644 index 00000000000..521217df4f4 --- /dev/null +++ b/admin/css/users.css @@ -0,0 +1,5 @@ +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} diff --git a/admin/js/apps.js b/admin/js/apps.js index ee9d814eb0b..4def5ed5553 100644 --- a/admin/js/apps.js +++ b/admin/js/apps.js @@ -1,18 +1,17 @@ $("input[x-use='appenablebutton']").live( "click", function(){ - appid = $(this).parent().parent().attr("x-uid"); + appid = $(this).parent().data("uid"); //alert("dsfsdfsdf"); if($(this).val() == "enabled"){ $(this).attr("value","disabled"); $(this).removeClass( "enabled" ); $(this).addClass( "disabled" ); - //$.post( "ajax/disableapp.php", $(appid).serialize(), function(data){} ); - $.post( "ajax/disableapp.php", { appid: appid }, function(data){ alert(data.status);}); + $.post( "ajax/disableapp.php", 'appid='+appid); } else if($(this).val() == "disabled"){ $(this).attr("value","enabled"); $(this).removeClass( "disabled" ); $(this).addClass( "enabled" ); - $.post( "ajax/enableapp.php", { appid: appid }, function(data){ alert(data.status);} ); + $.post( "ajax/enableapp.php", 'appid='+appid); } });
\ No newline at end of file diff --git a/admin/js/users.js b/admin/js/users.js index 994ce6f6cbd..7e643fb60a2 100644 --- a/admin/js/users.js +++ b/admin/js/users.js @@ -1,340 +1,100 @@ $(document).ready(function(){ - // Vars we need - var uid = ""; - var gid = ""; - var togglepassword = ""; - var togglegroup = ""; - - //######################################################################### - // Stuff I don't understand - //######################################################################### - - function doToggleGroup( group ){ - $("#changegroupgid").val(group); - - // Serialize the data - var post = $( "#changegroupsform" ).serialize(); - // Ajax foo - $.post( 'ajax/togglegroups.php', post, function(data){ - if( data.status == "success" ){ - var groups = []; - $("input[x-use='togglegroup']").each( function(index){ - if( $(this).attr("checked")){ - groups.push($(this).val()); - } - }); - if( groups.length == 0 ){ - $("#changegroups").prev().html( ' ' ); - } - else{ - $("#changegroups").prev().html( groups.join(", ")); - } - } - else{ - printError( data.data.message ); + $('select[multiple]').chosen(); + + $('td.remove>img').live('click',function(event){ + var uid=$(this).parent().parent().data('uid'); + $.post( + OC.filePath('admin','ajax','removeuser.php'), + {username:uid}, + function(result){ + } - }); - return false; - } - - function printError( message ){ - $("#errormessage").text( message ); - $("#errordialog").dialog( "open" ); - return false; - } - - //######################################################################### - // Functions for editing the dom after user manipulation - //######################################################################### - - // Manipulating the page after crteating a user - function userCreated( username, groups ){ - // We need at least a space for showing the div - if( groups == "" ){ - groups = ' '; - } - - // Add user to table - var newrow = '<tr x-uid="'+username+'"><td x-use="username"><div x-use="usernamediv">'+username+'</div></td>'; - newrow = newrow+'<td x-use="usergroups"><div x-use="usergroupsdiv">'+groups+'</td>'; - newrow = newrow+'<td><a class="removeuserbutton" href="">remove</a></td></tr>'; - $("#usertable").append( newrow ); - - // Clear forms - $("input[x-use='createuserfield']").val( "" ); - $("input[x-use='createusercheckbox']").attr( "checked", false ); - } - - function userRemoved( username ){ - $( "tr[x-uid='"+username+"']" ).remove(); - } - - function groupCreated( groupname ){ - var newrow = '<tr x-gid="'+groupname+'"><td>' + groupname + '</td>'; - newrow = newrow + '<td><a class="removegroupbutton" href="">remove</a></td></tr>'; - $("#grouptable").append( newrow ); - - // Delete form content - $("input[x-use='creategroupfield']").val( "" ); - - // Add group option to Create User and Edit User - var createuser = '<input x-use="createusercheckbox" x-gid="'+groupname+'" type="checkbox" name="groups[]" value="'+groupname+'" /> <span x-gid="'+groupname+'">'+groupname+'<br /></span>'; - $("#createusergroups").append( createuser ); - var changeuser = '<input x-use="togglegroup" x-gid="'+groupname+'" type="checkbox" name="groups[]" value="'+groupname+'" /> <span x-use="togglegroup" x-gid="'+groupname+'">'+groupname+'<br /></span>'; - $("#changegroupsform").append( changeuser ); - } - - function groupRemoved( groupname ){ - // Delete the options - $( "tr[x-gid='"+groupname+"']" ).remove(); - $( "span[x-gid='"+groupname+"']" ).remove(); - $( "input[x-gid='"+groupname+"']" ).remove(); - - // remove it from user list - $( "div[x-use='usergroupsdiv']" ).each(function(index){ - var content = $(this).text(); - var list = content.split( ", " ); - var newlist = []; - for( var i = 0; i < list.length; i++ ){ - var temp = list[i]; - if( temp != groupname ){ - newlist.push( temp ); - } + ); + $(this).parent().parent().remove(); + }); + + $('#newuser').submit(function(event){ + event.preventDefault(); + var username=$('#newusername').val(); + var password=$('#newuserpassword').val(); + var groups=$('#newusergroups').val(); + $.post( + OC.filePath('admin','ajax','createuser.php'), + { + username:username, + password:password, + groups:groups, + }, + function(result){ + } - var newstring = newlist.join( ", " ); - $(this).html( newstring ) - }); - - } - - //######################################################################### - // Editing the users properties by clicking the cell - //######################################################################### - - // Password (clicking on user name) - $("span[x-use='usernamediv']").live( "click", function(){ - if( togglepassword == "" || $(this).parent().parent().attr("x-uid") != togglepassword ){ - togglepassword = $(this).parent().parent().attr("x-uid"); - // Set the username! - $("#changepassworduid").val(togglepassword); - $("#changepasswordpwd").val(""); - $(this).parent().append( $('#changepassword') ); - $('#changepassword').show(); - } - else{ - $('#changepassword').hide(); - togglepassword = ""; + ); + var tr=$('#rightcontent 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'); } }); - - $("#changepasswordbutton").click( function(){ - // Serialize the data - var post = $( "#changepasswordform" ).serialize(); - // Ajax foo - $.post( 'ajax/changepassword.php', post, function(data){ - if( data.status == "success" ){ - togglepassword = ""; - $('#changepassword').hide(); - } - else{ - printError( data.data.message ); + + $('#newgroup').submit(function(event){ + event.preventDefault(); + var name=$('#newgroupname').val(); + $.post( + OC.filePath('admin','ajax','creategroup.php'), + {groupname:name}, + function(result){ + } - }); - return false; + ); + $('#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); }); - - // Groups - $("div[x-use='usergroupsdiv']").live( "click", function(){ - if( togglegroup == "" || $(this).parent().parent().attr("x-uid") != togglegroup){ - togglegroup = $(this).parent().parent().attr("x-uid"); - var groups = $(this).text(); - groups = groups.split(", "); - $("input[x-use='togglegroup']").each( function(index){ - var check = false; - // Group checked? - for( var i = 0; i < groups.length; i++ ){ - if( $(this).val() == groups[i] ){ - check = true; - } - } - - // Check/uncheck - if( check ){ - $(this).attr("checked","checked"); - } - else{ - $(this).removeAttr("checked"); - } - }); - $("#changegroupuid").val(togglegroup); - $(this).empty(); - $(this).parent().append( $('#changegroups') ); - $('#changegroups').show(); - } - else{ - var groups = []; - $("input[x-use='togglegroup']").each( function(index){ - if( $(this).attr("checked")){ - groups.push($(this).val()); - } - }); - if( groups.length == 0 ){ - $("#changegroups").prev().html( ' ' ); - } - else{ - $("#changegroups").prev().html( groups.join(", ")); - } - $('#changegroups').hide(); - togglegroup = ""; - } + + $('#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); + }); + rows.find('td.select input').attr('checked','checked'); }); - - $("span[x-use='togglegroup']").live( "click", function(){ - if( $(this).prev().attr("checked")){ - $(this).prev().removeAttr("checked") - } - else{ - $(this).prev().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; } - doToggleGroup( $(this).attr("x-gid")); - }); - - $("input[x-use='togglegroup']").live( "click", function(){ - doToggleGroup( $(this).attr("x-gid")); - }); - //######################################################################### - // Clicking on buttons - //######################################################################### - - - // Create a new user - $( "#createuserbutton" ) - .click(function(){ - if(!$( "#createuserbutton" ).data('active')){ - $( "#createuserbutton" ).data('active',true); - - // Create the post data - var post = $( "#createuserdata" ).serialize(); - - // Ajax call - $.post( 'ajax/createuser.php', post, function(data){ - $( "#createuserbutton" ).data('active',false); + if(group){ + $.post( + OC.filePath('admin','ajax','togglegroups.php'), + { + username:user, + group:group + }, + function(result){ - // If it says "success" then we are happy - if( data.status == "success" ){ - userCreated( data.data.username, data.data.groups ); - } - else{ - printError( data.data.message ); - } - }); - } - return false; - }); - - $( ".removeuserbutton" ).live( 'click', function() { - uid = $( this ).parent().parent().attr( 'x-uid' ); - $("#deleteuserusername").html(uid); - $("#deleteusernamefield").val(uid); - $("#removeuserform").dialog( "open" ); - return false; - }); - - $( "#creategroupbutton" ) - .click(function(){ - // Serialize the data - var post = $( "#creategroupdata" ).serialize(); - // Ajax foo - $.post( 'ajax/creategroup.php', post, function(data){ - if( data.status == "success" ){ - groupCreated( data.data.groupname ); - } - else{ - printError( data.data.message ); } - }); - return false; - }); - - $( ".removegroupbutton" ).live( 'click', function(){ - gid = $( this ).parent().parent().attr( 'x-gid' ); - $("#removegroupgroupname").html(gid); - $("#removegroupnamefield").val(gid); - $("#removegroupform").dialog( "open" ); - return false; - }); - - //######################################################################### - // Dialogs - //######################################################################### - - // Removing users - $( "#errordialog" ).dialog({ - autoOpen: false, - modal: true, - buttons: { - OK: function() { - $( this ).dialog( "close" ); - } - } - }); - - // Removing users - $( "#removeuserform" ).dialog({ - autoOpen: false, - height: 300, - width: 350, - modal: true, - buttons: { - "Remove user": function() { - var post = $( "#removeuserdata" ).serialize(); - $.post( 'ajax/removeuser.php', post, function(data){ - if( data.status == "success" ){ - userRemoved( uid ); - } - else{ - printError( data.data.message ); - } - }); - $( this ).dialog( "close" ); - }, - Cancel: function() { - $( this ).dialog( "close" ); - } - }, - close: function() { - true; - } - }); - - - // Dialog for adding users - $( "#removegroupform" ).dialog({ - autoOpen: false, - height: 300, - width: 350, - modal: true, - buttons: { - "Remove group": function(){ - var post = $( "#removegroupdata" ).serialize(); - $.post( 'ajax/removegroup.php', post, function(data){ - if( data.status == "success" ){ - groupRemoved( gid ); - } - else{ - printError( data.data.message ); - } - }); - $( this ).dialog( "close" ); - }, - Cancel: function() { - $( this ).dialog( "close" ); + ); + 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); } - }, - close: function(){ - true; + $(this).parent().parent().children('td.groups').text(groups.join(', ')); } }); - -} ); - +}); diff --git a/admin/system.php b/admin/system.php index 11a76132b4c..da77027f7aa 100644 --- a/admin/system.php +++ b/admin/system.php @@ -29,7 +29,7 @@ if( !OC_User::isLoggedIn() || !OC_Group::inGroup( OC_User::getUser(), 'admin' )) OC_App::setActiveNavigationEntry( "administration" ); -$tmpl = new OC_Template( "admin", "system", "admin" ); +$tmpl = new OC_Template( "admin", "system", "user" ); $tmpl->printPage(); ?> diff --git a/admin/templates/appsinst.php b/admin/templates/appsinst.php index d205d95cc34..035a75c9e8d 100644 --- a/admin/templates/appsinst.php +++ b/admin/templates/appsinst.php @@ -1,20 +1,7 @@ -<table> - <thead> - <tr> - <th><?php echo $l->t( 'Name' ); ?></th> - <th><?php echo $l->t( 'Version' ); ?></th> - <th><?php echo $l->t( 'Author' ); ?></th> - <th><?php echo $l->t( 'Status' ); ?></th> - </tr> - </thead> - <tbody> - <?php foreach($_["apps"] as $app): ?> - <tr x-uid="<?php echo($app['id']); ?>"> - <td class="name" width="200"><?php echo($app['name']); ?></td> - <td class="version"><?php echo($app['version']); ?></td> - <td><?php echo($app['author']); ?></td> - <td><input x-use="appenablebutton" type="submit" value="<?php echo $l->t( $app['enabled'] ? 'enabled' : 'disabled' ); ?>" class="appbutton <?php echo( $app['enabled'] ? 'enabled' : 'disabled' ); ?>" /></td> - </tr> - <?php endforeach; ?> - </tbody> -</table> +<ul id="apps"> +<?php foreach($_["apps"] as $app): ?> + <li data-uid="<?php echo($app['id']); ?>"><strong><?php echo($app['name']); ?></strong> <?php echo($app['version']); ?> <em>by <?php echo($app['author']); ?></em> + <input x-use="appenablebutton" type="submit" value="<?php echo $l->t( $app['enabled'] ? 'enabled' : 'disabled' ); ?>" class="appbutton <?php echo( $app['enabled'] ? 'enabled' : 'disabled' ); ?>" /> + </li> +<?php endforeach; ?> +</ul> diff --git a/admin/templates/users.php b/admin/templates/users.php index 79a4c712049..8e34c908fcd 100644 --- a/admin/templates/users.php +++ b/admin/templates/users.php @@ -1,117 +1,39 @@ -<fieldset> - <legend><?php echo $l->t( 'Users' ); ?></legend> - <table id="usertable"> - <thead> - <tr> - <th><?php echo $l->t( 'Name' ); ?></th> - <th><?php echo $l->t( 'Groups' ); ?></th> - <th></th> - </tr> - </thead> - <tfoot> - <tr id="createuserform"> - <form id="createuserdata"> - <td> - <input x-use="createuserfield" type="text" name="username" placeholder="<?php echo $l->t( 'Name' ); ?>" /> - <input x-use="createuserfield" type="password" name="password" placeholder="<?php echo $l->t( 'Password' ); ?>" /> - </td> - <td id="createusergroups"> - <?php foreach($_["groups"] as $i): ?> - <input id='newuser_group_<?php echo $i["name"]; ?>' x-use="createusercheckbox" x-gid="<?php echo $i["name"]; ?>" type="checkbox" name="groups[]" value="<?php echo $i["name"]; ?>" /> - <span x-gid="<?php echo $i["name"]; ?>"><label for='newuser_group_<?php echo $i["name"]; ?>'><?php echo $i["name"]; ?></label></span> - <?php endforeach; ?> - </td> - <td> - <input type="submit" id="createuserbutton" value="<?php echo $l->t( 'Add user' ); ?>" /> - </td> - </form> - </tr> - </tfoot> - <tbody> - <?php foreach($_["users"] as $user): ?> - <tr x-uid="<?php echo $user["name"] ?>"> - <td x-use="username"><span x-use="usernamediv"><?php echo $user["name"]; ?></span></td> - <td x-use="usergroups"><div x-use="usergroupsdiv"><?php if( $user["groups"] ){ echo $user["groups"]; }else{echo " ";} ?></div></td> - <td> - <?php if($user['name']!=OC_User::getUser()):?> - <input type="submit" class="removeuserbutton" value="<?php echo $l->t( 'Remove' ); ?>" /> - <?php endif;?> - </td> - </tr> - <?php endforeach; ?> - </tbody> - </table> -</fieldset> - -<fieldset> - <legend><?php echo $l->t( 'Groups' ); ?></legend> - <table id="grouptable"> - <thead> - <tr> - <th><?php echo $l->t( 'Name' ); ?></th> - <th></th> - </tr> - </thead> - <tfoot> - <form id="creategroupdata"> - <tr> - <td><input x-use="creategroupfield" type="text" name="groupname" placeholder="New group" /></td> - <td><input type="submit" id="creategroupbutton" value="<?php echo $l->t( 'Create group' ); ?>" /></td> - </tr> - </form> - </tfoot> - <tbody> - <?php foreach($_["groups"] as $group): ?> - <tr x-gid="<?php echo $group["name"]; ?>"> - <td><?php echo $group["name"] ?></td> - <td> - <?php if( $group["name"] != "admin" ): ?> - <input type="submit" class="removegroupbutton" value="<?php echo $l->t( 'remove' ); ?>" /> - <?php else: ?> - - <?php endif; ?> - </td> - </tr> - <?php endforeach; ?> - </tbody> - </table> -</fieldset> - - -<span id="changegroups" style="display:none"> - <form id="changegroupsform"> - <input id="changegroupuid" type="hidden" name="username" value="" /> - <input id="changegroupgid" type="hidden" name="group" value="" /> - <?php foreach($_["groups"] as $i): ?> - <input x-use="togglegroup" x-gid="<?php echo $i["name"]; ?>" type="checkbox" name="groups[]" value="<?php echo $i["name"]; ?>" /> - <span x-use="togglegroup" x-gid="<?php echo $i["name"]; ?>"><?php echo $i["name"]; ?></span> - <?php endforeach; ?> +<div id="controls"> + <form id="newgroup"> + <input id="newgroupname" placeholder="name"></input> + <input type="submit" value="create"></input> </form> -</span> - -<span id="changepassword" style="display:none"> - <form id="changepasswordform"> - <input id="changepassworduid" type="hidden" name="username" value="" /> - <?php echo $l->t( 'Force new password:' ); ?> - <input id="changepasswordpwd" type="password" name="password" value="" /> - <input type="submit" id="changepasswordbutton" value="<?php echo $l->t( 'Set' ); ?>" /> - </form> -</span> - -<div id="removeuserform" title="Remove user"> - <form id="removeuserdata"> - <?php echo $l->t( 'Do you really want to delete user' ); ?> <span id="deleteuserusername">$user</span>? - <input id="deleteusernamefield" type="hidden" name="username" value=""> - </form> -</div> - -<div id="removegroupform" title="Remove Group"> - <form id="removegroupdata"> - <?php echo $l->t( 'Do you really want to delete group' ); ?> <span id="removegroupgroupname">$group</span>? - <input id="removegroupnamefield" type="hidden" name="groupname" value=""> + <form id="newuser"> + <input id="newusername" placeholder="username"></input> + <input type="password" id="newuserpassword" placeholder="password"></input> + <select id="newusergroups" data-placeholder="groups" title="groups" multiple="multiple"> + <?php foreach($_["groups"] as $group): ?> + <option value="<?php echo $group['name'];?>"><?php echo $group['name'];?></option> + <?php endforeach;?> + </select> + <input type="submit" value="Create"></input> </form> </div> - -<div id="errordialog" title="Error"> - <span id="errormessage"></span> +<ul id="leftcontent"> + <?php foreach($_["groups"] as $group): ?> + <li data-gid="<?php echo $group["name"]; ?>"> + <?php echo $group["name"] ?> + </li> + <?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 " ";} ?></td> + <td class="remove"> + <?php if($user['name']!=OC_User::getUser()):?> + <img alt="Remove" title="Remove" class='svg' src='<?php echo image_path('core','actions/delete.svg') ?>'/> + <?php endif;?> + </td> + </tr> + <?php endforeach; ?> + </table> </div> diff --git a/admin/users.php b/admin/users.php index b87f1bb5bc8..4a83510cb72 100644 --- a/admin/users.php +++ b/admin/users.php @@ -28,8 +28,11 @@ if( !OC_User::isLoggedIn() || !OC_Group::inGroup( OC_User::getUser(), 'admin' )) } // We have some javascript foo! -OC_Util::addScript( "admin", "users" ); -OC_App::setActiveNavigationEntry( "core_users" ); +OC_Util::addScript( 'admin', 'users' ); +OC_Util::addStyle( 'admin', 'users' ); +OC_Util::addScript( '3rdparty', 'chosen/chosen.jquery.min' ); +OC_Util::addStyle( '3rdparty', 'chosen' ); +OC_App::setActiveNavigationEntry( 'core_users' ); $users = array(); $groups = array(); @@ -48,7 +51,7 @@ foreach( OC_Group::getGroups() as $i ){ $groups[] = array( "name" => $i ); } -$tmpl = new OC_Template( "admin", "users", "admin" ); +$tmpl = new OC_Template( "admin", "users", "user" ); $tmpl->assign( "users", $users ); $tmpl->assign( "groups", $groups ); $tmpl->printPage(); diff --git a/apps/contacts/ajax/addcard.php b/apps/contacts/ajax/addcard.php new file mode 100644 index 00000000000..24766931d71 --- /dev/null +++ b/apps/contacts/ajax/addcard.php @@ -0,0 +1,54 @@ +<?php +/** + * ownCloud - Addressbook + * + * @author Jakob Sack + * @copyright 2011 Jakob Sack mail@jakobsack.de + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * 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 Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +// Init owncloud +require_once('../../../lib/base.php'); + +$aid = $_POST['id']; +$l10n = new OC_L10N('contacts'); + +// Check if we are a user +if( !OC_User::isLoggedIn()){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!')))); + exit(); +} + +$addressbook = OC_Contacts_Addressbook::findAddressbook( $aid ); +if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your addressbook!')))); + exit(); +} + +$fn = $_POST['fn']; + +$vcard = new Sabre_VObject_Component('VCARD'); +$vcard->add(new Sabre_VObject_Property('FN',$fn)); +$vcard->add(new Sabre_VObject_Property('UID',OC_Contacts_Addressbook::createUID())); +$id = OC_Contacts_Addressbook::addCard($aid,$vcard->serialize()); + +$details = OC_Contacts_Addressbook::structureContact($vcard); +$tmpl = new OC_Template('contacts','part.details'); +$tmpl->assign('details',$details); +$tmpl->assign('id',$id); +$page = $tmpl->fetchPage(); + +echo json_encode( array( 'status' => 'success', 'data' => array( 'id' => $id, 'page' => $page ))); diff --git a/apps/contacts/ajax/addphoto.php b/apps/contacts/ajax/addphoto.php new file mode 100644 index 00000000000..03d5e6b3ceb --- /dev/null +++ b/apps/contacts/ajax/addphoto.php @@ -0,0 +1,59 @@ +<?php +/** + * ownCloud - Addressbook + * + * @author Jakob Sack + * @copyright 2011 Jakob Sack mail@jakobsack.de + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * 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 Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +// Init owncloud +require_once('../../../lib/base.php'); + +$id = $_POST['id']; +$l10n = new OC_L10N('contacts'); + +// Check if we are a user +if( !OC_User::isLoggedIn()){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!')))); + exit(); +} + +$card = OC_Contacts_Addressbook::findCard( $id ); +if( $card === false ){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!')))); + exit(); +} + +$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] ); +if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!')))); + exit(); +} + +$vcard = Sabre_VObject_Reader::read($card['carddata']); +$mimetype = $_FILES['photo']['type'] ? $_FILES['photo']['type'] : 'image/jpeg'; +$photobase = base64_encode(file_get_contents($_FILES['photo']['tmp_name'])); +$photo = new Sabre_VObject_Property( 'PHOTO', $photobase ); +$photo->parameters[] = new Sabre_VObject_Parameter('TYPE',$mimetype); +$photo->parameters[] = new Sabre_VObject_Parameter('ENCODING','b'); +$vcard->add($photo); + +$line = count($vcard->children) - 1; +$checksum = md5($vcard->children[$line]->serialize()); + +OC_Contacts_Addressbook::editCard($id,$vcard->serialize()); +echo json_encode( array( 'status' => 'success', 'data' => array( 'id' => $id, 'line' => $line, 'checksum' => $checksum ))); diff --git a/apps/contacts/ajax/addproperty.php b/apps/contacts/ajax/addproperty.php new file mode 100644 index 00000000000..d92566d6a18 --- /dev/null +++ b/apps/contacts/ajax/addproperty.php @@ -0,0 +1,73 @@ +<?php +/** + * ownCloud - Addressbook + * + * @author Jakob Sack + * @copyright 2011 Jakob Sack mail@jakobsack.de + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * 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 Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +// Init owncloud +require_once('../../../lib/base.php'); + +$id = $_POST['id']; +$l10n = new OC_L10N('contacts'); + +// Check if we are a user +if( !OC_User::isLoggedIn()){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!')))); + exit(); +} + +$card = OC_Contacts_Addressbook::findCard( $id ); +if( $card === false ){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!')))); + exit(); +} + +$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] ); +if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!')))); + exit(); +} + +$vcard = Sabre_VObject_Reader::read($card['carddata']); + +$name = $_POST['name']; +$value = $_POST['value']; +$parameters = isset($_POST['parameteres'])?$_POST['parameters']:array(); + +if(is_array($value)){ + $value = OC_Contacts_Addressbook::escapeSemicolons($value); +} +$property = new Sabre_VObject_Property( $name, $value ); +$parameternames = array_keys($parameters); +foreach($parameternames as $i){ + $property->parameters[] = new Sabre_VObject_Parameter($i,$parameters[$i]); +} + +$vcard->add($property); + +$line = count($vcard->children) - 1; +$checksum = md5($property->serialize()); + +OC_Contacts_Addressbook::editCard($id,$vcard->serialize()); + +$tmpl = new OC_Template('contacts','part.property'); +$tmpl->assign('property',OC_Contacts_Addressbook::structureProperty($property,$line)); +$page = $tmpl->fetchPage(); + +echo json_encode( array( 'status' => 'success', 'data' => array( 'page' => $page ))); diff --git a/apps/contacts/ajax/deletebook.php b/apps/contacts/ajax/deletebook.php new file mode 100644 index 00000000000..ba36c494cdf --- /dev/null +++ b/apps/contacts/ajax/deletebook.php @@ -0,0 +1,44 @@ +<?php +/** + * ownCloud - Addressbook + * + * @author Jakob Sack + * @copyright 2011 Jakob Sack mail@jakobsack.de + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * 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 Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +// Init owncloud +require_once('../../../lib/base.php'); + +$id = $_GET['id']; + +$l10n = new OC_L10N('contacts'); + +// Check if we are a user +if( !OC_User::isLoggedIn()){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!')))); + exit(); +} + + +$addressbook = OC_Contacts_Addressbook::findAddressbook( $id ); +if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!')))); + exit(); +} + +OC_Contacts_Addressbook::deleteAddressbook($id); +echo json_encode( array( 'status' => 'success', 'data' => array( 'id' => $id ))); diff --git a/apps/contacts/ajax/deletecard.php b/apps/contacts/ajax/deletecard.php new file mode 100644 index 00000000000..839936d3fad --- /dev/null +++ b/apps/contacts/ajax/deletecard.php @@ -0,0 +1,50 @@ +<?php +/** + * ownCloud - Addressbook + * + * @author Jakob Sack + * @copyright 2011 Jakob Sack mail@jakobsack.de + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * 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 Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +// Init owncloud +require_once('../../../lib/base.php'); + +$id = $_GET['id']; + +$l10n = new OC_L10N('contacts'); + +// Check if we are a user +if( !OC_User::isLoggedIn()){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!')))); + exit(); +} + + +$card = OC_Contacts_Addressbook::findCard( $id ); +if( $card === false ){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!')))); + exit(); +} + +$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] ); +if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!')))); + exit(); +} + +OC_Contacts_Addressbook::deleteCard($id); +echo json_encode( array( 'status' => 'success', 'data' => array( 'id' => $id ))); diff --git a/apps/contacts/ajax/deleteproperty.php b/apps/contacts/ajax/deleteproperty.php new file mode 100644 index 00000000000..9f8b5dbbaf1 --- /dev/null +++ b/apps/contacts/ajax/deleteproperty.php @@ -0,0 +1,62 @@ +<?php +/** + * ownCloud - Addressbook + * + * @author Jakob Sack + * @copyright 2011 Jakob Sack mail@jakobsack.de + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * 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 Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +// Init owncloud +require_once('../../../lib/base.php'); + +$id = $_GET['id']; +$line = $_GET['line']; +$checksum = $_GET['checksum']; + + +$l10n = new OC_L10N('contacts'); + +// Check if we are a user +if( !OC_User::isLoggedIn()){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!')))); + exit(); +} + + +$card = OC_Contacts_Addressbook::findCard( $id ); +if( $card === false ){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!')))); + exit(); +} + +$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] ); +if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!')))); + exit(); +} + +$vcard = Sabre_VObject_Reader::read($card['carddata']); + +if(md5($vcard->children[$line]->serialize()) != $checksum ){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Information about vCard is incorrect. Please reload page!')))); + exit(); +} + +unset($vcard->children[$line]); + +OC_Contacts_Addressbook::editCard($id,$vcard->serialize()); +echo json_encode( array( 'status' => 'success', 'data' => array( 'id' => $id ))); diff --git a/apps/contacts/details.php b/apps/contacts/ajax/getdetails.php index 7ab1b64de24..4ee3625afc2 100644 --- a/apps/contacts/details.php +++ b/apps/contacts/ajax/getdetails.php @@ -21,7 +21,7 @@ */ // Init owncloud -require_once('../../lib/base.php'); +require_once('../../../lib/base.php'); $id = $_GET['id']; @@ -29,7 +29,7 @@ $l10n = new OC_L10N('contacts'); // Check if we are a user if( !OC_User::isLoggedIn()){ - echo $l10n->t('You need to log in!'); + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!')))); exit(); } @@ -48,10 +48,9 @@ if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){ $vcard = Sabre_VObject_Reader::read($card['carddata']); $details = OC_Contacts_Addressbook::structureContact($vcard); - -$tmpl = new OC_Template('contacts','_details'); +$tmpl = new OC_Template('contacts','part.details'); $tmpl->assign('details',$details); $tmpl->assign('id',$id); $page = $tmpl->fetchPage(); -echo json_encode( array( 'status' => 'success', 'data' => array( 'page' => $page ))); +echo json_encode( array( 'status' => 'success', 'data' => array( 'id' => $id, 'page' => $page ))); diff --git a/apps/contacts/ajax/setphoto.php b/apps/contacts/ajax/setphoto.php new file mode 100644 index 00000000000..c29b5326027 --- /dev/null +++ b/apps/contacts/ajax/setphoto.php @@ -0,0 +1,77 @@ +<?php +/** + * ownCloud - Addressbook + * + * @author Jakob Sack + * @copyright 2011 Jakob Sack mail@jakobsack.de + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * 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 Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +// Init owncloud +require_once('../../../lib/base.php'); + +$id = $_POST['id']; +$line = $_POST['line']; +$checksum = $_POST['checksum']; +$l10n = new OC_L10N('contacts'); + +// Check if we are a user +if( !OC_User::isLoggedIn()){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!')))); + exit(); +} + +$card = OC_Contacts_Addressbook::findCard( $id ); +if( $card === false ){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!')))); + exit(); +} + +$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] ); +if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!')))); + exit(); +} + +$vcard = Sabre_VObject_Reader::read($card['carddata']); +$mimetype = $_FILES['photo']['type'] ? $_FILES['photo']['type'] : 'image/jpeg'; +$photobase = base64_encode(file_get_contents($_FILES['photo']['tmp_name'])); + +if(md5($vcard->children[$line]->serialize()) != $checksum){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Information about vCard is incorrect. Please reload page!')))); + exit(); +} + +// replace photo +$vcard->children[$line]->setValue($photobase); +$encoding = $type = false; +foreach($vcard->children[$line]->parameters as &$parameter){ + if($parameter->name == 'TYPE'){ + $parameter->value = $mimetype; + $type = true; + } + elseif($parameter->name == 'ENCODING'){ + $parameter->value = 'b'; + $encoding = true; + } +} unset($parameter); +if(!$encoding) $vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter('ENCODING','b'); +if(!$type) $vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter('TYPE',$mimetype); + +$checksum = md5($vcard->children[$line]->serialize()); + +OC_Contacts_Addressbook::editCard($id,$vcard->serialize()); +echo json_encode( array( 'status' => 'success', 'data' => array( 'id' => $id, 'line' => $line, 'checksum' => $checksum ))); diff --git a/apps/contacts/ajax/setproperty.php b/apps/contacts/ajax/setproperty.php new file mode 100644 index 00000000000..6f33c68631a --- /dev/null +++ b/apps/contacts/ajax/setproperty.php @@ -0,0 +1,93 @@ +<?php +/** + * ownCloud - Addressbook + * + * @author Jakob Sack + * @copyright 2011 Jakob Sack mail@jakobsack.de + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * 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 Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +// Init owncloud +require_once('../../../lib/base.php'); + +$id = $_POST['id']; +$line = $_POST['line']; +$checksum = $_POST['checksum']; +$l10n = new OC_L10N('contacts'); + +// Check if we are a user +if( !OC_User::isLoggedIn()){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!')))); + exit(); +} + +$card = OC_Contacts_Addressbook::findCard( $id ); +if( $card === false ){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!')))); + exit(); +} + +$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] ); +if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!')))); + exit(); +} + +$vcard = Sabre_VObject_Reader::read($card['carddata']); + +if(md5($vcard->children[$line]->serialize()) != $checksum){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Information about vCard is incorrect. Please reload page!')))); + exit(); +} + +// Set the value +$value = $_POST['value']; +if(is_array($value)){ + $value = OC_Contacts_Addressbook::escapeSemicolons($value); +} +$vcard->children[$line]->setValue($value); + +// Add parameters +$postparameters = isset($_POST['parameters'])?$_POST['parameters']:array(); +for($i=0;$i<count($vcard->children[$line]->parameters);$i++){ + $name = $vcard->children[$line]->parameters[$i]->name; + if(array_key_exists($name,$postparameters)){ + if($postparameters[$name] == '' || is_null($postparameters[$name])){ + unset($vcard->children[$line]->parameters[$i]); + } + else{ + $vcard->children[$line]->parameters[$i]->value = $postparameters[$name]; + } + unset($postparameters[$name]); + } +} +$missingparameters = array_keys($postparameters); +foreach($missingparameters as $i){ + if(!$postparameters[$i] == '' && !is_null($postparameters[$i])){ + $vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter($i,$postparameters[$i]); + } +} + +// Do checksum and be happy +$checksum = md5($vcard->children[$line]->serialize()); + +OC_Contacts_Addressbook::editCard($id,$vcard->serialize()); + +$tmpl = new OC_Template('contacts','part.property'); +$tmpl->assign('property',OC_Contacts_Addressbook::structureProperty($vcard->children[$line],$line)); +$page = $tmpl->fetchPage(); + +echo json_encode( array( 'status' => 'success', 'data' => array( 'page' => $page, 'line' => $line, 'oldchecksum' => $_POST['checksum'] ))); diff --git a/apps/contacts/ajax/showaddcard.php b/apps/contacts/ajax/showaddcard.php new file mode 100644 index 00000000000..41ebb41d3e9 --- /dev/null +++ b/apps/contacts/ajax/showaddcard.php @@ -0,0 +1,39 @@ +<?php +/** + * ownCloud - Addressbook + * + * @author Jakob Sack + * @copyright 2011 Jakob Sack mail@jakobsack.de + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * 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 Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +// Init owncloud +require_once('../../../lib/base.php'); + +$l10n = new OC_L10N('contacts'); + +// Check if we are a user +if( !OC_User::isLoggedIn()){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!')))); + exit(); +} + +$addressbooks = OC_Contacts_Addressbook::allAddressbooks(OC_USER::getUser()); +$tmpl = new OC_Template('contacts','part.addcardform'); +$tmpl->assign('addressbooks',$addressbooks); +$page = $tmpl->fetchPage(); + +echo json_encode( array( 'status' => 'success', 'data' => array( 'page' => $page ))); diff --git a/apps/contacts/ajax/showaddproperty.php b/apps/contacts/ajax/showaddproperty.php new file mode 100644 index 00000000000..becc39b120a --- /dev/null +++ b/apps/contacts/ajax/showaddproperty.php @@ -0,0 +1,51 @@ +<?php +/** + * ownCloud - Addressbook + * + * @author Jakob Sack + * @copyright 2011 Jakob Sack mail@jakobsack.de + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * 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 Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +// Init owncloud +require_once('../../../lib/base.php'); + +$id = $_GET['id']; +$l10n = new OC_L10N('contacts'); + +// Check if we are a user +if( !OC_User::isLoggedIn()){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!')))); + exit(); +} + +$card = OC_Contacts_Addressbook::findCard( $id ); +if( $card === false ){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!')))); + exit(); +} + +$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] ); +if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!')))); + exit(); +} + +$tmpl = new OC_Template('contacts','part.addpropertyform'); +$tmpl->assign('id',$id); +$page = $tmpl->fetchPage(); + +echo json_encode( array( 'status' => 'success', 'data' => array( 'page' => $page ))); diff --git a/apps/contacts/ajax/showsetproperty.php b/apps/contacts/ajax/showsetproperty.php new file mode 100644 index 00000000000..75c3ff88f5f --- /dev/null +++ b/apps/contacts/ajax/showsetproperty.php @@ -0,0 +1,62 @@ +<?php +/** + * ownCloud - Addressbook + * + * @author Jakob Sack + * @copyright 2011 Jakob Sack mail@jakobsack.de + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * 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 Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +// Init owncloud +require_once('../../../lib/base.php'); + +$id = $_GET['id']; +$line = $_GET['line']; +$checksum = $_GET['checksum']; +$l10n = new OC_L10N('contacts'); + +// Check if we are a user +if( !OC_User::isLoggedIn()){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!')))); + exit(); +} + +$card = OC_Contacts_Addressbook::findCard( $id ); +if( $card === false ){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!')))); + exit(); +} + +$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] ); +if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!')))); + exit(); +} + +$vcard = Sabre_VObject_Reader::read($card['carddata']); +if(md5($vcard->children[$line]->serialize()) != $checksum){ + echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Information about vCard is incorrect. Please reload page!')))); + exit(); +} + + +$tmpl = new OC_Template('contacts','part.setpropertyform'); +$tmpl->assign('id',$id); +$tmpl->assign('checksum',$checksum); +$tmpl->assign('property',OC_Contacts_Addressbook::structureProperty($vcard->children[$line],$line)); +$page = $tmpl->fetchPage(); + +echo json_encode( array( 'status' => 'success', 'data' => array( 'page' => $page ))); diff --git a/apps/contacts/carddav.php b/apps/contacts/carddav.php index ae2c5b97363..581bf4a717b 100644 --- a/apps/contacts/carddav.php +++ b/apps/contacts/carddav.php @@ -1,4 +1,24 @@ <?php +/** + * ownCloud - Addressbook + * + * @author Jakob Sack + * @copyright 2011 Jakob Sack mail@jakobsack.de + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * 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 Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ // Do not load FS ... $RUNTIME_NOSETUPFS = true; diff --git a/apps/contacts/css/styles.css b/apps/contacts/css/styles.css index 8d1c8b69c3f..c7680f4a716 100644 --- a/apps/contacts/css/styles.css +++ b/apps/contacts/css/styles.css @@ -1 +1 @@ - +.contacts_propertyname {float:left;} diff --git a/apps/contacts/index.php b/apps/contacts/index.php index 1e01b1c9fbd..0d4ff83ef81 100644 --- a/apps/contacts/index.php +++ b/apps/contacts/index.php @@ -37,6 +37,12 @@ if( !OC_User::isLoggedIn()){ $addressbooks = OC_Contacts_Addressbook::allAddressbooks(OC_User::getUser()); if( count($addressbooks) == 0){ OC_Contacts_Addressbook::addAddressbook(OC_User::getUser(),'default','Default Address Book'); + $addressbooks = OC_Contacts_Addressbook::allAddressbooks(OC_User::getUser()); +} +$prefbooks = OC_Preferences::getValue(OC_User::getUser(),'contacts','openaddressbooks',null); +if(is_null($prefbooks)){ + $prefbooks = $addressbooks[0]['id']; + OC_Preferences::setValue(OC_User::getUser(),'contacts','openaddressbooks',$prefbooks); } // Load the files we need @@ -48,7 +54,7 @@ $id = isset( $_GET['id'] ) ? $_GET['id'] : null; // sort addressbooks (use contactsort) usort($addressbooks,'contacts_namesort'); // Addressbooks to load -$openaddressbooks = explode(';',OC_Preferences::getValue(OC_User::getUser(),'contacts','openaddressbooks',null)); +$openaddressbooks = explode(';',$prefbooks); $contacts = array(); foreach( $openaddressbooks as $addressbook ){ @@ -63,7 +69,8 @@ usort($contacts,'contacts_namesort'); $details = array(); if( !is_null($id) || count($contacts)){ - $contact = OC_Contacts_Addressbook::findCard(is_null($id)?$contacts[0]['id']:$id); + if(is_null($id)) $id = $contacts[0]['id']; + $contact = OC_Contacts_Addressbook::findCard($id); $vcard = Sabre_VObject_Reader::read($contact['carddata']); $details = OC_Contacts_Addressbook::structureContact($vcard); } diff --git a/apps/contacts/js/interface.js b/apps/contacts/js/interface.js index 6af160b3927..0aae7d15d45 100644 --- a/apps/contacts/js/interface.js +++ b/apps/contacts/js/interface.js @@ -1,9 +1,15 @@ $(document).ready(function(){ - $('.contacts_contacts').find('li').live('click',function(){ + /* $('.contacts_addressbooksexpander').click(function(){ + $('.contacts_addressbooksdetails').toggle(); + return false; + });*/ + + $('#contacts_contacts li').live('click',function(){ var id = $(this).attr('x-id'); - $.getJSON('details.php',{'id':id},function(jsondata){ + $.getJSON('ajax/getdetails.php',{'id':id},function(jsondata){ if(jsondata.status == 'success'){ - $('.contacts_details').html(jsondata.data.page); + $('#contacts_details').attr('x-id',jsondata.data.id); + $('#contacts_details').html(jsondata.data.page); } else{ alert(jsondata.data.message); @@ -12,8 +18,140 @@ $(document).ready(function(){ return false; }); - $('.contacts_addressbooksexpander').click(function(){ - $('.contacts_addressbooksdetails').toggle(); + $('#contacts_deletecard').live('click',function(){ + var id = $('#contacts_details').attr('x-id'); + $.getJSON('ajax/deletecard.php',{'id':id},function(jsondata){ + if(jsondata.status == 'success'){ + $('#contacts_contacts [x-id="'+jsondata.data.id+'"]').remove(); + $('#contacts_details').attr('x-id',''); + $('#contacts_details').html(''); + } + else{ + alert(jsondata.data.message); + } + }); + return false; + }); + + $('#contacts_addproperty').live('click',function(){ + var id = $('#contacts_details').attr('x-id'); + $.getJSON('ajax/showaddproperty.php',{'id':id},function(jsondata){ + if(jsondata.status == 'success'){ + $('#contacts_details').append(jsondata.data.page); + } + else{ + alert(jsondata.data.message); + } + }); return false; }); + + $('#contacts_addpropertyform [name="name"]').live('change',function(){ + $('#contacts_addpropertyform #contacts_addresspart').remove(); + $('#contacts_addpropertyform #contacts_phonepart').remove(); + $('#contacts_addpropertyform #contacts_fieldpart').remove(); + $('#contacts_addpropertyform #contacts_generic').remove(); + if($(this).val() == 'ADR'){ + $('#contacts_addresspart').clone().insertBefore($('#contacts_addpropertyform input[type="submit"]')); + } + else if($(this).val() == 'TEL'){ + $('#contacts_phonepart').clone().insertBefore($('#contacts_addpropertyform input[type="submit"]')); + } + else if($(this).val() == 'NOTE'){ + $('#contacts_fieldpart').clone().insertBefore($('#contacts_addpropertyform input[type="submit"]')); + } + else{ + $('#contacts_generic').clone().insertBefore($('#contacts_addpropertyform input[type="submit"]')); + } + }); + + $('#contacts_addpropertyform input[type="submit"]').live('click',function(){ + $.post('ajax/addproperty.php',$('#contacts_addpropertyform').serialize(),function(jsondata){ + if(jsondata.status == 'success'){ + $('#contacts_details').append(jsondata.data.page); + $('#contacts_addpropertyform').remove(); + } + else{ + alert(jsondata.data.message); + } + }, 'json'); + return false; + }); + + $('#contacts_newcontact').click(function(){ + $.getJSON('ajax/showaddcard.php',{},function(jsondata){ + if(jsondata.status == 'success'){ + $('#contacts_details').attr('x-id',''); + $('#contacts_details').html(jsondata.data.page); + } + else{ + alert(jsondata.data.message); + } + }); + return false; + }); + + $('#contacts_addcardform input[type="submit"]').live('click',function(){ + $.post('ajax/addcard.php',$('#contacts_addcardform').serialize(),function(jsondata){ + if(jsondata.status == 'success'){ + $('#contacts_details').attr('x-id',jsondata.data.id); + $('#contacts_details').html(jsondata.data.page); + } + else{ + alert(jsondata.data.message); + } + }, 'json'); + return false; + }); + + $('.contacts_property [x-use="edit"]').live('click',function(){ + var id = $('#contacts_details').attr('x-id'); + var checksum = $(this).parent().parent().attr('x-checksum'); + var line = $(this).parent().parent().attr('x-line'); + $.getJSON('ajax/showsetproperty.php',{'id': id, 'checksum': checksum, 'line': line },function(jsondata){ + if(jsondata.status == 'success'){ + $('.contacts_property[x-line="'+line+'"][x-checksum="'+checksum+'"] .contacts_propertyvalue').html(jsondata.data.page); + } + else{ + alert(jsondata.data.message); + } + }); + return false; + }); + + $('#contacts_setpropertyform input[type="submit"]').live('click',function(){ + $.post('ajax/setproperty.php',$('#contacts_setpropertyform').serialize(),function(jsondata){ + if(jsondata.status == 'success'){ + $('.contacts_property[x-line="'+jsondata.data.line+'"][x-checksum="'+jsondata.data.oldchecksum+'"]').replaceWith(jsondata.data.page); + } + else{ + alert(jsondata.data.message); + } + },'json'); + return false; + }); + + $('.contacts_property [x-use="delete"]').live('click',function(){ + var id = $('#contacts_details').attr('x-id'); + var checksum = $(this).parent().parent().attr('x-checksum'); + var line = $(this).parent().parent().attr('x-line'); + $.getJSON('ajax/deleteproperty.php',{'id': id, 'checksum': checksum, 'line': line },function(jsondata){ + if(jsondata.status == 'success'){ + $('.contacts_property[x-line="'+line+'"][x-checksum="'+checksum+'"]').remove(); + } + else{ + alert(jsondata.data.message); + } + }); + return false; + }); + + + $('.contacts_property').live('mouseenter',function(){ + $(this).find('span').show(); + }); + + $('.contacts_property').live('mouseleave',function(){ + $(this).find('span').hide(); + }); }); diff --git a/apps/contacts/lib/addressbook.php b/apps/contacts/lib/addressbook.php index c0f26c7df55..cb7b0b4671a 100644 --- a/apps/contacts/lib/addressbook.php +++ b/apps/contacts/lib/addressbook.php @@ -78,7 +78,7 @@ class OC_Contacts_Addressbook{ $uris[] = $i['uri']; } - $uri = self::createURI('name', $uris ); + $uri = self::createURI($name, $uris ); $stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_addressbooks (userid,displayname,uri,description,ctag) VALUES(?,?,?,?,?)' ); $result = $stmt->execute(array($userid,$name,$uri,$description,1)); @@ -167,14 +167,14 @@ class OC_Contacts_Addressbook{ $uri = $property->value.'.vcf'; } } - $uri = self::createUID().'.vcf'; + if(is_null($uri)) $uri = self::createUID().'.vcf'; $stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' ); $result = $stmt->execute(array($id,$fn,$data,$uri,time())); - self::touch($id); + self::touchAddressbook($id); - return OC_DB::insertid; + return OC_DB::insertid(); } public static function addCardFromDAVData($id,$uri,$data){ @@ -189,13 +189,13 @@ class OC_Contacts_Addressbook{ $stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' ); $result = $stmt->execute(array($id,$fn,$data,$uri,time())); - self::touch($id); + self::touchAddressbook($id); - return OC_DB::insertid; + return OC_DB::insertid(); } public static function editCard($id, $data){ - $oldcard = self::findCard($id,$aid,$uri); + $oldcard = self::findCard($id); $fn = null; $card = Sabre_VObject_Reader::read($data); foreach($card->children as $property){ @@ -207,7 +207,7 @@ class OC_Contacts_Addressbook{ $stmt = OC_DB::prepare( 'UPDATE *PREFIX*contacts_cards SET fullname = ?,carddata = ?, lastmodified = ? WHERE id = ?' ); $result = $stmt->execute(array($fn,$data,time(),$id)); - self::touch($oldcard['addressbookid']); + self::touchAddressbook($oldcard['addressbookid']); return true; } @@ -226,20 +226,20 @@ class OC_Contacts_Addressbook{ $stmt = OC_DB::prepare( 'UPDATE *PREFIX*contacts_cards SET fullname = ?,carddata = ?, lastmodified = ? WHERE id = ?' ); $result = $stmt->execute(array($fn,$data,time(),$oldcard['id'])); - self::touch($oldcard['addressbookid']); + self::touchAddressbook($oldcard['addressbookid']); return true; } public static function deleteCard($id){ - $stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_addressbooks WHERE id = ?' ); + $stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE id = ?' ); $stmt->execute(array($id)); return true; } public static function deleteCardFromDAVData($aid,$uri){ - $stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_addressbooks WHERE addressbookid = ? AND uri=?' ); + $stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE addressbookid = ? AND uri=?' ); $stmt->execute(array($aid,$uri)); return true; @@ -265,23 +265,60 @@ class OC_Contacts_Addressbook{ return $userid; } + public static function escapeSemicolons($value){ + foreach($value as &$i ){ + $i = implode("\\\\;", explode(';', $i)); + } unset($i); + return implode(';',$value); + } + + public static function unescapeSemicolons($value){ + $array = explode(';',$value); + for($i=0;$i<count($array);$i++){ + if(substr($array[$i],-2,2)=="\\\\"){ + if(isset($array[$i+1])){ + $array[$i] = substr($array[$i],0,count($array[$i])-2).';'.$array[$i+1]; + unset($array[$i+1]); + } + else{ + $array[$i] = substr($array[$i],0,count($array[$i])-2).';'; + } + $i = $i - 1; + } + } + return $array; + } + public static function structureContact($object){ $details = array(); + $line = 0; foreach($object->children as $property){ - $temp = array( - 'name' => $property->name, - 'value' => ($property->name == 'PHOTO' || $property->name == 'LOGO' ? null : $property->value ), - 'parameters' => array()); - foreach($property->parameters as $parameter){ - $temp['parameters'][] = array( 'name' => $parameter->name, 'value' => $parameter->value); - } + $temp = self::structureProperty($property,$line); if(array_key_exists($property->name,$details)){ $details[$property->name][] = $temp; } else{ $details[$property->name] = array($temp); } + $line++; } return $details; } + + public static function structureProperty($property,$line=null){ + $value = $property->value; + if($property->name == 'ADR'){ + $value = self::unescapeSemicolons($value); + } + $temp = array( + 'name' => $property->name, + 'value' => $value, + 'line' => $line, + 'parameters' => array(), + 'checksum' => md5($property->serialize())); + foreach($property->parameters as $parameter){ + $temp['parameters'][$parameter->name] = $parameter->value; + } + return $temp; + } } diff --git a/apps/contacts/lib/connector_sabre.php b/apps/contacts/lib/connector_sabre.php index 98e2598b3a7..96a90dfc5de 100644 --- a/apps/contacts/lib/connector_sabre.php +++ b/apps/contacts/lib/connector_sabre.php @@ -1,13 +1,23 @@ <?php - /** - * PDO CardDAV backend - * - * @package Sabre - * @subpackage CardDAV - * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved. - * @author Evert Pot (http://www.rooftopsolutions.nl/) - * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License + * ownCloud - Addressbook + * + * @author Jakob Sack + * @copyright 2011 Jakob Sack mail@jakobsack.de + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * 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 Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * */ /** diff --git a/apps/contacts/templates/_details.php b/apps/contacts/templates/_details.php deleted file mode 100644 index e27b17ef2eb..00000000000 --- a/apps/contacts/templates/_details.php +++ /dev/null @@ -1,4 +0,0 @@ -Name <?php echo $_['details']['FN'][0]['value']; ?> -<?php if(array_key_exists('PHOTO',$_['details'])): ?> - <img src="photo.php?id=<?php echo $_['id']; ?>"> -<?php endif; ?>
\ No newline at end of file diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php index ca189cb4c8a..e6dd45739bc 100644 --- a/apps/contacts/templates/index.php +++ b/apps/contacts/templates/index.php @@ -3,7 +3,8 @@ OC_Util::addScript('contacts','interface'); OC_Util::addStyle('contacts','styles'); ?> -<div class="contacts_addressbooks"> +<?php +/*<div class="contacts_addressbooks"> <div class="contacts_addressbooksexpander"> Addressbooks </div> @@ -13,12 +14,14 @@ OC_Util::addStyle('contacts','styles'); <?php endforeach; ?> <br>To use this addressbook, use .../apps/contacts/carddav.php/addressbooks/USERNAME/addressbookname.php </div> -</div> -<div class="contacts_contacts leftcontent"> +</div>*/ +?> +<div id="contacts_contacts" class="leftcontent"> <ul> - <?php echo $this->inc("_contacts"); ?> + <?php echo $this->inc("part.contacts"); ?> </ul> + <a id="contacts_newcontact"><?php echo $l->t('Add Contact'); ?></a> </div> -<div class="contacts_details rightcontent"> - <?php echo $this->inc("_details"); ?> +<div id="contacts_details" class="rightcontent" x-id="<?php echo $_['id']; ?>"> + <?php echo $this->inc("part.details"); ?> </div> diff --git a/apps/contacts/templates/part.addcardform.php b/apps/contacts/templates/part.addcardform.php new file mode 100644 index 00000000000..94a59fe097c --- /dev/null +++ b/apps/contacts/templates/part.addcardform.php @@ -0,0 +1,13 @@ +<form id="contacts_addcardform"> + <?php if(count($_['addressbooks'])==1): ?> + <input type="hidden" name="id" value="<?php echo $_['addressbooks'][0]['id']; ?>"> + <?php else: ?> + <select name="id" size="1"> + <?php foreach($_['addressbooks'] as $addressbook): ?> + <option value="<?php echo $addressbook['id']; ?>"><?php echo $addressbook['displayname']; ?></option> + <?php endforeach; ?> + </select> + <?php endif; ?> + <input type="text" name="fn" value=""><br> + <input type="submit"> +</form> diff --git a/apps/contacts/templates/part.addpropertyform.php b/apps/contacts/templates/part.addpropertyform.php new file mode 100644 index 00000000000..ff9090b76d8 --- /dev/null +++ b/apps/contacts/templates/part.addpropertyform.php @@ -0,0 +1,43 @@ +<form id="contacts_addpropertyform"> + <input type="hidden" name="id" value="<?php echo $_['id']; ?>"> + <select name="name" size="1"> + <option value="BDAY"><?php echo $l->t('Birthday'); ?></option> + <option value="ADR"><?php echo $l->t('Address'); ?></option> + <option value="TEL"><?php echo $l->t('Telephone'); ?></option> + <option value="EMAIL" selected="selected"><?php echo $l->t('Email'); ?></option> + <option value="ORG"><?php echo $l->t('Organization'); ?></option> + </select> + <div id="contacts_generic"> + <input type="text" name="value" value=""> + </div> + <input type="submit"> +</form> +<div id="contacts_addcontactsparts" style="display:none;"> + <div id="contacts_addresspart"> + <select name="parameters[TYPE]" size="1"> + <option value="WORK"><?php echo $l->t('Work'); ?></option> + <option value="HOME" selected="selected"><?php echo $l->t('Home'); ?></option> + </select> + <?php echo $l->t('PO Box'); ?> <input type="text" name="value[0]" value=""> + <?php echo $l->t('Extended Address'); ?> <input type="text" name="value[1]" value=""> + <?php echo $l->t('Street Name'); ?> <input type="text" name="value[2]" value=""> + <?php echo $l->t('City'); ?> <input type="text" name="value[3]" value=""> + <?php echo $l->t('Region'); ?> <input type="text" name="value[4]" value=""> + <?php echo $l->t('Postal Code'); ?> <input type="text" name="value[5]" value=""> + <?php echo $l->t('Country'); ?> <input type="text" name="value[6]" value=""> + </div> + <div id="contacts_phonepart"> + <select name="parameters[TYPE]" size="1"> + <option value="WORK"><?php echo $l->t('Work'); ?></option> + <option value="CELL" selected="selected"><?php echo $l->t('Mobile'); ?></option> + <option value="HOME"><?php echo $l->t('Home'); ?></option> + </select> + <input type="text" name="value" value=""> + </div> + <div id="contacts_fieldpart"> + <textarea type="text" name="value"></textarea> + </div> + <div id="contacts_generic"> + <input type="text" name="value" value=""> + </div> +</div> diff --git a/apps/contacts/templates/_contacts.php b/apps/contacts/templates/part.contacts.php index bf633b79b04..fa6d4790cfc 100644 --- a/apps/contacts/templates/_contacts.php +++ b/apps/contacts/templates/part.contacts.php @@ -1,3 +1,3 @@ <?php foreach( $_['contacts'] as $contact ): ?> - <li x-id="<?php echo $contact['id']; ?>"><a href="index.php?id=<?php echo $contact['id']; ?>"><?php echo $contact['name']; ?></a></li> + <li x-id="<?php echo $contact['id']; ?>"><a href="index.php?id=<?php echo $contact['id']; ?>"><?php echo $contact['name']; ?></a> </li> <?php endforeach; ?> diff --git a/apps/contacts/templates/part.details.php b/apps/contacts/templates/part.details.php new file mode 100644 index 00000000000..4aca8dbc790 --- /dev/null +++ b/apps/contacts/templates/part.details.php @@ -0,0 +1,22 @@ +<?php if(array_key_exists('PHOTO',$_['details'])): ?> + <img src="photo.php?id=<?php echo $_['id']; ?>"> +<?php endif; ?> +<?php echo $this->inc('part.property', array('property' => $_['details']['FN'][0])); ?> +<?php if(isset($_['details']['BDAY'])): // Emails first ?> + <?php echo $this->inc('part.property', array('property' => $_['details']['BDAY'][0])); ?> +<?php endif; ?> +<?php if(isset($_['details']['ORG'])): // Emails first ?> + <?php echo $this->inc('part.property', array('property' => $_['details']['ORG'][0])); ?> +<?php endif; ?> + +<?php foreach(array('EMAIL','TEL','ADR') as $type): ?> + <?php if(isset($_['details'][$type])): // Emails first ?> + <br> + <?php foreach($_['details'][$type] as $property): ?> + <?php echo $this->inc('part.property',array('property' => $property )); ?> + <?php endforeach; ?> + <?php endif; ?> +<?php endforeach; ?> + +<a id="contacts_deletecard"><img src="../../core/img/actions/delete.png"></a> +<a id="contacts_addproperty"><img src="../../core/img/actions/download.png"></a> diff --git a/apps/contacts/templates/part.property.php b/apps/contacts/templates/part.property.php new file mode 100644 index 00000000000..1a4266b3a2b --- /dev/null +++ b/apps/contacts/templates/part.property.php @@ -0,0 +1,50 @@ +<div class="contacts_property" x-line="<?php echo $_['property']['line']; ?>" x-checksum="<?php echo $_['property']['checksum']; ?>"> + <?php if($_['property']['name'] == 'FN'): ?> + <div class="contacts_propertyname"><?php echo $l->t('Name'); ?></div> + <div class="contacts_propertyvalue"> + <span style="display:none;" x-use="edit"><img src="../../core/img/actions/rename.png"></span> + <?php echo $_['property']['value']; ?> + </div> + <?php elseif($_['property']['name'] == 'BDAY'): ?> + <div class="contacts_propertyname"><?php echo $l->t('Birthday'); ?></div> + <div class="contacts_propertyvalue"> + <?php echo $l->l('date',new DateTime($_['property']['value'])); ?> + <span style="display:none;" x-use="edit"><img src="../../core/img/actions/rename.png"></span> + <span style="display:none;" x-use="delete"><img src="../../core/img/actions/delete.png"></span> + </div> + <?php elseif($_['property']['name'] == 'ORG'): ?> + <div class="contacts_propertyname"><?php echo $l->t('Organisation'); ?></div> + <div class="contacts_propertyvalue"> + <?php echo $_['property']['value']; ?> + <span style="display:none;" x-use="edit"><img src="../../core/img/actions/rename.png"></span> + <span style="display:none;" x-use="delete"><img src="../../core/img/actions/delete.png"></span> + </div> + <?php elseif($_['property']['name'] == 'EMAIL'): ?> + <div class="contacts_propertyname"><?php echo $l->t('Email'); ?></div> + <div class="contacts_propertyvalue"> + <?php echo $_['property']['value']; ?> + <span style="display:none;" x-use="edit"><img src="../../core/img/actions/rename.png"></span> + <span style="display:none;" x-use="delete"><img src="../../core/img/actions/delete.png"></span> + </div> + <?php elseif($_['property']['name'] == 'TEL'): ?> + <div class="contacts_propertyname"><?php echo $l->t('Telefon'); ?></div> + <div class="contacts_propertyvalue"> + <?php echo $_['property']['value']; ?> + <span style="display:none;" x-use="edit"><img src="../../core/img/actions/rename.png"></span> + <span style="display:none;" x-use="delete"><img src="../../core/img/actions/delete.png"></span> + </div> + <?php elseif($_['property']['name'] == 'ADR'): ?> + <div class="contacts_propertyname"><?php echo $l->t('Address'); ?></div> + <div class="contacts_propertyvalue"> + <?php echo $l->t('PO Box'); ?> <?php echo $_['property']['value'][0]; ?><br> + <?php echo $l->t('Extended Address'); ?> <?php echo $_['property']['value'][1]; ?><br> + <?php echo $l->t('Street Name'); ?> <?php echo $_['property']['value'][2]; ?><br> + <?php echo $l->t('City'); ?> <?php echo $_['property']['value'][3]; ?><br> + <?php echo $l->t('Region'); ?> <?php echo $_['property']['value'][4]; ?><br> + <?php echo $l->t('Postal Code'); ?> <?php echo $_['property']['value'][5]; ?><br> + <?php echo $l->t('Country'); ?> <?php echo $_['property']['value'][6]; ?> + <span style="display:none;" x-use="edit"><img src="../../core/img/actions/rename.png"></span> + <span style="display:none;" x-use="delete"><img src="../../core/img/actions/delete.png"></span> + </div> + <?php endif; ?> +</div> diff --git a/apps/contacts/templates/part.setpropertyform.php b/apps/contacts/templates/part.setpropertyform.php new file mode 100644 index 00000000000..cd774ee6593 --- /dev/null +++ b/apps/contacts/templates/part.setpropertyform.php @@ -0,0 +1,21 @@ +<form id="contacts_setpropertyform"> + <input type="hidden" name="checksum" value="<?php echo $_['property']['checksum']; ?>"> + <input type="hidden" name="line" value="<?php echo $_['property']['line']; ?>"> + <input type="hidden" name="id" value="<?php echo $_['id']; ?>"> + <?php if($_['property']['name']=='ADR'): ?> + <?php echo $l->t('PO Box'); ?> <input type="text" name="value[0]" value="<?php echo $_['property']['value'][0]; ?>"> + <?php echo $l->t('Extended Address'); ?> <input type="text" name="value[1]" value="<?php echo $_['property']['value'][1]; ?>"> + <?php echo $l->t('Street Name'); ?> <input type="text" name="value[2]" value="<?php echo $_['property']['value'][2]; ?>"> + <?php echo $l->t('City'); ?> <input type="text" name="value[3]" value="<?php echo $_['property']['value'][3]; ?>"> + <?php echo $l->t('Region'); ?> <input type="text" name="value[4]" value="<?php echo $_['property']['value'][4]; ?>"> + <?php echo $l->t('Postal Code'); ?> <input type="text" name="value[5]" value="<?php echo $_['property']['value'][5]; ?>"> + <?php echo $l->t('Country'); ?> <input type="text" name="value[6]" value="<?php echo $_['property']['value'][6]; ?>"> + <?php elseif($_['property']['name']=='TEL'): ?> + <input type="text" name="value" value="<?php echo $_['property']['value']; ?>"> + <?php elseif($_['property']['name']=='NOTE'): ?> + <textarea type="text" name="value"><?php echo $_['property']['value']; ?></textarea> + <?php else: ?> + <input type="text" name="value" value="<?php echo $_['property']['value']; ?>"> + <?php endif; ?> + <input type="submit"> +</form> diff --git a/apps/contacts/temporaryupdate.php b/apps/contacts/temporaryupdate.php index bb5ff7604f3..4b6453364e3 100644 --- a/apps/contacts/temporaryupdate.php +++ b/apps/contacts/temporaryupdate.php @@ -1,4 +1,24 @@ <?php +/** + * ownCloud - Addressbook + * + * @author Jakob Sack + * @copyright 2011 Jakob Sack mail@jakobsack.de + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * 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 Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ // Init owncloud require_once('../../lib/base.php'); $connector = new OC_Connector_Sabre_Principal; diff --git a/apps/files_publiclink/appinfo/app.php b/apps/files_publiclink/appinfo/app.php index 17646b3e5b5..e2d8d27c007 100644 --- a/apps/files_publiclink/appinfo/app.php +++ b/apps/files_publiclink/appinfo/app.php @@ -1,6 +1,6 @@ <?php -OC_App::addNavigationSubEntry('files_index', array( "id" => "files_publiclink_administration", "order" => 1, "href" => OC_Helper::linkTo( "files_publiclink", "admin.php" ), "name" => "Public Links")); +OC_App::addNavigationEntry(array( "id" => "files_publiclink_administration", "order" => 2, "href" => OC_Helper::linkTo( "files_publiclink", "admin.php" ), "name" => "Public Links")); ?> diff --git a/apps/media/appinfo/app.php b/apps/media/appinfo/app.php index 4cdb36d4504..bc80536a969 100644 --- a/apps/media/appinfo/app.php +++ b/apps/media/appinfo/app.php @@ -27,34 +27,4 @@ OC_Util::addScript('media','loader'); OC_App::register( array( 'order' => 3, 'id' => 'media', 'name' => 'Media' )); OC_App::addNavigationEntry( array( 'id' => 'media_index', 'order' => 2, 'href' => OC_Helper::linkTo( 'media', 'index.php' ), 'icon' => OC_Helper::imagePath( 'media', 'media.png' ), 'name' => 'Music' )); - -// add subnavigations -$entry = array( - 'id' => "media_playlist", - 'order'=>1, - 'href' => '#playlist', - 'name' => 'Playlist' -); -OC_App::addNavigationSubEntry( "media_index", $entry); -$entry = array( - 'id' => "media_collection", - 'order'=>1, - 'href' => '#collection', - 'name' => 'Collection' -); -OC_App::addNavigationSubEntry( "media_index", $entry); -// $entry = array( -// 'id' => "media_recent", -// 'order'=>1, -// 'href' => '#recent', -// 'name' => 'Most Recent' -// ); -// OC_App::addNavigationSubEntry( "media_index", $entry); -// $entry = array( -// 'id' => "media_mostplayer", -// 'order'=>1, -// 'href' => '#mostplayed', -// 'name' => 'Most Played' -// ); -// OC_App::addNavigationSubEntry( "media_index", $entry); ?> diff --git a/apps/media/css/music.css b/apps/media/css/music.css index 3637234ab13..dd9b8ea70d9 100644 --- a/apps/media/css/music.css +++ b/apps/media/css/music.css @@ -3,7 +3,7 @@ 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{width:100%;border-spacing:0;} +#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;} @@ -12,7 +12,8 @@ li button.right.prettybutton{font-size:1em;} #collection li,#playlist li{list-style-type:none;} .template{display:none} -#collection{display:none}/*hide the collection initially*/ #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} diff --git a/apps/media/css/player.css b/apps/media/css/player.css index 94dd4d63605..6cf424a8ea1 100644 --- a/apps/media/css/player.css +++ b/apps/media/css/player.css @@ -1,29 +1,25 @@ -#jp-interface{position:fixed;z-index:100;width:25em;left:201px;top:-20px;height:60px;border-bottom:none;} -#jp-interface div.player{height:0px} -#jp-interface ul.jp-controls{list-style-type:none;padding:0;} -#jp-interface ul.jp-controls li{display:inline;} -#jp-interface ul.jp-controls a{position:absolute;overflow:hidden;text-indent:-9999px;} -a.jp-play,a.jp-pause{width:40px;height:40px;z-index:1;top:20px;left:48px;} +#controls ul.jp-controls{list-style-type:none;padding:0;} +#controls ul.jp-controls li{display:inline;} +#controls ul.jp-controls a{position:absolute;overflow:hidden;text-indent:-9999px;} +a.jp-play,a.jp-pause{width:40px;height:40px;z-index:1;top:0;left:48px;} a.jp-play{background:url("../img/jplayer.blue.monday.png") 0 0 no-repeat;} a.jp-play:hover{background:url("../img/jplayer.blue.monday.png") -41px 0 no-repeat;} a.jp-pause{background:url("../img/jplayer.blue.monday.png") 0 -42px no-repeat;display:none;} a.jp-pause:hover{background:url("../img/jplayer.blue.monday.png") -41px -42px no-repeat;} -a.jp-stop{top:26px;left:126px;background:url("../img/jplayer.blue.monday.png") 0 -83px no-repeat;width:28px;height:28px;z-index:1;} -a.jp-stop:hover{background:url("../img/jplayer.blue.monday.png") -29px -83px no-repeat;} -a.jp-previous{left:20px;top:26px;background:url("../img/jplayer.blue.monday.png") 0 -112px no-repeat;width:28px;height:28px;} +a.jp-previous{left:20px;top:.5em;background:url("../img/jplayer.blue.monday.png") 0 -112px no-repeat;width:28px;height:28px;} a.jp-previous:hover{background:url("../img/jplayer.blue.monday.png") -29px -112px no-repeat;} -a.jp-next{left:88px;top:26px;background:url("../img/jplayer.blue.monday.png") 0 -141px no-repeat;width:28px;height:28px;} +a.jp-next{left:88px;top:.5em;background:url("../img/jplayer.blue.monday.png") 0 -141px no-repeat;width:28px;height:28px;} a.jp-next:hover{background:url("../img/jplayer.blue.monday.png") -29px -141px no-repeat;} -div.jp-progress{position:absolute;overflow:hidden;background-color:#293b51;top:32px;left:164px;width:122px;height:15px;} +div.jp-progress{position:absolute;overflow:hidden;background-color:#293b51;top:1em;left:164px;width:122px;height:15px;} div.jp-seek-bar{background:url("../img/jplayer.blue.monday.png") 0 -202px repeat-x;width:0;height:100%;cursor:pointer;} div.jp-play-bar{background:url("../img/jplayer.blue.monday.png") 0 -218px repeat-x;width:0;height:100%;} div.jp-seeking-bg{background:url("../img/pbar-ani.gif");} -a.jp-mute,a.jp-unmute{height:15px;width:18px;top:32px;left:296px;} +a.jp-mute,a.jp-unmute{height:15px;width:18px;top:1em;left:296px;} a.jp-mute{background:url("../img/jplayer.blue.monday.png") 0 -186px no-repeat;} a.jp-mute:hover{background:url("../img/jplayer.blue.monday.png") -19px -170px no-repeat;} a.jp-unmute{background:url("../img/jplayer.blue.monday.png") 0 -170px no-repeat;display:none;} a.jp-unmute:hover{background:url("../img/jplayer.blue.monday.png") -19px -186px no-repeat;} -div.jp-volume-bar{position:absolute;overflow:hidden;background:url("../img/jplayer.blue.monday.png") 0 -250px repeat-x;width:46px;height:5px;cursor:pointer;top:37px;left:324px;} +div.jp-volume-bar{position:absolute;overflow:hidden;background:url("../img/jplayer.blue.monday.png") 0 -250px repeat-x;width:46px;height:5px;cursor:pointer;top:1.3em;left:324px;} div.jp-volume-bar-value{background:url("../img/jplayer.blue.monday.png") 0 -256px repeat-x;width:0;height:5px;} -div.jp-current-time,div.jp-duration{position:absolute;font-size:.64em;font-style:oblique;top:45px;left:164px;width:122px;} +div.jp-current-time,div.jp-duration{position:absolute;font-size:.64em;font-style:oblique;top:1em;left:164px;width:122px;} div.jp-duration{text-align:right;} diff --git a/apps/media/index.php b/apps/media/index.php index a7128aaad42..fe724b45ddf 100644 --- a/apps/media/index.php +++ b/apps/media/index.php @@ -42,17 +42,9 @@ OC_Util::addScript('media','jquery.jplayer.min'); OC_Util::addStyle('media','player'); OC_Util::addStyle('media','music'); -OC_App::setActiveNavigationEntry( 'media_playlist' ); +OC_App::setActiveNavigationEntry( 'media_index' ); $tmpl = new OC_Template( 'media', 'music', 'user' ); - -$player = new OC_Template( 'media', 'player'); -$playlist = new OC_Template( 'media', 'playlist'); -$collection= new OC_Template( 'media', 'collection'); - -$tmpl->assign('player',$player->fetchPage()); -$tmpl->assign('playlist',$playlist->fetchPage()); -$tmpl->assign('collection',$collection->fetchPage()); $tmpl->printPage(); ?> diff --git a/apps/media/js/collection.js b/apps/media/js/collection.js index 520ce7d1129..df7b79e332d 100644 --- a/apps/media/js/collection.js +++ b/apps/media/js/collection.js @@ -49,68 +49,106 @@ Collection={ Collection.load(Collection.display) }else{ if(Collection.parent){ - Collection.parent.children('li.artist').remove(); - var template=Collection.parent.children('li.template'); - for(var i=0;i<Collection.artists.length;i++){ - var artist=Collection.artists[i]; - var li=template.clone(); - li.data('artist',artist); - li.removeClass('template'); - li.addClass('artist'); - li.data('type','artist'); - li.children('span').text(artist.artist_name); - Collection.addButtons(li); - Collection.parent.append(li); - } + Collection.parent.find('tr:not(.template)').remove(); + var template=Collection.parent.find('tr.template'); + var lastArtist=''; + var lastAlbum=''; + $.each(Collection.artists,function(index,artist){ + $.each(artist.albums,function(index,album){ + $.each(album.songs,function(index,song){ + var tr=template.clone().removeClass('template'); + tr.find('td.title a').text(song.song_name); + tr.find('td.title a').click(function(event){ + event.preventDefault(); + PlayList.add(song); + PlayList.render(); + }); + if(artist.artist_name!=lastArtist){ + tr.find('td.artist a').click(function(event){ + event.preventDefault(); + PlayList.add(artist); + PlayList.render(); + }); + tr.find('td.artist a').text(artist.artist_name); + if(artist.albums.length>1){ + var expander=$('<a class="expander">></a>'); + expander.data('expanded',true); + expander.click(function(event){ + var tr=$(this).parent().parent(); + if(expander.data('expanded')){ + Collection.hideArtist(tr.data('artist')); + }else{ + Collection.showArtist(tr.data('artist')); + } + }); + tr.children('td.artist').append(expander); + } + } + if(album.album_name!=lastAlbum){ + tr.find('td.album a').click(function(event){ + event.preventDefault(); + PlayList.add(album); + PlayList.render(); + }); + tr.find('td.album a').text(album.album_name); + if(album.songs.length>1){ + var expander=$('<a class="expander">></a>'); + expander.data('expanded',true); + expander.click(function(event){ + var tr=$(this).parent().parent(); + if(expander.data('expanded')){ + Collection.hideAlbum(tr.data('album')); + }else{ + Collection.showAlbum(tr.data('album')); + } + }); + tr.children('td.album').append(expander); + } + } + tr.attr('data-artist',artist.artist_name); + tr.attr('data-album',album.album_name); + lastArtist=artist.artist_name; + lastAlbum=album.album_name; + + Collection.parent.find('tbody').append(tr); + }); + Collection.hideAlbum(artist.artist_name,album.album_name); + }); + Collection.hideArtist(artist.artist_name); + }); } } }, + showArtist:function(artist){ + Collection.parent.find('tr[data-artist="'+artist+'"]').show(); + Collection.parent.find('tr[data-artist="'+artist+'"]').first().removeClass('collapsed'); + Collection.parent.find('tr[data-artist="'+artist+'"] a.expander').data('expanded',true); + Collection.parent.find('tr[data-artist="'+artist+'"] a.expander').addClass('expanded'); + Collection.parent.find('tr[data-artist="'+artist+'"] a.expander').text('v'); + }, + hideArtist:function(artist){ + if(Collection.parent.find('tr[data-artist="'+artist+'"]').length>1){ + Collection.parent.find('tr[data-artist="'+artist+'"]').hide(); + Collection.parent.find('tr[data-artist="'+artist+'"]').first().show(); + Collection.parent.find('tr[data-artist="'+artist+'"]').first().addClass('collapsed'); + Collection.parent.find('tr[data-artist="'+artist+'"] a.expander').data('expanded',false); + Collection.parent.find('tr[data-artist="'+artist+'"] a.expander').removeClass('expanded'); + Collection.parent.find('tr[data-artist="'+artist+'"] a.expander').text('>'); + } + }, + showAlbum:function(artist,album){ + Collection.parent.find('tr[data-artist="'+artist+'"][data-album="'+album+'"]').show(); + }, + hideAlbum:function(artist,album){ + Collection.parent.find('tr[data-artist="'+artist+'"][data-album="'+album+'"]').hide(); + Collection.parent.find('tr[data-artist="'+artist+'"][data-album="'+album+'"]').last().show(); + }, parent:null, hide:function(){ if(Collection.parent){ Collection.parent.hide(); } }, - showAlbums:function(artistLi){ - $('ul.albums').parent().removeClass('active'); - $('ul.albums').remove(); - var artist=artistLi.data('artist'); - if(artist){ - var template=Collection.parent.children('li.template'); - var ul=$('<ul class="albums"></ul>'); - for(var i=0;i<artist.albums.length;i++){ - var li=template.clone(); - var album=artist.albums[i]; - li.removeClass('template'); - li.addClass('album'); - li.data('album',album); - li.data('type','album'); - li.children('span').text(album.album_name); - Collection.addButtons(li); - ul.append(li); - } - artistLi.append(ul); - } - }, - showSongs:function(albumLi){ - $('ul.songs').parent().removeClass('active'); - $('ul.songs').remove(); - var album=albumLi.data('album'); - var template=Collection.parent.children('li.template'); - var ul=$('<ul class="songs"></ul>'); - for(var i=0;i<album.songs.length;i++){ - var li=template.clone(); - var song=album.songs[i]; - li.removeClass('template'); - li.addClass('song'); - li.data('song',song); - li.data('type','song'); - li.children('span').text(song.song_name); - Collection.addButtons(li); - ul.append(li); - } - albumLi.append(ul); - }, registerPlay:function(){ var item=PlayList.items[PlayList.current]; var song=Collection.findSong(item.artist,item.album,item.name); @@ -198,14 +236,6 @@ Collection={ $(document).ready(function(){ Collection.parent=$('#collection'); Collection.load(); - $('#collection li.artist>span').live('click',function(){ - $(this).parent().toggleClass('active'); - Collection.showAlbums($(this).parent()); - }); - $('#collection li.album>span').live('click',function(){ - $(this).parent().toggleClass('active'); - Collection.showSongs($(this).parent()); - }); Collection.parent.hide(); $('#scan input.start').click(function(){ $('#scan input.start').hide(); diff --git a/apps/media/js/music.js b/apps/media/js/music.js index 4e11b2951be..7034824cad8 100644 --- a/apps/media/js/music.js +++ b/apps/media/js/music.js @@ -1,23 +1,4 @@ $(document).ready(function(){ - //load the collection - $('#navigation a[href="#collection"]').click(function(){ - $('#navigation li.subentry a.active').removeClass('active'); - $(this).addClass('active'); - PlayList.hide(); - Collection.display(); - }); - $('#navigation a[href="#playlist"]').click(function(){ - $('#navigation li.subentry a.active').removeClass('active'); - $(this).addClass('active'); - PlayList.render(); - Collection.hide(); - }); - var tab=window.location.href.slice(window.location.href.indexOf('#') + 1); - PlayList.init('mp3',function(){ - if(tab=='collection'){ - $('#navigation a[href="#collection"]').trigger('click'); - } - }); OC.search.customResults.Music=function(row,item){ var parts=item.link.substr(item.link.indexOf('#')+1).split('&'); var data={}; @@ -43,6 +24,7 @@ $(document).ready(function(){ }); row.find('div.name').append(button); } + Collection.display(); }); diff --git a/apps/media/js/playlist.js b/apps/media/js/playlist.js index a15c34f93f9..636ae29c555 100644 --- a/apps/media/js/playlist.js +++ b/apps/media/js/playlist.js @@ -10,19 +10,9 @@ PlayList.render=function(){ tr.removeClass('template'); tr.data('name',item.name); tr.data('artist',item.artist); - tr.data('album',item.album); - tr.data('time',item.length); - tr.data('plays',item.playcount); tr.children('td.name').children('span').text(item.name); tr.children('td.artist').text(item.artist); tr.children('td.album').text(item.album); - var secconds=(item.length%60); - if(secconds<10){ - secconds='0'+secconds; - } - var length=Math.floor(item.length/60)+':'+secconds; - tr.children('td.time').text(length); - tr.children('td.plays').text(item.playcount); tr.data('index',i); tr.click(function(){ PlayList.play($(this).data('index')); diff --git a/apps/media/js/settings.js b/apps/media/js/settings.js deleted file mode 100644 index 3dabd86a497..00000000000 --- a/apps/media/js/settings.js +++ /dev/null @@ -1,65 +0,0 @@ -$(document).ready(function() { - $("button.scan").click(function(event){ - event.preventDefault(); - var parent=$(this).parent().parent(); - var path=parent.children('input').val(); - scan(path); - }); - $("button.rescan").live('click', function(event) { - event.preventDefault(); - var parent=$(this).parent().parent(); - var path=parent.contents().filter(function(){ return(this.nodeType == 3); }).text(); - path=path.trim(); - scan(path); - }); - $("button.delete").live('click', function(event) { - event.preventDefault(); - var parent=$(this).parent().parent(); - var path=parent.contents().filter(function(){ return(this.nodeType == 3); }).text(); - path=path.trim(); - var data="action=delete&path="+path; - $.ajax({ - type: 'POST', - url: 'ajax/api.php', - cache: false, - data: data, - success: function(){ - parent.remove(); - } - }); - }); - $( "#scanpath" ).autocomplete({ - source: "../../files/ajax/autocomplete.php?dironly=true", - minLength: 1 - }); - $('#autoupdate').change(function(){ - $.ajax({ - url: 'ajax/autoupdate.php', - data: "autoupdate="+$(this).attr('checked') - }); - }) -}); - -function scan(path){ - var data="action=scan&path="+path; - $.ajax({ - type: 'POST', - url: 'ajax/api.php', - cache: false, - data: data, - success: function(songCount){ - var found=false; - $('#folderlist').children('li').each(function(){ - var otherPath=$(this).contents().filter(function(){ return(this.nodeType == 3); }).text(); - otherPath=otherPath.trim(); - if(otherPath==path){ - found=true; - $(this).children("span").html(songCount+" songs <button class='rescan prettybutton'>Rescan</button></span>"); - } - }) - if(!found){ - $('#folderlist').children().last().before("<li>"+path+"<span class='right'>"+songCount+" songs <button class='rescan prettybutton'>Rescan</button></span></li>"); - } - } - }); -} diff --git a/apps/media/templates/collection.php b/apps/media/templates/collection.php deleted file mode 100644 index f47cba24868..00000000000 --- a/apps/media/templates/collection.php +++ /dev/null @@ -1,17 +0,0 @@ -<div id='scan'> - <p id='scancount' style='display:none'><span class='songCount'>0</span> Songs scanned</p> - <div id="scanprogressbar"></div> - <input type='button' class='start' value='Recan Collection'></input> - <input type='button' class='stop' style='display:none' value='Pause'></input> -</div> -<ul id='collection'> - <li class='artist'> - <img src="<?php echo image_path('files','loading.gif') ?>" alt='loading'/>Loading Collection... - </li> - <li class='template'> - <span></span> - <button class='add'>Add</button> - <button class='play'>Play</button> - </li> -</ul> - diff --git a/apps/media/templates/music.php b/apps/media/templates/music.php index 7a61d59c9ba..5d0b0b6f0c4 100644 --- a/apps/media/templates/music.php +++ b/apps/media/templates/music.php @@ -1,3 +1,71 @@ -<?php echo $_['player'];?> -<?php echo $_['collection'];?> -<?php echo $_['playlist'];?> +<div id="controls"> + <ul class="jp-controls"> + <li><a href="#" class="jp-play" tabindex="1">play</a></li> + <li><a href="#" class="jp-pause" tabindex="1">pause</a></li> + <li><a href="#" class="jp-mute" tabindex="1">mute</a></li> + <li><a href="#" class="jp-unmute" tabindex="1">unmute</a></li> + <li><a href="#" class="jp-previous" tabindex="1">previous</a></li> + <li><a href="#" class="jp-next" tabindex="1">next</a></li> + </ul> + <div class="jp-progress"> + <div class="jp-seek-bar"> + <div class="jp-play-bar"></div> + </div> + </div> + <div class="jp-volume-bar"> + <div class="jp-volume-bar-value"></div> + </div> + <div class="jp-current-time"></div> + <div class="jp-duration"></div> + <div class="player" id="jp-player"></div> +</div> + +<div id="leftcontent"> +<table id="playlist"> + <thead> + <tr> + <th class="name"><input id="selectAll" type="checkbox">Name</th> + <th class="artist">Artist</th> + </tr> + </thead> + <tbody> + <tr> + <td> + 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> + +<div id="rightcontent"> +<div id="scan"> + <p id="scancount" style="display:none"><span class="songCount">0</span> Songs scanned</p> + <div id="scanprogressbar"></div> + <input type="button" class="start" value="Rescan Collection"></input> + <input type="button" class="stop" style="display:none" value="Pause"></input> +</div> +<table id="collection"> + <thead> + <th>Artist</th> + <th>Album</th> + <th>Title</th> + </thead> + <tbody> + <tr class="template"> + <td class="artist"><a/></td> + <td class="album"><a/></td> + <td class="title"><a/></td> + </tr> + </tbody> +</table> +</div> diff --git a/apps/media/templates/player.php b/apps/media/templates/player.php deleted file mode 100644 index 31b06e097bc..00000000000 --- a/apps/media/templates/player.php +++ /dev/null @@ -1,22 +0,0 @@ -<div id="jp-interface"> - <ul class="jp-controls"> - <li><a href="#" class="jp-play" tabindex="1">play</a></li> - <li><a href="#" class="jp-pause" tabindex="1">pause</a></li> - <li><a href="#" class="jp-stop" tabindex="1">stop</a></li> - <li><a href="#" class="jp-mute" tabindex="1">mute</a></li> - <li><a href="#" class="jp-unmute" tabindex="1">unmute</a></li> - <li><a href="#" class="jp-previous" tabindex="1">previous</a></li> - <li><a href="#" class="jp-next" tabindex="1">next</a></li> - </ul> - <div class="jp-progress"> - <div class="jp-seek-bar"> - <div class="jp-play-bar"></div> - </div> - </div> - <div class="jp-volume-bar"> - <div class="jp-volume-bar-value"></div> - </div> - <div class="jp-current-time"></div> - <div class="jp-duration"></div> - <div class='player' id='jp-player'></div> -</div> diff --git a/apps/media/templates/playlist.php b/apps/media/templates/playlist.php deleted file mode 100644 index bdc6ef59bb0..00000000000 --- a/apps/media/templates/playlist.php +++ /dev/null @@ -1,30 +0,0 @@ -<table id='playlist'> - <thead> - <tr> - <th class='name'><input id='selectAll' type='checkbox'>Name</th> - <th class='artist'>Artist</th> - <th class='album'>Album</th> - <th class='time'>Time</th> - <th class='plays'>Plays</th> - </tr> - </thead> - <tbody> - <tr> - <td> - The playlist is empty - </td> - </tr> - </tbody> - <tfoot> - <tr class='template'> - <td class='name'> - <input type='checkbox'> - <span></span> - </td> - <td class='artist'></td> - <td class='album'></td> - <td class='time'></td> - <td class='plays'></td> - </tr> - </tfoot> -</table>
\ No newline at end of file diff --git a/apps/media/templates/settings.php b/apps/media/templates/settings.php deleted file mode 100644 index 45c60761507..00000000000 --- a/apps/media/templates/settings.php +++ /dev/null @@ -1,23 +0,0 @@ -<form id="quota"> - <fieldset> - <legend>Music Directories</legend> - <ul id='folderlist'> - <?php foreach($_['folders'] as $folder):?> - <li> - <?php echo $folder['name'];?> - <span class='right'> - <?php echo $folder['songs'];?> songs - <button class='rescan prettybutton'>Rescan</button> - <button class='delete prettybutton'>Delete</button> - </span> - </li> - <?php endforeach; ?> - <li> - <input placeholder='path' id='scanpath'/> - <span class='right'><button class='scan prettybutton'>Scan</button></span> - </li> - </ul> - <label for="autoupdate" title='Automaticaly scan new files in above directories'>Auto Update</label> - <input type='checkbox' <?php if($_['autoupdate']){echo 'checked="checked"';};?> id='autoupdate' title='Automaticaly scan new files in above directories'> - </fieldset> -</form>
\ No newline at end of file diff --git a/apps/user_ldap/appinfo/app.php b/apps/user_ldap/appinfo/app.php index 7f20372ea8d..a6fca415012 100644 --- a/apps/user_ldap/appinfo/app.php +++ b/apps/user_ldap/appinfo/app.php @@ -36,4 +36,4 @@ $entry = array( 'href' => OC_Helper::linkTo( "user_ldap", "settings.php" ), 'name' => 'LDAP' ); -OC_App::addNavigationSubEntry( "core_users", $entry); +// OC_App::addNavigationSubEntry( "core_users", $entry); diff --git a/apps/user_openid/appinfo/app.php b/apps/user_openid/appinfo/app.php index 93b178ac706..3cdf2664e81 100644 --- a/apps/user_openid/appinfo/app.php +++ b/apps/user_openid/appinfo/app.php @@ -19,6 +19,8 @@ if(strpos($_SERVER["REQUEST_URI"],'?') and !strpos($_SERVER["REQUEST_URI"],'=')) OC_Util::addHeader('link',array('rel'=>'openid.server', 'href'=>$urlBase.OC_Helper::linkTo( "user_openid", "user.php" ).'/'.$userName)); OC_Util::addHeader('link',array('rel'=>'openid.delegate', 'href'=>$urlBase.OC_Helper::linkTo( "user_openid", "user.php" ).'/'.$userName)); +OC_APP::registerPersonal('user_openid','settings'); + require_once 'apps/user_openid/user_openid.php'; //active the openid backend diff --git a/apps/user_openid/js/settings.js b/apps/user_openid/js/settings.js new file mode 100644 index 00000000000..b85ce2d3522 --- /dev/null +++ b/apps/user_openid/js/settings.js @@ -0,0 +1,12 @@ +$(document).ready(function(){ + $('#openidform input').blur(function(event){ + event.preventDefault(); + var post = $( "#openidform" ).serialize(); + $.post( 'ajax/openid.php', post, function(data){ + if( data.status == "success" ){ + }else{ + alert('error while setting OpenID'); + } + }); + }); +}); diff --git a/apps/user_openid/settings.php b/apps/user_openid/settings.php new file mode 100644 index 00000000000..d85eaebb5ee --- /dev/null +++ b/apps/user_openid/settings.php @@ -0,0 +1,10 @@ +<?php + +$tmpl = new OC_Template( 'user_openid', 'settings'); +$identity=OC_Preferences::getValue(OC_User::getUser(),'user_openid','identity',''); +$tmpl->assign('identity',$identity); + +OC_Util::addScript('user_openid','settings'); + +return $tmpl->fetchPage(); +?>
\ No newline at end of file diff --git a/apps/user_openid/templates/settings.php b/apps/user_openid/templates/settings.php new file mode 100644 index 00000000000..fff1eff09e0 --- /dev/null +++ b/apps/user_openid/templates/settings.php @@ -0,0 +1,6 @@ +<form id="openidform"> + <fieldset> + <legend><?php echo $l->t( 'OpenID' );?></legend> + <input type="text" name='identity' id='identity' value="<?php echo $_['identity']; ?>" placeholder="OpenID for <?php echo OC_User::getUser();?>" /> + </fieldset> +</form>
\ No newline at end of file diff --git a/core/css/styles.css b/core/css/styles.css index 114080f1f10..4cb630d4a93 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -1,16 +1,34 @@ -* { margin:0; padding:0; border:0; cursor:default; } -body { background:#fefefe; font:normal 80%/1.6em "Lucida Grande", Arial, Verdana, sans-serif; color:#000; } -#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-settings #header { background:#313131; } +/* 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. */ + +* { margin:0; padding:0; border:0; outline:0; cursor:default; } +body { background:#fefefe; font:normal 80%/1.6em "Lucida Grande", Arial, Verdana, sans-serif; color:#000; margin-bottom:2em; } + + +/* HEADERS */ +#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 */ +background: -moz-linear-gradient(top, #35537a 0%, #1d2d42 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#35537a), color-stop(100%,#1d2d42)); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, #35537a 0%,#1d2d42 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, #35537a 0%,#1d2d42 100%); /* Opera11.10+ */ +background: -ms-linear-gradient(top, #35537a 0%,#1d2d42 100%); /* IE10+ */ +background: linear-gradient(top, #35537a 0%,#1d2d42 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#35537a', endColorstr='#1d2d42',GradientType=0 ); /* IE6-9 */ } + #owncloud { float:left; } h1 { margin:1em 3em 1em 0; border-bottom:1px solid #666; text-transform:uppercase; font-weight:normal; font-style:italic; color:#666; } p.center { text-align:center; } -a { color:#000; text-decoration:none; outline:0; } +a { color:#000; text-decoration:none; } table { white-space:nowrap; } -input, select { background:#fff; color:#333; outline:0; } a, a img, a strong, a span, input, button, select, li { cursor:pointer; } -input[type="text"], input[type="password"] { cursor:text; } + +/* INPUTS */ +input[type="text"], input[type="password"] { cursor:text; } input, select { font-size:1em; width:10em; margin:.3em; padding:.5em; 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; } @@ -22,47 +40,44 @@ input[type="checkbox"] { width:auto; } #body-login input { font-size:1.5em; } #body-login input[type="submit"] { float:right; margin-right:.8em; } #remember_login { margin:.8em .2em 0 1em; } -form.searchbox input[type="search"] { position:fixed; font-size:1.2em; top:.3em; right:7em; padding:.2em .5em .2em 1.5em; background:#f8f8f8 url('../img/actions/search.png') .5em center no-repeat; border:0; -moz-border-radius:1em; -webkit-border- +form.searchbox input[type="search"] { position:fixed; font-size:1.2em; top:.4em; right:4em; padding:.2em .5em .2em 1.5em; background:#f8f8f8 url('../img/actions/search.png') .5em center no-repeat; border:0; -moz-border-radius:1em; -webkit-border- radius:1em; border-radius:1em; } -input[type="submit"].enabled { background:#aea; -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 #dda600; 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; } +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:0.4em 0.5em 0 0; text-align:right; } form p { padding:0.5em 4em 0.5em 0.5em; text-align:left; } form p.form_footer { margin:1em 0 0 0; text-align:right; } form label { cursor:pointer; } -fieldset { padding:1em; background-color:#f7f7f7; border:1px solid #ddd; max-width:600px; margin:2em; } -legend { padding:.5em; font-size:1.2em; } +#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;} +legend { padding:.2em; font-size:1.2em; } .template{display:none;} -div.controls { width:100%; height:3em; margin:0; background-color:#f7f7f7; border-bottom:1px solid #eee; position:fixed; z-index:2; } +/* CONTENT ------------------------------------------------------------------ */ +#controls { width:100%; top:3.5em; height:3em; margin:0; background-color:#f7f7f7; border-bottom:1px solid #eee; position:fixed; z-index:2; } +#content { margin:3.5em 0 0 12.5em; } +#body-settings #content { padding:1em; } +#leftcontent { position:absolute; top:6.5em; width:50em; } +#rightcontent { position:absolute; top:6.5em; left:32em; } /* LOG IN & INSTALLATION ------------------------------------------------------------ */ #body-login { background-color:#ddd; } #body-login p.info { width:16em; margin:2em auto; padding:1em; background-color:#eee; -moz-box-shadow:0 1px 0 #bbb inset; -webkit-box-shadow:0 1px 0 #bbb inset; box-shadow:0 1px 0 #bbb inset; -moz-border-radius:1em; -webkit-border-radius:1em; border-radius:1em; } #body-login p.info a { font-weight:bold; } -#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 */ -background: -moz-linear-gradient(top, #35537a 0%, #1d2d42 100%); /* FF3.6+ */ -background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#35537a), color-stop(100%,#1d2d42)); /* Chrome,Safari4+ */ -background: -webkit-linear-gradient(top, #35537a 0%,#1d2d42 100%); /* Chrome10+,Safari5.1+ */ -background: -o-linear-gradient(top, #35537a 0%,#1d2d42 100%); /* Opera11.10+ */ -background: -ms-linear-gradient(top, #35537a 0%,#1d2d42 100%); /* IE10+ */ -background: linear-gradient(top, #35537a 0%,#1d2d42 100%); /* W3C */ -filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#35537a', endColorstr='#1d2d42',GradientType=0 ); /* IE6-9 */ } - #login { min-height:30em; margin:2em auto 0; border-bottom:1px solid #f8f8f8; background:#eee; } #login form { width:18em; margin:2em auto 5em; padding:0; } -#login form fieldset { background-color:transparent; border:0; margin:0; padding:0; } +#login form fieldset { background-color:transparent; border:0; margin-bottom:2em; padding:0; } +#login form fieldset legend { font-weight:bold; } #login form p { position:relative; padding:0; } #login form label { position:absolute; margin:.8em .8em; font-size:1.5em; color:#666; } #login form input[type="checkbox"]+label { position:relative; margin:0; font-size:1em; text-shadow:#fff 0 1px 0; } -#login form #use_mysql { font-size:.9em; margin:0 0 0 1em; } -#login form ul.errors { background:#fed7d7 url(images/no.png) no-repeat 1em 1em; border:1px solid #f00; font-size:1.2em; list-style-indent:inside; margin:0 0 4em 0; padding:1em 1em 1em 5em; } +#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; list-style:none; margin:0; padding:0; } @@ -79,10 +94,8 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#35537a', end #navigation .subentry { background-color:#ddd; border-top:1px solid #aaa; color:#555; } #navigation .subentry.active { background-color:#bbb; border-top:1px solid #888; border-bottom:1px solid #bbb; } #navigation .subentry a { padding-left:3.1em; font-size:1em; } - -/* CONTENT ------------------------------------------------------------------ */ -#content { margin:3.5em 0 0 12.5em; } -#body-settings #content { padding:1em; } +#navigation #settings { position:absolute; bottom:3.5em; width:100%; } +#navigation #expand { margin:0 0 .2em 1.2em; cursor:pointer; } /* USER SETTINGS ------------------------------------------------------------ */ #quota_indicator { margin:0 4em 1em 0; padding:0; border:1px solid #ddd; border-radius:10px; -webkit-border-radius:10px; -moz-border-radius:10px; } diff --git a/core/img/actions/back.png b/core/img/actions/back.png Binary files differdeleted file mode 100644 index 86abbe0cabe..00000000000 --- a/core/img/actions/back.png +++ /dev/null diff --git a/core/img/actions/back.svg b/core/img/actions/back.svg deleted file mode 100644 index 2bdf50c7334..00000000000 --- a/core/img/actions/back.svg +++ /dev/null @@ -1,121 +0,0 @@ -<?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:xlink="http://www.w3.org/1999/xlink" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - version="1.0" - width="22" - height="22" - id="svg2423" - sodipodi:version="0.32" - inkscape:version="0.48.1 r9760" - sodipodi:docname="steadyflow-panel.svg" - inkscape:output_extension="org.inkscape.output.svg.inkscape" - inkscape:export-filename="/home/jancborchardt/SparkleShare/playground/ownCloud/elementaryicons/elementary-icon-theme/elementary-mono-dark/panel/22/steadyflow-panel.png" - inkscape:export-xdpi="205.86" - inkscape:export-ydpi="205.86"> - <metadata - id="metadata12"> - <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> - <sodipodi:namedview - inkscape:window-height="776" - inkscape:window-width="1280" - inkscape:pageshadow="2" - inkscape:pageopacity="0.0" - guidetolerance="10.0" - gridtolerance="10.0" - objecttolerance="10.0" - borderopacity="1.0" - bordercolor="#666666" - pagecolor="#ffffff" - id="base" - showgrid="false" - inkscape:zoom="18.409653" - inkscape:cx="3.1144877" - inkscape:cy="10.453039" - inkscape:window-x="0" - inkscape:window-y="24" - inkscape:current-layer="svg2423" - showguides="true" - inkscape:guide-bbox="true" - inkscape:window-maximized="1"> - <inkscape:grid - type="xygrid" - id="grid2989" - empspacing="5" - visible="true" - enabled="true" - snapvisiblegridlinesonly="true" /> - </sodipodi:namedview> - <defs - id="defs2425"> - <linearGradient - inkscape:collect="always" - xlink:href="#linearGradient3678" - id="linearGradient3805" - gradientUnits="userSpaceOnUse" - gradientTransform="matrix(0,0.51263812,0.51263812,0,0.912685,4.921543)" - x1="0.98925388" - y1="20.108774" - x2="26.631666" - y2="20.093433" /> - <linearGradient - id="linearGradient3678"> - <stop - style="stop-color:#ffffff;stop-opacity:1;" - offset="0" - id="stop3680" /> - <stop - style="stop-color:#e6e6e6;stop-opacity:1;" - offset="1" - id="stop3682" /> - </linearGradient> - <linearGradient - gradientTransform="matrix(-0.4100229,0,0,0.5447147,78.029995,-3.8459034)" - gradientUnits="userSpaceOnUse" - xlink:href="#linearGradient3678" - id="linearGradient2388-7" - y2="38.279892" - x2="159.68553" - y1="14.403693" - x1="159.68553" /> - <linearGradient - inkscape:collect="always" - xlink:href="#linearGradient3678" - id="linearGradient3793" - gradientUnits="userSpaceOnUse" - gradientTransform="matrix(-0.4100229,0,0,0.5447147,47.235507,-11.911988)" - x1="159.68553" - y1="14.403693" - x2="159.68553" - y2="38.279892" /> - </defs> - <path - inkscape:connector-curvature="0" - d="m 11.5,19.5 -8,-7 8,-7 0,4 7,0 0,6 -7,0 z" - id="path4348-1-1" - style="opacity:0.5;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" - sodipodi:nodetypes="cccccccc" /> - <path - inkscape:connector-curvature="0" - d="m 11.5,18.5 -8,-7 8,-7 0,4 7,0 0,6 -7,0 z" - id="path4348-1" - style="fill:url(#linearGradient3805);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" - sodipodi:nodetypes="cccccccc" /> -</svg> diff --git a/core/img/actions/settings.png b/core/img/actions/settings.png Binary files differindex ff650ecb0b0..5b1607e59fc 100644 --- a/core/img/actions/settings.png +++ b/core/img/actions/settings.png diff --git a/core/img/actions/settings.svg b/core/img/actions/settings.svg index 67473520af6..da685e8be0b 100644 --- a/core/img/actions/settings.svg +++ b/core/img/actions/settings.svg @@ -15,8 +15,8 @@ height="16" id="svg2457" inkscape:version="0.48.1 r9760" - sodipodi:docname="bonobo-component-browser.svg" - inkscape:export-filename="/home/jancborchardt/SparkleShare/playground/ownCloud/elementaryicons/elementary-icon-theme/elementary/actions/16/bonobo-component-browser.png" + sodipodi:docname="settings.svg" + inkscape:export-filename="/home/jancborchardt/owncloud-sharing/core/img/actions/settings.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90"> <metadata @@ -45,7 +45,7 @@ id="namedview21" showgrid="false" inkscape:zoom="17.875" - inkscape:cx="-2.3776224" + inkscape:cx="-0.41568268" inkscape:cy="1.2867133" inkscape:window-x="0" inkscape:window-y="24" @@ -188,32 +188,81 @@ </linearGradient> <linearGradient inkscape:collect="always" - xlink:href="#linearGradient3678" - id="linearGradient3959" + xlink:href="#linearGradient3587-6-5-3-5-7" + id="linearGradient3784" + x1="0.5" + y1="7.5560002" + x2="15.5" + y2="7.5560002" + gradientUnits="userSpaceOnUse" /> + <linearGradient + x1="46.395508" + y1="12.707516" + x2="46.395508" + y2="38.409042" + id="linearGradient3795-2" + xlink:href="#linearGradient3587-6-5-3-5-7" gradientUnits="userSpaceOnUse" - gradientTransform="translate(-17.058189,-0.444)" - x1="25" - y1="0" - x2="25" - y2="16.000105" /> + gradientTransform="matrix(-0.4100229,0,0,0.5447147,28.02322,-5.9219706)" /> + <linearGradient + id="linearGradient3587-6-5-3-5-7"> + <stop + id="stop3589-9-2-2-6-2" + style="stop-color:#000000;stop-opacity:1" + offset="0" /> + <stop + id="stop3591-7-4-73-5-1" + style="stop-color:#363636;stop-opacity:1" + offset="1" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3587-6-5-3-5-7" + id="linearGradient3810" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(-0.4100229,0,0,0.5447147,28.02322,-5.9219706)" + x1="46.395508" + y1="12.707516" + x2="46.395508" + y2="38.409042" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3587-6-5-3-5-7" + id="linearGradient3813" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(-0.4100229,0,0,0.5447147,10.462268,-5.974418)" + x1="46.395508" + y1="12.707516" + x2="46.395508" + y2="38.409042" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3587-6-5-3-5-7" + id="linearGradient3816" + gradientUnits="userSpaceOnUse" + x1="7.4930072" + y1="0.0035526801" + x2="7.4930072" + y2="14.998127" /> </defs> <g transform="translate(0.027972,0.944)" id="g2479-3" - style="opacity:0.5;fill:#000000;fill-opacity:1"> + style="opacity:0.6;fill:#ffffff;fill-opacity:1"> <path inkscape:connector-curvature="0" - style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.99999994;marker:none;visibility:visible;display:block;overflow:visible;enable-background:accumulate" + style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.99999994000000003;marker:none;visibility:visible;display:block;overflow:visible;enable-background:accumulate" id="path2426-2" d="M 6.9375,0.056 C 6.6890831,0.056 6.5,0.245082 6.5,0.4935 l 0,1.25 C 5.9460971,1.885701 5.448836,2.115378 4.96875,2.39975 L 4.0625,1.4935 c -0.1756569,-0.175658 -0.449342,-0.175658 -0.625,0 l -1.5,1.5 c -0.175657,0.175658 -0.175657,0.449342 0,0.625 L 2.84375,4.52475 C 2.5593789,5.004836 2.329701,5.502097 2.1875,6.056 l -1.25,0 C 0.68908301,6.056 0.5,6.245082 0.5,6.4935 l 0,2.125 c 1e-8,0.248418 0.189083,0.4375 0.4375,0.4375 l 1.25,0 c 0.1422009,0.553903 0.371879,1.051164 0.65625,1.53125 L 1.9375,11.4935 c -0.175657,0.175658 -0.175657,0.449342 0,0.625 l 1.5,1.5 c 0.1756579,0.175658 0.449342,0.175658 0.625,0 L 4.96875,12.71225 C 5.4488361,12.996622 5.946097,13.2263 6.5,13.3685 l 0,1.25 c 1e-7,0.248418 0.189083,0.4375 0.4375,0.4375 l 2.125,0 C 9.3109176,15.056 9.5,14.866918 9.5,14.6185 l 0,-1.25 c 0.553903,-0.1422 1.051164,-0.371878 1.53125,-0.65625 l 0.90625,0.90625 c 0.175658,0.175658 0.449342,0.175658 0.625,0 l 1.5,-1.5 c 0.175658,-0.175658 0.175658,-0.449342 0,-0.625 L 13.15625,10.58725 C 13.440622,10.107164 13.6703,9.609903 13.8125,9.056 l 1.25,0 C 15.310918,9.056 15.5,8.866917 15.5,8.6185 l 0,-2.125 C 15.5,6.245082 15.310917,6.056 15.0625,6.056 l -1.25,0 C 13.6703,5.502097 13.440622,5.004836 13.15625,4.52475 L 14.0625,3.6185 c 0.175658,-0.175658 0.175658,-0.449342 0,-0.625 l -1.5,-1.5 c -0.175658,-0.175658 -0.449342,-0.175658 -0.625,0 L 11.03125,2.39975 C 10.551164,2.115378 10.053903,1.885701 9.5,1.7435 l 0,-1.25 C 9.4999996,0.245082 9.310918,0.056 9.0625,0.056 z M 8,4.2133427 c 1.8451469,0 3.342657,1.4975104 3.342657,3.3426573 0,1.8451469 -1.4975101,3.342657 -3.342657,3.342657 C 6.1548531,10.898657 4.6573427,9.4011469 4.6573427,7.556 4.6573427,5.7108531 6.1548531,4.2133427 8,4.2133427 z" sodipodi:nodetypes="ssccssssccssssccssssccssssccssssccssssccssssccssssssss" /> </g> <g id="g2479" - transform="translate(0,-0.056)"> + transform="translate(0,-0.056)" + style="fill-opacity:1;fill:url(#linearGradient3784);opacity:0.7"> <path inkscape:connector-curvature="0" - style="fill:url(#linearGradient3959);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.99999994;marker:none;visibility:visible;display:block;overflow:visible;enable-background:accumulate" + style="fill:url(#linearGradient3816);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.99999994000000003;marker:none;visibility:visible;display:block;overflow:visible;enable-background:accumulate" id="path2426" d="M 6.9375,0.056 C 6.6890831,0.056 6.5,0.245082 6.5,0.4935 l 0,1.25 C 5.9460971,1.885701 5.448836,2.115378 4.96875,2.39975 L 4.0625,1.4935 c -0.1756569,-0.175658 -0.449342,-0.175658 -0.625,0 l -1.5,1.5 c -0.175657,0.175658 -0.175657,0.449342 0,0.625 L 2.84375,4.52475 C 2.5593789,5.004836 2.329701,5.502097 2.1875,6.056 l -1.25,0 C 0.68908301,6.056 0.5,6.245082 0.5,6.4935 l 0,2.125 c 1e-8,0.248418 0.189083,0.4375 0.4375,0.4375 l 1.25,0 c 0.1422009,0.553903 0.371879,1.051164 0.65625,1.53125 L 1.9375,11.4935 c -0.175657,0.175658 -0.175657,0.449342 0,0.625 l 1.5,1.5 c 0.1756579,0.175658 0.449342,0.175658 0.625,0 L 4.96875,12.71225 C 5.4488361,12.996622 5.946097,13.2263 6.5,13.3685 l 0,1.25 c 1e-7,0.248418 0.189083,0.4375 0.4375,0.4375 l 2.125,0 C 9.3109176,15.056 9.5,14.866918 9.5,14.6185 l 0,-1.25 c 0.553903,-0.1422 1.051164,-0.371878 1.53125,-0.65625 l 0.90625,0.90625 c 0.175658,0.175658 0.449342,0.175658 0.625,0 l 1.5,-1.5 c 0.175658,-0.175658 0.175658,-0.449342 0,-0.625 L 13.15625,10.58725 C 13.440622,10.107164 13.6703,9.609903 13.8125,9.056 l 1.25,0 C 15.310918,9.056 15.5,8.866917 15.5,8.6185 l 0,-2.125 C 15.5,6.245082 15.310917,6.056 15.0625,6.056 l -1.25,0 C 13.6703,5.502097 13.440622,5.004836 13.15625,4.52475 L 14.0625,3.6185 c 0.175658,-0.175658 0.175658,-0.449342 0,-0.625 l -1.5,-1.5 c -0.175658,-0.175658 -0.449342,-0.175658 -0.625,0 L 11.03125,2.39975 C 10.551164,2.115378 10.053903,1.885701 9.5,1.7435 l 0,-1.25 C 9.4999996,0.245082 9.310918,0.056 9.0625,0.056 z M 8,4.2133427 c 1.8451469,0 3.342657,1.4975104 3.342657,3.3426573 0,1.8451469 -1.4975101,3.342657 -3.342657,3.342657 C 6.1548531,10.898657 4.6573427,9.4011469 4.6573427,7.556 4.6573427,5.7108531 6.1548531,4.2133427 8,4.2133427 z" sodipodi:nodetypes="ssccssssccssssccssssccssssccssssccssssccssssccssssssss" /> diff --git a/core/js/js.js b/core/js/js.js index 9e2ae8d7104..952c1b86ea9 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -27,7 +27,8 @@ t.cache={}; OC={ webroot:oc_webroot, - coreApps:['files','admin','log','search','settings','core'], + currentUser:oc_current_user, + coreApps:['files','admin','log','search','settings','core','3rdparty'], /** * get an absolute url to a file in an appen * @param app the id of the app the file belongs to @@ -264,6 +265,12 @@ $(document).ready(function(){ $('#remember_login+label').fadeIn(); } }); + + if($('body').attr("id")=="body-user") { $('#settings li').hide(); } + $('#expand').click(function() { + $('#settings li').slideToggle(); + }); + }); diff --git a/core/js/setup.js b/core/js/setup.js index 3025a511c61..3fb895cc414 100644 --- a/core/js/setup.js +++ b/core/js/setup.js @@ -1,32 +1,20 @@ $(document).ready(function() { - // Hide the MySQL config div if needed : - if(!$('#mysql').is(':checked')) { - $('#use_mysql').hide(); - } - - // Hide the PostgreSQL config div if needed: - if(!$('#pgsql').is(':checked')) { - $('#use_postgresql').hide(); - } - $('#datadirField').hide(250); if($('#hasSQLite').val()=='true'){ $('#databaseField').hide(250); + $('#use_other_db').slideUp(250); } $('#sqlite').click(function() { - $('#use_mysql').slideUp(250); - $('#use_postgresql').slideUp(250); + $('#use_other_db').slideUp(250); }); $('#mysql').click(function() { - $('#use_mysql').slideDown(250); - $('#use_postgresql').slideUp(250); + $('#use_other_db').slideDown(250); }); $('#pgsql').click(function() { - $('#use_postgresql').slideDown(250); - $('#use_mysql').slideUp(250); + $('#use_other_db').slideDown(250); }); $('#showAdvanced').click(function() { diff --git a/core/templates/404.php b/core/templates/404.php index 67ce8c8026c..13a81010343 100644 --- a/core/templates/404.php +++ b/core/templates/404.php @@ -7,12 +7,9 @@ if(!isset($_)){//also provide standalone error page exit; } ?> -<div id="login"> - <header><img src="<?php echo image_path('', 'weather-clear.png'); ?>" alt="ownCloud" /></header> - <ul> - <li class='error'> - <?php echo $l->t( 'Error 404, Cloud not found' ); ?><br/> - <p class='hint'><?php if(isset($_['file'])) echo $_['file']?></p> - </li> - </ul> -</div> +<ul> + <li class='error'> + <?php echo $l->t( 'Cloud not found' ); ?><br/> + <p class='hint'><?php if(isset($_['file'])) echo $_['file']?></p> + </li> +</ul> diff --git a/core/templates/error.php b/core/templates/error.php index aa8a8d473b4..4f05e008f99 100644 --- a/core/templates/error.php +++ b/core/templates/error.php @@ -1,12 +1,8 @@ -<div id="login"> - <header><img src="<?php echo image_path('', 'owncloud-logo-medium-white.png'); ?>" alt="ownCloud" /></header> - <ul> - <?php foreach($_["errors"] as $error):?> - <li class='error'> - <?php echo $error['error'] ?><br/> - <p class='hint'><?php if(isset($error['hint']))echo $error['hint'] ?></p> - </li> - <?php endforeach ?> - </ul> -</div> - +<ul> + <?php foreach($_["errors"] as $error):?> + <li class='error'> + <?php echo $error['error'] ?><br/> + <p class='hint'><?php if(isset($error['hint']))echo $error['hint'] ?></p> + </li> + <?php endforeach ?> +</ul> diff --git a/core/templates/installation.php b/core/templates/installation.php index de14c562419..e9f7daf7b89 100644 --- a/core/templates/installation.php +++ b/core/templates/installation.php @@ -1,85 +1,78 @@ -<div id="login"> - <header><img src="<?php echo image_path('', 'owncloud-logo-medium-white.png'); ?>" alt="ownCloud" /></header> - <form action="index.php" method="post"> - - <input type="hidden" name="install" value="true" /> - <?php if(count($_['errors']) > 0): ?> - <ul class="errors"> - <?php foreach($_['errors'] as $err): ?> - <li> - <?php if(is_array($err)):?> - <?php print $err['error']; ?> - <p class='hint'><?php print $err['hint']; ?></p> - <?php else: ?> - <?php print $err; ?> - <?php endif; ?> - </li> - <?php endforeach; ?> - </ul> - <?php endif; ?> +<form action="index.php" method="post"> - <fieldset> - <legend><?php echo $l->t( 'Create an <strong>admin account</strong>' ); ?></legend> - <input type="text" name="adminlogin" id="adminlogin" value="<?php print OC_Helper::init_var('adminlogin'); ?>" placeholder="<?php echo $l->t( 'Username' ); ?>" autofocus /></p> - <input type="password" name="adminpass" id="adminpass" value="<?php print OC_Helper::init_var('adminpass'); ?>" placeholder="<?php echo $l->t( 'Password' ); ?>" /></p> - </fieldset> - - <a id='showAdvanced'><strong><?php echo $l->t( 'Advanced' ); ?> ▾</strong></a> - - <fieldset id='datadirField'> - <legend><?php echo $l->t( 'Set data folder' ); ?></legend> - <input type="text" name="directory" id="directory" value="<?php print OC_Helper::init_var('directory', $_['directory']); ?>" placeholder="<?php echo $l->t( 'Data folder' ); ?>" /></p> - </fieldset> - - <fieldset id='databaseField'> - <legend><?php echo $l->t( 'Configure the database' ); ?></legend> - <?php if($_['hasSQLite']): ?> - <input type='hidden' id='hasSQLite' value='true'/> - <?php if(!$_['hasMySQL'] and !$_['hasPostgreSQL']): ?> - <p><?php echo $l->t( 'SQLite will be used.' ); ?></p> - <input type="hidden" id="dbtype" name="dbtype" value="sqlite" /> +<input type="hidden" name="install" value="true" /> + <?php if(count($_['errors']) > 0): ?> + <ul class="errors"> + <?php foreach($_['errors'] as $err): ?> + <li> + <?php if(is_array($err)):?> + <?php print $err['error']; ?> + <p class='hint'><?php print $err['hint']; ?></p> <?php else: ?> - <p><label class="sqlite" for="sqlite"><?php echo $l->t( 'SQLite' ); ?></label><input type="radio" name="dbtype" value='sqlite' id="sqlite" <?php OC_Helper::init_radio('dbtype', 'sqlite', 'sqlite'); ?>/></p> - <?php endif; ?> + <?php print $err; ?> <?php endif; ?> + </li> + <?php endforeach; ?> + </ul> + <?php endif; ?> - <?php if($_['hasMySQL']): ?> - <input type='hidden' id='hasMySQL' value='true'/> - <?php if(!$_['hasSQLite'] and !$_['hasPostgreSQL']): ?> - <p><?php echo $l->t( 'MySQL will be used.' ); ?></p> - <input type="hidden" id="dbtype" name="dbtype" value="mysql" /> - <?php else: ?> - <label class="mysql" for="mysql">MySQL</label><input type="radio" name="dbtype" value='mysql' id="mysql" <?php OC_Helper::init_radio('dbtype','pgsql', 'mysql', 'sqlite'); ?>/> - <?php endif; ?> - <div id="use_mysql"> - <input type="text" name="dbuser" id="dbuser" value="<?php print OC_Helper::init_var('dbuser'); ?>" placeholder="<?php echo $l->t( 'Database user' ); ?>" /> - <input type="password" name="dbpass" id="dbpass" value="<?php print OC_Helper::init_var('dbpass'); ?>" placeholder="<?php echo $l->t( 'Database password' ); ?>" /> - <input type="text" name="dbname" id="dbname" value="<?php print OC_Helper::init_var('dbname'); ?>" placeholder="<?php echo $l->t( 'Database name' ); ?>" /> - <input type="text" name="dbhost" id="dbhost" value="<?php print OC_Helper::init_var('dbhost', 'localhost'); ?>" placeholder="<?php echo $l->t( 'Host' ); ?>" /> - <input type="text" name="dbtableprefix" id="dbtableprefix" value="<?php print OC_Helper::init_var('dbtableprefix', 'oc_'); ?>" placeholder="<?php echo $l->t( 'Table prefix' ); ?>" /> - - </div> - <?php endif; ?> + <fieldset> + <legend><?php echo $l->t( 'Create an <strong>admin account</strong>' ); ?></legend> + <input type="text" name="adminlogin" id="adminlogin" value="<?php print OC_Helper::init_var('adminlogin'); ?>" placeholder="<?php echo $l->t( 'Username' ); ?>" autofocus required /></p> + <input type="password" name="adminpass" id="adminpass" value="<?php print OC_Helper::init_var('adminpass'); ?>" placeholder="<?php echo $l->t( 'Password' ); ?>" required /></p> + </fieldset> + + <fieldset id='databaseField'> + <?php if($_['hasMySQL'] or $_['hasPostgreSQL']) $hasOtherDB = true; //other than SQLite ?> + <legend><?php echo $l->t( 'Configure the database' ); ?></legend> + <?php if($_['hasSQLite']): ?> + <input type='hidden' id='hasSQLite' value='true' /> + <?php if(!$hasOtherDB): ?> + <p><?php echo $l->t( 'SQLite will be used.' ); ?></p> + <input type="hidden" id="dbtype" name="dbtype" value="sqlite" /> + <?php else: ?> + <p><label class="sqlite" for="sqlite"><?php echo $l->t( 'SQLite' ); ?></label><input type="radio" name="dbtype" value='sqlite' id="sqlite" <?php OC_Helper::init_radio('dbtype', 'sqlite', 'sqlite'); ?>/></p> + <?php endif; ?> + <?php endif; ?> - <?php if($_['hasPostgreSQL']): ?> - <input type='hidden' id='hasPostgreSQL' value='true'/> - <?php if(!$_['hasSQLite'] and !$_['hasSQLite']): ?> - <p><?php echo $l->t( 'PostgreSQL will be used.' ); ?></p> - <input type="hidden" id="dbtype" name="dbtype" value="pgsql" /> - <?php else: ?> - <p><label class="pgsql" for="pgsql">PostgreSQL</label><input type="radio" name="dbtype" value='pgsql' id="pgsql" <?php OC_Helper::init_radio('dbtype','pgsql', 'mysql', 'sqlite'); ?>/></p> - <?php endif; ?> - <div id="use_postgresql"> - <input type="text" name="pg_dbuser" id="pg_dbuser" value="<?php print OC_Helper::init_var('dbuser'); ?>" placeholder="<?php echo $l->t( 'Database user' ); ?>" /> - <input type="password" name="pg_dbpass" id="pg_dbpass" value="<?php print OC_Helper::init_var('dbpass'); ?>" placeholder="<?php echo $l->t( 'PostgreSQL password' ); ?>" /> - <input type="text" name="pg_dbname" id="pg_dbname" value="<?php print OC_Helper::init_var('dbname'); ?>" placeholder="<?php echo $l->t( 'Database name' ); ?>" /> - <input type="text" name="pg_dbhost" id="pg_dbhost" value="<?php print OC_Helper::init_var('dbhost', 'localhost'); ?>" placeholder="<?php echo $l->t( 'Host' ); ?>" /> - <input type="text" name="pg_dbtableprefix" id="pg_dbtableprefix" value="<?php print OC_Helper::init_var('dbtableprefix', 'oc_'); ?>" placeholder="<?php echo $l->t( 'Table prefix' ); ?>" /> - - </div> - <?php endif; ?> - </fieldset> + <?php if($_['hasMySQL']): ?> + <input type='hidden' id='hasMySQL' value='true'/> + <?php if(!$_['hasSQLite'] and !$_['hasPostgreSQL']): ?> + <p><?php echo $l->t( 'MySQL will be used.' ); ?></p> + <input type="hidden" id="dbtype" name="dbtype" value="mysql" /> + <?php else: ?> + <label class="mysql" for="mysql">MySQL</label><input type="radio" name="dbtype" value='mysql' id="mysql" <?php OC_Helper::init_radio('dbtype','pgsql', 'mysql', 'sqlite'); ?>/> + <?php endif; ?> + <?php endif; ?> + + <?php if($_['hasPostgreSQL']): ?> + <?php if(!$_['hasSQLite'] and !$_['hasMySQL']): ?> + <p><?php echo $l->t( 'PostgreSQL will be used.' ); ?></p> + <input type="hidden" id="dbtype" name="dbtype" value="pgsql" /> + <?php else: ?> + <p><label class="pgsql" for="pgsql">PostgreSQL</label><input type="radio" name="dbtype" value='pgsql' id="pgsql" <?php OC_Helper::init_radio('dbtype','pgsql', 'mysql', 'sqlite'); ?>/></p> + <?php endif; ?> + <?php endif; ?> + + <?php if($hasOtherDB): ?> + <div id="use_other_db"> + <input type="text" name="dbuser" id="dbuser" value="<?php print OC_Helper::init_var('dbuser'); ?>" placeholder="<?php echo $l->t( 'Database user' ); ?>" required /> + <input type="password" name="dbpass" id="dbpass" value="<?php print OC_Helper::init_var('dbpass'); ?>" placeholder="<?php echo $l->t( 'Database password' ); ?>" /> + <input type="text" name="dbname" id="dbname" value="<?php print OC_Helper::init_var('dbname'); ?>" placeholder="<?php echo $l->t( 'Database name' ); ?>" required /> + <input type="text" name="dbhost" id="dbhost" value="<?php print OC_Helper::init_var('dbhost', 'localhost'); ?>" placeholder="<?php echo $l->t( 'Host' ); ?>" required /> + <input type="text" name="dbtableprefix" id="dbtableprefix" value="<?php print OC_Helper::init_var('dbtableprefix', 'oc_'); ?>" placeholder="<?php echo $l->t( 'Table prefix' ); ?>" /> + + </div> + <?php endif; ?> + + </fieldset> + + <a id='showAdvanced'><strong><?php echo $l->t( 'Advanced' ); ?> ▾</strong></a> + + <fieldset id='datadirField'> + <legend><?php echo $l->t( 'Set data folder' ); ?></legend> + <input type="text" name="directory" id="directory" value="<?php print OC_Helper::init_var('directory', $_['directory']); ?>" placeholder="<?php echo $l->t( 'Data folder' ); ?>" required /></p> + </fieldset> - <input type="submit" value="<?php echo $l->t( 'Finish setup' ); ?>" /> - </form> -</div> + <input type="submit" value="<?php echo $l->t( 'Finish setup' ); ?>" /> +</form> diff --git a/core/templates/layout.admin.php b/core/templates/layout.admin.php deleted file mode 100644 index d70c54f7b15..00000000000 --- a/core/templates/layout.admin.php +++ /dev/null @@ -1,71 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <title>ownCloud</title> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <link rel="shortcut icon" href="<?php echo image_path('', 'favicon.png'); ?>" /><link rel="apple-touch-icon-precomposed" href="<?php echo image_path('', 'favicon-touch.png'); ?>" /> - <?php foreach($_['cssfiles'] as $cssfile): ?> - <link rel="stylesheet" href="<?php echo $cssfile; ?>" type="text/css" media="screen" /> - <?php endforeach; ?> - <script type="text/javascript"> - var oc_webroot = '<?php global $WEBROOT; echo $WEBROOT; ?>'; - var oc_current_user = '<?php echo OC_User::getUser() ?>'; - // </script> - <?php foreach($_['jsfiles'] as $jsfile): ?> - <script type="text/javascript" src="<?php echo $jsfile; ?>"></script> - <?php endforeach; ?> - <?php foreach($_['headers'] as $header): ?> - <?php - echo '<'.$header['tag'].' '; - foreach($header['attributes'] as $name=>$value){ - echo "$name='$value' "; - }; - echo '>'; - echo $header['text']; - echo '</'.$header['tag'].'>'; - ?> - <?php endforeach; ?> - </head> - - <body id="body-settings"> - <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> - <ul id="metanav"> - <li><a href="<?php echo link_to('', 'index.php'); ?>" title="Back to files"><img class='svg' src="<?php echo image_path('', 'actions/back.svg'); ?>"></a></li> - <li><a href="<?php echo link_to('', 'index.php?logout=true'); ?>" title="Log out"><img class='svg' src="<?php echo image_path('', 'actions/logout.svg'); ?>"></a></li> - </ul> - </div> - - <div id="main"> - <div id="navigation"> - <ul> - <?php foreach($_['settingsnavigation'] as $entry):?> - <li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title="" <?php if( $entry["active"] ): ?> class="active"<?php endif; ?>><?php echo $entry['name'] ?></a></li> - <?php if( sizeof( $entry["subnavigation"] )): ?> - <?php foreach($entry["subnavigation"] as $subentry):?> - <li><a href="<?php echo $subentry['href']; ?>" title="" <?php if( $subentry['active'] ): ?>class="active"<?php endif; ?>><?php echo $subentry['name'] ?></a></li> - <?php endforeach; ?> - <?php endif; ?> - <?php endforeach; ?> - <?php if(isset($_['adminnavigation'])):?> - <?php foreach($_['adminnavigation'] as $entry):?> - <li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title="" <?php if( $entry["active"] ): ?> class="active"<?php endif; ?>><?php echo $entry['name'] ?></a> - <?php if( sizeof( $entry["subnavigation"] )): ?> - <ul> - <?php foreach($entry["subnavigation"] as $subentry):?> - <li class="subentry"><a class="subentry<?php if( $subentry['active'] ): ?> active<?php endif; ?>" href="<?php echo $subentry['href']; ?>" title=""><?php echo $subentry['name'] ?></a></li> - <?php endforeach; ?> - </ul> - <?php endif; ?> - </li> - <?php endforeach; ?> - <?php endif; ?> - </ul> - </div> - - <div id="content"> - <?php echo $_['content']; ?> - </div> - </div> - </body> -</html> diff --git a/core/templates/layout.guest.php b/core/templates/layout.guest.php index 0b6189ef1c9..21388509f35 100644 --- a/core/templates/layout.guest.php +++ b/core/templates/layout.guest.php @@ -29,7 +29,12 @@ </head> <body id="body-login"> - <?php echo $_['content']; ?> - <p class="info"><?php echo $l->t( '<a href="http://owncloud.org/">ownCloud</a> is a personal cloud which runs on your own server.</p>' ); ?> + <div id="login"> + <header><div id="header"> + <img src="<?php echo image_path('', 'owncloud-logo-medium-white.png'); ?>" alt="ownCloud" /> + </div></header> + <?php echo $_['content']; ?> + </div> + <footer><p class="info"><?php echo $l->t( '<a href="http://owncloud.org/">ownCloud</a> is a personal cloud which runs on your own server.</p>' ); ?></p></footer> </body> </html> diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index a8dff9ff3d4..2dce647873f 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -27,35 +27,44 @@ <?php endforeach; ?> </head> - <body id="body-user"> - <div id="header"> + <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('settings', 'index.php'); ?>" title="Settings"><img class='svg' src="<?php echo image_path('', 'actions/settings.svg'); ?>"></a></li> - <li><a href="<?php echo link_to('', 'index.php'); ?>?logout=true" title="Log out"><img class='svg' src="<?php echo image_path('', 'actions/logout.svg'); ?>"></a></li> + <li><a href="<?php echo link_to('', 'index.php'); ?>?logout=true" title="Log out"><img class='svg' src="<?php echo image_path('', 'actions/logout.svg'); ?>" /></a></li> </ul> - </div> + </div></header> + + <nav><div id="navigation"> + <ul id="apps"> + <?php foreach($_['navigation'] as $entry): ?> + <li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title="" <?php if( $entry['active'] ): ?> class="active"<?php endif; ?>><?php echo $entry['name']; ?></a> + <?php if( sizeof( $entry["subnavigation"] )): ?> + <ul> + <?php foreach($entry["subnavigation"] as $subentry):?> + <li class="subentry"><a style="background-image:url(<?php echo $subentry['icon']; ?>)" href="<?php echo $subentry['href']; ?>" title="" class="subentry<?php if( $subentry['active'] ): ?> active<?php endif; ?>"><?php echo $subentry['name'] ?></a></li> + <?php endforeach; ?> + </ul> + <?php endif; ?> + </li> + <?php endforeach; ?> + </ul> + <ul id="settings"> + <img id="expand" class='svg' src="<?php echo image_path('', 'actions/settings.svg'); ?>" /> + <?php foreach($_['settingsnavigation'] as $entry):?> + <li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title="" <?php if( $entry["active"] ): ?> class="active"<?php endif; ?>><?php echo $entry['name'] ?></a></li> + <?php if( sizeof( $entry["subnavigation"] )): ?> + <?php foreach($entry["subnavigation"] as $subentry):?> + <li><a href="<?php echo $subentry['href']; ?>" title="" <?php if( $subentry['active'] ): ?>class="active"<?php endif; ?>><?php echo $subentry['name'] ?></a></li> + <?php endforeach; ?> + <?php endif; ?> + <?php endforeach; ?> + </ul> + </div></nav> - <div id="main"> - <div id="navigation"> - <ul> - <?php foreach($_['navigation'] as $entry): ?> - <li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title="" <?php if( $entry['active'] ): ?> class="active"<?php endif; ?>><?php echo $entry['name']; ?></a> - <?php if( sizeof( $entry["subnavigation"] )): ?> - <ul> - <?php foreach($entry["subnavigation"] as $subentry):?> - <li class="subentry"><a style="background-image:url(<?php echo $subentry['icon']; ?>)" href="<?php echo $subentry['href']; ?>" title="" class="subentry<?php if( $subentry['active'] ): ?> active<?php endif; ?>"><?php echo $subentry['name'] ?></a></li> - <?php endforeach; ?> - </ul> - <?php endif; ?> - </li> - <?php endforeach; ?> - </ul> - </div> - <div id="content"> - <?php echo $_['content']; ?> - </div> + <div id="content"> + <?php echo $_['content']; ?> </div> </body> </html> diff --git a/core/templates/login.php b/core/templates/login.php index 19f25f033d3..85db3bc9a52 100644 --- a/core/templates/login.php +++ b/core/templates/login.php @@ -1,23 +1,17 @@ -<div id="login"> - <header> - <img src="<?php echo image_path('', 'owncloud-logo-medium-white.png'); ?>" alt="ownCloud" /> - </header> - <form action="index.php" method="post"> - <fieldset> - <?php if($_['error']): ?> - <?php echo $l->t( 'Login failed!' ); ?> - <?php endif; ?> - <?php if(empty($_["username"])){?> - <input type="text" name="user" id="user" placeholder="Username" value="" autocomplete="off" required autofocus /> - <input type="password" name="password" id="password" placeholder="Password" value="" required /> - <input type="checkbox" name="remember_login" id="remember_login" /><label for="remember_login"><?php echo $l->t('remember'); ?></label> - <?php }else{ ?> - <input type="text" name="user" id="user" placeholder="Username" value="<?php echo $_['username']; ?>" autocomplete="off" required > - <input type="password" name="password" id="password" placeholder="Password" value="" required autofocus /> - <input type="checkbox" name="remember_login" id="remember_login" checked /><label for="remember_login"><?php echo $l->t('remember'); ?></label> - <?php } ?> - <input type="submit" id="submit" value="Log in" /> - </fieldset> - </form> -</div> - +<form action="index.php" method="post"> + <fieldset> + <?php if($_['error']): ?> + <?php echo $l->t( 'Login failed!' ); ?> + <?php endif; ?> + <?php if(empty($_["username"])){?> + <input type="text" name="user" id="user" placeholder="Username" value="" autocomplete="off" required autofocus /> + <input type="password" name="password" id="password" placeholder="Password" value="" required /> + <input type="checkbox" name="remember_login" id="remember_login" /><label for="remember_login"><?php echo $l->t('remember'); ?></label> + <?php }else{ ?> + <input type="text" name="user" id="user" placeholder="Username" value="<?php echo $_['username']; ?>" autocomplete="off" required > + <input type="password" name="password" id="password" placeholder="Password" value="" required autofocus /> + <input type="checkbox" name="remember_login" id="remember_login" checked /><label for="remember_login"><?php echo $l->t('remember'); ?></label> + <?php } ?> + <input type="submit" id="submit" value="Log in" /> + </fieldset> +</form> diff --git a/files/admin.php b/files/admin.php index 0b8639f38ca..7161de6e196 100644 --- a/files/admin.php +++ b/files/admin.php @@ -42,7 +42,7 @@ if(isset($_POST['maxUploadSize'])){ OC_App::setActiveNavigationEntry( "files_administration" ); // return template -$tmpl = new OC_Template( "files", "admin", "admin" ); +$tmpl = new OC_Template( "files", "admin", "user" ); $tmpl->assign( 'htaccessWorking', $htaccessWorking ); $tmpl->assign( 'uploadMaxFilesize', $maxUploadFilesize); $tmpl->printPage(); diff --git a/files/appinfo/app.php b/files/appinfo/app.php index 0f95b19f592..a4cec3d6ec2 100644 --- a/files/appinfo/app.php +++ b/files/appinfo/app.php @@ -3,10 +3,5 @@ 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", "home.png" ), "name" => "Files" )); -OC_App::addAdminPage( array( "id" => "files_administration", "order" => 3, "href" => OC_Helper::linkTo( "files", "admin.php" ), "name" => "Files", "icon" => OC_Helper::imagePath( "files", "folder.png" ))); - - -// To add navigation sub entries use -// OC_App::addNavigationSubEntry( "files_index", array( ... )); ?> diff --git a/files/css/files.css b/files/css/files.css index b57d1a9bed2..883fed5be4a 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -9,7 +9,7 @@ .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_newfolder_name { background-image:url("../img/folder.png"); font-weight:bold; width:12em; } +#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_newfolder_submit, #file_upload_submit { width:3em; } .file_upload_target { display:none; } diff --git a/files/js/filelist.js b/files/js/filelist.js index 8fd3bceafb1..ce9595d3495 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -113,7 +113,7 @@ FileList={ var tr=$('tr[data-file="'+name+'"]'); tr.data('renaming',true); var td=tr.children('td.filename'); - var input=$('<input value='+name+' class="filename"></input>'); + var input=$('<input value="'+name+'" class="filename"></input>'); var form=$('<form action="#"></form>') form.append(input); td.children('a.name').text(''); diff --git a/files/templates/index.php b/files/templates/index.php index 155bcf1ad51..1d059d88501 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -1,4 +1,4 @@ -<div class="controls"> +<div id="controls"> <span class="nav"> <?php echo($_['breadcrumb']); ?> </span> diff --git a/help/appinfo/app.php b/help/appinfo/app.php index 2e82c0cd181..372e28c97bd 100644 --- a/help/appinfo/app.php +++ b/help/appinfo/app.php @@ -2,13 +2,4 @@ OC_App::register( array( "order" => 1, "id" => "help", "name" => "Help" )); -// Workaround for having help as the last entry always -$entry = array( "id" => "help", "order" => 1000, "href" => OC_Helper::linkTo( "help", "index.php" ), "name" => "Help", "icon" => OC_Helper::imagePath( "help", "help.png" )); -if( isset( $_SESSION["user_id"] ) && OC_Group::inGroup( $_SESSION["user_id"], "admin" )){ - OC_App::addAdminPage( $entry ); -} -else{ - OC_App::addSettingsPage( $entry ); -} - ?> diff --git a/help/css/help.css b/help/css/help.css index e8c42f808d1..2722c676a66 100644 --- a/help/css/help.css +++ b/help/css/help.css @@ -6,3 +6,5 @@ table td.selection, table th.selection, table td.fileaction { width:2em; text-al table td.name a { padding:6px; text-decoration:none; color:#555555; } .type { text-decoration:none; color:#888888; font-size:.8em; } .description { text-decoration:none; color:#666666; font-size:.9em; } + +table#help tr td { white-space:normal; } diff --git a/help/index.php b/help/index.php index f1adea0be01..642b2131737 100644 --- a/help/index.php +++ b/help/index.php @@ -18,7 +18,7 @@ OC_App::setActiveNavigationEntry( "help" ); $kbe=OC_OCSClient::getKnownledgebaseEntries(); -$tmpl = new OC_Template( "help", "index", "admin" ); +$tmpl = new OC_Template( "help", "index", "user" ); $tmpl->assign( "kbe", $kbe ); $tmpl->assign( "pagecount", $pagecount ); $tmpl->assign( "page", $page ); diff --git a/help/templates/index.php b/help/templates/index.php index f859a8ae70c..ef5510e78b4 100644 --- a/help/templates/index.php +++ b/help/templates/index.php @@ -1,12 +1,12 @@ <?php if(is_null($_["kbe"])):?> Can't connect to Q&A database <?php else:?> - <table cellspacing="0" width="100%"> + <table id="help" cellspacing="20"> <tbody> <?php foreach($_["kbe"] as $kb): ?> <tr> <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>'); ?> + <td class="name"><p><strong><?php echo $kb["name"]; ?></strong></p><?php echo('<span class="type">'.$kb['description'].'</span>'); ?> <?php if($kb['answer']<>'') echo('<br /><span class="type"><b>Answer:</b></span><br /><span class="type">'.$kb['answer'].'</span>');?> </td> </tr> diff --git a/lib/app.php b/lib/app.php index 9e81ed8184e..f1363c8af5a 100644 --- a/lib/app.php +++ b/lib/app.php @@ -30,10 +30,10 @@ class OC_App{ static private $init = false; static private $apps = array(); static private $activeapp = ''; - static private $adminpages = array(); - static private $settingspages = array(); static private $navigation = array(); - static private $subnavigation = array(); + static private $settingsForms = array(); + static private $adminForms = array(); + static private $personalForms = array(); /** * @brief loads all apps @@ -167,38 +167,6 @@ class OC_App{ } /** - * @brief adds a sub entry to the navigation - * @param $parent id of the parent - * @param $data array containing the data - * @returns true/false - * - * This function adds a new sub entry to the navigation visible to users. - * these entries are visible only if the parent navigation entry is marked - * as being active (see activateNavigationEntry()). $data is an associative - * array. - * The following keys are required: - * - id: unique id for this entry ('addressbook_index') - * - href: link to the page - * - name: Human readable name ('Addressbook') - * - * The following keys are optional: - * - icon: path to the icon of the app - * - order: integer, that influences the position of your application in - * the navigation. Lower values come first. - */ - public static function addNavigationSubEntry( $parent, $data ){ - $data['active']=false; - if(!isset($data['icon'])){ - $data['icon']=''; - } - if( !array_key_exists( $parent, self::$subnavigation )){ - self::$subnavigation[$parent] = array(); - } - self::$subnavigation[$parent][] = $data; - return true; - } - - /** * @brief marks a navigation entry as active * @param $id id of the entry * @returns true/false @@ -224,70 +192,6 @@ class OC_App{ } /** - * @brief registers an admin page - * @param $data array containing the data - * @returns true/false - * - * This function registers a admin page that will be shown in the admin - * menu. $data is an associative array. - * The following keys are required: - * - id: unique id for this entry ('files_admin') - * - href: link to the admin page - * - name: Human readable name ('Files Administration') - * - * The following keys are optional: - * - order: integer, that influences the position of your application in - * the list. Lower values come first. - */ - public static function addAdminPage( $data = array()){ - // TODO: write function - OC_App::$adminpages[] = $data; - return true; - } - - /** - * @brief registers a settings page - * @param $data array containing the data - * @returns true/false - * - * This function registers a settings page. $data is an associative array. - * The following keys are required: - * - app: app the settings belong to ('files') - * - id: unique id for this entry ('files_public') - * - href: link to the admin page - * - name: Human readable name ('Public files') - * - * The following keys are optional: - * - order: integer, that influences the position of your application in - * the list. Lower values come first. - * - * For the main settings page of an app, the keys 'app' and 'id' have to be - * the same. - */ - public static function addSettingsPage( $data = array()){ - // TODO: write function - OC_App::$settingspages[] = $data; - return true; - } - - /** - * @brief Returns the navigation - * @returns associative array - * - * This function returns an array containing all entries added. The - * entries are sorted by the key 'order' ascending. Additional to the keys - * given for each app the following keys exist: - * - active: boolean, signals if the user is on this navigation entry - * - children: array that is empty if the key 'active' is false or - * contains the subentries if the key 'active' is true - */ - public static function getNavigation(){ - $navigation = self::proceedNavigation( self::$navigation ); - $navigation = self::addSubNavigation( $navigation ); - return $navigation; - } - - /** * @brief Returns the Settings Navigation * @returns associative array * @@ -295,57 +199,20 @@ class OC_App{ * entries are sorted by the key 'order' ascending. */ public static function getSettingsNavigation(){ - $navigation = self::proceedNavigation( self::$settingspages ); - $navigation = self::addSubNavigation( $navigation ); - - return $navigation; - } - - /** - * @brief Returns the admin navigation - * @returns associative array - * - * This function returns an array containing all admin pages added. The - * entries are sorted by the key 'order' ascending. - */ - public static function getAdminNavigation(){ - $navigation = self::proceedNavigation( self::$adminpages ); - $navigation = self::addSubNavigation( $navigation ); - - return $navigation; - } - - /// Private foo - private static function addSubNavigation( $list ){ - if(isset(self::$subnavigation[self::$activeapp])){ - $subNav=self::$subnavigation[self::$activeapp]; - foreach( $list as &$naventry ){ - if( $naventry['id'] == self::$activeapp ){ - $naventry['active'] = true; - $naventry['subnavigation'] = $subNav; - } - } - }else{ - foreach(self::$subnavigation as $parent=>$entries){ - $activeParent=false; - foreach($entries as &$subNav){ - $subNav['active']=$subNav['id'] == self::$activeapp; - if($subNav['active']){ - $activeParent=true; - } - } - if($activeParent){ - foreach( $list as &$naventry ){ - if( $naventry['id'] == $parent ){ - $naventry['active'] = true; - $naventry['subnavigation'] = $entries; - } - } - } - } + $admin=array( + array( "id" => "core_users", "order" => 2, "href" => OC_Helper::linkTo( "admin", "users.php" ), "name" => "Users", "icon" => OC_Helper::imagePath( "admin", "users.png" )), + array( "id" => "core_apps", "order" => 3, "href" => OC_Helper::linkTo( "admin", "apps.php?installed" ), "name" => "Apps", "icon" => OC_Helper::imagePath( "admin", "apps.png" )), + array( "id" => "files_administration", "order" => 3, "href" => OC_Helper::linkTo( "files", "admin.php" ), "name" => "Files", "icon" => OC_Helper::imagePath( "files", "folder.png" )), + ); + $settings=array( + array( "id" => "help", "order" => 1000, "href" => OC_Helper::linkTo( "help", "index.php" ), "name" => "Help", "icon" => OC_Helper::imagePath( "help", "help.png" )), + array( "id" => "settings", "order" => 1, "href" => OC_Helper::linkTo( "settings", "index.php" ), "name" => "Personal", "icon" => OC_Helper::imagePath( "settings", "personal.png" )) + ); + if( OC_Group::inGroup( $_SESSION["user_id"], "admin" )){ + $settings=array_merge($admin,$settings); } - - return $list; + $navigation = self::proceedNavigation($settings); + return $navigation; } /// This is private as well. It simply works, so don't ask for more details @@ -354,9 +221,6 @@ class OC_App{ $naventry['subnavigation'] = array(); if( $naventry['id'] == self::$activeapp ){ $naventry['active'] = true; - if( array_key_exists( $naventry['id'], self::$subnavigation )){ - $naventry['subnavigation'] = self::$subnavigation[$naventry['id']]; - } } else{ $naventry['active'] = false; @@ -393,6 +257,22 @@ class OC_App{ } /** + * @brief Returns the navigation + * @returns associative array + * + * This function returns an array containing all entries added. The + * entries are sorted by the key 'order' ascending. Additional to the keys + * given for each app the following keys exist: + * - active: boolean, signals if the user is on this navigation entry + * - children: array that is empty if the key 'active' is false or + * contains the subentries if the key 'active' is true + */ + public static function getNavigation(){ + $navigation = self::proceedNavigation( self::$navigation ); + return $navigation; + } + + /** * get the id of loaded app * @return string */ @@ -407,4 +287,48 @@ class OC_App{ return $topFolder; } } + + + /** + * get the forms for either settings, admin or personal + */ + public static function getForms($type){ + $forms=array(); + switch($type){ + case 'settings': + $source=self::$settingsForms; + break; + case 'admin': + $source=self::$adminForms; + break; + case 'personal': + $source=self::$personalForms; + break; + } + foreach($source as $form){ + $forms[]=include $form; + } + return $forms; + } + + /** + * register a settings form to be shown + */ + public static function registerSettings($app,$page){ + self::$settingsForms[]='apps/'.$app.'/'.$page.'.php'; + } + + /** + * register an admin form to be shown + */ + public static function registerAdmin($app,$page){ + self::$adminForms[]='apps/'.$app.'/'.$page.'.php'; + } + + /** + * register a personal form to be shown + */ + public static function registerPersonal($app,$page){ + self::$personalForms[]='apps/'.$app.'/'.$page.'.php'; + } } diff --git a/lib/l10n.php b/lib/l10n.php index 4e65af66c4f..5271bd4e589 100644 --- a/lib/l10n.php +++ b/lib/l10n.php @@ -146,16 +146,11 @@ class OC_L10N{ // If you add something don't forget to add it to $localizations // at the top of the page case 'date': - if( is_string( $data )) $data = strtotime( $data ); - return date( $this->localizations['date'], $data ); - break; case 'datetime': - if( is_string( $data )) $data = strtotime( $data ); - return date( $this->localizations['datetime'], $data ); - break; case 'time': - if( is_string( $data )) $data = strtotime( $data ); - return date( $this->localizations['time'], $data ); + if( $data instanceof DateTime ) return $data->format($this->localizations[$type]); + elseif( is_string( $data )) $data = strtotime( $data ); + return date( $this->localizations[$type], $data ); break; default: return false; diff --git a/lib/setup.php b/lib/setup.php index f87581d7582..192fd134608 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -46,39 +46,26 @@ class OC_Setup { $error[] = 'STEP 2 : data directory path is not set.'; } - if($dbtype=='mysql') { //mysql needs more config options + if($dbtype=='mysql' or $dbtype=='pgsql') { //mysql and postgresql needs more config options + if($dbtype=='mysql') + $dbprettyname = 'MySQL'; + else + $dbprettyname = 'PostgreSQL'; + if(empty($options['dbuser'])) { - $error[] = 'STEP 3 : MySQL database user is not set.'; + $error[] = "STEP 3 : $dbprettyname database user is not set."; } if(empty($options['dbpass'])) { - $error[] = 'STEP 3 : MySQL database password is not set.'; + $error[] = "STEP 3 : $dbprettyname database password is not set."; } if(empty($options['dbname'])) { - $error[] = 'STEP 3 : MySQL database name is not set.'; + $error[] = "STEP 3 : $dbprettyname database name is not set."; } if(empty($options['dbhost'])) { - $error[] = 'STEP 3 : MySQL database host is not set.'; + $error[] = "STEP 3 : $dbprettyname database host is not set."; } if(!isset($options['dbtableprefix'])) { - $error[] = 'STEP 3 : MySQL database table prefix is not set.'; - } - } - - if($dbtype=='pgsql') { //postgresql needs more config options - if(empty($options['pg_dbuser'])) { - $error[] = 'STEP 3 : PostgreSQL database user is not set.'; - } - if(empty($options['pg_dbpass'])) { - $error[] = 'STEP 3 : PostgreSQL database password is not set.'; - } - if(empty($options['pg_dbname'])) { - $error[] = 'STEP 3 : PostgreSQL database name is not set.'; - } - if(empty($options['pg_dbhost'])) { - $error[] = 'STEP 3 : PostgreSQL database host is not set.'; - } - if(!isset($options['pg_dbtableprefix'])) { - $error[] = 'STEP 3 : PostgreSQL database table prefix is not set.'; + $error[] = "STEP 3 : $dbprettyname database table prefix is not set."; } } @@ -150,11 +137,11 @@ class OC_Setup { } } elseif($dbtype == 'pgsql') { - $dbuser = $options['pg_dbuser']; - $dbpass = $options['pg_dbpass']; - $dbname = $options['pg_dbname']; - $dbhost = $options['pg_dbhost']; - $dbtableprefix = $options['pg_dbtableprefix']; + $dbuser = $options['dbuser']; + $dbpass = $options['dbpass']; + $dbname = $options['dbname']; + $dbhost = $options['dbhost']; + $dbtableprefix = $options['dbtableprefix']; OC_CONFIG::setValue('dbname', $dbname); OC_CONFIG::setValue('dbhost', $dbhost); OC_CONFIG::setValue('dbtableprefix', $dbtableprefix); @@ -224,7 +211,9 @@ class OC_Setup { OC_Installer::installShippedApps(true); //create htaccess files for apache hosts - self::createHtaccess(); //TODO detect if apache is used + if (strstr($_SERVER['SERVER_SOFTWARE'], 'Apache')) { + self::createHtaccess(); + } //and we are done OC_Config::setValue('installed', true); diff --git a/lib/template.php b/lib/template.php index 124343bd85b..2ba26eebac8 100644 --- a/lib/template.php +++ b/lib/template.php @@ -202,15 +202,12 @@ class OC_Template{ * * This function proceeds the template and prints its output. */ - public function printPage() - { + public function printPage(){ $data = $this->fetchPage(); - if( $data === false ) - { + if( $data === false ){ return false; } - else - { + else{ print $data; return true; } @@ -223,41 +220,29 @@ class OC_Template{ * This function proceeds the template. If $this->renderas is set, it will * will produce a full page. */ - public function fetchPage() - { + public function fetchPage(){ // global Data we need global $WEBROOT; global $SERVERROOT; $data = $this->_fetch(); - if( $this->renderas ) - { + if( $this->renderas ){ // Decide which page we show - if( $this->renderas == "user" ) - { + 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()); + if(array_search(OC_APP::getCurrentApp(),array('settings','admin','help'))!==false){ + $page->assign('bodyid','body-settings'); + }else{ + $page->assign('bodyid','body-user'); + } // Add navigation entry $page->assign( "navigation", OC_App::getNavigation()); - } - elseif( $this->renderas == "admin" ) - { - $page = new OC_Template( "core", "layout.admin" ); - $search=new OC_Template( 'core', 'part.searchbox'); - $search->assign('searchurl',OC_Helper::linkTo( 'search', 'index.php' )); - $page->assign('searchbox', $search->fetchPage()); - - // Add menu data - if( OC_Group::inGroup( $_SESSION["user_id"], "admin" )){ - $page->assign( "adminnavigation", OC_App::getAdminNavigation()); - } $page->assign( "settingsnavigation", OC_App::getSettingsNavigation()); - } - else - { + }else{ $page = new OC_Template( "core", "layout.guest" ); } @@ -295,8 +280,7 @@ class OC_Template{ $page->assign( "content", $data ); return $page->fetchPage(); } - else - { + else{ return $data; } } @@ -329,9 +313,14 @@ class OC_Template{ * Includes another template. use <?php echo $this->inc('template'); ?> to * do this. */ - public function inc( $file ){ + public function inc( $file, $additionalparams = null ){ // $_ erstellen $_ = $this->vars; + $l = $this->l10n; + + if( !is_null($additionalparams)){ + $_ = array_merge( $additionalparams, $this->vars ); + } // Einbinden ob_start(); diff --git a/settings/appinfo/app.php b/settings/appinfo/app.php index db4594dcc2d..4ffb944aba3 100644 --- a/settings/appinfo/app.php +++ b/settings/appinfo/app.php @@ -1,6 +1,5 @@ <?php OC_App::register( array( "id" => "settings", "name" => "Settings" )); -OC_App::addSettingsPage( array( "id" => "settings", "order" => -1000, "href" => OC_Helper::linkTo( "settings", "index.php" ), "name" => "Personal", "icon" => OC_Helper::imagePath( "settings", "personal.png" ))); ?> diff --git a/settings/css/settings.css b/settings/css/settings.css index 23561ec367d..66299b1faa0 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -1,2 +1,4 @@ -#passworderror{display:none;} -#passwordchanged{display:none;}
\ No newline at end of file +#passworderror { display:none; } +#passwordchanged { display:none; } + +input#identity { width:20em; } diff --git a/settings/index.php b/settings/index.php index 8b970a13c58..9669b5b3dba 100644 --- a/settings/index.php +++ b/settings/index.php @@ -24,15 +24,16 @@ unset($languages[array_search($lang,$languages)]); array_unshift($languages,$lang); // Return template -$tmpl = new OC_Template( "settings", "index", "admin"); +$tmpl = new OC_Template( "settings", "index", "user"); $tmpl->assign('usage',OC_Helper::humanFileSize($used)); $tmpl->assign('total_space',OC_Helper::humanFileSize($total)); $tmpl->assign('usage_relative',$relative); $tmpl->assign('languages',$languages); -$tmpl->assign('hasopenid',OC_App::isEnabled( 'user_openid' )); -if(OC_App::isEnabled( 'user_openid' )){ - $identity=OC_Preferences::getValue(OC_User::getUser(),'user_openid','identity',''); - $tmpl->assign('identity',$identity); + +$forms=OC_App::getForms('personal'); +$tmpl->assign('forms',array()); +foreach($forms as $form){ + $tmpl->append('forms',$form); } $tmpl->printPage(); diff --git a/settings/js/main.js b/settings/js/main.js index e6ca30d0ce4..f6b7eeb7584 100644 --- a/settings/js/main.js +++ b/settings/js/main.js @@ -19,17 +19,6 @@ $(document).ready(function(){ return false; }); - $('#openidform').submit(function(event){ - event.preventDefault(); - var post = $( "#openidform" ).serialize(); - $.post( 'ajax/openid.php', post, function(data){ - if( data.status == "success" ){ - }else{ - alert('error while setting OpenID'); - } - }); - }); - $("#languageinput").change( function(){ // Serialize the data var post = $( "#languageinput" ).serialize(); diff --git a/settings/templates/index.php b/settings/templates/index.php index 6e68cfa148c..0b5a14626fe 100644 --- a/settings/templates/index.php +++ b/settings/templates/index.php @@ -18,16 +18,6 @@ </fieldset> </form> -<?php if($_['hasopenid']):?> - <form id="openidform"> - <fieldset> - <legend><?php echo $l->t( 'OpenID' );?></legend> - <input type="text" name='identity' id='identity' value="<?php echo $_['identity']; ?>" placeholder="OpenID for <?php echo OC_User::getUser();?>" /> - <input type="submit" value="Save" /></p> - </fieldset> - </form> -<?php endif;?> - <form id="languageform"> <fieldset> <legend><?php echo $l->t( 'Language' );?></legend> @@ -39,3 +29,7 @@ </select> </fieldset> </form> + +<?php foreach($_['forms'] as $form){ + echo $form; +};?> |