, 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}
+
+
+ {* Content (pre)view *}
+ -
+ {if $tabs_disabled}
+ {'View'|i18n( 'design/admin/node/view/full' )}
+ {else}
+ {'View'|i18n( 'design/admin/node/view/full' )}
+ {/if}
+
+ {* Details *}
+ -
+ {if $tabs_disabled}
+ {'Details'|i18n( 'design/admin/node/view/full' )}
+ {else}
+ {'Details'|i18n( 'design/admin/node/view/full' )}
+ {/if}
+
+
+ {* Translations *}
+ {if fetch( 'content', 'translation_list' )|count|gt( 1 )}
+ {if $available_languages|count|gt( 1 ) }
+ -
+ {if $tabs_disabled}
+ {'Translations (%count)'|i18n( 'design/admin/node/view/full',,hash('%count', $translations_count ) )}
+ {else}
+ {'Translations (%count)'|i18n( 'design/admin/node/view/full',,hash('%count', $translations_count ) )}
+ {/if}
+
+ {/if}
+ {/if}
+
+ {* Locations *}
+ -
+ {if $tabs_disabled}
+ {'Locations (%count)'|i18n( 'design/admin/node/view/full',, hash( '%count', $node.object.assigned_nodes|count ) )}
+ {else}
+ {'Locations (%count)'|i18n( 'design/admin/node/view/full',, hash( '%count', $node.object.assigned_nodes|count ) )}
+ {/if}
+
+
+ {* Relations *}
+ -
+ {if $tabs_disabled}
+ {'Relations (%count)'|i18n( 'design/admin/node/view/full',, hash( '%count', sum( $related_objects_count, $reverse_related_objects_count ) ) )}
+ {else}
+ {'Relations (%count)'|i18n( 'design/admin/node/view/full',, hash( '%count', sum( $related_objects_count, $reverse_related_objects_count ) ) )}
+ {/if}
+
+
+ {* Ordering *}
+ -
+ {if $tabs_disabled}
+ {'Ordering'|i18n( 'design/admin/node/view/full' )}
+ {else}
+ {'Ordering'|i18n( 'design/admin/node/view/full' )}
+ {/if}
+
+
+{include uri='design:window_controls_extratabs.tpl'}
+
+
+
+{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 @@
+