Using midcom_auth with midcom-template

Tarjei Huse <tarjei-y/[email protected]>
Newsgroups gmane.comp.web.midgard.user
Message-ID <[email protected]>
Hi, for those who like to stay on the edge, here's how to use
midcom_auth instead of nemein auth with midcom-template:

You have to edit the pageelement edit-this-page. The easiest way is to
change it to this:

<?php
/*
  Edit This Page controls based on NAP information and ownerships
  Author: Henri Bergius ([email protected])
  The Midgard Project, Nemein Oy

  2004-03-24: Added person ownership recognition for
net.nemein.personnel topics (bergie)
  2004-06-03: Added check for whether user is at enabled editing port
(bergie)
  2004-08-24: Localized messages used in MidCOM context (bergie)
  2004-12-08: Reverted to the new MidCOM toolbar API and different
markup (bergie)
*/
?>
<div class="edit-this-page">
<?php
if ((!$GLOBALS["midcom_site"]['ais_port'] ||
$GLOBALS["midcom_site"]['host']->port ==
$GLOBALS["midcom_site"]['ais_port']) && 
    !is_null($_MIDCOM->auth->user) && 
    $_MIDGARD['self'] == $GLOBALS["midcom_site"]['uri'] && 
    !$GLOBALS["midcom_site"]['initialization_failed']) {

    $curr_leaf = $GLOBALS["midcom_site"]['nap']->get_current_leaf();
    if ($curr_leaf !== false) {

      $component =
$GLOBALS["midcom"]->get_context_data(MIDCOM_CONTEXT_COMPONENT);
      $leaf = $GLOBALS["midcom_site"]['nap']->get_leaf($curr_leaf);
      if ($component == "de.linkm.taviewer" && $leaf[MIDCOM_NAV_URL] ==
"") {

        // Index article, instantiate MidCOM toolbar system in combined
mode
        $toolbar =
$GLOBALS["midcom_site"]["nap"]->get_combined_toolbar($GLOBALS["midcom_site"]["uri"]."midcom-admin/ais/");

      } else {

        // Instantiate MidCOM toolbar system for leaf
        $toolbar =
$GLOBALS["midcom_site"]["nap"]->get_leaf_toolbar($GLOBALS["midcom_site"]["uri"]."midcom-admin/ais/");

      }
    } else {

      // Instantiate MidCOM toolbar system for node
      $toolbar =
$GLOBALS["midcom_site"]["nap"]->get_node_toolbar($GLOBALS["midcom_site"]["uri"]."midcom-admin/ais/");

    } 
    // Add a logout link
    $toolbar->add_item(array(
        MIDCOM_TOOLBAR_URL =>
$GLOBALS["midcom_site"]['uri'].'midcom-logout-',
        MIDCOM_TOOLBAR_LABEL =>
$GLOBALS["midcom_site"]['l10n']->get("logout"),
        MIDCOM_TOOLBAR_HELPTEXT => null,
        MIDCOM_TOOLBAR_ICON =>
MIDCOM_STATIC_URL."/stock-icons/16x16/exit.png",
        MIDCOM_TOOLBAR_ENABLED => true
    ));

    // Show the toolbar
    echo $toolbar->render();

} else {
//  if ($GLOBALS["midcom_site"]['ais_login'] != "NO" &&
is_null($_MIDCOM->auth)) {
  if ( is_null($_MIDCOM->auth->user)) {
          $_MIDCOM->auth->_auth_frontend->show_authentication_form();
  }
} ?>
</div>

Tarjei


-- 
Tarjei Huse <tarjei-y/[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.