Esempio n. 1
0
 public function getHtmlForUrl(UrlRequestObject $urlRequestObject)
 {
     $steam = $GLOBALS["STEAM"];
     //current room steam object
     if (isset($object) && (int) $object != 0) {
         $current_room = steam_factory::get_object($steam->get_id(), $object);
     } else {
         $current_room = $steam->get_current_steam_user()->get_workroom();
     }
     //current room steam object
     //$current_room = ($object != 0)?new steam_object($object):$steam->get_workroom_user($steam->login_user);
     $current_room_path = $current_room->get_path(1);
     $current_room_data = $current_room->get_attributes(array(OBJ_NAME, OBJ_DESC, OBJ_LAST_CHANGED, "bid:tags", "bid:presentation", "bid:collectiontype", "bid:description"), 1);
     $current_room_creator = $current_room->get_creator(1);
     //check if user may write in this folder
     $write_allowed = $current_room->check_access_write($steam->get_current_steam_user(), 1);
     //get inventory and inventorys attributes if allowed to
     $allowed = $current_room->check_access_read($steam->get_current_steam_user(), 1);
     $result = $steam->buffer_flush();
     $write_allowed = $result[$write_allowed];
     $allowed = $result[$allowed];
     $current_room_path = $result[$current_room_path];
     $current_room_data = $result[$current_room_data];
     $current_room_creator = $result[$current_room_creator];
     $current_room_creator_name = $current_room_creator->get_name();
     $current_room_display_name = str_replace("'s workarea", "", stripslashes($current_room_data[OBJ_NAME]));
     if (isset($current_room_data[OBJ_DESC]) && $current_room_data[OBJ_DESC] != "") {
         $current_room_display_name = $current_room_data[OBJ_DESC];
     }
     $current_room_display_name = str_replace("s workroom.", "", $current_room_display_name);
     $current_room_display_name = str_replace("s workroom", "", $current_room_display_name);
     $current_room_display_name = preg_replace("/.*'s bookmarks/", "Lesezeichen", $current_room_display_name);
     if ($allowed && $current_room instanceof steam_container) {
         $inventory = $current_room->get_inventory("", array("DOC_MIME_TYPE", "DOC_LAST_MODIFIED", "CONT_LAST_MODIFIED", "OBJ_LAST_CHANGED", "bid:tags", "bid:presentation", "bid:collectiontype", "bid:hidden", "bid:doctype", "bid:description", "DOC_EXTERN_URL", "OBJ_CREATION_TIME"));
     } else {
         $inventory = array();
     }
     if (sizeof($inventory) > 0) {
         $hascontent = true;
     } else {
         $hascontent = false;
     }
     //get head mounted content if needed
     $head_mounted = $current_room_data["bid:presentation"] === "head" && is_array($inventory) && isset($inventory[0]) && $inventory[0] instanceof steam_document;
     if ($head_mounted) {
         $tmp_content = new doc_content($steam, $inventory[0]);
         $head_mounted_content = $tmp_content->get_content($config_webserver_ip);
     }
     //******************************************************
     //** Display Stuff
     //******************************************************
     //template stuff
     $contenttemplate = new HTML_TEMPLATE_IT();
     $contenttemplate->loadTemplateFile($this->getExtensionPath() . "ui/taggedfolder.template.html");
     $contenttemplate->setVariable("FOLDER_ID", $current_room->get_id());
     $contenttemplate->setVariable("FOLDER_NAME", $current_room_display_name);
     //$contenttemplate->setVariable("FOLDER_PATH", PATH_URL . $current_room_path . "/");
     //$contenttemplate->setVariable("FOLDER_ICON", (($current_room_data["bid:presentation"] === "index")?"$config_webserver_ip/icons/mimetype/folder_closed_index.gif":"$config_webserver_ip/icons/mimetype/folder_closed.gif"));
     $contenttemplate->setVariable("FOLDER_LAST_CHANGED", date("d.m.Y H:i", $current_room_data[OBJ_LAST_CHANGED]));
     if (sizeof($inventory) == 0) {
         $contenttemplate->setCurrentBlock("no_content");
         $contenttemplate->setVariable("LANGUAGE_NO_CONTENT", gettext("LANGUAGE_NO_CONTENT"));
         $contenttemplate->parse("no_content");
     }
     return $contenttemplate->get();
     //set menu to write mode, if the user's access rights allow so and the user is not the guest user
     if ($write_allowed && $steam->get_login_user()->get_name() != "guest") {
         //$tpl->set_var("MENU",derive_menu("contentframe", $current_room, $current_room_path, 2));
     }
     //display directory
     //$content = false;
     $tnr = array();
     foreach ($inventory as $item) {
         $tnr[$item->get_id()] = array();
         $tnr[$item->get_id()]["creator"] = $item->get_creator(1);
         $tnr[$item->get_id()]["writeaccess"] = $item->check_access_write($steam->get_login_user(), 1);
         if ($item instanceof steam_document) {
             $tnr[$item->get_id()]["contentsize"] = $item->get_content_size(1);
         }
         if ($item instanceof steam_link) {
             $tnr[$item->get_id()]["link_object"] = $item->get_link_object(1);
         }
     }
     $result = $steam->buffer_flush();
     $creators = array();
     $linktargets = array();
     $accessresult = array();
     $sizeresult = array();
     foreach ($inventory as $item) {
         $creators[$item->get_id()] = $result[$tnr[$item->get_id()]["creator"]];
         $accessresult[$item->get_id()] = $result[$tnr[$item->get_id()]["writeaccess"]];
         if ($item instanceof steam_document) {
             $sizeresult[$item->get_id()] = $result[$tnr[$item->get_id()]["contentsize"]];
         }
         if ($item instanceof steam_link) {
             $linktargets[$item->get_id()] = $result[$tnr[$item->get_id()]["link_object"]];
         }
     }
     steam_factory::load_attributes($steam, $creators, array(OBJ_NAME));
     // If you want to use further Methods of caching e.g. PHP PEARs Cache_Lite
     // insert caching mechanisms in here...
     // below this, the steam connector is no longer used...
     $tags = array();
     foreach ($inventory as $item) {
         if (!$item instanceof steam_trashbin) {
             $itemname = $item->get_attribute(OBJ_NAME);
             $itemdescription = $item->get_attribute(OBJ_DESC);
             $itemmimetype = $item->get_attribute(DOC_MIME_TYPE);
             $lastchanged = $item->get_attribute(DOC_LAST_MODIFIED);
             if ($lastchanged === 0) {
                 $lastchanged = $item->get_attribute(OBJ_CREATION_TIME);
             }
             // set display name
             if ($itemdescription != "") {
                 $object_display_name = $itemdescription;
             } else {
                 $object_display_name = stripslashes($itemname);
             }
             $owner = $creators[$item->get_id()]->get_name();
             $bidDescription = $item->get_attribute("bid:description");
             $bidTags = $item->get_attribute("bid:tags");
             if (!$bidDescription) {
                 $bidDescription = "";
             }
             if (!$bidTags) {
                 $bidTags = "";
             }
             foreach (explode(" ", $bidTags) as $tag) {
                 $tag = trim($tag);
                 if (strlen($tag) > 0) {
                     if (!in_array($tag, $tags)) {
                         array_push($tags, $tag);
                     }
                 }
             }
             $tpl->set_var(array("OBJECT_ID" => $item->get_id(), "OBJECT_NAME" => $object_display_name, "OBJECT_NAME_GREY" => $object_display_name, "OBJECT_FILENAME" => stripslashes($itemname), "OBJECT_LAST_CHANGED" => date("d.m.Y H:i", $lastchanged), "bid:description" => $bidDescription, "bid:tags" => $bidTags, "OBJECT_OWNER" => $owner));
             if ($show_hidden) {
                 if ($content == false && $head_mounted) {
                     $tpl->parse("OBJECT_NAME", "head_mounted_name");
                 } else {
                     if ($item->get_attribute("bid:hidden")) {
                         $tpl->parse("OBJECT_NAME", "grey_name");
                     }
                 }
             } else {
                 if ($item->get_attribute("bid:hidden")) {
                     continue;
                 }
             }
             //parse correct Properties symbol
             $access = $accessresult[$item->get_id()];
             $tpl->parse("ITEM_PROPERTIES", $access ? "item_properties_on" : "item_properties_off");
             $visible = false;
             // render a steam_document
             if ($item instanceof steam_document) {
                 //derive mimetype
                 $mimetype = derive_icon(array("object" => $item, "name" => $itemname, "bid:collectiontype" => $item->get_attribute("bid:collectiontype"), "bid:doctype" => $item->get_attribute("bid:doctype"), "mimetype" => $itemmimetype));
                 //derive size
                 $size = $sizeresult[$item->get_id()];
                 $tpl->set_var(array("OBJECT_SIZE" => $size > 1048576 ? round($size / 1048576 + 0.05, 1) . " MB" : round($size / 1024 + 0.5) . " kB", "OBJECT_ICON" => $mimetype));
                 //care for documents not to be displayed in the browser
                 if ($itemmimetype === "text/html" || $itemmimetype === "text/plain" || $itemmimetype === "text/css" || $itemmimetype === "text/xml" || $itemmimetype === "application/vnd.google-earth.kml+xml" || $itemmimetype === "image/gif" || $itemmimetype === "image/jpg" || $itemmimetype === "image/jpeg" || $itemmimetype === "image/png") {
                     $tpl->parse("ITEM_LINK", "document");
                     $tpl->parse("DOCUMENTS", "item", true);
                 } else {
                     $tpl->parse("ITEM_LINK", "nb_document");
                     $tpl->parse("DOCUMENTS", "item", true);
                 }
                 $visible = true;
             } else {
                 if ($item instanceof steam_link || $item instanceof steam_exit) {
                     $linked_object = $linktargets[$item->get_id()];
                     if ($item instanceof steam_link) {
                         if ($itemdescription != "") {
                             $name = $itemdescription;
                         } else {
                             $name = $itemname;
                         }
                         if ($linked_object instanceof steam_document) {
                             $size = $linked_object->get_content_size();
                             $tpl->set_var(array("OBJECT_SIZE" => $size > 1048576 ? round($size / 1048576 + 0.05, 1) . " MB" : round($size / 1024 + 0.5) . " kB"));
                         } else {
                             $tpl->set_var(array("OBJECT_SIZE" => ""));
                         }
                     }
                     if ($item instanceof steam_exit) {
                         if ($itemdescription != "") {
                             $name = str_replace("s workroom.", "", stripslashes($itemdescription));
                         } else {
                             $name = str_replace("'s workarea", "", stripslashes($itemname));
                         }
                     }
                     //derive mimetype
                     $mimetype = derive_icon(array("object" => $item, "name" => $itemname, "bid:collectiontype" => $item->get_attribute("bid:collectiontype"), "bid:doctype" => $item->get_attribute("bid:doctype"), "mimetype" => $itemmimetype));
                     $tpl->set_var(array("LINK_OBJECT_ID" => is_object($linked_object) ? $linked_object->get_id() : -1, "OBJECT_NAME" => $name, "OBJECT_ICON" => $mimetype));
                     $tpl->parse("ITEM_LINK", "link");
                     $tpl->parse("DOCUMENTS", "item", true);
                     $visible = true;
                 } else {
                     if ($item instanceof steam_docextern) {
                         $url = derive_url($item->get_attribute(DOC_EXTERN_URL));
                         $tpl->set_var(array("OBJECT_SIZE" => "", "OBJECT_LINK" => $url, "OBJECT_ICON" => "./icons/mimetype/www.gif"));
                         $tpl->parse("ITEM_LINK", "www-link");
                         $tpl->parse("DOCUMENTS", "item", true);
                         $visible = true;
                     } else {
                         if ($item->get_attribute("bid:doctype") != "") {
                             $icon = array("bid:doctype" => $item->get_attribute("bid:doctype"));
                             $tpl->set_var(array("OBJECT_SIZE" => "", "OBJECT_ICON" => derive_icon($icon)));
                             $tpl->parse("ITEM_LINK", "folder");
                             $tpl->parse("DOCUMENTS", "item", true);
                             $visible = true;
                         } else {
                             if ($item instanceof steam_messageboard) {
                                 $icon = array("object" => $item);
                                 $tpl->set_var(array("OBJECT_NAME" => stripslashes($itemname), "OBJECT_NAME_GREY" => stripslashes($itemname), "OBJECT_SIZE" => "", "OBJECT_ICON" => derive_icon($icon)));
                                 $tpl->parse("ITEM_LINK", "folder");
                                 $tpl->parse("DOCUMENTS", "item", true);
                                 $visible = true;
                             } else {
                                 if ($item instanceof steam_container && !$item instanceof steam_user) {
                                     $icon = array("object" => $item, "bid:collectiontype" => $item->get_attribute("bid:collectiontype"), "bid:presentation" => $item->get_attribute("bid:presentation"));
                                     $icon = derive_icon($icon);
                                     $lastchanged = $item->get_attribute("CONT_LAST_MODIFIED");
                                     if ($lastchanged === 0) {
                                         $lastchanged = $item->get_attribute(OBJ_CREATION_TIME);
                                     }
                                     $tpl->set_var(array("OBJECT_SIZE" => "", "OBJECT_ICON" => $icon, "OBJECT_LAST_CHANGED" => date("d.m.Y H:i", $lastchanged)));
                                     $tpl->parse("ITEM_LINK", "folder");
                                     $tpl->parse("DOCUMENTS", "item", true);
                                     $visible = true;
                                 }
                             }
                         }
                     }
                 }
             }
             //parse javascript mark/unmark
             if ($visible) {
                 $tpl->parse("MARK", "mark", 1);
                 $tpl->parse("UNMARK", "unmark", 1);
             }
             $content = $content || $visible;
         }
     }
     //  if(!$content) $tpl->parse("DOCUMENTS", "no_content");
     natsort($tags);
     $tagString = implode(" ", $tags);
     $tpl->set_var(array("TAGS" => $tagString));
     $_SESSION["tags"] = $tagString;
     out();
     //Logout & Disconnect
     $steam->disconnect();
     function out()
     {
         //parse all out
         global $tpl;
         $tpl->parse("OUT", "content");
         $tpl->p("OUT");
     }
 }
Esempio n. 2
0
                 $icon = array("bid:doctype" => $item->get_attribute("bid:doctype"));
                 $tpl->set_var(array("OBJECT_SIZE" => "", "OBJECT_ICON" => derive_icon($icon)));
                 $tpl->parse("ITEM_LINK", "folder");
                 $tpl->parse("DOCUMENTS", "item", true);
                 $visible = true;
             } else {
                 if ($item instanceof steam_messageboard) {
                     $icon = array("object" => $item);
                     $tpl->set_var(array("OBJECT_NAME" => stripslashes($itemname), "OBJECT_NAME_GREY" => stripslashes($itemname), "OBJECT_SIZE" => "", "OBJECT_ICON" => derive_icon($icon)));
                     $tpl->parse("ITEM_LINK", "folder");
                     $tpl->parse("DOCUMENTS", "item", true);
                     $visible = true;
                 } else {
                     if ($item instanceof steam_container && !$item instanceof steam_user) {
                         $icon = array("object" => $item, "bid:collectiontype" => $item->get_attribute("bid:collectiontype"), "bid:presentation" => $item->get_attribute("bid:presentation"));
                         $icon = derive_icon($icon);
                         $lastchanged = $item->get_attribute("CONT_LAST_MODIFIED");
                         if ($lastchanged === 0) {
                             $lastchanged = $item->get_attribute(OBJ_CREATION_TIME);
                         }
                         $tpl->set_var(array("OBJECT_SIZE" => "", "OBJECT_ICON" => $icon, "OBJECT_LAST_CHANGED" => date("d.m.Y H:i", $lastchanged)));
                         $tpl->parse("ITEM_LINK", "folder");
                         $tpl->parse("DOCUMENTS", "item", true);
                         $visible = true;
                     }
                 }
             }
         }
     }
 }
 //parse javascript mark/unmark
Esempio n. 3
0
        $tpl->parse("BUTTON_LABEL", "text_button");
        break;
    case "html":
        $tpl->set_var("MIME_TYPE", "text/html");
        $tpl->parse("TITLE", "text_title");
        $tpl->parse("CONTENT", "text_form");
        $tpl->parse("BUTTON_LABEL", "text_button");
        break;
    case "link":
        $tpl->parse("TITLE", "link_title");
        $tpl->parse("CONTENT", "link_form");
        $tpl->parse("BUTTON_LABEL", "link_button");
        break;
    case "delete":
        foreach ($names as $item) {
            $tpl->set_var(array("OBJECT_ID" => $item->object->get_id(), "OBJECT_ICON" => derive_icon(array("object" => $item->object, "name" => $item->arguments[OBJ_NAME], "bid:doctype" => $item->arguments["bid:doctype"])), "OBJECT_NAME" => $item->arguments[OBJ_NAME]));
            $tpl->parse("DELETE_FORM_ROW", "delete_form_row", 1);
        }
        $tpl->parse("TITLE", "delete_title");
        $tpl->parse("CONTENT", "delete_form");
        $tpl->parse("BUTTON_LABEL", "delete_button");
        break;
    default:
        $tpl->parse("TITLE", "error_title");
        $tpl->parse("CONTENT", "error_form");
        $tpl->parse("BUTTON_LABEL", "error_button");
        break;
}
//parse all out
$tpl->parse("OUT", "content");
$tpl->p("OUT");
Esempio n. 4
0
    }
    //parse out doc content or appropriate link
    if ($item instanceof steam_document) {
        $content = new doc_content($steam, $item);
        $tpl->set_var("DOCUMENT_CONTENT", $content->get_content($config_webserver_ip));
        $tpl->parse("DOCUMENTS", "document", true);
    } else {
        $attributes["object"] = $item;
        $tpl->set_var(array("OBJECT_ID" => $item->get_id(), "OBJECT_NAME" => stripslashes($item->get_attribute(OBJ_NAME))));
        //parse out link
        if ($item instanceof steam_docextern) {
            $url = derive_url($item->get_attribute(DOC_EXTERN_URL));
            $tpl->set_var("OBJECT_LINK", $url);
            $tpl->parse("DOCUMENTS", "link", true);
        } else {
            $tpl->set_var(array("OBJECT_NAME" => $item->get_attribute(OBJ_NAME), "OBJECT_ICON" => derive_icon($attributes)));
            $tpl->parse("DOCUMENTS", "folder", true);
        }
    }
}
//Logout & Disconnect
$steam->disconnect();
out();
function out()
{
    //parse all out
    global $tpl;
    $tpl->parse("OUT", "content");
    $tpl->p("OUT");
    exit;
}
Esempio n. 5
0
$tpl->set_block("content", "nextpage", "DUMMY");
$tpl->set_block("content", "noresults", "DUMMY");
$tpl->set_var(array("FORM_NAME" => "bid_search", "FORM_URL" => "index.php", "PREVIOUSPAGENUMBER" => $previouspage, "NEXTPAGENUMBER" => $nextpage, "DUMMY" => ""));
if ($haspreviouspage) {
    $tpl->parse("PREVIOUSPAGELINK", "previouspage");
} else {
    $tpl->parse("PREVIOUSPAGELINK", "");
}
if ($hasnextpage) {
    $tpl->parse("NEXTPAGELINK", "nextpage");
} else {
    $tpl->parse("NEXTPAGELINK", "");
}
if (sizeof($page) > 0) {
    foreach ($page as $key => $value) {
        $icon = derive_icon(array("name" => $value["OBJ_NAME"], "bid:collectiontype" => $value["bid:collectiontype"], "bid:doctype" => $value["bid:doctype"], "mimetype" => $value["DOC_MIME_TYPE"]));
        $tpl->set_var(array("OBJ_NAME" => $value["OBJ_NAME"], "OBJ_ID" => $key, "OBJ_DESC" => $value["OBJ_DESC"] != "" ? $value["OBJ_DESC"] : "-", "USERFIRSTNAME" => $value["USER_FULLNAME"], "USERLASTNAME" => $value["USER_FIRSTNAME"], "LASTCHANGE" => date("d.m.Y - H:i:s", $value["OBJ_LAST_CHANGED"]), "CREATED" => date("d.m.Y - H:i:s", $value["OBJ_CREATION_TIME"]), "OBJ_ICON" => $icon));
        if ($value["isuser"] == true) {
            $tpl->parse("ENTRIES", "userresultentry", true);
        } else {
            if ($value["isgroup"] == true) {
                $tpl->parse("ENTRIES", "groupresultentry", true);
            } else {
                $tpl->parse("ENTRIES", "resultentry", true);
            }
        }
    }
} else {
    $tpl->parse("ENTRIES", "noresults");
}
$tpl->parse("OUT", "content");