From 022038178f4f3b3d8f10632d266a8033f5445c74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Szyma=C5=84ski?= Date: Tue, 10 Feb 2015 23:09:27 +0100 Subject: [PATCH] Initial commit. --- LICENSE | 48 +++--- README | 10 ++ design/admin2/templates/window_controls.tpl | 171 ++++++++++++++++++++ doc/.gitkeep | 0 extension.xml | 10 ++ ezinfo.php | 34 ++++ settings/admininterface.ini.append.php | 15 ++ settings/design.ini.append.php | 4 + settings/site.ini.append.php | 4 + 9 files changed, 272 insertions(+), 24 deletions(-) create mode 100644 README create mode 100644 design/admin2/templates/window_controls.tpl create mode 100644 doc/.gitkeep create mode 100644 extension.xml create mode 100644 ezinfo.php create mode 100644 settings/admininterface.ini.append.php create mode 100644 settings/design.ini.append.php create mode 100644 settings/site.ini.append.php diff --git a/LICENSE b/LICENSE index d6a9326..60549be 100644 --- a/LICENSE +++ b/LICENSE @@ -1,12 +1,12 @@ -GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + 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 + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public @@ -15,7 +15,7 @@ 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 +the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not @@ -55,8 +55,8 @@ 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 + + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains @@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions: 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 @@ -168,7 +168,7 @@ 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 @@ -225,7 +225,7 @@ 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 @@ -255,7 +255,7 @@ 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 + 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 @@ -277,9 +277,9 @@ 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. - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it @@ -290,8 +290,8 @@ to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - {description} - Copyright (C) {year} {fullname} + + Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -303,16 +303,17 @@ the "copyright" line and a pointer to where the full notice is found. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) year name of author + Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. @@ -329,12 +330,11 @@ necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. - {signature of Ty Coon}, 1 April 1989 + , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General +library. If this is what you want to do, use the GNU Library General Public License instead of this License. - diff --git a/README b/README new file mode 100644 index 0000000..bb2248f --- /dev/null +++ b/README @@ -0,0 +1,10 @@ +License: See, LICENSE +Changelog: See, doc/CHANGELOG +Installation: See, doc/INSTALL +Example: See, doc/EXAMPLE + +KS Admin Tabs is an extension for eZ Publish, that will give you +more flexbility while using additional tabs feature in content +object admin preview. After initial configuration, you can decide +for which content class object, which groups, nodes or objects you +want your new tab to be visible and for which hidden. \ No newline at end of file diff --git a/design/admin2/templates/window_controls.tpl b/design/admin2/templates/window_controls.tpl new file mode 100644 index 0000000..ba4f1ed --- /dev/null +++ b/design/admin2/templates/window_controls.tpl @@ -0,0 +1,171 @@ +{* Window controls *} +{def $node_url_alias = $node.url_alias + $tabs_disabled = ezpreference( 'admin_navigation_content' )|not + $default_tab = 'view' + $node_tab_index = first_set( $view_parameters.tab, $default_tab ) + $read_open_tab_by_cookie = true() + $available_languages = fetch( 'content', 'prioritized_languages' ) + $translations = $node.object.languages + $translations_count = $translations|count + $states = $node.object.allowed_assign_state_list + $states_count = $states|count + $related_objects_count = fetch( 'content', 'related_objects_count', hash( 'object_id', $node.object.id , 'all_relations', true() ) ) + $reverse_related_objects_count = fetch( 'content', 'reverse_related_objects_count', hash( 'object_id', $node.object.id , 'all_relations', true() ) ) + $additional_tabs = array() + $additional_tabs_count = 0 + $valid_tabs = array( $default_tab, 'details', 'translations', 'locations', 'relations', 'states' ) + $navigation_part_name = fetch( 'section', 'object', hash( 'section_id', $node.object.section_id ) ).navigation_part_identifier + $append_new_tab = 0 +} + +{if eq( $navigation_part_name, 'ezusernavigationpart' )} +{def $assigned_policies = fetch( 'user', 'user_role', hash( 'user_id', $node.contentobject_id ) ) + $assigned_roles = fetch( 'user', 'member_of', hash( 'id', $node.contentobject_id ) )} +{/if} + +{foreach ezini( 'WindowControlsSettings', 'AdditionalTabs', 'admininterface.ini' ) as $tab} + {def $tab_navigation_part = ezini( concat( 'AdditionalTab_', $tab ), 'NavigationPartName', 'admininterface.ini' )} + {if ne( $tab_navigation_part, $navigation_part_name )} + {continue} + {/if} + + {def $ini_content_class_id = ezini( concat( 'AdditionalTab_', $tab ), 'ContentClassID', 'admininterface.ini' ) + $content_class_id = $node.object.contentclass_id + } + {if and(not($ini_content_class_id|null()), ne( $ini_content_class_id, $content_class_id ))} + {continue} + {/if} + + {def $ini_parent_node_id = ezini( concat( 'AdditionalTab_', $tab ), 'ParentNodeID', 'admininterface.ini' ) + $parent_node_id = $node.parent_node_id + } + {if and(not($ini_parent_node_id|null()), ne( $ini_parent_node_id, $parent_node_id ))} + {continue} + {/if} + + {def $ini_content_class_identifier = ezini( concat( 'AdditionalTab_', $tab ), 'ContentClassIdentifier', 'admininterface.ini' ) + $content_class_identifier = $node.object.class_identifier + } + {if and(not($ini_content_class_identifier|null()), ne( $ini_content_class_identifier, $content_class_identifier ))} + {continue} + {/if} + + {def $ini_content_object_id = ezini( concat( 'AdditionalTab_', $tab ), 'ContentObjectID', 'admininterface.ini' ) + $content_object_id = $node.contentobject_id + } + {if and(not($ini_content_object_id|null()), ne( $ini_content_object_id, $content_object_id ))} + {continue} + {/if} + + {def $ini_content_node_id = ezini( concat( 'AdditionalTab_', $tab ), 'ContentNodeID', 'admininterface.ini' ) + $content_node_id = $node.contentobject_id + } + {if and(not($ini_content_class_id|null()), ne( $ini_content_node_id, $content_node_id ))} + {continue} + {/if} + + {set $additional_tabs = $additional_tabs|append( $tab )} + {undef $tab_navigation_part + $ini_content_class_id + $content_class_id + $ini_content_node_id + $content_node_id + $ini_parent_node_id + $parent_node_id + $ini_content_class_identifier + $content_class_identifier + $ini_content_object_id + $content_object_id + } +{/foreach} + +{set $valid_tabs = $valid_tabs|append( $additional_tabs ) + $additional_tabs_count = $additional_tabs|count()} + +{if $tabs_disabled} + +{else} + +{/if} + +{if $valid_tabs|contains( $node_tab_index )|not()} + {set $node_tab_index = $default_tab} +{elseif is_set( $view_parameters.tab )} + {* Force tabs enabled if there is a tab index in the url and it's valid *} + {set $tabs_disabled = false()} + {* Signal to node_tab.js that tab is forced by url *} + {set $read_open_tab_by_cookie = false()} +{/if} + + +
+ +{if $tabs_disabled} +
+{else} +
+ {include uri='design:windows.tpl'} +
+{/if} + +{ezscript_require( 'node_tabs.js' )} +{undef} diff --git a/doc/.gitkeep b/doc/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/extension.xml b/extension.xml new file mode 100644 index 0000000..74272bb --- /dev/null +++ b/extension.xml @@ -0,0 +1,10 @@ + + + + KS Admin Tab + 0.1-alpha + Copyright (C) 2015 Kamil Szymański + GNU General Public License v2.0 + http://github.com/eeree + + \ No newline at end of file diff --git a/ezinfo.php b/ezinfo.php new file mode 100644 index 0000000..1f7bbb9 --- /dev/null +++ b/ezinfo.php @@ -0,0 +1,34 @@ + +// This program is free software; you can redistribute it and/or +// modify it under the terms of version 2.0 of the GNU General +// Public License as published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of version 2.0 of the GNU General +// Public License along with this program; if not, write to the Free +// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301, USA. +// ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ## +// + +class ksadmintabssInfo +{ + static function info() + { + return array( 'Name' => 'KS Admin Tab extension', + 'Version' => '0.1-alpha', + 'Copyright' => 'Copyright (C) 2015 Kamil Szymański', + 'License' => 'GNU General Public License v2.0' ); + } +} diff --git a/settings/admininterface.ini.append.php b/settings/admininterface.ini.append.php new file mode 100644 index 0000000..5ac4e24 --- /dev/null +++ b/settings/admininterface.ini.append.php @@ -0,0 +1,15 @@ +