break;
                case 2:
                    $obj[$i] = new TextInput($mlist[$i][2], "meta", "VALUE", "MID = " . $mlist[$i][0], "type:textarea,size:3,width:300");
                    break;
                case 3:
                    $obj[$i] = new TextInput($mlist[$i][2], "meta", "VALUE", "MID = " . $mlist[$i][0], "type:color,param:form1");
                    break;
            }
            if (isset($obj[$i])) {
                $metaPanel->add($obj[$i]);
            }
        }
        $specialID = "";
    }
}
syncMetas($clnid, "CLUSTER");
$std = 0;
$add = getDBCell("cluster_templates", "MT_ID", "CLT_ID = " . $clt);
draw_metaInput($lang->get("mt_base"), $std);
draw_metaInput($lang->get("mt_additional"), $add);
//$editbar = new ButtonBar("edtbar", "informationheader");
//$editbar->add("action", $lang->get("save"));
//$editbar->add("reset", $lang->get("reset"), "reset");
if ($isArticle) {
    $editbar = new FormButtons();
} else {
    $editbar = new FormButtons(true, true);
}
$metaPanel->add(new Cell("clc", "white", 617, 1, 2));
$metaPanel->add(new Hidden("view", $view));
$metaPanel->add(new Hidden("processing", "yes"));
		function prepare() {
			global $specialID, $lang, $db;

			syncMetas($this->oid, "OBJECT");

			//checking, if there are any items in the template.
			$sql = "SELECT COUNT(MTI_ID) AS ANZ FROM meta_template_items WHERE MT_ID =" . $this->template_id;

			$query = new query($db, $sql);
			$query->getrow();
			$amount = $query->field("ANZ");

			if ($amount > 0) {
				$this->add(new Subtitle("st", $lang->get("edit_meta", "Edit Meta-Data")));

				$sql = "SELECT m.MID AS D1, t.MTYPE_ID AS D2, t.NAME AS D3 FROM meta_template_items t, meta m WHERE m.MTI_ID = t.MTI_ID AND m.CID = " . $this->oid . " AND m.DELETED=0 AND t.MT_ID = " . $this->template_id . " ORDER BY t.POSITION ASC";

				$query = new query($db, $sql);
				$mlist = null;
				$counter = 0;

				while ($query->getrow()) {
					// save the list, so that it will not go lost.
					$mlist[$counter][0] = $query->field("D1");

					$mlist[$counter][1] = $query->field("D2");
					$mlist[$counter][2] = $query->field("D3");
					$counter++;
				}

				// add the metainput fields.
				for ($i = 0; $i < $counter; $i++) {
					$specialID = $mlist[$i][0];

					// dispatch type.
					switch ($mlist[$i][1]) {
						case 1:
							$obj[$i] = new TextInput($mlist[$i][2], "meta", "VALUE", "MID = " . $mlist[$i][0], "type:text,size:64,width:300");

							break;

						case 2:
							$obj[$i] = new TextInput($mlist[$i][2], "meta", "VALUE", "MID = " . $mlist[$i][0], "type:textarea,size:3,width:300");

							break;

						case 3:
							$obj[$i] = new TextInput($mlist[$i][2], "meta", "VALUE", "MID = " . $mlist[$i][0], "type:color,param:form1");

							break;
					}

					if (isset($obj[$i]))
						$this->add($obj[$i]);
				}

				$specialID = "";
			}

			return $this->cells;
		}
		/**
		 * Draws the presentation or edit-fields in the body.
		 */
		function draw_myBody() {
			global $lang;

			$module = getDBCell("content", "MODULE_ID", "CID = " . $this->oid);

			if ($this->editor == $lang->get("ed_meta")) {
				// edit meta information
				syncMetas($this->oid, "OBJECT");

				$std = 0;
				$mod = getDBCell("modules", "MT_ID", "MODULE_ID = $module");
				$add = getDBCell("content", "MT_ID", "CID = " . $this->oid);

				$this->draw_metaInput($lang->get("mt_base"), $std);
				$this->draw_metaInput($lang->get("mt_module"), $mod);
				$this->draw_metaInput($lang->get("mt_additional"), $add);
			} else {
				// edit content
				includePGNSource ($module);

				$fkid = getDBCell("content_variations", "FK_ID", "CID = $this->oid AND VARIATION_ID = $this->variation");
				$this->contentObject = createPGNRef($module, $fkid);

				// dispatching between preview and editing mode.
				global $editvariation, $updatevariation;

				if (isset($editvariation) || isset($updatevariation)) {
					global $page_state, $specialID;

					if (isset($editvariation))
						$page_state = "start";

					$this->add(new FormSplitter($lang->get("o_edit"). "<i> " . $this->title . "</i>", "i_edit.gif"));
					$specialID = $fkid;
					$this->contentObject->edit($this);
					$specialID = "";
					$container = new HTMLContainer("container", "informationheader", 1);
					$container->add("<input type=\"SUBMIT\" name=\"updatevariation\" value=\"" . $lang->get("commit"). "\">");
					$container->add("<input type=\"SUBMIT\" name=\"preview\" value=\"" . $lang->get("preview"). "\">");
					$this->add($container);
					$this->add(new ButtonInCell("reset", $lang->get("reset"), "informationheader", "RESET"));
				} else {
					$this->add(new FormSplitter($lang->get("o_preview"). "<i>" . $this->title . "</i>", "i_edit.gif"));

					$this->add(new ButtonInCell("editvariation", $lang->get("o_edit"), "informationheader", "SUBMIT", "", 2));
					$this->add(new Label("preview", $this->contentObject->preview(), "standardlight", 2));
					$this->add(new ButtonInCell("editvariation", $lang->get("o_edit"), "informationheader", "SUBMIT", "", 2));
				}
			}
		}