-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://piwigo.org/svn/extensions/skeleton/trunk@21304 68402e56-0260-453c-a942-63ccdbb3a9ee
- Loading branch information
0 parents
commit 46edc28
Showing
37 changed files
with
1,100 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
/** | ||
* This is the main administration page, if you have only one admin page you can put | ||
* directly its code here or using the tabsheet system like bellow | ||
*/ | ||
|
||
defined('SKELETON_PATH') or die('Hacking attempt!'); | ||
|
||
global $template, $page, $conf; | ||
|
||
|
||
// get current tab | ||
$page['tab'] = (isset($_GET['tab'])) ? $_GET['tab'] : $page['tab'] = 'home'; | ||
|
||
// plugin tabsheet is not present on photo page | ||
if ($page['tab'] != 'photo') | ||
{ | ||
// tabsheet | ||
include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); | ||
$tabsheet = new tabsheet(); | ||
$tabsheet->set_id('skeleton'); | ||
|
||
$tabsheet->add('home', l10n('Welcome'), SKELETON_ADMIN . '-home'); | ||
$tabsheet->add('config', l10n('Configuration'), SKELETON_ADMIN . '-config'); | ||
$tabsheet->select($page['tab']); | ||
$tabsheet->assign(); | ||
} | ||
|
||
// include page | ||
include(SKELETON_PATH . 'admin/' . $page['tab'] . '.php'); | ||
|
||
// template vars | ||
$template->assign(array( | ||
'SKELETON_PATH'=> get_root_url() . SKELETON_PATH, // used for images, scripts, ... access | ||
'SKELETON_ABS_PATH'=> realpath(SKELETON_PATH), // used for template inclusion (Smarty needs a real path) | ||
'SKELETON_ADMIN' => SKELETON_ADMIN, | ||
)); | ||
|
||
// send page content | ||
$template->assign_var_from_handle('ADMIN_CONTENT', 'skeleton_content'); | ||
|
||
?> |
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,28 @@ | ||
<?php | ||
defined('SKELETON_PATH') or die('Hacking attempt!'); | ||
|
||
// +-----------------------------------------------------------------------+ | ||
// | Configuration tab | | ||
// +-----------------------------------------------------------------------+ | ||
|
||
// save config | ||
if (isset($_POST['save_config'])) | ||
{ | ||
$conf['skeleton'] = array( | ||
'option1' => intval($_POST['option1']), | ||
'option2' => isset($_POST['option2']), | ||
); | ||
|
||
conf_update_param('skeleton', serialize($conf['skeleton'])); | ||
array_push($page['infos'], l10n('Information data registered in database')); | ||
} | ||
|
||
// send config to template | ||
$template->assign(array( | ||
'skeleton' => $conf['skeleton'], | ||
)); | ||
|
||
// define template file | ||
$template->set_filename('skeleton_content', realpath(SKELETON_PATH . 'admin/template/config.tpl')); | ||
|
||
?> |
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,17 @@ | ||
<?php | ||
defined('SKELETON_PATH') or die('Hacking attempt!'); | ||
|
||
// +-----------------------------------------------------------------------+ | ||
// | Home tab | | ||
// +-----------------------------------------------------------------------+ | ||
|
||
// send variables to template | ||
$template->assign(array( | ||
'skeleton' => $conf['skeleton'], | ||
'INTRO_CONTENT' => load_language('intro.html', SKELETON_PATH, array('return'=>true)), | ||
)); | ||
|
||
// define template file | ||
$template->set_filename('skeleton_content', realpath(SKELETON_PATH . 'admin/template/home.tpl')); | ||
|
||
?> |
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,30 @@ | ||
<?php | ||
// +-----------------------------------------------------------------------+ | ||
// | Piwigo - a PHP based photo gallery | | ||
// +-----------------------------------------------------------------------+ | ||
// | Copyright(C) 2008-2012 Piwigo Team http://piwigo.org | | ||
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | | ||
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | | ||
// +-----------------------------------------------------------------------+ | ||
// | 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 | | ||
// | 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 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. | | ||
// +-----------------------------------------------------------------------+ | ||
|
||
// Recursive call | ||
$url = '../'; | ||
header( 'Request-URI: '.$url ); | ||
header( 'Content-Location: '.$url ); | ||
header( 'Location: '.$url ); | ||
exit(); | ||
?> |
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,49 @@ | ||
<?php | ||
defined('SKELETON_PATH') or die('Hacking attempt!'); | ||
|
||
// +-----------------------------------------------------------------------+ | ||
// | Photo[Skeleton] tab | | ||
// +-----------------------------------------------------------------------+ | ||
|
||
|
||
/* Basic checks */ | ||
check_status(ACCESS_ADMINISTRATOR); | ||
|
||
check_input_parameter('image_id', $_GET, false, PATTERN_ID); | ||
|
||
$admin_photo_base_url = get_root_url().'admin.php?page=photo-'.$_GET['image_id']; | ||
$self_url = SKELETON_ADMIN.'-photo&image_id='.$_GET['image_id']; | ||
|
||
|
||
/* Tabs */ | ||
// when adding a tab to an existing tabsheet you MUST reproduce the core tabsheet code | ||
// this way it will not break compatibility with other plugins and with core functions | ||
include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); | ||
$tabsheet = new tabsheet(); | ||
$tabsheet->set_id('photo'); // <= don't forget tabsheet id | ||
$tabsheet->select('skeleton'); | ||
$tabsheet->assign(); | ||
|
||
|
||
/* Initialisation */ | ||
$query = ' | ||
SELECT * | ||
FROM '.IMAGES_TABLE.' | ||
WHERE id = '.$_GET['image_id'].' | ||
;'; | ||
$picture = pwg_db_fetch_assoc(pwg_query($query)); | ||
|
||
# DO SOME STUFF HERE... or not ! | ||
|
||
|
||
/* Template */ | ||
$template->assign(array( | ||
'F_ACTION' => $self_url, | ||
'skeleton' => $conf['skeleton'], | ||
'TITLE' => render_element_name($picture), | ||
'TN_SRC' => DerivativeImage::thumb_url($picture), | ||
)); | ||
|
||
$template->set_filename('skeleton_content', realpath(SKELETON_PATH . 'admin/template/photo.tpl')); | ||
|
||
?> |
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,38 @@ | ||
{combine_css path=$SKELETON_PATH|@cat:"admin/template/style.css"} | ||
|
||
{footer_script}{literal} | ||
jQuery('input[name="option2"]').change(function() { | ||
$('.option1').toggle(); | ||
}); | ||
{/literal}{/footer_script} | ||
|
||
<div class="titrePage"> | ||
<h2>Skeleton</h2> | ||
</div> | ||
|
||
<form method="post" action="" class="properties"> | ||
<fieldset> | ||
<legend>{'Common configuration'|@translate}</legend> | ||
|
||
<ul> | ||
<li> | ||
<label> | ||
<span class="property"> | ||
{'Checkbox'|@translate} | ||
<a class="showInfo" title="{'Check me!'|@translate}">i</a> | ||
</span> | ||
<input type="checkbox" name="option2" value="1" {if $skeleton.option2}checked="checked"{/if}> | ||
</label> | ||
</li> | ||
<li class="option1" {if not $skeleton.option2}style="display:none;"{/if}> | ||
<label> | ||
<span class="property">{'Integer'|@translate}</span> | ||
<input type="text" name="option1" value="{$skeleton.option1}" size="4"> | ||
</label> | ||
</li> | ||
</ul> | ||
</fieldset> | ||
|
||
<p style="text-align:left;"><input type="submit" name="save_config" value="{'Save Settings'|@translate}"></p> | ||
|
||
</form> |
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,14 @@ | ||
{combine_css path=$SKELETON_PATH|@cat:"admin/template/style.css"} | ||
|
||
<div class="titrePage"> | ||
<h2>Skeleton</h2> | ||
</div> | ||
|
||
<form method="post" action="" class="properties"> | ||
<fieldset> | ||
<legend>{'What Skeleton can do for me?'|@translate}</legend> | ||
|
||
{$INTRO_CONTENT} | ||
</fieldset> | ||
|
||
</form> |
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,7 @@ | ||
<?php | ||
$url = '../'; | ||
header( 'Request-URI: '.$url ); | ||
header( 'Content-Location: '.$url ); | ||
header( 'Location: '.$url ); | ||
exit(); | ||
?> |
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,18 @@ | ||
{combine_css path=$SKELETON_PATH|@cat:"admin/template/style.css"} | ||
|
||
<h2>{$TITLE} › {'Edit photo'|@translate} {$TABSHEET_TITLE}</h2> | ||
|
||
|
||
<form action="{$F_ACTION}" method="post" id="catModify"> | ||
<fieldset> | ||
<legend>{'My awesome photo tab'|@translate}</legend> | ||
|
||
<p> | ||
<img src="{$TN_SRC}" alt="{'Thumbnail'|@translate}" class="Thumbnail"> | ||
</p> | ||
|
||
<p> | ||
<input class="submit" type="submit" value="{'Save'|@translate}" name="save_skeleton"> | ||
</p> | ||
</fieldset> | ||
</form> |
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,17 @@ | ||
.showInfo { | ||
position:static; | ||
display:inline-block; | ||
padding:1px 6px; | ||
width:4px; | ||
height:14px; | ||
line-height:14px; | ||
font-size:0.8em; | ||
} | ||
|
||
.square-list { | ||
list-style:square !important; | ||
margin-left:35px !important; | ||
} | ||
.square-list li { | ||
margin-bottom:0 !important; | ||
} |
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,97 @@ | ||
<?php | ||
defined('SKELETON_PATH') or die('Hacking attempt!'); | ||
|
||
/** | ||
* admin plugins menu link | ||
*/ | ||
function skeleton_admin_plugin_menu_links($menu) | ||
{ | ||
array_push($menu, array( | ||
'NAME' => l10n('Skeleton'), | ||
'URL' => SKELETON_ADMIN, | ||
)); | ||
return $menu; | ||
} | ||
|
||
/** | ||
* add a tab on photo properties page | ||
*/ | ||
function skeleton_tabsheet_before_select($sheets, $id) | ||
{ | ||
if ($id == 'photo') | ||
{ | ||
$sheets['skeleton'] = array( | ||
'caption' => l10n('Skeleton'), | ||
'url' => SKELETON_ADMIN.'-photo&image_id='.$_GET['image_id'], | ||
); | ||
} | ||
|
||
return $sheets; | ||
} | ||
|
||
/** | ||
* add a prefilter to the Batch Downloader | ||
*/ | ||
function skeleton_add_batch_manager_prefilters($prefilters) | ||
{ | ||
array_push($prefilters, array( | ||
'ID' => 'skeleton', | ||
'NAME' => l10n('Skeleton'), | ||
)); | ||
return $prefilters; | ||
} | ||
|
||
/** | ||
* perform added prefilter | ||
*/ | ||
function skeleton_perform_batch_manager_prefilters($filter_sets, $prefilter) | ||
{ | ||
if ($prefilter == 'skeleton') | ||
{ | ||
$query = ' | ||
SELECT id | ||
FROM '.IMAGES_TABLE.' | ||
ORDER BY RAND() | ||
LIMIT 20 | ||
;'; | ||
$filter_sets[] = array_from_query($query, 'id'); | ||
} | ||
|
||
return $filter_sets; | ||
} | ||
|
||
/** | ||
* add an action to the Batch Manager | ||
*/ | ||
function skeleton_loc_end_element_set_global() | ||
{ | ||
global $template; | ||
|
||
$template->append('element_set_global_plugins_actions', array( | ||
'ID' => 'skeleton', | ||
'NAME' => l10n('Skeleton'), | ||
'CONTENT' => '<label><input type="checkbox" name="check_skeleton"> '.l10n('Check me!').'</label>', // this is optional | ||
)); | ||
} | ||
|
||
/** | ||
* perform added action | ||
*/ | ||
function skeleton_element_set_global_action($action, $collection) | ||
{ | ||
if ($action == 'skeleton') | ||
{ | ||
global $page; | ||
|
||
if (empty($_POST['check_skeleton'])) | ||
{ | ||
array_push($page['warnings'], l10n('Nothing appened, but you didn\'t check the box!')); | ||
} | ||
else | ||
{ | ||
array_push($page['infos'], l10n('Nothing appened, but you checked the box!')); | ||
} | ||
} | ||
} | ||
|
||
?> |
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,6 @@ | ||
<?php | ||
defined('SKELETON_PATH') or die('Hacking attempt!'); | ||
|
||
|
||
|
||
?> |
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,7 @@ | ||
<?php | ||
$url = '../'; | ||
header( 'Request-URI: '.$url ); | ||
header( 'Content-Location: '.$url ); | ||
header( 'Location: '.$url ); | ||
exit(); | ||
?> |
Oops, something went wrong.