private function InitIPSStructure($libraryBasePath) { $path = 'IPSLibrary.install.IPSModuleManager.IPSVersionHandler'; if ($libraryBasePath <> '') { $path = $libraryBasePath.'.'.$path; } $categoryId = CreateCategoryPath($path); $this->instanceId = CreateDummyInstance("IPSLibrary", $categoryId, 30); $this->libraryBasePath = $libraryBasePath; }
function Migrate_Structure($module, $oldPath, $newPath, $filePath) { $oldCategoryId = @get_ObjectIDByPath($oldPath, true); if ($oldCategoryId==null) { echo "$oldPath not found ...\n"; return; } // Download new Module Scripts $moduleManager = new IPSModuleManager($module); //$moduleManager->DeployModule(); $moduleManager->LoadModule(); // Migrate existing Structure CreateCategoryPath($newPath); $newCategoryPath = str_replace('.app.', '.data.', $newPath); $newCategoryId = CreateCategoryPath($newCategoryPath); foreach (IPS_GetChildrenIDs($oldCategoryId) as $idx=>$childId) { $object = IPS_GetObject($childId); switch($object['ObjectType']) { case 0: // Category case 1: // Instance echo "Migrate Category=$childId, Name=".IPS_GetName($childId)."\n"; Migrate_Category($childId, $filePath); IPS_SetParent($childId, $newCategoryId); break; case 2: // Variable echo "Migrate Variable=$childId, Name=".IPS_GetName($childId)."\n"; IPS_SetParent($childId, $newCategoryId); break; case 3: // Script Delete_Script($childId, $filePath); break; default: echo "Unknown Object=$childId, Name=".IPS_GetName($childId)."\n"; } echo "Move $childId from $oldCategoryId to $newCategoryId ($newCategoryPath)\n"; } if (!IPS_DeleteCategory($oldCategoryId)) { echo "Error deleting old Category ".IPS_GetName($oldCategoryId)."\n"; exit; } echo '-------------------------------------------------------------------------------------------------------------'.PHP_EOL; echo '---- Bestehende Variablen von Modul '.$module.' wurden in die neue Strukture migriert'.PHP_EOL; echo '----'.PHP_EOL; echo '---- Anpassung der Konfiguration und erneute Installation muss manuell gemacht werden !!!'.PHP_EOL; echo '---- ACHTUNG: Pfad für WebFront und Mobile Installation haben sich geändert (liegt jetzt unter "Visualization.WebFront"'.PHP_EOL; echo '---- bzw. "Visualization.Mobile". Pfad im Init File (/IPSLibrary/install/InitializationFiles/<<Module>>.ini'.PHP_EOL; echo '---- anpassen oder Links manuell verschieben.'.PHP_EOL; echo '---- Im Zweifel einfach die bestehenden Strukture des jeweiligen Modules löschen, und eine erneute Installation'.PHP_EOL; echo '---- Installation ausführen.'.PHP_EOL; echo '-------------------------------------------------------------------------------------------------------------'.PHP_EOL; }
CreateWFCItemSplitPane ($WFC10_ConfigId, $tabItem, $WFC10_TabPaneItem, $WFC10_TabOrder, $WFC10_TabName, $WFC10_TabIcon, 1 /*Vertical*/, 300 /*Width*/, 1 /*Target=Pane2*/, 1/*UsePixel*/, 'true'); CreateWFCItemSplitPane ($WFC10_ConfigId, $tabItem.'_Left', $tabItem, 10, '', '', 0 /*Horicontal*/, 205 /*Height*/, 0 /*Target=Pane1*/, 1 /*UsePixel*/, 'true'); CreateWFCItemCategory ($WFC10_ConfigId, $tabItem.'_Right'.$UId, $tabItem, 20, '', '', $categoryId_WebFrontRight /*BaseId*/, 'false' /*BarBottomVisible*/); CreateWFCItemSplitPane ($WFC10_ConfigId, $tabItem.'_Top', $tabItem.'_Left', 10, '', '', 1 /*Vertical*/, 50 /*Width*/, 0 /*Target=Pane1*/, 0 /*UsePercentage*/, 'true'); CreateWFCItemCategory ($WFC10_ConfigId, $tabItem.'_Bottom'.$UId, $tabItem.'_Left', 20, '', '', $categoryId_WebFrontBottom /*BaseId*/, 'false' /*BarBottomVisible*/); CreateWFCItemCategory ($WFC10_ConfigId, $tabItem.'_TopLeft'.$UId, $tabItem.'_Top', 10, '', '', $categoryId_WebFrontTopLeft /*BaseId*/, 'false' /*BarBottomVisible*/); CreateWFCItemCategory ($WFC10_ConfigId, $tabItem.'_TopRight'.$UId, $tabItem.'_Top', 20, '', '', $categoryId_WebFrontTopRight /*BaseId*/, 'false' /*BarBottomVisible*/); ReloadAllWebFronts(); } // ---------------------------------------------------------------------------------------------------------------------------- // Mobile Installation // ---------------------------------------------------------------------------------------------------------------------------- if ($Mobile_Enabled) { $mobileId = CreateCategoryPath($Mobile_Path, $Mobile_PathOrder, $Mobile_PathIcon); $mobileId = CreateCategoryPath($Mobile_Path.'.'.$Mobile_Name, $Mobile_Order, $Mobile_Icon); $InstanceId = CreateDummyInstance("Sonnen-Aufgang/Untergang", $mobileId, 10); CreateLink('Begin/Ende', $SunriseDisplay, $InstanceId, 10); CreateLink('Limits', $SunriseLimits, $InstanceId, 20); $InstanceId = CreateDummyInstance("Zivile Dämmerung", $mobileId, 20); CreateLink('Begin/Ende', $CivilDisplay, $InstanceId, 10); CreateLink('Limits', $CivilLimits, $InstanceId, 20); $InstanceId = CreateDummyInstance("Nautische Dämmerung", $mobileId, 30); CreateLink('Begin/Ende', $NauticDisplay, $InstanceId, 10); CreateLink('Limits', $NauticLimits, $InstanceId, 20); $InstanceId = CreateDummyInstance("Astronomische Dämmerung", $mobileId, 40); CreateLink('Begin/Ende', $AstronomicDisplay, $InstanceId, 10); CreateLink('Limits', $AstronomicLimits, $InstanceId, 20); CreateLinkByDestination("Jahres Grafik", $YearUnlimitedMediaId, $mobileId, 100);
SetVariableConstant ("NP_ID_CDTRACKNAV", $cdTrackNavId, 'NetPlayer_IDs.inc.php', 'IPSLibrary::app::modules::NetPlayer'); SetVariableConstant ("NP_ID_RADIOLIST", $radioListId, 'NetPlayer_IDs.inc.php', 'IPSLibrary::app::modules::NetPlayer'); SetVariableConstant ("NP_ID_RADIONAV", $radioNavId, 'NetPlayer_IDs.inc.php', 'IPSLibrary::app::modules::NetPlayer'); SetVariableConstant ("NP_ID_SOURCE", $sourceId, 'NetPlayer_IDs.inc.php', 'IPSLibrary::app::modules::NetPlayer'); SetVariableConstant ('"NP_ID_CONTROL"', $controlId, 'NetPlayer_IDs.inc.php', 'IPSLibrary::app::modules::NetPlayer'); // Installation of Components IPSUtils_Include ("NetPlayer_Constants.inc.php", "IPSLibrary::app::modules::NetPlayer"); IPSUtils_Include ("NetPlayer_Configuration.inc.php", "IPSLibrary::config::modules::NetPlayer"); $params = explode(',',NETPLAYER_COMPONENT); if ($params[0] == 'IPSComponentPlayer_Mediaplayer') { if (!is_numeric($params[1])) { $pathItems = explode('.',$params[1]); $mediaPlayerName = $pathItems[count($pathItems)-1]; unset($pathItems[count($pathItems)-1]); $path = implode('.', $pathItems); $categoryId = CreateCategoryPath($path); // Create MediaPlayer $mediaPlayerInstanceId = CreateMediaPlayer($mediaPlayerName, $categoryId, 0); $mediaPlayerTitel = IPS_GetVariableIDByName('Titel', $mediaPlayerInstanceId); // Register Message Handler IPSMessageHandler::RegisterOnChangeEvent($mediaPlayerTitel/*Var*/, 'IPSComponentPlayer_MediaPlayer,'.$mediaPlayerInstanceId, 'IPSModulePlayer_NetPlayer'); } } /** @}*/ ?>
/** * @public * * Die Funktion registriert ein ScriptFile anhand des Filenames und Directory Pfades in IPS * * @param string $file Name des Script Files */ public function RegisterScriptByFilename($file) { $scriptPath = $this->GetScriptPathByFileName($file); $scriptName = $this->GetScriptNameByFileName($file); if (strpos($file, IPS_GetKernelDir().'scripts\\')===0) { $this->logHandler->Debug("Register Script $scriptName in $scriptPath (File=$file)"); $categoryId = CreateCategoryPath($scriptPath); CreateScript($scriptName, $file, $categoryId); } else { $this->logHandler->Debug("Script $scriptName NOT registered (Filepath)"); } }
} } if (!$widget) { CreateWFCItemWidget ($WFC10_ConfigId, 'IPSLogger_Widget', 'roottp', 90, $ID_SingleOutMsg, $ID_ScriptIPSLoggerClearSingleOut); } ReloadAllWebFronts(); } // ---------------------------------------------------------------------------------------------------------------------------- // iPhone Installation // ---------------------------------------------------------------------------------------------------------------------------- if ($Mobile_Enabled) { $ID_CategoryiPhone = CreateCategoryPath($Mobile_Path, $Mobile_PathOrder, $Mobile_PathIcon); CreateLink($Mobile_Name1, $ID_HtmlOutMsgList, $ID_CategoryiPhone, $Mobile_Order1); $ID_CategoryiPhone = CreateCategoryPath($Mobile_Path.'.'.$Mobile_Name2, $Mobile_Order2, $Mobile_Icon2); $ID_Output = CreateDummyInstance("Widget", $ID_CategoryiPhone, 100); CreateLink('Output Enabled', $ID_SingleOutEnabled, $ID_Output, 10); CreateLink('Logging Level', $ID_SingleOutLevel, $ID_Output, 20); CreateLink('Last Message', $ID_SingleOutMsg, $ID_Output, 30); CreateLink('Clear Message', $ID_ScriptIPSLoggerClearSingleOut,$ID_Output, 40); $ID_Output = CreateDummyInstance("WebFront", $ID_CategoryiPhone, 200); CreateLink('Output Enabled', $ID_HtmlOutEnabled, $ID_Output, 10); CreateLink('Logging Level', $ID_HtmlOutLevel, $ID_Output, 20); CreateLink('Message Count', $ID_HtmlOutMsgCount, $ID_Output, 30); CreateLink('Clear Output', $ID_ScriptIPSLoggerClearHtmlOut, $ID_Output, 50); $ID_Output = CreateDummyInstance("IPS", $ID_CategoryiPhone, 300); CreateLink('Output Enabled', $ID_IPSOutEnabled, $ID_Output, 10);
// Create Serial Port $id_IOComPort = null; if ($configData[EDIP_CONFIG_COMPORT] <> '') { $id_IOComPort = CreateSerialPort('EDIP_'.$configData[EDIP_CONFIG_NAME], $configData[EDIP_CONFIG_COMPORT], 115200, 1, 8, 'None',0, $IgnoreIOPortInstanceError); } // Create Register Variable $registerIdConfig = $configData[EDIP_CONFIG_REGISTER]; if ($registerIdConfig==null) { if ($id_IOComPort==null) { throw new IPSConfigHandlerException('Register Variable and ComPort not defined !!!'); } $registerIdConfig = CreateRegisterVariable($configData[EDIP_CONFIG_NAME].'_Register', $CategoryIdHW, $id_ScriptReceive, $id_IOComPort); } // Create Root Category if (!is_numeric($configData[EDIP_CONFIG_ROOT])) { CreateCategoryPath($configData[EDIP_CONFIG_ROOT]); } SetValue($id_Register, IPSUtil_ObjectIDByPath($registerIdConfig)); SetValue($id_Root, IPSUtil_ObjectIDByPath($configData[EDIP_CONFIG_ROOT])); SetValue($id_Current, IPSUtil_ObjectIDByPath($configData[EDIP_CONFIG_ROOT])); SetValue($id_value, 0); } else { echo "Register/Root Ids NOT assigned... \n"; } } CreateTimer_CyclicBySeconds ('Timer', $id_ScriptTimer, EDIP_CONFIG_REFRESHTIMER); SetVariableConstant ("EDIP_ID_PROGRAM", $CategoryIdData, 'IPSEDIP_IDs.inc.php', 'IPSLibrary::app::hardware::IPSEDIP'); SetVariableConstant ("EDIP_ID_EVENTSCRIPT",$id_ScriptEvent, 'IPSEDIP_IDs.inc.php', 'IPSLibrary::app::hardware::IPSEDIP');
$timerId_SearchUpdates = CreateTimer_OnceADay ('SearchUpdates', $scriptIdSearchUpdates, rand(0,4), rand(0,59)) ; // =================================================================================================== // Add Module Details // =================================================================================================== $variableIdStatus = CreateVariable(IPSMMG_VAR_ACTION, 3 /*String*/, $CategoryIdData, 10, '~String', null, 'Overview', ''); $variableIdModule = CreateVariable(IPSMMG_VAR_MODULE, 3 /*String*/, $CategoryIdData, 20, '~String', null, '', ''); $variableIdInfo = CreateVariable(IPSMMG_VAR_INFO, 3 /*String*/, $CategoryIdData, 30, '~String', null, '', ''); $variableIdHTML = CreateVariable(IPSMMG_VAR_HTML, 3 /*String*/, $CategoryIdData, 40, '~HTMLBox', null, '<iframe frameborder="0" width="100%" height="600px" src="../user/IPSModuleManagerGUI/IPSModuleManagerGUI.php"</iframe>', 'Information'); // ---------------------------------------------------------------------------------------------------------------------------- // Webfront Installation // ---------------------------------------------------------------------------------------------------------------------------- if ($WFC10_Enabled) { $categoryId_WebFront = CreateCategoryPath($WFC10_Path); EmptyCategory($categoryId_WebFront); CreateLink('IPSLibrary', $variableIdHTML, $categoryId_WebFront, 10); // System Tabpane CreateWFCItemTabPane ($WFC10_ConfigId, $WFC10_TabPaneItem, $WFC10_TabPaneParent, $WFC10_TabPaneOrder, $WFC10_TabPaneName, $WFC10_TabPaneIcon); // IPSLibrary Tabpane $tabItem = $WFC10_TabPaneItem.$WFC10_TabItem; DeleteWFCItems($WFC10_ConfigId, $tabItem); //CreateWFCItemExternalPage ($WFC10_ConfigId, $tabItem, $WFC10_TabPaneItem, $WFC10_TabOrder, $WFC10_TabName, $WFC10_TabIcon, "user\/IPSModuleManagerGUI\/IPSModuleManagerGUI.php", 'false' /*BarBottomVisible*/); CreateWFCItemCategory ($WFC10_ConfigId, $tabItem, $WFC10_TabPaneItem, $WFC10_TabOrder, $WFC10_TabName, $WFC10_TabIcon, $categoryId_WebFront, 'false' /*BarBottomVisible*/); ReloadAllWebFronts(); }
} // Bottom Left CreateLink('Meldungen', $ControlIdLog, $WebFrontOverviewBottom1, 10); // Bottom Right CreateLink('Automatic Ein', $ScriptIdAutomaticOn, $WebFrontOverviewBottom2, 10); CreateLink('Automatic Aus', $ScriptIdAutomaticOff, $WebFrontOverviewBottom2, 20); ReloadAllWebFronts(); } // ---------------------------------------------------------------------------------------------------------------------------- // Mobile Definition // ---------------------------------------------------------------------------------------------------------------------------- if ($Mobile_Enabled) { $mobileId = CreateCategoryPath($Mobile_Path, $Mobile_PathOrder, $Mobile_PathIcon); $Idx = 10; foreach ($WaterConfig as $CircleId=>$CircleData) { $CirclyId = get_WateringCirclyId($CircleId, $CategoryIdCircles); $CircleName = $CircleData[c_Property_Name]; // iPhone Overview CreateLink($CircleName, get_WateringControlId(c_Control_Active, $CirclyId), $mobileId, $Idx); // Detailed CirclyData $WebFrontiPhoneDetailId = CreateCategory($CircleName, $mobileId, $Idx*10); $iPhoneControl = CreateDummyInstance("Steuerung", $WebFrontiPhoneDetailId, 10); CreateLink('Status', get_WateringControlId(c_Control_Active, $CirclyId), $iPhoneControl, 10); CreateLink('Automatik', get_WateringControlId(c_Control_Automatic, $CirclyId), $iPhoneControl, 20); $iPhoneProgram = CreateDummyInstance("Programm", $WebFrontiPhoneDetailId, 20);