Menu

iTop v2.0.3 - User page javascript

2014-10-10
2014-11-04
  • jitsobullet

    jitsobullet - 2014-10-10

    Hi,

    I noticed in the latest version of iTop, upon creating a new user and selecting a contact from the first drop down - the 2 read only fields below (First name and email) loads automatically prior to the user actually being created, whereas before it would only appear once the user is saved.

    I wish to apply the same methodology to another Configuration Item, can someone please help me find the code where this is implemented?

    Kind regards

     
  • jitsobullet

    jitsobullet - 2014-10-30

    Up!

     
  • Denis

    Denis - 2014-10-30

    This is handled by the dependency between fields.

    In the XML definition of the field, look for a tag named "dependencies" in the XML. (Looks like this is missing in the XML reference documentation!)

    Example:

            <field id="approver_id" xsi:type="AttributeExternalKey">
              <filter><![CDATA[SELECT Person WHERE org_id= :this->org_id]]></filter>
              <dependencies>
                <attribute id="org_id"/>
              </dependencies>
              <sql>approver_id</sql>
              <target_class>Person</target_class>
              <is_null_allowed>true</is_null_allowed>
              <on_target_delete>DEL_MANUAL</on_target_delete>
              <allow_target_creation>false</allow_target_creation>
              <jointype/>
            </field>
    

    This tells iTop that the field "approver_id" depends on the value of the field "org_id", in this case this is needed because the possible values for "approver_id" are defined by an OQL query which contains - as a parameter - the value of the field org_id for the current object being edited.

     
  • jitsobullet

    jitsobullet - 2014-11-03

    Thanks Denis,

    I am familiar with the above concept and i think this then leads onto my next question on how does one make a field read only as has occured under the user creation section?

    If possible, i would also like to know where the script is located that allows for the data to be loaded instantly, whereas before this was not a possibility and the data only appeared after saving the CI.

    Kind regards

     

    Last edit: jitsobullet 2014-11-03
  • Denis

    Denis - 2014-11-03

    Only objects which have a lifecycle (like tickets) can specify that a field is read-only (or hidden) via the XML data model.

    However one can overload the method GetAttributeFlags(...) to alter this behavior and make a field read-only depending on any characteristics of the object.

    About your second question: all asynchronous actions in iTop are called via the page: pages/ajax.render.php

    Hope this helps

     
  • jitsobullet

    jitsobullet - 2014-11-04

    Appreciate that Denis

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.