Add files via upload
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"elements":
|
||||||
|
[
|
||||||
|
{ "type": "Label", "caption": "Trello Properties" },
|
||||||
|
{ "type": "ValidationTextBox", "name": "TrelloBoardId", "caption": "Trello Board-ID" },
|
||||||
|
{ "type": "ValidationTextBox", "name": "TrelloApiKey", "caption": "Trello API-Key" },
|
||||||
|
{ "type": "ValidationTextBox", "name": "TrelloApiToken", "caption": "Trello API-Token" },
|
||||||
|
{ "type": "NumberSpinner", "name": "Updateintervall", "caption": "Minutes" },
|
||||||
|
{ "type": "Label", "caption": "HTML-Box Properties" },
|
||||||
|
{ "type": "ValidationTextBox", "name": "BgColor", "caption": "Backgoundcolor as HEX or HTML-Color" },
|
||||||
|
{ "type": "ValidationTextBox", "name": "FontColor", "caption": "Fontcolor as HEX or HTML-Color" },
|
||||||
|
{ "type": "ValidationTextBox", "name": "FontSize", "caption": "Fontsize as px or rem" },
|
||||||
|
{ "type": "ValidationTextBox", "name": "HoverColor", "caption": "Hovercolor as HEX or HTML-Color" }
|
||||||
|
],
|
||||||
|
"actions":
|
||||||
|
[
|
||||||
|
{ "type": "Button", "label": "Update", "onClick": "TRC_Update($id);" }
|
||||||
|
],
|
||||||
|
"status":
|
||||||
|
[
|
||||||
|
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"id": "{907267F9-9AEA-9AA3-E88D-F38E450341AD}",
|
||||||
|
"name": "Trello Read Cards",
|
||||||
|
"type": 3,
|
||||||
|
"vendor": "Trello",
|
||||||
|
"aliases":
|
||||||
|
[
|
||||||
|
],
|
||||||
|
"url": "https://jh-artworks.com",
|
||||||
|
"parentRequirements": [],
|
||||||
|
"childRequirements": [],
|
||||||
|
"implemented": [],
|
||||||
|
"prefix": "TRC"
|
||||||
|
}
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
<?
|
||||||
|
// Klassendefinition
|
||||||
|
class TrelloReadCards extends IPSModule {
|
||||||
|
// Überschreibt die interne IPS_Create($id) Funktion
|
||||||
|
public function Create() {
|
||||||
|
// Diese Zeile nicht löschen.
|
||||||
|
parent::Create();
|
||||||
|
|
||||||
|
$this->RegisterPropertyString("TrelloBoardId","");
|
||||||
|
$this->RegisterPropertyString("TrelloApiKey","");
|
||||||
|
$this->RegisterPropertyString("TrelloApiToken","");
|
||||||
|
|
||||||
|
$this->RegisterPropertyString("BgColor","#4CAF50");
|
||||||
|
$this->RegisterPropertyString("FontColor","white");
|
||||||
|
$this->RegisterPropertyString("FontSize","1.5rem");
|
||||||
|
$this->RegisterPropertyString("HoverColor","lightblue");
|
||||||
|
|
||||||
|
$this->RegisterTimer("Update", 0, 'TRC_Update('.$this->InstanceID.');');
|
||||||
|
$this->RegisterPropertyInteger("Updateintervall",5);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Überschreibt die intere IPS_ApplyChanges($id) Funktion
|
||||||
|
public function ApplyChanges() {
|
||||||
|
// Diese Zeile nicht löschen
|
||||||
|
parent::ApplyChanges();
|
||||||
|
$this->SetTimerInterval("Update", $this->ReadPropertyInteger("Updateintervall") * 60 * 1000);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Die folgenden Funktionen stehen automatisch zur Verfügung, wenn das Modul über die "Module Control" eingefügt wurden.
|
||||||
|
* Die Funktionen werden, mit dem selbst eingerichteten Prefix, in PHP und JSON-RPC wiefolgt zur Verfügung gestellt:
|
||||||
|
*
|
||||||
|
* DWM_SendMessage($id);
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function Update() {
|
||||||
|
|
||||||
|
// Discord webhook URL
|
||||||
|
$boardid = $this->ReadPropertyString("TrelloBoardId");
|
||||||
|
$apikey = $this->ReadPropertyString("TrelloApiKey");
|
||||||
|
$apitoken = $this->ReadPropertyString("TrelloApiToken");
|
||||||
|
$bgcolor = $this->ReadPropertyString("BgColor");
|
||||||
|
$fontcolor = $this->ReadPropertyString("FontColor");
|
||||||
|
$fontsize = $this->ReadPropertyString("FontSize");
|
||||||
|
$hovercolor = $this->ReadPropertyString("HoverColor");
|
||||||
|
|
||||||
|
$url ='https://api.trello.com/1/boards/'.$boardid.'/lists?key='.$apikey.'&token='.$apitoken.''; ///get all lists on board
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
|
$output = curl_exec($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
$content = json_decode($output, true);
|
||||||
|
|
||||||
|
|
||||||
|
$lists=$content;
|
||||||
|
foreach ($lists as $list)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$url = 'https://api.trello.com/1/lists/'.$list['id'].'/cards?key='.$apikey.'&token='.$apitoken.''; ///get all cards on list
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
|
$output = curl_exec($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
$content = json_decode($output, true);
|
||||||
|
///print_r($list['name']);
|
||||||
|
$allcardsFull[$list['name']]=$content;
|
||||||
|
}
|
||||||
|
////print_r($allcardsFull);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$style = '<style>
|
||||||
|
|
||||||
|
th {
|
||||||
|
background-color: '.$bgcolor.';
|
||||||
|
color: '.$fontcolor .';
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
border-bottom: 1px solid grey;
|
||||||
|
font-size:'.$fontsize.';
|
||||||
|
}
|
||||||
|
|
||||||
|
tr:hover {background-color: '.$hovercolor.';}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
';
|
||||||
|
$keyindex =0;
|
||||||
|
$keys = array_keys($allcardsFull);
|
||||||
|
foreach ($allcardsFull as $cardfull){
|
||||||
|
|
||||||
|
$tdhtml ='';
|
||||||
|
|
||||||
|
|
||||||
|
foreach($cardfull as $card) {
|
||||||
|
|
||||||
|
$tdhtml .= '<tr><td>'.$card['name'].'</td></tr>';
|
||||||
|
//print_r ($name);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$html = $style.'<table width=100%>'.$tdhtml.'</table>';
|
||||||
|
$variablenID = $this->RegisterVariableString("card".$keyindex, $keys[$keyindex], "~HTMLBox",$keyindex);
|
||||||
|
SetValueString($variablenID,$html);
|
||||||
|
|
||||||
|
$keyindex ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"id": "{907267F9-9AEA-9AA3-E88D-F38E450341AD}",
|
||||||
|
"author": "J.H. Artworks",
|
||||||
|
"name": "Trello",
|
||||||
|
"url": "https://jh-artworks.com",
|
||||||
|
"compatibility": {
|
||||||
|
"version": "6.0",
|
||||||
|
"date": 1491343200
|
||||||
|
},
|
||||||
|
"version": "1.0",
|
||||||
|
"build": 0,
|
||||||
|
"date": 0
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user