1
Kalobotz
Getting modify errors with Koivi eidor
  • 2004/12/6 16:41

  • Kalobotz

  • Not too shy to talk

  • Posts: 133

  • Since: 2004/5/26


I have coded in the koivi editor within this form and when I press the modify button, to modify the review, it places a new review post instead of replacing the old like the original form does.

echo "<table>";
        echo 
"<form method=post action=index.php>";
        echo 
"<tr><td>"._MD_FILEID."</td><td><b>$lid</b></td></tr>";
        echo 
"<tr><td>"._MD_FILETITLE."</td><td><input type=text name=title value="$title" size=50 maxlength=100></input></td></tr>n";

        echo 
"<tr><td>"._MD_DLURL."</td><td><input type=text name=url value="$url" size=50 maxlength=100></input></td></tr>n";
        echo 
"<tr><td>"._MD_HOMEPAGEC."</td><td><input type=text name=homepage value="$homepage" size=50 maxlength=100></input></td></tr>n";

        echo 
"<tr><td>"._MD_CATEGORYC."</td><td>";
        
$mytree->makeMySelBox("title", "title", $cid);

        
//TR EDIT: Koivi Editor and File Upload
        
echo "<tr><td align="right"nowrap>"._MD_SHOTIMAGE."</td><td>n";
        echo 
"<input type="text" name="logourl" value="$logourl" size="50" maxlength="60" value="">n"; 
        echo 
"<input type='button' value='Upload' onclick='javascript:openWithSelfMain("".XOOPS_URL."/modules/myReviews/upload.php?img_path=$img_path&target=logourl&logo=1&target2=cimgwidth&target3=cimgheight","upload",450,450);' />n";
        echo 
"<tr><td align="right"></td><td>";
        
$directory = XOOPS_URL."/modules/myReviews/images/shots/";
        
printf(_MD_MUSTBEVALID,$directory);
        echo 
"</td></tr>n";
    
        
//echo  "<input type="hidden" name="op" value="addDownload"></input>";
        
echo "<tr><td align="right" valign="top" nowrap>"._MD_DESCRIPTIONC."</td><td>n";
        
$sform = new XoopsThemeForm( _MD_DESCRIPTIONC, "storyform", "index.php" );
        
$hidden_element = new XoopsFormHidden('op', 'addDownload');
        
$sform->addElement( $hidden_element );
        
$wysiwyg_text_area = new XoopsFormWysiwygTextArea(_MD_DESCRIPTIONC, 'description', $description , '100%', '400px','');
        
$wysiwyg_text_area->setUrl("/class/wysiwyg");
        
$sform->addElement( $wysiwyg_text_area ); 
        
$button_tray = new XoopsFormElementTray( '', '' );
        
$button_tray->addElement( new XoopsFormButton( '', 'submit', _MD_MODIFY, 'submit') );
        
$sform->addElement( $button_tray);
        
$sform->display();

        echo 
"</td></tr>n";
        echo 
"</td></tr>n";
        echo 
"</table>";
        echo 
"</form>n";
    echo 
"<table><tr><td>n";
    echo 
myTextForm("index.php?op=delDownload&lid=".$lid , _MD_DELETE);
    echo 
"</td><td>n";
    echo 
myTextForm("index.php?op=booksConfigMenu", _MD_CANCEL);
    echo 
"</td></tr></table>n";
        echo 
"<hr>";

2
samuels
Re: Getting modify errors with Koivi eidor
  • 2004/12/13 22:15

  • samuels

  • Quite a regular

  • Posts: 249

  • Since: 2003/10/30


I'm Sorry but this module needs a lot of work to implement koivi.
If I have time I'll made new forms for this module.

3
samuels
Re: Getting modify errors with Koivi eidor
  • 2004/12/14 21:41

  • samuels

  • Quite a regular

  • Posts: 249

  • Since: 2003/10/30


I have checked this form in Myreviews 2.1rc

This is the modfile.php file complete
<?php
// $Id: modfile.php,v 1.1 2004/01/29 14:45:12 buennagel Exp $
//  ------------------------------------------------------------------------ //
//                XOOPS - PHP Content Management System                      //
//                    Copyright (c) 2000 XOOPS.org                           //
//                       <https://xoops.org/>                             //
// ------------------------------------------------------------------------- //
//  This program is free software; you can redistribute it and/or modify     //
//  it under the terms of the GNU General Public License as published by     //
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //

include "header.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopstree.php";
include_once 
XOOPS_ROOT_PATH."/class/module.errorhandler.php";
include_once 
XOOPS_ROOT_PATH."/include/xoopscodes.php";

$myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object
$mytree = new XoopsTree($xoopsDB->prefix("myReviews_cat"),"cid","pid");

if(isset(
$HTTP_POST_VARS['submit']))
  {
    
$eh = new ErrorHandler; //ErrorHandler object
    
if(empty($xoopsUser)){
        
redirect_header(XOOPS_URL."/user.php",2,_MD_MUSTREGFIRST);
        exit();
    } else {
        
$ratinguser = $xoopsUser->getVar('uid');
    }
    
$submit_vars = array('lid', 'title', 'url', 'homepage', 'descriptio', 'logourl', 'cid');
    foreach(
$submit_vars as $submit_key) {
        $
$submit_key = $HTTP_POST_VARS[$submit_key];
    }
    
$lid = intval($lid);

    
// Check if Title exist
    
if (trim($title)=="") {
        
$eh->show("1001");
    }
    
// Check if HOMEPAGE exist
    
if (trim($homepage)=="") {
        
$eh->show("1016");
    }
    
// Check if Description exist
    
if (trim($descriptio)=="") {
        
$eh->show("1008");
    }

    
$url = $myts->makeTboxData4Save($url);
    
$logourl = $myts->makeTboxData4Save($logourl);
    
$cid = intval($cid);
    
$title = $myts->makeTboxData4Save($title);
    
$homepage = $myts->makeTboxData4Save($homepage);
    
$description = $myts->makeTareaData4Save($descriptio);
    
$newid = $xoopsDB->genId($xoopsDB->prefix("myReviews_mod")."_requestid_seq");

    
$sql = sprintf("INSERT INTO %s (requestid, lid, cid, title, url, homepage, logourl, description, modifysubmitter) VALUES (%u, %u, %u, '%s', '%s', '%s', '%s', '%s', %u)", $xoopsDB->prefix("myReviews_mod"), $newid, $lid, $cid, $title, $url, $homepage, $logourl, $description, $ratinguser);
    
$xoopsDB->query($sql) or $eh->show("0013");
    
$tags = array();
    
$tags['MODIFYREPORTS_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/index.php?op=listModReq';
    
$notification_handler =& xoops_gethandler('notification');
    
$notification_handler->triggerEvent('global', 0, 'file_modify', $tags);
    
redirect_header("index.php",2,_MD_THANKSFORINFO);
    exit();

  }
//End if


    
$lid = intval($HTTP_GET_VARS['lid']);
    if(empty(
$xoopsUser)){
        
redirect_header(XOOPS_URL."/user.php",2,_MD_MUSTREGFIRST);
        exit();
    }
    include 
XOOPS_ROOT_PATH."/header.php";
    
$result = $xoopsDB->query("SELECT cid, title, url, homepage, logourl FROM ".$xoopsDB->prefix("myReviews_downloads")." WHERE lid=".$lid." AND status>0");
    list(
$cid, $title, $url, $homepage, $logourl) = $xoopsDB->fetchRow($result);
    
$title = $myts->makeTboxData4Edit($title);
    
$url = $myts->makeTboxData4Edit($url);
    
$homepage = $myts->makeTboxData4Edit($homepage);
    
$logourl = $myts->makeTboxData4Edit($logourl);
    
$result2 = $xoopsDB->query("SELECT description FROM ".$xoopsDB->prefix("myReviews_text")." WHERE lid=$lid");
    list(
$description)=$xoopsDB->fetchRow($result2);
    
$description = $myts->makeTareaData4Show($description);
    
        include 
XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
        include 
XOOPS_ROOT_PATH . "/class/wysiwyg/formwysiwygtextarea.php";
    
        
$sform = new XoopsThemeForm( _MD_REQUESTMOD, "storyform", "modfile.php" );
        
$sform->addElement( new XoopsFormText( _MD_FILETITLE, 'title', 50, 80,$title ), true );
        
$sform->addElement( new XoopsFormText( _MD_DLURL, 'url', 50, 80,$url ), false );
        
$sform->addElement( new XoopsFormText( _MD_HOMEPAGEC, 'homepage', 50, 80,$homepage ), false );
        
$sform->addElement( new XoopsFormText( _MD_SHOTIMAGE, 'logourl', 50, 80,$logourl ), false );
        
$sform->addElement(new XoopsFormHidden('lid',$lid));
        
$wysiwyg_text_area= new XoopsFormWysiwygTextArea(  _MD_DESCRIPTIONC, 'descriptio', $description , '100%', '400px','');
        
$wysiwyg_text_area->setSkin("xp");
        
$sform->addElement( $wysiwyg_text_area );
        
        
$button_tray = new XoopsFormElementTray( '', '' );
        
$button_tray->addElement( new XoopsFormButton( '', 'submit', _MD_SENDREQUEST, 'submit' ) );
        
$sform->addElement( $button_tray );
        
$sform->display();
    
    include 
XOOPS_ROOT_PATH.'/footer.php';
?>

Take it as example to do the job with other forms on this module.