Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Help Topics in multiple combos

Hello All, 

I'm wondering if would it be possible to create different levels of help topics and when they are displayed in the ticket form, I like them to appear as chained combos. We have tons of categories and sub categories at work :(

Please let me know someone has done this before
Tagged:
«134

Comments

  • I have done following as a work around since Combo feature is not available at present...

    image

    image
  • Ufff! thanx! good thinking about the numbers to order them properly. Will do that then
  • I was able to modify the code and actually display combos based on the depth of the help topics and works great (including linked functionality with a jquery plugin) saving the appropiate help topic without caring about the levels you have. If anyone is interested I can upload it. I modified only 2 files 

    :)
  • Since we also have a lot of help topics, we suggested to have different dropdown lists for top level and sub level help topics but it got not yet implemented, so yes please, upload it ;)
  • I was able to modify the code and actually display combos based on the depth of the help topics and works great (including linked functionality with a jquery plugin) saving the appropiate help topic without caring about the levels you have. If anyone is interested I can upload it. I modified only 2 files  :)
    Please do upload. That would be really helpful :)
  • edited August 2014
    Hello guys,

    Here's the code as promised. I made the change pretty quickly cause I have a short delivery time, so don't judge my coding skills hahaha. The 3 files I changed are the following:
    C:\wamp\www\osTicket\open.php
    C:\wamp\www\osTicket\include\client\open.inc.php
    C:\wamp\www\osTicket\include\class.topic.php

    I'm attaching them here in a 7zip folder. Just by repleacing those files it should be working right away. Let me know If you have any problems.

    Jerry
    MultipleHelpTopicCombo.7z
    6K
  • This is how it looks ;) It also support the custom forms if the last help topic has one attached and in case of error the post back remembers the selection.

    let me know If you find any errors and I will fix it.

    Jerry

    image
    Untitled.png
    628 x 352 - 7K
  • Hi Sosamv,

    This is idea for what I need, however, we have come across one small issue, which I am hoping you can help with;

    If largest help topic has 3 levels, and the help topic chosen by the user has the maximum 3 levels then all works well, however if the topic has only 2 levels, we cannot raise a ticket as there unselected dropdowns (which have no options), it tells us that a required option is missing.

    Can you help?

    Cheers,

    Will
  • Let me see If I have time today, if not i will post it next week :S
  • There you go Will. I tested it very quickly. Give it a try, the only thing that is missing is to hide the disabled combos when it is a helptopic shorter than the others.


    the only file that changed is this one:
    C:\wamp\www\osTicket\include\client\open.inc.php

    but I've included all of them anyways.

    If you like to hide the combos you can do it in that file in the cmbs.change() event. Hope it helps
  • edited September 2014
    It will need more work... if the user has errors in the form, it will not properly save the state after post back :( please use the first version. I will have to work a little bit more on it, sorry
  • Here, give it a try... 
    code.7z
    7K
  • Hi,

    Thanks for such awesome code. Will it possible to have just two dropdowns? one for Main Parent Help topics and then all the sub topics (any level) to appear in the second dropdown?

    Thanks
  • Hey sosamv!

    Do you have an updated version?

    Thanks!
  • This is exactly what i'm looking for, thanks Sosamv.
    Any chance we could get an upgraded version for v1.9.4?

    Thanks again!
  • We have a large number of help topics as well and are looking for the same functionality.  Will have to give this a try.  Thanks for the post!
  • edited November 2014
    It appears that after applying this modification, the ability to create new topics is now broken...

    See below, the Add Topic button for new topics is gone :(

    image


    EDIT: I have narrowed the issue down to being a problem with class.topic.php - unsure what line is breaking the save / add topic buttons ATM as I am not a coder.

    Hopefully sosamv responds!
  • Maybe problem is here (scp/helptopics.php) on POST

    case 'create':
                if(($id=Topic::create($_POST,$errors))){
                    $msg=sprintf(__('Successfully added %s'), Format::htmlchars($_POST['topic']));
                    $_REQUEST['a']=null;
                }elseif(!$errors['err']){
                    $errors['err']=sprintf(__('Unable to add %s. Correct error(s) below and try again.'),
                        __('this help topic'));
                }
                break;

  • i've tried it on 1.9.4, 
    i've not copied the files over, i've compared the modded files with 1.9.3 to work out what the changes are, and copied those changes into the 1.9.4 files.

    no errors being displayed. and no problems creating new help topics.

    but trying to go in as a client and open a new ticket, i just get an empty page. 

    maybe i'm missing something obvious, but i'm seeing no difference in the open.php from 1.9.3 and the modded file uploaded on sept 5.
  • edited November 2014
    ^ Im getting the same experience as nhybgtvfr. Going to double check everything
  • just tried placing the modded files straight into the 1.9.4 system unaltered, get the same problem powdergeek11 had.

    going through it all again from scratch, a bit more carefully this time. 

    fortunately it's just a test server, so i can get away with breaking things :)

    so far, i've modded the 1.9.4 versions of open.php and open.inc.php,  and adding a new help topic can still be done without any problems. 
    a client attempt to open a new ticket loads the part of the page, but obviously doesn't get the selection parts yet.

    seeing:

    Open a New Ticket

    Please fill in the form below to open a new ticket.

    Help Topic:



    just working through the changes to class.topic.php now, will update again soon.


  • finished changing class.topic.php  

    tried creating new help topics, worked fine. 
    tried creating a new ticket as a client, that worked as  well.

    i've gone 3 levels deep on the topics,  select a topic with only 1 level i get

    {"media":null,"html":null}   after the contact details,

    selecting a topic with 2 levels of depth, i get the same after selecting the 2nd level topic.

    selecting a topic with 3 levels of depth (no spaces in any of the topics), i get the same after selecting the 3rd level topic.

    getting some really messed up stuff on a selection with a custom form, but that may be related to something else. 

    going to wipe out custom forms and existing help topics and test again. in the meantime, i've attached the modded 1.9.4 files i'm currently using.

    ost.zip
    8K
  • i can't get any further with this. 

    i'm not sure if some custom forms / lists that i was playing around with before is causing some issue. 
    i deleted all custom forms, but can't delete some custom lists because it say's they're in use by custom forms?!?

    looking at it, it looks like when the final option is selected, it's trying to call a dynamic form, which is being returned null values, when i don't believe if should be even calling it. 

    i've deleted some of the custom form / list stuff i found still lurking in the database, but may have missed stuff.
    i'm now going to try going back to a new clean install and re-applying the mod and see how it works on that.


    in the meantime, once it's working fully, i'd like to see only the 1st drop down list, with the others only showing up, if required, once a selection in the parent drop-down has been made. the created page code shows the inactive drop-downs as disabled, anyone know how to make it so they're hidden?

    <select name="topic2" disabled="" class="cmb" id="cmb2" style="width: 300px; float: none;">             
                                </select>
  • Thanks nhybgtvfr
    Everything works fine only one problem. I have 3 level and after the selection of third level I get {"media":null,"html":null}. 

    image
    sh2.png
    841 x 822 - 59K
  • yep. getting the same thing myself, just restarted it all with a completely new database, to confirm it wasn't anything else left over from custom forms causing it, but i still get the same thing. 

    even like this, as far as i can tell, creating a new ticket still works without any problems. 


    i tried before with a custom contact form, and it made a complete mess of that, with html tags and symbols showing up all over the place.

    your custom ticket details part looks ok though, so maybe anything other than a customised contact form may be ok.

    looking at the code some more, it looks like the help topic drop downs and the contact form are being created within the same tbody /tbody tags, with ticket details and captcha each in their own tbody, i *think*  the help topic part and the contact details part should both be in their own tbody. 

    but i'm in no way, shape or form, a programmer, i've managed to hack it this far, but i think someone with a bit more knowledge than me will need to fix this part.
  • ok. the remaining issue has nothing to do with the contact form being in the same tbody, that said, i still think the contact form *should* be in it's own tbody, which can be achieved by editing include/client/open.inc.php and adding
    </tbody>
    <tbody>
    just above these lines:
    <?php
            if (!$thisclient) {
                $uform = UserForm::getUserForm()->getForm($_POST);


    the issue is being displayed by this bit of code:
        <tbody id="dynamic-form">
            <?php if ($form) {
                include(CLIENTINC_DIR . 'templates/dynamic-form.tmpl.php');
            } ?>
        </tbody>
     
    i've moved it to the end of the table, so it doesn't affect any of the other forms.

    its being called by this bit of code, in the same file, with the highlighted line being the cause. 
    i've commented the line out, and the issue no longer displays, although i can't confirm that won't cause any other issues. not worked through that part yet.

    var changeCombo = function(){
        var value = $("#cmb_value").val();
        var data = $(':input[name]', '#dynamic-form').serialize();
        if(value ==""){
            $('#dynamic-form').html("");
        }else{
            $('#dynamic-form').load('ajax.php/form/help-topic/' + value , data);
        }
    }
  • ok, you can't just comment out the line below, if you do, it will not load any custom forms.

            $('#dynamic-form').load('ajax.php/form/help-topic/' + value , data);
     
    the actual data being returned by 'value' in that line appears to be fine, it matches up with my help topic id's. there doesn't appear to be anything spurious being included.

    when there are no custom forms it just displays {"media":null,"html":null} , i have no idea where it gets this from, they're not in the database, and the strings media and html only appear together in include/mpdf/classes/cssmgr.php

    if you do use a custom form, it appears on screen, mangled, like:
    \n
    \n

    Affected Site<\/h3>\n<\/em>\n <\/div>\n <\/td><\/tr>\n

  • I think they are getting the values from this file 

    include/class.forms.php
  • well, i don't seem to be getting any further with this. 

    looks like i'm gonna have to leave this one to someone with some real programming knowledge.

  • Hello guys, Here's the code as promised. I made the change pretty quickly cause I have a short delivery time, so don't judge my coding skills hahaha. The 3 files I changed are the following: C:\wamp\www\osTicket\open.php C:\wamp\www\osTicket\include\client\open.inc.phpC:\wamp\www\osTicket\include\class.topic.php I'm attaching them here in a 7zip folder. Just by repleacing those files it should be working right away. Let me know If you have any problems. Jerry
    Thanks!! That worked PERFECTLY! 
Sign In or Register to comment.