Exemplo n.º 1
0
function XMLParseDebutElement($parser, $name, $attrs)
{
    global $Xstring, $Xpath, $Xoptions, $Xtheme, $Xlasttag, $XlastName, $Xn, $Xcliststring, $Xtemp, $lastNB;
    $Xoptions = array();
    if (sizeof($attrs)) {
        while (list($k, $v) = each($attrs)) {
            $Xoptions[$k] = $v;
        }
    }
    if ($name == 'XMIND') {
        if ($Xoptions[THEME]) {
            $Xtheme = $Xoptions[THEME];
        } else {
            $Xtheme = 'default';
        }
        // theme par default
        $Xoptions[ONLOAD] = str_replace("'", "\\'", $Xoptions[ONLOAD]);
        if (!file_exists($Xpath . 'Xmind/themes/' . $Xtheme)) {
            die('Xmind error : le theme spécifié est introuvale !');
        }
        $Xstring .= '<html><head><title>' . $Xoptions[TITLE] . '</title>
  <script language="Javascript">var path="' . $Xpath . '"; var theme="' . $Xtheme . '"; </script> <script language="Javascript" src="' . $Xpath . 'Xmind/Xmind.js"></script><style type="text/css">' . XmindStyle($Xpath, $Xtheme) . '</style></head>
  <body leftmargin="' . $Xoptions[MARGE] . '" topmargin="' . $Xoptions[MARGE] . '"  onLoad="goDefault(\'' . $Xoptions[ONLOAD] . '\')" class="frame"><div style="z-index: 0; position: absolute; visibility: hidden; left: 500px"><iframe name="Xaction" id="Xaction" height="100" width="100" style="display:none;"></iframe></div>
  <form method="POST" TARGET=""><input type="hidden" name="Xtheme" value="' . $Xtheme . '"><input type="hidden" name="Xpath" value="' . $Xpath . '">';
    }
    if ($name == 'SCRIPT') {
        $Xstring .= '<script language="javascript">';
    }
    if ($name == 'TBOX') {
        if (!$Xoptions[SPAN]) {
            $Xoptions[SPAN] = 1;
        }
        $Xstring .= '<table cellpadding="' . $Xoptions[SPAN] . '" cellspacing="' . $Xoptions[SPAN] . '" height="' . $Xoptions[HEIGHT] . '" width="' . $Xoptions[WIDTH] . '" align="' . $Xoptions[ALIGN] . '" valign="' . $Xoptions[VALIGN] . '">';
    }
    if ($name == 'TR') {
        $Xstring .= '<tr>';
    }
    if ($name == 'TD') {
        if (!$Xoptions[VALIGN]) {
            $Xoptions[VALIGN] = 'middle';
        }
        $Xstring .= '<td height="' . $Xoptions[HEIGHT] . '" width="' . $Xoptions[WIDTH] . '" colspan="' . $Xoptions[COLSPAN] . '" rowspan="' . $Xoptions[ROWSPAN] . '" align="' . $Xoptions[ALIGN] . '" valign="' . $Xoptions[VALIGN] . '">';
    }
    if ($name == 'LAYER') {
        $Xstring .= '<div name="' . $Xoptions[NAME] . '" style="z-index: ' . $Xoptions[Z] . '; position: absolute; left:' . $Xoptions[X] . 'px; top:' . $Xoptions[Y] . 'px; width:' . $Xoptions[WIDTH] . 'px; height:' . $Xoptions[HEIGHT] . 'px" align="' . $Xoptions[ALIGN] . '" valign="' . $Xoptions[VALIGN] . '">';
    }
    if ($name == 'FRAME') {
        if (!$Xoptions[TALIGN]) {
            $Xoptions[TALIGN] = 'left';
        }
        if ($Xoptions[TITLE]) {
            $Xoptions[TITLE] = '<span class="frame">&nbsp;' . $Xoptions[TITLE] . '&nbsp;</span>';
        }
        $Xstring .= '<table height="' . $Xoptions[HEIGHT] . '" width="' . $Xoptions[WIDTH] . '" cellpadding="0" cellspacing="0" class="frame"><tr><td class="framea"></td><td class="frameab" align="' . $Xoptions[TALIGN] . '">' . $Xoptions[TITLE] . '</td><td class="frameb"></td></tr>';
        $Xstring .= '<tr><td class="frameac"></td><td class="frame"><table cellpadding="' . $Xoptions[MARGE] . '" cellspacing="' . $Xoptions[MARGE] . '" height="100%" width="100%"><tr><td height="100%" width="100%" align="' . $Xoptions[ALIGN] . '" valign="' . $Xoptions[VALIGN] . '">';
    }
    if ($name == 'NOTEBOOK') {
        $Xn[NOTEBOOK]++;
        if (!$Xoptions[NAME]) {
            $Xoptions[NAME] = 'notebook' . $Xn[NOTEBOOK];
        }
        $lastNB[1] = $Xoptions[NAME];
        $Xn[PAGE] = 1;
        if (!$Xoptions[PAGEON]) {
            $Xoptions[PAGEON] = 1;
        }
        $lastNB[0] = $Xoptions[PAGEON];
        $Xstring .= '<table id="' . $Xoptions[NAME] . '" last="' . $lastNB[0] . '" cellpadding="0" cellspacing="0" class="frame" width="' . $Xoptions[WIDTH] . '" height="' . $Xoptions[HEIGHT] . '"><tr><td class="pagea"></td><td class="pageab">';
        $tab = explode(',', $Xoptions[TITLES]);
        $Xstring .= '<table cellpadding="0" cellspacing="0"><tr>';
        for ($i = 0; $i < count($tab); $i++) {
            $j = $i + 1;
            if ($lastNB[0] == $j) {
                $on = 'On';
            } else {
                $on = 'Off';
            }
            $Xstring .= '<td id="Xpage_' . $Xoptions[NAME] . '_' . $j . 'a" class="pagea' . $on . '" onclick="NoteBookOnclick(\'' . $Xoptions[NAME] . '\', ' . $j . ')"></td><td id="Xpage_' . $Xoptions[NAME] . '_' . $j . 'ab" class="pageab' . $on . '" align="center" valign="middle" onclick="NoteBookOnclick(\'' . $Xoptions[NAME] . '\', ' . $j . ')">&nbsp;&nbsp;' . trim($tab[$i]) . '&nbsp;&nbsp;</td><td id="Xpage_' . $Xoptions[NAME] . '_' . $j . 'b" class="pageb' . $on . '" onclick="NoteBookOnclick(\'' . $Xoptions[NAME] . '\', ' . $j . ')"></td>';
        }
        $Xstring .= '</tr></table></td><td class="pageb"></td></tr><tr><td class="pageac"></td><td>';
    }
    if ($name == 'PAGE') {
        $Xstring .= '<div id="Xpage_' . $lastNB[1] . '_' . $Xn[PAGE] . '" style="width:100%; height:100%; display:';
        if ($lastNB[0] == $Xn[PAGE]) {
            $Xstring .= 'true';
        } else {
            $Xstring .= 'none';
        }
        $Xstring .= ';"><table cellpadding="' . $Xoptions[MARGE] . '" cellspacing="' . $Xoptions[MARGE] . '" height="100%" width="100%"><tr><td height="100%" width="100%" align="' . $Xoptions[ALIGN] . '" valign="' . $Xoptions[VALIGN] . '">';
        $Xn[PAGE]++;
    }
    if ($name == 'CLIST') {
        $Xtemp = '';
        $Xlasttag = $name;
        $XlastName = $Xoptions[NAME];
        $Xn[CLIST]++;
        if (!$Xoptions[NAME]) {
            $Xoptions[NAME] = 'clist' . $Xn[CLIST];
        }
        $XlastName = $Xoptions[NAME];
        if (!$Xoptions[COLUMNS]) {
            $Xoptions[COLUMNS] = 1;
        }
        $t = explode(',', trim($Xoptions[TITLES]));
        $w = explode(',', trim($Xoptions[CWIDTH]));
        $Xtemp[0] = explode(',', trim($Xoptions[CALIGN]));
        for ($i = 0; $i < $Xoptions[COLUMNS]; $i++) {
            if ($w[$i] < 50) {
                $w[$i] = 50;
            }
            if (!$w[$i] || $w[$i] < strlen($t[$i]) * 8 + 14) {
                $w[$i] = strlen($t[$i]) * 8 + 15;
            }
        }
        $Xtemp[1] = $w;
        if ($Xoptions[WIDTH] < array_sum($w) + 12) {
            $Xoptions[WIDTH] = array_sum($w) + 24;
        }
        if ($Xoptions[HEIGHT]) {
            $Xoptions[HEIGHT] -= 5;
        }
        $Xstring .= '<table height="' . $Xoptions[HEIGHT] . '" width="' . $Xoptions[WIDTH] . '" cellpadding="1" cellspacing="1" class="clist"><tr><td><div style="z-index: 0; width:' . $Xoptions[WIDTH] . 'px;"><table cellpadding="0" cellspacing="0"><tr>';
        for ($i = 0; $i < $Xoptions[COLUMNS]; $i++) {
            $Xstring .= '<td class="cclista"></td><td class="cclistab" style="width:' . ($w[$i] - 12) . 'px; height:20px;" align="' . trim($Xtemp[0][$i]) . '" valign="middle">' . trim($t[$i]) . '</td><td class="cclistb"></td><td></td>';
        }
        $Xstring .= '</tr></table></div><input id="' . $Xoptions[NAME] . '" name="' . $Xoptions[NAME] . '" type="hidden" real="Xclist' . $Xn[CLIST] . 'f"><iframe id="Xclist' . $Xn[CLIST] . 'f" name="Xclist' . $Xn[CLIST] . 'f" frameborder="0" width="100%" height="' . $Xoptions[HEIGHT] . '" src="' . $Xpath . 'Xmind/themes/' . $Xtheme . '/inclist.html" real="' . $Xoptions[NAME] . '"></iframe></td></tr></table>';
        $Xcliststring .= 'document.getElementById("Xclist' . $Xn[CLIST] . 'f").contentWindow.document.getElementById("content").innerHTML=\'<table border=0 cellpadding="0" cellspacing="0"><tbody id="content2"><tr>';
        for ($i = 0; $i < $Xoptions[COLUMNS]; $i++) {
            $Xcliststring .= '<td style="width:6px; height:1px;"></td><td id="td' . $i . '" style="width:' . ($w[$i] - 12) . 'px; height:1px;" align="' . trim($Xtemp[0][$i]) . '"></td><td style="width:6px; height:1px;"></td>';
        }
        $Xcliststring .= '</tr>';
    }
}
Exemplo n.º 2
0
function XMLParseDebutElement($parser, $name, $attrs)
{
    global $Xstring, $Xstring2, $Xpath, $Xoptions, $Xtheme, $Xlasttag, $XlastName, $Xn, $Yn, $Xbox, $Xtemp, $lastNB, $Xintegration;
    $Xoptions = array();
    if (sizeof($attrs)) {
        while (list($k, $v) = each($attrs)) {
            $Xoptions[$k] = $v;
        }
    }
    $Xlasttag = $name;
    $Yn[$name]++;
    if ($name == 'XMIND') {
        $Xn[XMIND]++;
        if ($Xoptions[THEME]) {
            $Xtheme = $Xoptions[THEME];
        } else {
            $Xtheme = 'default';
        }
        // theme par default
        $Xintegration = $Xoptions[INTEGRATIONTYPE];
        if ($Xoptions[ONLOAD]) {
            $Xoption[ONLOAD] = 'var defaultonload="' . str_replace("'", "\\'", $Xoptions[ONLOAD]) . '";';
        }
        if (!file_exists($Xpath . 'Xmind/themes/' . $Xtheme)) {
            die('Xmind error : le theme [' . $Xtheme . '] est introuvale !');
        }
        if ($Xintegration != 'plain') {
            $Xstring .= '<html><head><title>' . $Xoptions[TITLE] . '</title></head><body leftmargin="' . $Xoptions[MARGE] . '" topmargin="' . $Xoptions[MARGE] . '" class="frame">';
        }
        if ($Xn[XMIND] == 1) {
            $Xstring .= '<script language="Javascript">var path="' . $Xpath . '"; var theme="' . $Xtheme . '"; ' . $Xoption[ONLOAD] . '</script> <script language="Javascript" src="' . $Xpath . 'Xmind/Xmind.js"></script><style type="text/css">' . XmindStyle($Xpath, $Xtheme) . '</style>
  <div style="z-index: 0; position: absolute; visibility: hidden; left: 500px"><iframe name="Xaction" id="Xaction" height="100" width="100" style="display:none;"></iframe></div>
  <form method="POST" TARGET=""><input type="hidden" name="Xtheme" value="' . $Xtheme . '"><input type="hidden" name="Xpath" value="' . $Xpath . '">';
        }
    }
    if ($name == 'SCRIPT') {
        $Xstring .= '<script language="javascript">';
    }
    if ($name == 'CODE') {
        $Xtemp[CODE] = $Xoptions[NAME];
    }
    if ($name == 'HBOX' || $name == 'VBOX') {
        if (!$Xoptions[SPAN]) {
            $Xoptions[SPAN] = 1;
        }
        if (!$Xoptions[WIDTH]) {
            $Xoptions[WIDTH] = '100%';
        }
        $Xstring .= '<table cellpadding="0" cellspacing="' . $Xoptions[SPAN] . '" height="' . $Xoptions[HEIGHT] . '" width="' . $Xoptions[WIDTH] . '" align="' . $Xoptions[ALIGN] . '" valign="' . $Xoptions[VALIGN] . '"><tr><td align="center" valign="middle">';
        $Xtemp[BOX][++$Xbox] = $name;
    }
    if ($name == 'TBOX') {
        if (!$Xoptions[SPAN]) {
            $Xoptions[SPAN] = 1;
        }
        $Xstring .= '<table cellpadding="0" cellspacing="' . $Xoptions[SPAN] . '" height="' . $Xoptions[HEIGHT] . '" width="' . $Xoptions[WIDTH] . '" align="' . $Xoptions[ALIGN] . '" valign="' . $Xoptions[VALIGN] . '"  background="' . $Xoptions[BACKGROUND] . '">';
    }
    if ($name == 'TR') {
        $Xstring .= '<tr>';
    }
    if ($name == 'TD') {
        if (!$Xoptions[VALIGN]) {
            $Xoptions[VALIGN] = 'middle';
        }
        $Xstring .= '<td height="' . $Xoptions[HEIGHT] . '" width="' . $Xoptions[WIDTH] . '" colspan="' . $Xoptions[COLSPAN] . '" rowspan="' . $Xoptions[ROWSPAN] . '" align="' . $Xoptions[ALIGN] . '" valign="' . $Xoptions[VALIGN] . '" background="' . $Xoptions[BACKGROUND] . '">';
    }
    if ($name == 'LAYER') {
        $Xstring .= '<div name="' . $Xoptions[NAME] . '" style="z-index: ' . $Xoptions[Z] . '; position: absolute; left:' . $Xoptions[X] . 'px; top:' . $Xoptions[Y] . 'px; width:' . $Xoptions[WIDTH] . 'px; height:' . $Xoptions[HEIGHT] . 'px" align="' . $Xoptions[ALIGN] . '" valign="' . $Xoptions[VALIGN] . '">';
    }
    if ($name == 'FRAME') {
        if (!$Xoptions[VALIGN]) {
            $Xoptions[VALIGN] = 'top';
        }
        if (!$Xoptions[TALIGN]) {
            $Xoptions[TALIGN] = 'left';
        }
        if ($Xoptions[TITLE]) {
            $Xoptions[TITLE] = '<span class="frame">&nbsp;' . $Xoptions[TITLE] . '&nbsp;</span>';
        } else {
            $Xoptions[TITLE] = '&nbsp;<br>';
        }
        $Xstring .= '<table height="' . $Xoptions[HEIGHT] . '" width="' . $Xoptions[WIDTH] . '" cellpadding="0" cellspacing="0" class="frame"><tr><td class="framea"></td><td class="frameab" align="' . $Xoptions[TALIGN] . '">' . $Xoptions[TITLE] . '</td><td class="frameb"></td></tr>';
        $Xstring .= '<tr><td class="frameac"></td><td class="frame"><table cellpadding="' . $Xoptions[MARGE] . '" cellspacing="' . $Xoptions[MARGE] . '" height="100%" width="100%"><tr><td height="100%" width="100%" align="' . $Xoptions[ALIGN] . '" valign="' . $Xoptions[VALIGN] . '">';
    }
    if ($name == 'NOTEBOOK') {
        $Xn[NOTEBOOK]++;
        $Yb = $Yn[NOTEBOOK];
        if (!$Xoptions[NAME]) {
            $Xoptions[NAME] = 'notebook' . $Xn[NOTEBOOK];
        }
        $Xtemp[NOTEBOOK][$Yb][1] = $Xoptions[NAME];
        $Xn[PAGE][$Yb] = 1;
        if (!$Xoptions[PAGEON]) {
            $Xoptions[PAGEON] = 1;
        }
        $Xtemp[NOTEBOOK][$Yb][0] = $Xoptions[PAGEON];
        $Xstring .= '<table id="' . $Xoptions[NAME] . '" last="' . $Xtemp[NOTEBOOK][$Yb][0] . '" cellpadding="0" cellspacing="0" class="frame" width="' . $Xoptions[WIDTH] . '" height="' . $Xoptions[HEIGHT] . '"><tr><td class="pagea"></td><td class="pageab">';
        $tab = explode(',', $Xoptions[TITLES]);
        $Xstring .= '<table cellpadding="0" cellspacing="0"><tr>';
        for ($i = 0; $i < count($tab); $i++) {
            $j = $i + 1;
            if ($Xtemp[NOTEBOOK][$Yb][0] == $j) {
                $on = 'On';
            } else {
                $on = 'Off';
            }
            $Xstring .= '<td id="Xpage_' . $Xoptions[NAME] . '_' . $j . 'a" class="pagea' . $on . '" onclick="NoteBookOnclick(\'' . $Xoptions[NAME] . '\', ' . $j . ')"></td><td id="Xpage_' . $Xoptions[NAME] . '_' . $j . 'ab" class="pageab' . $on . '" align="center" valign="middle" onclick="NoteBookOnclick(\'' . $Xoptions[NAME] . '\', ' . $j . ')">&nbsp;&nbsp;' . trim($tab[$i]) . '&nbsp;&nbsp;</td><td id="Xpage_' . $Xoptions[NAME] . '_' . $j . 'b" class="pageb' . $on . '" onclick="NoteBookOnclick(\'' . $Xoptions[NAME] . '\', ' . $j . ')"></td>';
        }
        $Xstring .= '</tr></table></td><td class="pageb"></td></tr><tr><td class="pageac"></td><td>';
    }
    if ($name == 'PAGE') {
        $Yb = $Yn[NOTEBOOK];
        $Xstring .= '<div id="Xpage_' . $Xtemp[NOTEBOOK][$Yb][1] . '_' . $Xn[PAGE][$Yb] . '" style="width:100%; height:100%; display:';
        if ($Xtemp[NOTEBOOK][$Yb][0] == $Xn[PAGE][$Yb]) {
            $Xstring .= 'true';
        } else {
            $Xstring .= 'none';
        }
        $Xstring .= ';"><table cellpadding="' . $Xoptions[MARGE] . '" cellspacing="' . $Xoptions[MARGE] . '" height="100%" width="100%"><tr><td height="100%" width="100%" align="' . $Xoptions[ALIGN] . '" valign="' . $Xoptions[VALIGN] . '">';
        $Xn[PAGE][$Yb]++;
    }
    if ($name == 'CLIST') {
        $Xtemp = '';
        $Xlasttag = $name;
        $XlastName = $Xoptions[NAME];
        $Xn[CLIST]++;
        if (!$Xoptions[NAME]) {
            $Xoptions[NAME] = 'clist' . $Xn[CLIST];
        }
        $XlastName = $Xoptions[NAME];
        if (!$Xoptions[COLUMNS]) {
            $Xoptions[COLUMNS] = 1;
        }
        $t = explode(',', trim($Xoptions[TITLES]));
        $w = explode(',', trim($Xoptions[CWIDTH]));
        $Xtemp[0] = explode(',', trim($Xoptions[CALIGN]));
        for ($i = 0; $i < $Xoptions[COLUMNS]; $i++) {
            if ($w[$i] < 50) {
                $w[$i] = 50;
            }
            if (!$w[$i] || $w[$i] < strlen($t[$i]) * 8 + 14) {
                $w[$i] = strlen($t[$i]) * 8 + 15;
            }
        }
        $Xtemp[1] = $w;
        if ($Xoptions[WIDTH] < array_sum($w) + 12) {
            $Xoptions[WIDTH] = array_sum($w) + 24;
        }
        if ($Xoptions[HEIGHT]) {
            $Xoptions[HEIGHT] -= 5;
        }
        $Xstring .= '<table height="' . $Xoptions[HEIGHT] . '" width="' . $Xoptions[WIDTH] . '" cellpadding="1" cellspacing="1" class="clist"><tr><td><div style="z-index: 0; width:' . $Xoptions[WIDTH] . 'px;"><table cellpadding="0" cellspacing="0"><tr>';
        for ($i = 0; $i < $Xoptions[COLUMNS]; $i++) {
            $Xstring .= '<td class="cclista"></td><td class="cclistab" style="width:' . ($w[$i] - 12) . 'px; height:20px;" align="' . trim($Xtemp[0][$i]) . '" valign="middle">' . trim($t[$i]) . '</td><td class="cclistb"></td><td></td>';
        }
        $Xstring .= '</tr></table></div><input id="' . $Xoptions[NAME] . '" name="' . $Xoptions[NAME] . '" type="hidden" real="Xclist' . $Xn[CLIST] . 'f"><iframe id="Xclist' . $Xn[CLIST] . 'f" name="Xclist' . $Xn[CLIST] . 'f" frameborder="0" width="100%" height="' . $Xoptions[HEIGHT] . '" src="' . $Xpath . 'Xmind/themes/' . $Xtheme . '/inclist.php?clist=' . $Xn[CLIST] . '" real="' . $Xoptions[NAME] . '"></iframe></td></tr></table>';
        $Xstring .= '<script language="Javascript">function ClistDefault' . $Xn[CLIST] . '() { document.getElementById("Xclist' . $Xn[CLIST] . 'f").contentWindow.document.getElementById("content").innerHTML=\'<table border=0 cellpadding="0" cellspacing="0"><tbody id="content2"><tr>';
        for ($i = 0; $i < $Xoptions[COLUMNS]; $i++) {
            $Xstring .= '<td style="width:6px; height:1px;"></td><td id="td' . $i . '" style="width:' . ($w[$i] - 12) . 'px; height:1px;" align="' . trim($Xtemp[0][$i]) . '"></td><td style="width:6px; height:1px;"></td>';
        }
        $Xstring .= '</tr>';
    }
    if ($name == 'MENUBAR') {
        $Xn[MENUBAR]++;
        $Xtemp[menubar] = 1;
        if (!$Xoptions[NAME]) {
            $Xoptions[NAME] = 'menubar' . $Xn[MENUBAR];
        }
        $Xstring .= '<table id="' . $Xoptions[NAME] . '" cellpadding="1" cellspacing="1" width="' . $Xoptions[WIDTH] . '" class="menubar"><tr>';
        $tab = explode(',', $Xoptions[TITLES]);
        $i = 0;
        if ($tab) {
            foreach ($tab as $t) {
                $menu = 'menu' . $Xn[MENUBAR] . '_' . ($Xn[MENU] + $i + 1);
                $Xstring .= '<td width="1%" height="21" onclick="traceMenu(this,\'' . $menu . '\')" onmouseover="traceTitreMenu(this,\'' . $menu . '\')"  onmouseout="closeLastTitreMenu()" class="itembar">&nbsp;&nbsp;' . trim($t) . '&nbsp;&nbsp;</td>';
                $i++;
            }
        }
        $Xstring .= '<td></td></tr></table>' . XmindBetweenBox($Xtemp, $Xbox);
    }
    if ($name == 'MENU') {
        $Xn[MENU]++;
        if (!$Xoptions[NAME] || $Xtemp[menubar]) {
            $Xoptions[NAME] = 'menu' . $Xn[MENUBAR] . '_' . $Xn[MENU];
        }
        $Xstring2 .= '<div id="' . $Xoptions[NAME] . '" style="z-index: 0; position: absolute; top:10px; left:10px; visibility: hidden;"><table cellpadding="0" cellspacing="0" class="menu">';
    }
}