Menu

itop

2025-08-26
2025-09-02
  • Carlos Cartechini

    Good morning. Thanks to anyone who can help me. I have the following problem. I was able to open a page encapsulated in an iframe from the portal. However, I couldn't pass the UserRequest to my home page. I looked for information, but it's clearly not that simple. In my data model, I have the following code; the iTop version is 3.1.1. If you could help, I'd be grateful.

    datamodel.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.3">
      <module_designs>
        <module_design id="itop-portal" xsi:type="portal">
          <bricks>
            <brick id="url-nuevo-ticket" xsi:type="Combodo\iTop\Portal\Brick\UrlBrick" _delta="define">
              <width>50</width>
              <title>
                <default>Portal:NuevoTicketButton</default>
              </title>
              <description>Portal:NuevoTicketButton+</description>
              <decoration_class>
                <default>fa fa-exclamation fa-2x fa-fw</default>
              </decoration_class>
              <url>https://itopdes.misitio.com.ar/pages/pps-conf-ingresoreq/apps-conf-ingresoreq.php?;</url>
            </brick>
            <brick id="services" _delta="if_exists">
              <visible>
                <home>false</home>
                <navigation_menu>false</navigation_menu>
              </visible>
            </brick>
            <brick id="approvals" _delta="if_exists">
              <visible>
                <home>false</home>
                <navigation_menu>false</navigation_menu>
              </visible>
            </brick>
          </bricks>
        </module_design>
      </module_designs>
    </itop_design>
    

    module.php

    SetupWebPage::AddModule(
        __FILE__, // Path to the current file, all other file names are relative to the directory containing this file
        'misitio-portal-url-button/1.0.0',
        array(
            // Identification
            'label' => 'Portal - Botón de URL',
            'category' => 'business',
    
            // Setup
            'dependencies' => array(
                //'itop-portal/3.2.0',
                'itop-portal-url-brick/1.1.1'
            ),
            'mandatory' => false,
            'visible' => true,
    
            // Components
            'datamodel' => array(
                'model.misitio-portal-url-button.php' => 'datamodel.xml'
            ),
            'webservice' => array(),
            'dictionary' => array(
    
                'es_CR.dict.misitio-portal-url-button.php'
            ),
            'data.struct' => array(),
            'data.sample' => array(),
    
            // Documentation
            'doc.manual_setup' => '',
            'doc.more_information' => '',
    
            // Default settings
            'settings' => array(),
        )
    );
    ?>
    
     

    Last edit: Carlos Cartechini 2025-08-27
  • Carlos Cartechini

    I tell you, I was able to make an intermediate page that then calls my site, in it I wanted to use UseRights: in the following way

    <?php
    require_once('../../approot.inc.php');
    require_once(APPROOT.'/application/application.inc.php');
    
    // Obtener el usuario actual
    $oUser = UserRights::GetUser();
    
    // Datos a enviar
     $userData = array(
       'itop_user' => oUser->Get('login'),
       'user_id' => $oUser->GetKey(),
       'user_name' => $oUser->Get('friendlyname'),
       'user_email' => $oUser->Get('email'),
       'token' => md5($oUser->Get('login') . 'clave-secreta') // Opcional: para validación
     );
    
    ?>
    <!DOCTYPE html>
    <html>
    <head>
      <title>Redireccionando...</title>
    </head>
    <body>
      <form id="postForm" action=">itopdes.misitio.com.ar/pages/pps-conf-ingresoreq/apps-conf-ingresoreq.php" method="post">
        <?php foreach ($userData as $name => $value): ?>
          <input type="hidden" name="<?= $name ?>" value="<?= htmlentities($value) ?>">
        <?php endforeach; ?>
      </form>
      <script>
        document.getElementById('postForm').submit();
      </script>
    </body>
    </html>
    

    But I still get a 500 error. If anyone could guide me, I'd be grateful.

     

    Last edit: Carlos Cartechini 2025-08-27
    • jf-cbd

      jf-cbd - 2025-09-01

      Hello, I didn't check all the details of your post, but did you check the logs and/or try some debugging (e.g. by showing PHP errors in your code) to see what is the cause of the 500 error ?

       
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2025-09-01
      'itop_user' => oUser->Get('login'),
    

    Looks like you're at least missing a $ in front of oUser.
    Also, the form action seems incorrect (I wouldn't expect > in front of your URL)

    Not 100% sure either if your foreach approach works or if they're considered individual PHP snippets.

     

    Last edit: Jeffrey Bostoen 2025-09-01
  • Carlos Cartechini

    Thanks for responding. I'm telling you, I found this way to do it. So far, I've got it figured out.

    $userData = array('itop_user' => $_SESSION['auth_user']  //$oUser->Get('login')
    

    Thank you very much.

     

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.