1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 06:07:32 +02:00

Fixes #1457 New Forum Posts Menu - "Show Original Topic in Menu" option not saving. New User-Extended Field preset for User comments. New e107::debug() function added for throwing info to the browser console. (Firefox/Chrome)

This commit is contained in:
Cameron
2016-03-26 10:14:57 -07:00
parent ec4b24f7fd
commit 46043bbb68
7 changed files with 130 additions and 4 deletions

View File

@@ -117,7 +117,14 @@ TEMPL;
// alert(target); // alert(target);
$.post(target, data ,function(ret) $.post(target, data ,function(ret)
{ {
// alert('Posted: '+ret); // alert('Posted: '+ret);
// console.log('Posted: '+ ret);
if(ret == '')
{
return false;
}
var a = $.parseJSON(ret); var a = $.parseJSON(ret);
if(a.error) if(a.error)

View File

@@ -77,6 +77,13 @@
<applicable>253</applicable> <applicable>253</applicable>
<read>253</read> <read>253</read>
<write>253</write> <write>253</write>
</item>
<item name="comment">
<type>textarea</type>
<include_text>class='form-control tbox' col='80' maxlength='254'</include_text>
<applicable>253</applicable>
<read>253</read>
<write>253</write>
</item> </item>
<item name="timezone"> <item name="timezone">
<type>list</type> <type>list</type>

View File

@@ -484,10 +484,14 @@ class e_array {
if (!is_array($ArrayData)) { if (!is_array($ArrayData)) {
return false; return false;
} }
$Array = var_export($ArrayData, true); $Array = var_export($ArrayData, true);
if ($AddSlashes == true) {
if ($AddSlashes == true)
{
$Array = addslashes($Array); $Array = addslashes($Array);
} }
return $Array; return $Array;
} }

View File

@@ -1863,6 +1863,99 @@ class e107
$jshandler->resetDependency(); $jshandler->resetDependency();
} }
/**
* Throw log/info/warnings/errors to the Chrome/Firefox Console.
* @param $name
* @param null $var
* @param string $type
*/
public static function debug($name, $var = null, $type = 'log', $js = false)
{
$nl = "\r\n";
// echo "alert('hi');";
if($js != true)
{
echo '<script type="text/javascript">'.$nl;
}
switch($type) {
case 'log':
echo 'console.log("'.$name.'");'.$nl;
break;
case 'info':
echo 'console.info("'.$name.'");'.$nl;
break;
case 'warning':
echo 'console.warn("'.$name.'");'.$nl;
break;
case 'error':
echo 'console.error("'.$name.'");'.$nl;
break;
}
if (!empty($var))
{
if (is_object($var) || is_array($var))
{
$object = json_encode($var);
echo 'var object'.preg_replace('~[^A-Z|0-9]~i',"_",$name).' = \''.str_replace("'","\'",$object).'\';'.$nl;
echo 'var val'.preg_replace('~[^A-Z|0-9]~i',"_",$name).' = eval("(" + object'.preg_replace('~[^A-Z|0-9]~i',"_",$name).' + ")" );'.$nl;
switch($type)
{
case 'log':
echo 'console.debug(val'.preg_replace('~[^A-Z|0-9]~i',"_",$name).');'.$nl;
break;
case 'info':
echo 'console.info(val'.preg_replace('~[^A-Z|0-9]~i',"_",$name).');'.$nl;
break;
case 'warning':
echo 'console.warn(val'.preg_replace('~[^A-Z|0-9]~i',"_",$name).');'.$nl;
break;
case 'error':
echo 'console.error(val'.preg_replace('~[^A-Z|0-9]~i',"_",$name).');'.$nl;
break;
}
}
else
{
switch($type)
{
case 'log':
echo 'console.debug("'.str_replace('"','\\"',$var).'");'.$nl;
break;
case 'info':
echo 'console.info("'.str_replace('"','\\"',$var).'");'.$nl;
break;
case 'warning':
echo 'console.warn("'.str_replace('"','\\"',$var).'");'.$nl;
break;
case 'error':
echo 'console.error("'.str_replace('"','\\"',$var).'");'.$nl;
break;
}
}
}
if($js != true)
{
echo '</script>'.$nl;
}
}
/** /**
* Retrieve JS Helper object * Retrieve JS Helper object
* *

View File

@@ -1624,7 +1624,7 @@ class e_form
*/ */
function radio($name, $value, $checked = false, $options = null) function radio($name, $value, $checked = false, $options = null)
{ {
if(!is_array($options)) parse_str($options, $options); if(!is_array($options)) parse_str($options, $options);
if(is_array($value)) if(is_array($value))
@@ -1665,6 +1665,8 @@ class e_form
{ {
$text .= "<span>".$labelFound."</span></label>"; $text .= "<span>".$labelFound."</span></label>";
} }
return $text; return $text;
} }
@@ -1683,6 +1685,12 @@ class e_form
$options_on = varset($options['enabled'],array()); $options_on = varset($options['enabled'],array());
$options_off = varset($options['disabled'],array()); $options_off = varset($options['disabled'],array());
unset($options['enabled'],$options['disabled']);
$options_on = array_merge($options_on, $options);
$options_off = array_merge($options_off, $options);
if(vartrue($options['class']) == 'e-expandit' || vartrue($options['expandit'])) // See admin->prefs 'Single Login' for an example. if(vartrue($options['class']) == 'e-expandit' || vartrue($options['expandit'])) // See admin->prefs 'Single Login' for an example.
{ {
@@ -1708,6 +1716,8 @@ class e_form
$text = $this->radio($name, 1, $checked_enabled, $options_on)." ".$this->radio($name, 0, !$checked_enabled, $options_off); $text = $this->radio($name, 1, $checked_enabled, $options_on)." ".$this->radio($name, 0, !$checked_enabled, $options_off);
} }
return $text; return $text;
} }
@@ -2639,6 +2649,7 @@ class e_form
case 'radio': case 'radio':
//$def_options['class'] = ' '; //$def_options['class'] = ' ';
$def_options = array('class' => '');
unset($def_options['size'], $def_options['selected']); unset($def_options['size'], $def_options['selected']);
break; break;

View File

@@ -56,6 +56,8 @@ define("UE_LAN_GENDER","Gender");
define("UE_LAN_GENDER_DESC","Gender"); define("UE_LAN_GENDER_DESC","Gender");
define("UE_LAN_MALE","Male"); define("UE_LAN_MALE","Male");
define("UE_LAN_FEMALE","Female"); define("UE_LAN_FEMALE","Female");
define("UE_LAN_COMMENT", "Comments");
define("UE_LAN_COMMENT_DESC", "Comment Box");

View File

@@ -38,7 +38,7 @@ class forum_newforumposts_menu // plugin folder + menu name (without the .php)
function getQuery() function getQuery()
{ {
$max_age = vartrue($this->menuPref['maxage'], 0); $max_age = vartrue($this->menuPref['maxage'], 0);
$max_age = ($max_age == 0) ? '' : '(t.post_datestamp > '.(time()-(int)$max_age*86400).') AND '; $max_age = ($max_age == 0) ? '' : '(p.post_datestamp > '.(time()-(int)$max_age*86400).') AND ';
$forumList = implode(',', $this->forumObj->getForumPermList('view')); $forumList = implode(',', $this->forumObj->getForumPermList('view'));
@@ -148,6 +148,8 @@ class forum_newforumposts_menu // plugin folder + menu name (without the .php)
$caption = LAN_PLUGIN_FORUM_LATESTPOSTS; $caption = LAN_PLUGIN_FORUM_LATESTPOSTS;
} }
// e107::debug('menuPref', $this->menuPref);
e107::getRender()->tablerender($caption, $text, 'nfp_menu'); e107::getRender()->tablerender($caption, $text, 'nfp_menu');
} }