Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Szymański committed Feb 10, 2015
1 parent 2c73e9c commit 0220381
Show file tree
Hide file tree
Showing 9 changed files with 272 additions and 24 deletions.
48 changes: 24 additions & 24 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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., <http://fsf.org/>
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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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}
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>

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
Expand All @@ -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.
Expand All @@ -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
<signature of Ty Coon>, 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.

10 changes: 10 additions & 0 deletions README
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.
171 changes: 171 additions & 0 deletions design/admin2/templates/window_controls.tpl
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 &quot;Tabs&quot; 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 &quot;Tabs&quot; 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 added doc/.gitkeep
Empty file.
10 changes: 10 additions & 0 deletions extension.xml
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>
34 changes: 34 additions & 0 deletions ezinfo.php
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' );
}
}
15 changes: 15 additions & 0 deletions settings/admininterface.ini.append.php
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

4 changes: 4 additions & 0 deletions settings/design.ini.append.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php /* #?ini charset="utf-8"?

[ExtensionSettings]
DesignExtensions[]=ksadmintabs
4 changes: 4 additions & 0 deletions settings/site.ini.append.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php /* #?ini charset="utf-8"?

[TemplateSettings]
ExtensionAutoloadPath[]=ksadmintabs

0 comments on commit 0220381

Please sign in to comment.