FM Design
Would you like to react to this message? Create an account in a few clicks or log in to continue.

IMPORTANT

FM Design is in read-only mode, please click here for more information.

Latest topics
» Forumactif Edge - Releases
by Ange Tuteur Tue 03 Sep 2019, 11:49

» GIFActif - Giphy Button for the Editor
by Ange Tuteur Wed 08 May 2019, 17:21

» Forum Closure
by Ange Tuteur Mon 01 Jan 2018, 01:28

» Chit Chat Thread
by Valoish Sun 31 Dec 2017, 19:15

» Font/Text background color.
by Valoish Sun 31 Dec 2017, 19:11

» Forumactif Messenger - Instant Message Application for Forumotion
by Wolfuryo Sun 31 Dec 2017, 18:24

» [GAME] Count to One Million!
by brandon_g Fri 29 Dec 2017, 18:58

» Post Cards
by manikbiradar Wed 20 Dec 2017, 07:50

» [GAME] Countdown from 200,000
by Valoish Wed 13 Dec 2017, 23:22

» GeekPolice Tech Support Forums - GeekPolice.net
by Dr Jay Mon 11 Dec 2017, 19:12

» Asking about some plugin for Forumotion
by Dr Jay Mon 11 Dec 2017, 19:10

» [GAME] What are you thinking right now?
by Van-Helsing Sat 09 Dec 2017, 14:51

» Widget : Similar topics
by ranbac Wed 06 Dec 2017, 18:11

» Change the Background of the Forum and put an image and how to make prefixs?
by Clement Wed 06 Dec 2017, 15:19

» Hello from Western Australia
by SarkZKalie Wed 06 Dec 2017, 05:34

Recent Tutorials
Top posting users this month

Who is online?
In total there are 9 users online :: 0 Registered, 0 Hidden and 9 Guests

None

[ View the whole list ]


Most users ever online was 515 on Tue 14 Sep 2021, 15:24

[SOLVED] Editor botton

View previous topic View next topic Go down

Kisskiss
Kisskiss

Gender : Unspecified
Posts : 47
Points : 2924
Reputation : 1
Language : Italian, spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : punBB

PostKisskiss Fri 22 Jul 2016, 10:54

Hello,

How could I add a button in the editor visible to the staff ?
I have some tables that uses only the staff and those buttons would need to place the code in the editor no longer copy and paste.

Thank you! lol!


Last edited by Kisskiss on Fri 05 Aug 2016, 19:21; edited 1 time in total
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12044
Reputation : 2375
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Fri 22 Jul 2016, 11:00

Kisskiss
Kisskiss

Gender : Unspecified
Posts : 47
Points : 2924
Reputation : 1
Language : Italian, spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : punBB

PostKisskiss Wed 03 Aug 2016, 18:04

http://help.forumotion.com/t141539-is-that-possible-simple-menu-with-quick-replys#965626


I used that, it works !

I want to add more , just want them to have different images , as I customize the CSS ?

botton 1
Code:
.sceditor-button-messages div {
  background-image:url('IMAGE') !important;
}

botton 2

????
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12044
Reputation : 2375
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Wed 03 Aug 2016, 19:36

Hello again @Kisskiss,

For creating a second button follow the same steps, BUT in the script replace all instances of 'messages' ( apostrophes included ), with something like 'messages_2'. Then your CSS will look like this :
Code:
.sceditor-button-messages_2 div {
  background-image:url('IMAGE') !important;
}
Kisskiss
Kisskiss

Gender : Unspecified
Posts : 47
Points : 2924
Reputation : 1
Language : Italian, spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : punBB

PostKisskiss Fri 05 Aug 2016, 16:39

But I have not figured out how to make it visible only to staff groups ( possibly only a few ) because even now users see the button

Thanks
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12044
Reputation : 2375
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Fri 05 Aug 2016, 16:44

To make it only visible for staff, find and replace this :
Code:
if (!$.sceditor) return;

With this :
Code:
if (!$.sceditor && !_userdata.user_level) return;
Kisskiss
Kisskiss

Gender : Unspecified
Posts : 47
Points : 2924
Reputation : 1
Language : Italian, spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : punBB

PostKisskiss Fri 05 Aug 2016, 16:45

you can also choose the groups to make it visible here ?
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12044
Reputation : 2375
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Fri 05 Aug 2016, 16:46

Kisskiss wrote:you can also choose the groups to make it visible here ?
Unfortunately not, you'd have to do that based on the user's id.
Kisskiss
Kisskiss

Gender : Unspecified
Posts : 47
Points : 2924
Reputation : 1
Language : Italian, spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : punBB

PostKisskiss Fri 05 Aug 2016, 16:48

We have to change all the code to do this with the member ID ?
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12044
Reputation : 2375
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Fri 05 Aug 2016, 17:04

Well if you wanted to do it by member id we'd have to replace this :
Code:
if (!$.sceditor) return;

with this :
Code:
if (!$.sceditor && _userdata.user_id == 1 || 2 || 3 || 4) return;

You have to separate each user id by "||" which literally translates to "OR"
Kisskiss
Kisskiss

Gender : Unspecified
Posts : 47
Points : 2924
Reputation : 1
Language : Italian, spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : punBB

PostKisskiss Fri 05 Aug 2016, 17:11

one last question ... in that code I can add only 3 buttons, but if I do not want to 5 ?? I tried to add more ' title ' : ' code ' but not the button appears
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12044
Reputation : 2375
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Fri 05 Aug 2016, 17:17

Ah about that ! On the last pair :
Code:
'Goodbye' : 'See you !'
you need to add a comma "," after it to end that line. It's sorta like a period in a sentence. If you leave it out it'll cause an error.

This is how it would look with 2 additional presets :
Code:
      var messages = {
        'Title' : 'Message content',
        'Hello' : 'Good day !',
        'Goodbye' : 'See you !',
        'NEW PRESET 1' : 'message..',
        'NEW PRESET 2' : 'message..'
      },
Kisskiss
Kisskiss

Gender : Unspecified
Posts : 47
Points : 2924
Reputation : 1
Language : Italian, spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : punBB

PostKisskiss Fri 05 Aug 2016, 17:25

Hmmmm no, the problem not solved



Last edited by Kisskiss on Fri 05 Aug 2016, 19:20; edited 1 time in total
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12044
Reputation : 2375
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Fri 05 Aug 2016, 18:54

You need to escape any apostrophes inside the string with the escape character : "\", otherwise it'll cause an error.

For example : l'apposita icona ----> l\'apposita icona

Here's the corrected code :
Code:
$(function() {
  if (!$.sceditor) return;
 
  $.sceditor.command.set('messages_2', {
    dropDown : function(editor, caller, callback) {
      var messages_2 = {
        'Risolto - admin' : '[table class="moderation-message" style="width: 100%;background: #F03333;margin-top: 5px;margin-bottom: 5px;border-bottom: 3px solid #F03333;padding: 5px;border-radius: 4px;font-weight: bold;color: #fff;font-size: 12px;text-shadow: 1px 1px 3px rgba(0,0,0,0.1);font-family: Trebuchet MS, Helvetica, Arial, sans-serif"][tr][td width="1%"][img]http://i21.servimg.com/u/f21/11/80/17/98/solved10.png[/img][/td]\n[td]Caro Utente,\nti ricordiamo che se il tuo problema puo essere considerato [b]Risolto[/b], è necessario inserire l\'apposita icona, in modo da permettere allo staff di archiviare il topic.\n \nGrazie per la comprensione, A presto! 8) [/td]\n[/tr]\n[/table]',
        'Risolto - mod' : '[table class="moderation-message" style="width: 100%;background: #787EEB;margin-top: 5px;margin-bottom: 5px;border-bottom: 3px solid #787EEB;padding: 5px;border-radius: 4px;font-weight: bold;color: #fff;font-size: 12px;text-shadow: 1px 1px 3px rgba(0,0,0,0.1);font-family: Trebuchet MS, Helvetica, Arial, sans-serif"][tr][td width="1%"][img]http://i21.servimg.com/u/f21/11/80/17/98/solved10.png[/img][/td]\n[td]Caro Utente,\nti ricordiamo che se il tuo problema puo essere considerato [b]Risolto[/b], è necessario inserire l\'apposita icona, in modo da permettere allo staff di archiviare il topic.\n \nGrazie per la comprensione, A presto! 8) [/td]\n[/tr]\n[/table]',
        'Abband - mod' : '[table class="moderation-message" style="width: 100%;background: #787EEB;margin-top: 5px;margin-bottom: 5px;border-bottom: 3px solid #787EEB;padding: 5px;border-radius: 4px;font-weight: bold;color: #fff;font-size: 12px;text-shadow: 1px 1px 3px rgba(0,0,0,0.1);font-family: Trebuchet MS, Helvetica, Arial, sans-serif"][tr][td width="1%"][img]http://i21.servimg.com/u/f21/11/80/17/98/garbag11.png[/img][/td]\n[td]Caro Utente,\nPurtroppo sono passati 15 giorni dal tuo ultimo messaggio in qusto topic, e secondo il nostro regolamento i topic che non ricevono alcuna risposta da almeno [b]15 giorni[/b], vengono considerati [u]Abbandonati[/u]\n \nGrazie per la Comprensione, A presto!  :)  :) [/td]\n[/tr]\n[/table]',
        'Abband - admin' : '[table class="moderation-message" style="width: 100%;background: #F03333;margin-top: 5px;margin-bottom: 5px;border-bottom: 3px solid #F03333;padding: 5px;border-radius: 4px;font-weight: bold;color: #fff;font-size: 12px;text-shadow: 1px 1px 3px rgba(0,0,0,0.1);font-family: Trebuchet MS, Helvetica, Arial, sans-serif"][tr][td width="1%"][img]http://i21.servimg.com/u/f21/11/80/17/98/garbag11.png[/img][/td]\n[td]Caro Utente,\nPurtroppo sono passati 15 giorni dal tuo ultimo messaggio in qusto topic, e secondo il nostro regolamento i topic che non ricevono alcuna risposta da almeno [b]15 giorni[/b], vengono considerati [u]Abbandonati[/u]\n \nGrazie per la Comprensione, A presto!  :)  :) [/td]\n[/tr]\n[/table]',
        'Vuoto - admin' : '[table class="moderation-message" style="width: 100%;background: #F03333;margin-top: 5px;margin-bottom: 5px;border-bottom: 3px solid #F03333;padding: 5px;border-radius: 4px;font-weight: bold;color: #fff;font-size: 12px;text-shadow: 1px 1px 3px rgba(0,0,0,0.1);font-family: Trebuchet MS, Helvetica, Arial, sans-serif"][tr][td width="1%"][img]http://i21.servimg.com/u/f21/11/80/17/98/garbag11.png[/img][/td]\n[td]Caro Utente,\n \n \n \n [/td]\n[/tr]\n[/table]',
        'Vuoto - mod ' : '[table class="moderation-message" style="width: 100%;background: #787EEB;margin-top: 5px;margin-bottom: 5px;border-bottom: 3px solid #787EEB;padding: 5px;border-radius: 4px;font-weight: bold;color: #fff;font-size: 12px;text-shadow: 1px 1px 3px rgba(0,0,0,0.1);font-family: Trebuchet MS, Helvetica, Arial, sans-serif"][tr][td width="1%"][img]http://i21.servimg.com/u/f21/11/80/17/98/garbag11.png[/img][/td]\n[td]Caro Utente,\n \n \n \n [/td]\n[/tr]\n[/table]',
      },
      a, d = document.createElement('DIV'), i;
 
      for (i in messages_2) {
        a = document.createElement('A');
        a.className = 'sceditor-font-option';
        a.title = messages_2[i];
        a.innerHTML = i;
        a.onclick = function() {
          callback(this.title);
          editor.closeDropDown(true);
          return false;
        };
        d.appendChild(a);
      }
 
      editor.createDropDown(caller, 'messages_2', d);
    },
 
    exec : function(c) {
      var e = this;
      $.sceditor.command.get('messages_2').dropDown(e, c, function(content) {
        e.insertText(content);
      });
    },
 
    txtExec : function(c) {
      var e = this;
      $.sceditor.command.get('messages_2').dropDown(e, c, function(content) {
        e.insertText(content);
      });
    },
 
    tooltip : 'Preset messages_2'
  });
 
  toolbar += '|messages_2'
});
Kisskiss
Kisskiss

Gender : Unspecified
Posts : 47
Points : 2924
Reputation : 1
Language : Italian, spanish
Browser : Browser : Google Chrome Forum Version : Forum Version : punBB

PostKisskiss Fri 05 Aug 2016, 19:19

friendly , problem solved.

thank you very much [SOLVED] Editor botton 1f618
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12044
Reputation : 2375
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Fri 05 Aug 2016, 19:24

You're welcome ! Mr. Green

Topic archived

Have a good weekend. Smile
Sponsored content

PostSponsored content

View previous topic View next topic Back to top

Create an account or log in to leave a reply

You need to be a member in order to leave a reply.

Create an account

Join our community by creating a new account. It's easy!


Create a new account

Log in

Already have an account? No problem, log in here.


Log in

 
Permissions in this forum:
You cannot reply to topics in this forum