From a12cdb55b10b60983a7653ed86afe453d11da57b Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Mon, 17 Oct 2011 19:34:00 +0200 Subject: [PATCH 001/136] Replace ownCloud calendar html with fullcalendar implementation --- 3rdparty/fullcalendar/GPL-LICENSE.txt | 278 + 3rdparty/fullcalendar/MIT-LICENSE.txt | 20 + 3rdparty/fullcalendar/changelog.txt | 313 + 3rdparty/fullcalendar/css/fullcalendar.css | 616 ++ .../fullcalendar/css/fullcalendar.print.css | 59 + 3rdparty/fullcalendar/js/fullcalendar.js | 5210 +++++++++++++++++ 3rdparty/fullcalendar/js/fullcalendar.min.js | 113 + 3rdparty/fullcalendar/js/gcal.js | 112 + apps/calendar/css/style.css | 2 + apps/calendar/index.php | 14 +- apps/calendar/templates/calendar.php | 248 +- 11 files changed, 6793 insertions(+), 192 deletions(-) create mode 100644 3rdparty/fullcalendar/GPL-LICENSE.txt create mode 100644 3rdparty/fullcalendar/MIT-LICENSE.txt create mode 100644 3rdparty/fullcalendar/changelog.txt create mode 100644 3rdparty/fullcalendar/css/fullcalendar.css create mode 100644 3rdparty/fullcalendar/css/fullcalendar.print.css create mode 100644 3rdparty/fullcalendar/js/fullcalendar.js create mode 100644 3rdparty/fullcalendar/js/fullcalendar.min.js create mode 100644 3rdparty/fullcalendar/js/gcal.js diff --git a/3rdparty/fullcalendar/GPL-LICENSE.txt b/3rdparty/fullcalendar/GPL-LICENSE.txt new file mode 100644 index 0000000000..11dddd00ef --- /dev/null +++ b/3rdparty/fullcalendar/GPL-LICENSE.txt @@ -0,0 +1,278 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. diff --git a/3rdparty/fullcalendar/MIT-LICENSE.txt b/3rdparty/fullcalendar/MIT-LICENSE.txt new file mode 100644 index 0000000000..46d4754496 --- /dev/null +++ b/3rdparty/fullcalendar/MIT-LICENSE.txt @@ -0,0 +1,20 @@ +Copyright (c) 2009 Adam Shaw + +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. diff --git a/3rdparty/fullcalendar/changelog.txt b/3rdparty/fullcalendar/changelog.txt new file mode 100644 index 0000000000..50d0880fd7 --- /dev/null +++ b/3rdparty/fullcalendar/changelog.txt @@ -0,0 +1,313 @@ + +version 1.5.2 (8/21/11) + - correctly process UTC "Z" ISO8601 date strings (issue 750) + +version 1.5.1 (4/9/11) + - more flexible ISO8601 date parsing (issue 814) + - more flexible parsing of UNIX timestamps (issue 826) + - FullCalendar now buildable from source on a Mac (issue 795) + - FullCalendar QA'd in FF4 (issue 883) + - upgraded to jQuery 1.5.2 (which supports IE9) and jQuery UI 1.8.11 + +version 1.5 (3/19/11) + - slicker default styling for buttons + - reworked a lot of the calendar's HTML and accompanying CSS + (solves issues 327 and 395) + - more printer-friendly (fullcalendar-print.css) + - fullcalendar now inherits styles from jquery-ui themes differently. + styles for buttons are distinct from styles for calendar cells. + (solves issue 299) + - can now color events through FullCalendar options and Event-Object properties (issue 117) + THIS IS NOW THE PREFERRED METHOD OF COLORING EVENTS (as opposed to using className and CSS) + - FullCalendar options: + - eventColor (changes both background and border) + - eventBackgroundColor + - eventBorderColor + - eventTextColor + - Event-Object options: + - color (changes both background and border) + - backgroundColor + - borderColor + - textColor + - can now specify an event source as an *object* with a `url` property (json feed) or + an `events` property (function or array) with additional properties that will + be applied to the entire event source: + - color (changes both background and border) + - backgroudColor + - borderColor + - textColor + - className + - editable + - allDayDefault + - ignoreTimezone + - startParam (for a feed) + - endParam (for a feed) + - ANY OF THE JQUERY $.ajax OPTIONS + allows for easily changing from GET to POST and sending additional parameters (issue 386) + allows for easily attaching ajax handlers such as `error` (issue 754) + allows for turning caching on (issue 355) + - Google Calendar feeds are now specified differently: + - specify a simple string of your feed's URL + - specify an *object* with a `url` property of your feed's URL. + you can include any of the new Event-Source options in this object. + - the old `$.fullCalendar.gcalFeed` method still works + - no more IE7 SSL popup (issue 504) + - remove `cacheParam` - use json event source `cache` option instead + - latest jquery/jquery-ui + +version 1.4.11 (2/22/11) + - fixed rerenderEvents bug (issue 790) + - fixed bug with faulty dragging of events from all-day slot in agenda views + - bundled with jquery 1.5 and jquery-ui 1.8.9 + +version 1.4.10 (1/2/11) + - fixed bug with resizing event to different week in 5-day month view (issue 740) + - fixed bug with events not sticking after a removeEvents call (issue 757) + - fixed bug with underlying parseTime method, and other uses of parseInt (issue 688) + +version 1.4.9 (11/16/10) + - new algorithm for vertically stacking events (issue 111) + - resizing an event to a different week (issue 306) + - bug: some events not rendered with consecutive calls to addEventSource (issue 679) + +version 1.4.8 (10/16/10) + - ignoreTimezone option (set to `false` to process UTC offsets in ISO8601 dates) + - bugfixes + - event refetching not being called under certain conditions (issues 417, 554) + - event refetching being called multiple times under certain conditions (issues 586, 616) + - selection cannot be triggered by right mouse button (issue 558) + - agenda view left axis sized incorrectly (issue 465) + - IE js error when calendar is too narrow (issue 517) + - agenda view looks strange when no scrollbars (issue 235) + - improved parsing of ISO8601 dates with UTC offsets + - $.fullCalendar.version + - an internal refactor of the code, for easier future development and modularity + +version 1.4.7 (7/5/10) + - "dropping" external objects onto the calendar + - droppable (boolean, to turn on/off) + - dropAccept (to filter which events the calendar will accept) + - drop (trigger) + - selectable options can now be specified with a View Option Hash + - bugfixes + - dragged & reverted events having wrong time text (issue 406) + - bug rendering events that have an endtime with seconds, but no hours/minutes (issue 477) + - gotoDate date overflow bug (issue 429) + - wrong date reported when clicking on edge of last column in agenda views (412) + - support newlines in event titles + - select/unselect callbacks now passes native js event + +version 1.4.6 (5/31/10) + - "selecting" days or timeslots + - options: selectable, selectHelper, unselectAuto, unselectCancel + - callbacks: select, unselect + - methods: select, unselect + - when dragging an event, the highlighting reflects the duration of the event + - code compressing by Google Closure Compiler + - bundled with jQuery 1.4.2 and jQuery UI 1.8.1 + +version 1.4.5 (2/21/10) + - lazyFetching option, which can force the calendar to fetch events on every view/date change + - scroll state of agenda views are preserved when switching back to view + - bugfixes + - calling methods on an uninitialized fullcalendar throws error + - IE6/7 bug where an entire view becomes invisible (issue 320) + - error when rendering a hidden calendar (in jquery ui tabs for example) in IE (issue 340) + - interconnected bugs related to calendar resizing and scrollbars + - when switching views or clicking prev/next, calendar would "blink" (issue 333) + - liquid-width calendar's events shifted (depending on initial height of browser) (issue 341) + - more robust underlying algorithm for calendar resizing + +version 1.4.4 (2/3/10) + - optimized event rendering in all views (events render in 1/10 the time) + - gotoDate() does not force the calendar to unnecessarily rerender + - render() method now correctly readjusts height + +version 1.4.3 (12/22/09) + - added destroy method + - Google Calendar event pages respect currentTimezone + - caching now handled by jQuery's ajax + - protection from setting aspectRatio to zero + - bugfixes + - parseISO8601 and DST caused certain events to display day before + - button positioning problem in IE6 + - ajax event source removed after recently being added, events still displayed + - event not displayed when end is an empty string + - dynamically setting calendar height when no events have been fetched, throws error + +version 1.4.2 (12/02/09) + - eventAfterRender trigger + - getDate & getView methods + - height & contentHeight options (explicitly sets the pixel height) + - minTime & maxTime options (restricts shown hours in agenda view) + - getters [for all options] and setters [for height, contentHeight, and aspectRatio ONLY! stay tuned..] + - render method now readjusts calendar's size + - bugfixes + - lightbox scripts that use iframes (like fancybox) + - day-of-week classNames were off when firstDay=1 + - guaranteed space on right side of agenda events (even when stacked) + - accepts ISO8601 dates with a space (instead of 'T') + +version 1.4.1 (10/31/09) + - can exclude weekends with new 'weekends' option + - gcal feed 'currentTimezone' option + - bugfixes + - year/month/date option sometimes wouldn't set correctly (depending on current date) + - daylight savings issue caused agenda views to start at 1am (for BST users) + - cleanup of gcal.js code + +version 1.4 (10/19/09) + - agendaWeek and agendaDay views + - added some options for agenda views: + - allDaySlot + - allDayText + - firstHour + - slotMinutes + - defaultEventMinutes + - axisFormat + - modified some existing options/triggers to work with agenda views: + - dragOpacity and timeFormat can now accept a "View Hash" (a new concept) + - dayClick now has an allDay parameter + - eventDrop now has an an allDay parameter + (this will affect those who use revertFunc, adjust parameter list) + - added 'prevYear' and 'nextYear' for buttons in header + - minor change for theme users, ui-state-hover not applied to active/inactive buttons + - added event-color-changing example in docs + - better defaults for right-to-left themed button icons + +version 1.3.2 (10/13/09) + - Bugfixes (please upgrade from 1.3.1!) + - squashed potential infinite loop when addMonths and addDays + is called with an invalid date + - $.fullCalendar.parseDate() now correctly parses IETF format + - when switching views, the 'today' button sticks inactive, fixed + - gotoDate now can accept a single Date argument + - documentation for changes in 1.3.1 and 1.3.2 now on website + +version 1.3.1 (9/30/09) + - Important Bugfixes (please upgrade from 1.3!) + - When current date was late in the month, for long months, and prev/next buttons + were clicked in month-view, some months would be skipped/repeated + - In certain time zones, daylight savings time would cause certain days + to be misnumbered in month-view + - Subtle change in way week interval is chosen when switching from month to basicWeek/basicDay view + - Added 'allDayDefault' option + - Added 'changeView' and 'render' methods + +version 1.3 (9/21/09) + - different 'views': month/basicWeek/basicDay + - more flexible 'header' system for buttons + - themable by jQuery UI themes + - resizable events (require jQuery UI resizable plugin) + - rescoped & rewritten CSS, enhanced default look + - cleaner css & rendering techniques for right-to-left + - reworked options & API to support multiple views / be consistent with jQuery UI + - refactoring of entire codebase + - broken into different JS & CSS files, assembled w/ build scripts + - new test suite for new features, uses firebug-lite + - refactored docs + - Options + + date + + defaultView + + aspectRatio + + disableResizing + + monthNames (use instead of $.fullCalendar.monthNames) + + monthNamesShort (use instead of $.fullCalendar.monthAbbrevs) + + dayNames (use instead of $.fullCalendar.dayNames) + + dayNamesShort (use instead of $.fullCalendar.dayAbbrevs) + + theme + + buttonText + + buttonIcons + x draggable -> editable/disableDragging + x fixedWeeks -> weekMode + x abbrevDayHeadings -> columnFormat + x buttons/title -> header + x eventDragOpacity -> dragOpacity + x eventRevertDuration -> dragRevertDuration + x weekStart -> firstDay + x rightToLeft -> isRTL + x showTime (use 'allDay' CalEvent property instead) + - Triggered Actions + + eventResizeStart + + eventResizeStop + + eventResize + x monthDisplay -> viewDisplay + x resize -> windowResize + 'eventDrop' params changed, can revert if ajax cuts out + - CalEvent Properties + x showTime -> allDay + x draggable -> editable + 'end' is now INCLUSIVE when allDay=true + 'url' now produces a real tag, more native clicking/tab behavior + - Methods: + + renderEvent + x prevMonth -> prev + x nextMonth -> next + x prevYear/nextYear -> moveDate + x refresh -> rerenderEvents/refetchEvents + x removeEvent -> removeEvents + x getEventsByID -> clientEvents + - Utilities: + 'formatDate' format string completely changed (inspired by jQuery UI datepicker + datejs) + 'formatDates' added to support date-ranges + - Google Calendar Options: + x draggable -> editable + - Bugfixes + - gcal extension fetched 25 results max, now fetches all + +version 1.2.1 (6/29/09) + - bugfixes + - allows and corrects invalid end dates for events + - doesn't throw an error in IE while rendering when display:none + - fixed 'loading' callback when used w/ multiple addEventSource calls + - gcal className can now be an array + +version 1.2 (5/31/09) + - expanded API + - 'className' CalEvent attribute + - 'source' CalEvent attribute + - dynamically get/add/remove/update events of current month + - locale improvements: change month/day name text + - better date formatting ($.fullCalendar.formatDate) + - multiple 'event sources' allowed + - dynamically add/remove event sources + - options for prevYear and nextYear buttons + - docs have been reworked (include addition of Google Calendar docs) + - changed behavior of parseDate for number strings + (now interpets as unix timestamp, not MS times) + - bugfixes + - rightToLeft month start bug + - off-by-one errors with month formatting commands + - events from previous months sticking when clicking prev/next quickly + - Google Calendar API changed to work w/ multiple event sources + - can also provide 'className' and 'draggable' options + - date utilties moved from $ to $.fullCalendar + - more documentation in source code + - minified version of fullcalendar.js + - test suit (available from svn) + - top buttons now use +
+ + + + + - -
- - -
- -
+ + + +
From 0c890a501cc7c24fb7eb5a4e4bff35dd2bb56b6d Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Sun, 23 Oct 2011 21:51:56 +0200 Subject: [PATCH 021/136] upgraded the new new button. Didn't and doesn't work in Firefox though --- core/img/actions/upload.png | Bin 0 -> 236 bytes core/img/actions/upload.svg | 73 ++++++++++++++++++++++++++++++++++++ files/css/files.css | 13 ++++--- files/templates/index.php | 10 ++--- 4 files changed, 85 insertions(+), 11 deletions(-) create mode 100644 core/img/actions/upload.png create mode 100644 core/img/actions/upload.svg diff --git a/core/img/actions/upload.png b/core/img/actions/upload.png new file mode 100644 index 0000000000000000000000000000000000000000..5744aad75a8c64eb1494deaadfd6db17c529c479 GIT binary patch literal 236 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf2?p zUk71ECym(^Ktah8*NBqf{Irtt#G+J&^73-M%)IR45I`QM^Y;f!YU6CD!xpX6Qg{BI Zn_r^NbZGurmvEq^44$rjF6*2UngGdGQ$hd$ literal 0 HcmV?d00001 diff --git a/core/img/actions/upload.svg b/core/img/actions/upload.svg new file mode 100644 index 0000000000..91333bb681 --- /dev/null +++ b/core/img/actions/upload.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/files/css/files.css b/files/css/files.css index c6f7621515..0f0a3a6c58 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -4,7 +4,7 @@ /* FILE MENU */ .actions { padding:.3em; float:left; } -.actions input { margin:0; } +.actions input, .actions button { margin:0; } #file_menu { right:0; position:absolute; top:0; } #file_menu a { display:block; float:left; background-image:none; text-decoration:none; } .file_upload_form, #file_newfolder_form { display:inline; float: left; margin-left:0; } @@ -12,11 +12,11 @@ .file_upload_wrapper, #file_newfolder_name { background-repeat:no-repeat; background-position:.5em .5em; padding-left:2em; } .file_upload_wrapper { font-weight:bold; display:-moz-inline-box; /* fallback for older firefox versions*/ display:inline-block; padding-left:0; overflow:hidden; position:relative; margin:0;} .file_upload_wrapper .file_upload_button_wrapper { position:absolute; top:0; left:0; width:100%; height:100%; cursor:pointer; z-index:1000; } -#new { float:left; border-top-right-radius:0; border-bottom-right-radius:0; margin-top:-0.075em; margin-right:0; border-right:none } +#new { float:left; border-top-right-radius:0; border-bottom-right-radius:0; margin:-.075em 0 0 1em; border-right:none; z-index:1010; } #new.active { border-bottom-left-radius:0; border-bottom:none; } #new>a{ padding-left:1em; padding-right:1em; } -#new>ul { display:none; position:fixed; text-align:left; padding:0.5em; background:#f8f8f8; margin-top:0.4em; border:1px solid #ddd; min-width:7em; margin-left:-0.5em; } -#new>ul>li { margin:0.3em; padding-left:1.3em; background-repeat:no-repeat; cursor:pointer; } +#new>ul { display:none; position:fixed; text-align:left; padding:.5em; background:#f8f8f8; margin-top:.4em; border:1px solid #ddd; min-width:7em; margin-left:-.5em; z-index:-1; } +#new>ul>li { margin:.3em; padding-left:2em; background-repeat:no-repeat; cursor:pointer; } #new>ul>li>p { cursor:pointer; } #file_newfolder_name { background-image:url('../../core/img/places/folder.svg'); font-weight:normal; width:7em; } @@ -25,8 +25,9 @@ .file_upload_target { display:none; } .file_upload_start { opacity:0; filter:alpha(opacity=0); z-index:1; position:absolute; left:0; top:0; width:100%; cursor:pointer;} -input.file_upload_filename.active { border-bottom-right-radius:0 } -input.file_upload_filename { z-index:100; cursor:pointer; border-top-left-radius:0; border-bottom-left-radius:0; } +.file_upload_filename.active { border-bottom-right-radius:0 } +.file_upload_filename { z-index:100; cursor:pointer; border-top-left-radius:0; border-bottom-left-radius:0; padding:.3em; } + .file_upload_form, .file_upload_wrapper, .file_upload_start, .file_upload_filename, #file_upload_submit { cursor:pointer; } diff --git a/files/templates/index.php b/files/templates/index.php index 902c5cfa14..cb1ab68808 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -7,9 +7,9 @@ t('New');?>
@@ -17,9 +17,9 @@ - + - +
From 950018b5c393898173ebb5ccb515ff12e836f6af Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Tue, 25 Oct 2011 19:56:57 +0200 Subject: [PATCH 022/136] Fix scrolling calendar --- apps/calendar/js/calendar.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js index afbb1b2858..d63b9df36f 100644 --- a/apps/calendar/js/calendar.js +++ b/apps/calendar/js/calendar.js @@ -204,9 +204,12 @@ Calendar={ direction = 'down'; } } - if(direction == 'down'){ + var scroll = $(document).scrollTop(), + doc_height = $(document).height(), + win_height = $(window).height(); + if(direction == 'down' && win_height == (doc_height - scroll)){ $('#calendar_holder').fullCalendar('next'); - }else{ + }else if (direction == 'top' && scroll == 0) { $('#calendar_holder').fullCalendar('prev'); } }, @@ -483,7 +486,7 @@ function ListView(element, calendar) { } } $(document).ready(function(){ - //Calendar.UI.initScroll(); + Calendar.UI.initScroll(); $('#calendar_holder').fullCalendar({ header: false, firstDay: 1, From 50649ad0d19e8dc8ad3f2366673217c752d1774c Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Tue, 25 Oct 2011 19:57:20 +0200 Subject: [PATCH 023/136] Implement select event creation --- apps/calendar/ajax/neweventform.php | 48 +++++++++++++---------------- apps/calendar/js/calendar.js | 35 ++++++--------------- 2 files changed, 31 insertions(+), 52 deletions(-) diff --git a/apps/calendar/ajax/neweventform.php b/apps/calendar/ajax/neweventform.php index d02b116347..588d364871 100644 --- a/apps/calendar/ajax/neweventform.php +++ b/apps/calendar/ajax/neweventform.php @@ -15,39 +15,35 @@ if(!OC_USER::isLoggedIn()) { } OC_JSON::checkAppEnabled('calendar'); +if (!isset($_POST['start'])){ + OC_JSON::error(); + die; +} +$start = $_POST['start']; +$end = $_POST['end']; +$allday = $_POST['allday']; + +if (!$end){ + $duration = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'duration', '60'); + $end = $start + ($duration * 60); +} +$start = new DateTime('@'.$start); +$end = new DateTime('@'.$end); +$timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', 'Europe/London'); +$start->setTimezone(new DateTimeZone($timezone)); +$end->setTimezone(new DateTimeZone($timezone)); + $calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); $category_options = OC_Calendar_Object::getCategoryOptions($l10n); $repeat_options = OC_Calendar_Object::getRepeatOptions($l10n); -$startday = substr($_GET['d'], 0, 2); -$startmonth = substr($_GET['d'], 2, 2); -$startyear = substr($_GET['d'], 4, 4); -$allday = $_GET['t'] == 'allday'; -if(!$allday){ - $starthour = substr($_GET['t'], 0, 2); - $startminutes = substr($_GET['t'], 2, 2); -}else{ - $starthour = '00'; - $startminutes = '00'; -} - -$datetimestamp = mktime($starthour, $startminutes, 0, $startmonth, $startday, $startyear); -$duration = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'duration', "60"); -$datetimestamp = $datetimestamp + ($duration * 60); -$endmonth = date("m", $datetimestamp); -$endday = date("d", $datetimestamp); -$endyear = date("Y", $datetimestamp); -$endtime = date("G", $datetimestamp); -$endminutes = date("i", $datetimestamp); - - $tmpl = new OC_Template('calendar', 'part.newevent'); $tmpl->assign('calendar_options', $calendar_options); $tmpl->assign('category_options', $category_options); -$tmpl->assign('startdate', $startday . '-' . $startmonth . '-' . $startyear); -$tmpl->assign('starttime', $starthour . ':' . $startminutes); -$tmpl->assign('enddate', $endday . '-' . $endmonth . '-' . $endyear); -$tmpl->assign('endtime', ($endtime <= 9 ? '0' : '') . $endtime . ':' . $endminutes); +$tmpl->assign('startdate', $start->format('d-m-Y')); +$tmpl->assign('starttime', $start->format('H:i')); +$tmpl->assign('enddate', $end->format('d-m-Y')); +$tmpl->assign('endtime', $end->format('H:i')); $tmpl->assign('allday', $allday); $tmpl->printpage(); ?> diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js index d63b9df36f..30015ae68f 100644 --- a/apps/calendar/js/calendar.js +++ b/apps/calendar/js/calendar.js @@ -31,36 +31,17 @@ Calendar={ } }); }, - newEvent:function(date, allDay, jsEvent, view){ - var dayofmonth = date.getDate(); - var month = date.getMonth(); - var year = date.getFullYear(); - var hour = date.getHours(); - var min = date.getMinutes(); - if(dayofmonth <= 9){ - dayofmonth = '0' + dayofmonth; - } - month++; - if(month <= 9){ - month = '0' + month; - } - if(hour <= 9){ - hour = '0' + hour; - } - if(min <= 9){ - min = '0' + min; - } - var date = String(dayofmonth) + String(month) + String(year); - if (allDay){ - var time = 'allday'; - }else{ - var time = String(hour) + String(min); + newEvent:function(start, end, allday){ + start = Math.round(start.getTime()/1000); + if (end){ + end = Math.round(end.getTime()/1000); } + $('#calendar_holder').fullCalendar('unselect'); if($('#event').dialog('isOpen') == true){ // TODO: save event $('#event').dialog('destroy').remove(); }else{ - $('#dialog_holder').load(OC.filePath('calendar', 'ajax', 'neweventform.php') + '?d=' + date + '&t=' + time, Calendar.UI.startEventDialog); + $('#dialog_holder').load(OC.filePath('calendar', 'ajax', 'neweventform.php'), {start:start, end:end, allday:allday?1:0}, Calendar.UI.startEventDialog); } }, editEvent:function(calEvent, jsEvent, view){ @@ -509,7 +490,9 @@ $(document).ready(function(){ $('#datecontrol_date').html(view.title); $.get(OC.filePath('calendar', 'ajax', 'changeview.php') + "?v="+view.name); }, - dayClick: Calendar.UI.newEvent, + selectable: true, + selectHelper: true, + select: Calendar.UI.newEvent, eventClick: Calendar.UI.editEvent, eventDrop: Calendar.UI.moveEvent, eventResize: Calendar.UI.resizeEvent, From 55d957489d3680ca97d70faa70ea15999a7278df Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Tue, 25 Oct 2011 19:59:23 +0200 Subject: [PATCH 024/136] Fix fromtime/totime warnings --- apps/calendar/lib/object.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php index 4afeb341a9..9a343a2376 100644 --- a/apps/calendar/lib/object.php +++ b/apps/calendar/lib/object.php @@ -426,7 +426,7 @@ class OC_Calendar_Object{ $errarr['endbeforestart'] = 'true'; $errnum++; } - if($fromday == $today && $frommonth == $tomonth && $fromyear == $toyear){ + if(!$allday && $fromday == $today && $frommonth == $tomonth && $fromyear == $toyear){ list($tohours, $tominutes) = explode(':', $request['totime']); list($fromhours, $fromminutes) = explode(':', $request['fromtime']); if($tohours < $fromhours){ @@ -481,9 +481,11 @@ class OC_Calendar_Object{ $categories = isset($request["categories"]) ? $request["categories"] : null; $allday = isset($request["allday"]); $from = $request["from"]; - $fromtime = $request["fromtime"]; $to = $request["to"]; - $totime = $request["totime"]; + if (!$allday){ + $fromtime = $request['fromtime']; + $totime = $request['totime']; + } $description = $request["description"]; //$repeat = $request["repeat"]; /*switch($request["repeatfreq"]){ From d0e9c813993f5f02381f52faf34c9a54247f58fb Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Tue, 25 Oct 2011 20:01:04 +0200 Subject: [PATCH 025/136] Quickfix hanging tipsy popups --- apps/calendar/js/calendar.js | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js index 30015ae68f..cdfc521b22 100644 --- a/apps/calendar/js/calendar.js +++ b/apps/calendar/js/calendar.js @@ -10,6 +10,7 @@ Calendar={ space:' ', UI:{ startEventDialog:function(){ + $('.tipsy').remove(); Calendar.UI.lockTime(); $( "#from" ).datepicker({ dateFormat : 'dd-mm-yy' From c0e9c805eceb24d25a57806684d9b5e3e5795e43 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 27 Oct 2011 22:46:52 +0200 Subject: [PATCH 026/136] Disable loading non-existing settings script in bookmark app --- apps/bookmarks/settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/bookmarks/settings.php b/apps/bookmarks/settings.php index 8186472dec..0ace04fa2c 100644 --- a/apps/bookmarks/settings.php +++ b/apps/bookmarks/settings.php @@ -8,6 +8,6 @@ $tmpl = new OC_Template( 'bookmarks', 'settings'); -OC_Util::addScript('bookmarks','settings'); +//OC_Util::addScript('bookmarks','settings'); return $tmpl->fetchPage(); From 6d4d15b221443e0cfb375f9870e34e825cc79c37 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 27 Oct 2011 22:47:56 +0200 Subject: [PATCH 027/136] Fix html id's in part.addcardform.php --- apps/contacts/templates/part.addcardform.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/contacts/templates/part.addcardform.php b/apps/contacts/templates/part.addcardform.php index 8e482cc4eb..a596ad8163 100644 --- a/apps/contacts/templates/part.addcardform.php +++ b/apps/contacts/templates/part.addcardform.php @@ -19,7 +19,7 @@
  1. -
    +
  2. @@ -81,19 +81,19 @@
  3. - +
  4. - +
  5. - +
  6. - +
  7. From 7b01858c570f5d9d70946b257b66ecca144e2fbd Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 27 Oct 2011 22:48:50 +0200 Subject: [PATCH 028/136] Enable php display_errors setting --- lib/base.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/base.php b/lib/base.php index d5fff1e0a7..c52b4493e0 100644 --- a/lib/base.php +++ b/lib/base.php @@ -77,6 +77,9 @@ class OC{ // set some stuff //ob_start(); error_reporting(E_ALL | E_STRICT); + if (defined('DEBUG') && DEBUG){ + ini_set('display_errors', 1); + } date_default_timezone_set('Europe/Berlin'); ini_set('arg_separator.output','&'); From 1e8e2ae353312dacc2a05f1005fa322566cb6012 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 27 Oct 2011 22:54:39 +0200 Subject: [PATCH 029/136] Move unselect call to after the dialog starts --- apps/calendar/js/calendar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js index cdfc521b22..47db5dc5fc 100644 --- a/apps/calendar/js/calendar.js +++ b/apps/calendar/js/calendar.js @@ -11,6 +11,7 @@ Calendar={ UI:{ startEventDialog:function(){ $('.tipsy').remove(); + $('#calendar_holder').fullCalendar('unselect'); Calendar.UI.lockTime(); $( "#from" ).datepicker({ dateFormat : 'dd-mm-yy' @@ -37,7 +38,6 @@ Calendar={ if (end){ end = Math.round(end.getTime()/1000); } - $('#calendar_holder').fullCalendar('unselect'); if($('#event').dialog('isOpen') == true){ // TODO: save event $('#event').dialog('destroy').remove(); From 8dd2f463f826d44299770919b7e9be21d83075f7 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 27 Oct 2011 22:56:22 +0200 Subject: [PATCH 030/136] Cleanup tipsy popups on more actions --- apps/calendar/js/calendar.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js index 47db5dc5fc..e943bee705 100644 --- a/apps/calendar/js/calendar.js +++ b/apps/calendar/js/calendar.js @@ -107,6 +107,7 @@ Calendar={ },"json"); }, moveEvent:function(event, dayDelta, minuteDelta, allDay, revertFunc){ + $('.tipsy').remove(); $.post(OC.filePath('calendar', 'ajax', 'moveevent.php'), { id: event.id, dayDelta: dayDelta, minuteDelta: minuteDelta, allDay: allDay?1:0}, function(data) { if (data.status == 'success'){ @@ -117,6 +118,7 @@ Calendar={ }); }, resizeEvent:function(event, dayDelta, minuteDelta, revertFunc){ + $('.tipsy').remove(); $.post(OC.filePath('calendar', 'ajax', 'resizeevent.php'), { id: event.id, dayDelta: dayDelta, minuteDelta: minuteDelta}, function(data) { if (data.status == 'success'){ @@ -171,6 +173,7 @@ Calendar={ //} }, scrollCalendar:function(event){ + $('.tipsy').remove(); var direction; if(event.detail){ if(event.detail < 0){ From a809fe9a048d53c23bb962da5f1b133f4aac82b8 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sat, 29 Oct 2011 00:27:25 +0200 Subject: [PATCH 031/136] Add a dependencies check apps --- apps/dependencies_chk/appinfo/app.php | 9 ++ apps/dependencies_chk/appinfo/info.xml | 11 +++ apps/dependencies_chk/css/style.css | 9 ++ apps/dependencies_chk/settings.php | 91 ++++++++++++++++++++ apps/dependencies_chk/templates/settings.php | 16 ++++ 5 files changed, 136 insertions(+) create mode 100644 apps/dependencies_chk/appinfo/app.php create mode 100644 apps/dependencies_chk/appinfo/info.xml create mode 100644 apps/dependencies_chk/css/style.css create mode 100644 apps/dependencies_chk/settings.php create mode 100644 apps/dependencies_chk/templates/settings.php diff --git a/apps/dependencies_chk/appinfo/app.php b/apps/dependencies_chk/appinfo/app.php new file mode 100644 index 0000000000..dea2cd39f8 --- /dev/null +++ b/apps/dependencies_chk/appinfo/app.php @@ -0,0 +1,9 @@ + 14, + 'id' => 'dependencies_chk', + 'name' => 'Owncloud Install Info' )); + +OC_APP::registerAdmin('dependencies_chk','settings'); diff --git a/apps/dependencies_chk/appinfo/info.xml b/apps/dependencies_chk/appinfo/info.xml new file mode 100644 index 0000000000..38a6dee256 --- /dev/null +++ b/apps/dependencies_chk/appinfo/info.xml @@ -0,0 +1,11 @@ + + + dependencies_chk + Owncloud dependencies info + 0.01 + MIT + Brice Maron (eMerzh) + 2 + Display OwnCloud's dependencies informations (missings modules, ...) + + diff --git a/apps/dependencies_chk/css/style.css b/apps/dependencies_chk/css/style.css new file mode 100644 index 0000000000..30f204be7b --- /dev/null +++ b/apps/dependencies_chk/css/style.css @@ -0,0 +1,9 @@ +#status_list legend { font-weight: bold; color: #888888; } +.state > li { margin-bottom: 3px; padding-left: 0.5em; list-style-type: circle; } +.state .state_module { font-weight:bold; text-shadow: 0 1px 0 #DDD; cursor:help;} + +.state_used ul, .state_used li { display:inline; } + +.state_ok .state_module { color: #009700; } +.state_warning .state_module { color: #FF9B29; } +.state_error .state_module { color: #FF3B3B; } diff --git a/apps/dependencies_chk/settings.php b/apps/dependencies_chk/settings.php new file mode 100644 index 0000000000..ca60953215 --- /dev/null +++ b/apps/dependencies_chk/settings.php @@ -0,0 +1,91 @@ +. + * + */ +$l=new OC_L10N('dependencies_chk'); +$tmpl = new OC_Template( 'dependencies_chk', 'settings'); + +$modules = array(); + +//Possible status are : ok, error, warning +$modules[] =array( + 'status' => function_exists('json_encode') ? 'ok' : 'error', + 'part'=> 'php-json', + 'modules'=> array('core'), + 'message'=> $l->t('The php-json module is needed by the many application for inter communications')); + +$modules[] =array( + 'status' => function_exists('curl_init') ? 'ok' : 'error', + 'part'=> 'php-curl', + 'modules'=> array('bookmarks'), + 'message'=> $l->t('The php-curl modude is needed to fetch the page title when adding a bookmarks')); + +$modules[] =array( + 'status' => function_exists('imagepng') ? 'ok' : 'error', + 'part'=> 'php-gd', + 'modules'=> array('gallery'), + 'message'=> $l->t('The php-gd module is needed to create thumbnails of your images')); + +$modules[] =array( + 'status' => OC_Helper::canExecute("mp3info") ? 'ok' : 'warning', + 'part'=> 'mp3info', + 'modules'=> array('media'), + 'message'=> $l->t('The program mp3info is useful to discover ID3 tags of your music files')); + +$modules[] =array( + 'status' => OC_Helper::canExecute("ldap_bind") ? 'ok' : 'error', + 'part'=> 'php-ldap', + 'modules'=> array('user_ldap'), + 'message'=> $l->t('The php-ldap module is needed connect to your ldap server')); + +$modules[] =array( + 'status' => class_exists('ZipArchive') ? 'ok' : 'warning', + 'part'=> 'php-zip', + 'modules'=> array('admin_export','core'), + 'message'=> $l->t('The php-zip module is needed download multiple files at once')); + +$modules[] =array( + 'status' => function_exists('mb_detect_encoding') ? 'ok' : 'error', + 'part'=> 'php-mb_multibyte ', + 'modules'=> array('core'), + 'message'=> $l->t('The php-mb_multibyte module is needed to manage correctly the encoding.')); + +$modules[] =array( + 'status' => function_exists('ctype_digit') ? 'ok' : 'error', + 'part'=> 'php-ctype', + 'modules'=> array('core'), + 'message'=> $l->t('The php-ctype module is needed validate data.')); + + +foreach($modules as $key => $module) { + $enabled = false ; + foreach($module['modules'] as $app) { + if(OC_App::isEnabled($app) || $app=='core'){ + $enabled = true; + } + } + if($enabled == false) unset($modules[$key]); +} + +OC_UTIL::addStyle('dependencies_chk', 'style'); +$tmpl->assign( 'items', $modules ); + +return $tmpl->fetchPage(); diff --git a/apps/dependencies_chk/templates/settings.php b/apps/dependencies_chk/templates/settings.php new file mode 100644 index 0000000000..8ff27ebb18 --- /dev/null +++ b/apps/dependencies_chk/templates/settings.php @@ -0,0 +1,16 @@ +
    + t('Dependencies status');?> +
      + +
    • + +
      t('Used by :');?> +
        + +
      • + +
      +
    • + +
    +
    \ No newline at end of file From 5ffec927012a98cdcc409318dd1b2a264f071b83 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sat, 29 Oct 2011 00:49:52 +0200 Subject: [PATCH 032/136] upgrade to Sabredav 1.5.4 --- 3rdparty/Sabre.includes.php | 2 +- 3rdparty/Sabre/CardDAV/AddressBook.php | 10 ++--- 3rdparty/Sabre/CardDAV/Backend/Abstract.php | 14 +++--- 3rdparty/Sabre/CardDAV/Backend/PDO.php | 6 +-- 3rdparty/Sabre/CardDAV/Card.php | 8 +--- 3rdparty/Sabre/CardDAV/ICard.php | 10 ++--- 3rdparty/Sabre/CardDAV/Plugin.php | 9 ++-- 3rdparty/Sabre/CardDAV/UserAddressBooks.php | 8 ++-- 3rdparty/Sabre/CardDAV/Version.php | 6 +-- .../Sabre/DAV/Browser/GuessContentType.php | 2 +- 3rdparty/Sabre/DAV/Server.php | 2 +- 3rdparty/Sabre/DAV/Version.php | 2 +- .../Sabre/DAVACL/Exception/NeedPrivileges.php | 10 ++--- 3rdparty/Sabre/DAVACL/PrincipalCollection.php | 2 +- 3rdparty/Sabre/VObject/Component.php | 13 ++++-- 3rdparty/Sabre/VObject/Element/DateTime.php | 43 +++++++++++++++---- .../Sabre/VObject/Element/MultiDateTime.php | 6 +-- 3rdparty/Sabre/VObject/Node.php | 7 +++ 3rdparty/Sabre/VObject/Property.php | 13 ++++-- 3rdparty/Sabre/VObject/Reader.php | 6 ++- 3rdparty/Sabre/VObject/Version.php | 2 +- 21 files changed, 103 insertions(+), 78 deletions(-) diff --git a/3rdparty/Sabre.includes.php b/3rdparty/Sabre.includes.php index 9d389288c7..d41b287b77 100644 --- a/3rdparty/Sabre.includes.php +++ b/3rdparty/Sabre.includes.php @@ -71,6 +71,7 @@ include 'Sabre/DAV/IExtendedCollection.php'; /* Node abstract implementations */ include 'Sabre/DAV/Node.php'; include 'Sabre/DAV/File.php'; +include 'Sabre/DAV/Collection.php'; include 'Sabre/DAV/Directory.php'; /* Utilities */ @@ -124,4 +125,3 @@ include 'Sabre/DAV/Auth/Backend/PDO.php'; /* DavMount plugin */ include 'Sabre/DAV/Mount/Plugin.php'; - diff --git a/3rdparty/Sabre/CardDAV/AddressBook.php b/3rdparty/Sabre/CardDAV/AddressBook.php index 3333480ea8..471ca7b338 100644 --- a/3rdparty/Sabre/CardDAV/AddressBook.php +++ b/3rdparty/Sabre/CardDAV/AddressBook.php @@ -1,7 +1,9 @@ extensionMap[$extension])) return $this->extensionMap[$extension]; diff --git a/3rdparty/Sabre/DAV/Server.php b/3rdparty/Sabre/DAV/Server.php index b99866dad5..3d76d4f191 100644 --- a/3rdparty/Sabre/DAV/Server.php +++ b/3rdparty/Sabre/DAV/Server.php @@ -821,7 +821,7 @@ class Sabre_DAV_Server { $node->put($body); $this->httpResponse->setHeader('Content-Length','0'); - $this->httpResponse->sendStatus(200); + $this->httpResponse->sendStatus(204); } else { diff --git a/3rdparty/Sabre/DAV/Version.php b/3rdparty/Sabre/DAV/Version.php index e7f7f83e6f..6bece1985e 100644 --- a/3rdparty/Sabre/DAV/Version.php +++ b/3rdparty/Sabre/DAV/Version.php @@ -14,7 +14,7 @@ class Sabre_DAV_Version { /** * Full version number */ - const VERSION = '1.5.3'; + const VERSION = '1.5.4'; /** * Stability : alpha, beta, stable diff --git a/3rdparty/Sabre/DAVACL/Exception/NeedPrivileges.php b/3rdparty/Sabre/DAVACL/Exception/NeedPrivileges.php index 640ab8efff..024ab6641f 100644 --- a/3rdparty/Sabre/DAVACL/Exception/NeedPrivileges.php +++ b/3rdparty/Sabre/DAVACL/Exception/NeedPrivileges.php @@ -2,6 +2,9 @@ /** * NeedPrivileges + * + * The 403-need privileges is thrown when a user didn't have the appropriate + * permissions to perform an operation * * @package Sabre * @subpackage DAVACL @@ -10,13 +13,6 @@ * @author Evert Pot (http://www.rooftopsolutions.nl/) * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License */ - -/** - * NeedPrivileges - * - * The 403-need privileges is thrown when a user didn't have the appropriate - * permissions to perform an operation - */ class Sabre_DAVACL_Exception_NeedPrivileges extends Sabre_DAV_Exception_Forbidden { /** diff --git a/3rdparty/Sabre/DAVACL/PrincipalCollection.php b/3rdparty/Sabre/DAVACL/PrincipalCollection.php index 3cc0ae8462..4d22bf8aa7 100644 --- a/3rdparty/Sabre/DAVACL/PrincipalCollection.php +++ b/3rdparty/Sabre/DAVACL/PrincipalCollection.php @@ -9,7 +9,7 @@ * The users are instances of Sabre_DAV_Auth_Principal * * @package Sabre - * @subpackage DAV + * @subpackage DAVACL * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved. * @author Evert Pot (http://www.rooftopsolutions.nl/) * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License diff --git a/3rdparty/Sabre/VObject/Component.php b/3rdparty/Sabre/VObject/Component.php index 3d5a3d7563..47cf9f3d81 100644 --- a/3rdparty/Sabre/VObject/Component.php +++ b/3rdparty/Sabre/VObject/Component.php @@ -83,13 +83,16 @@ class Sabre_VObject_Component extends Sabre_VObject_Element { if (!is_null($itemValue)) { throw new InvalidArgumentException('The second argument must not be specified, when passing a VObject'); } + $item->parent = $this; $this->children[] = $item; } elseif(is_string($item)) { if (!is_scalar($itemValue)) { throw new InvalidArgumentException('The second argument must be scalar'); } - $this->children[] = new Sabre_VObject_Property($item,$itemValue); + $item = new Sabre_VObject_Property($item,$itemValue); + $item->parent = $this; + $this->children[] = $item; } else { @@ -208,16 +211,19 @@ class Sabre_VObject_Component extends Sabre_VObject_Element { $overWrite = count($matches)?key($matches):null; if ($value instanceof Sabre_VObject_Component || $value instanceof Sabre_VObject_Property) { + $value->parent = $this; if (!is_null($overWrite)) { $this->children[$overWrite] = $value; } else { $this->children[] = $value; } } elseif (is_scalar($value)) { + $property = new Sabre_VObject_Property($name,$value); + $property->parent = $this; if (!is_null($overWrite)) { - $this->children[$overWrite] = new Sabre_VObject_Property($name,$value); + $this->children[$overWrite] = $property; } else { - $this->children[] = new Sabre_VObject_Property($name,$value); + $this->children[] = $property; } } else { throw new InvalidArgumentException('You must pass a Sabre_VObject_Component, Sabre_VObject_Property or scalar type'); @@ -237,6 +243,7 @@ class Sabre_VObject_Component extends Sabre_VObject_Element { foreach($matches as $k=>$child) { unset($this->children[$k]); + $child->parent = null; } diff --git a/3rdparty/Sabre/VObject/Element/DateTime.php b/3rdparty/Sabre/VObject/Element/DateTime.php index 30e5c6ca86..3350ec02c8 100644 --- a/3rdparty/Sabre/VObject/Element/DateTime.php +++ b/3rdparty/Sabre/VObject/Element/DateTime.php @@ -70,7 +70,7 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property { $this->setValue($dt->format('Ymd\\THis')); $this->offsetUnset('VALUE'); $this->offsetUnset('TZID'); - $this->offsetSet('VALUE','DATE-TIME'); + $this->offsetSet('VALUE','DATE-TIME'); break; case self::UTC : $dt->setTimeZone(new DateTimeZone('UTC')); @@ -116,7 +116,7 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property { list( $this->dateType, $this->dateTime - ) = self::parseData($this->value, $this->offsetGet('TZID')); + ) = self::parseData($this->value, $this); return $this->dateTime; } @@ -137,7 +137,7 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property { list( $this->dateType, $this->dateTime, - ) = self::parseData($this->value, $this->offsetGet('TZID')); + ) = self::parseData($this->value, $this); return $this->dateType; } @@ -151,12 +151,12 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property { * 2. A DateTime object (or null) * * @param string|null $propertyValue The string to parse (yymmdd or - * ymmddThhmmss, etc..) - * @param string|null $tzid The value of the 'TZID' property. + * ymmddThhmmss, etc..) + * @param Sabre_VObject_Property|null $property The instance of the + * property we're parsing. * @return array */ - static public function parseData($propertyValue, $tzid) { - + static public function parseData($propertyValue, Sabre_VObject_Property $property = null) { if (is_null($propertyValue)) { return array(null, null); @@ -195,6 +195,8 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property { ); } + // Finding the timezone. + $tzid = $property['TZID']; if (!$tzid) { return array( self::LOCAL, @@ -202,7 +204,32 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property { ); } - $tz = new DateTimeZone($tzid->value); + try { + $tz = new DateTimeZone($tzid->value); + } catch (Exception $e) { + + // The id was invalid, we're going to try to find the information + // through the VTIMEZONE object. + + // First we find the root object + $root = $property; + while($root->parent) { + $root = $root->parent; + } + + if (isset($root->VTIMEZONE)) { + foreach($root->VTIMEZONE as $vtimezone) { + if (((string)$vtimezone->TZID) == $tzid) { + if (isset($vtimezone->{'X-LIC-LOCATION'})) { + $tzid = (string)$vtimezone->{'X-LIC-LOCATION'}; + } + } + } + } + + $tz = new DateTimeZone($tzid); + + } $dt = new DateTime($dateStr, $tz); $dt->setTimeZone($tz); diff --git a/3rdparty/Sabre/VObject/Element/MultiDateTime.php b/3rdparty/Sabre/VObject/Element/MultiDateTime.php index 5e677f5e5b..dc6ca5abb8 100644 --- a/3rdparty/Sabre/VObject/Element/MultiDateTime.php +++ b/3rdparty/Sabre/VObject/Element/MultiDateTime.php @@ -60,7 +60,7 @@ class Sabre_VObject_Element_MultiDateTime extends Sabre_VObject_Property { $val[] = $i->format('Ymd\\THis'); } $this->setValue(implode(',',$val)); - $this->offsetSet('VALUE','DATE-TIME'); + $this->offsetSet('VALUE','DATE-TIME'); break; case Sabre_VObject_Element_DateTime::UTC : $val = array(); @@ -121,7 +121,7 @@ class Sabre_VObject_Element_MultiDateTime extends Sabre_VObject_Property { list( $type, $dt - ) = Sabre_VObject_Element_DateTime::parseData($val, $this->offsetGet('TZID')); + ) = Sabre_VObject_Element_DateTime::parseData($val, $this); $dts[] = $dt; $this->dateType = $type; } @@ -154,7 +154,7 @@ class Sabre_VObject_Element_MultiDateTime extends Sabre_VObject_Property { list( $type, $dt - ) = Sabre_VObject_Element_DateTime::parseData($val, $this->offsetGet('TZID')); + ) = Sabre_VObject_Element_DateTime::parseData($val, $this); $dts[] = $dt; $this->dateType = $type; } diff --git a/3rdparty/Sabre/VObject/Node.php b/3rdparty/Sabre/VObject/Node.php index efc7f76da7..7100b62f1c 100644 --- a/3rdparty/Sabre/VObject/Node.php +++ b/3rdparty/Sabre/VObject/Node.php @@ -25,6 +25,13 @@ abstract class Sabre_VObject_Node implements IteratorAggregate, ArrayAccess, Cou */ protected $iterator = null; + /** + * A link to the parent node + * + * @var Sabre_VObject_Node + */ + protected $parent = null; + /* {{{ IteratorAggregator interface */ /** diff --git a/3rdparty/Sabre/VObject/Property.php b/3rdparty/Sabre/VObject/Property.php index 624dd4b8a5..0605822904 100644 --- a/3rdparty/Sabre/VObject/Property.php +++ b/3rdparty/Sabre/VObject/Property.php @@ -149,13 +149,16 @@ class Sabre_VObject_Property extends Sabre_VObject_Element { if (!is_null($itemValue)) { throw new InvalidArgumentException('The second argument must not be specified, when passing a VObject'); } + $item->parent = $this; $this->parameters[] = $item; } elseif(is_string($item)) { if (!is_scalar($itemValue)) { throw new InvalidArgumentException('The second argument must be scalar'); } - $this->parameters[] = new Sabre_VObject_Parameter($item,$itemValue); + $parameter = new Sabre_VObject_Parameter($item,$itemValue); + $parameter->parent = $this; + $this->parameters[] = $parameter; } else { @@ -231,12 +234,15 @@ class Sabre_VObject_Property extends Sabre_VObject_Element { throw new InvalidArgumentException('A parameter name must be specified. This means you cannot use the $array[]="string" to add parameters.'); $this->offsetUnset($name); - $this->parameters[] = new Sabre_VObject_Parameter($name, $value); + $parameter = new Sabre_VObject_Parameter($name, $value); + $parameter->parent = $this; + $this->parameters[] = $parameter; } elseif ($value instanceof Sabre_VObject_Parameter) { if (!is_null($name)) throw new InvalidArgumentException('Don\'t specify a parameter name if you\'re passing a Sabre_VObject_Parameter. Add using $array[]=$parameterObject.'); - + + $value->parent = $this; $this->parameters[] = $value; } else { throw new InvalidArgumentException('You can only add parameters to the property object'); @@ -258,6 +264,7 @@ class Sabre_VObject_Property extends Sabre_VObject_Element { $result = array(); foreach($this->parameters as $key=>$parameter) { if ($parameter->name == $name) { + $parameter->parent = null; unset($this->parameters[$key]); } diff --git a/3rdparty/Sabre/VObject/Reader.php b/3rdparty/Sabre/VObject/Reader.php index c38afbfb63..5ed7882ac9 100644 --- a/3rdparty/Sabre/VObject/Reader.php +++ b/3rdparty/Sabre/VObject/Reader.php @@ -95,7 +95,7 @@ class Sabre_VObject_Reader { while(stripos($nextLine,"END:")!==0) { - $obj->children[] = self::readLine($lines); + $obj->add(self::readLine($lines)); $nextLine = current($lines); if ($nextLine===false) @@ -140,7 +140,9 @@ class Sabre_VObject_Reader { if ($matches['parameters']) { - $obj->parameters = self::readParameters($matches['parameters']); + foreach(self::readParameters($matches['parameters']) as $param) { + $obj->add($param); + } } return $obj; diff --git a/3rdparty/Sabre/VObject/Version.php b/3rdparty/Sabre/VObject/Version.php index 950c1c5110..937c367e22 100644 --- a/3rdparty/Sabre/VObject/Version.php +++ b/3rdparty/Sabre/VObject/Version.php @@ -14,7 +14,7 @@ class Sabre_VObject_Version { /** * Full version number */ - const VERSION = '1.2.2'; + const VERSION = '1.2.4'; /** * Stability : alpha, beta, stable From a21908cf18fe139976a4eec494c0dce037c08841 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sat, 29 Oct 2011 10:07:01 +0200 Subject: [PATCH 033/136] Change name and fix a typo --- apps/admin_dependencies_chk/appinfo/app.php | 9 +++++++++ .../appinfo/info.xml | 2 +- .../css/style.css | 0 .../settings.php | 8 ++++---- .../templates/settings.php | 0 apps/dependencies_chk/appinfo/app.php | 9 --------- 6 files changed, 14 insertions(+), 14 deletions(-) create mode 100644 apps/admin_dependencies_chk/appinfo/app.php rename apps/{dependencies_chk => admin_dependencies_chk}/appinfo/info.xml (90%) rename apps/{dependencies_chk => admin_dependencies_chk}/css/style.css (100%) rename apps/{dependencies_chk => admin_dependencies_chk}/settings.php (93%) rename apps/{dependencies_chk => admin_dependencies_chk}/templates/settings.php (100%) delete mode 100644 apps/dependencies_chk/appinfo/app.php diff --git a/apps/admin_dependencies_chk/appinfo/app.php b/apps/admin_dependencies_chk/appinfo/app.php new file mode 100644 index 0000000000..e2169b5dd7 --- /dev/null +++ b/apps/admin_dependencies_chk/appinfo/app.php @@ -0,0 +1,9 @@ + 14, + 'id' => 'admin_dependencies_chk', + 'name' => 'Owncloud Install Info' )); + +OC_APP::registerAdmin('admin_dependencies_chk','settings'); diff --git a/apps/dependencies_chk/appinfo/info.xml b/apps/admin_dependencies_chk/appinfo/info.xml similarity index 90% rename from apps/dependencies_chk/appinfo/info.xml rename to apps/admin_dependencies_chk/appinfo/info.xml index 38a6dee256..7216a1ee86 100644 --- a/apps/dependencies_chk/appinfo/info.xml +++ b/apps/admin_dependencies_chk/appinfo/info.xml @@ -1,6 +1,6 @@ - dependencies_chk + admin_dependencies_chk Owncloud dependencies info 0.01 MIT diff --git a/apps/dependencies_chk/css/style.css b/apps/admin_dependencies_chk/css/style.css similarity index 100% rename from apps/dependencies_chk/css/style.css rename to apps/admin_dependencies_chk/css/style.css diff --git a/apps/dependencies_chk/settings.php b/apps/admin_dependencies_chk/settings.php similarity index 93% rename from apps/dependencies_chk/settings.php rename to apps/admin_dependencies_chk/settings.php index ca60953215..a3c9396497 100644 --- a/apps/dependencies_chk/settings.php +++ b/apps/admin_dependencies_chk/settings.php @@ -20,8 +20,8 @@ * License along with this library. If not, see . * */ -$l=new OC_L10N('dependencies_chk'); -$tmpl = new OC_Template( 'dependencies_chk', 'settings'); +$l=new OC_L10N('admin_dependencies_chk'); +$tmpl = new OC_Template( 'admin_dependencies_chk', 'settings'); $modules = array(); @@ -30,7 +30,7 @@ $modules[] =array( 'status' => function_exists('json_encode') ? 'ok' : 'error', 'part'=> 'php-json', 'modules'=> array('core'), - 'message'=> $l->t('The php-json module is needed by the many application for inter communications')); + 'message'=> $l->t('The php-json module is needed by the many applications for inter communications')); $modules[] =array( 'status' => function_exists('curl_init') ? 'ok' : 'error', @@ -85,7 +85,7 @@ foreach($modules as $key => $module) { if($enabled == false) unset($modules[$key]); } -OC_UTIL::addStyle('dependencies_chk', 'style'); +OC_UTIL::addStyle('admin_dependencies_chk', 'style'); $tmpl->assign( 'items', $modules ); return $tmpl->fetchPage(); diff --git a/apps/dependencies_chk/templates/settings.php b/apps/admin_dependencies_chk/templates/settings.php similarity index 100% rename from apps/dependencies_chk/templates/settings.php rename to apps/admin_dependencies_chk/templates/settings.php diff --git a/apps/dependencies_chk/appinfo/app.php b/apps/dependencies_chk/appinfo/app.php deleted file mode 100644 index dea2cd39f8..0000000000 --- a/apps/dependencies_chk/appinfo/app.php +++ /dev/null @@ -1,9 +0,0 @@ - 14, - 'id' => 'dependencies_chk', - 'name' => 'Owncloud Install Info' )); - -OC_APP::registerAdmin('dependencies_chk','settings'); From eaad3ab45fa8a1d33a24afd7147b674aa79434ee Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sat, 29 Oct 2011 10:15:29 +0200 Subject: [PATCH 034/136] Be consistent with licencing --- apps/admin_dependencies_chk/appinfo/info.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/admin_dependencies_chk/appinfo/info.xml b/apps/admin_dependencies_chk/appinfo/info.xml index 7216a1ee86..10721ece15 100644 --- a/apps/admin_dependencies_chk/appinfo/info.xml +++ b/apps/admin_dependencies_chk/appinfo/info.xml @@ -3,7 +3,7 @@ admin_dependencies_chk Owncloud dependencies info 0.01 - MIT + AGPL Brice Maron (eMerzh) 2 Display OwnCloud's dependencies informations (missings modules, ...) From e533e82bc9526ef9869b20e99b745c210348218f Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sat, 29 Oct 2011 11:40:48 +0200 Subject: [PATCH 035/136] Add sequence name in insertid to be more portable --- apps/bookmarks/ajax/addBookmark.php | 8 +------- apps/calendar/lib/calendar.php | 4 ++-- apps/calendar/lib/object.php | 4 ++-- apps/contacts/lib/addressbook.php | 4 ++-- apps/contacts/lib/vcard.php | 4 ++-- apps/media/lib_collection.php | 2 +- lib/db.php | 10 ++++++++-- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/apps/bookmarks/ajax/addBookmark.php b/apps/bookmarks/ajax/addBookmark.php index 3975fd15f8..45b16ae5fa 100644 --- a/apps/bookmarks/ajax/addBookmark.php +++ b/apps/bookmarks/ajax/addBookmark.php @@ -54,13 +54,7 @@ $params=array( ); $query->execute($params); -if($CONFIG_DBTYPE == 'pgsql') -{ - $query = OC_DB::prepare("SELECT currval('*PREFIX*bookmarks_id_seq')"); - $b_id = $query->execute()->fetchOne(); -} else { - $b_id = OC_DB::insertid(); -} +$b_id = OC_DB::insertid('*PREFIX*bookmarks'); if($b_id !== false) { diff --git a/apps/calendar/lib/calendar.php b/apps/calendar/lib/calendar.php index c19c0e73c0..f6d40aa534 100644 --- a/apps/calendar/lib/calendar.php +++ b/apps/calendar/lib/calendar.php @@ -111,7 +111,7 @@ class OC_Calendar_Calendar{ $stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*calendar_calendars (userid,displayname,uri,ctag,calendarorder,calendarcolor,timezone,components) VALUES(?,?,?,?,?,?,?,?)' ); $result = $stmt->execute(array($userid,$name,$uri,1,$order,$color,$timezone,$components)); - return OC_DB::insertid(); + return OC_DB::insertid('*PREFIX*calendar_calendar'); } /** @@ -131,7 +131,7 @@ class OC_Calendar_Calendar{ $stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*calendar_calendars (userid,displayname,uri,ctag,calendarorder,calendarcolor,timezone,components) VALUES(?,?,?,?,?,?,?,?)' ); $result = $stmt->execute(array($userid,$name,$uri,1,$order,$color,$timezone,$components)); - return OC_DB::insertid(); + return OC_DB::insertid('*PREFIX*calendar_calendars'); } /** diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php index 0c3e497d4f..33871cd318 100644 --- a/apps/calendar/lib/object.php +++ b/apps/calendar/lib/object.php @@ -78,7 +78,7 @@ class OC_Calendar_Object{ OC_Calendar_Calendar::touchCalendar($id); - return OC_DB::insertid(); + return OC_DB::insertid('*PREFIX*calendar_objects'); } /** @@ -97,7 +97,7 @@ class OC_Calendar_Object{ OC_Calendar_Calendar::touchCalendar($id); - return OC_DB::insertid(); + return OC_DB::insertid('*PREFIX*calendar_objects'); } /** diff --git a/apps/contacts/lib/addressbook.php b/apps/contacts/lib/addressbook.php index 2e869d7de3..87477ed7ed 100644 --- a/apps/contacts/lib/addressbook.php +++ b/apps/contacts/lib/addressbook.php @@ -96,7 +96,7 @@ class OC_Contacts_Addressbook{ $stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_addressbooks (userid,displayname,uri,description,ctag) VALUES(?,?,?,?,?)' ); $result = $stmt->execute(array($userid,$name,$uri,$description,1)); - return OC_DB::insertid(); + return OC_DB::insertid('*PREFIX*contacts_addressbooks'); } /** @@ -113,7 +113,7 @@ class OC_Contacts_Addressbook{ $stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_addressbooks (userid,displayname,uri,description,ctag) VALUES(?,?,?,?,?)' ); $result = $stmt->execute(array($userid,$name,$uri,$description,1)); - return OC_DB::insertid(); + return OC_DB::insertid('*PREFIX*contacts_addressbooks'); } /** diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php index 74bc0f92f1..adfa32b6f5 100644 --- a/apps/contacts/lib/vcard.php +++ b/apps/contacts/lib/vcard.php @@ -121,7 +121,7 @@ class OC_Contacts_VCard{ OC_Contacts_Addressbook::touch($id); - return OC_DB::insertid(); + return OC_DB::insertid('*PREFIX*contacts_cards'); } /** @@ -147,7 +147,7 @@ class OC_Contacts_VCard{ OC_Contacts_Addressbook::touch($id); - return OC_DB::insertid(); + return OC_DB::insertid('*PREFIX*contacts_cards'); } /** diff --git a/apps/media/lib_collection.php b/apps/media/lib_collection.php index 571cb7e685..caa3ac3f47 100644 --- a/apps/media/lib_collection.php +++ b/apps/media/lib_collection.php @@ -267,7 +267,7 @@ class OC_MEDIA_COLLECTION{ $query=self::$queries['addsong']; } $query->execute(array($name,$artist,$album,$path,$uid,$length,$track,$size)); - $songId=OC_DB::insertid(); + $songId=OC_DB::insertid('*PREFIX*media_songs'); // self::setLastUpdated(); return self::getSongId($name,$artist,$album); } diff --git a/lib/db.php b/lib/db.php index 421b08c232..c059f5ab33 100644 --- a/lib/db.php +++ b/lib/db.php @@ -224,6 +224,7 @@ class OC_DB { /** * @brief gets last value of autoincrement + * @param $table string The optional table name (will replace *PREFIX*) and add sequence suffix * @returns id * * MDB2 lastInsertID() @@ -231,9 +232,14 @@ class OC_DB { * Call this method right after the insert command or other functions may * cause trouble! */ - public static function insertid(){ + public static function insertid($table=null){ self::connect(); - return self::$connection->lastInsertId(); + if($table !== null){ + $prefix = OC_Config::getValue( "dbtableprefix", "oc_" ); + $suffix = OC_Config::getValue( "dbsequencesuffix", "_id_seq" ); + $table = str_replace( '*PREFIX*', $prefix, $table ); + } + return self::$connection->lastInsertId($table.$suffix); } /** From c7d1737d47c1846beee5d145dd73dd7924a6eea9 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Tue, 1 Nov 2011 22:35:13 +0100 Subject: [PATCH 036/136] attempt to manage some special chars in file list Added a jquery function to filter by attributes. Add more logging in rename file Use the new function to avoid errors --- apps/files_sharing/js/share.js | 6 ++-- core/js/js.js | 7 +++++ files/js/fileactions.js | 2 +- files/js/filelist.js | 54 +++++++++++++++++++--------------- files/js/files.js | 11 +++++-- files/templates/part.list.php | 2 +- lib/filestorage/local.php | 5 ++++ 7 files changed, 56 insertions(+), 31 deletions(-) diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index c0fc91e92a..131571351c 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -10,7 +10,7 @@ $(document).ready(function() { type: 'GET', url: OC.linkTo('files_sharing', 'ajax/getitem.php'), dataType: 'json', - data: 'source='+file, + data: {source: file}, async: false, success: function(users) { if (users) { @@ -184,8 +184,8 @@ function createDropdown(filename, files) { html += ''; html += ''; if (filename) { - $('tr[data-file="'+filename+'"]').addClass('mouseOver'); - $(html).appendTo($('tr[data-file="'+filename+'"] td.filename')); + $('tr').filterAttr('data-file',filename).addClass('mouseOver'); + $(html).appendTo($('tr').filterAttr('data-file',filename).find('td.filename')); } else { $(html).appendTo($('thead .share')); } diff --git a/core/js/js.js b/core/js/js.js index 9e814ca072..440f504c8f 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -401,3 +401,10 @@ if (!Array.prototype.map){ return res; }; } + +/** + * Filter Jquery selector by attribute value + **/ +$.fn.filterAttr = function(attr_name, attr_value) { + return this.filter(function() { return $(this).attr(attr_name) === attr_value; }); +}; diff --git a/files/js/fileactions.js b/files/js/fileactions.js index f95c5e84dc..9e2688e82c 100644 --- a/files/js/fileactions.js +++ b/files/js/fileactions.js @@ -56,7 +56,7 @@ FileActions={ $('#fileList .action').remove(); var actions=FileActions.get(FileActions.getCurrentMimeType(),FileActions.getCurrentType()); var file=FileActions.getCurrentFile(); - if($('tr[data-file="'+file+'"]').data('renaming')){ + if($('tr').filterAttr('data-file',file).data('renaming')){ return; } var defaultAction=FileActions.getDefault(FileActions.getCurrentMimeType(),FileActions.getCurrentType()); diff --git a/files/js/filelist.js b/files/js/filelist.js index 863a3385d1..5740ece971 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -4,7 +4,7 @@ FileList={ }, addFile:function(name,size,lastModified,loading){ var img=(loading)?OC.imagePath('core', 'loading.gif'):OC.imagePath('core', 'filetypes/file.png'); - var html=''; + var html=''; if(name.indexOf('.')!=-1){ var basename=name.substr(0,name.lastIndexOf('.')); var extention=name.substr(name.lastIndexOf('.')); @@ -29,16 +29,21 @@ FileList={ html+=''+simpleSize+''; html+=''+relative_modified_date(lastModified.getTime() / 1000)+''; html+=''; - FileList.insertElement(name,'file',$(html)); + FileList.insertElement(name,'file',$(html).attr('data-file',name)); if(loading){ - $('tr[data-file="'+name+'"]').data('loading',true); + $('tr').filterAttr('data-file',name).data('loading',true); }else{ - $('tr[data-file="'+name+'"] td.filename').draggable(dragOptions); + $('tr').filterAttr('data-file',name).find('td.filename').draggable(dragOptions); } }, addDir:function(name,size,lastModified){ - var html=''; - html+=''+name+''; + html = $('').attr({ "data-type": "dir", "data-size": size, "data-file": name}); + td = $('').attr({"class": "filename", "style": 'background-image:url('+OC.imagePath('core', 'filetypes/folder.png')+')' }); + td.append(''); + var link_elem = $('').attr({ "class": "name", "href": "index.php?dir="+ encodeURIComponent($('#dir').val()+'/'+name) }); + link_elem.append($('').addClass('nametext').text(name)); + td.append(link_elem); + html.append(td); if(size!='Pending'){ simpleSize=simpleFileSize(size); }else{ @@ -47,13 +52,15 @@ FileList={ sizeColor = Math.round(200-Math.pow((size/(1024*1024)),2)); lastModifiedTime=Math.round(lastModified.getTime() / 1000); modifiedColor=Math.round((Math.round((new Date()).getTime() / 1000)-lastModifiedTime)/60/60/24*5); - html+=''+simpleSize+''; - html+=''+relative_modified_date(lastModified.getTime() / 1000)+''; - html+=''; + td = $('').attr({ "class": "filesize", "title": humanFileSize(size), "style": 'color:rgb('+sizeColor+','+sizeColor+','+sizeColor+')'}).text(simpleSize); + html.append(td); - FileList.insertElement(name,'dir',$(html)); - $('tr[data-file="'+name+'"] td.filename').draggable(dragOptions); - $('tr[data-file="'+name+'"] td.filename').droppable(folderDropOptions); + td = $('').attr({ "class": "date" }); + td.append($('').attr({ "class": "modified", "title": formatDate(lastModified), "style": 'color:rgb('+modifiedColor+','+modifiedColor+','+modifiedColor+')' }).text( relative_modified_date(lastModified.getTime() / 1000) )); + html.append(td); + FileList.insertElement(name,'dir',html); + $('tr').filterAttr('data-file',name).find('td.filename').draggable(dragOptions); + $('tr').filterAttr('data-file',name).find('td.filename').droppable(folderDropOptions); }, refresh:function(data) { result = jQuery.parseJSON(data.responseText); @@ -64,8 +71,8 @@ FileList={ resetFileActionPanel(); }, remove:function(name){ - $('tr[data-file="'+name+'"] td.filename').draggable('destroy'); - $('tr[data-file="'+name+'"]').remove(); + $('tr').filterAttr('data-file',name).find('td.filename').draggable('destroy'); + $('tr').filterAttr('data-file',name).remove(); if($('tr[data-file]').length==0){ $('#emptyfolder').show(); $('.file_upload_filename').addClass('highlight'); @@ -101,7 +108,7 @@ FileList={ $('.file_upload_filename').removeClass('highlight'); }, loadingDone:function(name){ - var tr=$('tr[data-file="'+name+'"]'); + var tr=$('tr').filterAttr('data-file',name); tr.data('loading',false); var mime=tr.data('mime'); tr.attr('data-mime',mime); @@ -111,13 +118,13 @@ FileList={ tr.find('td.filename').draggable(dragOptions); }, isLoading:function(name){ - return $('tr[data-file="'+name+'"]').data('loading'); + return $('tr').filterAttr('data-file',name).data('loading'); }, rename:function(name){ - var tr=$('tr[data-file="'+name+'"]'); + var tr=$('tr').filterAttr('data-file',name); tr.data('renaming',true); var td=tr.children('td.filename'); - var input=$(''); + var input=$('').val(name); var form=$('
    ') form.append(input); td.children('a.name').text(''); @@ -143,7 +150,7 @@ FileList={ } $.ajax({ url: 'ajax/rename.php', - data: "dir="+$('#dir').val()+"&newname="+encodeURIComponent(newname)+"&file="+encodeURIComponent(name) + data: { dir : $('#dir').val(), newname: newname, file: name } }); }); form.click(function(event){ @@ -165,9 +172,10 @@ FileList={ files=[files]; } $.each(files,function(index,file){ - $('tr[data-file="'+file+'"]').hide(); - $('tr[data-file="'+file+'"]').find('input[type="checkbox"]').removeAttr('checked'); - $('tr[data-file="'+file+'"]').removeClass('selected'); + var files = $('tr').filterAttr('data-file',file); + files.hide(); + files.find('input[type="checkbox"]').removeAttr('checked'); + files.removeClass('selected'); }); procesSelection(); FileList.deleteCanceled=false; @@ -208,7 +216,7 @@ $(document).ready(function(){ if($('#notification').data('deletefile')) { $.each(FileList.deleteFiles,function(index,file){ - $('tr[data-file="'+file+'"]').show(); + $('tr').filterAttr('data-file',file).show(); // alert(file); }); FileList.deleteCanceled=true; diff --git a/files/js/files.js b/files/js/files.js index 902c5e5493..593eeafde8 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -1,4 +1,9 @@ $(document).ready(function() { + $('#fileList tr').each(function(){ + //little hack to set unescape filenames in attribute + $(this).attr('data-file',unescape($(this).data('file'))); + }); + if($('tr[data-file]').length==0){ $('.file_upload_filename').addClass('highlight'); } @@ -185,9 +190,9 @@ $(document).ready(function() { if(response[0] != undefined && response[0].status == 'success'){ for(var i=0;i200) $relative_date_color = 200; ?> - '> + '> diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php index 01523b6b0b..9e29f85071 100644 --- a/lib/filestorage/local.php +++ b/lib/filestorage/local.php @@ -84,6 +84,11 @@ class OC_Filestorage_Local extends OC_Filestorage{ return $return; } public function rename($path1,$path2){ + if(! $this->file_exists($path1)){ + OC_Log::write('core','unable to rename, file does not exists : '.$path1,OC_Log::ERROR); + return false; + } + if($return=rename($this->datadir.$path1,$this->datadir.$path2)){ $this->clearFolderSizeCache($path1); $this->clearFolderSizeCache($path2); From 13d2c5e926e71a1ef2ef0bce96eb5a6f627cf88f Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Wed, 2 Nov 2011 20:26:17 +0100 Subject: [PATCH 037/136] Fix bug with spaces in file names. --- files/js/files.js | 3 ++- files/templates/part.list.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/files/js/files.js b/files/js/files.js index 593eeafde8..635266164c 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -2,6 +2,7 @@ $(document).ready(function() { $('#fileList tr').each(function(){ //little hack to set unescape filenames in attribute $(this).attr('data-file',unescape($(this).data('file'))); + $(this).data('file',unescape($(this).data('file'))); }); if($('tr[data-file]').length==0){ @@ -69,7 +70,7 @@ $(document).ready(function() { } procesSelection(); } else { - var filename=$(this).parent().parent().data('file'); + var filename=$(this).parent().parent().attr('data-file'); if(!FileList.isLoading(filename)){ var mime=$(this).parent().parent().data('mime'); var type=$(this).parent().parent().data('type'); diff --git a/files/templates/part.list.php b/files/templates/part.list.php index b0ef73c406..46830ba3a3 100644 --- a/files/templates/part.list.php +++ b/files/templates/part.list.php @@ -5,7 +5,7 @@ $relative_modified_date = relative_modified_date($file['mtime']); $relative_date_color = round((time()-$file['mtime'])/60/60/24*14); // the older the file, the brighter the shade of grey; days*14 if($relative_date_color>200) $relative_date_color = 200; ?> - '> + '> From 7b3ae2edd405f31071f43f941615c9da6dd1536e Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 30 Oct 2011 15:40:42 +0100 Subject: [PATCH 038/136] use database table prefix from installer, not the old configured value --- lib/setup.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/setup.php b/lib/setup.php index 2dcedb9b82..e2d56ddaf4 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -82,7 +82,7 @@ class OC_Setup { $dbpass = $options['dbpass']; $dbname = $options['dbname']; $dbhost = $options['dbhost']; - $dbtableprefix = OC_Config::getValue('dbtableprefix','oc_'); + $dbtableprefix = $options['dbtableprefix']; OC_Config::setValue('dbname', $dbname); OC_Config::setValue('dbhost', $dbhost); OC_Config::setValue('dbtableprefix', $dbtableprefix); @@ -135,7 +135,7 @@ class OC_Setup { $dbpass = $options['dbpass']; $dbname = $options['dbname']; $dbhost = $options['dbhost']; - $dbtableprefix = OC_Config::getValue('dbtableprefix','oc_'); + $dbtableprefix = $options['dbtableprefix']; OC_CONFIG::setValue('dbname', $dbname); OC_CONFIG::setValue('dbhost', $dbhost); OC_CONFIG::setValue('dbtableprefix', $dbtableprefix); From e2907eb99db54090ded8332bee5ebb7c94e08b2f Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 3 Nov 2011 12:47:12 +0100 Subject: [PATCH 039/136] no longer rely on PEAR::isError since we can use PDO now --- apps/remoteStorage/lib_remoteStorage.php | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/apps/remoteStorage/lib_remoteStorage.php b/apps/remoteStorage/lib_remoteStorage.php index f10a72870a..4bbadafe7d 100644 --- a/apps/remoteStorage/lib_remoteStorage.php +++ b/apps/remoteStorage/lib_remoteStorage.php @@ -4,12 +4,6 @@ class OC_remoteStorage { public static function getValidTokens($ownCloudUser, $userAddress, $dataScope) { $query=OC_DB::prepare("SELECT token,appUrl FROM *PREFIX*authtoken WHERE user=? AND userAddress=? AND dataScope=? LIMIT 100"); $result=$query->execute(array($ownCloudUser,$userAddress,$dataScope)); - if( PEAR::isError($result)) { - $entry = 'DB Error: "'.$result->getMessage().'"
    '; - $entry .= 'Offending command was: '.$result->getDebugInfo().'
    '; - OC_Log::write('removeStorage',$entry,OC_Log::ERROR); - die( $entry ); - } $ret = array(); while($row=$result->fetchRow()){ $ret[$row['token']]=$userAddress; @@ -21,12 +15,6 @@ class OC_remoteStorage { $user=OC_User::getUser(); $query=OC_DB::prepare("SELECT token,appUrl,userAddress,dataScope FROM *PREFIX*authtoken WHERE user=? LIMIT 100"); $result=$query->execute(array($user)); - if( PEAR::isError($result)) { - $entry = 'DB Error: "'.$result->getMessage().'"
    '; - $entry .= 'Offending command was: '.$result->getDebugInfo().'
    '; - OC_Log::write('removeStorage',$entry,OC_Log::ERROR); - die( $entry ); - } $ret = array(); while($row=$result->fetchRow()){ $ret[$row['token']] = array( @@ -42,23 +30,11 @@ class OC_remoteStorage { $user=OC_User::getUser(); $query=OC_DB::prepare("DELETE FROM *PREFIX*authtoken WHERE token=? AND user=?"); $result=$query->execute(array($token,$user)); - if( PEAR::isError($result)) { - $entry = 'DB Error: "'.$result->getMessage().'"
    '; - $entry .= 'Offending command was: '.$result->getDebugInfo().'
    '; - OC_Log::write('removeStorage',$entry,OC_Log::ERROR); - die( $entry ); - } } private static function addToken($token, $appUrl, $userAddress, $dataScope){ $user=OC_User::getUser(); $query=OC_DB::prepare("INSERT INTO *PREFIX*authtoken (`token`,`appUrl`,`user`,`userAddress`,`dataScope`) VALUES(?,?,?,?,?)"); $result=$query->execute(array($token,$appUrl,$user,$userAddress,$dataScope)); - if( PEAR::isError($result)) { - $entry = 'DB Error: "'.$result->getMessage().'"
    '; - $entry .= 'Offending command was: '.$result->getDebugInfo().'
    '; - OC_Log::write('removeStorage',$entry,OC_Log::ERROR); - die( $entry ); - } } public static function createDataScope($appUrl, $userAddress, $dataScope){ $token=uniqid(); From 8eda6f8febcd8e7320d758e512d2d887d86debb0 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 3 Nov 2011 13:09:44 +0100 Subject: [PATCH 040/136] make webfinger work properly if owncloud is installed in a subdirectory --- apps/user_webfinger/webfinger.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/user_webfinger/webfinger.php b/apps/user_webfinger/webfinger.php index afb5368968..349afaba50 100644 --- a/apps/user_webfinger/webfinger.php +++ b/apps/user_webfinger/webfinger.php @@ -4,7 +4,14 @@ if($_SERVER['SCRIPT_NAME'] == '/.well-known/webfinger.php') { } else { header('Please-first: activate'); } -header("Content-Type: application/xml+xrd"); +// header("Content-Type: application/xml+xrd"); + +// calculate the documentroot +// modified version of the one in lib/base.php that takes the .well-known symlink into account +$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']); +$SERVERROOT=str_replace("\\",'/',dirname(dirname(dirname(dirname(__FILE__))))); +$SUBURI=substr(realpath($_SERVER["SCRIPT_FILENAME"]),strlen($SERVERROOT)); +$WEBROOT=substr($SUBURI,0,-34); if($_GET['q']) { $bits = explode('@', $_GET['q']); @@ -20,5 +27,5 @@ echo "<"; ?xml version="1.0" encoding="UTF-8"?> - + From bf18568e176481f416b28be0e3ee663777031219 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 4 Nov 2011 03:02:51 +0100 Subject: [PATCH 041/136] small styling fix for New button --- files/css/files.css | 5 +++-- files/js/files.js | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/files/css/files.css b/files/css/files.css index 0f0a3a6c58..ecd9d9a790 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -3,7 +3,7 @@ See the COPYING-README file. */ /* FILE MENU */ -.actions { padding:.3em; float:left; } +.actions { padding:.3em; float:left; height:2em; } .actions input, .actions button { margin:0; } #file_menu { right:0; position:absolute; top:0; } #file_menu a { display:block; float:left; background-image:none; text-decoration:none; } @@ -16,8 +16,9 @@ #new.active { border-bottom-left-radius:0; border-bottom:none; } #new>a{ padding-left:1em; padding-right:1em; } #new>ul { display:none; position:fixed; text-align:left; padding:.5em; background:#f8f8f8; margin-top:.4em; border:1px solid #ddd; min-width:7em; margin-left:-.5em; z-index:-1; } -#new>ul>li { margin:.3em; padding-left:2em; background-repeat:no-repeat; cursor:pointer; } +#new>ul>li { margin:.3em; padding-left:2em; background-repeat:no-repeat; cursor:pointer; padding-bottom:0.1em } #new>ul>li>p { cursor:pointer; } +#new>ul>li>input { padding:0.3em; margin:-0.3em; } #file_newfolder_name { background-image:url('../../core/img/places/folder.svg'); font-weight:normal; width:7em; } .file_upload_start, .file_upload_filename { font-size:1em; } diff --git a/files/js/files.js b/files/js/files.js index 4f9cde49aa..4ff1e931c0 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -265,7 +265,7 @@ $(document).ready(function() { $(window).click(function(){ $('#new>ul').hide(); $('#new').removeClass('active'); - $('input.file_upload_filename').removeClass('active'); + $('button.file_upload_filename').removeClass('active'); $('#new li').each(function(i,element){ if($(element).children('p').length==0){ $(element).children('input').remove(); @@ -279,7 +279,7 @@ $(document).ready(function() { $('#new>a').click(function(){ $('#new>ul').toggle(); $('#new').toggleClass('active'); - $('input.file_upload_filename').toggleClass('active'); + $('button.file_upload_filename').toggleClass('active'); }); $('#new li').click(function(){ if($(this).children('p').length==0){ From 9a049de85fa7858efaee8f8f2649dc99340233d4 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 4 Nov 2011 03:11:29 +0100 Subject: [PATCH 042/136] fix mimeicon for new files --- files/js/files.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/files/js/files.js b/files/js/files.js index 4ff1e931c0..bbc0bd31c3 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -310,6 +310,11 @@ $(document).ready(function() { complete: function(data){boolOperationFinished(data, function(){ var date=new Date(); FileList.addFile(name,0,date); + var tr=$('tr').filterAttr('data-file',name); + tr.data('mime','text/plain'); + getMimeIcon('text/plain',function(path){ + tr.find('td.filename').attr('style','background-image:url('+path+')'); + }); });} }); break; From e55c5c590eb47ff10f8166c943470e30584d5b0f Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 4 Nov 2011 16:16:54 +0100 Subject: [PATCH 043/136] make 'New' button work with firefox --- files/css/files.css | 8 ++++---- files/templates/index.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/files/css/files.css b/files/css/files.css index ecd9d9a790..22f4810d0a 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -4,7 +4,7 @@ /* FILE MENU */ .actions { padding:.3em; float:left; height:2em; } -.actions input, .actions button { margin:0; } +.actions input, .actions button, .actions .button { margin:0; } #file_menu { right:0; position:absolute; top:0; } #file_menu a { display:block; float:left; background-image:none; text-decoration:none; } .file_upload_form, #file_newfolder_form { display:inline; float: left; margin-left:0; } @@ -12,10 +12,10 @@ .file_upload_wrapper, #file_newfolder_name { background-repeat:no-repeat; background-position:.5em .5em; padding-left:2em; } .file_upload_wrapper { font-weight:bold; display:-moz-inline-box; /* fallback for older firefox versions*/ display:inline-block; padding-left:0; overflow:hidden; position:relative; margin:0;} .file_upload_wrapper .file_upload_button_wrapper { position:absolute; top:0; left:0; width:100%; height:100%; cursor:pointer; z-index:1000; } -#new { float:left; border-top-right-radius:0; border-bottom-right-radius:0; margin:-.075em 0 0 1em; border-right:none; z-index:1010; } -#new.active { border-bottom-left-radius:0; border-bottom:none; } +#new { float:left; border-top-right-radius:0; border-bottom-right-radius:0; margin:0 0 0 1em; border-right:none; z-index:1010; height:1.3em; } +#new.active { border-bottom-left-radius:0; border-bottom:none; background:#f8f8f8 } #new>a{ padding-left:1em; padding-right:1em; } -#new>ul { display:none; position:fixed; text-align:left; padding:.5em; background:#f8f8f8; margin-top:.4em; border:1px solid #ddd; min-width:7em; margin-left:-.5em; z-index:-1; } +#new>ul { display:none; position:fixed; text-align:left; padding:.5em; background:#f8f8f8; margin-top:0.075em; border:1px solid #ddd; min-width:7em; margin-left:-.5em; z-index:-1; } #new>ul>li { margin:.3em; padding-left:2em; background-repeat:no-repeat; cursor:pointer; padding-bottom:0.1em } #new>ul>li>p { cursor:pointer; } #new>ul>li>input { padding:0.3em; margin:-0.3em; } diff --git a/files/templates/index.php b/files/templates/index.php index cb1ab68808..722c38e477 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -2,7 +2,7 @@
    - +
    From b3bb83cf58c70f71cee43405e6e15fdd7ba456fa Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Fri, 4 Nov 2011 23:44:41 +0100 Subject: [PATCH 044/136] Do not use mix data/attr to retrieve filename ... data() will try to convert filename to int --- files/js/files.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/files/js/files.js b/files/js/files.js index bbc0bd31c3..5adf67010b 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -1,8 +1,7 @@ $(document).ready(function() { $('#fileList tr').each(function(){ //little hack to set unescape filenames in attribute - $(this).attr('data-file',unescape($(this).data('file'))); - $(this).data('file',unescape($(this).data('file'))); + $(this).attr('data-file',unescape($(this).attr('data-file'))); }); if($('tr[data-file]').length==0){ @@ -501,7 +500,7 @@ function getSelectedFiles(property){ var files=[]; elements.each(function(i,element){ var file={ - name:$(element).data('file'), + name:$(element).attr('data-file'), mime:$(element).data('mime'), type:$(element).data('type'), size:$(element).data('size'), From 095d0aa74325e078b80861b62af11f1de2a7830e Mon Sep 17 00:00:00 2001 From: Sean Leonard Date: Fri, 4 Nov 2011 17:08:03 -0700 Subject: [PATCH 045/136] Add WebFinger's .well-known file to .gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index cc4d3bf03b..a84615cf13 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,6 @@ nbproject # Mac OS .DS_Store + +# WebFinger +.well-known From 70014c4fd02f3bda7c92f68ffee8b787b223022f Mon Sep 17 00:00:00 2001 From: Sean Leonard Date: Fri, 4 Nov 2011 17:16:01 -0700 Subject: [PATCH 046/136] Removed if !mod_php5.c around RewriteRule Made things work on Dreamhost shared hosting --- .htaccess | 2 -- 1 file changed, 2 deletions(-) diff --git a/.htaccess b/.htaccess index 34d4c719c8..0d334503d0 100644 --- a/.htaccess +++ b/.htaccess @@ -4,8 +4,6 @@ php_value upload_max_filesize 512M php_value post_max_size 512M SetEnv htaccessWorking true - RewriteEngine on RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization},last] - Options -Indexes From 75ff9abaca2f1a067be3fce10794835b857e5cba Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sun, 6 Nov 2011 00:39:11 +0100 Subject: [PATCH 047/136] Fix another problem of the so-called 'fix-special chars' commit. --- files/js/files.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/js/files.js b/files/js/files.js index 5adf67010b..0af2b9285b 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -1,7 +1,7 @@ $(document).ready(function() { $('#fileList tr').each(function(){ //little hack to set unescape filenames in attribute - $(this).attr('data-file',unescape($(this).attr('data-file'))); + $(this).attr('data-file',decodeURI($(this).attr('data-file'))); }); if($('tr[data-file]').length==0){ From 8de7c36b4cbb3ef02ad4ca0023cbb06f9f2481d8 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sun, 6 Nov 2011 13:34:22 +0100 Subject: [PATCH 048/136] Fix broken upload since merge of new button branch --- files/js/files.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/js/files.js b/files/js/files.js index 0af2b9285b..469a4b81d2 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -163,7 +163,7 @@ $(document).ready(function() { }); $('.file_upload_start').live('change',function(){ - var form=$(this).parent().parent(); + var form=$(this).closest('form'); var uploadId=form.attr('data-upload-id'); var files=this.files; var target=form.children('iframe'); From 2fa9e3279cd305c9ca6eef01918fb6fa418db7db Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sun, 6 Nov 2011 13:50:05 +0100 Subject: [PATCH 049/136] Manage More special chars in file listings. ';' is still problematic --- files/js/files.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/js/files.js b/files/js/files.js index 469a4b81d2..4eaa098241 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -1,7 +1,7 @@ $(document).ready(function() { $('#fileList tr').each(function(){ //little hack to set unescape filenames in attribute - $(this).attr('data-file',decodeURI($(this).attr('data-file'))); + $(this).attr('data-file',decodeURIComponent($(this).attr('data-file'))); }); if($('tr[data-file]').length==0){ From 7de591f5cc1cfadc5c2b0f88cded25578cd58350 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sun, 6 Nov 2011 14:37:22 +0100 Subject: [PATCH 050/136] Avoid Huge error message when unable to read log file --- lib/log.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/log.php b/lib/log.php index 98333be54f..446ddd4884 100644 --- a/lib/log.php +++ b/lib/log.php @@ -59,6 +59,9 @@ class OC_Log{ return array(); } $fh=fopen($logFile,'r'); + if($fh === false){ // Unable to read log file! + return array(); + } while(!feof($fh)){ $line=fgets($fh); if($line){ From cc35cb74e191040169100021c906cc8267b3508e Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sun, 6 Nov 2011 15:29:51 +0100 Subject: [PATCH 051/136] Try to avoid closing the share box too soon on multiple selections --- apps/files_sharing/js/share.js | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index 131571351c..4056d693bf 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -46,6 +46,7 @@ $(document).ready(function() { $('.share').click(function(event) { event.preventDefault(); + event.stopPropagation(); var filenames = getSelectedFiles('name'); var length = filenames.length; var files = ''; From 3940ca3df1a87a242b70f68b5f89f92cf3251526 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sun, 6 Nov 2011 16:48:26 +0100 Subject: [PATCH 052/136] Display correctly the error message when nothing is retrieved from OCS servers --- lib/ocsclient.php | 2 ++ settings/templates/help.php | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/ocsclient.php b/lib/ocsclient.php index 654c5e0527..072fd236fe 100644 --- a/lib/ocsclient.php +++ b/lib/ocsclient.php @@ -108,6 +108,7 @@ class OC_OCSClient{ $xml=@file_get_contents($url); if($xml==FALSE){ + OC_Log::write('core','Unable to parse OCS content',OC_Log::FATAL); return NULL; } $data=simplexml_load_string($xml); @@ -143,6 +144,7 @@ class OC_OCSClient{ $kbe=array(); $xml=@file_get_contents($url); if($xml==FALSE){ + OC_Log::write('core','Unable to parse knowledgebase content',OC_Log::FATAL); return NULL; } $data=simplexml_load_string($xml); diff --git a/settings/templates/help.php b/settings/templates/help.php index 4e3cdd7b90..754bf8b637 100644 --- a/settings/templates/help.php +++ b/settings/templates/help.php @@ -9,7 +9,10 @@ printPage(); + if($pageNavi) + { + $pageNavi->printPage(); + } ?>
    From 97291fda5829fd56a22e39b6a62681aaa239bef5 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sun, 6 Nov 2011 16:54:05 +0100 Subject: [PATCH 053/136] Add allow_url_fopen directive to admin_dependencies_chk --- apps/admin_dependencies_chk/settings.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/admin_dependencies_chk/settings.php b/apps/admin_dependencies_chk/settings.php index a3c9396497..de2f97aa79 100644 --- a/apps/admin_dependencies_chk/settings.php +++ b/apps/admin_dependencies_chk/settings.php @@ -74,6 +74,11 @@ $modules[] =array( 'modules'=> array('core'), 'message'=> $l->t('The php-ctype module is needed validate data.')); +$modules[] =array( + 'status' => ini_get('allow_url_fopen') == '1' ? 'ok' : 'error', + 'part'=> 'allow_url_fopen', + 'modules'=> array('core'), + 'message'=> $l->t('The allow_url_fopen directive of your php.ini should be set to 1 to retrieve knowledge base from OCS servers')); foreach($modules as $key => $module) { $enabled = false ; From 452a4637647d6dbd54b275aead765d3a2329813e Mon Sep 17 00:00:00 2001 From: Florian Vichot Date: Sun, 6 Nov 2011 16:43:00 +0100 Subject: [PATCH 054/136] Make OC_Connector_Sabre_File::get() return a PHP stream instead of the file content, as is recommended by SabreDAV to handle large files. --- lib/connector/sabre/file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/connector/sabre/file.php b/lib/connector/sabre/file.php index b049f39c17..98661dbb18 100644 --- a/lib/connector/sabre/file.php +++ b/lib/connector/sabre/file.php @@ -29,7 +29,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D */ public function get() { - return OC_Filesystem::file_get_contents($this->path); + return OC_Filesystem::fopen($this->path,'r'); } From 2bd28acdc6a1cb4aacd76790705895f20dc05533 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 8 Nov 2011 22:48:29 +0100 Subject: [PATCH 055/136] take free disk space (and user quota) into account for max upload size --- files/index.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/files/index.php b/files/index.php index 8bb5b618d8..4b3bbd1bfd 100644 --- a/files/index.php +++ b/files/index.php @@ -89,6 +89,10 @@ $upload_max_filesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize' $post_max_size = OC_Helper::computerFileSize(ini_get('post_max_size')); $maxUploadFilesize = min($upload_max_filesize, $post_max_size); +$freeSpace=OC_Filesystem::free_space('/'); +$freeSpace=max($freeSpace,0); +$maxUploadFilesize = min($maxUploadFilesize ,$freeSpace); + $tmpl = new OC_Template( "files", "index", "user" ); $tmpl->assign( "fileList", $list->fetchPage() ); $tmpl->assign( "breadcrumb", $breadcrumbNav->fetchPage() ); From 841be90939a74048b0cba9e2085d4853a8a7c5bf Mon Sep 17 00:00:00 2001 From: Jakob Sack Date: Sun, 23 Oct 2011 11:35:47 +0200 Subject: [PATCH 056/136] Improve style in contacts --- apps/contacts/css/styles.css | 2 +- apps/contacts/js/interface.js | 6 +++--- apps/contacts/templates/part.details.php | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/contacts/css/styles.css b/apps/contacts/css/styles.css index 68f843b7aa..e2e673346c 100644 --- a/apps/contacts/css/styles.css +++ b/apps/contacts/css/styles.css @@ -6,7 +6,7 @@ #contacts_details_list li { overflow:hidden; } #contacts_details_list li p.contacts_property_name { width:25%; float:left;text-align:right;padding-right:0.3em; } #contacts_details_list li p.contacts_property_data, #contacts_details_list li ul.contacts_property_data { width:72%; overflow:hidden; } -#contacts_addproperty, #contacts_addproperty_button { margin-left:25%; } +#contacts_addproperty_button, #contacts_setproperty_button { margin-left:25%; } .contacts_property_data ul, .contacts_property_data ol { list-style:none; } .contacts_property_data li { overflow: hidden; } diff --git a/apps/contacts/js/interface.js b/apps/contacts/js/interface.js index 9270297f32..1cc3a5dfd6 100644 --- a/apps/contacts/js/interface.js +++ b/apps/contacts/js/interface.js @@ -56,13 +56,13 @@ $(document).ready(function(){ $('#contacts_addpropertyform #contacts_fieldpart').remove(); $('#contacts_addpropertyform #contacts_generic').remove(); if($(this).val() == 'ADR'){ - $('#contacts_addresspart').clone().insertBefore($('#contacts_addpropertyform input[type="submit"]')); + $('#contacts_addresspart').clone().insertAfter($('#contacts_addpropertyform .contacts_property_name')); } else if($(this).val() == 'TEL'){ - $('#contacts_phonepart').clone().insertBefore($('#contacts_addpropertyform input[type="submit"]')); + $('#contacts_phonepart').clone().insertAfter($('#contacts_addpropertyform .contacts_property_name')); } else{ - $('#contacts_generic').clone().insertBefore($('#contacts_addpropertyform input[type="submit"]')); + $('#contacts_generic').clone().insertAfter($('#contacts_addpropertyform .contacts_property_name')); } }); diff --git a/apps/contacts/templates/part.details.php b/apps/contacts/templates/part.details.php index e9fa8356e8..212be283d8 100644 --- a/apps/contacts/templates/part.details.php +++ b/apps/contacts/templates/part.details.php @@ -35,7 +35,8 @@

    -


    +

    +
@@ -46,14 +44,7 @@
  • @@ -67,8 +58,7 @@
  • diff --git a/apps/contacts/templates/part.details.php b/apps/contacts/templates/part.details.php index 212be283d8..f5bd75809b 100644 --- a/apps/contacts/templates/part.details.php +++ b/apps/contacts/templates/part.details.php @@ -27,10 +27,7 @@

    @@ -44,8 +41,7 @@

  • @@ -80,14 +76,7 @@

    diff --git a/apps/contacts/templates/part.setpropertyform.php b/apps/contacts/templates/part.setpropertyform.php index eb8a67a8aa..811b9626ce 100644 --- a/apps/contacts/templates/part.setpropertyform.php +++ b/apps/contacts/templates/part.setpropertyform.php @@ -5,6 +5,12 @@

      +
    1. + + +
    2. diff --git a/lib/template.php b/lib/template.php index 440b62003e..d1439199e1 100644 --- a/lib/template.php +++ b/lib/template.php @@ -98,6 +98,33 @@ function relative_modified_date($timestamp) { else { return $l->t('years ago'); } } +function html_select_options($options, $selected, $params=array()) { + if (!is_array($selected)){ + $selected=array($selected); + } + if (isset($params['combine']) && $params['combine']){ + $options = array_combine($options, $options); + } + $value_name = $label_name = false; + if (isset($params['value'])){ + $value_name = $params['value']; + } + if (isset($params['label'])){ + $label_name = $params['label']; + } + $html = ''; + foreach($options as $value => $label){ + if ($value_name && is_array($label)){ + $value = $label[$value_name]; + } + if ($label_name && is_array($label)){ + $label = $label[$label_name]; + } + $select = in_array($value, $selected) ? ' selected="selected"' : ''; + $html .= ''; + } + return $html; +} /** * This class provides the templates for owncloud. From 26272c42525e63fedcf2b35d3d875fbec860eae1 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 11 Nov 2011 15:51:44 +0100 Subject: [PATCH 063/136] automatic timezone detection --- apps/calendar/ajax/guesstimezone.php | 39 ++++++++++++++++++++++++++++ apps/calendar/index.php | 5 +++- apps/calendar/js/geo.js | 20 ++++++++++++++ apps/calendar/templates/calendar.php | 37 +++++++++++++------------- 4 files changed, 82 insertions(+), 19 deletions(-) create mode 100755 apps/calendar/ajax/guesstimezone.php create mode 100755 apps/calendar/js/geo.js mode change 100644 => 100755 apps/calendar/templates/calendar.php diff --git a/apps/calendar/ajax/guesstimezone.php b/apps/calendar/ajax/guesstimezone.php new file mode 100755 index 0000000000..a3594498b0 --- /dev/null +++ b/apps/calendar/ajax/guesstimezone.php @@ -0,0 +1,39 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ +function make_array_out_of_xml ($xml){ + $returnarray = array(); + $xml = (array)$xml ; + foreach ($xml as $property => $value){ + $value = (array)$value; + if(!isset($value[0])){ + $returnarray[$property] = make_array_out_of_xml($value); + }else{ + $returnarray[$property] = trim($value[0]); + } + } + return $returnarray; +} +require_once ("../../../lib/base.php"); +OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('calendar'); +$l = new OC_L10N('calendar'); +$lat = $_GET['lat']; +$long = $_GET['long']; +$geolocation = file_get_contents('http://ws.geonames.org/timezone?lat=' . $lat . '&lng=' . $long); +//Information are by Geonames (http://www.geonames.org) and licensed under the Creative Commons Attribution 3.0 License +$geoxml = simplexml_load_string($geolocation); +$geoarray = make_array_out_of_xml($geoxml); +if(isset($geoarray['timezone']['timezoneId']) && $geoarray['timezone']['timezoneId'] != ''){ + OC_Preferences::setValue(OC_USER::getUser(), 'calendar', 'timezone', $geoarray['timezone']['timezoneId']); + $message = array('message'=> $l->t('New Timezone:') . $geoarray['timezone']['timezoneId']); + OC_JSON::success($message); +}else{ + OC_JSON::error(); +} + +?> \ No newline at end of file diff --git a/apps/calendar/index.php b/apps/calendar/index.php index e5326d26e9..3313750d52 100644 --- a/apps/calendar/index.php +++ b/apps/calendar/index.php @@ -32,6 +32,9 @@ if(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'mont OC_Util::addScript('3rdparty/fullcalendar', 'fullcalendar'); OC_Util::addStyle('3rdparty/fullcalendar', 'fullcalendar'); +if(OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone") == null){ + OC_UTIL::addScript('calendar', 'geo'); +} OC_Util::addScript('calendar', 'calendar'); OC_Util::addStyle('calendar', 'style'); OC_Util::addScript('', 'jquery.multiselect'); @@ -39,4 +42,4 @@ OC_Util::addStyle('', 'jquery.multiselect'); OC_App::setActiveNavigationEntry('calendar_index'); $tmpl = new OC_Template('calendar', 'calendar', 'user'); $tmpl->assign('eventSources', $eventSources); -$tmpl->printPage(); +$tmpl->printPage(); \ No newline at end of file diff --git a/apps/calendar/js/geo.js b/apps/calendar/js/geo.js new file mode 100755 index 0000000000..acea17c026 --- /dev/null +++ b/apps/calendar/js/geo.js @@ -0,0 +1,20 @@ +/** + * Copyright (c) 2011 Georg Ehrke + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ +if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition(function(position) { + $.getJSON(OC.filePath('calendar', 'ajax', 'guesstimezone.php?lat=' + position.coords.latitude + '&long=' + position.coords.longitude + ''), + function(data){ + if (data.status == 'success'){ + $('#notification').html(data.message); + $('#notification').slideDown(); + window.setTimeout(function(){$('#notification').slideUp();}, 5000); + }else{ + console.log('Can\'t set new timezone.'); + } + }); + }); +} \ No newline at end of file diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php old mode 100644 new mode 100755 index 0a6a7008fc..6654568f5a --- a/apps/calendar/templates/calendar.php +++ b/apps/calendar/templates/calendar.php @@ -1,21 +1,21 @@ - +
      @@ -40,6 +40,7 @@ var missing_field_dberror = 't('There was a database fail') ?>';
      +
      From 03d9fab3c0cf3a3c50259d6a33439a998628b45c Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sat, 12 Nov 2011 14:06:14 +0100 Subject: [PATCH 064/136] fix caldav url --- apps/calendar/templates/calendar.php | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php index 6654568f5a..bee98f43e1 100755 --- a/apps/calendar/templates/calendar.php +++ b/apps/calendar/templates/calendar.php @@ -15,6 +15,7 @@ var missing_field_totime = 't('To Time') ?>'; var missing_field_startsbeforeends = 't('The event ends before it starts') ?>'; var missing_field_dberror = 't('There was a database fail') ?>'; + var totalurl = '';
      From eea20e51d8d96e91a7899704cad48811152fe143 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sat, 12 Nov 2011 16:13:27 +0100 Subject: [PATCH 065/136] another fix of caldav url --- apps/calendar/templates/calendar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php index bee98f43e1..76c0249e26 100755 --- a/apps/calendar/templates/calendar.php +++ b/apps/calendar/templates/calendar.php @@ -15,7 +15,7 @@ var missing_field_totime = 't('To Time') ?>'; var missing_field_startsbeforeends = 't('The event ends before it starts') ?>'; var missing_field_dberror = 't('There was a database fail') ?>'; - var totalurl = ''; + var totalurl = '/calendars';
      From a303992d781db9d6714522014f4903ce89c62127 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sat, 12 Nov 2011 22:02:04 +0100 Subject: [PATCH 066/136] support for repeating events --- 3rdparty/when/MIT-LICENSE.txt | 9 + 3rdparty/when/When.php | 725 ++++++++++++++++++++++++++++++++++ apps/calendar/ajax/events.php | 97 +++-- apps/calendar/lib/object.php | 4 +- 4 files changed, 799 insertions(+), 36 deletions(-) create mode 100644 3rdparty/when/MIT-LICENSE.txt create mode 100755 3rdparty/when/When.php diff --git a/3rdparty/when/MIT-LICENSE.txt b/3rdparty/when/MIT-LICENSE.txt new file mode 100644 index 0000000000..b4429c89ac --- /dev/null +++ b/3rdparty/when/MIT-LICENSE.txt @@ -0,0 +1,9 @@ +License + +Copyright (c) 2010 Thomas Planer + +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/when/When.php b/3rdparty/when/When.php new file mode 100755 index 0000000000..5f97f0eb9b --- /dev/null +++ b/3rdparty/when/When.php @@ -0,0 +1,725 @@ + + * Location: http://github.com/tplaner/When + * Created: September 2010 + * Description: Determines the next date of recursion given an iCalendar "rrule" like pattern. + * Requirements: PHP 5.3+ - makes extensive use of the Date and Time library (http://us2.php.net/manual/en/book.datetime.php) + */ +class When +{ + protected $frequency; + + protected $start_date; + protected $try_date; + + protected $end_date; + + protected $gobymonth; + protected $bymonth; + + protected $gobyweekno; + protected $byweekno; + + protected $gobyyearday; + protected $byyearday; + + protected $gobymonthday; + protected $bymonthday; + + protected $gobyday; + protected $byday; + + protected $gobysetpos; + protected $bysetpos; + + protected $suggestions; + + protected $count; + protected $counter; + + protected $goenddate; + + protected $interval; + + protected $wkst; + + protected $valid_week_days; + protected $valid_frequency; + + /** + * __construct + */ + public function __construct() + { + $this->frequency = null; + + $this->gobymonth = false; + $this->bymonth = range(1,12); + + $this->gobymonthday = false; + $this->bymonthday = range(1,31); + + $this->gobyday = false; + // setup the valid week days (0 = sunday) + $this->byday = range(0,6); + + $this->gobyyearday = false; + $this->byyearday = range(0,366); + + $this->gobysetpos = false; + $this->bysetpos = range(1,366); + + $this->gobyweekno = false; + // setup the range for valid weeks + $this->byweekno = range(0,54); + + $this->suggestions = array(); + + // this will be set if a count() is specified + $this->count = 0; + // how many *valid* results we returned + $this->counter = 0; + + // max date we'll return + $this->end_date = new DateTime('9999-12-31'); + + // the interval to increase the pattern by + $this->interval = 1; + + // what day does the week start on? (0 = sunday) + $this->wkst = 0; + + $this->valid_week_days = array('SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'); + + $this->valid_frequency = array('SECONDLY', 'MINUTELY', 'HOURLY', 'DAILY', 'WEEKLY', 'MONTHLY', 'YEARLY'); + } + + /** + * @param DateTime|string $start_date of the recursion - also is the first return value. + * @param string $frequency of the recrusion, valid frequencies: secondly, minutely, hourly, daily, weekly, monthly, yearly + */ + public function recur($start_date, $frequency = "daily") + { + try + { + if(is_object($start_date)) + { + $this->start_date = clone $start_date; + } + else + { + // timestamps within the RFC have a 'Z' at the end of them, remove this. + $start_date = trim($start_date, 'Z'); + $this->start_date = new DateTime($start_date); + } + + $this->try_date = clone $this->start_date; + } + catch(Exception $e) + { + throw new InvalidArgumentException('Invalid start date DateTime: ' . $e); + } + + $this->freq($frequency); + + return $this; + } + + public function freq($frequency) + { + if(in_array(strtoupper($frequency), $this->valid_frequency)) + { + $this->frequency = strtoupper($frequency); + } + else + { + throw new InvalidArgumentException('Invalid frequency type.'); + } + + return $this; + } + + // accepts an rrule directly + public function rrule($rrule) + { + // strip off a trailing semi-colon + $rrule = trim($rrule, ";"); + + $parts = explode(";", $rrule); + + foreach($parts as $part) + { + list($rule, $param) = explode("=", $part); + + $rule = strtoupper($rule); + $param = strtoupper($param); + + switch($rule) + { + case "FREQ": + $this->frequency = $param; + break; + case "UNTIL": + $this->until($param); + break; + case "COUNT": + $this->count($param); + break; + case "INTERVAL": + $this->interval($param); + break; + case "BYDAY": + $params = explode(",", $param); + $this->byday($params); + break; + case "BYMONTHDAY": + $params = explode(",", $param); + $this->bymonthday($params); + break; + case "BYYEARDAY": + $params = explode(",", $param); + $this->byyearday($params); + break; + case "BYWEEKNO": + $params = explode(",", $param); + $this->byweekno($params); + break; + case "BYMONTH": + $params = explode(",", $param); + $this->bymonth($params); + break; + case "BYSETPOS": + $params = explode(",", $param); + $this->bysetpos($params); + break; + case "WKST": + $this->wkst($param); + break; + } + } + + return $this; + } + + //max number of items to return based on the pattern + public function count($count) + { + $this->count = (int)$count; + + return $this; + } + + // how often the recurrence rule repeats + public function interval($interval) + { + $this->interval = (int)$interval; + + return $this; + } + + // starting day of the week + public function wkst($day) + { + switch($day) + { + case 'SU': + $this->wkst = 0; + break; + case 'MO': + $this->wkst = 1; + break; + case 'TU': + $this->wkst = 2; + break; + case 'WE': + $this->wkst = 3; + break; + case 'TH': + $this->wkst = 4; + break; + case 'FR': + $this->wkst = 5; + break; + case 'SA': + $this->wkst = 6; + break; + } + + return $this; + } + + // max date + public function until($end_date) + { + try + { + if(is_object($end_date)) + { + $this->end_date = clone $end_date; + } + else + { + // timestamps within the RFC have a 'Z' at the end of them, remove this. + $end_date = trim($end_date, 'Z'); + $this->end_date = new DateTime($end_date); + } + } + catch(Exception $e) + { + throw new InvalidArgumentException('Invalid end date DateTime: ' . $e); + } + + return $this; + } + + public function bymonth($months) + { + if(is_array($months)) + { + $this->gobymonth = true; + $this->bymonth = $months; + } + + return $this; + } + + public function bymonthday($days) + { + if(is_array($days)) + { + $this->gobymonthday = true; + $this->bymonthday = $days; + } + + return $this; + } + + public function byweekno($weeks) + { + $this->gobyweekno = true; + + if(is_array($weeks)) + { + $this->byweekno = $weeks; + } + + return $this; + } + + public function bysetpos($days) + { + $this->gobysetpos = true; + + if(is_array($days)) + { + $this->bysetpos = $days; + } + + return $this; + } + + public function byday($days) + { + $this->gobyday = true; + + if(is_array($days)) + { + $this->byday = array(); + foreach($days as $day) + { + $len = strlen($day); + + $as = '+'; + + // 0 mean no occurence is set + $occ = 0; + + if($len == 3) + { + $occ = substr($day, 0, 1); + } + if($len == 4) + { + $as = substr($day, 0, 1); + $occ = substr($day, 1, 1); + } + + if($as == '-') + { + $occ = '-' . $occ; + } + else + { + $occ = '+' . $occ; + } + + $day = substr($day, -2, 2); + switch($day) + { + case 'SU': + $this->byday[] = $occ . 'SU'; + break; + case 'MO': + $this->byday[] = $occ . 'MO'; + break; + case 'TU': + $this->byday[] = $occ . 'TU'; + break; + case 'WE': + $this->byday[] = $occ . 'WE'; + break; + case 'TH': + $this->byday[] = $occ . 'TH'; + break; + case 'FR': + $this->byday[] = $occ . 'FR'; + break; + case 'SA': + $this->byday[] = $occ . 'SA'; + break; + } + } + } + + return $this; + } + + public function byyearday($days) + { + $this->gobyyearday = true; + + if(is_array($days)) + { + $this->byyearday = $days; + } + + return $this; + } + + // this creates a basic list of dates to "try" + protected function create_suggestions() + { + switch($this->frequency) + { + case "YEARLY": + $interval = 'year'; + break; + case "MONTHLY": + $interval = 'month'; + break; + case "WEEKLY": + $interval = 'week'; + break; + case "DAILY": + $interval = 'day'; + break; + case "HOURLY": + $interval = 'hour'; + break; + case "MINUTELY": + $interval = 'minute'; + break; + case "SECONDLY": + $interval = 'second'; + break; + } + + $month_day = $this->try_date->format('j'); + $month = $this->try_date->format('n'); + $year = $this->try_date->format('Y'); + + $timestamp = $this->try_date->format('H:i:s'); + + if($this->gobysetpos) + { + if($this->try_date == $this->start_date) + { + $this->suggestions[] = clone $this->try_date; + } + else + { + if($this->gobyday) + { + foreach($this->bysetpos as $_pos) + { + $tmp_array = array(); + $_mdays = range(1, date('t',mktime(0,0,0,$month,1,$year))); + foreach($_mdays as $_mday) + { + $date_time = new DateTime($year . '-' . $month . '-' . $_mday . ' ' . $timestamp); + + $occur = ceil($_mday / 7); + + $day_of_week = $date_time->format('l'); + $dow_abr = strtoupper(substr($day_of_week, 0, 2)); + + // set the day of the month + (positive) + $occur = '+' . $occur . $dow_abr; + $occur_zero = '+0' . $dow_abr; + + // set the day of the month - (negative) + $total_days = $date_time->format('t') - $date_time->format('j'); + $occur_neg = '-' . ceil(($total_days + 1)/7) . $dow_abr; + + $day_from_end_of_month = $date_time->format('t') + 1 - $_mday; + + if(in_array($occur, $this->byday) || in_array($occur_zero, $this->byday) || in_array($occur_neg, $this->byday)) + { + $tmp_array[] = clone $date_time; + } + } + + if($_pos > 0) + { + $this->suggestions[] = clone $tmp_array[$_pos - 1]; + } + else + { + $this->suggestions[] = clone $tmp_array[count($tmp_array) + $_pos]; + } + + } + } + } + } + elseif($this->gobyyearday) + { + foreach($this->byyearday as $_day) + { + if($_day >= 0) + { + $_day--; + + $_time = strtotime('+' . $_day . ' days', mktime(0, 0, 0, 1, 1, $year)); + $this->suggestions[] = new Datetime(date('Y-m-d', $_time) . ' ' . $timestamp); + } + else + { + $year_day_neg = 365 + $_day; + $leap_year = $this->try_date->format('L'); + if($leap_year == 1) + { + $year_day_neg = 366 + $_day; + } + + $_time = strtotime('+' . $year_day_neg . ' days', mktime(0, 0, 0, 1, 1, $year)); + $this->suggestions[] = new Datetime(date('Y-m-d', $_time) . ' ' . $timestamp); + } + } + } + // special case because for years you need to loop through the months too + elseif($this->gobyday && $interval == "year") + { + foreach($this->bymonth as $_month) + { + // this creates an array of days of the month + $_mdays = range(1, date('t',mktime(0,0,0,$_month,1,$year))); + foreach($_mdays as $_mday) + { + $date_time = new DateTime($year . '-' . $_month . '-' . $_mday . ' ' . $timestamp); + + // get the week of the month (1, 2, 3, 4, 5, etc) + $week = $date_time->format('W'); + + if($date_time >= $this->start_date && in_array($week, $this->byweekno)) + { + $this->suggestions[] = clone $date_time; + } + } + } + } + elseif($interval == "day") + { + $this->suggestions[] = clone $this->try_date; + } + elseif($interval == "week") + { + $this->suggestions[] = clone $this->try_date; + + if($this->gobyday) + { + $week_day = $this->try_date->format('w'); + + $days_in_month = $this->try_date->format('t'); + + $overflow_count = 1; + $_day = $month_day; + + $run = true; + while($run) + { + $_day++; + if($_day <= $days_in_month) + { + $tmp_date = new DateTime($year . '-' . $month . '-' . $_day . ' ' . $timestamp); + } + else + { + //$tmp_month = $month+1; + $tmp_date = new DateTime($year . '-' . $month . '-' . $overflow_count . ' ' . $timestamp); + $tmp_date->modify('+1 month'); + $overflow_count++; + } + + $week_day = $tmp_date->format('w'); + + if($this->try_date == $this->start_date) + { + if($week_day == $this->wkst) + { + $this->try_date = clone $tmp_date; + $this->try_date->modify('-7 days'); + $run = false; + } + } + + if($week_day != $this->wkst) + { + $this->suggestions[] = clone $tmp_date; + } + else + { + $run = false; + } + } + } + } + elseif($this->gobyday || $interval == "month") + { + $_mdays = range(1, date('t',mktime(0,0,0,$month,1,$year))); + foreach($_mdays as $_mday) + { + $date_time = new DateTime($year . '-' . $month . '-' . $_mday . ' ' . $timestamp); + + // get the week of the month (1, 2, 3, 4, 5, etc) + $week = $date_time->format('W'); + + if($date_time >= $this->start_date && in_array($week, $this->byweekno)) + { + $this->suggestions[] = clone $date_time; + } + } + } + elseif($this->gobymonth) + { + foreach($this->bymonth as $_month) + { + $date_time = new DateTime($year . '-' . $_month . '-' . $month_day . ' ' . $timestamp); + + if($date_time >= $this->start_date) + { + $this->suggestions[] = clone $date_time; + } + } + } + else + { + $this->suggestions[] = clone $this->try_date; + } + + if($interval == "month") + { + $this->try_date->modify('last day of ' . $this->interval . ' ' . $interval); + } + else + { + $this->try_date->modify($this->interval . ' ' . $interval); + } + } + + protected function valid_date($date) + { + $year = $date->format('Y'); + $month = $date->format('n'); + $day = $date->format('j'); + + $year_day = $date->format('z') + 1; + + $year_day_neg = -366 + $year_day; + $leap_year = $date->format('L'); + if($leap_year == 1) + { + $year_day_neg = -367 + $year_day; + } + + // this is the nth occurence of the date + $occur = ceil($day / 7); + + $week = $date->format('W'); + + $day_of_week = $date->format('l'); + $dow_abr = strtoupper(substr($day_of_week, 0, 2)); + + // set the day of the month + (positive) + $occur = '+' . $occur . $dow_abr; + $occur_zero = '+0' . $dow_abr; + + // set the day of the month - (negative) + $total_days = $date->format('t') - $date->format('j'); + $occur_neg = '-' . ceil(($total_days + 1)/7) . $dow_abr; + + $day_from_end_of_month = $date->format('t') + 1 - $day; + + if(in_array($month, $this->bymonth) && + (in_array($occur, $this->byday) || in_array($occur_zero, $this->byday) || in_array($occur_neg, $this->byday)) && + in_array($week, $this->byweekno) && + (in_array($day, $this->bymonthday) || in_array(-$day_from_end_of_month, $this->bymonthday)) && + (in_array($year_day, $this->byyearday) || in_array($year_day_neg, $this->byyearday))) + { + return true; + } + else + { + return false; + } + } + + // return the next valid DateTime object which matches the pattern and follows the rules + public function next() + { + // check the counter is set + if($this->count !== 0) + { + if($this->counter >= $this->count) + { + return false; + } + } + + // create initial set of suggested dates + if(count($this->suggestions) === 0) + { + $this->create_suggestions(); + } + + // loop through the suggested dates + while(count($this->suggestions) > 0) + { + // get the first one on the array + $try_date = array_shift($this->suggestions); + + // make sure the date doesn't exceed the max date + if($try_date > $this->end_date) + { + return false; + } + + // make sure it falls within the allowed days + if($this->valid_date($try_date) === true) + { + $this->counter++; + return $try_date; + } + else + { + // we might be out of suggested days, so load some more + if(count($this->suggestions) === 0) + { + $this->create_suggestions(); + } + } + } + } +} diff --git a/apps/calendar/ajax/events.php b/apps/calendar/ajax/events.php index 66aeb1a35b..f161bb88a0 100644 --- a/apps/calendar/ajax/events.php +++ b/apps/calendar/ajax/events.php @@ -6,40 +6,10 @@ * See the COPYING-README file. */ -require_once ("../../../lib/base.php"); -if(!OC_USER::isLoggedIn()) { - die(""); -} -OC_JSON::checkAppEnabled('calendar'); +require_once ('../../../lib/base.php'); +require_once('../../../3rdparty/when/When.php'); -$start = DateTime::createFromFormat('U', $_GET['start']); -$end = DateTime::createFromFormat('U', $_GET['end']); - -$events = OC_Calendar_Object::allInPeriod($_GET['calendar_id'], $start, $end); -$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone", "Europe/London"); -$return = array(); -foreach($events as $event) -{ - $return_event = array(); - $object = OC_Calendar_Object::parse($event['calendardata']); - $vevent = $object->VEVENT; - $dtstart = $vevent->DTSTART; - $dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent); - $start_dt = $dtstart->getDateTime(); - $end_dt = $dtend->getDateTime(); - if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE) - { - $return_event['allDay'] = true; - $return_event['start'] = $start_dt->format('Y-m-d'); - $end_dt->modify('-1 sec'); - $return_event['end'] = $end_dt->format('Y-m-d'); - }else{ - $start_dt->setTimezone(new DateTimeZone($user_timezone)); - $end_dt->setTimezone(new DateTimeZone($user_timezone)); - $return_event['start'] = $start_dt->format('Y-m-d H:i:s'); - $return_event['end'] = $end_dt->format('Y-m-d H:i:s'); - $return_event['allDay'] = false; - } +function addoutput($event, $vevent, $return_event){ $return_event['id'] = (int)$event['id']; $return_event['title'] = $event['summary']; $return_event['description'] = isset($vevent->DESCRIPTION)?$vevent->DESCRIPTION->value:''; @@ -50,6 +20,65 @@ foreach($events as $event) $lastmodified = 0; } $return_event['lastmodified'] = (int)$lastmodified; - $return[] = $return_event; + return $return_event; +} + +OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('calendar'); + +$start = DateTime::createFromFormat('U', $_GET['start']); +$end = DateTime::createFromFormat('U', $_GET['end']); + +$events = OC_Calendar_Object::allInPeriod($_GET['calendar_id'], $start, $end); +$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone", "Europe/London"); +$return = array(); +foreach($events as $event){ + $object = OC_Calendar_Object::parse($event['calendardata']); + $vevent = $object->VEVENT; + $dtstart = $vevent->DTSTART; + $dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent); + $return_event = array(); + $start_dt = $dtstart->getDateTime(); + $end_dt = $dtend->getDateTime(); + if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE){ + $return_event['allDay'] = true; + }else{ + $return_event['allDay'] = false; + } + //Repeating Events + if($event['repeating'] == 1){ + $duration = (double) $end_dt->format('U') - (double) $start_dt->format('U'); + $r = new When(); + $r->recur((string) $dtstart)->rrule((string) $vevent->RRULE); + while($result = $r->next()){ + if($result->format('U') > $_GET['end']){ + break; + } + if($return_event['allDay'] == true){ + $return_event['start'] = $result->format('Y-m-d'); + $return_event['end'] = date('Y-m-d', $result->format('U') + $duration--); + }else{ + $return_event['start'] = $result->format('Y-m-d H:i:s'); + $return_event['end'] = date('Y-m-d H:i:s', $result->format('U') + $duration); + } + $return[] = addoutput($event, $vevent, $return_event); + } + }else{ + $return_event = array(); + if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE){ + $return_event['allDay'] = true; + $return_event['start'] = $start_dt->format('Y-m-d'); + $end_dt->modify('-1 sec'); + $return_event['end'] = $end_dt->format('Y-m-d'); + }else{ + $start_dt->setTimezone(new DateTimeZone($user_timezone)); + $end_dt->setTimezone(new DateTimeZone($user_timezone)); + $return_event['start'] = $start_dt->format('Y-m-d H:i:s'); + $return_event['end'] = $end_dt->format('Y-m-d H:i:s'); + $return_event['allDay'] = false; + } + $return[] = addoutput($event, $vevent, $return_event); + } } OC_JSON::encodedPrint($return); +?> \ No newline at end of file diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php index ccc62d565e..58d46ce6a7 100644 --- a/apps/calendar/lib/object.php +++ b/apps/calendar/lib/object.php @@ -43,12 +43,12 @@ class OC_Calendar_Object{ public static function allInPeriod($id, $start, $end){ $stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*calendar_objects WHERE calendarid = ?' .' AND ((startdate >= ? AND startdate <= ? AND repeating = 0)' - .' OR (startdate <= ? AND enddate >= ? AND repeating = 1))' ); + .' OR (startdate <= ? AND repeating = 1))' ); $start = self::getUTCforMDB($start); $end = self::getUTCforMDB($end); $result = $stmt->execute(array($id, $start, $end, - $end, $start)); + $end)); $calendarobjects = array(); while( $row = $result->fetchRow()){ From 89b3a395df12411328c33c1d5460f87eb1972024 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sat, 12 Nov 2011 22:30:09 +0100 Subject: [PATCH 067/136] fix timezone for repeating events --- apps/calendar/ajax/events.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/calendar/ajax/events.php b/apps/calendar/ajax/events.php index f161bb88a0..9a2ba88060 100644 --- a/apps/calendar/ajax/events.php +++ b/apps/calendar/ajax/events.php @@ -39,7 +39,9 @@ foreach($events as $event){ $dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent); $return_event = array(); $start_dt = $dtstart->getDateTime(); + $start_dt->setTimezone(new DateTimeZone($user_timezone)); $end_dt = $dtend->getDateTime(); + $end_dt->setTimezone(new DateTimeZone($user_timezone)); if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE){ $return_event['allDay'] = true; }else{ @@ -49,7 +51,7 @@ foreach($events as $event){ if($event['repeating'] == 1){ $duration = (double) $end_dt->format('U') - (double) $start_dt->format('U'); $r = new When(); - $r->recur((string) $dtstart)->rrule((string) $vevent->RRULE); + $r->recur((string) $start_dt->format('Ymd\THis'))->rrule((string) $vevent->RRULE); while($result = $r->next()){ if($result->format('U') > $_GET['end']){ break; @@ -71,8 +73,6 @@ foreach($events as $event){ $end_dt->modify('-1 sec'); $return_event['end'] = $end_dt->format('Y-m-d'); }else{ - $start_dt->setTimezone(new DateTimeZone($user_timezone)); - $end_dt->setTimezone(new DateTimeZone($user_timezone)); $return_event['start'] = $start_dt->format('Y-m-d H:i:s'); $return_event['end'] = $end_dt->format('Y-m-d H:i:s'); $return_event['allDay'] = false; From 3d498002d040603778efbbd558a4d25c6d6734a4 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 14 Nov 2011 22:52:34 +0100 Subject: [PATCH 068/136] first implementation of the search function --- apps/calendar/appinfo/app.php | 2 ++ apps/calendar/lib/search.php | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 apps/calendar/lib/search.php diff --git a/apps/calendar/appinfo/app.php b/apps/calendar/appinfo/app.php index 2dc01eab0f..5675e624dd 100644 --- a/apps/calendar/appinfo/app.php +++ b/apps/calendar/appinfo/app.php @@ -21,3 +21,5 @@ OC_App::addNavigationEntry( array( 'name' => $l->t('Calendar'))); OC_App::registerPersonal('calendar', 'settings'); + +require_once('apps/calendar/lib/search.php'); \ No newline at end of file diff --git a/apps/calendar/lib/search.php b/apps/calendar/lib/search.php new file mode 100644 index 0000000000..41faf49a51 --- /dev/null +++ b/apps/calendar/lib/search.php @@ -0,0 +1,26 @@ + 0){ + $searchquery = explode(' ', $query); + }else{ + $searchquery[] = $query; + } + foreach($calendars as $calendar){ + $objects = OC_Calendar_Object::all($calendar['id']); + foreach($objects as $object){ + if(substr_count(strtolower($object['summary']), strtolower($query)) > 0){//$name,$text,$link,$type + $results[]=new OC_Search_Result($object['summary'],'','#','Cal.'); + } + } + } + return $results; + } +} +new OC_Search_Provider_Calendar(); \ No newline at end of file From 0d274b0268fc3ffa98775e5e34f35bd50c019707 Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Mon, 24 Oct 2011 12:55:05 +0000 Subject: [PATCH 069/136] fix id3 tag resolve. should use utf8 from getID3 directly but not to convert them from ISO8859-1 to utf8 after analyze. --- apps/media/lib_scanner.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/media/lib_scanner.php b/apps/media/lib_scanner.php index ef63cea45d..c2bea2d836 100644 --- a/apps/media/lib_scanner.php +++ b/apps/media/lib_scanner.php @@ -93,6 +93,7 @@ class OC_MEDIA_SCANNER{ } if(!self::$getID3){ self::$getID3=@new getID3(); + self::$getID3->encoding='UTF-8'; } $data=@self::$getID3->analyze($file); getid3_lib::CopyTagsToComments($data); @@ -105,21 +106,18 @@ class OC_MEDIA_SCANNER{ $artist='unknown'; }else{ $artist=stripslashes($data['comments']['artist'][0]); - $artist=utf8_encode($artist); } if(!isset($data['comments']['album'])){ OC_Log::write('media',"error reading album tag in '$file'",OC_Log::WARN); $album='unknown'; }else{ $album=stripslashes($data['comments']['album'][0]); - $album=utf8_encode($album); } if(!isset($data['comments']['title'])){ OC_Log::write('media',"error reading title tag in '$file'",OC_Log::WARN); $title='unknown'; }else{ $title=stripslashes($data['comments']['title'][0]); - $title=utf8_encode($title); } $size=$data['filesize']; $track=(isset($data['comments']['track']))?$data['comments']['track'][0]:0; @@ -150,4 +148,4 @@ class OC_MEDIA_SCANNER{ $ext=substr($filename,strrpos($filename,'.')+1); return $ext=='mp3' || $ext=='flac' || $ext=='m4a' || $ext=='ogg' || $ext=='oga'; } -} \ No newline at end of file +} From 96b91e5b0b54a9070eec55949d4ff13163b25d8c Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Mon, 24 Oct 2011 16:43:18 +0000 Subject: [PATCH 070/136] fix ampache encoding problem. use htmlentities encoding parameter directly. --- apps/media/lib_ampache.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/media/lib_ampache.php b/apps/media/lib_ampache.php index 0ad84d6680..bb468d5595 100644 --- a/apps/media/lib_ampache.php +++ b/apps/media/lib_ampache.php @@ -128,7 +128,7 @@ class OC_MEDIA_AMPACHE{ $albums=count(OC_MEDIA_COLLECTION::getAlbums($artist['artist_id'])); $songs=count(OC_MEDIA_COLLECTION::getSongs($artist['artist_id'])); $id=$artist['artist_id']; - $name=utf8_decode(htmlentities($artist['artist_name'])); + $name=htmlentities($artist['artist_name'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); echo("\t\n"); echo("\t\t$name\n"); echo("\t\t$albums\n"); @@ -142,10 +142,10 @@ class OC_MEDIA_AMPACHE{ if(!$artistName){ $artistName=OC_MEDIA_COLLECTION::getArtistName($album['album_artist']); } - $artistName=utf8_decode(htmlentities($artistName)); + $artistName=htmlentities($artistName, ENT_COMPAT | ENT_HTML401, 'UTF-8'); $songs=count(OC_MEDIA_COLLECTION::getSongs($album['album_artist'],$album['album_id'])); $id=$album['album_id']; - $name=utf8_decode(htmlentities($album['album_name'])); + $name=htmlentities($album['album_name'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); $artist=$album['album_artist']; echo("\t\n"); echo("\t\t$name\n"); @@ -163,10 +163,10 @@ class OC_MEDIA_AMPACHE{ if(!$albumName){ $albumName=OC_MEDIA_COLLECTION::getAlbumName($song['song_album']); } - $artistName=utf8_decode(htmlentities($artistName)); - $albumName=utf8_decode(htmlentities($albumName)); + $artistName=htmlentities($artistName, ENT_COMPAT | ENT_HTML401, 'UTF-8'); + $albumName=htmlentities($albumName, ENT_COMPAT | ENT_HTML401, 'UTF-8'); $id=$song['song_id']; - $name=utf8_decode(htmlentities($song['song_name'])); + $name=htmlentities($song['song_name'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); $artist=$song['song_artist']; $album=$song['song_album']; echo("\t\n"); From 28cd41a2a43ce614199e1b966c1d424efd8b23dd Mon Sep 17 00:00:00 2001 From: krzaczek Date: Tue, 4 Oct 2011 15:37:05 +0200 Subject: [PATCH 071/136] users_ldap - added getUsers() method to fetch all existing users from LDAP server --- apps/user_ldap/user_ldap.php | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php index 1154efc17b..4fb8daf3c4 100644 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -65,7 +65,7 @@ class OC_USER_LDAP extends OC_User_Backend { $this->ds = ldap_connect( $this->ldap_host, $this->ldap_port ); if(ldap_set_option($this->ds, LDAP_OPT_PROTOCOL_VERSION, 3)) if(ldap_set_option($this->ds, LDAP_OPT_REFERRALS, 0)) - ldap_start_tls($this->ds); + @ldap_start_tls($this->ds); } // login @@ -117,7 +117,36 @@ class OC_USER_LDAP extends OC_User_Backend { $dn = $this->getDn($uid); return !empty($dn); } + + public function getUsers() + { + if(!$this->configured) + return false; + + // connect to server + $ds = $this->getDs(); + if( !$ds ) + return false; + + // get users + $filter = "objectClass=person"; + $sr = ldap_search( $this->getDs(), $this->ldap_base, $filter ); + $entries = ldap_get_entries( $this->getDs(), $sr ); + + if( $entries["count"] == 0 ) + return false; + else { + $users = array(); + foreach($entries as $row) { + if(isset($row['uid'])) { + $users[] = $row['uid'][0]; + } + } + } + + return $users; + } } -?> +?> \ No newline at end of file From a70c2b3cb9752507ea60d7b8d2bbcedad04feb14 Mon Sep 17 00:00:00 2001 From: krzaczek Date: Tue, 4 Oct 2011 15:38:15 +0200 Subject: [PATCH 072/136] apps file_sharing changed $RUNTIME_NOAPPS = true; to $RUNTIME_NOAPPS = false; in ajax/userautocomplete.php - to fetch users also from different user backends - not only database backend --- apps/files_sharing/ajax/userautocomplete.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files_sharing/ajax/userautocomplete.php b/apps/files_sharing/ajax/userautocomplete.php index 21516c3d09..9d971fb62a 100644 --- a/apps/files_sharing/ajax/userautocomplete.php +++ b/apps/files_sharing/ajax/userautocomplete.php @@ -1,5 +1,5 @@ Date: Tue, 4 Oct 2011 15:58:54 +0200 Subject: [PATCH 073/136] apps file_sharing - remove "$RUNTIME_NOAPPS = true" from all ajax file to enable other user backend --- apps/files_sharing/ajax/getitem.php | 2 +- apps/files_sharing/ajax/setpermissions.php | 2 +- apps/files_sharing/ajax/share.php | 2 +- apps/files_sharing/ajax/unshare.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/files_sharing/ajax/getitem.php b/apps/files_sharing/ajax/getitem.php index 075ec043ea..d9df4abe98 100644 --- a/apps/files_sharing/ajax/getitem.php +++ b/apps/files_sharing/ajax/getitem.php @@ -1,5 +1,5 @@ Date: Tue, 4 Oct 2011 16:08:14 +0200 Subject: [PATCH 074/136] apps files_sharing - fix in share.js to check the "can edit" checkbox - there was a bug in share.js so the checbox was always unchecked --- apps/files_sharing/js/share.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index 4056d693bf..4457dddbe1 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -224,7 +224,7 @@ function addUser(uid_shared_with, permissions, parentFolder) { var user = '
    3. '; user += ''; user += uid_shared_with; - user += ''; + user += ''; user += ''; user += '
    4. '; } From 1c7ba0dd9eb79558fd4cd463aafa28bde1b51e85 Mon Sep 17 00:00:00 2001 From: Markus Kalkbrenner Date: Thu, 17 Nov 2011 10:31:30 +0100 Subject: [PATCH 075/136] added .buildpath --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index a84615cf13..68c48822e9 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,4 @@ nbproject # WebFinger .well-known +/.buildpath From 0155effdb75f3c1508ab96a14eb957fb434e51af Mon Sep 17 00:00:00 2001 From: Markus Kalkbrenner Date: Thu, 17 Nov 2011 11:16:56 +0100 Subject: [PATCH 076/136] - bugfix: allow anonymous bind for search, then bind with users credentials. - added explaination how to setup anonymous bind for search to template - make usage of TLS configurable --- apps/user_ldap/settings.php | 6 +++++- apps/user_ldap/templates/settings.php | 4 +++- apps/user_ldap/user_ldap.php | 14 ++++++++------ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/apps/user_ldap/settings.php b/apps/user_ldap/settings.php index 8dbd3c0462..b922ac99f9 100644 --- a/apps/user_ldap/settings.php +++ b/apps/user_ldap/settings.php @@ -20,12 +20,16 @@ * License along with this library. If not, see . * */ -$params = array('ldap_host', 'ldap_port', 'ldap_dn', 'ldap_password', 'ldap_base', 'ldap_filter'); +$params = array('ldap_host', 'ldap_port', 'ldap_dn', 'ldap_password', 'ldap_base', 'ldap_filter', 'ldap_tls'); foreach($params as $param){ if(isset($_POST[$param])){ OC_Appconfig::setValue('user_ldap', $param, $_POST[$param]); } + elseif('ldap_tls' == $param) { + // unchecked checkboxes are not included in the post paramters + OC_Appconfig::setValue('user_ldap', $param, 0); + } } // fill template diff --git a/apps/user_ldap/templates/settings.php b/apps/user_ldap/templates/settings.php index 32e1b29daf..374f124174 100644 --- a/apps/user_ldap/templates/settings.php +++ b/apps/user_ldap/templates/settings.php @@ -4,9 +4,11 @@

      -

      + + Leave both empty for anonymous bind for search, then bind with users credentials.

      +

      >

      diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php index 4fb8daf3c4..1100be81eb 100644 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -33,6 +33,7 @@ class OC_USER_LDAP extends OC_User_Backend { protected $ldap_password; protected $ldap_base; protected $ldap_filter; + protected $ldap_tls; function __construct() { $this->ldap_host = OC_Appconfig::getValue('user_ldap', 'ldap_host',''); @@ -41,11 +42,11 @@ class OC_USER_LDAP extends OC_User_Backend { $this->ldap_password = OC_Appconfig::getValue('user_ldap', 'ldap_password',''); $this->ldap_base = OC_Appconfig::getValue('user_ldap', 'ldap_base',''); $this->ldap_filter = OC_Appconfig::getValue('user_ldap', 'ldap_filter',''); + $this->ldap_tls = OC_Appconfig::getValue('user_tls', 'ldap_tls', 0); if( !empty($this->ldap_host) && !empty($this->ldap_port) - && !empty($this->ldap_dn) - && !empty($this->ldap_password) + && ((!empty($this->ldap_dn) && !empty($this->ldap_password)) || (empty($this->ldap_dn) && empty($this->ldap_password))) && !empty($this->ldap_base) && !empty($this->ldap_filter) ) @@ -63,9 +64,10 @@ class OC_USER_LDAP extends OC_User_Backend { private function getDs() { if(!$this->ds) { $this->ds = ldap_connect( $this->ldap_host, $this->ldap_port ); - if(ldap_set_option($this->ds, LDAP_OPT_PROTOCOL_VERSION, 3)) - if(ldap_set_option($this->ds, LDAP_OPT_REFERRALS, 0)) - @ldap_start_tls($this->ds); + if(ldap_set_option($this->ds, LDAP_OPT_PROTOCOL_VERSION, 3)) + if(ldap_set_option($this->ds, LDAP_OPT_REFERRALS, 0)) + if($this->ldap_tls) + ldap_start_tls($this->ds); } // login @@ -149,4 +151,4 @@ class OC_USER_LDAP extends OC_User_Backend { } -?> \ No newline at end of file +?> From cff6a41e2b8aa78e682f4b9cc2f28e2a7efa340d Mon Sep 17 00:00:00 2001 From: Markus Kalkbrenner Date: Thu, 17 Nov 2011 15:17:01 +0100 Subject: [PATCH 077/136] fixed copy&paste error: store ldap_tls setting in user_ldap, not user_tls --- apps/user_ldap/user_ldap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php index 1100be81eb..dd831f57aa 100644 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -42,7 +42,7 @@ class OC_USER_LDAP extends OC_User_Backend { $this->ldap_password = OC_Appconfig::getValue('user_ldap', 'ldap_password',''); $this->ldap_base = OC_Appconfig::getValue('user_ldap', 'ldap_base',''); $this->ldap_filter = OC_Appconfig::getValue('user_ldap', 'ldap_filter',''); - $this->ldap_tls = OC_Appconfig::getValue('user_tls', 'ldap_tls', 0); + $this->ldap_tls = OC_Appconfig::getValue('user_ldap', 'ldap_tls', 0); if( !empty($this->ldap_host) && !empty($this->ldap_port) From bf84aa23f40980bae72ced15b1830d6e4dfc49eb Mon Sep 17 00:00:00 2001 From: Markus Kalkbrenner Date: Thu, 17 Nov 2011 16:03:42 +0100 Subject: [PATCH 078/136] - provide a setting for the ldap user display name instead of hardcoded value 'uid' which is not common for Active Directory - provide a sorted list of ldap users - replaced double quotes by single quotes and spaces by tabs according to coding standards - replaced hardcoded strings in template by translatable ones --- apps/user_ldap/appinfo/app.php | 5 ++++- apps/user_ldap/settings.php | 5 ++++- apps/user_ldap/templates/settings.php | 15 ++++++++------- apps/user_ldap/user_ldap.php | 24 ++++++++++++++---------- 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/apps/user_ldap/appinfo/app.php b/apps/user_ldap/appinfo/app.php index 7906241f79..3261708f59 100644 --- a/apps/user_ldap/appinfo/app.php +++ b/apps/user_ldap/appinfo/app.php @@ -26,7 +26,10 @@ require_once('apps/user_ldap/user_ldap.php'); OC_APP::registerAdmin('user_ldap','settings'); // define LDAP_DEFAULT_PORT -define("OC_USER_BACKEND_LDAP_DEFAULT_PORT", 389); +define('OC_USER_BACKEND_LDAP_DEFAULT_PORT', 389); + +// define OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME +define('OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME', 'uid'); // register user backend OC_User::useBackend( "LDAP" ); diff --git a/apps/user_ldap/settings.php b/apps/user_ldap/settings.php index b922ac99f9..e61d82bf8b 100644 --- a/apps/user_ldap/settings.php +++ b/apps/user_ldap/settings.php @@ -20,7 +20,7 @@ * License along with this library. If not, see . * */ -$params = array('ldap_host', 'ldap_port', 'ldap_dn', 'ldap_password', 'ldap_base', 'ldap_filter', 'ldap_tls'); +$params = array('ldap_host', 'ldap_port', 'ldap_dn', 'ldap_password', 'ldap_base', 'ldap_filter', 'ldap_display_name', 'ldap_tls'); foreach($params as $param){ if(isset($_POST[$param])){ @@ -42,4 +42,7 @@ foreach($params as $param){ // ldap_port has a default value $tmpl->assign( 'ldap_port', OC_Appconfig::getValue('user_ldap', 'ldap_port', OC_USER_BACKEND_LDAP_DEFAULT_PORT)); +// ldap_display_name has a default value +$tmpl->assign( 'ldap_display_name', OC_Appconfig::getValue('user_ldap', 'ldap_display_name', OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME)); + return $tmpl->fetchPage(); diff --git a/apps/user_ldap/templates/settings.php b/apps/user_ldap/templates/settings.php index 374f124174..8a879fa246 100644 --- a/apps/user_ldap/templates/settings.php +++ b/apps/user_ldap/templates/settings.php @@ -1,13 +1,14 @@
      LDAP -

      -

      -

      - - Leave both empty for anonymous bind for search, then bind with users credentials.

      -

      -

      +

      +

      +

      + + t('Leave both empty for anonymous bind for search, then bind with users credentials.');?>

      +

      +

      +

      >

      diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php index dd831f57aa..8557a7fde5 100644 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -34,6 +34,7 @@ class OC_USER_LDAP extends OC_User_Backend { protected $ldap_base; protected $ldap_filter; protected $ldap_tls; + protected $ldap_display_name; function __construct() { $this->ldap_host = OC_Appconfig::getValue('user_ldap', 'ldap_host',''); @@ -43,12 +44,14 @@ class OC_USER_LDAP extends OC_User_Backend { $this->ldap_base = OC_Appconfig::getValue('user_ldap', 'ldap_base',''); $this->ldap_filter = OC_Appconfig::getValue('user_ldap', 'ldap_filter',''); $this->ldap_tls = OC_Appconfig::getValue('user_ldap', 'ldap_tls', 0); + $this->ldap_display_name = OC_Appconfig::getValue('user_ldap', 'ldap_display_name', OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME); if( !empty($this->ldap_host) && !empty($this->ldap_port) && ((!empty($this->ldap_dn) && !empty($this->ldap_password)) || (empty($this->ldap_dn) && empty($this->ldap_password))) && !empty($this->ldap_base) && !empty($this->ldap_filter) + && !empty($this->ldap_display_name) ) { $this->configured = true; @@ -90,15 +93,16 @@ class OC_USER_LDAP extends OC_User_Backend { return false; // get dn - $filter = str_replace("%uid", $uid, $this->ldap_filter); + $filter = str_replace('%uid', $uid, $this->ldap_filter); $sr = ldap_search( $this->getDs(), $this->ldap_base, $filter ); $entries = ldap_get_entries( $this->getDs(), $sr ); - if( $entries["count"] == 0 ) + if( $entries['count'] == 0 ) return false; - return $entries[0]["dn"]; + return $entries[0]['dn']; } + public function checkPassword( $uid, $password ) { if(!$this->configured){ return false; @@ -131,22 +135,22 @@ class OC_USER_LDAP extends OC_User_Backend { return false; // get users - $filter = "objectClass=person"; + $filter = 'objectClass=person'; $sr = ldap_search( $this->getDs(), $this->ldap_base, $filter ); $entries = ldap_get_entries( $this->getDs(), $sr ); - - if( $entries["count"] == 0 ) + if( $entries['count'] == 0 ) return false; else { $users = array(); foreach($entries as $row) { - if(isset($row['uid'])) { - $users[] = $row['uid'][0]; + if(isset($row[$this->ldap_display_name])) { + $users[] = $row[$this->ldap_display_name][0]; } } + // TODO language specific sorting of user names + sort($users); + return $users; } - - return $users; } } From 48ae18a7333a14072bee02cbb31a1753181bc229 Mon Sep 17 00:00:00 2001 From: Markus Kalkbrenner Date: Thu, 17 Nov 2011 17:14:10 +0100 Subject: [PATCH 079/136] - fixed translateable strings in template - added explaination about ldap filter and display name - bugfix: keys in ldap response are lower case => lower display name filed before searching --- apps/user_ldap/templates/settings.php | 7 ++++--- apps/user_ldap/user_ldap.php | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/apps/user_ldap/templates/settings.php b/apps/user_ldap/templates/settings.php index 8a879fa246..5f25570e22 100644 --- a/apps/user_ldap/templates/settings.php +++ b/apps/user_ldap/templates/settings.php @@ -5,10 +5,11 @@

      - t('Leave both empty for anonymous bind for search, then bind with users credentials.');?>

      + t('Leave both empty for anonymous bind for search, then bind with users credentials.');?>

      -

      -

      +

      +

      + t('Currently the display name field needs to be the same you matched %%uid against in the filter above, because ownCloud doesn\'t distinguish between user id and user name.');?>

      >

      diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php index 8557a7fde5..249def7a1c 100644 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -143,8 +143,10 @@ class OC_USER_LDAP extends OC_User_Backend { else { $users = array(); foreach($entries as $row) { - if(isset($row[$this->ldap_display_name])) { - $users[] = $row[$this->ldap_display_name][0]; + // TODO ldap_get_entries() seems to lower all keys => needs review + $ldap_display_name = strtolower($this->ldap_display_name); + if(isset($row[$ldap_display_name])) { + $users[] = $row[$ldap_display_name][0]; } } // TODO language specific sorting of user names From 4bebf419d1e06929b86fbb33e146d4e7ef7766fb Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 18 Nov 2011 20:19:55 +0100 Subject: [PATCH 080/136] use oc_appconfig instead of oc_config for the external apps --- apps/external/ajax/seturls.php | 20 ++++++++++---------- apps/external/appinfo/app.php | 10 +++++----- apps/external/index.php | 2 +- apps/external/settings.php | 20 ++++++++++---------- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/apps/external/ajax/seturls.php b/apps/external/ajax/seturls.php index c8e9775454..e994385a19 100644 --- a/apps/external/ajax/seturls.php +++ b/apps/external/ajax/seturls.php @@ -8,16 +8,16 @@ require_once('../../../lib/base.php'); OC_Util::checkAdminUser(); -if(isset($_POST['s1name'])) OC_Config::setValue( 'external-site1name', $_POST['s1name'] ); -if(isset($_POST['s1url'])) OC_Config::setValue( 'external-site1url', $_POST['s1url'] ); -if(isset($_POST['s2name'])) OC_Config::setValue( 'external-site2name', $_POST['s2name'] ); -if(isset($_POST['s2url'])) OC_Config::setValue( 'external-site2url', $_POST['s2url'] ); -if(isset($_POST['s3name'])) OC_Config::setValue( 'external-site3name', $_POST['s3name'] ); -if(isset($_POST['s3url'])) OC_Config::setValue( 'external-site3url', $_POST['s3url'] ); -if(isset($_POST['s4name'])) OC_Config::setValue( 'external-site4name', $_POST['s4name'] ); -if(isset($_POST['s4url'])) OC_Config::setValue( 'external-site4url', $_POST['s4url'] ); -if(isset($_POST['s5name'])) OC_Config::setValue( 'external-site5name', $_POST['s5name'] ); -if(isset($_POST['s5url'])) OC_Config::setValue( 'external-site5url', $_POST['s5url'] ); +if(isset($_POST['s1name'])) OC_Appconfig::setValue( 'external','site1name', $_POST['s1name'] ); +if(isset($_POST['s1url'])) OC_Appconfig::setValue( 'external','site1url', $_POST['s1url'] ); +if(isset($_POST['s2name'])) OC_Appconfig::setValue( 'external','site2name', $_POST['s2name'] ); +if(isset($_POST['s2url'])) OC_Appconfig::setValue( 'external','site2url', $_POST['s2url'] ); +if(isset($_POST['s3name'])) OC_Appconfig::setValue( 'external','site3name', $_POST['s3name'] ); +if(isset($_POST['s3url'])) OC_Appconfig::setValue( 'external','site3url', $_POST['s3url'] ); +if(isset($_POST['s4name'])) OC_Appconfig::setValue( 'external','site4name', $_POST['s4name'] ); +if(isset($_POST['s4url'])) OC_Appconfig::setValue( 'external','site4url', $_POST['s4url'] ); +if(isset($_POST['s5name'])) OC_Appconfig::setValue( 'external','site5name', $_POST['s5name'] ); +if(isset($_POST['s5url'])) OC_Appconfig::setValue( 'external','site5url', $_POST['s5url'] ); echo 'true'; diff --git a/apps/external/appinfo/app.php b/apps/external/appinfo/app.php index df14954d86..0f536cbf41 100644 --- a/apps/external/appinfo/app.php +++ b/apps/external/appinfo/app.php @@ -25,13 +25,13 @@ OC_APP::registerAdmin('external','settings'); OC_App::register( array( 'order' => 70, 'id' => 'external', 'name' => 'External' )); -if(OC_Config::getValue( "external-site1name", '' )<>'') OC_App::addNavigationEntry( array( 'id' => 'external_index1', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=1', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Config::getValue( "external-site1name", '' ))); +if(OC_Appconfig::getValue( "external","site1name", '' )<>'') OC_App::addNavigationEntry( array( 'id' => 'external_index1', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=1', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Appconfig::getValue( "external","site1name", '' ))); -if(OC_Config::getValue( "external-site2name", '' )<>'') OC_App::addNavigationEntry( array( 'id' => 'external_index2', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=2', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Config::getValue( "external-site2name", '' ))); +if(OC_Appconfig::getValue( "external","site2name", '' )<>'') OC_App::addNavigationEntry( array( 'id' => 'external_index2', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=2', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Appconfig::getValue( "external","site2name", '' ))); -if(OC_Config::getValue( "external-site3name", '' )<>'') OC_App::addNavigationEntry( array( 'id' => 'external_index3', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=3', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Config::getValue( "external-site3name", '' ))); +if(OC_Appconfig::getValue( "external","site3name", '' )<>'') OC_App::addNavigationEntry( array( 'id' => 'external_index3', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=3', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Appconfig::getValue( "external","site3name", '' ))); -if(OC_Config::getValue( "external-site4name", '' )<>'') OC_App::addNavigationEntry( array( 'id' => 'external_index4', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=4', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Config::getValue( "external-site4name", '' ))); +if(OC_Appconfig::getValue( "external","site4name", '' )<>'') OC_App::addNavigationEntry( array( 'id' => 'external_index4', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=4', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Appconfig::getValue( "external","site4name", '' ))); -if(OC_Config::getValue( "external-site5name", '' )<>'') OC_App::addNavigationEntry( array( 'id' => 'external_index5', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=5', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Config::getValue( "external-site5name", '' ))); +if(OC_Appconfig::getValue( "external","site5name", '' )<>'') OC_App::addNavigationEntry( array( 'id' => 'external_index5', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=5', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Appconfig::getValue( "external","site5name", '' ))); diff --git a/apps/external/index.php b/apps/external/index.php index 116e16d909..86b19abc10 100644 --- a/apps/external/index.php +++ b/apps/external/index.php @@ -35,7 +35,7 @@ if(isset($_GET['id'])){ $id=$_GET['id']; $id = (int) $id; - $url=OC_Config::getValue( "external-site".$id."url", '' ); + $url=OC_Appconfig::getValue( "external","site".$id."url", '' ); OC_App::setActiveNavigationEntry( 'external_index'.$id ); $tmpl = new OC_Template( 'external', 'frame', 'user' ); diff --git a/apps/external/settings.php b/apps/external/settings.php index ad33c16e1b..3e0c342512 100644 --- a/apps/external/settings.php +++ b/apps/external/settings.php @@ -6,17 +6,17 @@ OC_Util::addScript( "external", "admin" ); $tmpl = new OC_Template( 'external', 'settings'); - $tmpl->assign('s1name',OC_Config::getValue( "external-site1name", '' )); - $tmpl->assign('s2name',OC_Config::getValue( "external-site2name", '' )); - $tmpl->assign('s3name',OC_Config::getValue( "external-site3name", '' )); - $tmpl->assign('s4name',OC_Config::getValue( "external-site4name", '' )); - $tmpl->assign('s5name',OC_Config::getValue( "external-site5name", '' )); + $tmpl->assign('s1name',OC_Appconfig::getValue( "external","site1name", '' )); + $tmpl->assign('s2name',OC_Appconfig::getValue( "external","site2name", '' )); + $tmpl->assign('s3name',OC_Appconfig::getValue( "external","site3name", '' )); + $tmpl->assign('s4name',OC_Appconfig::getValue( "external","site4name", '' )); + $tmpl->assign('s5name',OC_Appconfig::getValue( "external","site5name", '' )); - $tmpl->assign('s1url',OC_Config::getValue( "external-site1url", '' )); - $tmpl->assign('s2url',OC_Config::getValue( "external-site2url", '' )); - $tmpl->assign('s3url',OC_Config::getValue( "external-site3url", '' )); - $tmpl->assign('s4url',OC_Config::getValue( "external-site4url", '' )); - $tmpl->assign('s5url',OC_Config::getValue( "external-site5url", '' )); + $tmpl->assign('s1url',OC_Appconfig::getValue( "external","site1url", '' )); + $tmpl->assign('s2url',OC_Appconfig::getValue( "external","site2url", '' )); + $tmpl->assign('s3url',OC_Appconfig::getValue( "external","site3url", '' )); + $tmpl->assign('s4url',OC_Appconfig::getValue( "external","site4url", '' )); + $tmpl->assign('s5url',OC_Appconfig::getValue( "external","site5url", '' )); return $tmpl->fetchPage(); ?> From 949bd2c47a47196f767aa8a6a8e70ae0b834ad90 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Sat, 19 Nov 2011 11:56:40 +0100 Subject: [PATCH 081/136] first small step to an automatic updating system. At the moment we only have a hint that a new version is avaiable and a link to a not yet existing page if updating information. This has to be improved. --- lib/updater.php | 91 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 lib/updater.php diff --git a/lib/updater.php b/lib/updater.php new file mode 100644 index 0000000000..e4db719a62 --- /dev/null +++ b/lib/updater.php @@ -0,0 +1,91 @@ +. + * + */ + +/** + * Class that handels autoupdating of ownCloud + */ +class OC_Updater{ + + /** + * Check if a new version is available + */ + public static function check(){ + OC_Config::setValue('lastupdatedat',microtime(true)); + + $updaterurl='http://apps.owncloud.com/updater.php'; + $version=OC_Util::getVersion(); + $version['installed']=OC_Config::getValue( "installedat"); + $version['updated']=OC_Config::getValue( "lastupdatedat"); + $version['updatechannel']='stable'; + $versionstring=implode('x',$version); + + //fetch xml data from updater + $url=$updaterurl.'?version='.$versionstring; + $xml=@file_get_contents($url); + if($xml==FALSE){ + return array(); + } + $data=@simplexml_load_string($xml); + + $tmp=array(); + $tmp['version'] = $data->version; + $tmp['versionstring'] = $data->versionstring; + $tmp['url'] = $data->url; + $tmp['web'] = $data->web; + + + return $tmp; + + } + + + + public static function ShowUpdatingHint(){ + $data=OC_Updater::check(); + if(isset($data['version']) and $data['version']<>'') { + $txt=''.$data['versionstring'].' is available. Please click here for more information'; + }else{ + $txt='Your ownCloud is up to date'; + } + return($txt); + + } + + + /** + * do ownCloud update + */ + public static function doUpdate(){ + + //update ownCloud core + + //update all apps + + //update version in config + + } + +} + + + +?> From 7df9d934caecfdbc6e316d79e37d37ebd52bdda6 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Sat, 19 Nov 2011 12:02:34 +0100 Subject: [PATCH 082/136] second half of the updating stuff --- lib/config.php | 1 - lib/setup.php | 2 ++ settings/templates/personal.php | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/config.php b/lib/config.php index 2c82036257..8d03271b3e 100644 --- a/lib/config.php +++ b/lib/config.php @@ -94,7 +94,6 @@ class OC_Config{ // Write changes self::writeData(); - return true; } diff --git a/lib/setup.php b/lib/setup.php index e2d56ddaf4..8afe0070e9 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -77,6 +77,8 @@ class OC_Setup { OC_Config::setValue('datadirectory', $datadir); OC_Config::setValue('dbtype', $dbtype); OC_Config::setValue('version',implode('.',OC_Util::getVersion())); + OC_Config::setValue('installedat',microtime(true)); + OC_Config::setValue('lastupdatedat',microtime(true)); if($dbtype == 'mysql') { $dbuser = $options['dbuser']; $dbpass = $options['dbpass']; diff --git a/settings/templates/personal.php b/settings/templates/personal.php index 54487165f3..8c5de5ccf2 100644 --- a/settings/templates/personal.php +++ b/settings/templates/personal.php @@ -50,7 +50,9 @@ };?>

      - ownCloud , source code licensed freely under AGPL + ownCloud
      +
      + source code licensed freely under AGPL

      From a38778f9115d3c6463e74bdf27d003e01e7dc88c Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sun, 20 Nov 2011 14:23:26 +0100 Subject: [PATCH 083/136] fix timeformat setting for fullcalendar --- apps/calendar/js/calendar.js | 10 +++++----- apps/calendar/templates/calendar.php | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js index af5ecd8281..5592e418a4 100644 --- a/apps/calendar/js/calendar.js +++ b/apps/calendar/js/calendar.js @@ -138,9 +138,9 @@ Calendar={ }, getEventPopupText:function(event){ if (event.allDay){ - var timespan = $.fullCalendar.formatDates(event.start, event.end, t('calendar', "ddd d MMMM[ yyyy]{ -[ddd d] MMMM yyyy}")); + var timespan = $.fullCalendar.formatDates(event.start, event.end, 'ddd d MMMM[ yyyy]{ -[ddd d] MMMM yyyy}', {monthNamesShort: monthNamesShort, monthNames: monthNames, dayNames: dayNames, dayNamesShort: dayNamesShort}); //t('calendar', "ddd d MMMM[ yyyy]{ -[ddd d] MMMM yyyy}") }else{ - var timespan = $.fullCalendar.formatDates(event.start, event.end, t('calendar', "ddd d MMMM[ yyyy] HH:mm{ -[ ddd d MMMM yyyy] HH:mm}")); + var timespan = $.fullCalendar.formatDates(event.start, event.end, 'ddd d MMMM[ yyyy] ' + defaulttime + '{ -[ ddd d MMMM yyyy]' + defaulttime + '}', {monthNamesShort: monthNamesShort, monthNames: monthNames, dayNames: dayNames, dayNamesShort: dayNamesShort}); //t('calendar', "ddd d MMMM[ yyyy] HH:mm{ -[ ddd d MMMM yyyy] HH:mm}") // Tue 18 October 2011 08:00 - 16:00 } var html = @@ -482,13 +482,13 @@ $(document).ready(function(){ editable: true, defaultView: defaultView, timeFormat: { - agenda: 'HH:mm{ - HH:mm}', - '': 'HH:mm' + agenda: agendatime, + '': defaulttime }, titleFormat: { list: 'yyyy/MMM/d dddd' }, - axisFormat: 'HH:mm', + axisFormat: defaulttime, monthNames: monthNames, monthNamesShort: monthNamesShort, dayNames: dayNames, diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php index 76c0249e26..2003b7efc4 100755 --- a/apps/calendar/templates/calendar.php +++ b/apps/calendar/templates/calendar.php @@ -5,6 +5,8 @@ var dayNamesShort = tA(array('Sun.', 'Mon.', 'Tue.', 'Wed.', 'Thu.', 'Fri.', 'Sat.'))) ?>; var monthNames = tA(array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'))) ?>; var monthNamesShort = tA(array('Jan.', 'Feb.', 'Mar.', 'Apr.', 'May.', 'Jun.', 'Jul.', 'Aug.', 'Sep.', 'Oct.', 'Nov.', 'Dec.'))) ?>; + var agendatime = '{ - }'; + var defaulttime = ''; var allDayText = 't('All day') ?>'; var missing_field = 't('Missing fields') ?>'; var missing_field_title = 't('Title') ?>'; From ad390d5e42eaa9d56c79f7d81d057ef88eda9117 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 17 Nov 2011 23:54:14 +0100 Subject: [PATCH 084/136] Add type selects to editing ADR & TEL contact property types --- apps/contacts/ajax/addcard.php | 5 +++++ apps/contacts/ajax/setproperty.php | 5 +++++ apps/contacts/ajax/showsetproperty.php | 2 ++ apps/contacts/index.php | 6 +++++ apps/contacts/templates/part.property.php | 22 +++++++++++++++++-- .../templates/part.setpropertyform.php | 5 ++++- 6 files changed, 42 insertions(+), 3 deletions(-) diff --git a/apps/contacts/ajax/addcard.php b/apps/contacts/ajax/addcard.php index 0cecd3bdc0..dd5b90651f 100644 --- a/apps/contacts/ajax/addcard.php +++ b/apps/contacts/ajax/addcard.php @@ -68,11 +68,16 @@ foreach( $add as $propname){ } $id = OC_Contacts_VCard::add($aid,$vcard->serialize()); +$adr_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'ADR'); +$phone_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'TEL'); + $details = OC_Contacts_VCard::structureContact($vcard); $name = $details['FN'][0]['value']; $tmpl = new OC_Template('contacts','part.details'); $tmpl->assign('details',$details); $tmpl->assign('id',$id); +$tmpl->assign('adr_types',$adr_types); +$tmpl->assign('phone_types',$phone_types); $page = $tmpl->fetchPage(); OC_JSON::success(array('data' => array( 'id' => $id, 'name' => $name, 'page' => $page ))); diff --git a/apps/contacts/ajax/setproperty.php b/apps/contacts/ajax/setproperty.php index 18e0087247..9164f86913 100644 --- a/apps/contacts/ajax/setproperty.php +++ b/apps/contacts/ajax/setproperty.php @@ -94,7 +94,12 @@ $checksum = md5($vcard->children[$line]->serialize()); OC_Contacts_VCard::edit($id,$vcard->serialize()); +$adr_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'ADR'); +$phone_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'TEL'); + $tmpl = new OC_Template('contacts','part.property'); +$tmpl->assign('adr_types',$adr_types); +$tmpl->assign('phone_types',$phone_types); $tmpl->assign('property',OC_Contacts_VCard::structureProperty($vcard->children[$line],$line)); $page = $tmpl->fetchPage(); diff --git a/apps/contacts/ajax/showsetproperty.php b/apps/contacts/ajax/showsetproperty.php index 4ec3dd7d8e..2ec4b89b82 100644 --- a/apps/contacts/ajax/showsetproperty.php +++ b/apps/contacts/ajax/showsetproperty.php @@ -62,12 +62,14 @@ if(is_null($line)){ } $adr_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'ADR'); +$phone_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'TEL'); $tmpl = new OC_Template('contacts','part.setpropertyform'); $tmpl->assign('id',$id); $tmpl->assign('checksum',$checksum); $tmpl->assign('property',OC_Contacts_VCard::structureProperty($vcard->children[$line])); $tmpl->assign('adr_types',$adr_types); +$tmpl->assign('phone_types',$phone_types); $page = $tmpl->fetchPage(); OC_JSON::success(array('data' => array( 'page' => $page ))); diff --git a/apps/contacts/index.php b/apps/contacts/index.php index 7e93d6183e..29d41d3c4c 100644 --- a/apps/contacts/index.php +++ b/apps/contacts/index.php @@ -75,8 +75,14 @@ if( !is_null($id) || count($contacts)){ $details = OC_Contacts_VCard::structureContact($vcard); } +$l10n = new OC_L10N('contacts'); +$adr_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'ADR'); +$phone_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'TEL'); + // Process the template $tmpl = new OC_Template( 'contacts', 'index', 'user' ); +$tmpl->assign('adr_types',$adr_types); +$tmpl->assign('phone_types',$phone_types); $tmpl->assign('addressbooks', $addressbooks); $tmpl->assign('contacts', $contacts); $tmpl->assign('details', $details ); diff --git a/apps/contacts/templates/part.property.php b/apps/contacts/templates/part.property.php index 4bc3a4d85f..dbd125dc95 100644 --- a/apps/contacts/templates/part.property.php +++ b/apps/contacts/templates/part.property.php @@ -24,7 +24,16 @@

      - (t(ucwords(str_replace('cell','mobile',strtolower($_['property']['parameters']['TYPE'])))); ?>) +t(ucwords(strtolower($type))); + } +?> + () @@ -34,7 +43,16 @@ t('Address'); ?>
      - (t(ucwords($_['property']['parameters']['TYPE'])); ?>) +t(ucwords(strtolower($type))); + } +?> + ()

      diff --git a/apps/contacts/templates/part.setpropertyform.php b/apps/contacts/templates/part.setpropertyform.php index 811b9626ce..9340ce7c71 100644 --- a/apps/contacts/templates/part.setpropertyform.php +++ b/apps/contacts/templates/part.setpropertyform.php @@ -42,7 +42,10 @@

    -

    +

    +

    From a2ecdfcac102395ce3d9da41b4074fd7e4cc927e Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Wed, 23 Nov 2011 21:06:51 +0100 Subject: [PATCH 085/136] Contacts: support multiple phone type parameter --- apps/contacts/ajax/setproperty.php | 12 ++++++++++- apps/contacts/css/formtastic.css | 8 +++----- apps/contacts/css/styles.css | 11 +++++++--- apps/contacts/js/interface.js | 12 +++++++---- apps/contacts/lib/vcard.php | 20 +++++++++++++++++-- apps/contacts/templates/part.addcardform.php | 2 +- apps/contacts/templates/part.property.php | 19 ++++++++++-------- .../templates/part.setpropertyform.php | 6 +++--- 8 files changed, 63 insertions(+), 27 deletions(-) diff --git a/apps/contacts/ajax/setproperty.php b/apps/contacts/ajax/setproperty.php index 9164f86913..c9102c4a2e 100644 --- a/apps/contacts/ajax/setproperty.php +++ b/apps/contacts/ajax/setproperty.php @@ -70,6 +70,9 @@ $vcard->children[$line]->setValue($value); // Add parameters $postparameters = isset($_POST['parameters'])?$_POST['parameters']:array(); +if ($vcard->children[$line]->name == 'TEL' && !array_key_exists('TYPE', $postparameters)){ + $postparameters['TYPE']=''; +} for($i=0;$ichildren[$line]->parameters);$i++){ $name = $vcard->children[$line]->parameters[$i]->name; if(array_key_exists($name,$postparameters)){ @@ -77,7 +80,14 @@ for($i=0;$ichildren[$line]->parameters);$i++){ unset($vcard->children[$line]->parameters[$i]); } else{ - $vcard->children[$line]->parameters[$i]->value = $postparameters[$name]; + unset($vcard->children[$line][$name]); + $values = $postparameters[$name]; + if (!is_array($values)){ + $values = array($values); + } + foreach($values as $value){ + $vcard->children[$line]->add($name, $value); + } } unset($postparameters[$name]); } diff --git a/apps/contacts/css/formtastic.css b/apps/contacts/css/formtastic.css index 629c220732..fede92b61c 100644 --- a/apps/contacts/css/formtastic.css +++ b/apps/contacts/css/formtastic.css @@ -94,16 +94,14 @@ This stylesheet forms part of the Formtastic Rails Plugin /* INPUTS --------------------------------------------------------------------------------------------------*/ .formtastic .inputs { - overflow:hidden; /* clear containing floats */ -} - -.formtastic .input { - overflow:hidden; /* clear containing floats */ padding:0.5em 0; /* padding and negative margin juggling is for Firefox */ margin-top:-0.5em; margin-bottom:1em; } +.formtastic .input { +} + /* LEFT ALIGNED LABELS --------------------------------------------------------------------------------------------------*/ diff --git a/apps/contacts/css/styles.css b/apps/contacts/css/styles.css index ad64c777ee..e226c48ae5 100644 --- a/apps/contacts/css/styles.css +++ b/apps/contacts/css/styles.css @@ -3,16 +3,21 @@ #contacts_deletecard {position:absolute;top:15px;right:0;} #contacts_details_list { list-style:none; } -#contacts_details_list li { overflow:hidden; } #contacts_details_list li p.contacts_property_name { width:25%; float:left;text-align:right;padding-right:0.3em;color:#666; } -#contacts_details_list li p.contacts_property_data, #contacts_details_list li ul.contacts_property_data { width:72%; overflow:hidden; } +#contacts_details_list li p.contacts_property_data, #contacts_details_list li ul.contacts_property_data { width:72%;float:left; } #contacts_addproperty_button, #contacts_setproperty_button { margin-left:25%; } -.contacts_property_data ul, .contacts_property_data ol { list-style:none; } +.contacts_property_data ul, ol.contacts_property_data { list-style:none; } .contacts_property_data li { overflow: hidden; } .contacts_property_data li label { width:20%; float:left; text-align:right;padding-right:0.3em; } +.contacts_property_data input { float:left; } .contacts_property_data li input { width:70%;overflow:hidden; } +.chzn-container { margin:3px 0 0; } +.chzn-container .chzn-choices { border-radius: 0.5em; } +.chzn-container.chzn-container-active .chzn-choices { border-bottom-left-radius: 0;border-bottom-right-radius: 0; } +.chzn-container .chzn-drop { border-bottom-left-radius: 0.5em;border-bottom-right-radius: 0.5em; } + /* Form setup ----------------------------------------------------------------*/ /* .forme {} */ /* .forme ul, .forme ol { list-style:none; } */ diff --git a/apps/contacts/js/interface.js b/apps/contacts/js/interface.js index 1cc3a5dfd6..24b512e532 100644 --- a/apps/contacts/js/interface.js +++ b/apps/contacts/js/interface.js @@ -82,7 +82,8 @@ $(document).ready(function(){ $.getJSON('ajax/showaddcard.php',{},function(jsondata){ if(jsondata.status == 'success'){ $('#rightcontent').data('id',''); - $('#rightcontent').html(jsondata.data.page); + $('#rightcontent').html(jsondata.data.page) + .find('select').chosen(); } else{ alert(jsondata.data.message); @@ -111,7 +112,8 @@ $(document).ready(function(){ var checksum = $(this).parents('li').first().data('checksum'); $.getJSON('ajax/showsetproperty.php',{'id': id, 'checksum': checksum },function(jsondata){ if(jsondata.status == 'success'){ - $('.contacts_property[data-checksum="'+checksum+'"]').html(jsondata.data.page); + $('.contacts_property[data-checksum="'+checksum+'"]').html(jsondata.data.page) + .find('select').chosen(); } else{ alert(jsondata.data.message); @@ -148,10 +150,12 @@ $(document).ready(function(){ $('.contacts_property').live('mouseenter',function(){ - $(this).find('span').show(); + $(this).find('span[data-use]').show(); }); $('.contacts_property').live('mouseleave',function(){ - $(this).find('span').hide(); + $(this).find('span[data-use]').hide(); }); + + $('#contacts_addcardform select').chosen(); }); diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php index 56602f25c0..4865fae764 100644 --- a/apps/contacts/lib/vcard.php +++ b/apps/contacts/lib/vcard.php @@ -296,7 +296,13 @@ class OC_Contacts_VCard{ $property = new Sabre_VObject_Property( $name, $value ); $parameternames = array_keys($parameters); foreach($parameternames as $i){ - $property->parameters[] = new Sabre_VObject_Parameter($i,$parameters[$i]); + $values = $parameters[$i]; + if (!is_array($values)){ + $values = array($values); + } + foreach($values as $value){ + $property->add($i, $value); + } } $vcard->add($property); @@ -352,7 +358,17 @@ class OC_Contacts_VCard{ $parameter->name = 'PREF'; $parameter->value = '1'; } - $temp['parameters'][$parameter->name] = $parameter->value; + if ($property->name == 'TEL' && $parameter->name == 'TYPE'){ + if (isset($temp['parameters'][$parameter->name])){ + $temp['parameters'][$parameter->name][] = $parameter->value; + } + else{ + $temp['parameters'][$parameter->name] = array($parameter->value); + } + } + else{ + $temp['parameters'][$parameter->name] = $parameter->value; + } } return $temp; } diff --git a/apps/contacts/templates/part.addcardform.php b/apps/contacts/templates/part.addcardform.php index 037e3629bb..627053547a 100644 --- a/apps/contacts/templates/part.addcardform.php +++ b/apps/contacts/templates/part.addcardform.php @@ -43,7 +43,7 @@
  • -
  • diff --git a/apps/contacts/templates/part.property.php b/apps/contacts/templates/part.property.php index dbd125dc95..afef431126 100644 --- a/apps/contacts/templates/part.property.php +++ b/apps/contacts/templates/part.property.php @@ -23,15 +23,18 @@

    t('Phone'); ?>

    - + t(ucwords(strtolower($type))); - } + $types = array(); + foreach($_['property']['parameters']['TYPE'] as $type): + if (isset($_['phone_types'][strtoupper($type)])){ + $types[]=$_['phone_types'][strtoupper($type)]; + } + else{ + $types[]=$l->t(ucwords(strtolower($type))); + } + endforeach; + $label = join(' ', $types); ?> () diff --git a/apps/contacts/templates/part.setpropertyform.php b/apps/contacts/templates/part.setpropertyform.php index 9340ce7c71..bd18d86b47 100644 --- a/apps/contacts/templates/part.setpropertyform.php +++ b/apps/contacts/templates/part.setpropertyform.php @@ -42,9 +42,9 @@

    -

    - +

    From 5e037bfd5458436e8f6d83d4fe53f62b53cd8ae9 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Wed, 23 Nov 2011 21:07:26 +0100 Subject: [PATCH 086/136] Contacts: remove redundant li in setpropertyform template --- apps/contacts/templates/part.setpropertyform.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/contacts/templates/part.setpropertyform.php b/apps/contacts/templates/part.setpropertyform.php index bd18d86b47..b0bf6645d5 100644 --- a/apps/contacts/templates/part.setpropertyform.php +++ b/apps/contacts/templates/part.setpropertyform.php @@ -1,4 +1,3 @@ -
  • @@ -55,4 +54,3 @@ -
  • From ee549dfb3802e98156e96a4cf549854b9d4f791a Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 17 Nov 2011 23:53:06 +0100 Subject: [PATCH 087/136] Fix scrolling through months --- apps/calendar/js/calendar.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js index 5592e418a4..005e359f8e 100644 --- a/apps/calendar/js/calendar.js +++ b/apps/calendar/js/calendar.js @@ -198,8 +198,12 @@ Calendar={ win_height = $(window).height(); if(direction == 'down' && win_height == (doc_height - scroll)){ $('#calendar_holder').fullCalendar('next'); + $(document).scrollTop(0); + event.preventDefault(); }else if (direction == 'top' && scroll == 0) { $('#calendar_holder').fullCalendar('prev'); + $(document).scrollTop(win_height); + event.preventDefault(); } }, Calendar:{ From 2dd757156c5da230a767152276acd31bcc2a5241 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Wed, 23 Nov 2011 21:31:27 +0100 Subject: [PATCH 088/136] Fix file dropping on root (Files menu entry) --- files/js/files.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/js/files.js b/files/js/files.js index 4eaa098241..53437453ff 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -14,8 +14,8 @@ $(document).ready(function() { $('#fileList tr td.filename').draggable(dragOptions); $('#fileList tr[data-type="dir"] td.filename').droppable(folderDropOptions); $('div.crumb').droppable(crumbDropOptions); - $('#plugins>ul>li:first-child').data('dir',''); - $('#plugins>ul>li:first-child').droppable(crumbDropOptions); + $('ul#apps>li:first-child').data('dir',''); + $('ul#apps>li:first-child').droppable(crumbDropOptions); // Triggers invisible file input $('.file_upload_button_wrapper').live('click', function() { From 6c01175acd21cbc6c2483ad6633877872095407e Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 24 Nov 2011 02:53:35 +0100 Subject: [PATCH 089/136] fix ampache htmlentity calls --- apps/media/lib_ampache.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/media/lib_ampache.php b/apps/media/lib_ampache.php index bb468d5595..bc1f853047 100644 --- a/apps/media/lib_ampache.php +++ b/apps/media/lib_ampache.php @@ -128,7 +128,7 @@ class OC_MEDIA_AMPACHE{ $albums=count(OC_MEDIA_COLLECTION::getAlbums($artist['artist_id'])); $songs=count(OC_MEDIA_COLLECTION::getSongs($artist['artist_id'])); $id=$artist['artist_id']; - $name=htmlentities($artist['artist_name'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); + $name=htmlentities($artist['artist_name'], ENT_COMPAT, 'UTF-8'); echo("\t\n"); echo("\t\t$name\n"); echo("\t\t$albums\n"); @@ -142,10 +142,10 @@ class OC_MEDIA_AMPACHE{ if(!$artistName){ $artistName=OC_MEDIA_COLLECTION::getArtistName($album['album_artist']); } - $artistName=htmlentities($artistName, ENT_COMPAT | ENT_HTML401, 'UTF-8'); + $artistName=htmlentities($artistName, ENT_COMPAT, 'UTF-8'); $songs=count(OC_MEDIA_COLLECTION::getSongs($album['album_artist'],$album['album_id'])); $id=$album['album_id']; - $name=htmlentities($album['album_name'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); + $name=htmlentities($album['album_name'], ENT_COMPAT, 'UTF-8'); $artist=$album['album_artist']; echo("\t\n"); echo("\t\t$name\n"); @@ -163,10 +163,10 @@ class OC_MEDIA_AMPACHE{ if(!$albumName){ $albumName=OC_MEDIA_COLLECTION::getAlbumName($song['song_album']); } - $artistName=htmlentities($artistName, ENT_COMPAT | ENT_HTML401, 'UTF-8'); - $albumName=htmlentities($albumName, ENT_COMPAT | ENT_HTML401, 'UTF-8'); + $artistName=htmlentities($artistName, ENT_COMPAT, 'UTF-8'); + $albumName=htmlentities($albumName, ENT_COMPAT, 'UTF-8'); $id=$song['song_id']; - $name=htmlentities($song['song_name'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); + $name=htmlentities($song['song_name'], ENT_COMPAT, 'UTF-8'); $artist=$song['song_artist']; $album=$song['song_album']; echo("\t\n"); From 93502b3ef832492c3437a9cae43986e8f16de426 Mon Sep 17 00:00:00 2001 From: Ignacio Daniel Rostagno Date: Sat, 19 Nov 2011 14:51:02 -0300 Subject: [PATCH 090/136] Music - Fix album and artist expand layout. --- apps/media/css/music.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/media/css/music.css b/apps/media/css/music.css index 67d5607519..a6738058be 100644 --- a/apps/media/css/music.css +++ b/apps/media/css/music.css @@ -31,7 +31,8 @@ div.jp-volume-bar-value { background:#ccc; width:0; height:0.4em; } #collection li { padding-right:10px; } #searchresults input.play, #searchresults input.add { float:left; height:1em; width:1em; } #collection tr.collapsed td.album, #collection tr.collapsed td.title { color:#ddd; } -a.expander { float:right; padding:0 1em; } +td.artist img, td.artist a, td.album img, td.album a { float: left; } +td.artist a.expander, td.album a.expander { float:right; padding:0 1em; } tr.active td { background-color:#eee; font-weight:bold; } tr td { border-top:1px solid #eee; height:2.2em; } tr .artist img { vertical-align:middle; } From 18d8dc4757400772a950218e2678b08545a1dd47 Mon Sep 17 00:00:00 2001 From: Insanemal Date: Mon, 21 Nov 2011 12:51:13 +1000 Subject: [PATCH 091/136] Added option to lowercase all usernames. This resolves bug with Windows AD servers as LDAP server. Windows is case insensitve on logon requests. If users are stored camel case and logon using all lower it causes issues as OwnCloud is configured to be case sensitive. Signed-off-by: Insanemal --- apps/user_ldap/settings.php | 5 ++++- apps/user_ldap/templates/settings.php | 1 + apps/user_ldap/user_ldap.php | 10 +++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/apps/user_ldap/settings.php b/apps/user_ldap/settings.php index e61d82bf8b..4be36b0444 100644 --- a/apps/user_ldap/settings.php +++ b/apps/user_ldap/settings.php @@ -20,7 +20,7 @@ * License along with this library. If not, see . * */ -$params = array('ldap_host', 'ldap_port', 'ldap_dn', 'ldap_password', 'ldap_base', 'ldap_filter', 'ldap_display_name', 'ldap_tls'); +$params = array('ldap_host', 'ldap_port', 'ldap_dn', 'ldap_password', 'ldap_base', 'ldap_filter', 'ldap_display_name', 'ldap_tls', 'ldap_nocase'); foreach($params as $param){ if(isset($_POST[$param])){ @@ -28,6 +28,9 @@ foreach($params as $param){ } elseif('ldap_tls' == $param) { // unchecked checkboxes are not included in the post paramters + OC_Appconfig::setValue('user_ldap', $param, 0); + } + elseif('ldap_nocase' == $param) { OC_Appconfig::setValue('user_ldap', $param, 0); } } diff --git a/apps/user_ldap/templates/settings.php b/apps/user_ldap/templates/settings.php index 5f25570e22..587e94e013 100644 --- a/apps/user_ldap/templates/settings.php +++ b/apps/user_ldap/templates/settings.php @@ -11,6 +11,7 @@

    t('Currently the display name field needs to be the same you matched %%uid against in the filter above, because ownCloud doesn\'t distinguish between user id and user name.');?>

    >

    +

    >

    diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php index 249def7a1c..0b309fd99d 100644 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -34,6 +34,7 @@ class OC_USER_LDAP extends OC_User_Backend { protected $ldap_base; protected $ldap_filter; protected $ldap_tls; + protected $ldap_nocase; protected $ldap_display_name; function __construct() { @@ -44,6 +45,7 @@ class OC_USER_LDAP extends OC_User_Backend { $this->ldap_base = OC_Appconfig::getValue('user_ldap', 'ldap_base',''); $this->ldap_filter = OC_Appconfig::getValue('user_ldap', 'ldap_filter',''); $this->ldap_tls = OC_Appconfig::getValue('user_ldap', 'ldap_tls', 0); + $this->ldap_nocase = OC_Appconfig::getValue('user_ldap', 'ldap_nocase', 0); $this->ldap_display_name = OC_Appconfig::getValue('user_ldap', 'ldap_display_name', OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME); if( !empty($this->ldap_host) @@ -146,7 +148,13 @@ class OC_USER_LDAP extends OC_User_Backend { // TODO ldap_get_entries() seems to lower all keys => needs review $ldap_display_name = strtolower($this->ldap_display_name); if(isset($row[$ldap_display_name])) { - $users[] = $row[$ldap_display_name][0]; + if($this->ldap_nocase) { + $users[] = strtolower($row[$ldap_display_name][0]); + } + else + { + $users[] = $row[$ldap_display_name][0]; + } } } // TODO language specific sorting of user names From 8d092434edcabbede56feaf1be925e7d88d8aee2 Mon Sep 17 00:00:00 2001 From: Insanemal Date: Mon, 21 Nov 2011 20:20:26 +1000 Subject: [PATCH 092/136] Adjusted the check user function to lowercase the return. Signed-off-by: Insanemal --- apps/user_ldap/user_ldap.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php index 0b309fd99d..d35cefcaae 100644 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -115,7 +115,14 @@ class OC_USER_LDAP extends OC_User_Backend { if (!@ldap_bind( $this->getDs(), $dn, $password )) return false; - return $uid; + + if($this->ldap_nocase) { + return strtolower($uid); + } + else { + return $uid; + } + } public function userExists( $uid ) { From c945989a70b278ddb038d194a5c9b84572ab201b Mon Sep 17 00:00:00 2001 From: Insanemal Date: Tue, 22 Nov 2011 11:08:27 +1000 Subject: [PATCH 093/136] Total rewite of fix. This now re-looks up the username and returns that for use. Signed-off-by: Insanemal --- apps/user_ldap/settings.php | 23 +++++++++++++---------- apps/user_ldap/templates/settings.php | 2 +- apps/user_ldap/user_ldap.php | 24 ++++++++++++++++-------- 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/apps/user_ldap/settings.php b/apps/user_ldap/settings.php index 4be36b0444..1f2d8ed9af 100644 --- a/apps/user_ldap/settings.php +++ b/apps/user_ldap/settings.php @@ -22,16 +22,19 @@ */ $params = array('ldap_host', 'ldap_port', 'ldap_dn', 'ldap_password', 'ldap_base', 'ldap_filter', 'ldap_display_name', 'ldap_tls', 'ldap_nocase'); -foreach($params as $param){ - if(isset($_POST[$param])){ - OC_Appconfig::setValue('user_ldap', $param, $_POST[$param]); - } - elseif('ldap_tls' == $param) { - // unchecked checkboxes are not included in the post paramters - OC_Appconfig::setValue('user_ldap', $param, 0); - } - elseif('ldap_nocase' == $param) { - OC_Appconfig::setValue('user_ldap', $param, 0); +if ($_POST) { + foreach($params as $param){ + if(isset($_POST[$param])){ + OC_Appconfig::setValue('user_ldap', $param, $_POST[$param]); + } + elseif('ldap_tls' == $param) { + // unchecked checkboxes are not included in the post paramters + OC_Appconfig::setValue('user_ldap', $param, 0); + } + elseif('ldap_nocase' == $param) { + OC_Appconfig::setValue('user_ldap', $param, 0); + } + } } diff --git a/apps/user_ldap/templates/settings.php b/apps/user_ldap/templates/settings.php index 587e94e013..2abb0b4729 100644 --- a/apps/user_ldap/templates/settings.php +++ b/apps/user_ldap/templates/settings.php @@ -11,7 +11,7 @@

    t('Currently the display name field needs to be the same you matched %%uid against in the filter above, because ownCloud doesn\'t distinguish between user id and user name.');?>

    >

    -

    >

    +

    >

    diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php index d35cefcaae..106240e74b 100644 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -117,7 +117,21 @@ class OC_USER_LDAP extends OC_User_Backend { return false; if($this->ldap_nocase) { - return strtolower($uid); + $filter = str_replace('%uid', $uid, $this->ldap_filter); + $sr = ldap_search( $this->getDs(), $this->ldap_base, $filter ); + $entries = ldap_get_entries( $this->getDs(), $sr ); + if( $entries['count'] == 1 ) { + foreach($entries as $row) { + $ldap_display_name = strtolower($this->ldap_display_name); + if(isset($row[$ldap_display_name])) { + return $row[$ldap_display_name][0]; + } + } + } + else { + return $uid; + } + } else { return $uid; @@ -155,13 +169,7 @@ class OC_USER_LDAP extends OC_User_Backend { // TODO ldap_get_entries() seems to lower all keys => needs review $ldap_display_name = strtolower($this->ldap_display_name); if(isset($row[$ldap_display_name])) { - if($this->ldap_nocase) { - $users[] = strtolower($row[$ldap_display_name][0]); - } - else - { - $users[] = $row[$ldap_display_name][0]; - } + $users[] = $row[$ldap_display_name][0]; } } // TODO language specific sorting of user names From 76bfc3b547064a5862f72f9165785aa134d8ce4f Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Tue, 25 Oct 2011 01:58:37 +0200 Subject: [PATCH 094/136] set http auth headers for apache+php-cgi work around if variable gets renamed by apache --- lib/base.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/base.php b/lib/base.php index c52b4493e0..700236c96c 100644 --- a/lib/base.php +++ b/lib/base.php @@ -92,6 +92,14 @@ class OC{ $_SERVER['PHP_AUTH_PW'] = strip_tags($password); } + //set http auth headers for apache+php-cgi work around if variable gets renamed by apache + if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']) && preg_match('/Basic\s+(.*)$/i', $_SERVER['REDIRECT_HTTP_AUTHORIZATION'], $matches)) + { + list($name, $password) = explode(':', base64_decode($matches[1])); + $_SERVER['PHP_AUTH_USER'] = strip_tags($name); + $_SERVER['PHP_AUTH_PW'] = strip_tags($password); + } + // calculate the documentroot OC::$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']); OC::$SERVERROOT=str_replace("\\",'/',substr(__FILE__,0,-13)); From fab70cb59062ae945825c820787c05c7f8630bf3 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Thu, 24 Nov 2011 13:50:29 +0100 Subject: [PATCH 095/136] removed no longer used function and exec command security++ --- lib/util.php | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/lib/util.php b/lib/util.php index 14313569a1..0f79948bc2 100644 --- a/lib/util.php +++ b/lib/util.php @@ -180,7 +180,6 @@ class OC_Util { } $CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" ); $CONFIG_DBNAME = OC_Config::getValue( "dbname", "owncloud" ); - $serverUser=OC_Util::checkWebserverUser(); //common hint for all file permissons error messages $permissionsHint="Permissions can usually be fixed by giving the webserver write access to the ownCloud directory"; @@ -239,21 +238,6 @@ class OC_Util { OC_Template::printGuestPage("", "login", $parameters); } - /** - * Try to get the username the httpd server runs on, used in hints - */ - public static function checkWebserverUser(){ - if(is_callable('posix_getuid')){ - $serverUser=posix_getpwuid(posix_getuid()); - $serverUser='\''.$serverUser['name'].'\''; - }elseif(exec('whoami')){ - $serverUser=exec('whoami'); - }else{ - $serverUser='\'www-data\' for ubuntu/debian'; //TODO: try to detect the distro and give a guess based on that - } - return $serverUser; - } - /** * Check if the app is enabled, send json error msg if not From cea6561632b8979da1b5bdc9a57dca26d2b9f90c Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 24 Nov 2011 21:04:34 +0100 Subject: [PATCH 096/136] Update chosen to v0.9.5 --- 3rdparty/css/chosen/chosen-sprite.png | Bin 742 -> 3998 bytes 3rdparty/css/chosen/chosen.css | 84 ++++++++---- 3rdparty/js/chosen/VERSION | 2 +- 3rdparty/js/chosen/chosen.jquery.js | 171 +++++++++++++++++------- 3rdparty/js/chosen/chosen.jquery.min.js | 4 +- 5 files changed, 180 insertions(+), 81 deletions(-) diff --git a/3rdparty/css/chosen/chosen-sprite.png b/3rdparty/css/chosen/chosen-sprite.png index f20db4439ea5c1038126bf326c8fd048b03a8226..9edce05a6a899eaf98481d12dddbc433331a01ee 100644 GIT binary patch delta 3675 zcmV-h4y5ts1)d*}7k?-S0{{R3m1Swo00009a7bBm000XU000XU0RWnu7ytkYPiaF# zP*7-ZbZ>KLZ*U+IBfRsybQWXdwQbLP> z6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uh>2n?1;Gf_2w45>mM5#WQz#Kz&|EGkvK~TfD`~gdX7S-06<0o zfSs5oQvjd@0DoZ1V`Ad~P%QvpCx7PC0DztNnR@{MTa+Oc0iclpAQNSXL;z?z0Ibhe zibVieFaQ*0OT;+<*ew7sNmph_0I;_Jz|Ig0vH%DS05DOAg((08djMd_BO`bKgqZ*o zM)FrY@hh$n=PCdIc$u<1xgb(Nq-kB6gFW3VVXcL!g-k)GJ!M? z;PcD?0HBc-5#WRK{dmp}uFlRjj{ zU%*%WY=8NFJpA|d;J)G{fihizM+Erb!p!tcr5w+a34~(Y=8s4Gw+sLL9n&JjNn*KJ zDiq^U5^;`1nvC-@r6P$!k}1U{(*I=Q-z@tBKHoI}uxdU5dyy@uU1J0GOD7Ombim^G z008p4Z^6_k2m^pic}y~NFDM$asoMrTt>Q)JIDYsg8YWOM=_LvvQa(M47EeKs5csfMxqPQWOOl_ zj~1Yt&~mgIJ&ZP?=g_NY5897DL&q?{=okkx#B4Aw#=}CfI4lX1W6QB3tPHEh8n9NZ z1G|a!W6!a71QLNozzH@4cS0ax9zjT0On+ET*hr`#93(Um+6gxa1B6k+CnA%mOSC4s z5&6UzVlpv@SV$}*))J2sFA#f(L&P^E5{W}HC%KRUNwK6<(h|}}(r!{C=`5+6G)NjF zlgZj-YqAG9lq?`C$c5yc>d>VnA`E_*3F2Qp##d8RZb=H01_mn13=s zRim0x-Ke2d5jBrmLam{;Qm;{ms1r1GnmNsb7D-E`t)i9F8fX`2_i3-_bh;7Ul^#x) z&{xvS=|||7=mYe33=M`AgU5(xC>fg=2N-7=cNnjjOr{yriy6mMFgG#lnCF=fnQv8C zDz++o6_Lscl}eQ+l^ZHARH>?_s(;?93sv(~%T$l4UQ>OpMpZLY-Tx+V9mzG$oNUKq+N9(;duI;CtroBbGS^I$wLB~obTqj3okIn_1=Tq5J-KPqt z7EL`m^{y_eYo!~ZyF_=tZl~^;p1xjyo=k72-g&*}`W$^P{Z##J`lt0r3|I!U3?v5I z49*xl#WitnJRL8`+woCDU4O$sL#1JrVVB{Ak-5=4qt!-@Mh}c>#$4kh<88)m#-k<% zCLtzEP3leVno>={htGUuD;o7bD)w_sX$S}eAxwzy?U zvgBH(S?;#HZiQMoS*2K2T3xe7t(~nU*1N5{rxB;QPLocnp4Ml>uz&Hk$+oGt8L;Kp z2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C^>JO{ zdeZfso3oq3?Wo(Y?teD!Y3_&IpUgC$DV|v~bI`-cL*P;6(LW2Hl`w1HtbR{JPl0E( z=OZs;FOgTR*RZ#xcdGYc?-xGyK60PqKI1$$-ZI`u$xr8UFki1L{Ox>G0o)(&RAZ;=|I=wN2l97;c zLaHH6leTB-XXa*h%dBOEvi`+xi?=Txl?TadvyiL>S${1GwnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_Iu74EU7nc=(*eKk1(e4|2 zy!JHg)!SRV_x(P}zS~s+RZZ1q)n)rh`?L2yu78QD>G+oWZC$NSZE@|#1JVQi2O|!) z*SXZy9nw8iQjgXv>qid9AHM#b?{_T?HVsvcoW|lKa720J>GuiW_Z|&8+IEb4tl4MXfXY$XC zoqv^`eSR+a++f?HwtMGe&fjVeZ|}Mgbm7uP|BL54ygSZZ^0;*JvfJeoSGZT2uR33C z>U8Qn{*%*B$Ge=nny$HAYq{=vy|sI0_vss+H_qMky?OB#|JK!>IX&II^LlUh#rO5! z7TtbwC;iULyV-Xq?ybB}ykGP{?LpZ?-G7JGKU@CX*zeqbYQT4(^U>T#_XdT7&;F71 zj}JoykC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTP zlfP|zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot(_`g8%^e{{R4h=>PzAFaQARU;qF*m;eA5 zZ<1fdMgRZ<0Ffp4e^F6UQc_Y=Q&Ut_R8>_~R#sM5S65hASXo(FT3T9LTU%UQTwPsV zUS3{bUteHgU}0flVq#)rV`F4wWMyS#W@ct*XJ=?=XlZF_YHDh0Yin$5Y;A3AZfQa&mHWb8~cbbai!gc6N4mcXxPrczJnwdU|?$e|vj;e0+UdCU$jHda$;ryf%FD~k%*@Qq&CSlv&d<-!f6&m-(b3V;($dq@)6~?|)z#J3 z*4Ee8*Vx$D+1c6J+S=RO+uYpT-QC^Z-rnEe-{9cj;o;%p;^O1ulq(=H}<; z=jiC@>FMd}>gwz3>+J08?d|RE?(XmJ@9^;O@$vEU^78ZZ^Yrxe_4W1k_V)Mp_xSku z`T6i^!0bqY%NklT+>Q{e^Xseq&L0`odh4XD~y+}^OCg<&Q;C~m{JN*e-Gl;yI(`W%3<@})9>$Zidb04T52$N(_ccdKU!p_TnE03fxFWZol0H|Op* z)<^EHqf+IGueD_LN80V3=R6L|tEmi*dG$=BrECtE_0)n=Hho?_wGWw|%CyhIjtmYG zEvd4wTTLj6cK^Z)>{mVaGq8DIyI}jC7{=o?JD?~(}0|0~!uhzlT_-+6I002ovPDHLkV1o5cKhppJ delta 395 zcmV;60d)SJALa#+7Y-%}0{{R3uWtyw00026hW2H=$?x#9xGbV7#^2p!UU?|T2Ii5zE`@j;o)o^r^4@E+uEG;9AL5Yg|RggC18 zQMd^X&mV%1!lnTZ1H(jNQeptiBq%KM5<6S~%8q~;z&Hxm#5>!HTsTvr`c-+u!kZqCC5mm$tL^@ay66=w7#;zQa^u)dMjNZr&1fIxv4F1=b& zcadNb06;rcUjqO(x?<;Ih0@*WcIOs&sq-FrQzYhPPl@+Z-p#CxH zIMkgMhm@g85_XG(@cS18PL%|ofBbiG&?#J$-*DK{d~1+fzG!0bqh{GcR3GYR2<-WG zJWTBwfeThLb2|w9jqK$u0uOqp@wnF32y7N=2g089a+e4!qPiwi*LE5REUGhWvbM9@ pegj?4jMSL~<8&5_rJi)+@d=yNidHAaT2cT2002ovPDHLkV1fyUx26C9 diff --git a/3rdparty/css/chosen/chosen.css b/3rdparty/css/chosen/chosen.css index 247d07bf02..b9c6d88028 100644 --- a/3rdparty/css/chosen/chosen.css +++ b/3rdparty/css/chosen/chosen.css @@ -1,9 +1,4 @@ /* @group Base */ -select.chzn-select { - visibility: hidden; - height: 28px !important; - min-height: 28px !important; -} .chzn-container { font-size: 13px; position: relative; @@ -60,9 +55,21 @@ select.chzn-select { 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 abbr { + display: block; + position: absolute; + right: 26px; + top: 8px; + width: 12px; + height: 13px; + font-size: 1px; + background: url(chosen-sprite.png) right top no-repeat; +} +.chzn-container-single .chzn-single abbr:hover { + background-position: right -11px; +} .chzn-container-single .chzn-single div { -webkit-border-radius: 0 4px 4px 0; -moz-border-radius : 0 4px 4px 0; @@ -94,18 +101,19 @@ select.chzn-select { } .chzn-container-single .chzn-search { padding: 3px 4px; + position: relative; 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%); + background: #fff url('chosen-sprite.png') no-repeat 100% -22px; + background: url('chosen-sprite.png') no-repeat 100% -22px, -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% -22px, -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%); + background: url('chosen-sprite.png') no-repeat 100% -22px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%); + background: url('chosen-sprite.png') no-repeat 100% -22px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%); + background: url('chosen-sprite.png') no-repeat 100% -22px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%); + background: url('chosen-sprite.png') no-repeat 100% -22px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%); + background: url('chosen-sprite.png') no-repeat 100% -22px, linear-gradient(top, #ffffff 85%,#eeeeee 99%); margin: 1px 0; padding: 4px 20px 4px 5px; outline: 0; @@ -123,6 +131,11 @@ select.chzn-select { } /* @end */ +.chzn-container-single-nosearch .chzn-search input { + position: absolute; + left: -9000px; +} + /* @group Multi Chosen */ .chzn-container-multi .chzn-choices { background-color: #fff; @@ -197,18 +210,18 @@ select.chzn-select { .chzn-container-multi .chzn-choices .search-choice .search-choice-close { display: block; position: absolute; - right: 5px; - top: 6px; - width: 8px; - height: 9px; + right: 3px; + top: 4px; + width: 12px; + height: 13px; 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; + background-position: right -11px; } .chzn-container-multi .chzn-choices .search-choice-focus .search-choice-close { - background-position: right -9px; + background-position: right -11px; } /* @end */ @@ -226,6 +239,7 @@ select.chzn-select { padding: 0; } .chzn-container .chzn-results li { + display: none; line-height: 80%; padding: 7px 7px 8px; margin: 0; @@ -233,6 +247,7 @@ select.chzn-select { } .chzn-container .chzn-results .active-result { cursor: pointer; + display: list-item; } .chzn-container .chzn-results .highlighted { background: #3875d7; @@ -247,6 +262,7 @@ select.chzn-select { } .chzn-container .chzn-results .no-results { background: #f4f4f4; + display: list-item; } .chzn-container .chzn-results .group-result { cursor: default; @@ -309,6 +325,18 @@ select.chzn-select { } /* @end */ +/* @group Disabled Support */ +.chzn-disabled { + cursor: default; + opacity:0.5 !important; +} +.chzn-disabled .chzn-single { + cursor: default; +} +.chzn-disabled .chzn-choices .search-choice .search-choice-close { + cursor: default; +} + /* @group Right to Left */ .chzn-rtl { direction:rtl;text-align: right; } .chzn-rtl .chzn-single { padding-left: 0; padding-right: 8px; } @@ -327,14 +355,14 @@ select.chzn-select { .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%); + background: url('chosen-sprite.png') no-repeat -38px -22px, #ffffff; + background: url('chosen-sprite.png') no-repeat -38px -22px, -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 -22px, -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%); + background: url('chosen-sprite.png') no-repeat -38px -22px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%); + background: url('chosen-sprite.png') no-repeat -38px -22px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%); + background: url('chosen-sprite.png') no-repeat -38px -22px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%); + background: url('chosen-sprite.png') no-repeat -38px -22px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%); + background: url('chosen-sprite.png') no-repeat -38px -22px, 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/VERSION b/3rdparty/js/chosen/VERSION index f374f6662e..b0bb878545 100644 --- a/3rdparty/js/chosen/VERSION +++ b/3rdparty/js/chosen/VERSION @@ -1 +1 @@ -0.9.1 +0.9.5 diff --git a/3rdparty/js/chosen/chosen.jquery.js b/3rdparty/js/chosen/chosen.jquery.js index 5ea409d90e..e7e661c096 100644 --- a/3rdparty/js/chosen/chosen.jquery.js +++ b/3rdparty/js/chosen/chosen.jquery.js @@ -1,7 +1,7 @@ // Chosen, a Select Box Enhancer for jQuery and Protoype // by Patrick Filler for Harvest, http://getharvest.com // -// Version 0.9 +// Version 0.9.5 // Full source at https://github.com/harvesthq/chosen // Copyright (c) 2011 Harvest http://getharvest.com @@ -16,18 +16,22 @@ root = this; $ = jQuery; $.fn.extend({ - chosen: function(data, options) { + chosen: function(options) { + if ($.browser === "msie" && ($.browser.version === "6.0" || $.browser.version === "7.0")) { + return this; + } return $(this).each(function(input_field) { if (!($(this)).hasClass("chzn-done")) { - return new Chosen(this, data, options); + return new Chosen(this, options); } }); } }); Chosen = (function() { - function Chosen(elmn) { + function Chosen(form_field, options) { + this.form_field = form_field; + this.options = options != null ? options : {}; this.set_default_values(); - this.form_field = elmn; this.form_field_jq = $(this.form_field); this.is_multiple = this.form_field.multiple; this.is_rtl = this.form_field_jq.hasClass("chzn-rtl"); @@ -40,22 +44,28 @@ this.click_test_action = __bind(function(evt) { return this.test_active_click(evt); }, this); + this.activate_action = __bind(function(evt) { + return this.activate_field(evt); + }, this); this.active_field = false; this.mouse_on_container = false; this.results_showing = false; this.result_highlighted = null; this.result_single_selected = null; - return this.choices = 0; + this.allow_single_deselect = (this.options.allow_single_deselect != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false; + this.disable_search_threshold = this.options.disable_search_threshold || 0; + this.choices = 0; + return this.results_none_found = this.options.no_results_text || "No results match"; }; Chosen.prototype.set_up_html = function() { var container_div, dd_top, dd_width, sf_width; this.container_id = this.form_field.id.length ? this.form_field.id.replace(/(:|\.)/g, '_') : this.generate_field_id(); this.container_id += "_chzn"; - this.f_width = this.form_field_jq.width(); + this.f_width = this.form_field_jq.outerWidth(); this.default_text = this.form_field_jq.data('placeholder') ? this.form_field_jq.data('placeholder') : this.default_text_default; container_div = $("
    ", { id: this.container_id, - "class": "chzn-container " + (this.is_rtl ? ' chzn-rtl' : void 0), + "class": "chzn-container" + (this.is_rtl ? ' chzn-rtl' : ''), style: 'width: ' + this.f_width + 'px;' }); if (this.is_multiple) { @@ -66,6 +76,9 @@ this.form_field_jq.hide().after(container_div); this.container = $('#' + this.container_id); this.container.addClass("chzn-container-" + (this.is_multiple ? "multi" : "single")); + if (!this.is_multiple && this.form_field.options.length <= this.disable_search_threshold) { + this.container.addClass("chzn-container-single-nosearch"); + } this.dropdown = this.container.find('div.chzn-drop').first(); dd_top = this.container.height(); dd_width = this.f_width - get_side_border_padding(this.dropdown); @@ -92,8 +105,11 @@ return this.set_tab_index(); }; Chosen.prototype.register_observers = function() { - this.container.click(__bind(function(evt) { - return this.container_click(evt); + this.container.mousedown(__bind(function(evt) { + return this.container_mousedown(evt); + }, this)); + this.container.mouseup(__bind(function(evt) { + return this.container_mouseup(evt); }, this)); this.container.mouseenter(__bind(function(evt) { return this.mouse_enter(evt); @@ -101,8 +117,8 @@ this.container.mouseleave(__bind(function(evt) { return this.mouse_leave(evt); }, this)); - this.search_results.click(__bind(function(evt) { - return this.search_results_click(evt); + this.search_results.mouseup(__bind(function(evt) { + return this.search_results_mouseup(evt); }, this)); this.search_results.mouseover(__bind(function(evt) { return this.search_results_mouseover(evt); @@ -129,30 +145,52 @@ return this.search_field.focus(__bind(function(evt) { return this.input_focus(evt); }, this)); - } else { - return this.selected_item.focus(__bind(function(evt) { - return this.activate_field(evt); - }, this)); } }; - Chosen.prototype.container_click = function(evt) { - if (evt && evt.type === "click") { - evt.stopPropagation(); - } - if (!this.pending_destroy_click) { - if (!this.active_field) { - if (this.is_multiple) { - this.search_field.val(""); - } - $(document).click(this.click_test_action); - this.results_show(); - } else if (!this.is_multiple && evt && ($(evt.target) === this.selected_item || $(evt.target).parents("a.chzn-single").length)) { - evt.preventDefault(); - this.results_toggle(); + Chosen.prototype.search_field_disabled = function() { + this.is_disabled = this.form_field_jq.attr('disabled'); + if (this.is_disabled) { + this.container.addClass('chzn-disabled'); + this.search_field.attr('disabled', true); + if (!this.is_multiple) { + this.selected_item.unbind("focus", this.activate_action); } - return this.activate_field(); + return this.close_field(); } else { - return this.pending_destroy_click = false; + this.container.removeClass('chzn-disabled'); + this.search_field.attr('disabled', false); + if (!this.is_multiple) { + return this.selected_item.bind("focus", this.activate_action); + } + } + }; + Chosen.prototype.container_mousedown = function(evt) { + var target_closelink; + if (!this.is_disabled) { + target_closelink = evt != null ? ($(evt.target)).hasClass("search-choice-close") : false; + if (evt && evt.type === "mousedown") { + evt.stopPropagation(); + } + if (!this.pending_destroy_click && !target_closelink) { + if (!this.active_field) { + if (this.is_multiple) { + this.search_field.val(""); + } + $(document).click(this.click_test_action); + this.results_show(); + } else if (!this.is_multiple && evt && ($(evt.target) === this.selected_item || $(evt.target).parents("a.chzn-single").length)) { + evt.preventDefault(); + this.results_toggle(); + } + return this.activate_field(); + } else { + return this.pending_destroy_click = false; + } + } + }; + Chosen.prototype.container_mouseup = function(evt) { + if (evt.target.nodeName === "ABBR") { + return this.results_reset(evt); } }; Chosen.prototype.mouse_enter = function() { @@ -164,7 +202,7 @@ Chosen.prototype.input_focus = function(evt) { if (!this.active_field) { return setTimeout((__bind(function() { - return this.container_click(); + return this.container_mousedown(); }, this)), 50); } }; @@ -235,9 +273,13 @@ this.choice_build(data); } else if (data.selected && !this.is_multiple) { this.selected_item.find("span").text(data.text); + if (this.allow_single_deselect) { + this.selected_item.find("span").first().after(""); + } } } } + this.search_field_disabled(); this.show_search_field_default(); this.search_field_scale(); this.search_results.html(content); @@ -252,7 +294,7 @@ } }; Chosen.prototype.result_add_option = function(option) { - var classes; + var classes, style; if (!option.disabled) { option.dom_id = this.container_id + "_o_" + option.array_index; classes = option.selected && this.is_multiple ? [] : ["active-result"]; @@ -262,7 +304,11 @@ if (option.group_array_index != null) { classes.push("group-option"); } - return '
  • ' + option.html + '
  • '; + if (option.classes !== "") { + classes.push(option.classes); + } + style = option.style.cssText !== "" ? " style=\"" + option.style + "\"" : ""; + return '
  • ' + option.html + '
  • '; } else { return ""; } @@ -353,12 +399,12 @@ return this.search_field.removeClass("default"); } }; - Chosen.prototype.search_results_click = function(evt) { + Chosen.prototype.search_results_mouseup = function(evt) { var target; target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first(); if (target.length) { this.result_highlight = target; - return this.result_select(); + return this.result_select(evt); } }; Chosen.prototype.search_results_mouseover = function(evt) { @@ -391,8 +437,12 @@ }; Chosen.prototype.choice_destroy_link_click = function(evt) { evt.preventDefault(); - this.pending_destroy_click = true; - return this.choice_destroy($(evt.target)); + if (!this.is_disabled) { + this.pending_destroy_click = true; + return this.choice_destroy($(evt.target)); + } else { + return evt.stopPropagation; + } }; Chosen.prototype.choice_destroy = function(link) { this.choices -= 1; @@ -403,18 +453,29 @@ this.result_deselect(link.attr("rel")); return link.parents('li').first().remove(); }; - Chosen.prototype.result_select = function() { + Chosen.prototype.results_reset = function(evt) { + this.form_field.options[0].selected = true; + this.selected_item.find("span").text(this.default_text); + this.show_search_field_default(); + $(evt.target).remove(); + this.form_field_jq.trigger("change"); + if (this.active_field) { + return this.results_hide(); + } + }; + Chosen.prototype.result_select = function(evt) { var high, high_id, item, position; if (this.result_highlight) { high = this.result_highlight; high_id = high.attr("id"); this.result_clear_highlight(); - high.addClass("result-selected"); if (this.is_multiple) { this.result_deactivate(high); } else { + this.search_results.find(".result-selected").removeClass("result-selected"); this.result_single_selected = high; } + high.addClass("result-selected"); position = high_id.substr(high_id.lastIndexOf("_") + 1); item = this.results_data[position]; item.selected = true; @@ -423,18 +484,23 @@ this.choice_build(item); } else { this.selected_item.find("span").first().text(item.text); + if (this.allow_single_deselect) { + this.selected_item.find("span").first().after(""); + } + } + if (!(evt.metaKey && this.is_multiple)) { + this.results_hide(); } - this.results_hide(); this.search_field.val(""); this.form_field_jq.trigger("change"); return this.search_field_scale(); } }; Chosen.prototype.result_activate = function(el) { - return el.addClass("active-result").show(); + return el.addClass("active-result"); }; Chosen.prototype.result_deactivate = function(el) { - return el.removeClass("active-result").hide(); + return el.removeClass("active-result"); }; Chosen.prototype.result_deselect = function(pos) { var result, result_data; @@ -530,17 +596,18 @@ return _results; }; Chosen.prototype.winnow_results_set_highlight = function() { - var do_high; + var do_high, selected_results; if (!this.result_highlight) { - do_high = this.search_results.find(".active-result").first(); - if (do_high) { + selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : []; + do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first(); + if (do_high != null) { return this.result_do_highlight(do_high); } } }; Chosen.prototype.no_results = function(terms) { var no_results_html; - no_results_html = $('
  • No results match ""
  • '); + no_results_html = $('
  • ' + this.results_none_found + ' ""
  • '); no_results_html.find("span").first().html(terms); return this.search_results.append(no_results_html); }; @@ -611,7 +678,7 @@ case 13: evt.preventDefault(); if (this.results_showing) { - return this.result_select(); + return this.result_select(evt); } break; case 27: @@ -623,6 +690,8 @@ case 38: case 40: case 16: + case 91: + case 17: break; default: return this.results_search(); @@ -758,7 +827,9 @@ html: option.innerHTML, selected: option.selected, disabled: group_disabled === true ? group_disabled : option.disabled, - group_array_index: group_position + group_array_index: group_position, + classes: option.className, + style: option.style.cssText }); } else { this.parsed.push({ diff --git a/3rdparty/js/chosen/chosen.jquery.min.js b/3rdparty/js/chosen/chosen.jquery.min.js index 1d6a6983d8..371ee53e7a 100644 --- a/3rdparty/js/chosen/chosen.jquery.min.js +++ b/3rdparty/js/chosen/chosen.jquery.min.js @@ -1,10 +1,10 @@ // Chosen, a Select Box Enhancer for jQuery and Protoype // by Patrick Filler for Harvest, http://getharvest.com // -// Version 0.9 +// Version 0.9.5 // Full source at https://github.com/harvesthq/chosen // Copyright (c) 2011 Harvest http://getharvest.com // MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md // This file is generated by `cake build`, do not edit it by hand. -(function(){var a,b,c,d,e=function(a,b){return function(){return a.apply(b,arguments)}};d=this,a=jQuery,a.fn.extend({chosen:function(c,d){return a(this).each(function(e){if(!a(this).hasClass("chzn-done"))return new b(this,c,d)})}}),b=function(){function b(b){this.set_default_values(),this.form_field=b,this.form_field_jq=a(this.form_field),this.is_multiple=this.form_field.multiple,this.is_rtl=this.form_field_jq.hasClass("chzn-rtl"),this.default_text_default=this.form_field.multiple?"Select Some Options":"Select an Option",this.set_up_html(),this.register_observers(),this.form_field_jq.addClass("chzn-done")}b.prototype.set_default_values=function(){this.click_test_action=e(function(a){return this.test_active_click(a)},this),this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null;return this.choices=0},b.prototype.set_up_html=function(){var b,d,e,f;this.container_id=this.form_field.id.length?this.form_field.id.replace(/(:|\.)/g,"_"):this.generate_field_id(),this.container_id+="_chzn",this.f_width=this.form_field_jq.width(),this.default_text=this.form_field_jq.data("placeholder")?this.form_field_jq.data("placeholder"):this.default_text_default,b=a("
    ",{id:this.container_id,"class":"chzn-container "+(this.is_rtl?" chzn-rtl":void 0),style:"width: "+this.f_width+"px;"}),this.is_multiple?b.html('
      '):b.html(''+this.default_text+'
        '),this.form_field_jq.hide().after(b),this.container=a("#"+this.container_id),this.container.addClass("chzn-container-"+(this.is_multiple?"multi":"single")),this.dropdown=this.container.find("div.chzn-drop").first(),d=this.container.height(),e=this.f_width-c(this.dropdown),this.dropdown.css({width:e+"px",top:d+"px"}),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chzn-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chzn-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chzn-search").first(),this.selected_item=this.container.find(".chzn-single").first(),f=e-c(this.search_container)-c(this.search_field),this.search_field.css({width:f+"px"})),this.results_build();return this.set_tab_index()},b.prototype.register_observers=function(){this.container.click(e(function(a){return this.container_click(a)},this)),this.container.mouseenter(e(function(a){return this.mouse_enter(a)},this)),this.container.mouseleave(e(function(a){return this.mouse_leave(a)},this)),this.search_results.click(e(function(a){return this.search_results_click(a)},this)),this.search_results.mouseover(e(function(a){return this.search_results_mouseover(a)},this)),this.search_results.mouseout(e(function(a){return this.search_results_mouseout(a)},this)),this.form_field_jq.bind("liszt:updated",e(function(a){return this.results_update_field(a)},this)),this.search_field.blur(e(function(a){return this.input_blur(a)},this)),this.search_field.keyup(e(function(a){return this.keyup_checker(a)},this)),this.search_field.keydown(e(function(a){return this.keydown_checker(a)},this));if(this.is_multiple){this.search_choices.click(e(function(a){return this.choices_click(a)},this));return this.search_field.focus(e(function(a){return this.input_focus(a)},this))}return this.selected_item.focus(e(function(a){return this.activate_field(a)},this))},b.prototype.container_click=function(b){b&&b.type==="click"&&b.stopPropagation();if(!this.pending_destroy_click){this.active_field?!this.is_multiple&&b&&(a(b.target)===this.selected_item||a(b.target).parents("a.chzn-single").length)&&(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(document).click(this.click_test_action),this.results_show());return this.activate_field()}return this.pending_destroy_click=!1},b.prototype.mouse_enter=function(){return this.mouse_on_container=!0},b.prototype.mouse_leave=function(){return this.mouse_on_container=!1},b.prototype.input_focus=function(a){if(!this.active_field)return setTimeout(e(function(){return this.container_click()},this),50)},b.prototype.input_blur=function(a){if(!this.mouse_on_container){this.active_field=!1;return setTimeout(e(function(){return this.blur_test()},this),100)}},b.prototype.blur_test=function(a){if(!this.active_field&&this.container.hasClass("chzn-container-active"))return this.close_field()},b.prototype.close_field=function(){a(document).unbind("click",this.click_test_action),this.is_multiple||(this.selected_item.attr("tabindex",this.search_field.attr("tabindex")),this.search_field.attr("tabindex",-1)),this.active_field=!1,this.results_hide(),this.container.removeClass("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default();return this.search_field_scale()},b.prototype.activate_field=function(){!this.is_multiple&&!this.active_field&&(this.search_field.attr("tabindex",this.selected_item.attr("tabindex")),this.selected_item.attr("tabindex",-1)),this.container.addClass("chzn-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val());return this.search_field.focus()},b.prototype.test_active_click=function(b){return a(b.target).parents("#"+this.container_id).length?this.active_field=!0:this.close_field()},b.prototype.results_build=function(){var a,b,c,e,f,g;c=new Date,this.parsing=!0,this.results_data=d.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.find("li.search-choice").remove(),this.choices=0):this.is_multiple||this.selected_item.find("span").text(this.default_text),a="",g=this.results_data;for(e=0,f=g.length;e'+a("
        ").text(b.label).html()+""}return""},b.prototype.result_add_option=function(a){var b;if(!a.disabled){a.dom_id=this.container_id+"_o_"+a.array_index,b=a.selected&&this.is_multiple?[]:["active-result"],a.selected&&b.push("result-selected"),a.group_array_index!=null&&b.push("group-option");return'
      • '+a.html+"
      • "}return""},b.prototype.results_update_field=function(){this.result_clear_highlight(),this.result_single_selected=null;return this.results_build()},b.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight();if(b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(c'+b.html+''),d=a("#"+c).find("a").first();return d.click(e(function(a){return this.choice_destroy_link_click(a)},this))},b.prototype.choice_destroy_link_click=function(b){b.preventDefault(),this.pending_destroy_click=!0;return this.choice_destroy(a(b.target))},b.prototype.choice_destroy=function(a){this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.val().length<1&&this.results_hide(),this.result_deselect(a.attr("rel"));return a.parents("li").first().remove()},b.prototype.result_select=function(){var a,b,c,d;if(this.result_highlight){a=this.result_highlight,b=a.attr("id"),this.result_clear_highlight(),a.addClass("result-selected"),this.is_multiple?this.result_deactivate(a):this.result_single_selected=a,d=b.substr(b.lastIndexOf("_")+1),c=this.results_data[d],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.is_multiple?this.choice_build(c):this.selected_item.find("span").first().text(c.text),this.results_hide(),this.search_field.val(""),this.form_field_jq.trigger("change");return this.search_field_scale()}},b.prototype.result_activate=function(a){return a.addClass("active-result").show()},b.prototype.result_deactivate=function(a){return a.removeClass("active-result").hide()},b.prototype.result_deselect=function(b){var c,d;d=this.results_data[b],d.selected=!1,this.form_field.options[d.options_index].selected=!1,c=a("#"+this.container_id+"_o_"+b),c.removeClass("result-selected").addClass("active-result").show(),this.result_clear_highlight(),this.winnow_results(),this.form_field_jq.trigger("change");return this.search_field_scale()},b.prototype.results_search=function(a){return this.results_showing?this.winnow_results():this.results_show()},b.prototype.winnow_results=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;j=new Date,this.no_results_clear(),h=0,i=this.search_field.val()===this.default_text?"":a("
        ").text(a.trim(this.search_field.val())).html(),f=new RegExp("^"+i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),m=new RegExp(i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),r=this.results_data;for(n=0,p=r.length;n=0||c.html.indexOf("[")===0){e=c.html.replace(/\[|\]/g,"").split(" ");if(e.length)for(o=0,q=e.length;o"+c.html.substr(k+i.length),l=l.substr(0,k)+""+l.substr(k)):l=c.html,a("#"+g).html!==l&&a("#"+g).html(l),this.result_activate(a("#"+g)),c.group_array_index!=null&&a("#"+this.results_data[c.group_array_index].dom_id).show()):(this.result_highlight&&g===this.result_highlight.attr("id")&&this.result_clear_highlight(),this.result_deactivate(a("#"+g)))}}return h<1&&i.length?this.no_results(i):this.winnow_results_set_highlight()},b.prototype.winnow_results_clear=function(){var b,c,d,e,f;this.search_field.val(""),c=this.search_results.find("li"),f=[];for(d=0,e=c.length;dNo results match ""'),c.find("span").first().html(b);return this.search_results.append(c)},b.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},b.prototype.keydown_arrow=function(){var b,c;this.result_highlight?this.results_showing&&(c=this.result_highlight.nextAll("li.active-result").first(),c&&this.result_do_highlight(c)):(b=this.search_results.find("li.active-result").first(),b&&this.result_do_highlight(a(b)));if(!this.results_showing)return this.results_show()},b.prototype.keyup_arrow=function(){var a;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight){a=this.result_highlight.prevAll("li.active-result");if(a.length)return this.result_do_highlight(a.first());this.choices>0&&this.results_hide();return this.result_clear_highlight()}},b.prototype.keydown_backstroke=function(){if(this.pending_backstroke){this.choice_destroy(this.pending_backstroke.find("a").first());return this.clear_backstroke()}this.pending_backstroke=this.search_container.siblings("li.search-choice").last();return this.pending_backstroke.addClass("search-choice-focus")},b.prototype.clear_backstroke=function(){this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus");return this.pending_backstroke=null},b.prototype.keyup_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale();switch(b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke){this.result_clear_highlight();return this.results_search()}break;case 13:a.preventDefault();if(this.results_showing)return this.result_select();break;case 27:if(this.results_showing)return this.results_hide();break;case 9:case 38:case 40:case 16:break;default:return this.results_search()}},b.prototype.keydown_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale(),b!==8&&this.pending_backstroke&&this.clear_backstroke();switch(b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.mouse_on_container=!1;break;case 13:a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},b.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(i=0,j=g.length;i",{style:f}),c.text(this.search_field.val()),a("body").append(c),h=c.width()+25,c.remove(),h>this.f_width-10&&(h=this.f_width-10),this.search_field.css({width:h+"px"}),b=this.container.height();return this.dropdown.css({top:b+"px"})}},b.prototype.generate_field_id=function(){var a;a=this.generate_random_id(),this.form_field.id=a;return a},b.prototype.generate_random_id=function(){var b;b="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();while(a("#"+b).length>0)b+=this.generate_random_char();return b},b.prototype.generate_random_char=function(){var a,b,c;a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ",c=Math.floor(Math.random()*a.length);return b=a.substring(c,c+1)};return b}(),c=function(a){var b;return b=a.outerWidth()-a.width()},d.get_side_border_padding=c}).call(this),function(){var a;a=function(){function a(){this.options_index=0,this.parsed=[]}a.prototype.add_node=function(a){return a.nodeName==="OPTGROUP"?this.add_group(a):this.add_option(a)},a.prototype.add_group=function(a){var b,c,d,e,f,g;b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:a.label,children:0,disabled:a.disabled}),f=a.childNodes,g=[];for(d=0,e=f.length;d",{id:this.container_id,"class":"chzn-container"+(this.is_rtl?" chzn-rtl":""),style:"width: "+this.f_width+"px;"}),this.is_multiple?b.html('
          '):b.html(''+this.default_text+'
            '),this.form_field_jq.hide().after(b),this.container=a("#"+this.container_id),this.container.addClass("chzn-container-"+(this.is_multiple?"multi":"single")),!this.is_multiple&&this.form_field.options.length<=this.disable_search_threshold&&this.container.addClass("chzn-container-single-nosearch"),this.dropdown=this.container.find("div.chzn-drop").first(),d=this.container.height(),e=this.f_width-c(this.dropdown),this.dropdown.css({width:e+"px",top:d+"px"}),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chzn-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chzn-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chzn-search").first(),this.selected_item=this.container.find(".chzn-single").first(),f=e-c(this.search_container)-c(this.search_field),this.search_field.css({width:f+"px"})),this.results_build();return this.set_tab_index()},b.prototype.register_observers=function(){this.container.mousedown(e(function(a){return this.container_mousedown(a)},this)),this.container.mouseup(e(function(a){return this.container_mouseup(a)},this)),this.container.mouseenter(e(function(a){return this.mouse_enter(a)},this)),this.container.mouseleave(e(function(a){return this.mouse_leave(a)},this)),this.search_results.mouseup(e(function(a){return this.search_results_mouseup(a)},this)),this.search_results.mouseover(e(function(a){return this.search_results_mouseover(a)},this)),this.search_results.mouseout(e(function(a){return this.search_results_mouseout(a)},this)),this.form_field_jq.bind("liszt:updated",e(function(a){return this.results_update_field(a)},this)),this.search_field.blur(e(function(a){return this.input_blur(a)},this)),this.search_field.keyup(e(function(a){return this.keyup_checker(a)},this)),this.search_field.keydown(e(function(a){return this.keydown_checker(a)},this));if(this.is_multiple){this.search_choices.click(e(function(a){return this.choices_click(a)},this));return this.search_field.focus(e(function(a){return this.input_focus(a)},this))}},b.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq.attr("disabled");if(this.is_disabled){this.container.addClass("chzn-disabled"),this.search_field.attr("disabled",!0),this.is_multiple||this.selected_item.unbind("focus",this.activate_action);return this.close_field()}this.container.removeClass("chzn-disabled"),this.search_field.attr("disabled",!1);if(!this.is_multiple)return this.selected_item.bind("focus",this.activate_action)},b.prototype.container_mousedown=function(b){var c;if(!this.is_disabled){c=b!=null?a(b.target).hasClass("search-choice-close"):!1,b&&b.type==="mousedown"&&b.stopPropagation();if(!this.pending_destroy_click&&!c){this.active_field?!this.is_multiple&&b&&(a(b.target)===this.selected_item||a(b.target).parents("a.chzn-single").length)&&(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(document).click(this.click_test_action),this.results_show());return this.activate_field()}return this.pending_destroy_click=!1}},b.prototype.container_mouseup=function(a){if(a.target.nodeName==="ABBR")return this.results_reset(a)},b.prototype.mouse_enter=function(){return this.mouse_on_container=!0},b.prototype.mouse_leave=function(){return this.mouse_on_container=!1},b.prototype.input_focus=function(a){if(!this.active_field)return setTimeout(e(function(){return this.container_mousedown()},this),50)},b.prototype.input_blur=function(a){if(!this.mouse_on_container){this.active_field=!1;return setTimeout(e(function(){return this.blur_test()},this),100)}},b.prototype.blur_test=function(a){if(!this.active_field&&this.container.hasClass("chzn-container-active"))return this.close_field()},b.prototype.close_field=function(){a(document).unbind("click",this.click_test_action),this.is_multiple||(this.selected_item.attr("tabindex",this.search_field.attr("tabindex")),this.search_field.attr("tabindex",-1)),this.active_field=!1,this.results_hide(),this.container.removeClass("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default();return this.search_field_scale()},b.prototype.activate_field=function(){!this.is_multiple&&!this.active_field&&(this.search_field.attr("tabindex",this.selected_item.attr("tabindex")),this.selected_item.attr("tabindex",-1)),this.container.addClass("chzn-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val());return this.search_field.focus()},b.prototype.test_active_click=function(b){return a(b.target).parents("#"+this.container_id).length?this.active_field=!0:this.close_field()},b.prototype.results_build=function(){var a,b,c,e,f,g;c=new Date,this.parsing=!0,this.results_data=d.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.find("li.search-choice").remove(),this.choices=0):this.is_multiple||this.selected_item.find("span").text(this.default_text),a="",g=this.results_data;for(e=0,f=g.length;e')));this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.search_results.html(a);return this.parsing=!1},b.prototype.result_add_group=function(b){if(!b.disabled){b.dom_id=this.container_id+"_g_"+b.array_index;return'
          • '+a("
            ").text(b.label).html()+"
          • "}return""},b.prototype.result_add_option=function(a){var b,c;if(!a.disabled){a.dom_id=this.container_id+"_o_"+a.array_index,b=a.selected&&this.is_multiple?[]:["active-result"],a.selected&&b.push("result-selected"),a.group_array_index!=null&&b.push("group-option"),a.classes!==""&&b.push(a.classes),c=a.style.cssText!==""?' style="'+a.style+'"':"";return'
          • "+a.html+"
          • "}return""},b.prototype.results_update_field=function(){this.result_clear_highlight(),this.result_single_selected=null;return this.results_build()},b.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight();if(b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(c'+b.html+''),d=a("#"+c).find("a").first();return d.click(e(function(a){return this.choice_destroy_link_click(a)},this))},b.prototype.choice_destroy_link_click=function(b){b.preventDefault();if(!this.is_disabled){this.pending_destroy_click=!0;return this.choice_destroy(a(b.target))}return b.stopPropagation},b.prototype.choice_destroy=function(a){this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.val().length<1&&this.results_hide(),this.result_deselect(a.attr("rel"));return a.parents("li").first().remove()},b.prototype.results_reset=function(b){this.form_field.options[0].selected=!0,this.selected_item.find("span").text(this.default_text),this.show_search_field_default(),a(b.target).remove(),this.form_field_jq.trigger("change");if(this.active_field)return this.results_hide()},b.prototype.result_select=function(a){var b,c,d,e;if(this.result_highlight){b=this.result_highlight,c=b.attr("id"),this.result_clear_highlight(),this.is_multiple?this.result_deactivate(b):(this.search_results.find(".result-selected").removeClass("result-selected"),this.result_single_selected=b),b.addClass("result-selected"),e=c.substr(c.lastIndexOf("_")+1),d=this.results_data[e],d.selected=!0,this.form_field.options[d.options_index].selected=!0,this.is_multiple?this.choice_build(d):(this.selected_item.find("span").first().text(d.text),this.allow_single_deselect&&this.selected_item.find("span").first().after('')),(!a.metaKey||!this.is_multiple)&&this.results_hide(),this.search_field.val(""),this.form_field_jq.trigger("change");return this.search_field_scale()}},b.prototype.result_activate=function(a){return a.addClass("active-result")},b.prototype.result_deactivate=function(a){return a.removeClass("active-result")},b.prototype.result_deselect=function(b){var c,d;d=this.results_data[b],d.selected=!1,this.form_field.options[d.options_index].selected=!1,c=a("#"+this.container_id+"_o_"+b),c.removeClass("result-selected").addClass("active-result").show(),this.result_clear_highlight(),this.winnow_results(),this.form_field_jq.trigger("change");return this.search_field_scale()},b.prototype.results_search=function(a){return this.results_showing?this.winnow_results():this.results_show()},b.prototype.winnow_results=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;j=new Date,this.no_results_clear(),h=0,i=this.search_field.val()===this.default_text?"":a("
            ").text(a.trim(this.search_field.val())).html(),f=new RegExp("^"+i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),m=new RegExp(i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),r=this.results_data;for(n=0,p=r.length;n=0||c.html.indexOf("[")===0){e=c.html.replace(/\[|\]/g,"").split(" ");if(e.length)for(o=0,q=e.length;o"+c.html.substr(k+i.length),l=l.substr(0,k)+""+l.substr(k)):l=c.html,a("#"+g).html!==l&&a("#"+g).html(l),this.result_activate(a("#"+g)),c.group_array_index!=null&&a("#"+this.results_data[c.group_array_index].dom_id).show()):(this.result_highlight&&g===this.result_highlight.attr("id")&&this.result_clear_highlight(),this.result_deactivate(a("#"+g)))}}return h<1&&i.length?this.no_results(i):this.winnow_results_set_highlight()},b.prototype.winnow_results_clear=function(){var b,c,d,e,f;this.search_field.val(""),c=this.search_results.find("li"),f=[];for(d=0,e=c.length;d'+this.results_none_found+' ""'),c.find("span").first().html(b);return this.search_results.append(c)},b.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},b.prototype.keydown_arrow=function(){var b,c;this.result_highlight?this.results_showing&&(c=this.result_highlight.nextAll("li.active-result").first(),c&&this.result_do_highlight(c)):(b=this.search_results.find("li.active-result").first(),b&&this.result_do_highlight(a(b)));if(!this.results_showing)return this.results_show()},b.prototype.keyup_arrow=function(){var a;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight){a=this.result_highlight.prevAll("li.active-result");if(a.length)return this.result_do_highlight(a.first());this.choices>0&&this.results_hide();return this.result_clear_highlight()}},b.prototype.keydown_backstroke=function(){if(this.pending_backstroke){this.choice_destroy(this.pending_backstroke.find("a").first());return this.clear_backstroke()}this.pending_backstroke=this.search_container.siblings("li.search-choice").last();return this.pending_backstroke.addClass("search-choice-focus")},b.prototype.clear_backstroke=function(){this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus");return this.pending_backstroke=null},b.prototype.keyup_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale();switch(b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke){this.result_clear_highlight();return this.results_search()}break;case 13:a.preventDefault();if(this.results_showing)return this.result_select(a);break;case 27:if(this.results_showing)return this.results_hide();break;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},b.prototype.keydown_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale(),b!==8&&this.pending_backstroke&&this.clear_backstroke();switch(b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.mouse_on_container=!1;break;case 13:a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},b.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(i=0,j=g.length;i",{style:f}),c.text(this.search_field.val()),a("body").append(c),h=c.width()+25,c.remove(),h>this.f_width-10&&(h=this.f_width-10),this.search_field.css({width:h+"px"}),b=this.container.height();return this.dropdown.css({top:b+"px"})}},b.prototype.generate_field_id=function(){var a;a=this.generate_random_id(),this.form_field.id=a;return a},b.prototype.generate_random_id=function(){var b;b="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();while(a("#"+b).length>0)b+=this.generate_random_char();return b},b.prototype.generate_random_char=function(){var a,b,c;a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ",c=Math.floor(Math.random()*a.length);return b=a.substring(c,c+1)};return b}(),c=function(a){var b;return b=a.outerWidth()-a.width()},d.get_side_border_padding=c}).call(this),function(){var a;a=function(){function a(){this.options_index=0,this.parsed=[]}a.prototype.add_node=function(a){return a.nodeName==="OPTGROUP"?this.add_group(a):this.add_option(a)},a.prototype.add_group=function(a){var b,c,d,e,f,g;b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:a.label,children:0,disabled:a.disabled}),f=a.childNodes,g=[];for(d=0,e=f.length;d Date: Thu, 24 Nov 2011 21:28:44 +0100 Subject: [PATCH 097/136] Bookmarks: make a soft-requirement of php-curl --- apps/bookmarks/bookmarksHelper.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/bookmarks/bookmarksHelper.php b/apps/bookmarks/bookmarksHelper.php index 44d4235b9b..ac512fbc24 100644 --- a/apps/bookmarks/bookmarksHelper.php +++ b/apps/bookmarks/bookmarksHelper.php @@ -56,6 +56,9 @@ function getURLMetadata($url) { } $metadata['url'] = $url; + if (!function_exists('curl_init')){ + return $metadata; + } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); @@ -66,4 +69,4 @@ function getURLMetadata($url) { $metadata['title'] = htmlspecialchars_decode(@$match[1]); return $metadata; -} \ No newline at end of file +} From 43911d9a6f403f8531b5caa5ac843565d98a2417 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 24 Nov 2011 21:29:48 +0100 Subject: [PATCH 098/136] Template: output better html for select options --- lib/template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/template.php b/lib/template.php index d1439199e1..881d2a27b1 100644 --- a/lib/template.php +++ b/lib/template.php @@ -121,7 +121,7 @@ function html_select_options($options, $selected, $params=array()) { $label = $label[$label_name]; } $select = in_array($value, $selected) ? ' selected="selected"' : ''; - $html .= ''; + $html .= ''."\n"; } return $html; } From 9701145f830d5d4286e8602d3b0f464914468c34 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 24 Nov 2011 21:34:50 +0100 Subject: [PATCH 099/136] Contacts: make type of phone property also multiselect in addproperty --- apps/contacts/js/interface.js | 1 + apps/contacts/templates/part.details.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/contacts/js/interface.js b/apps/contacts/js/interface.js index 24b512e532..ba1c0e536c 100644 --- a/apps/contacts/js/interface.js +++ b/apps/contacts/js/interface.js @@ -64,6 +64,7 @@ $(document).ready(function(){ else{ $('#contacts_generic').clone().insertAfter($('#contacts_addpropertyform .contacts_property_name')); } + $('#contacts_addpropertyform .contacts_property_data select').chosen(); }); $('#contacts_addpropertyform input[type="submit"]').live('click',function(){ diff --git a/apps/contacts/templates/part.details.php b/apps/contacts/templates/part.details.php index f5bd75809b..5e9a5c5674 100644 --- a/apps/contacts/templates/part.details.php +++ b/apps/contacts/templates/part.details.php @@ -75,7 +75,7 @@

            -

            From 6ce6cbf4894a34c4e5bf1dd13a75be661e5ab520 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 24 Nov 2011 21:35:41 +0100 Subject: [PATCH 100/136] Contacts: better label for saving a property --- apps/contacts/templates/part.setpropertyform.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/contacts/templates/part.setpropertyform.php b/apps/contacts/templates/part.setpropertyform.php index b0bf6645d5..d31bde009a 100644 --- a/apps/contacts/templates/part.setpropertyform.php +++ b/apps/contacts/templates/part.setpropertyform.php @@ -52,5 +52,5 @@

            - + From 53ff85e2ad631b03b8f1ee788d0019be9a8e8aa1 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 24 Nov 2011 21:36:14 +0100 Subject: [PATCH 101/136] Contacts: layout updates --- apps/contacts/css/styles.css | 3 ++- apps/contacts/templates/part.details.php | 4 ++-- apps/contacts/templates/part.setpropertyform.php | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/contacts/css/styles.css b/apps/contacts/css/styles.css index e226c48ae5..f351589fe1 100644 --- a/apps/contacts/css/styles.css +++ b/apps/contacts/css/styles.css @@ -3,9 +3,10 @@ #contacts_deletecard {position:absolute;top:15px;right:0;} #contacts_details_list { list-style:none; } +#contacts_details_list li { overflow:visible; } #contacts_details_list li p.contacts_property_name { width:25%; float:left;text-align:right;padding-right:0.3em;color:#666; } #contacts_details_list li p.contacts_property_data, #contacts_details_list li ul.contacts_property_data { width:72%;float:left; } -#contacts_addproperty_button, #contacts_setproperty_button { margin-left:25%; } +#contacts_setproperty_button { margin-left:25%; } .contacts_property_data ul, ol.contacts_property_data { list-style:none; } .contacts_property_data li { overflow: hidden; } diff --git a/apps/contacts/templates/part.details.php b/apps/contacts/templates/part.details.php index 5e9a5c5674..f6d69005a0 100644 --- a/apps/contacts/templates/part.details.php +++ b/apps/contacts/templates/part.details.php @@ -29,12 +29,12 @@ +
            +

            -
            -
            - inc("part.addcardform"); ?> + inc("part.details"); + } + else{ + echo $this->inc("part.addcardform"); + } + ?>
            From 546b7279a3488f242bc9f18d224ee9438915260e Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Wed, 7 Dec 2011 20:34:41 +0100 Subject: [PATCH 114/136] Contacts: Add "Preferred" before phone label for preferred numbers --- apps/contacts/templates/part.property.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/contacts/templates/part.property.php b/apps/contacts/templates/part.property.php index afef431126..6264f29674 100644 --- a/apps/contacts/templates/part.property.php +++ b/apps/contacts/templates/part.property.php @@ -20,7 +20,7 @@

            -

            t('Phone'); ?>

            +

            t('Preferred').' ' : '' ?>t('Phone'); ?>

            From a389d94e2bf9b1288a13b002a17039cb6e87d969 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Wed, 7 Dec 2011 20:36:47 +0100 Subject: [PATCH 115/136] Imageviewer: fix fancybox.png image url in fancybox css --- .../css/jquery.fancybox-1.3.4.css | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/apps/files_imageviewer/css/jquery.fancybox-1.3.4.css b/apps/files_imageviewer/css/jquery.fancybox-1.3.4.css index 030497750b..1dfd9b95d3 100644 --- a/apps/files_imageviewer/css/jquery.fancybox-1.3.4.css +++ b/apps/files_imageviewer/css/jquery.fancybox-1.3.4.css @@ -35,7 +35,7 @@ left: 0; width: 40px; height: 480px; - background-image: url('../img/fancybox/fancybox.png'); + background-image: url('../img/fancybox.png'); } #fancybox-overlay { @@ -282,7 +282,7 @@ #fancybox-title-over { padding: 10px; - background-image: url('../img/fancybox/fancy_title_over.png'); + background-image: url('../img/fancy_title_over.png'); display: block; } @@ -306,7 +306,7 @@ #fancybox-title-float-left { padding: 0 0 0 15px; - background: url('../img/fancybox/fancybox.png') -40px -90px no-repeat; + background: url('../img/fancybox.png') -40px -90px no-repeat; } #fancybox-title-float-main { @@ -314,25 +314,25 @@ line-height: 29px; font-weight: bold; padding: 0 0 3px 0; - background: url('../img/fancybox/fancybox-x.png') 0px -40px; + background: url('../img/fancybox-x.png') 0px -40px; } #fancybox-title-float-right { padding: 0 0 0 15px; - background: url('../img/fancybox/fancybox.png') -55px -90px no-repeat; + background: url('../img/fancybox.png') -55px -90px no-repeat; } /* IE6 */ -.fancybox-ie6 #fancybox-close { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_close.png', sizingMethod='scale'); } +.fancybox-ie6 #fancybox-close { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_close.png', sizingMethod='scale'); } -.fancybox-ie6 #fancybox-left-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_nav_left.png', sizingMethod='scale'); } -.fancybox-ie6 #fancybox-right-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_nav_right.png', sizingMethod='scale'); } +.fancybox-ie6 #fancybox-left-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_nav_left.png', sizingMethod='scale'); } +.fancybox-ie6 #fancybox-right-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_nav_right.png', sizingMethod='scale'); } -.fancybox-ie6 #fancybox-title-over { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_over.png', sizingMethod='scale'); zoom: 1; } -.fancybox-ie6 #fancybox-title-float-left { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_left.png', sizingMethod='scale'); } -.fancybox-ie6 #fancybox-title-float-main { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_main.png', sizingMethod='scale'); } -.fancybox-ie6 #fancybox-title-float-right { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_right.png', sizingMethod='scale'); } +.fancybox-ie6 #fancybox-title-over { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_title_over.png', sizingMethod='scale'); zoom: 1; } +.fancybox-ie6 #fancybox-title-float-left { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_title_left.png', sizingMethod='scale'); } +.fancybox-ie6 #fancybox-title-float-main { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_title_main.png', sizingMethod='scale'); } +.fancybox-ie6 #fancybox-title-float-right { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_title_right.png', sizingMethod='scale'); } .fancybox-ie6 #fancybox-bg-w, .fancybox-ie6 #fancybox-bg-e, .fancybox-ie6 #fancybox-left, .fancybox-ie6 #fancybox-right, #fancybox-hide-sel-frame { height: expression(this.parentNode.clientHeight + "px"); @@ -343,17 +343,17 @@ top: expression( (-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px'); } -#fancybox-loading.fancybox-ie6 div { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_loading.png', sizingMethod='scale'); } +#fancybox-loading.fancybox-ie6 div { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_loading.png', sizingMethod='scale'); } /* IE6, IE7, IE8 */ .fancybox-ie .fancybox-bg { background: transparent !important; } -.fancybox-ie #fancybox-bg-n { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_n.png', sizingMethod='scale'); } -.fancybox-ie #fancybox-bg-ne { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_ne.png', sizingMethod='scale'); } -.fancybox-ie #fancybox-bg-e { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_e.png', sizingMethod='scale'); } -.fancybox-ie #fancybox-bg-se { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_se.png', sizingMethod='scale'); } -.fancybox-ie #fancybox-bg-s { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_s.png', sizingMethod='scale'); } -.fancybox-ie #fancybox-bg-sw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_sw.png', sizingMethod='scale'); } -.fancybox-ie #fancybox-bg-w { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_w.png', sizingMethod='scale'); } -.fancybox-ie #fancybox-bg-nw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_nw.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-n { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_shadow_n.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-ne { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_shadow_ne.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-e { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_shadow_e.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-se { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_shadow_se.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-s { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_shadow_s.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-sw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_shadow_sw.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-w { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_shadow_w.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-bg-nw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/fancy_shadow_nw.png', sizingMethod='scale'); } From 0342b5fc433da288f62b701bd77121d300ab30bc Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Wed, 7 Dec 2011 20:38:24 +0100 Subject: [PATCH 116/136] Fix filename of log icon --- lib/app.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/app.php b/lib/app.php index d3d9986576..b1aa8ba354 100644 --- a/lib/app.php +++ b/lib/app.php @@ -223,7 +223,7 @@ class OC_App{ // admin apps menu $settings[] = array( "id" => "core_apps", "order" => 3, "href" => OC_Helper::linkTo( "settings", "apps.php?installed" ), "name" => $l->t("Apps"), "icon" => OC_Helper::imagePath( "settings", "apps.svg" )); // admin log menu - $settings[] = array( "id" => "core_log", "order" => 4, "href" => OC_Helper::linkTo( "settings", "log.php" ), "name" => $l->t("Log"), "icon" => OC_Helper::imagePath( "log", "apps.svg" )); + $settings[] = array( "id" => "core_log", "order" => 4, "href" => OC_Helper::linkTo( "settings", "log.php" ), "name" => $l->t("Log"), "icon" => OC_Helper::imagePath( "settings", "log.svg" )); $settings[]=array( "id" => "admin", "order" => 1000, "href" => OC_Helper::linkTo( "settings", "admin.php" ), "name" => $l->t("Admin"), "icon" => OC_Helper::imagePath( "settings", "admin.svg" )); } From 9ba59aee3657dd67b8c0d575f1454fe50754f1f7 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Wed, 7 Dec 2011 20:38:58 +0100 Subject: [PATCH 117/136] Sort apps on name and enabled status --- settings/apps.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/settings/apps.php b/settings/apps.php index 27b4c17f9e..12a7bf7720 100644 --- a/settings/apps.php +++ b/settings/apps.php @@ -43,6 +43,14 @@ foreach($registeredApps as $app){ } } +function app_sort($a, $b){ + if ($a['active'] != $b['active']){ + return $b['active'] - $a['active']; + } + return strcmp($a['name'], $b['name']); +} +usort($apps, 'app_sort'); + // dissabled for now // $catagoryNames=OC_OCSClient::getCategories(); // if(is_array($catagoryNames)){ From d4546cdf37bced97d447b5170202cbd61c39d3be Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Thu, 8 Dec 2011 17:18:22 +0700 Subject: [PATCH 118/136] bump version number to force db rebuild --- apps/remoteStorage/appinfo/info.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remoteStorage/appinfo/info.xml b/apps/remoteStorage/appinfo/info.xml index a20c6ff4cd..8179ca9911 100644 --- a/apps/remoteStorage/appinfo/info.xml +++ b/apps/remoteStorage/appinfo/info.xml @@ -3,7 +3,7 @@ remoteStorage remoteStorage compatibility Enables your users to use ownCloud as their remote storage for unhosted applications. - 0.1 + 0.2 AGPL Michiel de Jong 2 From eeaf539a4414e3081b6f6652167363a3221a1973 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 8 Dec 2011 20:04:56 +0100 Subject: [PATCH 119/136] Gallery: splitout model code --- apps/gallery/ajax/createAlbum.php | 3 +- apps/gallery/ajax/getAlbums.php | 6 ++-- apps/gallery/ajax/getCovers.php | 16 +++++++---- apps/gallery/ajax/scanForAlbums.php | 3 +- apps/gallery/ajax/thumbnail.php | 17 +++++++---- apps/gallery/appinfo/app.php | 4 +++ apps/gallery/css/styles.css | 13 ++++++++- apps/gallery/index.php | 7 ++--- apps/gallery/lib/album.php | 18 ++++++++++++ apps/gallery/lib/photo.php | 28 +++++++++++++++++++ .../{lib_scanner.php => lib/scanner.php} | 22 +++++---------- apps/gallery/templates/view_album.php | 10 +++++-- lib/db.php | 2 +- 13 files changed, 105 insertions(+), 44 deletions(-) create mode 100644 apps/gallery/lib/album.php create mode 100644 apps/gallery/lib/photo.php rename apps/gallery/{lib_scanner.php => lib/scanner.php} (59%) diff --git a/apps/gallery/ajax/createAlbum.php b/apps/gallery/ajax/createAlbum.php index 610f761b72..9413b54718 100644 --- a/apps/gallery/ajax/createAlbum.php +++ b/apps/gallery/ajax/createAlbum.php @@ -3,8 +3,7 @@ require_once('../../../lib/base.php'); OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('gallery'); -$stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_albums ("uid_owner", "album_name") VALUES ("'.OC_User::getUser().'", "'.$_GET['album_name'].'")'); -$stmt->execute(array()); +OC_Gallery_Album::create(OC_User::getUser(), $_GET['album_name']); OC_JSON::success(array('name' => $_GET['album_name'])); diff --git a/apps/gallery/ajax/getAlbums.php b/apps/gallery/ajax/getAlbums.php index 38bea74636..856f29344d 100644 --- a/apps/gallery/ajax/getAlbums.php +++ b/apps/gallery/ajax/getAlbums.php @@ -4,13 +4,11 @@ OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('gallery'); $a = array(); -$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE `uid_owner` = ?'); -$result = $stmt->execute(array(OC_User::getUser())); +$result = OC_Gallery_Album::find(OC_User::getUser()); while ($r = $result->fetchRow()) { $album_name = $r['album_name']; - $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_photos WHERE `album_id` = ?'); - $tmp_res = $stmt->execute(array($r['album_id'])); + $tmp_res = OC_Gallery_Photo::find($r['album_id']); $a[] = array('name' => $album_name, 'numOfItems' => min($tmp_res->numRows(), 10)); } diff --git a/apps/gallery/ajax/getCovers.php b/apps/gallery/ajax/getCovers.php index b9c7558a53..db7c8e9fcd 100644 --- a/apps/gallery/ajax/getCovers.php +++ b/apps/gallery/ajax/getCovers.php @@ -18,7 +18,7 @@ function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height, $tgtImg, $ default: exit(); } - if(!$myImage) exit(); + if(!$myImage) exit(); $ratio_orig = $width_orig/$height_orig; if ($thumbnail_width/$thumbnail_height > $ratio_orig) { @@ -44,15 +44,19 @@ function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height, $tgtImg, $ $box_size = 200; $album_name= $_GET['album_name']; -$stmt = OC_DB::prepare('SELECT `file_path` FROM *PREFIX*gallery_photos,*PREFIX*gallery_albums WHERE *PREFIX*gallery_albums.`uid_owner` = ? AND `album_name` = ? AND *PREFIX*gallery_photos.`album_id` = *PREFIX*gallery_albums.`album_id`'); -$result = $stmt->execute(array(OC_User::getUser(), $album_name)); +$result = OC_Gallery_Photo::findForAlbum(OC_User::getUser(), $album_name); $numOfItems = min($result->numRows(),10); -$targetImg = imagecreatetruecolor($numOfItems*$box_size, $box_size); +if ($numOfItems){ + $targetImg = imagecreatetruecolor($numOfItems*$box_size, $box_size); +} +else{ + $targetImg = imagecreatetruecolor($box_size, $box_size); +} $counter = 0; while (($i = $result->fetchRow()) && $counter < $numOfItems) { - $imagePath = OC::$CONFIG_DATADIRECTORY . $i['file_path']; + $imagePath = OC_Filesystem::getLocalFile($i['file_path']); if(file_exists($imagePath)) { CroppedThumbnail($imagePath, $box_size, $box_size, $targetImg, $counter*$box_size); @@ -65,7 +69,7 @@ header('Content-Type: image/png'); $offset = 3600 * 24; // calc the string in GMT not localtime and add the offset header("Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT"); -header('Cache-Control: max-age=3600, must-revalidate'); +header('Cache-Control: max-age='.$offset.', must-revalidate'); header('Pragma: public'); imagepng($targetImg); diff --git a/apps/gallery/ajax/scanForAlbums.php b/apps/gallery/ajax/scanForAlbums.php index de0b141a36..ff696804b0 100644 --- a/apps/gallery/ajax/scanForAlbums.php +++ b/apps/gallery/ajax/scanForAlbums.php @@ -3,9 +3,8 @@ require_once('../../../lib/base.php'); OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('gallery'); -require_once('../lib_scanner.php'); -OC_JSON::success(array('albums' => OC_GALLERY_SCANNER::scan(''))); +OC_JSON::success(array('albums' => OC_Gallery_Scanner::scan(''))); //OC_JSON::success(array('albums' => array(array('name' => 'test', 'imagesCount' => 1, 'images' => array('dupa'))))); ?> diff --git a/apps/gallery/ajax/thumbnail.php b/apps/gallery/ajax/thumbnail.php index a141645293..d937691fa0 100644 --- a/apps/gallery/ajax/thumbnail.php +++ b/apps/gallery/ajax/thumbnail.php @@ -49,12 +49,19 @@ function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height) { //$imgSr $box_size = 200; $img = $_GET['img']; -$tmp = OC::$CONFIG_DATADIRECTORY . $img; +$imagePath = OC_Filesystem::getLocalFile($img); -if(file_exists($tmp)) +if(file_exists($imagePath)) { - header('Content-Type: image/png'); - $image = CroppedThumbnail($tmp, $box_size, $box_size); + $image = CroppedThumbnail($imagePath, $box_size, $box_size); + + header('Content-Type: image/png'); + $offset = 3600 * 24; + // calc the string in GMT not localtime and add the offset + header("Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT"); + header('Cache-Control: max-age='.$offset.', must-revalidate'); + header('Pragma: public'); + imagepng($image); imagedestroy($image); -} \ No newline at end of file +} diff --git a/apps/gallery/appinfo/app.php b/apps/gallery/appinfo/app.php index 8f855c470e..2b1ab857af 100644 --- a/apps/gallery/appinfo/app.php +++ b/apps/gallery/appinfo/app.php @@ -1,4 +1,8 @@ 20, 'id' => 'gallery', diff --git a/apps/gallery/css/styles.css b/apps/gallery/css/styles.css index 03b179138e..070effe3a9 100644 --- a/apps/gallery/css/styles.css +++ b/apps/gallery/css/styles.css @@ -1,14 +1,22 @@ div#gallery_list { margin: 90pt 20pt; } +div#gallery_list.leftcontent { + padding-top: 15px; + margin: 0; + text-align: center; +} div#gallery_album_box { width: 200px; text-align: center; border: 0; - float: left; + display: inline-block; margin: 5pt; } +.leftcontent div#gallery_album_box { + margin: 5px; +} div#gallery_album_box h1 { font-size: 12pt; @@ -21,3 +29,6 @@ div#gallery_album_cover { border: solid 1px black; } +#gallery_images { +padding:10px 5px; +} diff --git a/apps/gallery/index.php b/apps/gallery/index.php index 87fdafcf13..2c409089eb 100644 --- a/apps/gallery/index.php +++ b/apps/gallery/index.php @@ -7,8 +7,7 @@ OC_App::setActiveNavigationEntry( 'gallery_index' ); if (!isset($_GET['view'])) { - $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE uid_owner = ?'); - $result = $stmt->execute(array(OC_User::getUser())); + $result = OC_Gallery_Album::find(OC_User::getUser()); $r = array(); while ($row = $result->fetchRow()) @@ -18,9 +17,7 @@ if (!isset($_GET['view'])) { $tmpl->assign('r', $r); $tmpl->printPage(); } else { - $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_photos, *PREFIX*gallery_albums WHERE uid_owner = ? AND album_name = ? AND *PREFIX*gallery_albums.album_id = *PREFIX*gallery_photos.album_id'); - - $result = $stmt->execute(array(OC_User::getUser(), $_GET['view'])); + $result = OC_Gallery_Photo::findForAlbum(OC_User::getUser(), $_GET['view']); $photos = array(); while ($p = $result->fetchRow()) diff --git a/apps/gallery/lib/album.php b/apps/gallery/lib/album.php new file mode 100644 index 0000000000..6ddfe46de3 --- /dev/null +++ b/apps/gallery/lib/album.php @@ -0,0 +1,18 @@ +execute(array($owner, $name)); + } + public static function find($owner, $name=null){ + $sql = 'SELECT * FROM *PREFIX*gallery_albums WHERE uid_owner = ?'; + $args = array($owner); + if (!is_null($name)){ + $sql .= ' AND album_name = ?'; + $args[] = $name; + } + $stmt = OC_DB::prepare($sql); + return $stmt->execute($args); + } +} diff --git a/apps/gallery/lib/photo.php b/apps/gallery/lib/photo.php new file mode 100644 index 0000000000..97d159935f --- /dev/null +++ b/apps/gallery/lib/photo.php @@ -0,0 +1,28 @@ +execute(array($albumId, $img)); + } + public static function find($albumId, $img=null){ + $sql = 'SELECT * FROM *PREFIX*gallery_photos WHERE album_id = ?'; + $args = array($albumId); + $args = array($albumId); + if (!is_null($img)){ + $sql .= ' AND file_path = ?'; + $args[] = $img; + } + $stmt = OC_DB::prepare($sql); + return $stmt->execute($args); + } + public static function findForAlbum($owner, $album_name){ + $stmt = OC_DB::prepare('SELECT *' + .' FROM *PREFIX*gallery_photos photos,' + .' *PREFIX*gallery_albums albums' + .' WHERE albums.uid_owner = ?' + .' AND albums.album_name = ?' + .' AND photos.album_id = albums.album_id'); + return $stmt->execute(array($owner, $album_name)); + } +} diff --git a/apps/gallery/lib_scanner.php b/apps/gallery/lib/scanner.php similarity index 59% rename from apps/gallery/lib_scanner.php rename to apps/gallery/lib/scanner.php index 1231de3f3c..1590051c48 100644 --- a/apps/gallery/lib_scanner.php +++ b/apps/gallery/lib/scanner.php @@ -1,9 +1,6 @@ execute(array(OC_User::getUser(), $current_album['name'])); + $result = OC_Gallery_Album::find(OC_User::getUser(), $current_album['name']); if ($result->numRows() == 0 && count($current_album['images'])) { - $stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_albums (`uid_owner`, `album_name`) VALUES (?, ?)'); - $stmt->execute(array(OC_User::getUser(), $current_album['name'])); + OC_Gallery_Album::create(OC_User::getUser(), $current_album['name']); + $result = OC_Gallery_Album::find(OC_User::getUser(), $current_album['name']); } - $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE `uid_owner` = ? AND `album_name` = ?'); - $result = $stmt->execute(array(OC_User::getUser(), $current_album['name'])); $albumId = $result->fetchRow(); $albumId = $albumId['album_id']; foreach ($current_album['images'] as $img) { - $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_photos WHERE `album_id` = ? AND `file_path` = ?'); - $result = $stmt->execute(array($albumId, $img)); + $result = OC_Gallery_Photo::find($albumId, $img); if ($result->numRows() == 0) { - $stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_photos (`album_id`, `file_path`) VALUES (?, ?)'); - $stmt->execute(array($albumId, $img)); + OC_Gallery_Photo::create($albumId, $img); } } } diff --git a/apps/gallery/templates/view_album.php b/apps/gallery/templates/view_album.php index 230e2a5c21..ae43e2fc55 100644 --- a/apps/gallery/templates/view_album.php +++ b/apps/gallery/templates/view_album.php @@ -1,5 +1,6 @@

            -