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

More cleanup

This commit is contained in:
CaMer0n
2012-06-01 08:09:14 +00:00
parent e886feef49
commit ef3a390732
13 changed files with 47 additions and 346 deletions

View File

@@ -63,12 +63,6 @@ $creditsArray = array(
"version" => "0.1",
"licence" => "GPL, ".CRELAN_8
),
array( "name" => "DHTML / JavaScript Calendar",
"url" => "http://www.dynarch.com/projects/",
"description" => CRELAN_17,
"version" => "1.0",
"licence" => "GPL"
),
array( "name" => "FPDF",
"url" => "http://www.fpdf.org/",
"description" => CRELAN_18,

View File

@@ -728,8 +728,7 @@ class admin_newspost
require_once(e_HANDLER."cache_handler.php");
require_once(e_HANDLER."news_class.php");
// require_once(e_HANDLER."calendar/calendar_class.php");
// $this->_cal = new DHTML_Calendar(true);
$this->_pst = $pstobj;
@@ -1077,7 +1076,7 @@ class admin_newspost
$_POST['news_start'] = vartrue(e107::getDate()->convert($_POST['news_start'],'inputdatetime'), 0);
echo "date=".$_POST['news_start'];
// echo "date=".$_POST['news_start'];
if($_POST['news_start'])
{
// $_POST['news_start'] = e107::getDate()->convert($_POST['news_start']);

View File

@@ -34,16 +34,13 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
$e_sub_cat = 'user_extended';
$curtype = '1';
require_once(e_HANDLER.'calendar/calendar_class.php');
require_once(e_HANDLER.'message_handler.php');
$cal = new DHTML_Calendar(true);
require_once("auth.php");
require_once(e_HANDLER.'user_extended_class.php');
require_once(e_HANDLER.'userclass_class.php');
require_once(e_HANDLER.'form_handler.php');
$frm = new e_form;
$frm = e107::getForm();
$ue = new e107_user_extended;
@@ -1264,9 +1261,6 @@ function headerjs()
</script>";
global $cal;
$text .= $cal->load_files();
echo $text;
}
?>

View File

@@ -15,7 +15,8 @@ $(document).ready(function()
$("input.e-date").each(function() {
$(this).datepicker({
dateFormat: $(this).attr("data-date-format"),
ampm: $(this).attr("data-date-ampm")
ampm: $(this).attr("data-date-ampm"),
showButtonPanel: true
});
});
@@ -23,7 +24,8 @@ $(document).ready(function()
$(this).datetimepicker({
dateFormat: $(this).attr("data-date-format"),
timeFormat: $(this).attr("data-time-format"),
ampm: $(this).attr("data-date-ampm")
ampm: $(this).attr("data-date-ampm"),
showButtonPanel: true
});
});

View File

@@ -1,159 +0,0 @@
window.defaultStatus = "";
//get reference object for popup
function getRefToDivMod( divID, oDoc ) {
if( !oDoc ) { oDoc = document; }
if( document.layers ) {
if( oDoc.layers[divID] ) { return oDoc.layers[divID]; } else {
for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {
y = getRefToDivMod(divID,oDoc.layers[x].document);
}
return y;
}
}
if( document.getElementById ) { return oDoc.getElementById(divID); }
if( document.all ) { return oDoc.all[divID]; }
return document[divID];
}
//resize method for popup window (resize to fit contents)
function resizeWinTo() {
if( !document.images.length ) { document.images[0] = document.layers[0].images[0]; }
if( !document.images[0].height || window.doneAlready ) { return false; } //in case images are disabled
var oH = getRefToDivMod( 'myID' ); if( !oH ) { return false; }
var oW = oH.clip ? oH.clip.width : oH.offsetWidth;
var oH = oH.clip ? oH.clip.height : oH.offsetHeight; if( !oH ) { return false; }
if( !oH || window.doneAlready ) { return false; } //in case images are disabled
window.doneAlready = true; //for Safari and Opera
/*//no idea why this is in here
if(document.getElementsByTagName) {
for( var l = document.getElementsByTagName(\'a\'), x = 0; l[x]; x++ ) {
if(l[x].className==\'makeright\'&&!l[x].style.position){
l[x].style.position=\'relative\';
l[x].style.left=(document.images[0].width-(l[x].offsetWidth+l[x].offsetLeft))+\'px\';
}}}
*/
var x = window; x.resizeTo( oW + 200, oH + 200 );
var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;
if( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }
else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }
else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }
if( window.opera && !document.childNodes ) { myW += 16; }
x.resizeTo( oW = oW + ( ( oW + 200 ) - myW ), oH = oH + ( (oH + 200 ) - myH ) );
//three lines to center the popup on the screen
//'var scW = screen.availWidth ? screen.availWidth : screen.width;
//'var scH = screen.availHeight ? screen.availHeight : screen.height;
//'if( !window.opera ) { x.moveTo(Math.round((scW-oW)/2),Math.round((scH-oH)/2)); }
return false;
}
//open popup with image and text
function openPerfectPopup(oSrc, oWidth, oTitle, oText){
//the first two should be small for Opera's sake
PositionX = 20;
PositionY = 20;
defaultWidth = 600;
defaultHeight = 400;
var AutoClose = '';
var oW1 = oWidth+30;
var oContent
var buttonclose = "<input class='button' type='button' value='close' onClick='window.close();' />";
oContent = "<table border='0' cellspacing='10' cellpadding='0' style='text-align:center; width:"+oWidth+"px; height:100px;'>\n";
oContent += "<tr><td style='white-space:nowrap; width:"+oWidth+"px;'>";
oContent += "<img src='"+oSrc+"' alt='' style='width:"+oWidth+"px;' />";
oContent += "</td></tr>\n";
oContent += "<tr><td class='poptext' style='width:"+oWidth+"px; text-align:left;'>"+oText+"</td></tr>\n";
oContent += "<tr><td colspan='2' style='white-space:nowrap; width:"+oWidth+"px; text-align:right;'>"+buttonclose+"</td></tr>\n";
oContent += "</table>\n";
var imgWin = window.open('','name','scrollbars=no,resizable=1,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY);
if( !imgWin ) { return true; } //popup blockers should not cause errors
imgWin.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html>\n'+
'<head>\n'+
'<title>'+oTitle+'<\/title>\n'+
'<script type="text/javaScript">\n'+
'//get reference object for popup\n'+
'function getRefToDivMod( divID, oDoc ) {\n'+
' if( !oDoc ) { oDoc = document; }\n'+
' if( document.layers ) {\n'+
' if( oDoc.layers[divID] ) { return oDoc.layers[divID]; } else {\n'+
' for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {\n'+
' y = getRefToDivMod(divID,oDoc.layers[x].document);\n'+
' }\n'+
' return y;\n'+
' }\n'+
' }\n'+
' if( document.getElementById ) { return oDoc.getElementById(divID); }\n'+
' if( document.all ) { return oDoc.all[divID]; }\n'+
' return document[divID];\n'+
'}\n'+
'\n'+
'//resize method for popup window (resize to fit contents)\n'+
'function resizeWinTo() {\n'+
' if( !document.images.length ) { document.images[0] = document.layers[0].images[0]; }\n'+
' if( !document.images[0].height || window.doneAlready ) { return; } //in case images are disabled\n'+
' var oH = getRefToDivMod( "myID" ); if( !oH ) { return false; }\n'+
' var oW = oH.clip ? oH.clip.width : oH.offsetWidth;\n'+
' var oH = oH.clip ? oH.clip.height : oH.offsetHeight; if( !oH ) { return false; }\n'+
' if( !oH || window.doneAlready ) { return; } //in case images are disabled\n'+
' window.doneAlready = true; //for Safari and Opera\n'+
' var x = window; x.resizeTo( oW + 200, oH + 200 );\n'+
' var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;\n'+
' if( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }\n'+
' else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }\n'+
' else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }\n'+
' if( window.opera && !document.childNodes ) { myW += 16; }\n'+
' x.resizeTo( oW = oW + ( ( oW + 200 ) - myW ), oH = oH + ( (oH + 200 ) - myH ) );\n'+
'}\n'+
'<\/script>\n'+
'<style type="text/css">\n'+
'html,body{\n'+
' text-align:center;\n'+
' font-family: arial, verdana, helvetica, tahoma, sans-serif;\n'+
' font-size: 11px;\n'+
' color: #444;\n'+
' margin-left: auto;\n'+
' margin-right: auto; \n'+
' margin-top:0px;\n'+
' margin-bottom:0px;\n'+
' padding: 0px;\n'+
' background-color:#FFF;\n'+
' height:100%;\n'+
' cursor:default;\n'+
'}\n'+
'.poptext{\n'+
' font-size: 11px;\n'+
' text-align:left;\n'+
' color:#444;\n'+
' line-height:140%;\n'+
' vertical-align:top;\n'+
' text-align:left;\n'+
'}\n'+
'.button{\n'+
' border:1px solid #444;\n'+
' color: #444;\n'+
' background-color:#FFF;\n'+
' font-size: 11px;\n'+
' padding:2px;\n'+
' cursor:pointer;\n'+
' width:50px;\n'+
'}\n'+
'<\/style>\n'+
'<\/head>\n'+
'<body onload="resizeWinTo();">\n'+
(document.layers?('<layer left="0" top="0" id="myID">\n'):('<div style="width:'+oW1+'px; position:absolute;left:0px;top:0px;" id="myID" >\n'))+
oContent+
(document.layers?'<\/layer>\n':'<\/div>\n')+
'<\/body>\n'+
'<\/html>\n');
imgWin.document.close();
if( imgWin.focus ) { imgWin.focus(); }
return false;
}

View File

@@ -134,7 +134,6 @@ class e107
*/
protected static $_known_handlers = array(
'ArrayData' => '{e_HANDLER}arraystorage_class.php',
'DHTML_Calendar' => '{e_HANDLER}calendar/calendar_class.php',
'UserHandler' => '{e_HANDLER}user_handler.php',
'comment' => '{e_HANDLER}comment_class.php',
'convert' => '{e_HANDLER}date_handler.php',

View File

@@ -339,7 +339,7 @@ class e_form
$dateFormat = ($options['dateformat']) ? trim($options['dateformat']) :e107::getPref('inputdate', '%Y-%m-%d');
$timeFormat = ($options['timeformat']) ? trim($options['timeformat']) :e107::getPref('inputtime', '%H:%M:%S');
$type = ($options['type']) ? trim($options['type']) : "date";
$type = ($options['type']) ? trim($options['type']) : "date"; // 'datetime'
// echo "TYPE=".$type;
@@ -398,7 +398,7 @@ class e_form
$text = "";
$class = (isset($classes[$type])) ? $classes[$type] : "e-date";
$class = (isset($classes[$type])) ? $classes[$type] : "tbox e-date";
if(vartrue($options['inline']))
{
@@ -462,31 +462,6 @@ class e_form
*/
// DHTML Calendar is deprecated in 2.0.
/*
$cal = new DHTML_Calendar(true);
$cal_options['showsTime'] = varset($options['time'], true);
$cal_options['showOthers'] = varset($options['others'], false);
$cal_options['weekNumbers'] = varset($options['weeks'], false);
$cal_options['ifFormat'] = e107::getPref('inputdate', '%d/%m/%Y %H:%M:%S');
$cal_options['timeFormat'] = "24";
$cal_attrib['class'] = "tbox date";
$cal_attrib['size'] = varset($options['size'], 25);
$cal_attrib['name'] = $name;
if ($datestamp)
{
$cal_attrib['value'] = is_numeric($datestamp) ? e107::getDateConvert()->convert_date($datestamp, 'input') : $datestamp; //date("d/m/Y H:i:s", $datestamp);
}
return $cal->make_input_field($cal_options, $cal_attrib);
*/
}
/**

View File

@@ -1353,7 +1353,16 @@ class mailoutAdminClass extends e107MailManager
'name' => $calName,
'value' => (($calVal == '') ? '' : date($dispString,$calVal))
);
return $this->_cal->make_input_field($calOptions, $calAttrib);
list($dformat,$tformat) = explode(" ",$dateString);
$options['type'] = 'datetime';
$options['dateFormat'] = $dformat;
$options['timeFormat'] = $tformat;
return e107::getForm()->datepicker($calName,$calVal,$options);
// return $this->_cal->make_input_field($calOptions, $calAttrib);
}

View File

@@ -1,88 +0,0 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/popup_handler.php,v $
* $Revision$
* $Date$
* $Author$
*/
if (!defined('e107_INIT')) { exit; }
class popup{
// usage:
// you need to add the following call to popup.js in a headerjs function
//
// function headerjs(){
// echo "<script type='text/javascript' src='".e_FILE."popup.js'></script>\n";
// }
// on the page where you want to popup image to appear,
// you need to include this class and create a new object for it:
// require_once(e_HANDLER."popup_handler.php");
// $pp = new popup;
// then you need to prepare the right paramater in the function call.
// the function returns the image with the popup link as a href on it
// clicking the popup will use the js functions in the included js file to popup the image
// $pp -> popup($oSrc, $oSrcThumb, $oIconWidth, $oMaxWidth, $oTitle, $oText)
function popup($image, $thumb, $iconwidth='100', $maxwidth='', $title, $text){
global $tp;
//$image : full path to the large image you want to popup
//$thumb : full path to the small image to show on screen
//$maxwidth : the maximum size (width or height) an image may be popup'ed
//$title : the window title of the popup
//$text : the additional text to add into the popup
if(file_exists($image)){
//use $image if $thumb doesn't exist
if(!file_exists($thumb)){
$thumb = $image;
}
$imagearray = getimagesize(trim($image));
//$imagearray holds width and height parameters of the image
//$imagearray[0] is width - $imagearray[1] is height
if($imagearray[1] > $imagearray[0]){
if(isset($maxwidth) && $maxwidth!='' && $imagearray[1] > $maxwidth){
$width = round(($maxwidth*$imagearray[0])/$imagearray[1],0);
$height = $maxwidth;
}else{
$width = $imagearray[0];
$height = $imagearray[1];
}
}else{
if(isset($maxwidth) && $maxwidth!='' && $imagearray[0] > $maxwidth){
$width = $maxwidth;
$height = round(($maxwidth*$imagearray[1])/$imagearray[0],0);
}else{
$width = $imagearray[0];
$height = $imagearray[1];
}
}
$iconwidth = ($title == "help" ? "" : ($iconwidth ? "width:".intval($iconwidth)."px;" : "width:100px;") );
$width = intval($width);
$search = array("'", '$', '"', '&#036;','&#039;', '&#092;');
$replace = array("\'", '\$', '&quot;', '\$', "\'", '\\');
$title = str_replace($search, $replace, $title);
$text = str_replace($search, $replace, $text);
$popup = "<a href='javascript:void(0);' onclick=\"javascript:openPerfectPopup('".$image."',".$width.",'".$title."','".$text."')\" style='cursor:pointer;' onmouseover=\"window.status='".POPUP_LAN_1."'; return true;\" onmouseout=\"window.status=''; return true;\" ><img src='".$thumb."' style='".$iconwidth."' alt='' /></a><br /><br />";
}else{
$popup = "";
}
return $popup;
}
}
?>

View File

@@ -694,16 +694,7 @@ class e107_user_extended
break;
case EUF_DATE : //date
return $cal->make_input_field(
array(
'ifFormat' => '%Y-%m-%d'
),
array(
'class' => 'tbox',
'name' => $fname,
'value' => $curval
)
);
return e107::getForm()->datepicker($fname,$curval,'dateformat=yy-mm-dd');
break;
case EUF_LANGUAGE : // language

View File

@@ -33,13 +33,13 @@ require_once(e_HANDLER.'xml_class.php');
require_once(e_HANDLER."form_handler.php");
require_once(e_HANDLER."ren_help.php");
require_once(e_HANDLER."calendar/calendar_class.php");
$cal = new DHTML_Calendar(true);
$gen = new convert();
//$cal = new DHTML_Calendar(true);
//$gen = new convert();
function headerjs()
{
global $cal;
return $cal->load_files()."<script type='text/javascript' src='".e_FILE_ABS."jslib/core/admin.js'></script>\n";
// global $cal;
// return $cal->load_files()."<script type='text/javascript' src='".e_FILE_ABS."jslib/core/admin.js'></script>\n";
}
$e_sub_cat = 'download';

View File

@@ -861,18 +861,13 @@ $columnInfo = array(
if (!$download_datestamp){
$download_datestamp = time();
}
$cal_options['showsTime'] = false;
$cal_options['showOthers'] = false;
$cal_options['weekNumbers'] = false;
$cal_options['ifFormat'] = "%d/%m/%Y %H:%M:%S";
$cal_options['timeFormat'] = "24";
$cal_attrib['class'] = "tbox";
$cal_attrib['size'] = "22";
$cal_attrib['name'] = "download_datestamp";
$cal_attrib['value'] = date("d/m/Y H:i:s", $download_datestamp);
$text .= $cal->make_input_field($cal_options, $cal_attrib);
$update_checked = ($_POST['update_datestamp']) ? "checked='checked'" : "";
$text .= " &nbsp;&nbsp;<span><input type='checkbox' value='1' name='update_datestamp' $update_checked/>".DOWLAN_148."</span>
$text .= $frm->datepicker('download_datestamp',$download_datestamp);
// $update_checked = ($_POST['update_datestamp']) ? "checked='checked'" : "";
// $text .= " &nbsp;&nbsp;<span><input type='checkbox' value='1' name='update_datestamp' $update_checked/>".DOWLAN_148."</span>";
$text .= "
</td>
</tr>
<tr>
@@ -1098,15 +1093,8 @@ $columnInfo = array(
$dlInfo['download_comment'] = $tp->toDB($_POST['download_comment']);
$dlInfo['download_class'] = intval($_POST['download_class']);
$dlInfo['download_visible'] = intval($_POST['download_visible']);
$dlInfo['download_datestamp'] = e107::getDate()->convert($_POST['download_datestamp'],'inputdate');
if(preg_match("#(.*?)/(.*?)/(.*?) (.*?):(.*?):(.*?)$#", $_POST['download_datestamp'], $matches))
{
$dlInfo['download_datestamp'] = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]);
}
else
{
$dlInfo['download_datestamp'] = time();
}
if($_POST['update_datestamp'])
{

View File

@@ -59,9 +59,6 @@ require_once (e_HANDLER.'ren_help.php');
include_once (e107::coreTemplatePath('usersettings')); //correct way to load a core template.
include_once (e_CORE.'shortcodes/batch/usersettings_shortcodes.php');
require_once (e_HANDLER.'calendar/calendar_class.php');
$cal = new DHTML_Calendar(true);
// include JS, headerjs not called in header anymore
$js = e107::getJs();
$js->footerInline(headerjs());
@@ -748,7 +745,7 @@ function delete_file($fname, $dir = 'avatars/')
function headerjs()
{
//global $cal;
$script = "
<script type='text/javascript'>
function addtext_us(sc)
@@ -758,7 +755,7 @@ function headerjs()
</script>
";
//$script .= $cal->load_files();
return $script;
}