News:

Wondering if this will always be free?  See why free is better.

Main Menu

AJAX Personal Text

Started by Fustrate, August 20, 2008, 12:10:34 AM

Previous topic - Next topic

Fustrate

Link to Mod



AJAX Personal Text v1.0



Introduction
An AJAX-based personal text updater, which will place a user's personal text at the top of the forum. When it is clicked, it turns into a text box and allows the user to edit their personal text on the fly, without ever leaving the page.

Features
o A small line of text is put next to your username at the top of the (default) theme. Add the following where you want this to go in other themes:
&raquo; <span style="font-size: 80%; padding: 3px;" id="update_personal_text">', !empty($context['user']['personal_text']) ? $context['user']['personal_text'] : $txt['ajax_personal_text_none'], '</span>
<script language="JavaScript" type="text/javascript"><!-- // -->
// Ajaxify that personal text!
if (typeof(window.XMLHttpRequest) != "undefined")
{
aPersonalText[0] = new PersonalText({
sBackReference: "aPersonalText[0]",
sScriptUrl: "', $scripturl, '",
sSessionId: "', $context['session_id'], '",
sLabelPersonalText: "Personal Text",
sBoxBackground: "transparent",
sBoxBackgroundHover: "#ffffff",
iBoxBorderWidthHover: 1,
sBoxBorderColorHover: "#adadad" ,
sItemBorder: "1px solid #ffffff",
sItemBorderHover: "1px dotted gray",
sItemBackground: "transparent",
sItemBackgroundHover: "#e0e0f0"
});
}
</script>

o To use this mod, just click the line of text and it will turn into a text box!
o There are NO admin features for this modification.


Support
Please use the modification thread for support with this modification. Personal messages for support are discouraged.

Languages
o English
o English UTF-8
If you have any translations for any other languages, I would be grateful if you would send them to me via PM or in the Mods topic.

Changelog
> Comment
+ Addition
- Error/bug fix

Version 1.0 Aug. 14th, 2008
> Initial Release
Steven Hoffman
Former Team Member, 2009-2012

Nathaniel

Good little mod! :)

Its making me wish that I knew how to use Ajax. ;)
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Fustrate

I'm also now working on making a system where you can use email to update your personal text ;) don't know if I'll ever release it, because it involves setting up an email forward which I know would just confuse a ton of people who will post questions like "what is a cpanel?!?!"... and I just don't have time for that ;)

But anyways, enjoy!
Steven Hoffman
Former Team Member, 2009-2012

Alpay

#3
Hello;

Turkish Translate:

Modifications.turkish.php:
$txt['ajax_personal_text_none'] = '<i>Kişisel İleti Girilmemiş</i>';

Modifications.turkish-utf8.php
$txt['ajax_personal_text_none'] = '<i>Kişisel İleti Girilmemiş</i>';

Edit : Problem Turkish character İı Üü Şş Çç Ğğ
example :  ı =  %u0131

Quote$text = strtr($text, chr(231).chr(199).chr(254).chr(222).chr(240).chr(208).chr(253).chr(221).chr(246).chr(214).chr(252).chr(220),
         'cCsSgGiIoOuU')

Ncen

Could this be downgraded to work with SMF 1.1.5? ^^' Just curious.

Fustrate

Yes, it could. I'm not sure if I even have the time to do it seeing as school starts in three days, but I'll put it on my list of things to do.
Steven Hoffman
Former Team Member, 2009-2012

[SiNaN]

I don't use this mod on my own but there are complaints in the Turkish Language Board that it doesn't work the Turkish chars. Do you have a fix for that?
Former SMF Core Developer | My Mods | SimplePortal

Fustrate

It's the javascript... I have no clue how to fix that, but I'll start researching it ASAP.
Steven Hoffman
Former Team Member, 2009-2012

[SiNaN]

Okay, probably other language users will also have a problem like this.
Former SMF Core Developer | My Mods | SimplePortal

Fustrate

Hmm... can you ask them when exactly the error occurs?

Starting off with a Turkish personal text, does it show up correctly in the box when the page first loads?
- If they try changing it to English, does it save?
- If they try editing it and press "Cancel" instead, does it revert back to the original Turkish or is it messed up?

Starting off with English, does it display correctly?
- If they try changing to Turkish, does it save?
Steven Hoffman
Former Team Member, 2009-2012

[SiNaN]

Sorry for delay, I had to test it myself.

1) Yes.
     a) Yes.
     b) Revert back to original without problem.

2) Yes.
     b) Yes.

It saves and shows correctly on the page you change it. But when you pass to another page, it is messed up both in that box and forum profile page.

To add; some other bad news: I'm using FF 3.0.1 and it doesn't work on it. I've tested on IE.
Former SMF Core Developer | My Mods | SimplePortal

Fustrate

I also use FF3.0.1, and it works fine for me. Tested on Opera, IE6+7, Safari on Windows and Mac, FF3 on Linux.

It's obviously not saving correctly to the database. I'll look into that this afternoon when I get back from Ultimate Frisbee class and Psychology :D
Steven Hoffman
Former Team Member, 2009-2012

[SiNaN]

Well I don't know. I couldn't get it working. I'm at school, so could be something blocking the js.

Problem seems to be here:

script.js line 1274:

sendXMLDocument(smf_prepareScriptUrl(this.opt.sScriptUrl) + 'action=xmlhttp;sa=personal', 'text=' + encode(new_personal_text));

Cause when I check the $_REQUEST['text'] in Xml.php, it comes there already messed up.
Former SMF Core Developer | My Mods | SimplePortal

Fustrate

Try changing encode( to encodeURIComponent(
Steven Hoffman
Former Team Member, 2009-2012

[SiNaN]

Nope, the characters are changed now but its again messed up.

What I enter: => asdğüşiçö
What is in $_REQUEST['text'] => asd?ü?içö
What is diplayed => asdğüşiçö

They are more likely to be utf.
Former SMF Core Developer | My Mods | SimplePortal

Fustrate

What we need is a javascript function that will convert everything it gets into HTML entities, so that they can safely be sent through to PHP which can decode them quite easily. I'm looking around, but there's not much out there on this subject.
Steven Hoffman
Former Team Member, 2009-2012

Fustrate

New version uploaded, this one works with multiple languages (for the buttons) and saves your personal text when you press 'enter' on your keyboard.

The Turkish problem, however, persists.
Steven Hoffman
Former Team Member, 2009-2012

matasanos


Nathaniel

No, as you can see on the mod download page, this mod is only compatible with SMF 2 Beta:
QuoteCompatible With: 2.0 Beta 3.1 Public

Also:
Quote from: YodaOfDarkness on August 22, 2008, 01:56:27 PM
Yes, it could. I'm not sure if I even have the time to do it seeing as school starts in three days, but I'll put it on my list of things to do.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

matasanos


Advertisement: