Esempio n. 1
0
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        $ajaxResponseObject->setStatus("ok");
        $current_room = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
        $portal = \steam_factory::create_docextern($GLOBALS["STEAM"]->get_id(), strip_tags($this->params["name"]), strip_tags($this->params["url"]), $current_room, "");
        $jswrapper = new \Widgets\JSWrapper();
        $jswrapper->setJs(<<<END
\t\tcloseDialog();
\t\tsendRequest("LoadContent", {"id":"{$this->id}"}, "explorerWrapper", "updater", null, null, "explorer");
END
);
        $ajaxResponseObject->addWidget($jswrapper);
        return $ajaxResponseObject;
    }
Esempio n. 2
0
     $hint = gettext("Please insert the URL, starting with 'http://'") . " ";
 }
 if (empty($values["name"])) {
     $problem .= gettext("The name is missing.");
     $hint .= gettext("How is the title of the webpage?");
 } else {
     if (strpos($values["name"], "/")) {
         if (!isset($problem)) {
             $problem = "";
         }
         $problem .= gettext("Please don't use the \"/\"-char in the name of the weblink.");
     }
 }
 if (empty($problem)) {
     if (!is_object($docextern)) {
         $docextern = steam_factory::create_docextern($GLOBALS["STEAM"]->get_id(), $values["name"], $values["url"], $env, $values["desc"]);
     } else {
         if (empty($values["desc"])) {
             $docextern->delete_attribute("OBJ_DESC");
         } else {
             $docextern->set_attribute("OBJ_DESC", $values["desc"]);
         }
         $docextern->set_name($values["name"]);
         $docextern->set_url($values["url"]);
     }
     header("Location: " . $values["return_to"]);
     exit;
 } else {
     $portal->set_problem_description($problem, $hint);
     $content->setVariable("VALUE_NAME", h($values["name"]));
     $content->setVariable("VALUE_URL", h($values["url"]));
Esempio n. 3
0
            foreach ($obj->attributes() as $attribute => $value) {
                if ($attribute == "tag") {
                    $delicious_tags[] = "" . $value;
                }
            }
        }
        if (!isset($delicious_tags)) {
            echo "<script type='text/javascript'>alert('login failed.');</script>";
        }
    }
}
// action: import links
if (isset($_POST["selected_posts"])) {
    foreach ($_POST["selected_posts"] as $post_hash) {
        $post = $_POST["delicious"][$post_hash];
        $obj = steam_factory::create_docextern($steam, urlencode($post["href"]), $post["href"], $current_room, $post["description"]);
        $obj->set_attributes(array("hash" => $post_hash, "others" => $post["others"], "tag" => $post["tag"], "time" => $post["time"]));
    }
    // close this popup
    echo "<script type=\"text/javascript\">opener.location.reload();window.close();</script>";
}
//******************************************************
//** Display Stuff
//******************************************************
//template stuff
$tpl = new Template("./templates/{$language}", "keep");
$tpl->set_file("content", "delicious_import.ihtml");
$tpl->set_block("content", "getposts_title", "DUMMY");
$tpl->set_block("content", "getposts_form", "DUMMY");
$tpl->set_block("content", "getposts_button", "DUMMY");
$tpl->set_block("content", "import_title", "DUMMY");
Esempio n. 4
0
 public function blogroll_add_blog($name, $url, $dsc = "")
 {
     $blogroll = $this->get_blogroll();
     $blog = steam_factory::create_docextern($this->steam_connector->get_id(), $name, $url, $blogroll, $dsc);
     return $blog;
 }
Esempio n. 5
0
 $values = $_POST["values"];
 // ABFRAGEN
 $problems = "";
 $hints = "";
 if (!$values["name"] || !$values["url"]) {
     $problems .= gettext("One of the required fields is missing.");
 }
 $hints .= gettext("Please provide a name for the unit and an URL for the extern content.");
 if (empty($problems)) {
     $all_users = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
     $staff = $course->steam_group_staff;
     $learners = $course->steam_group_learners;
     if (!isset($unit)) {
         $env = $course->get_workroom();
         $url = $values["url"];
         $new_unit = steam_factory::create_docextern($GLOBALS["STEAM"]->get_id(), $values["name"], $url, $env, $values["dsc"]);
         $new_unit->set_attribute("UNIT_EXTERN_APPEARANCE", $values["appearance"]);
         $new_unit->set_attribute("UNIT_EXTERN_URL_DESCRIPTION", $values["url_dsc"]);
         $new_unit->set_attributes(array("OBJ_LONG_DESC" => $values["long_dsc"], "UNIT_TYPE" => "units_extern", "OBJ_TYPE" => "docextern_unit_koala", "UNIT_DISPLAY_TYPE" => gettext("Extern Ressource")));
         $koala_unit = new koala_object_docextern($new_unit, new units_extern($course->get_steam_object()));
     } else {
         $new_unit = $unit->get_steam_object();
         $koala_unit = $unit;
         $attrs = $new_unit->get_attributes(array(OBJ_NAME, OBJ_DESC, 'OBJ_LONG_DESC', OBJ_TYPE, 'UNIT_TYPE', 'UNIT_DISPLAY_TYPE', 'UNIT_EXTERN_APPEARANCE', 'DOC_EXTERN_URL', 'UNIT_EXTERN_URL_DESCRIPTION'));
         if ($attrs[OBJ_NAME] !== $values['name']) {
             $new_unit->set_name($values['name']);
         }
         $changes = array();
         if ($attrs['OBJ_TYPE'] !== 'docextern_unit_koala') {
             $changes['OBJ_TYPE'] = 'docextern_unit_koala';
         }
Esempio n. 6
0
                         $result = $inventory[$i];
                         $result->set_content(stripslashes($_POST["text"]));
                         $result->set_attribute("DOC_MIME_TYPE", $mimetype);
                         break;
                     }
                 }
                 if (!$result) {
                     $result = steam_factory::create_document($steam, $title, stripslashes($_POST["text"]), $mimetype, $current_room, $desc);
                 }
             } else {
                 $error[] = "error_title";
             }
             break;
         case "link":
             if (trim($_POST["title"]) != "" && trim($_POST["url"]) != "") {
                 $result = steam_factory::create_docextern($steam, $title, $_POST["url"], $current_room, $desc);
             } else {
                 if (trim($_POST["title"]) == "") {
                     $error[] = "error_title";
                 }
                 if (trim($_POST["url"]) == "") {
                     $error[] = "error_url";
                 }
             }
             break;
         default:
             break;
     }
 }
 //close window on success
 if ($result !== false) {
Esempio n. 7
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //$path = $request->getPath();
     $STEAM = $GLOBALS["STEAM"];
     $weblogId = $this->params[0];
     $weblog = \steam_factory::get_object($STEAM->get_id(), $weblogId);
     //if ( ! $weblog = steam_factory::get_object( $STEAM->get_id(), $_GET[ "id" ] ) )
     //{
     //	include( "bad_link.php" );
     //	exit;
     //}
     if (!$weblog instanceof \steam_calendar) {
         if ($weblog instanceof \steam_container) {
             $category = $weblog;
             $categories = $category->get_environment();
             $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $categories->get_environment()->get_id());
         } elseif ($weblog instanceof \steam_date) {
             $date = $weblog;
             $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $date->get_environment()->get_id());
         } else {
             include "bad_link.php";
             exit;
         }
     } else {
         $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $weblogId);
         define("OBJ_ID", $weblogId);
         if (!$weblog->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     $date = $weblog;
     //if(!isset($date))
     //throw new \Exception("variable date is not set.");
     //if ( $_SERVER[ "REQUEST_METHOD" ] == "POST" && $date->check_access_write( $user ) )
     if (false) {
         $values = $_POST["values"];
         if (!isset($values["delete"])) {
             $values["delete"] = false;
         }
         if ($values["delete"]) {
             require_once "Cache/Lite.php";
             $cache = new Cache_Lite(array("cacheDir" => PATH_CACHE));
             $cache->clean($weblog->get_id());
             $cache->clean($date->get_id());
             $trashbin = $GLOBALS["STEAM"]->get_current_steam_user();
             if (is_object($trashbin)) {
                 $date->move($trashbin);
             } else {
                 $date->delete();
             }
         }
         header("Location: " . $values["return_to"]);
         exit;
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         //echo "hund";
         $values = $_POST["values"];
         $problem = "";
         $hint = "";
         if (isset($values["save"])) {
             $values["save"] = true;
         } else {
             $values["save"] = false;
         }
         if ($values["save"]) {
             if (empty($values["url"])) {
                 $problem = gettext("The URL is missing.") . " ";
                 $hint = gettext("Please insert the URL, starting with 'http://'") . " ";
             }
             if (empty($values["name"])) {
                 $problem .= gettext("The name is missing.");
                 $hint .= gettext("How is the title of the webpage?");
             } else {
                 if (strpos($values["name"], "/")) {
                     if (!isset($problem)) {
                         $problem = "";
                     }
                     $problem .= gettext("Please don't use the \"/\"-char in the name of the blogroll entry.");
                 }
             }
             if (empty($problem)) {
                 $environment = $weblog->get_blogroll();
                 if (!is_object($environment)) {
                     throw new \Exception("Environment is not correct.");
                 }
                 if (!$environment instanceof \steam_container) {
                     throw new \Exception("Environment is no container.");
                 }
                 if (!$environment->check_access_write($user)) {
                     throw new \Exception("No write access on this container.", E_USER_RIGHTS);
                 }
                 if (empty($problem)) {
                     $docextern = \steam_factory::create_docextern($GLOBALS["STEAM"]->get_id(), $values["name"], $values["url"], $environment, $values["desc"]);
                     header("Location: " . $values["return_to"]);
                     exit;
                 } else {
                     //TODO: PROBDESC
                     //$portal->set_problem_description( $problem, $hint );
                 }
             } else {
                 //TODO: PROBDESC
                 //$portal->set_problem_description( $problem, $hint );
             }
         }
     }
     $content = \Weblog::getInstance()->loadTemplate("weblog_blogroll.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplatefile( PATH_TEMPLATES . "weblog_blogroll.template.html" );
     if (!empty($problem)) {
         $content->setVariable("VALUE_NAME", $values["name"]);
         $content->setVariable("VALUE_URL", $values["url"]);
         $content->setVariable("VALUE_DESC", $values["desc"]);
     }
     $content->setVariable("GREETING", str_replace("%n", $_SESSION["LMS_USER"]->get_forename(), gettext("Hi %n!")));
     $help_text = "<b>" . gettext("What is a blogroll?") . "</b> " . gettext("A blogroll is a collection of links to other weblogs.") . " " . gettext("When present, blogrolls are on the front page sidebar of most weblogs.") . " " . gettext("Some blogrolls also simply consist of the list of weblogs an author reads himself.");
     $content->setVariable("HELP_TEXT", $help_text);
     $content->setVariable("YOUR_BLOGROLL_TEXT", gettext("Your Blogroll"));
     $content->setVariable("CREATE_NEW_LINK_TEXT", gettext("Create new Link"));
     $content->setVariable("FORM_ACTION", "");
     //PATH_URL . "docextern_create.php" );
     $content->setVariable("ENVIRONMENT", $weblog->get_blogroll()->get_id());
     $content->setVariable("LABEL_NAME", gettext("Name"));
     $content->setVariable("LABEL_URL", gettext("URL"));
     $content->setVariable("LABEL_DESCRIPTION", gettext("Description"));
     $content->setVariable("LABEL_SAVE_CHANGES", gettext("Save changes"));
     $content->setVariable("LABEL_BACK", gettext("back"));
     $content->setVariable("LINK_BACK", PATH_URL . "weblog/index/" . $weblog->get_id() . "/");
     $blogroll = $weblog->get_blogroll_list();
     foreach ($blogroll as $link) {
         if (!$link instanceof \steam_docextern) {
             continue;
         }
         $content->setCurrentBlock("BLOCK_LINK");
         $content->setVariable("LINK_URL", $link->get_url());
         $content->setVariable("LINK_NAME", h($link->get_name()));
         $content->setVariable("LINK_DESC", h($link->get_attribute("OBJ_DESC")));
         $content->setVariable("LABEL_EDIT", gettext("edit"));
         $content->setVariable("LINK_EDIT", PATH_URL . "docextern/" . $link->get_id() . "/edit/");
         $content->setVariable("LINK_DELETE", PATH_URL . "docextern/" . $link->get_id() . "/delete/");
         $content->setVariable("LABEL_DELETE", gettext("delete"));
         $content->parse("BLOCK_LINK");
     }
     $rootlink = \lms_steam::get_link_to_root($weblog);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($weblog->get_name()), "link" => PATH_URL . "weblog/" . $weblog->get_id() . "/"), array("link" => "", "name" => gettext("Edit Blogroll")));
     //$portal->set_page_main(
     //$headline,
     //$content->get()
     //);
     //return $portal->get_html();
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }