1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

Emoticons Administration ready, message handler multi-view in action

This commit is contained in:
secretr
2008-12-15 11:35:33 +00:00
parent 384cbbcf2c
commit 3a818d060b
3 changed files with 137 additions and 102 deletions

View File

@@ -9,8 +9,8 @@
* Administration Area - Emotions Settings & Packs
*
* $Source: /cvs_backup/e107_0.8/e107_admin/emoticon.php,v $
* $Revision: 1.10 $
* $Date: 2008-12-14 21:01:58 $
* $Revision: 1.11 $
* $Date: 2008-12-15 11:35:33 $
* $Author: secretr $
*
*/
@@ -81,7 +81,14 @@ foreach($_POST as $key => $value)
if(strstr($key, "defPack_"))
{
$pref['emotepack'] = str_replace("defPack_", "", $key);
save_prefs();
if(save_prefs())
{
$emessage->add(LAN_UPDATED, E_MESSAGE_SUCCESS);
}
else
{
$emessage->add(LAN_NO_CHANGE, E_MESSAGE_INFO);
}
$admin_log->log_event('EMOTE_01', $pref['emotepack'], E_LOG_INFORMATIVE, '');
break;
}
@@ -128,6 +135,7 @@ class emotec
global $e107, $emessage, $fl, $pref;
$text = "
".$emessage->render()."
<div class='admintabs' id='tab-container'>
<ul class='e-tabs' id='core-emote-tabs'>
<li id='tab-activate'><a href='#emoticon-activate'>".EMOLAN_1."</a></li>
@@ -159,15 +167,10 @@ class emotec
</div>
</fieldset>
</form>
";
//$e107->ns -> tablerender(EMOLAN_1, $text);
$text .= "
<form method='post' action='".e_SELF."?#etabTabContainer=emoticon-packages'>
<form method='post' action='".e_SELF."#etabTabContainer=emoticon-packages'>
<fieldset id='emoticon-packages'>
<legend class='e-hideme'>".EMOLAN_13."</legend>
<table cellpadding='0' cellspacing='0' class='adminlist'>
@@ -217,9 +220,9 @@ class emotec
$text .= "
</td>
<td class='center middle'>".($pref['emotepack'] == $pack ? EMOLAN_10 : "<button type='submit' name='defPack_".$pack."'><span>".EMOLAN_11."</span></button>")."</td>
<td class='center middle'>".($pref['emotepack'] == $pack ? EMOLAN_10 : "<button type='submit' name='defPack_".$pack."' value='".EMOLAN_11."'><span>".EMOLAN_11."</span></button>")."</td>
<td>
<button class='submit' type='submit' name='subPack_".$pack."'><span>".EMOLAN_12."</span></button>
<button class='edit' type='submit' name='subPack_".$pack."'><span>".EMOLAN_12."</span></button>
";
if ($can_scan && ($pack != 'default'))
{
@@ -230,7 +233,7 @@ class emotec
}
$text .= "
<br /><br />
<button class='submit' type='submit' name='XMLPack_".$pack."'><span>".EMOLAN_28."</span></button>
<button class='create' type='submit' name='XMLPack_".$pack."'><span>".EMOLAN_28."</span></button>
";
$text .= "
</td>
@@ -246,7 +249,7 @@ class emotec
</div>
";
$e107->ns->tablerender(EMOLAN_13, $emessage->render().$text);
$e107->ns->tablerender(EMOLAN_PAGE_TITLE, $text);
}
@@ -269,10 +272,10 @@ class emotec
//XXX Not sure if we need to know rhe number of files found - count($eArray) - <div class='info-bar'><strong>Total ".count($eArray)." files found</strong></div>
$text = "
<form method='post' action='".e_SELF."'>
<form method='post' action='".e_SELF."#etabTabContainer=emoticon-packages'>
<fieldset id='core-emoticon-configure'>
<legend class='e-hideme'>".EMOLAN_15."</legend>
<div class='info-bar'><strong>Total ".count($eArray)." files found</strong></div>
<div class='info-bar'><strong>".sprintf(EMOLAN_31, count($eArray))."</strong></div>
<table cellpadding='0' cellspacing='0' class='adminlist'>
<colgroup span='3'>
<col style='width:20px' />
@@ -298,11 +301,11 @@ class emotec
if (!isset($emotecode[$evalue]))
{
$file_back = '<span class="error">&nbsp;&nbsp;Emote not set</span>';
$file_back = '<span class="error">&nbsp;&nbsp;'.EMOLAN_37.'</span>';
}
elseif (!$emotecode[$evalue])
{
$text_back = '<span class="error">&nbsp;&nbsp;Empty value</span>';
$text_back = '<span class="error">&nbsp;&nbsp;'.EMOLAN_38.'</span>';
}
$text .= "
<tr>
@@ -320,19 +323,20 @@ class emotec
</table>
<div class='buttons-bar center'>
<input type='hidden' name='packID' value='{$packID}' />
<button class='submit' type='submit' name='sub_conf' value='".EMOLAN_14."'><span>".EMOLAN_14."</span></button>
<button class='update' type='submit' name='sub_conf' value='".EMOLAN_14."'><span>".EMOLAN_14."</span></button>
<button class='cancel' type='submit' name='cancel' value='".LAN_CANCEL."'><span>".LAN_CANCEL."</span></button>
</div>
</fieldset>
</form>";
$e107->ns->tablerender(EMOLAN_15.": '".$packID."'", $text);
$e107->ns->tablerender(EMOLAN_PAGE_TITLE.' - '.EMOLAN_15.": '".$packID."'", $text);
}
// Generate an XML file - packname.xml in root emoticon directory
function emoteXML($packID, $strip_xtn = TRUE)
{
global $fl, $sysprefs, $tp;
global $emessage, $fl, $sysprefs, $tp;
$fname = e_IMAGE."emotes/".$packID."/emoticons.xml";
$backname = e_IMAGE."emotes/".$packID."/emoticons.bak";
@@ -372,11 +376,11 @@ class emotec
//XXX message handler
if (file_put_contents($fname,$f_string) === FALSE)
{
echo "<br /><div style='text-align: center;'>".EMOLAN_30."<b>".$fname."</b></div><br />";
$emessage->add('<strong>'.EMOLAN_30.'</strong>'.str_replace(e_IMAGE, e_IMAGE_ABS, $fname), E_MESSAGE_WARNING);
}
else
{
echo "<br /><div style='text-align: center;'>".EMOLAN_29."<b>".$fname."</b></div><br />";
$emessage->add('<strong>'.EMOLAN_29.'</strong>'.str_replace(e_IMAGE, e_IMAGE_ABS, $fname), E_MESSAGE_SUCCESS);
}
}
@@ -406,7 +410,7 @@ class emotec
// Return false to disable listing of packs
function installCheck($do_one = FALSE)
{
global $sql, $fl;
global $e107, $emessage, $sql, $fl;
// Pick up a list of emote packs from the database
$pack_local = array();
@@ -422,21 +426,13 @@ class emotec
{
if(strpos($value,' ')!==FALSE)
{ // Highlight any directory names containing spaces - not allowed
global $ns;
$msg = "
<div class='center'><strong>".EMOLAN_17."<br />".EMOLAN_18."</strong>
<table class='fborder'>
<tr>
<td class='fcaption'>".EMOLAN_19."</td>
<td class='fcaption'>".EMOLAN_20."</td>
</tr>
<tr>
<td class='forumheader3'>".$value."</td>
<td class='forumheader3'>".e_IMAGE_ABS."emotes/</td>
</tr>
</table>
</div>";
$ns->tablerender(EMOLAN_21, $msg);
<strong>".EMOLAN_17."</strong> ".EMOLAN_18."
<div>".EMOLAN_19.": {$value}</div>
<div>".EMOLAN_20.": ".e_IMAGE_ABS."emotes/</div>
";
$emessage->add($msg, E_MESSAGE_ERROR);
$e107->ns->tablerender(EMOLAN_PAGE_TITLE.' - '.EMOLAN_21, $emessage->render());
return FALSE;
}
@@ -448,7 +444,7 @@ class emotec
if (($do_one == $value) || !$do_one && (!$sql -> db_Select("core", "*", "e107_name='emote_".$value."' ")))
{ // Pack info not in DB, or to be re-scanned
$no_error = TRUE;
$File_type = 'Unknown';
$File_type = EMOLAN_32;
// Array of all files in the directory of the selected emote pack
$fileArray = $fl -> get_files(e_IMAGE."emotes/".$value); // We actually want all the files in the directory
$confFile = '';
@@ -521,7 +517,7 @@ class emotec
}
elseif (strpos($contents, "<emoticon") !== FALSE)
{ // "Original" E107 format (as used on KDE, although they may be changing to XEP-0038)
echo "Decoding standard XML file<br />";
//echo "Decoding standard XML file<br />";
preg_match_all("#\<emoticon file=\"(.*?)\"\>(.*?)\<\/emoticon\>#si", $contents, $match);
$xml_type = 2;
@@ -592,7 +588,8 @@ class emotec
}
else
{
echo "Unsupported XML File Format<br /><br />";
//echo "Unsupported XML File Format<br /><br />";
$emessage->add(EMOLAN_33, E_MESSAGE_WARNING);
$no_error = FALSE;
}
@@ -604,8 +601,9 @@ class emotec
if($confFile['type'] == "php")
{
echo EMOLAN_25."'".$value."'<br />";
include_once(e_IMAGE."emotes/".$value."/".$confFile['file']);
//$emessage->add(EMOLAN_25." '{$value}'", E_MESSAGE_INFO);
$File_type = EMOLAN_24;
$tmp = $_emoteconf; // Use consistent name
}
@@ -620,22 +618,30 @@ class emotec
{ // Assume new pack
$sql->db_Insert("core", "'emote_".$value."', '{$tmp}' ");
}
echo "<div style='text-align: center;'><b>".$File_type." '</b> ".$value."'</div>";
//echo "<div style='text-align: center;'><b>".$File_type." '</b> ".$value."'</div>";
$emessage->add("<strong>{$File_type}</strong> '{$value}'", E_MESSAGE_INFO);
}
else
{ // Error occurred
echo "<div style='text-align: center;'><b>".EMOLAN_27." '</b> ".$value."'</div>";
//echo "<div style='text-align: center;'><b>".EMOLAN_27." '</b> ".$value."'</div>";
$emessage->add(EMOLAN_27." '{$value}'", E_MESSAGE_ERROR);
}
}
}
if (count($pack_local))
{
foreach ($pack_local as $p => $d)
{
echo "Missing files for pack: ".$p." - deleted in database<br />";
$emessage->add(EMOLAN_34.$p.EMOLAN_35, E_MESSAGE_INFO);
$sql->db_Delete("core","`e107_name` = 'emote_{$p}'");
}
}
//echo $emessage->render();
return TRUE;
}
@@ -653,7 +659,6 @@ function headerjs()
$ret = "
<script type='text/javascript'>
//add required core lan - delete confirm message
(".e_jshelper::toString(IMALAN_67).").addModLan('core', 'delete_confirm');
</script>
<script type='text/javascript' src='".e_FILE_ABS."jslib/core/admin.js'></script>
";

View File

@@ -1,7 +1,7 @@
<?php
/*
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id: lan_emoticon.php,v 1.5 2008-12-14 21:01:58 secretr Exp $
* $Id: lan_emoticon.php,v 1.6 2008-12-15 11:35:33 secretr Exp $
*
* Admin Language File
*
@@ -28,15 +28,15 @@ define("EMOLAN_14", "Save configuration");
define("EMOLAN_15", "Edit / configure emotes");
define("EMOLAN_16", "Emote configuration saved");
define("EMOLAN_17", "You have an emoticon pack present that contains spaces in the name, which are not allowed!");
define("EMOLAN_18", "please rename the instances listed below so they no longer contain spaces:");
define("EMOLAN_18", "Please rename the instances listed below so they no longer contain spaces:");
define("EMOLAN_19", "Name");
define("EMOLAN_20", "Location");
define("EMOLAN_21", "Error");
define("EMOLAN_21", "Read Pack Error");
//define("EMOLAN_2", "Name");
define("EMOLAN_22", "New emote pak found:");
define("EMOLAN_23", "New emote xml pak found:");
define("EMOLAN_24", "New emote php found:");
define("EMOLAN_25", "Installing new PHP emotes: ");
define("EMOLAN_22", "New emote pack found:");
define("EMOLAN_23", "New emote xml pack found:");
define("EMOLAN_24", "New emote php pack found:");
//define("EMOLAN_25", "Installing new PHP emotes: ");
define("EMOLAN_26", "Re-scan pack");
define("EMOLAN_27", "Error occurred processing pack: ");
define("EMOLAN_28", "Generate XML");
@@ -44,5 +44,13 @@ define("EMOLAN_29", "XML file generated: ");
define("EMOLAN_30", "Error writing XML file: ");
//0.8
define("EMOLAN_31", "Total %d files found");
define("EMOLAN_PAGE_TITLE", " Emoticons");
define("EMOLAN_31", "Total %u files found");
define("EMOLAN_32", "Unknown Pack detected : ");
define("EMOLAN_33", "Unsupported XML File Format!");
define("EMOLAN_34", "Missing files for pack: ");
define("EMOLAN_35", " - deleted in database");
define("EMOLAN_37", "Emote not set");
define("EMOLAN_38", "Empty emote value");
?>

View File

@@ -53,7 +53,7 @@ input, select{ vertical-align:middle; }
textarea { overflow:auto; }
/* Table */
table { border:0; border-spacing:0; empty-cells:show; font-size:100%; }
table { border:0; border-spacing:0; empty-cells:show; font-size:100%; width: 100%; }
th { vertical-align:top; text-align:left; font-weight:normal; }
td { vertical-align:top; }
@@ -110,6 +110,7 @@ select, .tbox, .helpbox {
background:#fff;
font:12px arial, helvetica, sans-serif;
}
option { padding-right: 10px;}
input.input-text, textarea, .tbox, .helpbox { padding:2px; }
select.tbox { min-height:17px; padding: 0px; /* to set the height for empty selects */ }
.select.order { width: 40px !important; }
@@ -134,7 +135,7 @@ input.radio { margin-right: 3px; }
.adminform td.label { }
.adminform td.control { }
.field-help { width: 280px; line-height: 1.4em; padding-top: 3px; color:#333333 }
.field-help { width: 280px; line-height: 1.4em; padding-top: 3px; color:#333333; font-size: 11px; }
.label-note { font-style: italic; }
/* form used for content edit */
@@ -177,12 +178,12 @@ input.radio { margin-right: 3px; }
/******** SyS Messages / Message text formatting */
/* message boxes */
#s-message {margin-bottom: 10px; }
#s-message { }
#s-message div.info,
#s-message div.error,
#s-message div.success,
#s-message div.warning { padding: 5px;}
#s-message div.warning { padding: 5px; margin-bottom: 10px; }
#s-message div.info { background-color:#C1E0FF; border: 1px solid #3399FF; }
@@ -249,11 +250,13 @@ button.delete:hover span,
button.delete:focus span { background-image:url(images/btn_remove_over_left.gif) }
button.delete:active span { background-image:url(images/btn_remove_active_left.gif)}
/* Do we need this? Just no additional class?
button.submit span {}
button.submit span {}
button.submit:hover span,
button.submit:focus span {}
button.submit:active span {}
*/
button.update span { padding-left: 30px; }
button.update span { background-image:url(images/btn_update_left.gif); }
@@ -273,6 +276,12 @@ button.edit:hover span,
button.edit:focus span {}
button.edit:active span {}
button.cancel span {}
button.cancel span {}
button.cancel:hover span,
button.cancel:focus span {}
button.cancel:active span {}
.buttons-bar { padding: 10px 0px; }
.buttons-bar button { margin-right: 10px; }
@@ -325,13 +334,18 @@ ul.plugin-navigation ul.sub-nav a.link-active {font-weight: bold;}
.page-info { border: 1px solid #DDDDDD; margin-bottom: 10px; }
.page-info p { padding: 10px; }
#core-prefs-main .col-label {}
#core-emoticon-configure input.input-text { width: 300px; }
#core-links-edit textarea { width: 390px !important; }
#core-links-edit .helpbox { width: 390px !important; margin: 5px 0px; }
#core-links-edit .field-help { width: 390px; }
#core-admin-log-config legend { font-weight: bold; }
#core-admin-log-options .checkbox,
#core-admin-log-filter .checkbox { margin-right: 5px; }
#core-admin-log-maintenance .select { width: 60px; }
#core-admin-log-maintenance button { margin-left: 10px; }
#core-frontpage-edit-home { width: 50%; float: left; }
#core-frontpage-edit-post-login { width: 50%; float: left; }
@@ -343,6 +357,14 @@ ul.plugin-navigation ul.sub-nav a.link-active {font-weight: bold;}
#core-frontpage-edit .buttons-bar { clear: both; }
/******** Core Block IDs */
/* admin_log.php */
#core-admin-log-config {}
#core-admin-log-options {}
#core-admin-log-maintenance {}
#core-admin-log-filter {}
#core-admin-log-list {}
#core-admin-log-confirm-delete {}
/* cache.php */
#core-cache-settings {} /* General cache settings - Default front page */