|
From: <luc...@us...> - 2013-09-27 21:12:56
|
Revision: 12101
http://sourceforge.net/p/xoops/svn/12101
Author: luciorota
Date: 2013-09-27 21:12:53 +0000 (Fri, 27 Sep 2013)
Log Message:
-----------
Modified Paths:
--------------
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopseditor/sampleform.inc.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopseditor/tinymce/formtinymce.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopseditor/tinymce/tinymce.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopseditor/xoopseditor.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/form.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formcheckbox.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formcolorpicker.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formdhtmltextarea.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formeditor.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formelement.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formselect.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formselecteditor.php
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopseditor/sampleform.inc.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopseditor/sampleform.inc.php 2013-09-26 17:27:27 UTC (rev 12100)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopseditor/sampleform.inc.php 2013-09-27 21:12:53 UTC (rev 12101)
@@ -34,11 +34,8 @@
$editor = @ $xoopsUser->getVar('editor'); // Need set through user profile
}
// Add the editor selection box
- // If dohtml is disabled, set $noHtml = true; $mode not considered if $noHtml is false
- xoops_load('XoopsCache');
- XoopsCache::delete('editorlist');
- $mode = 'html'; // extension or mimetype
- $sample_form->addElement(new XoopsFormSelectEditor($sample_form, 'editor', $editor, $noHtml = false, $mode));
+ // If dohtml is disabled, set $noHtml = true
+ $sample_form->addElement(new XoopsFormSelectEditor($sample_form, 'editor', $editor, $noHtml = false));
// options for the editor
// required configs
$options['editor'] = $editor;
@@ -49,8 +46,8 @@
$options['cols'] = 60; // default value = 50
$options['width'] = '100%'; // default value = 100%
$options['height'] = '400px'; // default value = 400px
- $options['mode'] = $mode; // for editors that support mode option
+
// "textarea": if the selected editor with name of $editor can not be created, the editor "textarea" will be used
// if no $onFailure is set, then the first available editor will be used
// If dohtml is disabled, set $noHtml to true
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopseditor/tinymce/formtinymce.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopseditor/tinymce/formtinymce.php 2013-09-26 17:27:27 UTC (rev 12100)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopseditor/tinymce/formtinymce.php 2013-09-27 21:12:53 UTC (rev 12101)
@@ -86,23 +86,6 @@
}
/**
- * Renders the Javascript function needed for client-side for get content
- *
- * I'VE USED THIS EXAMPLE TO WRITE VALIDATION CODE
- * http://tinymce.moxiecode.com/punbb/viewtopic.php?id=12616
- *
- * @return string
- */
- function renderGetContentJS()
- {
- if ($eltname = $this->getName()) {
- $ret = "tinyMCE.get('{$eltname}').getContent()";
- return $ret;
- }
- return '';
- }
-
- /**
* get language
*
* @return string
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopseditor/tinymce/tinymce.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopseditor/tinymce/tinymce.php 2013-09-26 17:27:27 UTC (rev 12100)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopseditor/tinymce/tinymce.php 2013-09-27 21:12:53 UTC (rev 12101)
@@ -269,10 +269,11 @@
$this->init();
if (self::$LastOfElementsTinymce!=$this->setting["elements"]) {
$ret = "\n<!-- 'tiny_mce.js' SCRIPT NOT YET ".$this->setting["elements"]." -->\n"; //debug
+
return $ret;
- } else {
+ } else {
$this->setting["elements"]=implode(",",self::$ListOfElementsTinymce);
- }
+ }
if ( !empty($this->setting["callback"]) ) {
$callback = $this->setting["callback"];
unset($this->setting["callback"]);
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopseditor/xoopseditor.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopseditor/xoopseditor.php 2013-09-26 17:27:27 UTC (rev 12100)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopseditor/xoopseditor.php 2013-09-27 21:12:53 UTC (rev 12101)
@@ -90,7 +90,6 @@
var $root_path = "";
var $nohtml = false;
var $allowed_editors = array();
- var $modes = null;
/**
* Enter description here...
*
@@ -126,16 +125,15 @@
*
* @param string $name Editor name which is actually the folder name
* @param array $options editor options: $key => $val
+ * @param string $OnFailure a pre-validated editor that will be used if the required editor is failed to create
* @param bool $noHtml dohtml disabled
- * @param string $OnFailure a pre-validated editor that will be used if the required editor is failed to create
- * @param mixed $modes Requested mode (or array of them)
*/
- function get($name = '', $options = null, $noHtml = false, $OnFailure = '', $modes = null)
+ function get($name = '', $options = null, $noHtml = false, $OnFailure = '')
{
- if (array_key_exists($name, $this->getList($noHtml, $modes)) && $editor = $this->_loadEditor($name, $options)) {
+ if (array_key_exists($name, $this->getList($noHtml)) && $editor = $this->_loadEditor($name, $options)) {
return $editor;
}
- $list = array_keys($this->getList($noHtml, $modes));
+ $list = array_keys($this->getList($noHtml));
if (empty($OnFailure) || !in_array($OnFailure, $list)) {
$OnFailure = $list[0];
}
@@ -147,10 +145,9 @@
* XoopsEditorHandler::getList()
*
* @param mixed $noHtml
- * @param mixed $modes Requested mode (or array of them)
* @return
*/
- function getList($noHtml = false, $modes = null)
+ function getList($noHtml = false)
{
/*
Do NOT use this method statically, please use
@@ -180,17 +177,7 @@
if (empty($config['order']))
continue;
$order[] = $config['order'];
- if (!isset($config['modes'])) {
- $config['modes'] = null;
- }
- if ($config['nohtml'] == false) {
- $config['modes'] = array('htm', 'html', 'htmlmixed', 'text/html');
- }
- $list[$item] = array(
- 'title' => $config['title'] ,
- 'nohtml' => $config['nohtml'],
- 'modes' => $config['modes']
- );
+ $list[$item] = array('title' => $config['title'] , 'nohtml' => $config['nohtml']);
}
}
array_multisort($order, $list);
@@ -205,10 +192,6 @@
foreach ($editors as $name) {
if (!empty($noHtml) && empty($list[$name]['nohtml']))
continue;
- if (!empty($modes) && is_string($modes) && !empty($list[$name]['modes']) && !in_array(strtolower($modes), $list[$name]['modes']))
- continue;
- if (!empty($modes) && is_array($modes) && !empty($list[$name]['modes']) && (count(array_intersect($modes, $list[$name]['modes'])) == 0))
- continue;
$_list[$name] = $list[$name]['title'];
}
return $_list;
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/form.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/form.php 2013-09-26 17:27:27 UTC (rev 12100)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/form.php 2013-09-27 21:12:53 UTC (rev 12101)
@@ -558,60 +558,6 @@
}
/**
- * Renders the Javascript function needed for client-side for get content
- *
- * Additionally, each element class may provide its own "renderGetContentJS" method
- * that is supposed to return custom get content code for the element.
- *
- * The element get content code can assume that the JS "myform" variable points to the form.
- * Exemple:
- * <script type='text/javascript'>
- * var content[];
- * content = " . renderGetContentJS(false) . "
- * </script>
- *
- * A basic element get content method may contain something like this:
- * <code>
- * function renderGetContentJS() {
- * $name = $this->getName();
- * return "myform.{$name}.value;";
- * }
- * </code>
- *
- * @param boolean $withtags Include the < javascript > tags in the returned string
- * @return string
- */
- function renderGetContentJS($withtags = true)
- {
- $js = '';
- if ($withtags) {
- $js .= "\n<!-- Start Form GetContent JavaScript //-->\n<script type='text/javascript'>\n<!--//\n";
- }
- $formname = $this->getName();
- $js .= "function xoopsFormGetContent_{$formname}() {\n";
- $js .= " var myform = window.document.{$formname};\n";
- $js .= " var content = new Object();\n";
- $elements = $this->getElements(true);
- foreach($elements as $elt) {
- if (method_exists($elt, 'renderGetContentJS') && ($elt->getName() != '')) {
- $js .= " content['" . $elt->getName() . "'] = " . $elt->renderGetContentJS() . ";\n";
- }
- }
- $js .= " Object.size = function(obj) {\n";
- $js .= " var size = 0, key;\n";
- $js .= " for (key in obj)\n";
- $js .= " {if (obj.hasOwnProperty(key)) size++;}\n";
- $js .= " return size;\n";
- $js .= " };\n";
- $js .= " return (Object.size(content) > 0) ? content : null;\n";
- $js .= "}\n";
- if ($withtags) {
- $js .= "//--></script>\n<!-- End Form GetContent JavaScript //-->\n";
- }
- return $js;
- }
-
- /**
* assign to smarty form template instead of displaying directly
*
* @param object $ &$tpl reference to a {@link Smarty} object
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formcheckbox.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formcheckbox.php 2013-09-26 17:27:27 UTC (rev 12100)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formcheckbox.php 2013-09-27 21:12:53 UTC (rev 12101)
@@ -242,33 +242,4 @@
}
return '';
}
-
- /**
- * Render custom javascript validation code
- *
- * @seealso XoopsForm::renderValidationJS
- */
- function renderGetContentJS()
- {
- // render custom validation code if any
- if (! empty($this->customGetContentCode)) {
- return implode(NWLINE, $this->customGetContentCode);
- // generate get content code if required
- } else {
- $eltname = $this->getName();
- return NWLINE . "
- function(){
- var checkboxesChecked = [];
- var checkBox = myform.elements['{$eltname}'];
- if (checkBox.length) {
- for (var i = 0; i < checkBox.length; i++) {
- if (checkBox[i].checked == true) {
- checkboxesChecked.push(checkboxes[i]);
- }
- }
- }
- return (checkboxesChecked.length > 0) ? checkboxesChecked : null;
- }";
- }
- }
}
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formcolorpicker.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formcolorpicker.php 2013-09-26 17:27:27 UTC (rev 12100)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formcolorpicker.php 2013-09-27 21:12:53 UTC (rev 12101)
@@ -72,18 +72,4 @@
return "if ( !(new RegExp(\"^#[0-9a-fA-F]{6}\",\"i\").test(myform.{$eltname}.value)) ) { window.alert(\"{$eltmsg}\"); myform.{$eltname}.focus(); return false; }";
}
-
- /**
- * Returns custom get content Javascript
- *
- * @return string Element get content Javascript
- */
- function renderGetContentJS()
- {
- $eltname = $this->getName();
- return NWLINE . "
- function(){
- return ( (new RegExp(\"^#[0-9a-fA-F]{6}\",\"i\").test(myform.{$eltname}.value))) ? myform.{$eltname}.value : null;
- }";
- }
}
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formdhtmltextarea.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formdhtmltextarea.php 2013-09-26 17:27:27 UTC (rev 12100)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formdhtmltextarea.php 2013-09-27 21:12:53 UTC (rev 12101)
@@ -265,19 +265,4 @@
}
return parent::renderValidationJS();
}
-
- /**
- * XoopsFormDhtmlTextArea::renderGetContentJS()
- *
- * @return
- */
- function renderGetContentJS()
- {
- if ($this->htmlEditor && is_object($this->htmlEditor) && method_exists($this->htmlEditor, 'renderGetContentJS')) {
- if (! isset($this->htmlEditor->isEnabled) || $this->htmlEditor->isEnabled) {
- return $this->htmlEditor->renderGetContentJS();
- }
- }
- return parent::renderGetContentJS();
- }
}
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formeditor.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formeditor.php 2013-09-26 17:27:27 UTC (rev 12100)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formeditor.php 2013-09-27 21:12:53 UTC (rev 12101)
@@ -57,7 +57,7 @@
/**
* renderValidationJS
- * override original renderValidationJS method
+ * TEMPORARY SOLUTION to 'override' original renderValidationJS method
* with custom XoopsEditor's renderValidationJS method
*/
function renderValidationJS()
@@ -77,27 +77,6 @@
}
/**
- * renderGetContentJS
- * 'override' original renderGetContentJS method
- * with custom XoopsEditor's renderGetContentJS method
- */
- function renderGetContentJS()
- {
- if (is_object($this->editor)) {
- if (method_exists($this->editor, 'renderGetContentJS')) {
- $this->editor->setName($this->getName());
- $this->editor->setCaption($this->getCaption());
- $this->editor->_required = $this->isRequired();
- $ret = $this->editor->renderGetContentJS();
- return $ret;
- } else {
- parent::renderGetContentJS();
- }
- }
- return false;
- }
-
- /**
* XoopsFormEditor::render()
*
* @return
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formelement.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formelement.php 2013-09-26 17:27:27 UTC (rev 12100)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formelement.php 2013-09-27 21:12:53 UTC (rev 12101)
@@ -434,37 +434,6 @@
}
/**
- * Render custom javascript get content code
- *
- * @seealso XoopsForm::renderGetContentJS
- */
- function renderGetContentJS()
- {
- // render custom get content code if any
- if (!empty($this->customGetContentCode)) {
- return implode(NWLINE, $this->customGetContentCode);
- // generate get content code if required
- } else if ($eltname = $this->getName()) {
- // $eltname = $this->getName();
- $eltcaption = $this->getCaption();
- $eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption);
- $eltmsg = str_replace(array(':' , '?' , '%'), '', $eltmsg);
- $eltmsg = str_replace('"', '\"', stripslashes($eltmsg));
- $eltmsg = strip_tags($eltmsg);
- echo $this->getFormType();
- switch ($this->getFormType()) {
- case 'checkbox':
- return "myform.{$eltname}.value";
- break;
- default:
- return "myform.{$eltname}.value";
- break;
- } // switch
- }
- return false;
- }
-
- /**
* Generates output for the element.
*
* This method is abstract and must be overwritten by the child classes.
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formselect.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formselect.php 2013-09-26 17:27:27 UTC (rev 12100)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formselect.php 2013-09-27 21:12:53 UTC (rev 12101)
@@ -238,34 +238,4 @@
}
return '';
}
-
- /**
- * Render custom javascript get content code
- *
- * @seealso XoopsForm::renderGetContentJS
- */
- function renderGetContentJS()
- {
- // render custom validation code if any
- if (! empty($this->customGetContentCode)) {
- return implode("\n", $this->customGetContentCode);
- // generate validation code if required
- } else {
- $eltname = $this->getName();
- return "
- function(){
- var selectSelected = [];
- var selectBox = myform.elements['{$eltname}'];
- if (selectBox.length) {
- for (i = 0; i < selectBox.options.length; i++ ) {
- if (selectBox.options[i].selected == true && selectBox.options[i].value != '') {
- selectSelected.push(selectBox.options[i].value);
- }
- }
- }
- return (selectSelected.length > 0) ? selectSelected : null;
- }";
- }
- return '';
- }
}
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formselecteditor.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formselecteditor.php 2013-09-26 17:27:27 UTC (rev 12100)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/class/xoopsform/formselecteditor.php 2013-09-27 21:12:53 UTC (rev 12101)
@@ -27,7 +27,6 @@
*/
class XoopsFormSelectEditor extends XoopsFormElementTray
{
- var $modes = null;
var $allowed_editors = array();
var $form;
var $value;
@@ -41,13 +40,10 @@
* @param string $name editor name
* @param string $value Pre-selected text value
* @param bool $noHtml dohtml disabled
- * @param array $allowed_editors
- * @param mixed $modes Requested mode (or array of them)
*/
- function XoopsFormSelectEditor(&$form, $name = 'editor', $value = null, $nohtml = false, $allowed_editors = array(), $modes = null)
+ function XoopsFormSelectEditor(&$form, $name = 'editor', $value = null, $nohtml = false, $allowed_editors = array())
{
$this->XoopsFormElementTray(_SELECT);
- $this->modes = $modes;
$this->allowed_editors = $allowed_editors;
$this->form = &$form;
$this->name = $name;
@@ -65,13 +61,12 @@
xoops_load('XoopsEditorHandler');
$editor_handler = XoopsEditorHandler::getInstance();
$editor_handler->allowed_editors = $this->allowed_editors;
- $editor_handler->modes = $this->modes;
$option_select = new XoopsFormSelect("", $this->name, $this->value);
$extra = 'onchange="if(this.options[this.selectedIndex].value.length > 0 ){
window.document.forms.' . $this->form->getName() . '.submit();
}"';
$option_select->setExtra($extra);
- $option_select->addOptionArray($editor_handler->getList($this->nohtml, $this->modes));
+ $option_select->addOptionArray($editor_handler->getList($this->nohtml));
$this->addElement($option_select);
return parent::render();
}
|