Ejemplo n.º 1
0
 public function processData(\IRequestObject $requestObject)
 {
     $params = $requestObject->getParams();
     $objectId = $params["messageObjectId"];
     $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectId);
     $dialog = new \Widgets\Dialog();
     $dialog->setTitle("Meldung bearbeiten");
     $dialog->setPositionX($this->params["mouseX"]);
     $dialog->setPositionY($this->params["mouseY"]);
     //$dialog->setWidth(450);
     $clearer = new \Widgets\Clearer();
     $titelInput = new \Widgets\TextInput();
     $titelInput->setLabel("Überschrift");
     $titelInput->setData($object);
     $titelInput->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_NAME"));
     $dialog->addWidget($titelInput);
     $dialog->addWidget($clearer);
     $titelInput = new \Widgets\TextInput();
     $titelInput->setLabel("Untertitel");
     $titelInput->setData($object);
     $titelInput->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_DESC"));
     $dialog->addWidget($titelInput);
     $dialog->addWidget($clearer);
     $contentText = new \Widgets\Textarea();
     $contentText->setLabel("Inhalt");
     $contentText->setTextareaClass("mce-small");
     $contentText->setWidth(480);
     $contentText->setData($object);
     $contentText->setContentProvider(\Widgets\DataProvider::contentProvider());
     $dialog->addWidget($contentText);
     $dialog->addWidget($clearer);
     $dialog->addWidget($clearer);
     $titelInput = new \Widgets\TextInput();
     $titelInput->setLabel("Link-Text");
     $titelInput->setData($object);
     $titelInput->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:msg:link_url_label"));
     $dialog->addWidget($titelInput);
     $dialog->addWidget($clearer);
     $titelInput = new \Widgets\TextInput();
     $titelInput->setLabel("Link-Adresse");
     $titelInput->setData($object);
     $titelInput->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:msg:link_url"));
     $dialog->addWidget($titelInput);
     $dialog->addWidget($clearer);
     $widget = new \Widgets\Checkbox();
     $widget->setLabel("Link in einem neuen Fenster öffnen");
     $widget->setData($object);
     $widget->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:portlet:msg:link_open"));
     $widget->setCheckedValue("checked");
     $widget->setUncheckedValue("");
     $dialog->addWidget($widget);
     //create widgets
     //$button1 = new \Widgets\Button();
     //TODO: add a edit box for the message here
     //$button1->setLabel("abschicken");
     //add widgets to dialog
     //$dialog->addWidget($button1);
     $this->dialog = $dialog;
 }
Ejemplo n.º 2
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $pyramidPosition = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
     $user = $GLOBALS["STEAM"]->get_current_steam_user();
     if ($this->params["action"] == "join") {
         // changing group (only) in the group choosing phase
         $pyramid = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["pyramid"]);
         $phase = $pyramid->get_attribute("PYRAMIDDISCUSSION ACTCOL");
         if ($phase == 0) {
             if ($this->params["formergroup"] == $this->params["newgroup"]) {
                 $formergroup = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["formergroup"]);
                 $formergroup->remove_member($user);
             } else {
                 if ($this->params["formergroup"] == 0) {
                     $newgroup = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["newgroup"]);
                     $newgroup->add_member($user);
                 } else {
                     $formergroup = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["formergroup"]);
                     $formergroup->remove_member($user);
                     $newgroup = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["newgroup"]);
                     $newgroup->add_member($user);
                 }
             }
         }
         $ajaxResponseObject->setStatus("ok");
         return $ajaxResponseObject;
     } else {
         $read_position_states = array();
         $read_position_states[$user->get_id()] = 1;
         $pyramidPosition->set_attribute("PYRAMIDDISCUSSION_POS_READ_STATES", $read_position_states);
         $column = $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_COLUMN");
         $row = $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_ROW");
         $dialog = new \Widgets\Dialog();
         $dialog->setTitle("Bearbeite Position " . $column . "-" . $row);
         $dialog->setWidth("600");
         $clearer = new \Widgets\Clearer();
         $titleInput = new \Widgets\TextInput();
         $titleInput->setLabel("Titel");
         $titleInput->setData($pyramidPosition);
         $titleInput->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_DESC"));
         $dialog->addWidget($titleInput);
         $dialog->addWidget($clearer);
         $textareaWidget = new \Widgets\Textarea();
         $textareaWidget->setTextareaClass("mce-small");
         $textareaWidget->setWidth("600");
         $textareaWidget->setData($pyramidPosition);
         $textareaWidget->setContentProvider(\Widgets\DataProvider::contentProvider());
         $dialog->addWidget($textareaWidget);
         $dialog->addWidget($clearer);
         $ajaxResponseObject->addWidget($dialog);
         $ajaxResponseObject->setStatus("ok");
         return $ajaxResponseObject;
     }
 }
Ejemplo n.º 3
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     if (isset($this->id)) {
         $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
         if ($object instanceof \steam_document) {
             $mimetype = $object->get_attribute(DOC_MIME_TYPE);
             $objName = $object->get_name();
             $objDesc = trim($object->get_attribute(OBJ_DESC));
             if ($objDesc === 0 || $objDesc === "") {
                 $name = $objName;
             } else {
                 $name = $objDesc . " (" . $objName . ")";
             }
             $actionBar = new \Widgets\ActionBar();
             $actionBar->setActions(array(array("name" => "Anzeigen", "link" => PATH_URL . "Explorer/ViewDocument/" . $this->id . "/"), array("name" => "Bearbeiten", "link" => PATH_URL . "Explorer/EditDocument/" . $this->id . "/"), array("name" => "Eigenschaften", "ajax" => array("onclick" => array("command" => "properties", "params" => array("id" => $this->id), "requestType" => "popup"))), array("name" => "Rechte", "ajax" => array("onclick" => array("command" => "Sanctions", "params" => array("id" => $this->id), "requestType" => "popup")))));
             $contentText = new \Widgets\TextareaCode();
             $contentText->setWidth(945);
             $contentText->setRows(50);
             $contentText->setData($object);
             $contentText->setContentProvider(\Widgets\DataProvider::contentProvider());
             $clearer = new \Widgets\Clearer();
             // 				$html = "";
             // 				if ($mimetype == "image/png" || $mimetype == "image/jpeg" || $mimetype == "image/gif") {  // Image
             // 					$html = "<div style=\"text-align:center\"><img style=\"max-width:100%\" title=\"{$name}\" alt=\"Bild: {$name}\" src=\"" . PATH_URL . "Download/Document/" . $this->id . "/\"></div>";
             // 				} else if ($mimetype == "text/html") {
             // 					$html = strip_tags($object->get_content(),"<h1><h2><h3><h4><h5><p><a><div><style><b><i><strong><img>");
             // 				} else if (strstr($mimetype, "text")) {
             // 					$html = "<pre>{$object->get_content()}</pre>";
             // 				} else {
             // 					header("location: " . PATH_URL . "Download/Document/" . $this->id . "/");
             // 				}
             // 				$rawHtml = new \Widgets\RawHtml();
             // 				$rawHtml->setHtml($html);
             //$rawHtml->addWidget($breadcrumb);
             //$rawHtml->addWidget($environment);
             //$rawHtml->addWidget($loader);
             $frameResponseObject->setTitle($name);
             $frameResponseObject->addWidget($actionBar);
             //$frameResponseObject->addWidget($rawHtml);
             $frameResponseObject->addWidget($contentText);
             $frameResponseObject->addWidget($clearer);
             return $frameResponseObject;
         }
     } else {
         ExtensionMaster::getInstance()->send404Error();
     }
 }
Ejemplo n.º 4
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     if (isset($this->id)) {
         $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
         if ($object instanceof \steam_document) {
             $mimetype = $object->get_attribute(DOC_MIME_TYPE);
             $objName = $object->get_name();
             $objDesc = trim($object->get_attribute(OBJ_DESC));
             if ($objDesc === 0 || $objDesc === "") {
                 $name = $objName;
             } else {
                 $name = $objDesc . " (" . $objName . ")";
             }
             $actionBar = new \Widgets\ActionBar();
             if ($mimetype == "text/html") {
                 $actionBar->setActions(array(array("name" => "Anzeigen", "link" => PATH_URL . "Explorer/ViewDocument/" . $this->id . "/"), array("name" => "Quelltext", "link" => PATH_URL . "Explorer/CodeEditDocument/" . $this->id . "/"), array("name" => "Eigenschaften", "ajax" => array("onclick" => array("command" => "properties", "params" => array("id" => $this->id), "requestType" => "popup"))), array("name" => "Rechte", "ajax" => array("onclick" => array("command" => "Sanctions", "params" => array("id" => $this->id), "requestType" => "popup")))));
             } else {
                 $actionBar->setActions(array(array("name" => "Anzeigen", "link" => PATH_URL . "Explorer/ViewDocument/" . $this->id . "/"), array("name" => "Eigenschaften", "ajax" => array("onclick" => array("command" => "properties", "params" => array("id" => $this->id), "requestType" => "popup"))), array("name" => "Rechte", "ajax" => array("onclick" => array("command" => "Sanctions", "params" => array("id" => $this->id), "requestType" => "popup")))));
             }
             $contentText = new \Widgets\Textarea();
             $contentText->setWidth(945);
             $contentText->setheight(400);
             $contentText->setData($object);
             $contentText->setTextareaClass("mce-full");
             if ($mimetype !== "text/html") {
                 $contentText->setTextareaClass("plain");
             }
             $html = cleanHTML($object->get_content());
             $dirname = dirname($object->get_path()) . "/";
             preg_match_all('/src="([%a-z0-9.\\-_\\/]*)"/iU', $html, $matches);
             $orig_matches = $matches[0];
             $path_matches = $matches[1];
             foreach ($path_matches as $key => $path) {
                 $path = urldecode($path);
                 if (parse_url($path, PHP_URL_SCHEME) != null) {
                     continue;
                 }
                 $ref_object = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $dirname . $path);
                 if ($ref_object instanceof \steam_object) {
                     $new_path = PATH_URL . "Download/Document/" . $ref_object->get_id();
                 } else {
                     $new_path = PATH_URL . "styles/standard/images/404.jpg";
                 }
                 $html = str_replace($orig_matches[$key], "src=\"{$new_path}\" data-mce-src=\"{$path}\"", $html);
             }
             $contentText->setContentProvider(\Widgets\DataProvider::contentProvider($html));
             $clearer = new \Widgets\Clearer();
             // 				$html = "";
             // 				if ($mimetype == "image/png" || $mimetype == "image/jpeg" || $mimetype == "image/gif") {  // Image
             // 					$html = "<div style=\"text-align:center\"><img style=\"max-width:100%\" title=\"{$name}\" alt=\"Bild: {$name}\" src=\"" . PATH_URL . "Download/Document/" . $this->id . "/\"></div>";
             // 				} else if ($mimetype == "text/html") {
             // 					$html = strip_tags($object->get_content(),"<h1><h2><h3><h4><h5><p><a><div><style><b><i><strong><img>");
             // 				} else if (strstr($mimetype, "text")) {
             // 					$html = "<pre>{$object->get_content()}</pre>";
             // 				} else {
             // 					header("location: " . PATH_URL . "Download/Document/" . $this->id . "/");
             // 				}
             // 				$rawHtml = new \Widgets\RawHtml();
             // 				$rawHtml->setHtml($html);
             //$rawHtml->addWidget($breadcrumb);
             //$rawHtml->addWidget($environment);
             //$rawHtml->addWidget($loader);
             $frameResponseObject->setTitle($name);
             $frameResponseObject->addWidget($actionBar);
             //$frameResponseObject->addWidget($rawHtml);
             $frameResponseObject->addWidget($contentText);
             $frameResponseObject->addWidget($clearer);
             return $frameResponseObject;
         }
     } else {
         ExtensionMaster::getInstance()->send404Error();
     }
 }
Ejemplo n.º 5
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $object_id = $this->id;
     $steam = $GLOBALS["STEAM"];
     $steamId = $steam->get_id();
     /** log-in user */
     $steamUser = \lms_steam::get_current_user();
     /** id of the log-in user */
     $steamUserId = $steamUser->get_id();
     /** name of the log-in user */
     $steamUserName = $steamUser->get_name();
     /** the current object */
     $object = \steam_factory::get_object($steamId, $object_id);
     /** the content of the message object */
     $object_content = $object->get_content(1);
     /** additional required attributes */
     $attrib = $object->get_attributes(array(OBJ_NAME, OBJ_DESC, OBJ_CREATION_TIME, OBJ_LAST_CHANGED), 1);
     /** get the annotating category */
     $category = $object->get_annotating(1);
     /** check the rights of the log-in user */
     $allowed_write = $object->check_access_write($steamUser, 1);
     // flush the buffer
     $result = $steam->buffer_flush();
     $object_content = $result[$object_content];
     $attrib = $result[$attrib];
     $category = $result[$category];
     $allowed_write = $result[$allowed_write];
     $category_attributes = $category->get_attributes(array(OBJ_NAME, OBJ_DESC), 1);
     $result = $steam->buffer_flush();
     $category_attributes = $result[$category_attributes];
     $content = $object_content;
     $title = $attrib[OBJ_DESC];
     $dialog = new \Widgets\Dialog();
     $dialog->setTitle("Bearbeite aktuelles Thema »" . getCleanName($object) . "«");
     $clearer = new \Widgets\Clearer();
     $titelInput = new \Widgets\TextInput();
     $titelInput->setLabel("Überschrift");
     $titelInput->setData($object);
     $titelInput->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_DESC"));
     $dialog->addWidget($titelInput);
     $dialog->addWidget($clearer);
     $contentText = new \Widgets\Textarea();
     $contentText->setLabel("Inhalt");
     $contentText->setTextareaClass("mce-small");
     $contentText->setWidth(480);
     $contentText->setData($object);
     $contentText->setContentProvider(\Widgets\DataProvider::contentProvider());
     $dialog->addWidget($contentText);
     $dialog->addWidget($clearer);
     $dialog->addWidget($clearer);
     /*$ajaxForm = new \Widgets\AjaxForm();
     		 $ajaxForm->setSubmitCommand("EditReplyContent");
     		 $ajaxForm->setSubmitNamespace("Forum");
     
     		 $ajaxForm->setHtml(<<<END
     		 <input type="hidden" name="id" value="{$this->id}">
     		 <input type="hidden" name="forum" value="{$this->params["forum"]}">
     		 <div class="widgets_lable">Überschrift:</div>
     		 <div class="widgets_textinput"><input type="text" value="{$title}" name="title"></div><br clear="all">
     		 <div class="widgets_lable">Inhalt:</div>
     		 <div class="widgets_textarea"><textarea rows="10" style="width:100%" class="tinymce"  value="{$content}" name="content1" id="content1"></textarea><br clear="all">
     		 <input id="content_id" type="hidden" name="content" value="">
     		 <script type="text/javascript">
     		 tinyMCE.init({
     		 mode : "textareas",
     
     		 // General options
     		 theme : "advanced",
     		 skin: "o2k7",
     		 id: "content1",
     		 name:"content1",
     		 force_br_newlines : true,
     		 force_p_newlines : false,
     		 forced_root_block : '',
     
     		 language: "de",
     		 plugins : "emotions,paste",
     
     			//Specific options
     			setup : function(ed) {
     			ed.onKeyUp.add(function(ed, o) {
     			var content = "<p>"+ed.getContent()+"</p>";
     			$("#content_id").val(content);
     			});
     			ed.onInit.add(function(ed) {
     			ed.setContent('{$content}');
     			});
     
     			},
     
     			// Theme options
     			theme_advanced_buttons1 : "bold,italic,underline,|,image,link,unlink,|,forecolor,removeformat,|,undo,redo,pasteword,|,code",
     			theme_advanced_buttons2 : "",
     			theme_advanced_buttons3 : "",
     			theme_advanced_buttons4 : "",
     			theme_advanced_toolbar_location : "top",
     			theme_advanced_toolbar_align : "left",
     			theme_advanced_statusbar_location : "none",
     			theme_advanced_resizing : false
     			});
     
     			</script>
     			END
     			);
     			$dialog->addWidget($ajaxForm);*/
     $ajaxResponseObject->setStatus("ok");
     $ajaxResponseObject->addWidget($dialog);
     return $ajaxResponseObject;
 }
Ejemplo n.º 6
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $forumId = $this->params["forum"];
     $objectId = $this->id;
     $steam = $GLOBALS["STEAM"];
     $steamId = $steam->get_id();
     $forum = \steam_factory::get_object($steamId, $forumId);
     /** log-in user */
     $steamUser = \lms_steam::get_current_user();
     /** id of the log-in user */
     $steamUserId = $steamUser instanceof \steam_user ? $steamUser->get_id() : 0;
     /** the current category object */
     $object = \steam_factory::get_object($steamId, $objectId);
     /** the content of the category object */
     $object_content = $object->get_content(1);
     /** additional required attributes */
     $attrib = $object->get_attributes(array(OBJ_NAME, OBJ_DESC, OBJ_CREATION_TIME, OBJ_LAST_CHANGED, "bid:description"), 1);
     /* get the annotating forum object */
     $forum = $object->get_annotating(1);
     /** check the rights of the log-in user */
     $allowed_write = $object->check_access_write($steamUser, 1);
     // flush the buffer
     $result = $steam->buffer_flush();
     $object_content = $result[$object_content];
     $attrib = $result[$attrib];
     $forum = $result[$forum];
     $allowed_write = $result[$allowed_write];
     $forum_attrib = $forum->get_attributes(array(OBJ_NAME, OBJ_DESC, "bid:description"), 1);
     $result = $steam->buffer_flush();
     $forum_attrib = $result[$forum_attrib];
     $content = $object_content;
     $title = $attrib[OBJ_DESC];
     $description = isset($attrib["bid:description"]) ? $attrib["bid:description"] : "";
     $dialog = new \Widgets\Dialog();
     $dialog->setTitle("Bearbeite aktuelles Thema »" . getCleanName($object) . "«");
     $clearer = new \Widgets\Clearer();
     $titelInput = new \Widgets\TextInput();
     $titelInput->setLabel("Überschrift");
     $titelInput->setData($object);
     $titelInput->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_DESC"));
     $dialog->addWidget($titelInput);
     $dialog->addWidget($clearer);
     $contentText = new \Widgets\Textarea();
     $contentText->setLabel("Inhalt");
     $contentText->setTextareaClass("mce-small");
     $contentText->setWidth(480);
     $contentText->setData($object);
     $contentText->setContentProvider(\Widgets\DataProvider::contentProvider());
     $dialog->addWidget($contentText);
     $dialog->addWidget($clearer);
     $dialog->addWidget($clearer);
     /*$widget = new \Widgets\Checkbox();
     		$widget->setLabel("Benutzer dürfen ihre Antworten bearbeiten");
     		$widget->setData($object);
     		$widget->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:forum:is_editable"));
     		$widget->setCheckedValue("checked");
     		$widget->setUncheckedValue("");
     		$dialog->addWidget($widget);*/
     /*	$ajaxForm = new \Widgets\AjaxForm();
     		$ajaxForm->setSubmitCommand("EditTopicContent");
     		$ajaxForm->setSubmitNamespace("Forum");
     
     		$ajaxForm->setHtml(<<<END
     	<input type="hidden" name="id" value="{$this->id}">
     	
     	
     	<div class="widgets_lable">Überschrift:</div>
     	<div class="widgets_textinput"><input type="text" value="{$title}" name="title"></div><br clear="all">
     	<div class="widgets_lable">Inhalt:</div>
     	<div class="widgets_textarea"><textarea rows="10" style="width:100%" class="tinymce"  value="{$content}" name="content1" id="content1"></textarea><br clear="all">
     	
     END
     		);
     			
     		$dialog->addWidget($ajaxForm);*/
     $ajaxResponseObject->setStatus("ok");
     $ajaxResponseObject->addWidget($dialog);
     return $ajaxResponseObject;
 }