diff --git a/3rdparty/css/chosen-sprite.png b/3rdparty/css/chosen-sprite.png new file mode 100644 index 0000000000..f20db4439e Binary files /dev/null and b/3rdparty/css/chosen-sprite.png differ diff --git a/3rdparty/css/chosen.css b/3rdparty/css/chosen.css new file mode 100644 index 0000000000..247d07bf02 --- /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 0000000000..80109bba80 --- /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 0000000000..cee8ed1cc0 --- /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: npm -g install uglify-js +3. Verify that your $NODE_PATH is properly configured using echo $NODE_PATH + +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 0000000000..f374f6662e --- /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 dce62fa11d..0cf66a553f 100644 --- a/admin/ajax/disableapp.php +++ b/admin/ajax/disableapp.php @@ -1,5 +1,4 @@ 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 4f39feab0c..de11dccc3d 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 c6b4f69ebc..92ab64df55 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 0000000000..521217df4f --- /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 ee9d814eb0..4def5ed555 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 994ce6f6cb..7e643fb60a 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(", ")); - } + $('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){ + } - else{ - printError( data.data.message ); - } - }); - 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 = '
'+username+'
'; - newrow = newrow+'
'+groups+''; - newrow = newrow+'remove'; - $("#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 = '' + groupname + ''; - newrow = newrow + 'remove'; - $("#grouptable").append( newrow ); - - // Delete form content - $("input[x-use='creategroupfield']").val( "" ); - - // Add group option to Create User and Edit User - var createuser = ' '+groupname+'
'; - $("#createusergroups").append( createuser ); - var changeuser = ' '+groupname+'
'; - $("#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 ); - } - } - 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 = ""; - } + ); + $(this).parent().parent().remove(); }); - - $("#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 ); - } - }); - return false; - }); - - // 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 = ""; - } - }); - - $("span[x-use='togglegroup']").live( "click", function(){ - if( $(this).prev().attr("checked")){ - $(this).prev().removeAttr("checked") - } - else{ - $(this).prev().attr("checked","checked") - } - 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); + + $('#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){ - // Create the post data - var post = $( "#createuserdata" ).serialize(); - - // Ajax call - $.post( 'ajax/createuser.php', post, function(data){ - $( "#createuserbutton" ).data('active',false); + } + ); + 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'); + } + }); + + $('#newgroup').submit(function(event){ + event.preventDefault(); + var name=$('#newgroupname').val(); + $.post( + OC.filePath('admin','ajax','creategroup.php'), + {groupname:name}, + function(result){ + + } + ); + $('#newusergroups').append(''); + $('select[multiple]').trigger("liszt:updated"); + var li=$('#leftcontent li').first().next().clone(); + li.text(name); + $('#leftcontent li').first().after(li); + }); + + $('#leftcontent li').live('click',function(event){ + $('#leftcontent li').removeClass('selected'); + $(this).addClass('selected'); + $('#rightcontent tr td.select input').show(); + $('#rightcontent tr td.select input').removeAttr('checked'); + var group=$(this).text().trim(); + var rows=$('#rightcontent tr').filter(function(i,tr){ + return ($(tr).children('td.groups').text().split(', ').indexOf(group)>-1); + }); + rows.find('td.select input').attr('checked','checked'); + }); + $('#rightcontent tr td.select input').live('change',function(event){ + var group=$('#leftcontent li.selected').text().trim(); + var user=$(this).parent().parent().children('td.name').text().trim(); + if(group=='admin' && user==OC.currentUser){ + event.preventDefault(); + $(this).attr('checked','checked'); + return false; + } + if(group){ + $.post( + OC.filePath('admin','ajax','togglegroups.php'), + { + username:user, + group:group + }, + function(result){ - // 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" ); + ); + var groups=$(this).parent().parent().children('td.groups').text().trim().split(', '); + if(groups[0]=='') groups.pop(); + var index=groups.indexOf(group); + if(index==-1){ + groups.push(group); + }else{ + groups.splice(index,1); } + $(this).parent().parent().children('td.groups').text(groups.join(', ')); } }); - - // 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" ); - } - }, - close: function(){ - true; - } - }); - -} ); - +}); diff --git a/admin/system.php b/admin/system.php index 11a76132b4..da77027f7a 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 d205d95cc3..035a75c9e8 100644 --- a/admin/templates/appsinst.php +++ b/admin/templates/appsinst.php @@ -1,20 +1,7 @@ - - - - - - - - - - - - - - - - - - - -
t( 'Name' ); ?>t( 'Version' ); ?>t( 'Author' ); ?>t( 'Status' ); ?>
+ diff --git a/admin/templates/users.php b/admin/templates/users.php index 79a4c71204..8e34c908fc 100644 --- a/admin/templates/users.php +++ b/admin/templates/users.php @@ -1,117 +1,39 @@ -
- t( 'Users' ); ?> - - - - - - - - - - - - - - - - - - - - "> - - - - - - -
t( 'Name' ); ?>t( 'Groups' ); ?>
- - - - - " type="checkbox" name="groups[]" value="" /> - "> - - - -
- - - -
-
- -
- t( 'Groups' ); ?> - - - - - - - - - - - - - - - - +
+
+ + + +
+ + +
"> - - - - - -
t( 'Name' ); ?>
- - - -   - -
-
- - -
+ +
+ + + "> + + + + + - - - - - -
-
- t( 'Do you really want to delete user' ); ?> $user? - - -
- -
-
- t( 'Do you really want to delete group' ); ?> $group? - - -
- -
- +
+ + Remove'/> + +
diff --git a/admin/users.php b/admin/users.php index b87f1bb5bc..4a83510cb7 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 0000000000..24766931d7 --- /dev/null +++ b/apps/contacts/ajax/addcard.php @@ -0,0 +1,54 @@ +. + * + */ + +// 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 0000000000..03d5e6b3ce --- /dev/null +++ b/apps/contacts/ajax/addphoto.php @@ -0,0 +1,59 @@ +. + * + */ + +// 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 0000000000..d92566d6a1 --- /dev/null +++ b/apps/contacts/ajax/addproperty.php @@ -0,0 +1,73 @@ +. + * + */ + +// 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 0000000000..ba36c494cd --- /dev/null +++ b/apps/contacts/ajax/deletebook.php @@ -0,0 +1,44 @@ +. + * + */ + +// 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 0000000000..839936d3fa --- /dev/null +++ b/apps/contacts/ajax/deletecard.php @@ -0,0 +1,50 @@ +. + * + */ + +// 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 0000000000..9f8b5dbbaf --- /dev/null +++ b/apps/contacts/ajax/deleteproperty.php @@ -0,0 +1,62 @@ +. + * + */ + +// 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 similarity index 87% rename from apps/contacts/details.php rename to apps/contacts/ajax/getdetails.php index 7ab1b64de2..4ee3625afc 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 0000000000..c29b532602 --- /dev/null +++ b/apps/contacts/ajax/setphoto.php @@ -0,0 +1,77 @@ +. + * + */ + +// 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 0000000000..6f33c68631 --- /dev/null +++ b/apps/contacts/ajax/setproperty.php @@ -0,0 +1,93 @@ +. + * + */ + +// 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;$ichildren[$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 0000000000..41ebb41d3e --- /dev/null +++ b/apps/contacts/ajax/showaddcard.php @@ -0,0 +1,39 @@ +. + * + */ + +// 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 0000000000..becc39b120 --- /dev/null +++ b/apps/contacts/ajax/showaddproperty.php @@ -0,0 +1,51 @@ +. + * + */ + +// 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 0000000000..75c3ff88f5 --- /dev/null +++ b/apps/contacts/ajax/showsetproperty.php @@ -0,0 +1,62 @@ +. + * + */ + +// 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 ae2c5b9736..581bf4a717 100644 --- a/apps/contacts/carddav.php +++ b/apps/contacts/carddav.php @@ -1,4 +1,24 @@ . + * + */ // Do not load FS ... $RUNTIME_NOSETUPFS = true; diff --git a/apps/contacts/css/styles.css b/apps/contacts/css/styles.css index 8d1c8b69c3..c7680f4a71 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 1e01b1c9fb..0d4ff83ef8 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 6af160b392..0aae7d15d4 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 c0f26c7df5..cb7b0b4671 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;$ichildren 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 98e2598b3a..96a90dfc5d 100644 --- a/apps/contacts/lib/connector_sabre.php +++ b/apps/contacts/lib/connector_sabre.php @@ -1,13 +1,23 @@ . + * */ /** diff --git a/apps/contacts/templates/_details.php b/apps/contacts/templates/_details.php deleted file mode 100644 index e27b17ef2e..0000000000 --- a/apps/contacts/templates/_details.php +++ /dev/null @@ -1,4 +0,0 @@ -Name - - - \ No newline at end of file diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php index ca189cb4c8..e6dd45739b 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'); ?> -
+
Addressbooks
@@ -13,12 +14,14 @@ OC_Util::addStyle('contacts','styles');
To use this addressbook, use .../apps/contacts/carddav.php/addressbooks/USERNAME/addressbookname.php
- -
+
*/ +?> +
    - inc("_contacts"); ?> + inc("part.contacts"); ?>
+ t('Add Contact'); ?>
-
- inc("_details"); ?> +
+ inc("part.details"); ?>
diff --git a/apps/contacts/templates/part.addcardform.php b/apps/contacts/templates/part.addcardform.php new file mode 100644 index 0000000000..94a59fe097 --- /dev/null +++ b/apps/contacts/templates/part.addcardform.php @@ -0,0 +1,13 @@ +
+ + + + + +
+ +
diff --git a/apps/contacts/templates/part.addpropertyform.php b/apps/contacts/templates/part.addpropertyform.php new file mode 100644 index 0000000000..ff9090b76d --- /dev/null +++ b/apps/contacts/templates/part.addpropertyform.php @@ -0,0 +1,43 @@ +
+ + +
+ +
+ +
+ diff --git a/apps/contacts/templates/_contacts.php b/apps/contacts/templates/part.contacts.php similarity index 95% rename from apps/contacts/templates/_contacts.php rename to apps/contacts/templates/part.contacts.php index bf633b79b0..fa6d4790cf 100644 --- a/apps/contacts/templates/_contacts.php +++ b/apps/contacts/templates/part.contacts.php @@ -1,3 +1,3 @@ -
  • +
  • diff --git a/apps/contacts/templates/part.details.php b/apps/contacts/templates/part.details.php new file mode 100644 index 0000000000..4aca8dbc79 --- /dev/null +++ b/apps/contacts/templates/part.details.php @@ -0,0 +1,22 @@ + + + +inc('part.property', array('property' => $_['details']['FN'][0])); ?> + + inc('part.property', array('property' => $_['details']['BDAY'][0])); ?> + + + inc('part.property', array('property' => $_['details']['ORG'][0])); ?> + + + + +
    + + inc('part.property',array('property' => $property )); ?> + + + + + + diff --git a/apps/contacts/templates/part.property.php b/apps/contacts/templates/part.property.php new file mode 100644 index 0000000000..1a4266b3a2 --- /dev/null +++ b/apps/contacts/templates/part.property.php @@ -0,0 +1,50 @@ +
    + +
    t('Name'); ?>
    +
    + + +
    + +
    t('Birthday'); ?>
    +
    + l('date',new DateTime($_['property']['value'])); ?> + + +
    + +
    t('Organisation'); ?>
    +
    + + + +
    + +
    t('Email'); ?>
    +
    + + + +
    + +
    t('Telefon'); ?>
    +
    + + + +
    + +
    t('Address'); ?>
    +
    + t('PO Box'); ?>
    + t('Extended Address'); ?>
    + t('Street Name'); ?>
    + t('City'); ?>
    + t('Region'); ?>
    + t('Postal Code'); ?>
    + t('Country'); ?> + + +
    + +
    diff --git a/apps/contacts/templates/part.setpropertyform.php b/apps/contacts/templates/part.setpropertyform.php new file mode 100644 index 0000000000..cd774ee659 --- /dev/null +++ b/apps/contacts/templates/part.setpropertyform.php @@ -0,0 +1,21 @@ +
    + + + + + t('PO Box'); ?> + t('Extended Address'); ?> + t('Street Name'); ?> + t('City'); ?> + t('Region'); ?> + t('Postal Code'); ?> + t('Country'); ?> + + + + + + + + +
    diff --git a/apps/contacts/temporaryupdate.php b/apps/contacts/temporaryupdate.php index bb5ff7604f..4b6453364e 100644 --- a/apps/contacts/temporaryupdate.php +++ b/apps/contacts/temporaryupdate.php @@ -1,4 +1,24 @@ . + * + */ // 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 17646b3e5b..e2d8d27c00 100644 --- a/apps/files_publiclink/appinfo/app.php +++ b/apps/files_publiclink/appinfo/app.php @@ -1,6 +1,6 @@ "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 4cdb36d450..bc80536a96 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 3637234ab1..dd9b8ea70d 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 94dd4d6360..6cf424a8ea 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 a7128aaad4..fe724b45dd 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 520ce7d112..df7b79e332 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;i1){ + var expander=$('>'); + 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=$('>'); + 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=$('
      '); - for(var i=0;i'); - for(var i=0;ispan').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 4e11b2951b..7034824cad 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 a15c34f93f..636ae29c55 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 3dabd86a49..0000000000 --- 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 "); - } - }) - if(!found){ - $('#folderlist').children().last().before("
    • "+path+""+songCount+" songs
    • "); - } - } - }); -} diff --git a/apps/media/templates/collection.php b/apps/media/templates/collection.php deleted file mode 100644 index f47cba2486..0000000000 --- a/apps/media/templates/collection.php +++ /dev/null @@ -1,17 +0,0 @@ -
      - -
      - - -
      -
        -
      • - loadingLoading Collection... -
      • -
      • - - - -
      • -
      - diff --git a/apps/media/templates/music.php b/apps/media/templates/music.php index 7a61d59c9b..5d0b0b6f0c 100644 --- a/apps/media/templates/music.php +++ b/apps/media/templates/music.php @@ -1,3 +1,71 @@ - - - +
      + + + + + +
      +
      + +
      + + + + + + + + + + + + + + + + + + +
      NameArtist
      + The playlist is empty +
      + + +
      +
      + +
      +
      + +
      + + +
      + + + + + + + + + + + + + +
      ArtistAlbumTitle
      +
      diff --git a/apps/media/templates/player.php b/apps/media/templates/player.php deleted file mode 100644 index 31b06e097b..0000000000 --- a/apps/media/templates/player.php +++ /dev/null @@ -1,22 +0,0 @@ -
      - - - - - -
      -
      diff --git a/apps/media/templates/playlist.php b/apps/media/templates/playlist.php deleted file mode 100644 index bdc6ef59bb..0000000000 --- a/apps/media/templates/playlist.php +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - -
      NameArtistAlbumTimePlays
      - The playlist is empty -
      - - -
      \ 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 45c6076150..0000000000 --- a/apps/media/templates/settings.php +++ /dev/null @@ -1,23 +0,0 @@ -
      -
      - Music Directories -
        - -
      • - - - songs - - - -
      • - -
      • - - -
      • -
      - - id='autoupdate' title='Automaticaly scan new files in above directories'> -
      -
      \ No newline at end of file diff --git a/apps/user_ldap/appinfo/app.php b/apps/user_ldap/appinfo/app.php index 7f20372ea8..a6fca41501 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 93b178ac70..3cdf2664e8 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 0000000000..b85ce2d352 --- /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 0000000000..d85eaebb5e --- /dev/null +++ b/apps/user_openid/settings.php @@ -0,0 +1,10 @@ +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 0000000000..fff1eff09e --- /dev/null +++ b/apps/user_openid/templates/settings.php @@ -0,0 +1,6 @@ +
      +
      + t( 'OpenID' );?> + +
      +
      \ No newline at end of file diff --git a/core/css/styles.css b/core/css/styles.css index 114080f1f1..4cb630d4a9 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 deleted file mode 100644 index 86abbe0cab..0000000000 Binary files a/core/img/actions/back.png and /dev/null differ diff --git a/core/img/actions/back.svg b/core/img/actions/back.svg deleted file mode 100644 index 2bdf50c733..0000000000 --- a/core/img/actions/back.svg +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - diff --git a/core/img/actions/settings.png b/core/img/actions/settings.png index ff650ecb0b..5b1607e59f 100644 Binary files a/core/img/actions/settings.png and b/core/img/actions/settings.png differ diff --git a/core/img/actions/settings.svg b/core/img/actions/settings.svg index 67473520af..da685e8be0 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"> + + gradientTransform="matrix(-0.4100229,0,0,0.5447147,28.02322,-5.9219706)" /> + + + + + + + + style="opacity:0.6;fill:#ffffff;fill-opacity:1"> + transform="translate(0,-0.056)" + style="fill-opacity:1;fill:url(#linearGradient3784);opacity:0.7"> diff --git a/core/js/js.js b/core/js/js.js index 9e2ae8d710..952c1b86ea 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 3025a511c6..3fb895cc41 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 67ce8c8026..13a8101034 100644 --- a/core/templates/404.php +++ b/core/templates/404.php @@ -7,12 +7,9 @@ if(!isset($_)){//also provide standalone error page exit; } ?> -
      -
      ownCloud
      -
        -
      • - t( 'Error 404, Cloud not found' ); ?>
        -

        -
      • -
      -
      +
        +
      • + t( 'Cloud not found' ); ?>
        +

        +
      • +
      diff --git a/core/templates/error.php b/core/templates/error.php index aa8a8d473b..4f05e008f9 100644 --- a/core/templates/error.php +++ b/core/templates/error.php @@ -1,12 +1,8 @@ -
      -
      ownCloud
      -
        - -
      • -
        -

        -
      • - -
      -
      - +
        + +
      • +
        +

        +
      • + +
      diff --git a/core/templates/installation.php b/core/templates/installation.php index de14c56241..e9f7daf7b8 100644 --- a/core/templates/installation.php +++ b/core/templates/installation.php @@ -1,85 +1,78 @@ -
      -
      ownCloud
      -
      + + + + 0): ?> +
        + +
      • + + +

        + + + +
      • + +
      + + +
      + t( 'Create an admin account' ); ?> +

      +

      +
      - - 0): ?> -
        - -
      • - - -

        - - - -
      • - -
      +
      + + t( 'Configure the database' ); ?> + + + +

      t( 'SQLite will be used.' ); ?>

      + + +

      />

      + -
      - t( 'Create an admin account' ); ?> -

      -

      -
      - - t( 'Advanced' ); ?> ▾ - -
      - t( 'Set data folder' ); ?> -

      -
      - -
      - t( 'Configure the database' ); ?> - - - -

      t( 'SQLite will be used.' ); ?>

      - - -

      />

      - - + + + +

      t( 'MySQL will be used.' ); ?>

      + + + /> + + - - - -

      t( 'MySQL will be used.' ); ?>

      - - - /> - -
      - - - - - - -
      - + + +

      t( 'PostgreSQL will be used.' ); ?>

      + + +

      />

      + + - - - -

      t( 'PostgreSQL will be used.' ); ?>

      - - -

      />

      - -
      - - - - - - -
      - -
      + +
      + + + + + + +
      + - - -
      + + + t( 'Advanced' ); ?> ▾ + +
      + t( 'Set data folder' ); ?> +

      +
      + + + diff --git a/core/templates/layout.admin.php b/core/templates/layout.admin.php deleted file mode 100644 index d70c54f7b1..0000000000 --- a/core/templates/layout.admin.php +++ /dev/null @@ -1,71 +0,0 @@ - - - - ownCloud - - - - - - - - - - - $value){ - echo "$name='$value' "; - }; - echo '>'; - echo $header['text']; - echo ''; - ?> - - - - - - -
      - - -
      - -
      -
      - - diff --git a/core/templates/layout.guest.php b/core/templates/layout.guest.php index 0b6189ef1c..21388509f3 100644 --- a/core/templates/layout.guest.php +++ b/core/templates/layout.guest.php @@ -29,7 +29,12 @@ - -

      t( 'ownCloud is a personal cloud which runs on your own server.

      ' ); ?> +
      +
      + +
      +

      t( 'ownCloud is a personal cloud which runs on your own server.

      ' ); ?>

      diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index a8dff9ff3d..2dce647873 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -27,35 +27,44 @@ - - -
      - -
      - -
      + + +
      +
      diff --git a/core/templates/login.php b/core/templates/login.php index 19f25f033d..85db3bc9a5 100644 --- a/core/templates/login.php +++ b/core/templates/login.php @@ -1,23 +1,17 @@ -
      -
      - ownCloud -
      -
      -
      - - t( 'Login failed!' ); ?> - - - - - - - - - - - -
      -
      -
      - +
      +
      + + t( 'Login failed!' ); ?> + + + + + + + + + + + +
      +
      diff --git a/files/admin.php b/files/admin.php index 0b8639f38c..7161de6e19 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 0f95b19f59..a4cec3d6ec 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 b57d1a9bed..883fed5be4 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 8fd3bceafb..ce9595d349 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=$(''); + var input=$(''); var form=$('
      ') form.append(input); td.children('a.name').text(''); diff --git a/files/templates/index.php b/files/templates/index.php index 155bcf1ad5..1d059d8850 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -1,4 +1,4 @@ -
      +
      diff --git a/help/appinfo/app.php b/help/appinfo/app.php index 2e82c0cd18..372e28c97b 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 e8c42f808d..2722c676a6 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 f1adea0be0..642b213173 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 f859a8ae70..ef5510e78b 100644 --- a/help/templates/index.php +++ b/help/templates/index.php @@ -1,12 +1,12 @@ Can't connect to Q&A database - +
      - diff --git a/lib/app.php b/lib/app.php index 9e81ed8184..f1363c8af5 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 @@ -166,38 +166,6 @@ class OC_App{ return true; } - /** - * @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 @@ -223,70 +191,6 @@ class OC_App{ return self::$activeapp; } - /** - * @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; @@ -392,6 +256,22 @@ class OC_App{ return $data; } + /** + * @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 4e65af66c4..5271bd4e58 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 f87581d758..192fd13460 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 124343bd85..2ba26eebac 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 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 db4594dcc2..4ffb944aba 100644 --- a/settings/appinfo/app.php +++ b/settings/appinfo/app.php @@ -1,6 +1,5 @@ "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 23561ec367..66299b1faa 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 8b970a13c5..9669b5b3db 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 e6ca30d0ce..f6b7eeb758 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 6e68cfa148..0b5a14626f 100644 --- a/settings/templates/index.php +++ b/settings/templates/index.php @@ -18,16 +18,6 @@ - - -
      - t( 'OpenID' );?> - -

      -
      - - -
      t( 'Language' );?> @@ -39,3 +29,7 @@
      + +
      "") { echo(''); } ?>
      '.$kb['description'].''); ?> +

      '.$kb['description'].''); ?> '') echo('
      Answer:
      '.$kb['answer'].'');?>