1
AHLIS
Add textboxs etc... in WF-Links 1.0.9
  • 2012/12/18 19:38

  • AHLIS

  • Not too shy to talk

  • Posts: 189

  • Since: 2004/12/12


Hi,

Is it hard to add textbox, checkbox or radiobuttons etc... in wf-links?

It's a good fundation, but I would like to add some more options. First in admin and then show them in the module.

If it's legal.

Best Regards
Ahlis

2
Mamba
Re: Add textboxs etc... in WF-Links 1.0.9
  • 2012/12/18 20:08

  • Mamba

  • Moderator

  • Posts: 11366

  • Since: 2004/4/23


Yes, it is legal, because XOOPS is Open Source!

So you can make all the changes that you want. If it works, you can submit it back to the community, and if people like it, we could include you changes in the next release.
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

3
AHLIS
Re: Add textboxs etc... in WF-Links 1.0.9
  • 2012/12/18 20:59

  • AHLIS

  • Not too shy to talk

  • Posts: 189

  • Since: 2004/12/12


Hi Mamba,

Okey, great. Then I'll take a look at it to see if I'm able to add stuff to it. :) I hope so. hehe

Best Regards
Ahlis

4
AHLIS
Re: Add textboxs etc... in WF-Links 1.0.9
  • 2012/12/19 18:56

  • AHLIS

  • Not too shy to talk

  • Posts: 189

  • Since: 2004/12/12


Hi again,

I have been trying to add two textfield. one plain text and one for url.

The name I used in the files where I have been adding thoose to is: os & dev

After editing and updating the module I can see the two new text field in admin. I add some text to them and press the button "Modify". The I choose edit and check if the text is still there but it's gone.

I have also tried to make a new link but with the same result.

This is my first time to do thi kind of editing, so I guess I have missed something or done something wrong.

Below is what I have done:
wflinks/sql/wflinks.sql 
# Table structure for table 'wflinks_links'
      
`osvarchar(25NOT NULL,
      `
devvarchar(255NOT NULL,

# Table structure for table 'wflinks_mod'
      
`osvarchar(25NOT NULL default ",
      `dev` varchar(255) NOT NULL,


wflinks/submit.php
    
$os = $wfmyts -> addslashes( ltrim( $_REQUEST["os"] ) );
    
$dev = $wfmyts -> addslashes( ltrim( $_REQUEST["dev"] ) );

     
$sql = "INSERT INTO " . $xoopsDB -> prefix( 'wflinks_links' ) . "    (lidcidtitleurlsubmitterstatusdatehitsratingvotescommentsforumidpublishedexpiredofflinedescriptionipaddressnotifypubcountrykeywordsitem_taggooglemapyahoomapmultimapstreet1street2townstateziptelfaxvoipmobileemailvatosdev ";

         
$sql .= " VALUES     (''$cid'$title''$url''$submitter''$status''$date'0000'$forumid''$publishdate'0'$offline''$descriptionb''$ipaddress''$notifypub''$country''$keywords''$item_tag''$googlemap''$yahoomap''$multimap''$street1''$street2''$town''$state''$zip''$tel''$fax''$voip''$mobile''$email''$vat''$os''$dev' )";

        
$sql = "UPDATE " . $xoopsDB -> prefix( 'wflinks_links' ) . " SET cid=$cidtitle='$title'url='$url'updated='$updated'offline='$offline'description='$descriptionb'ipaddress='$ipaddress'notifypub='$notifypub'country='$country'keywords='$keywords'item_tag='$item_tag'googlemap='$googlemap'yahoomap='$yahoomap'multimap='$multimap'street1='$street1'street2='$street2'town='$town'state='$state',  zip='$zip'tel='$tel'fax='$fax'voip='$voip'mobile='$mobile'email='$email'vat='$vat'os='$os, dev='$dev WHERE lid=" . intval($lid);

    
$sql = "INSERT INTO " . $xoopsDB -> prefix( 'wflinks_mod' ) . " (requestidlidcidtitleurlforumiddescriptionmodifysubmitterrequestdatecountrykeywordsitem_taggooglemapyahoomapmultimapstreet1street2townstateziptelfaxvoipmobileemailvatosdev)";
        
$sql .= " VALUES (''$lid$cid'$title''$url''$forumid''$descriptionb''$modifysubmitter''$requestdate''$country''$keywords''$item_tag''$googlemap''$yahoomap''$multimap''$street1''$street2''$town''$state''$zip''$tel''$fax''$voip''$mobile''$email''$vat''$os''$dev')";

    
$os = $link_array['os'] ? $wfmyts -> htmlSpecialCharsStrip( $link_array['os'] ) : ''; 
        
$dev = $link_array['dev'] ? $wfmyts -> htmlSpecialCharsStrip( $link_array['dev'] ) : 'http://';

        
$sform -> addElement( new XoopsFormText( _MD_WFL_OS, 'os', 70, 25, $os ), true );
    
$sform -> addElement( new XoopsFormText( _MD_WFL_DEV, 'dev', 70, 255, $dev ) );


wflinks/include/update.php 

//Make changes to table wflinks_links
$i++;
$ret[$i] = true;
$query[$i] = sprintf("ALTER TABLE " . $xoopsDB -> prefix( 'wflinks_links') . " ADD COLUMN os VARCHAR(25NOT NULL default '' AFTER multimap");
$ret[$i] = $ret[$i] && $xoopsDB->query($query[$i]);
$i++;
$ret[$i] = true;
$query[$i] = sprintf("ALTER TABLE " . $xoopsDB -> prefix( 'wflinks_links') . " ADD COLUMN dev VARCHAR(255NOT NULL default '' AFTER os");
$ret[$i] = $ret[$i] && $xoopsDB->query($query[$i]);

$i++;
$ret[$i] = true;
$query[$i] = sprintf("ALTER TABLE " . $xoopsDB -> prefix( 'wflinks_links') . " MODIFY os TEXT NOT NULL default ''");
$ret[$i] = $ret[$i] && $xoopsDB->query($query[$i]);
$i++;
$ret[$i] = true;
$query[$i] = sprintf("ALTER TABLE " . $xoopsDB -> prefix( 'wflinks_links') . " MODIFY dev TEXT NOT NULL default ''");
$ret[$i] = $ret[$i] && $xoopsDB->query($query[$i]);

//Make changes to table wflinks_mod
$i++;
$ret[$i] = true;
$query[$i] = sprintf("ALTER TABLE " . $xoopsDB -> prefix( 'wflinks_mod') . " ADD COLUMN os VARCHAR(25NOT NULL default '' AFTER mobile");
$ret[$i] = $ret[$i] && $xoopsDB->query($query[$i]);
$i++;
$ret[$i] = true;
$query[$i] = sprintf("ALTER TABLE " . $xoopsDB -> prefix( 'wflinks_mod') . " ADD COLUMN dev VARCHAR(25NOT NULL default '' AFTER os");
$ret[$i] = $ret[$i] && $xoopsDB->query($query[$i]);


wflinks/language/english/main.php
    define( '_MD_WFL_OS', 'OS Version' );
    define( '_MD_WFL_DEV', 'Dev. Homepage' );


wflinks/language/english/admin.php
    define( "
_AM_WFL_OS", "OS Version" );
    define( "
_AM_WFL_LINK_DEV", "DevURL" ); 


wflinks/update/weblinks_update.php

    //Delete some Fields
    
$result = $xoopsDB -> queryF("ALTER TABLE " . $xoopsDB -> prefix( 'wflinks_links' ) . " DROP os");
    
$result = $xoopsDB -> queryF("ALTER TABLE " . $xoopsDB -> prefix( 'wflinks_links' ) . " DROP dev");


What have I done wrong or missed?

Best Regards
Ahlis

5
Mamba
Re: Add textboxs etc... in WF-Links 1.0.9
  • 2012/12/19 19:48

  • Mamba

  • Moderator

  • Posts: 11366

  • Since: 2004/4/23


Without looking into the code, the first thing that I would do is check in the DB if the content of the fields have been saved there. If not, that you have problems with saving.

If the content is there, but it's not visible back, then you have problem with reading the content from the DB, so you would need to check in the debugger (or via echo) if the field variables contain the content.

If they do, then you have problem with presenting it, i.e. there is something wrong with either your HTML part, or your Smarty, if you're using it.

So this is just a process I would use to find out what is the issue, one step at the time...
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

6
AHLIS
Re: Add textboxs etc... in WF-Links 1.0.9
  • 2012/12/19 21:26

  • AHLIS

  • Not too shy to talk

  • Posts: 189

  • Since: 2004/12/12


Hi Mamba,

Okey. Thanks for the tip. Will check in that order. See if I find anything wrong.

Best Regards
Ahlis

7
AHLIS
Re: Add textboxs etc... in WF-Links 1.0.9
  • 2012/12/20 12:28

  • AHLIS

  • Not too shy to talk

  • Posts: 189

  • Since: 2004/12/12


Hi Mamba,

Thanks for the help. I found some problem when saving the new textfields.

I also find some error in the code above. Had used both small and big letters. So I changed them to small.

The next step is to include this to the html so they show up . :)

Getting forward. :) Fun when it works. hehe

Best Regards
Ahlis

ps. I guess more question will come ds. :)

8
AHLIS
Re: Add textboxs etc... in WF-Links 1.0.9
  • 2012/12/20 21:21

  • AHLIS

  • Not too shy to talk

  • Posts: 189

  • Since: 2004/12/12


Hi again,

I have made some progress, but now I'm stuck again.

<div><small><b><{$smarty.const._MD_WFL_OS}>:</b>&nbsp;<{$wfllink.os}></small></div>
<div><small><b><{$smarty.const._MD_WFL_DEV}>:</b>&nbsp;<{$wfllink.dev}></small></div>

$wfllink.os & $wfllink.dev dosen't work. I can see the label on both os & dev but the textfields are empty.

If I change $wfllink.os to $wfllink.publisher then it show who has posted it.

So I guess $wfllink.os & $wfllink.dev miss some kind of connection.

I have looked in all files but am getting a headake. Don't know where to find it.

Best Regards
Ahlis

9
Mamba
Re: Add textboxs etc... in WF-Links 1.0.9
  • 2012/12/20 22:05

  • Mamba

  • Moderator

  • Posts: 11366

  • Since: 2004/4/23


Quote:
If I change $wfllink.os to $wfllink.publisher then it show who has posted it.
So I guess $wfllink.os & $wfllink.dev miss some kind of connection.

Did you assign them to Smarty?
Seems like $wfllink.publisher is assigned to Smarty, so Smarty can provide the value, but the others are not. Check in code how it is done with $wfllink.publisher, and do the same for the other two fields.

some of the steps for "publisher" are:

You assign value to "publisher" in "link" (file: \wflinks\include\linkloadinfo.php):
$link['publisher'] = ( isset( $link_arr['publisher'] ) && !empty( $link_arr['publisher'] ) ) ? $wfmyts -> htmlSpecialCharsStrip$link_arr['publisher'] ) : _MD_WFL_NOTSPECIFIED;


then you assign "link" to "wfllink" in Smarty (in file \wflinks\singlelink.php):

Quote:
$xoopsTpl -> assign( 'wfllink', $link );

So when you call in HTML the "$wfllink.publisher", you'll get the value.
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

10
AHLIS
Re: Add textboxs etc... in WF-Links 1.0.9
  • 2012/12/20 22:18

  • AHLIS

  • Not too shy to talk

  • Posts: 189

  • Since: 2004/12/12


Hi Mamba,

Okey. I haven't add them I think. :)

Is it in htdocs/class/smarty/???/ I should add them to?

Login

Who's Online

183 user(s) are online (114 user(s) are browsing Support Forums)


Members: 0


Guests: 183


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits