1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-18 20:31:41 +02:00

Newspost administration - work in progres (news cats ready);

overall administration area improvements;
iconpicker shortcode, iconpicker e_form method;
new Ajax#toggleUpdate, Ajax#scUpdate methods;
old icons removal
This commit is contained in:
secretr
2009-01-16 17:57:57 +00:00
parent 21f4629908
commit 2e951dd633
39 changed files with 282 additions and 152 deletions

View File

@@ -0,0 +1,67 @@
<?php
/*
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id: iconpicker.php,v 1.1 2009-01-16 17:57:56 secretr Exp $
*
* Image picker shortcode
*
*/
function iconpicker_shortcode($parm)
{
require_once (e_HANDLER."file_class.php");
require_once(e_HANDLER.'admin_handler.php');
$e107 = &e107::getInstance();
$fl = new e_file();
$parms = array();
parse_str($parm, $parms);
if(!varset($parms['path']))
{
$parms['path'] = e_IMAGE."icons/";
$parms['path_omit'] = e_IMAGE."icons/";
}
$parms['path'] = explode('|', $parms['path']);
$iconlist = array();
foreach($parms['path'] as $iconpath)
{
$tmp = $fl->get_files($iconpath, '\.jpg|\.gif|\.png|\.JPG|\.GIF|\.PNG');
if($tmp)
{
$iconlist += $tmp;
}
unset($tmp);
}
$iconlist = multiarray_sort($iconlist, 'fname');
$tmp = array(16, 32, 48, 64, 128);
$tmp1 = array();
$name = varset($parms['id']);
foreach($iconlist as $icon)
{
$filepath = varsettrue($parms['path_omit']) ? str_replace(explode('|', $parms['path_omit']), "", $icon['path'].$icon['fname']) : $e107->tp->createConstants($icon['path'], 1).$icon['fname'];
$filepath_abs = str_replace(array(e_IMAGE, e_FILE, e_PLUGIN), array(e_IMAGE_ABS, e_FILE_ABS, e_PLUGIN_ABS), $icon['path'].$icon['fname']);
$str = "<a href='#{$filepath}' title='{$filepath}' onclick=\"e107Helper.insertText('{$filepath}','{$name}','{$name}-iconpicker'); return false; \"><img class='icon picker list%%size%%' src='{$filepath_abs}' alt='{$filepath}' /></a>";
foreach ($tmp as $isize)
{
if(strpos($icon['fname'], '_'.$isize.'.') !== false)
{
$tmp1[$isize] = varset($tmp1[$isize]).str_replace('%%size%%', ' S'.$isize, $str);
continue 2;
}
}
$tmp1['other'] = varset($tmp1['other']).$str;//other
}
return $tmp1 ? '<div id="'.$name.'-iconpicker-ajax"><div class="field-spacer iconpicker">'.str_replace('%%size%%', '', implode('</div><div class="field-spacer iconpicker">', $tmp1)).'</div></div>' : '';
}
?>

View File

@@ -1,5 +1,5 @@
// $Id: imageselector.sc,v 1.8 2008-12-17 17:27:07 secretr Exp $
// $Id: imageselector.sc,v 1.9 2009-01-16 17:57:56 secretr Exp $
//FIXME - full rewrite, backward compatible
global $sql,$parm,$tp;
@@ -36,13 +36,10 @@ if($scaction == 'select' || $scaction == 'all')
foreach($paths as $pths)
{
$imagelist += $fl->get_files($pths,'\.jpg|\.gif|\.png|\.JPG|\.GIF|\.PNG', 'standard', $recurse);
$imagelist[$tp->createConstants($pths, 1)]= $fl->get_files($pths,'\.jpg|\.gif|\.png|\.JPG|\.GIF|\.PNG', 'standard', $recurse);
}
if($imagelist)
{
sort($imagelist);
}
if(!$fullpath && (count($paths) > 1))
{
@@ -54,21 +51,35 @@ if($scaction == 'select' || $scaction == 'all')
$height = ($height) ? $height : "0";
$label = ($label) ? $label : " -- -- ";
$tabindex = varset($tabindex) ? " tabindex='{$tabindex}'" : '';
$class = varset($class) ? " class='{$class}'" : " class='tbox'";
$class = varset($class) ? " class='{$class}'" : " class='tbox imgselector'";
$text .= "<select{$multi}{$tabindex}{$class} name='{$name}' id='{$name}' onchange=\"replaceSC('imagepreview={$name}|{$width}|{$height}',this.form,'{$name}_prev'); \">
<option value=''>".$label."</option>\n";
foreach($imagelist as $icon)
require_once(e_HANDLER.'admin_handler.php');
foreach($imagelist as $imagedirlabel => $icons)
{
$dir = str_replace($paths,"",$icon['path']);
if(!$filter || ($filter && ereg($filter,$dir.$icon['fname'])))
$text .= "<optgroup label='".$tp->replaceConstants($imagedirlabel, TRUE)."'>";
if(empty($icons)) $text .= "<option value=''>Empty</option>\n";
else
{
$pth = ($fullpath) ? $tp->createConstants($icon['path'],1) : $dir;
$selected = ($default == $pth.$icon['fname']) ? " selected='selected'" : "";
$text .= "<option value='{$pth}{$icon['fname']}'{$selected}>{$dir}{$icon['fname']}</option>\n";
}
$icons = multiarray_sort($icons, 'fname');
foreach($icons as $icon)
{
$dir = str_replace($paths,"",$icon['path']);
if(!$filter || ($filter && ereg($filter,$dir.$icon['fname'])))
{
$pth = ($fullpath) ? $tp->createConstants($icon['path'],1) : $dir;
$selected = ($default == $pth.$icon['fname'] || $pth.$default == $pth.$icon['fname']) ? " selected='selected'" : "";
$text .= "<option value='{$pth}{$icon['fname']}'{$selected}>&nbsp;&nbsp;&nbsp;{$dir}{$icon['fname']}</option>\n";
}
}
}
$text .= '</optgroup>';
}
$text .= "</select>";