コード例 #1
0
/**
 * syncronize variations with entered data to the database.
 * The configuration for this function must be set manually.
 * I.E. there must be the $oid-Variable set and there must(!)
 * be also the global vars content_variations_VARIATION_ID_XX
 * and content_MODULE_ID
 * set which are automatically set by the SelectMultiple2Input.
 */
function syncVariations()
{
    global $db, $oid, $content_MODULE_ID;
    $module = value("content_MODULE_ID", "NUMERIC");
    if ($module == "0") {
        $module = $content_MODULE_ID;
    }
    includePGNSource($module);
    //delete all variations first.
    $del = "UPDATE content_variations SET DELETED=1 WHERE CID = {$oid}";
    $query = new query($db, $del);
    // get list of variations
    $variations = createNameValueArray("variations", "NAME", "VARIATION_ID", "DELETED=0");
    for ($i = 0; $i < count($variations); $i++) {
        $id = $variations[$i][1];
        if (value("content_variations_VARIATION_ID_" . $id) != "0") {
            // create or restore variation
            // check, if variations already exists and is set to deleted.
            $sql = "SELECT COUNT(CID) AS ANZ FROM content_variations WHERE CID = {$oid} AND VARIATION_ID = {$id}";
            $query = new query($db, $sql);
            $query->getrow();
            $amount = $query->field("ANZ");
            if ($amount > 0) {
                $sql = "UPDATE content_variations SET DELETED=0 WHERE CID = {$oid} AND VARIATION_ID = {$id}";
            } else {
                $fk = nextGUID();
                $sql = "INSERT INTO content_variations (CID, VARIATION_ID, FK_ID, DELETED) VALUES ( {$oid}, {$id}, {$fk}, 0)";
                $PGNRef = createPGNRef($module, $fk);
                $PGNRef->sync();
            }
            $query = new query($db, $sql);
        }
    }
}
コード例 #2
0
	function syncLanguages() {
	  global $db, $auth;
	  $variations = createDBCArray('variations', 'VARIATION_ID');
	  // enable languages in all templates
	  $spms = createDBCArray('sitepage_master', 'SPM_ID', 'VERSION=0');
	  for ($i=0; $i<count($spms); $i++) {
		for ($j=0; $j<count($variations); $j++) {
		  $check = getDBCell("sitepage_variations", "VARIATION_ID", "SPM_ID=".$spms[$i]." AND VARIATION_ID=".$variations[$j]);		  
		  if ($check=="") {		    
		  	$update = new query($db, 'INSERT INTO sitepage_variations (SPM_ID, VARIATION_ID) VALUES ('.$spms[$i].','.$variations[$j].')');
		  }	
		}
	  }
	  
	  // enable languages for all contents
	  $cids = createDBCArray("content", "CID", "VERSION=0");
	  for ($i=0; $i<count($cids); $i++) {
	  	$module = getDBCell("content", "MODULE_ID", "CID=".$cids[$i]);
	    for ($j=0; $j<count($variations); $j++) {
	      $check = getDBCell("content_variations", "VARIATION_ID", "CID=".$cids[$i]." AND VARIATION_ID=".$variations[$j]);
	      if ($check=="") {
		      $fk = nextGUID();
	  		  $sql = "INSERT INTO content_variations (CID, VARIATION_ID, FK_ID, DELETED) VALUES ( $cids[$i], $variations[$j], $fk, 0)";
              $PGNRef = createPGNRef($module, $fk);
              $PGNRef->sync();
              $update = new query($db, $sql);
	      }
	    }	  
	  }

	  // enable languages for all clusters
	  $clnids = createDBCArray('cluster_node', 'CLNID', 'VERSION=0 AND DELETED=0');
	  for ($i=0; $i<count($clnids); $i++) {
	  	for ($j=0; $j<count($variations); $j++) {
	  	  $check = getDBCell("cluster_variations", 'VARIATION_ID', 'CLNID='.$clnids[$i].' AND VARIATION_ID='.$variations[$j]);
	  	  if ($check=="") {
			$fk = nextGUID();
			$sql = "INSERT INTO cluster_variations (CLNID, VARIATION_ID, CLID, DELETED,CREATED_AT, CREATE_USER ) VALUES ( $clnids[$i], $variations[$j], $fk, 0, NOW()+0, '".$auth->userName."')";
	  	  	$update = new query($db, $sql);
	  	  	syncCluster($fk);
	  	  }
	  	}	  	
	  }
	  
	  // enable languages for all menutexts
	  $spids = createDBCArray("sitepage", "SPID", "VERSION=0 AND DELETED=0");
	  for ($i=0; $i<count($spids); $i++) {
	    for ($j=0; $j<count($variations); $j++) {
	      $check = getDBCell("sitepage_names", "VARIATION_ID", "VARIATION_ID= $variations[$j] AND SPID=$spids[$i]");
	      if ($check =="") {
	      	$update = new query($db, 'INSERT INTO sitepage_names (SPID,VARIATION_ID,NAME,HELP,DELETED,VERSION) VALUES ('.$spids[$i].','.$variations[$j].',"","",0,0)');
	      }		      
	    }	
	  }	  	  	  
	}	
コード例 #3
0
 /**
  * Get the API-Object of a type 3 Plugin
  * @param string name of the Type-3 Plugin
  * @param mixed parameters as assosiative array ("id" => 12);
  */
 function getAPI($name, $parameters = null)
 {
     $pluginId = getDBCell("modules", "MODULE_ID", "UPPER(MODULE_NAME) = '" . strtoupper($name) . "' AND MODULE_TYPE_ID = 3");
     includePGNSource($pluginId);
     $ref = createPGNRef($pluginId, 0);
     if (is_object($ref)) {
         return $ref->draw($parameters);
     } else {
         return null;
     }
 }
コード例 #4
0
/**
 * Import the XML as content to a plugin
 * @param string XML-Data to import.
 * @param integer GUID to use for this content or null for creation
 */
function XmlImportPlugin($xmlString, $id = null)
{
    if ($id == null) {
        $id = nextGUID;
    }
    $xmlOptions = array(XML_OPTION_CASE_FOLDING => TRUE, XML_OPTION_SKIP_WHITE => TRUE);
    $xml =& new XPath(FALSE, $xmlOptions);
    $xml->importFromString($xmlString);
    $type = strtoupper($xml->getAttributes('/NX:CONTENT[1]', "TYPE"));
    $moduleId = getDBCell("modules", "MODULE_ID", "UPPER(MODULE_NAME) = '{$type}'");
    if ($moduleId != "") {
        $pgn = createPGNRef($moduleId, $id);
        $pgn->import($xmlString);
        return $id;
    }
    return false;
}
コード例 #5
0
	/**
	 * Standard Constructor
	 *
	 * @param string Name to display on top.
	 * @param string Table where the FK is saved in
	 * @param string Column where the FK id saved in to reference the plugin.
	 * @param string Where-Clause to select a FK
	 * @param string Name of the plugin.
	 * @param string A reference to the form ýou are using.
	 * @param boolean show preview of the plugin.
	 * @param string style of the control.
	 */
	function PluginInput($label, $table, $column, $cond, $pgnname, & $form, $showpreview=false, $style="standard") {
       	   global $page_state, $page_action;
	   $this->label = $label;
	   $this->table = $table;
	   $this->column = $column;
	   $this->cond = $cond;
	   $this->pgnname = $pgnname;
	   $this->style = $style;
	   $this->form = &$form;
	   
	   $this->v_label = new Label("lbl_".$column, $label, $this->style,2);
	 	
	   //now retrieve the values....
	   $this->pgntypeid = getDBCell("modules", "MODULE_ID", "UPPER(MODULE_NAME) = '".strtoupper($pgnname)."'");
	   if ($this->pgntypeid =="") {
	     $this->errortext = "<center> The Plugin $pgnname is not installed. </center>";   
	   } else {
	     	includePGNSource($this->pgntypeid);	 
		$form->add($this->v_label);
		if ($page_action == "UPDATE") {
		   	$fkid = getDBCell($table, $column, $cond);
		   	if ($fkid !="") {
			 	$ref = createPGNRef($this->pgntypeid, $fkid);
		     		if ($showpreview) {
  			 		$preview = $ref->preview();
			 		$this->form->add(new Label("lbl", $preview, "", 2));
			 	}
			 	$ref->edit($this->form);		
		   	}  
		 } else {
		   	$fkid=value("PGFK".$this->table.$this->column, "NUMERIC");			
		   	if ($fkid=="0") { 
			   	$fkid = nextGUID();
  			   	$ref = createPGNRef($this->pgntypeid, $fkid);		 	     			   	
			 } else {
			    	$ref = createPGNRef($this->pgntypeid, $fkid);		 	   			    	
			 }
			 $ref->edit($this->form);
			 $this->form->add(new Hidden("PGFK".$this->table.$this->column, $fkid));		
			 global $page_state;
			 if ($page_state == "processing") {
			   	// was commented out somewhat.
			 	addInsert($ref->management_table, $ref->pk_name, $fkid, "NUMBER");
			   	addInsert($table, $column, $fkid, "NUMBER");			 
			 }
		 }
	   } // plugin does exist
	}
コード例 #6
0
/**
 * Uninstalls a Plugin
 * @param integer GUID of the plugin to uninstall.
 */
function uninstallPlugin($oid)
{
    global $db;
    // module uninstall handler
    includePGNSource($oid);
    $modRef = createPGNRef($oid, 0);
    if ($modRef != null) {
        $modRef->registration();
        $modRef->_uninstaller();
        // content deletion
        $delHandler = new ActionHandler("DELETE");
        $sql = "SELECT CID FROM content WHERE MODULE_ID = {$oid}";
        $query = new query($db, $sql);
        while ($query->getrow()) {
            $cid = $query->field("CID");
            $delHandler->addDBAction("DELETE FROM meta WHERE CID = {$cid}");
            $delHandler->addDBAction("UPDATE cluster_template_items SET FKID=0 WHERE FKID={$cid}");
            $delHandler->addDBAction("DELETE FROM content_variations WHERE CID = {$cid}");
            $delHandler->addDBAction("DELETE FROM content WHERE CID = {$cid}");
        }
        // meta-templates deletion.
        $mtid = getDBCell("modules", "MT_ID", "MODULE_ID = {$oid}");
        if ($mtid != 0) {
            $delHandler->addDBAction("DELETE FROM meta_template_items WHERE MT_ID = {$mtid}");
            $delHandler->addDBAction("DELETE FROM meta_templates WHERE MT_ID = {$mtid}");
        }
        $delHandler->addDBAction("DELETE FROM modules WHERE MODULE_ID = {$oid}");
        $delHandler->process("DELETE");
        $delHandler = new ActionHandler("DELETE");
        // cluster deletion.
        $delHandler->addDBAction("UPDATE cluster_template_items SET FKID = 0 WHERE FKID = {$oid} AND CLTITYPE_ID=2");
        $cltis = createDBCArray("cluster_template_items", "CLTI_ID", "CLTITYPE_ID = 2 AND FKID = {$oid}");
        for ($i = 0; $i < count($cltis); $i++) {
            $id = $cltis[$i];
            $delHandler->addDBAction("DELETE FROM cluster_content WHERE CLTI_ID = {$id}");
        }
        $delHandler->process("DELETE");
        writeDataTypeArray();
    }
}
コード例 #7
0
		/**
		 * Called to get the necessary html-headers of the plugins that are used within 
		 * the class on which the page is based
		 */
		function _autoInitPlugins() {
		  $clt = getDBCell('cluster_node', 'CLT_ID', 'CLNID='.$this->parent->pageClusterNodeId);		  
		  $ar = createDBCArray('cluster_template_items', 'FKID', 'CLT_ID='.$clt.' AND CLTITYPE_ID IN (1,2,5)');
		  for ($i=0; $i < count($ar); $i++) {
		  	$ref = createPGNRef($ar[$i], 0);
		  	if (is_object($ref)) {
		  		$out = $ref->getHTMLHeader();
		  		if (strlen($out) > 0 )
		  		  $this->header.= "\n".$ref->getHTMLHeader();
		  		unset($ref);
		  	}
		  }
		} 
コード例 #8
0
/**
 * delete the content of a plugin.
 * @param integer id of the record to delete
 * @param integer id of the plugin to delete.
 */
function deletePlugin($fkid, $module)
{
    $ref = createPGNRef($module, $fkid);
    if ($ref != null) {
        $ref->deleteRecord();
    }
}
コード例 #9
0
	/**
	 * Retrieves the output of static field as defined in Cluster-Template. 
	 * To be used for Items with maximum cardinality of 1 only. Faster than getContent
	 * @author Tim Haedke
	 * @param string name of the field to query the content from.
	 * @param string additional parameters for this plugin.
	 * @param integer ID of the Cluster-Node to query. Leave Blank or set to zero for Page-Cluster. 
	 * @param integer ID of the Variation to query. Leave Blank or set to zero for Page-Variation. 
	 * @returns string The output of the module.
	 */
	function getStaticContent($name, $param = "", $cclnid = 0, $cvariation = 0) {
		global $clnid, $v, $clid, $c, $db, $contentCounter;

		if ($cclnid == 0)
			$cclnid = $clnid;

		if ($cvariation == 0)
			$cvariation = $v;

		$myclid = getCLID($cclnid, $cvariation);

		$contentCounter['static']++;

		$sql = "SELECT cn.CLT_ID clt, cti.CLTI_ID clti, cti.FKID cid, c.MODULE_ID plugin, cv.FK_ID oid, cti.NAME FROM cluster_node cn, cluster_template_items cti, content c, content_variations cv WHERE cn.CLNID = $cclnid AND cti.CLT_ID = cn.CLT_ID AND UPPER(cti.NAME) = UPPER('$name') AND c.CID = cti.FKID AND cv.CID = cti.FKID AND cv.VARIATION_ID = $cvariation AND cv.DELETED=0;";
		$query = new query($db, $sql);

		while ($query->getrow()) {
			$clt = $query->field("clt");

			$clti = $query->field("clti");
			$clti = $query->field("cid");
			$plugin = $query->field("plugin");
			$oid = $query->field("oid");
		}

		$query->free();

		if ($oid != "" && $plugin != "") {
			$ref = createPGNRef($plugin, $oid);

			$content = $ref->draw($param);
			unset ($ref);
		} else
			$content = "";

		if ($content != "")
			return $content;

		// now the content seems to be empty. So we try standard variation.
		if ($cvariation != $c["stdvariation"])
			$content = getStaticContent($name, $param, $cclnid, $c["stdvariation"]);

		return $content;
	}
コード例 #10
0
$pagemenu->addSubMenu($lang->get("mt_generate_dta", "Generate DataTypes"), "modules/maintenance/datatypes.php", "ADMINISTRATOR", "maintenance");
if ($c["renderstatichtml"]) {
    $pagemenu->addSubMenu($lang->get("rb_cache", "Rebuild Cache"), "modules/maintenance/rebuild_cache.php", "ADMINISTRATOR", "maintenance2");
}
$pagemenu->addSubMenu($lang->get("clear_jpcache", "Clear Cache"), "modules/maintenance/clear_temp_cache.php", "ADMINISTRATOR", "purge");
$pagemenu->addSubMenu($lang->get("logs", "Logfile Analysis"), "modules/logs/logs.php", "LOGS", "logfile");
$pagemenu->addSubMenu($lang->get("sync_clusters", "Synchronize Clusters"), "modules/maintenance/sync_clusters.php", "SYNC_CLUSTERS", "maintenance2");
$pagemenu->addSubMenu($lang->get("mt_lw_site", "Launch whole site"), "modules/maintenance/launch_site.php", "ADMINISTRATOR", "maintenance2");
$pagemenu->addSubMenu($lang->get("maint_mode", "Maintenance Mode"), "modules/maintenance_mode/switchmode.php", "ADMINISTRATOR", "maintenance2");
$pagemenu->addMenu($lang->get("m_installplugin", "Plugins"), "ANY");
$pagemenu->addSubmenu($lang->get("m_pgn"), "modules/plugins/install.php", "ADMINISTRATOR", "plugincontrol");
// retrieve list with all plugins
includePGNSources();
$plugins = createDBCArray("modules", "MODULE_ID", "1");
for ($i = 0; $i < count($plugins); $i++) {
    $ref = createPGNRef($plugins[$i], 0);
    if ($ref->globalConfigPage != "") {
        $ref->registration();
        $pagemenu->addSubMenu($ref->name, $ref->globalConfigPage, $ref->globalConfigRoles, "plugin", false);
    }
}
$pagemenu->addMenu($lang->get("m_admin", "Administration"), "ADMINISTRATION_M", false);
$pagemenu->addSubmenu($lang->get("m_access", "Access"), "modules/user/user_general.php", "USER_MANAGEMENT", "accesscontrol");
$pagemenu->addSubmenu($lang->get("m_var"), "modules/variations/variations.php", "VARIATIONS", "variations");
$pagemenu->addSubMenu($lang->get("m_backup", "Backup"), "modules/backup/backup.php", "BACKUP", "backup");
$pagemenu->addSubMenu($lang->get("m_translation", "Translation"), "modules/translation/translation.php", "TRANSLATION", "translation");
$pagemenu->addSubmenu($lang->get("m_myprofile"), "modules/user/myprofile.php", "ANY", "myprofile");
if ($c["pagetracking"]) {
    $pagemenu->addSubmenu($lang->get("m_report"), "modules/stats/report.php", "TRAFFIC", "stats");
}
$pagemenu->addMenu($lang->get("m_community", "Community"), "ESERVICES", false);
コード例 #11
0
		/**
		 * Retrieves the output of a field as defined in Cluster-Template. 
		 * To be used for Items with every cardinality. Returns an array with the results. 
		 * @param string name of the field to query the content from.
		 * @param string additional parameters for this plugin. 
		 * @param integer ID of the Variation to query. Leave Blank or set to zero for Page-Variation. 
		 * @param string Column, you want to order the output of.
		 * @returns string The output of the module.
		 */
		function getField($name, $params = null, $variation = 0, $order = "POSITION ASC") {
			
			if ($variation == 0)
				$variation = $this->variation;

			// $myclid = getCLID($this->pageClusterNodeId, $this->variation);
			// determine, if static or dynamic content.
			$clt = getDBCell("cluster_node", "CLT_ID", "CLNID = $this->pageClusterNodeId");
			$clti = getDBCell("cluster_template_items", "CLTI_ID", "CLT_ID = $clt AND UPPER(NAME) = UPPER('$name')");

			if ($clti == "") {
				$res[0] = "$name is not defined!";

				return $res;
			}

			$type = getDBCell("cluster_template_items", "CLTITYPE_ID", "CLTI_ID = $clti");
			$res = array ();
			
			if ($type == 1)
				$res[0] = "$name is a static content and therefore not a field!";

			if ($type == 2) { // dynamic field
				$plugin = getDBCell("cluster_template_items", "FKID", "CLTI_ID = $clti");

				$field = createDBCArray("cluster_content", "CLCID", "CLTI_ID = $clti AND CLID = $this->pageClusterId ORDER BY $order");

				if (count($field) == 0 && $variation != $this->parent->stdVariation)
					$res = $this->getField($name, $params, $this->parent->stdVariation, $order);
					
				for ($i = 0; $i < count($field); $i++) {
					if ($field[$i] != "" && $plugin != "") {
						$ref = createPGNRef($plugin, $field[$i]);

						$content = $ref->draw($params);
						unset ($ref);
						array_push($res, $content);
					}
				}
			}  else if ($type == 5) {
				$plugin = getDBCell("cluster_template_items", "FKID", "CLTI_ID = $clti");
				$field = createDBCArray("cluster_content", "FKID", "CLTI_ID = $clti AND CLID = $this->pageClusterId", "ORDER BY ".$order, false);
				
				if (count($field) == 0 && $variation != $this->parent->stdVariation)
					$res = $this->getField($name, $params, $this->parent->stdVariation, $order);

				for ($i = 0; $i < count($field); $i++) {
					if ($field[$i] != "" && $plugin != "") {
						
						$oid = getDBCell("content_variations", "FK_ID", "CID = ".$field[$i]." AND VARIATION_ID = $this->variation AND DELETED=0");
						$ref = createPGNRef($plugin, $oid);

						$content = $ref->draw($params);
						unset ($ref);
						array_push($res, $content);
					}	
				}		
			
			} else {
				$res[0] = "$name is not a content-field!";
			}
			
			return $res;
		}
コード例 #12
0
 		$editpanel = new Panel($lang->get("edit_content"));
 		$buttonbar = new ButtonBar("variations");
 		$buttonbar->selectBoxDescr = true;
 		$buttonbar->setVariationSelector(createNameValueArrayEx("variations", "NAME", "VARIATION_ID", "1"), $variation);        		
 		$editpanel->add($buttonbar);
 		$editpanel->add(new Subtitle("st", $lang->get("title")));
 		$oname = new TextInput($lang->get("o_name"), "content", "NAME", $cond, "type:text,width:200,size:32", "MANDATORY&UNIQUE");
 		$oname->setFilter("CATEGORY_ID = $category_id");
 		$editpanel->add($oname);
 		$editpanel->add(new TextInput($lang->get('access_key', 'Access Key', 'Key-Value with which you can access this content from the editor by typing [key].'), 'content', 'ACCESSKEY', $cond, "type:text,width:100,size:16",'UNIQUE'));        		
 		$editpanel->backto = $c["docroot"] . "modules/content/objectbrowser.php?sid=$sid&resetfilter=1&pnode=$category_id";
 
 		// Edit
 		$editpanel->add(new Subtitle("st", $lang->get("edit_content")));
 		includePGNSource ($content_MODULE_ID);
 		$ref = createPGNRef($content_MODULE_ID, $fkid);
 
 		if ($ref != "") {
 			$ref->edit($editpanel);
 		} else {
 			$editpanel->add(new Label("std", $lang->get("error_init", "Could not initialize the content"), "standardlight"));
 		}
 
 		// Description
 		$editpanel->add(new Subtitle("st", $lang->get("content_desc", "Description of Content")));
 		//$editpanel->add(new TextInput($lang->get("description"), "content", "DESCRIPTION", $cond, "type:textarea,width:300,size:3", ""));
 		$editpanel->add(new TextInput($lang->get("keywords"), "content", "KEYWORDS", $cond, "type:textarea,width:300,size:3", ""));
 		// MetaData 
 		$editpanel->add(new Hidden("resetfilter", '1'));        		
 		$editpanel->add(new MetaDataEditor($oid, $template, 2));
 		$editpanel->add(new FormButtons());
コード例 #13
0
/**
 * synchronize a Variation of a Cluster-Instance with the Cluster-Template.
 * @param integer Cluster-ID, i.e. ID of the Variation.
 */
function syncCluster($clid)
{
    global $db;
    $syncList = null;
    // determine cluster-node.
    $cln = getDBCell("cluster_variations", "CLNID", "CLID = {$clid}");
    // determine cluster-template.
    $clt = getDBCell("cluster_node", "CLT_ID", "CLNID = {$cln}");
    // get a list with the configuration of the cluster...
    $sql = "SELECT CLTI_ID, NAME, MINCARD, MAXCARD, FKID, CLTITYPE_ID FROM cluster_template_items WHERE CLT_ID = {$clt} AND DELETED=0 AND FKID <> 0 ORDER BY POSITION";
    $cltis = new query($db, $sql);
    while ($cltis->getrow()) {
        $cltiId = $cltis->field("CLTI_ID");
        $name = $cltis->field("NAME");
        $mincard = $cltis->field("MINCARD");
        $maxcard = $cltis->field("MAXCARD");
        $type = $cltis->field("CLTITYPE_ID");
        $fkid = $cltis->field("FKID");
        // check, if enough fields are present.
        $syncSQL = "SELECT COUNT(CLCID) AS ANZ FROM cluster_content WHERE CLID = {$clid} AND CLTI_ID = {$cltiId} AND DELETED = 0";
        $syncQuery = new query($db, $syncSQL);
        $syncQuery->getrow();
        $amount = $syncQuery->field("ANZ");
        if ($amount < $mincard) {
            // we must(!) syncronize as there are not enough fields.
            $newpos = 1;
            $maxposSQL = "SELECT MAX(POSITION) AS MPOS FROM cluster_content WHERE CLTI_ID = {$cltiId} AND CLID = {$clid}";
            $mq = new query($db, $maxposSQL);
            if ($mq->getrow()) {
                $newpos = $mq->field("MPOS") + 1;
            }
            $mq->free();
            if ($type == 2) {
                // dynamic content item.
                while ($amount < $mincard) {
                    $nextId = $db->nextid("GUID");
                    $ssql = "INSERT INTO cluster_content (CLCID, CLID, CLTI_ID, POSITION, TITLE, FKID, DELETED) VALUES ";
                    $ssql .= "({$nextId}, {$clid}, {$cltiId}, {$newpos}, '', 0,0)";
                    $synq = new query($db, $ssql);
                    $amount++;
                    $newpos++;
                    $nextsync = count($syncList);
                    $syncList[$nextsync][0] = $nextId;
                    $syncList[$nextsync][1] = $fkid;
                }
            } else {
                if ($type == 4 || $type == 6) {
                    //dynamic cluster item. Create slots.
                    while ($amount < $mincard) {
                        $nextId = $db->nextid("GUID");
                        $ssql = "INSERT INTO cluster_content (CLCID, CLID, CLTI_ID, POSITION, TITLE, FKID, DELETED) VALUES ";
                        $ssql .= "({$nextId}, {$clid}, {$cltiId}, {$newpos}, '', 0,0)";
                        $synq = new query($db, $ssql);
                        $amount++;
                        $newpos++;
                    }
                } else {
                    if ($type == 5) {
                        //library content. Create slots.
                        while ($amount < $mincard) {
                            $nextId = $db->nextid("GUID");
                            $ssql = "INSERT INTO cluster_content (CLCID, CLID, CLTI_ID, POSITION, TITLE, FKID, DELETED) VALUES ";
                            $ssql .= "({$nextId}, {$clid}, {$cltiId}, {$newpos}, '', 0,0)";
                            $synq = new query($db, $ssql);
                            $amount++;
                            $newpos++;
                        }
                    } else {
                        if ($type == 8) {
                            //channel. Create empty slots.
                            while ($amount < $mincard) {
                                $nextId = nextGUID();
                                $ssql = "INSERT INTO cluster_content (CLCID, CLID, CLTI_ID, POSITION, TITLE, FKID, DELETED) VALUES ";
                                $ssql .= "({$nextId}, {$clid}, {$cltiId}, {$newpos}, '', 0,0)";
                                $synq = new query($db, $ssql);
                                $amount++;
                                $newpos++;
                                createCenterstage($nextId);
                            }
                        }
                    }
                }
            }
        }
        /*if ($amount > $maxcard) {
        	  // there is nothing to be done. This check is to be performed when
        	  // launching a cluster and therefore an error has to be prompted!
          }*/
    }
    // traverse through synclist;
    $counter = 0;
    while (count($syncList) > $counter) {
        $PGNRef = createPGNRef($syncList[$counter][1], $syncList[$counter][0]);
        if ($PGNRef != null) {
            $PGNRef->sync();
        }
        //syncMetas($syncList[$counter][0], "CLUSTERCONTENT");
        //reactivate for having meta on each cluter-item...
        $counter++;
    }
}
コード例 #14
0
		/**
		 * 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));
				}
			}
		}
コード例 #15
0
		/**
		 * Retrieves the output of a field as defined in Cluster-Template. 
		 * To be used for Items with every cardinality. Returns an array with the results. 
		 * @param string name of the field to query the content from.
		 * @param string additional parameters for this plugin. 
		 * @param integer ID of the Variation to query. Leave Blank or set to zero for Page-Variation. 
		 * @param string Column, you want to order the output of.
		 * @returns string The output of the module.
		 */
		function getField($name, $params = null, $variation = 0, $order = "POSITION ASC") {
			global $sid, $lang, $c;			
			$linkadd = "";	
			
			if ($variation == 0)
				$variation = $this->variation;

			// $myclid = getCLID($this->pageClusterNodeId, $this->variation);
			// determine, if static or dynamic content.
			$clt = getDBCell("cluster_node", "CLT_ID", "CLNID = $this->pageClusterNodeId");
			$clti = getDBCell("cluster_template_items", "CLTI_ID", "CLT_ID = $clt AND UPPER(NAME) = UPPER('$name')");

			if ($clti == "") {
				$res[0] = "$name is not defined!";

				return $res;
			}

			$type = getDBCell("cluster_template_items", "CLTITYPE_ID", "CLTI_ID = $clti");
			$res = array ();

			if ($type == 1)
				$res[0] = "$name is a static content and therefore not a field!";

			if ($type == 2) { // dynamic field
				$plugin = getDBCell("cluster_template_items", "FKID", "CLTI_ID = $clti");

				$field = createDBCArray("cluster_content", "CLCID", "CLTI_ID = $clti AND CLID = $this->pageClusterId ORDER BY $order");

				if (count($field) == 0 && $this->variation != $this->parent->stdVariation)
					$res = $this->getField($name, $params, $order, $this->parent->stdVariation);

				for ($i = 0; $i < count($field); $i++) {
					if ($field[$i] != "" && $plugin != "") {
						$linkadd = "<a href=\"#\" onClick=\"window.open('" . $c["docroot"] . "modules/sitepages/sma_editor.php?sid=$sid&oid=" . $field[$i] . "', 'sma', 'top=100,width=650,height=380,toolbar=no,menubar=no,status=no,location=no,dependent=yes,scrollbars=yes');\"><img src=\"" . $c["docroot"] . "img/icons/sma_edit.gif\" alt=\"" . $lang->get("sma_ext_edit", "Open edit window. Save all inline edited texts before!"). "\" width=\"16\" height=\"16\" border=\"0\"></a>";
						$ref = createPGNRef($plugin, $field[$i]);
						$content = $ref->drawLiveAuthoring($param);
						if ($param == "")
							$content .= $linkadd;
						unset ($ref);
						array_push($res, $content);
					}
				}
			}  else if ($type == 5) {
				$plugin = getDBCell("cluster_template_items", "FKID", "CLTI_ID = $clti");

				$field = createDBCArray("cluster_content", "FKID", "CLTI_ID = $clti AND CLID = $this->pageClusterId ORDER BY $order");

				if (count($field) == 0 && $this->variation != $this->parent->stdVariation)
					$res = $this->getField($name, $params, $order, $this->parent->stdVariation);

				for ($i = 0; $i < count($field); $i++) {
					if ($field[$i] != "" && $plugin != "") {
						
						$oid = getDBCell("content_variations", "FK_ID", "CID = ".$field[$i]." AND VARIATION_ID = $this->variation AND DELETED=0");
						$ref = createPGNRef($plugin, $oid);

						$content = $ref->drawLiveAuthoring($params);
						unset ($ref);
						array_push($res, $content);
					}	
				}		
			
			} else {
				$res[0] = "$name is not a content-field!";
			}
			
			return $res;
		}
コード例 #16
0
ファイル: help.php プロジェクト: BackupTheBerlios/nxwcms-svn
	/**
	 * Creates an instance of the Selected module and variation.
	 * returns the plugin-Class
	 * @param integer ID of the content
	 * @param integer Variation ID to select appropriate recordset for.
	 * @return Object	Object of type Plugin.
	 */
	function createPGNRef2($contentId, $variation=0) {
		global $c, $cds;
		if ($variation==0 && ! is_object($cds)) $variation = variation();
		$modId = getDBCell("content", "MODULE_ID", "CID=".$contentId);
		$check = getDBCell("content_variations", "VARIATION_ID", "VARIATION_ID = $variation AND CID = $contentId");
		if ($check =="") {
			$variation = getDBCell("content_variations", "VARIATION_ID", "CID = $contentId");
		}
		$fkid = getDBCell("content_variations", "FK_ID", "CID = $contentId AND VARIATION_ID = ".$variation);
		
        if ($modId != "") {
			includePGNSource($modId);
			return createPGNRef($modId, $fkid);
        }
	}
コード例 #17
0
<?php

require_once "../../config.inc.php";
require_once $c["path"] . "api/auth/auth_sma.php";
$sid = $_COOKIE["nxwcms"];
$auth = new authSMA("B_LIVE_AUTHORING", false);
$disableMenu = true;
$page = new page("SMA Editor");
$sma = 1;
$oid = value("oid", "NUMERIC");
if ($oid != "0") {
    includePGNISources();
    $page_action = "UPDATE";
    $go = "-";
    $form = new EditForm($lang->get("ed_content"));
    $jsupdate = new HTMLContainer("con", "standard", 2);
    $jsupdate->add("<script language=\"JavaScript\">opener.document.location.reload();window.close();</script>");
    $ref = createPGNRef(getModuleFromCLC($oid), $oid);
    $ref->edit($form);
    if ($page_state == "processing") {
        $form->add($jsupdate);
    }
    $page->add($form);
}
$page->draw();
コード例 #18
0
		function draw() {
			global $lang, $c, $sid, $aclf;

			echo '<td colspan="' . $this->cells . '">';			
			echo '<table cellpadding="0" cellspacing="0" height="140" border="0" width="190">';
			echo '<tr>';
			echo '<td width="190" height="1">' . drawSpacer(190, 1). '</td>';			
			echo '</tr>';
			echo '<tr>';
			echo '<td class="headbox">';
			echo '<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td>';
			echo '<b>'.$this->name.'</b>&nbsp;&nbsp;&nbsp;('.$this->module_name.')';						
			echo '</td><td align="right"><b>';
			// draw Links depending on $linkset
			
			$ref = createPGNRef($this->module_id, $this->fkid);

			$preview = "";
			if ($ref != null) {
				if ($ref->management_table == "pgn_image") $ref_array = $ref->draw("ALL");			
			}
			
			// draw information on the content
			echo '</b>';			
			echo '</td></tr></table>';
			echo '</td></tr>';
			echo '<tr><td class="standardlight">';
			if (stristr($this->linkset, "LIB") || stristr($this->linkset, "EDIT")) {
				if ($aclf->checkAccessToFunction("EDIT_OBJECT") || $aclf->checkAccessToFunction("OBJECT_PROPS"))
					echo buttonLink($lang->get("edit"), $c["docroot"] . "modules/content/object_edit.php?go=update&sid=$sid&oid=" . $this->oid). "&nbsp;";
			}

			
			if (stristr($this->linkset, "LIB") || stristr($this->linkset, "LAUNCH")) {				
				if ($aclf->checkAccessToFunction("OBJECT_LAUNCH"))
					echo buttonLink($lang->get("launch", "Launch"), "?action=launch&sid=$sid&oid=" . $this->oid). "&nbsp;&nbsp;";
			}

			if (stristr($this->linkset, "LIB") || stristr($this->linkset, "DELETE")) {
				if ($aclf->checkAccessToFunction("DELETE_OBJECT"))
					echo buttonLink($lang->get("Delete"), "?action=delobject&sid=$sid&oid=" . $this->oid). "&nbsp;&nbsp;";
			}


			if (stristr($this->linkset, "SELECT")) {
				echo drawSpacer("10", "1");
				if ($aclf->checkAccessToFunction("EDIT_CL_CONTENT")) {
					global $sname;
					if ($sname != "0" && $sname!="") {	
						$jsAction="javascript:window.opener.document.getElementById('".$sname."').value='".$this->oid."';window.opener.document.getElementById('disp_".$sname."').innerHTML='".$lang->get("prev_avail", "You selected an object. A preview will be available after saving.")."';window.close();";						
					} else {
						$jsAction = "javascript:getImage('" . $ref_array["path"] . "');ok();";
					}
					echo buttonLink($lang->get("select", "Select"), "$jsAction"). "&nbsp;&nbsp;";
				}
			}			
			echo '</td></tr>';
			echo '<tr>';
			echo '<td valign="top" align="center" class="standardlight">';
			echo  $ref->preview();
			echo '</td></tr>';
			
			echo '<tr><td valign="top" class="standardlight">';		
			echo '<b>'.$lang->get("ackey", 'Access Key'). ":</b> ";
			echo "[".$this->accesskey."]";
			echo "</td>";
			echo "</tr>";			
			
			echo '<tr><td class="line">'.drawSpacer(1,1).'</td></tr>';			
			echo "</table>";
			br();
			echo "</td>";
			unset($ref);
			return 1;
		}