-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kamil Szymański
committed
Feb 10, 2015
1 parent
2c73e9c
commit 0220381
Showing
9 changed files
with
272 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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} | ||
<div class="button-left"><a id="maincontent-show" class="show-hide-tabs" href={'/user/preferences/set/admin_navigation_content/1'|ezurl} title="{'Enable "Tabs" by default while browsing content.'|i18n( 'design/admin/parts/my/menu' )}">+</a></div> | ||
{else} | ||
<div class="button-left"><a id="maincontent-hide" class="show-hide-tabs" href={'/user/preferences/set/admin_navigation_content/0'|ezurl} title="{'Disable "Tabs" by default while browsing content.'|i18n( 'design/admin/parts/my/menu' )}">-</a></div> | ||
{/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} | ||
|
||
<ul class="tabs{if $tabs_disabled} disabled{/if}{if $read_open_tab_by_cookie} tabs-by-cookie{/if}"> | ||
{* Content (pre)view *} | ||
<li id="node-tab-view" class="first{if $node_tab_index|eq('view')} selected{/if}"> | ||
{if $tabs_disabled} | ||
<span class="disabled" title="{'Tab is disabled, enable with toggler to the left of these tabs.'|i18n( 'design/admin/node/view/full' )}">{'View'|i18n( 'design/admin/node/view/full' )}</span> | ||
{else} | ||
<a href={concat( $node_url_alias, '/(tab)/view' )|ezurl} title="{'Show simplified view of content.'|i18n( 'design/admin/node/view/full' )}">{'View'|i18n( 'design/admin/node/view/full' )}</a> | ||
{/if} | ||
</li> | ||
{* Details *} | ||
<li id="node-tab-details" class="middle{if $node_tab_index|eq('details')} selected{/if}"> | ||
{if $tabs_disabled} | ||
<span class="disabled" title="{'Tab is disabled, enable with toggler to the left of these tabs.'|i18n( 'design/admin/node/view/full' )}">{'Details'|i18n( 'design/admin/node/view/full' )}</span> | ||
{else} | ||
<a href={concat( $node_url_alias, '/(tab)/details' )|ezurl} title="{'Show details.'|i18n( 'design/admin/node/view/full' )}">{'Details'|i18n( 'design/admin/node/view/full' )}</a> | ||
{/if} | ||
</li> | ||
|
||
{* Translations *} | ||
{if fetch( 'content', 'translation_list' )|count|gt( 1 )} | ||
{if $available_languages|count|gt( 1 ) } | ||
<li id="node-tab-translations" class="middle{if $node_tab_index|eq('translations')} selected{/if}"> | ||
{if $tabs_disabled} | ||
<span class="disabled" title="{'Tab is disabled, enable with toggler to the left of these tabs.'|i18n( 'design/admin/node/view/full' )}">{'Translations (%count)'|i18n( 'design/admin/node/view/full',,hash('%count', $translations_count ) )}</span> | ||
{else} | ||
<a href={concat( $node_url_alias, '/(tab)/translations' )|ezurl} title="{'Show available translations.'|i18n( 'design/admin/node/view/full' )}">{'Translations (%count)'|i18n( 'design/admin/node/view/full',,hash('%count', $translations_count ) )}</a> | ||
{/if} | ||
</li> | ||
{/if} | ||
{/if} | ||
|
||
{* Locations *} | ||
<li id="node-tab-locations" class="middle{if $node_tab_index|eq('locations')} selected{/if}"> | ||
{if $tabs_disabled} | ||
<span class="disabled" title="{'Tab is disabled, enable with toggler to the left of these tabs.'|i18n( 'design/admin/node/view/full' )}">{'Locations (%count)'|i18n( 'design/admin/node/view/full',, hash( '%count', $node.object.assigned_nodes|count ) )}</span> | ||
{else} | ||
<a href={concat( $node_url_alias, '/(tab)/locations' )|ezurl} title="{'Show location overview.'|i18n( 'design/admin/node/view/full' )}">{'Locations (%count)'|i18n( 'design/admin/node/view/full',, hash( '%count', $node.object.assigned_nodes|count ) )}</a> | ||
{/if} | ||
</li> | ||
|
||
{* Relations *} | ||
<li id="node-tab-relations" class="middle{if $node_tab_index|eq('relations')} selected{/if}"> | ||
{if $tabs_disabled} | ||
<span class="disabled" title="{'Tab is disabled, enable with toggler to the left of these tabs.'|i18n( 'design/admin/node/view/full' )}">{'Relations (%count)'|i18n( 'design/admin/node/view/full',, hash( '%count', sum( $related_objects_count, $reverse_related_objects_count ) ) )}</span> | ||
{else} | ||
<a href={concat( $node_url_alias, '/(tab)/relations' )|ezurl} title="{'Show object relation overview.'|i18n( 'design/admin/node/view/full' )}">{'Relations (%count)'|i18n( 'design/admin/node/view/full',, hash( '%count', sum( $related_objects_count, $reverse_related_objects_count ) ) )}</a> | ||
{/if} | ||
</li> | ||
|
||
{* Ordering *} | ||
<li id="node-tab-ordering" class="{if $additional_tabs}middle{else}last{/if}{if $node_tab_index|eq('ordering')} selected{/if}"> | ||
{if $tabs_disabled} | ||
<span class="disabled" title="{'Tab is disabled, enable with toggler to the left of these tabs.'|i18n( 'design/admin/node/view/full' )}">{'Ordering'|i18n( 'design/admin/node/view/full' )}</span> | ||
{else} | ||
<a href={concat( $node_url_alias, '/(tab)/ordering' )|ezurl} title="{'Show published ordering overview.'|i18n( 'design/admin/node/view/full' )}">{'Ordering'|i18n( 'design/admin/node/view/full' )}</a> | ||
{/if} | ||
</li> | ||
|
||
{include uri='design:window_controls_extratabs.tpl'} | ||
</ul> | ||
<div class="float-break"></div> | ||
|
||
{if $tabs_disabled} | ||
<div class="tabs-content disabled"></div> | ||
{else} | ||
<div class="tabs-content"> | ||
{include uri='design:windows.tpl'} | ||
</div> | ||
{/if} | ||
|
||
{ezscript_require( 'node_tabs.js' )} | ||
{undef} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<software> | ||
<metadata> | ||
<name>KS Admin Tab</name> | ||
<version>0.1-alpha</version> | ||
<copyright>Copyright (C) 2015 Kamil Szymański</copyright> | ||
<license>GNU General Public License v2.0</license> | ||
<info_url>http://github.com/eeree</info_url> | ||
</metadata> | ||
</software> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
// | ||
// ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ## | ||
// SOFTWARE NAME: KS Admin Tabs | ||
// SOFTWARE RELEASE: 0.1-alpha | ||
// COPYRIGHT NOTICE: Copyright (C) 2015 Kamil Szymański | ||
// SOFTWARE LICENSE: GNU General Public License v2 | ||
// NOTICE: > | ||
// 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' => '<a href="http://github.com/eeree">KS Admin Tab</a> extension', | ||
'Version' => '0.1-alpha', | ||
'Copyright' => 'Copyright (C) 2015 Kamil Szymański', | ||
'License' => 'GNU General Public License v2.0' ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php /* #?ini charset="utf-8"? | ||
|
||
[WindowControlsSettings] | ||
AdditionalTabs[]=customtab | ||
|
||
[AdditionalTab_customtab] | ||
Title=Example Tab | ||
Description=Some example tab description | ||
NavigationPartName=ezcontentnavigationpart | ||
ContentClassID=21 | ||
ContentNodeID=60 | ||
ParentNodeID=2 | ||
ContentObjectID=58 | ||
ContentClassIdentifier=landing_page | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php /* #?ini charset="utf-8"? | ||
|
||
[ExtensionSettings] | ||
DesignExtensions[]=ksadmintabs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php /* #?ini charset="utf-8"? | ||
|
||
[TemplateSettings] | ||
ExtensionAutoloadPath[]=ksadmintabs |