TYPO3 Plugin nur für Typoscript-Einbindung [closed] - typo3-6.2.x

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
Ich habe ein Plugin einer Extension dass ich nur über TypoScript einbinden möchte. In der Plugin-Liste des CE-Wizards soll es nicht erscheinen. Ich möchte das dann im Fluid per typoscriptObject Viewhelper laden.
Wie blende ich es im Wizard aus?

I do not register the plugin in ext_tables.php, thus it will not be shown in frontend. My TS setup for the plugin is:
lib.kofcagents_headerimage = USER
lib.kofcagents_headerimage {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = Agents
pluginName = pi5
vendorName = Vendor
controller = Library
action = showHeaderImage
switchableControllerActions {
Library {
1 = showHeaderImage
}
}
view < plugin.tx_agents.view
persistence < plugin.tx_agents.persistence
settings < plugin.tx_agents.settings
}

Related

Recriando o evryone do discord no whatsapp [closed]

Closed. This question is not written in English. It is not currently accepting answers.
Stack Overflow is an English-only site. The author must be able to communicate in English to understand and engage with any comments and/or answers their question receives. Don't translate this post for the author; machine translations can be inaccurate, and even human translations can alter the intended meaning of the post.
Closed 3 days ago.
Improve this question
Eu estou tentado adaptar o !everyone do discord em bot do whats, só que não sei como e não cho nada sobre. o problema é só em ocultar tudo, já está marcando normal.
Esse é uma parte do meu código;
client.on("ready", async () => {
console.log("Conexão feita! Valeu boy.");
client.on('message', async (msg) => {
if (msg.body === '!everyone') {
const chat = await msg.getChat();
let text = "";
let mentions = [];
for (let participant of chat.participants) {
const contact = await client.getContactById(participant.id._serialized);
mentions.push(contact);
text += `#${participant.id.user} `;
}
await chat.sendMessage(text, { mentions });
}
});
});

Google App Script Email as PDF from Spreadsheet [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
My code below for generate PDF attachment is working fine but they send all data in the spreadsheet.
Anyone can help to send only the specify spreadsheet like my code only sheet"Email" in stead of All sheets ?
Thank you
function SendEmail() {
try {
var ss = SpreadsheetApp.getActive();
var url = "https://docs.google.com/feeds/download/spreadsheets/Export?key=" + ss.getId() + "&exportFormat=pdf";
var params = {
method : "get",
headers : {"Authorization": "Bearer " + ScriptApp.getOAuthToken()},
muteHttpExceptions: true
};
var blob = UrlFetchApp.fetch(url, params).getBlob();
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Email')
var subjectrange = sheet.getRange("A20");
var subjectdata = subjectrange.getValues();
var emailranges=sheet.getRange('E14');
var emaildata=emailranges.getValue();
var username=ss.getSheetId();
blob.setName(ss.getName()+ ".pdf");
var confirm = Browser.msgBox('Send Email Confirmation','Are you sure you want to send this mail for booking request ?', Browser.Buttons.OK_CANCEL);
if(confirm=='ok') {
MailApp.sendEmail(emaildata, subjectdata, " Attachment file is: \n" +subjectdata+ "- \n Kindly reply your booking to this email . \n Thank you - ADS Co., Ltd", {attachments: [blob]}) };} catch (f) {Logger.log(f.toString());
}
}
Answer
If you don't want to export some sheets you can hide them. Furthermore, you can export a Spreadsheet with the method getBlob. Once you have made the export, you can undo the hide.
Small code assuming two sheets
var sheet = ss.getSheetByName('Unwanted Sheet')
sheet.hideSheet()
var blob = ss.getBlob()
blob.setName(ss.getName())
sheet.showSheet()
Full code working with many sheets
function exportSheet(sheetName) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheets = ss.getSheets();
for (var i = 0; i < sheets.length; i++) {
if (sheets[i].getSheetName() !== sheetName) {
sheets[i].hideSheet()
}
}
var blob = ss.getBlob()
blob.setName(ss.getName())
for (var i = 0; i < sheets.length; i++) {
sheets[i].showSheet()
}
}
Some tips
You don't have to add .pdf to the blob name, it already understand that it is a pdf file and the extension will appear automatically
You can use GmailApp service instead of MailApp since it is more versatile and has more functionalities. The main reason to use MailApp is using that it doesn’t require the developer to be a Gmail user.
Reference
hideSheet
showSheet
getBlob
GmailApp
MailApp

Enterprise Architect -> How to get the edge of the end node using a SQL Query on the .eap-File (.mdb)

I have to draw some EA diagrams using only the .eap file without an installed EA on the server. So I am opening it as MDB-File via ODBC.
I know there is the attribute t_diagramlinks.Geometry (with edge={1,2,3,4}) and the Attribute t_connector.Start_Edge and the attribute t_connector.End_Edge.
The table t_diagramlinks with the attribute Geometry is diagram-dependent.
The table t_connector with the attributes .Start_Edge and .End_Edge is not diagram-dependent --> there could be connections that haven't been drawn on a diagram.
I know that the SX, SY, EX, EY of t_diagramlinks are coordinates relative to the origin of each node that is drawn on a diagram.
Problem: EX / EY sometimes is zero and isn't painting the end line to the edge of the node. I guess it has something to do with mouse release position.
"My Interpretation" below is what my renderer produces based on my assumptions.
"EA Interpretation" is what EA is actually rendering and which I would like to see in my renderer as well.
Questions
I am using the csv-Value EDGE in t_diagramlinks.Geometry - but where
do I find this for the end node?
For which purpose are the attributes Start_Edge an End_Edge in the
table t_connector when it is not diagram-dependent?
I am using in t_diagramlinks.Geometry the csv-Value EDGE - but where
do i find this for the end node?
You need to use Euclide. SX,SY/EX,EY are relative shifts from the shortest center connection between start and end element.
For which purpose are the attributes Start_Edge an End_Edge in the
table "t_connector" when it is not diagram-dependend?
They are used for qualified properties.
Edit: To elaborate a bit more on your basic issue. t_diagramlinks.path holds bending points for the connector (if any are specified). So in order to find the point where a connector actually joins an element you have to find the nearest bend to that element. Now between this bend and the middle of the element you will have a natural attachment point. Relative to that the SX-Y (/EX-Y) are added to make the manually shifted rendered attachment point.
The above goes with a grain of salt. I never verified the nitty gritty but used my stomach from seeing the numbers. I might look into that in detail to update my Inside book but can't promise.
2nd Edit: Now that I know that "My Interpretation" is what your renderer produces based on your assumptions, here's the (most likely; see above) story. In order to render a connector EA will use the following information:
the frame coordinates of the two connected elements
calculated from the coordinates the middle point of the elements
the path property of the connector (if not empty)
the nearest bending point to the relevant elements (if not empty)
the shift factors SX-Y and EX-Y for the connector
Starting from the start element's middle point you draw a virtual line to either the nearest bending point or the middle of the end element (unless see below). That way you can calculate the virtual attachment point at the element's rectangular frame (even use cases have a rectangular frame). Now you shift that point by SX-Y which will (/should?) always travel along the edge of the element frame. Now you have the virtual attachment point for the start element.
On the other side (the end element; my "unless" from above) you would do a similar thing to calculate the virtual attachment for the end. What I don't know is the real order in which EA is doing that (I have no code insight). So if you have manual offsets on both sides the calculation will give different results depending on the order to draw the virtual connection to the other side (so: is the shift on the other side respected or not). Basically I think you can neglect that for 99.9% of all cases and the rest is just irrelevant noise.
So now you know the virtual end points you either connect them directly or, if a path is give, you connect them via the bending points.
Again: all with a grain of salt. It's just observation from the outside but likely not too far away. There's also the fact that you have different line styles with rounded edges (not taken into account here) and bezier lines (even more dragon land).
Thank you very much. I choosed to calculate the End-Edge mathematically:
My problem was, that i wasn't able to detect the end edge of the target endnode on a link relation. Further more there are 8 different link types, that are determining the layout of the links. So as Thomas mentioned i had to detect the last point before the endpoint. If it is a path, the last node of the path is the point before the endpoint. If there is not a path, the startnodes starting point is the last point before the endpoint. But if there is a path defined and the link mode has been set to 1 i may not process the connection path, because the Conn_Path property is containing a customized line - but after customizing the user has selected to have a direct link (it will not be deleted).
The mathematic behind is used as linear function y=m*x+b and the lines are described by 4 straight lines which are appropriate to the edges of the endnode.
So you can do the following algorithm:
The complete algorithm is using the following approach:
1.) Determine straight line between start- and endnode (there are 2 special cases if the line is completely horizontal or vertically parallel to the coordinate system)
2.) Create a rectangle which consists of four straight lines (2 vertical / 2 horizontal lines)
3.) Determine the intersection of the first straight line with the rectangles lines
4.) Exclude point that are not consisting to the rectangle
5.) Determine the point on the rectangle with the shortest distance => this is the searched end edge point
The written javascript code i have used to do the routing is the following:
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Erzeuge eine eigene Link-Klasse für das Routing der Pfeile, die von Hand gezogen wurden
// und über spezielle Attribute in der EAP-Datei definiert werden
// Ruft die Superklasse von go.Link im Konstruktor auf
function MultiNodePathLink() {
go.Link.call(this);
}
go.Diagram.inherit(MultiNodePathLink, go.Link); // Erben von go.Link
// ignores this.routing, this.adjusting, this.corner, this.smoothness, this.curviness
/** #override */
MultiNodePathLink.prototype.computePoints = function () {
// Die this Referenz ist hier ist ein geerbter ein go.Link. der bei Links
var startNode = this.fromNode;
var startNodeX = startNode.location.M; // X-Koordinate vom Startknoten
var startNodeY = startNode.location.N; // Y-Koordinate vom Startknoten
var endNode = this.toNode;
var endNodeX = endNode.location.M; // X-Koordinate vom Startknoten
var endNodeY = endNode.location.N; // Y-Koordinate vom Startknoten
var startNodeData = startNode.data; // Das sind die Daten
var endNodeData = endNode.data; // Das sind die Daten
// Die Link-Daten
var linkProperties = this.data;
//** Das Feld Style in [t_diagramlink] bestimmt die Connector-Darstellung **/
// http://www.capri-soft.de/blog/?p=2904
/*
* 1 = Direct Mode=1
* 2 = Auto Routing Mode=2
* 3 = Custom Line Mode=3
* 4 = Tree Vertical Mode=3;TREE=V
* 5 = Tree Horizontal Mode=3;TREE=H
* 6 = Lateral Vertical Mode=3;TREE=LV
* 7 = Lateral Horizontal Mode=3;TREE=LH
* 8 = Orthogonal Square Mode=3;TREE=OS
* 9 = Orthogonal Rounded Mode=3;TREE=OR
*/
var styleStringArray = linkProperties.style.split(";");
var mode = -1;
var tree = '';
for (var i = 0; i < styleStringArray.length; i++) {
if (styleStringArray[i].trim().indexOf('Mode=') > -1) {
mode = styleStringArray[i].replace('Mode=', '');
}
if (styleStringArray[i].trim().indexOf('TREE=') > -1) {
tree = styleStringArray[i].replace('TREE=', '');
}
}
// In der Tabelle t_diagramlinks in der Freitextspalte "Geometry" wird in einem CSV-String
// gespeichert, wie der Link letztendlich auf dem Diagram gezogen wurde
var geometryString = linkProperties.geometry.split(";");
// SX and SY are relative to the centre of the start object
var sx = geometryString[0].replace("SX=", "");
var sy = geometryString[1].replace("SY=", "");
// EX and EY are relative to the centre of the end object
var ex = geometryString[2].replace("EX=", "");
var ey = geometryString[3].replace("EY=", "");
// SX=-67;SY=-43;EX=-12;EY=-40;EDGE=3;$LLB=;
// LLT=;LMT=;LMB=CX=30:CY=13:OX=11:OY=-2:HDN=0:BLD=0:ITA=0:UND=0:CLR=-1:ALN=1:DIR=0:ROT=0;
// LRT=;LRB=;IRHS=;ILHS=;
// EDGE ranges in value from 1-4, with 1=Top, 2=Right, 3=Bottom, 4=Left (Outgoing Point of the Start Object)
var edge = geometryString[4].replace("EDGE=", "");
// Hier beginnt das Custom-Routing
this.clearPoints();
if (linkProperties.start_object_name == 'System Verification Test Reports' && linkProperties.end_object_name == 'System test specifications') {
var test = 'irrsinn';
}
// Hier werden die Wege definiert für das gecustomizte Link Routing
// Geht der Link nach oben oder unten wird die Y-Koordinate des Startknotens genutzt (Weil Orthogonales Routing)
var startConnX = null;
var startConnY = null;
if (edge == 1) { // Ecke oben
startConnX = Math.abs(startNodeX) + Math.abs((startNode.actualBounds.width / 2) + new Number(sx));
startConnY = Math.abs(startNodeY);
}
else if (edge == 3) { // Ecke unten
startConnX = Math.abs(startNodeX) + Math.abs((startNode.actualBounds.width / 2) + new Number(sx));
startConnY = Math.abs(startNodeY) + new Number(startNode.actualBounds.height);
}
else if (edge == 2) { // Ecke rechts
startConnX = Math.abs(startNodeX) + startNode.actualBounds.width;
startConnY = Math.abs(startNodeY) + Math.abs((startNode.actualBounds.height / 2) - new Number(sy));
}
else if (edge == 4) { // Ecke links
startConnX = new Number(Math.abs(startNodeX));
startConnY = Math.round(startNodeY) + Math.round((startNode.actualBounds.height / 2) - new Number(sy));
}
else {
alert('Die Edge konnte nicht entdeckt werden! Ist der Geometry String in der EAP Datei richtig?');
}
this.addPoint(new go.Point(Math.round(startConnX), Math.round(startConnY)));
// Abfrage: Gibt es einen letzten Path Punkt?
var lastPathPunkt=false;
var lastPathPunktX, lastPathPunktY;
if (mode != 1)
{
// Routing über die Zwischenwege
if (typeof linkProperties.conn_path !== "undefined" && linkProperties.conn_path !== "") {
var splittedArray = linkProperties.conn_path.split(";");
if (splittedArray.length > 1) {
// Hier ist mindestens ein Wert vorhanden da auch der erste mit Semikolon abgeschlossen wird im Path vom EA
for (var i = 0; i < splittedArray.length - 1; i++) {
var einMittelPunkt = splittedArray[i];
var mittelPunktArray = einMittelPunkt.split(":");
this.addPoint(new go.Point(Math.abs(new Number(mittelPunktArray[0])), Math.abs(new Number(mittelPunktArray[1]))))
lastPathPunktX = Math.abs(new Number(mittelPunktArray[0]));
lastPathPunktY = Math.abs(new Number(mittelPunktArray[1]));
lastPathPunkt = true;
}
}
}
}
// Wenn es keinen Pfad gab,muss der letzte Punkt mit dem Startknoten identisch sein
if (lastPathPunkt == false) {
lastPathPunktX = Math.abs(Math.round(startConnX));
lastPathPunktY = Math.abs(Math.round(startConnY));
}
// End-Routing
// Der Endpunkt in EA in Document Coordinates
var endConnX = Math.abs(endNodeX) + Math.abs((endNode.actualBounds.width / 2) + new Number(ex));
var endConnY = Math.abs(endNodeY) + Math.abs((endNode.actualBounds.height / 2) - new Number(ey));
// Spezialfälle bei horizontalen und vertikalen Linien:
if (endConnX == lastPathPunktX) {
// Es liegt eine vertikale Gerade (z.B. von oben nach unten) vor
this.addPoint(new go.Point(Math.round(lastPathPunktX), Math.round(lastPathPunktY)));
this.addPoint(new go.Point(Math.round(endConnX), Math.round(endConnY)));
} else if (endConnY == lastPathPunktY) {
// Es liegt eine horizontale Gerade (z.B. von rechts nach links) vor
this.addPoint(new go.Point(Math.round(lastPathPunktX), Math.round(lastPathPunktY)));
this.addPoint(new go.Point(Math.round(endConnX), Math.round(endConnY)));
} else {
// Es ist keine Gerade sondern ein Gerade, die mit y=m*x+b beschrieben werden kann
// 1.) Gerade zwischen Start- und Endpunkt ermittelnhn
// Ye-Ys
// m = ----- b=Ys-m*Xs oder b=Ye-m*Xe
// Xe-Xs
var m = (endConnY - lastPathPunktY) / (endConnX - lastPathPunktX);
var b = lastPathPunktY - m * lastPathPunktX
// 2.) Ermittlung der horizontalen und vertikalen Geraden des Rechteckes und dem Schnittpunkten
// Die Geraden, die das Rechteck definieren:
var rY1 = endNodeY;
var rY2 = endNodeY + endNode.actualBounds.height;
var rX1 = endNodeX;
var rX2 = endNodeX + endNode.actualBounds.width;
// (rX1, rY1) -zu-> (rX2, rY2)
// Horizontale Geraden:
// y - b
// x = -----
// m
var lengthToPoint = [];
var sX1 = (rY1 - b) / m; // S1(sX1|rY1)
if (sX1 >= rX1 && sX1 <= rX2) {
// Der Schnittpunkt sX1 ist am Rechteck
// Distanz: d=SQRT((y2-y1)^2+(x2-x1)^2)
var dS1 = Math.sqrt(Math.pow(rY1 - lastPathPunktY, 2) + Math.pow(sX1 - lastPathPunktX, 2));
lengthToPoint.push({
"distanz": dS1,
"x": sX1,
"y": rY1
});
}
var sX2 = (rY2 - b) / m; // S2(sX2|rY2)
if (sX2 >= rX1 && sX2 <= rX2) {
// Der Schnittpunkt sX2 ist am Rechteck
// Distanz: d=SQRT((y2-y1)^2+(x2-x1)^2)
var dS2 = Math.sqrt(Math.pow(rY2 - lastPathPunktY, 2) + Math.pow(sX2 - lastPathPunktX, 2));
lengthToPoint.push({
"distanz": dS2,
"x": sX2,
"y": rY2
});
}
// Vertikale Geraden:
//
// y = m*x + b
var sY1 = m * rX1 + b; // S3(rX1|sY1)
if (sY1 >= rY1 && sY1 <= rY2) {
// Der Schnittpunkt sY1 ist am Rechteck
// Distanz: d=SQRT((y2-y1)^2+(x2-x1)^2)
var dS3 = Math.sqrt(Math.pow(sY1 - lastPathPunktY, 2) + Math.pow(rX1 - lastPathPunktX, 2));
lengthToPoint.push({
"distanz": dS3,
"x": rX1,
"y": sY1
});
}
var sY2 = m * rX2 + b; // S4(rX2|sY2)
if (sY2 >= rY1 && sY2 <= rY2) {
// Der Schnittpunkt sY2 ist am Rechteck
// Distanz: d=SQRT((y2-y1)^2+(x2-x1)^2)
var dS4 = Math.sqrt(Math.pow(sY2 - lastPathPunktY, 2) + Math.pow(rX2 - lastPathPunktX, 2));
lengthToPoint.push({
"distanz": dS4,
"x": rX2,
"y": sY2
});
}
// Sortiere alle Punkte nach Distanz - der mit der kleinsten Entfernung isses
lengthToPoint.sort(function (a, b) { return a.distanz - b.distanz });
if (lengthToPoint.length > 0)
{
this.addPoint(new go.Point(Math.round(lengthToPoint[0].x), Math.round(lengthToPoint[0].y)));
}
else
{
this.addPoint(new go.Point(Math.round(lastPathPunktX), Math.round(lastPathPunktY)));
}
}
return true;
};
// end MultiNodePathLink class

JSON Parse error Objective-c [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
i trying to parse JSON with NSJSONSerialization.
NSArray *a = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&err]; the error shows this: Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (Badly formed array around character 202.) UserInfo=0x9f79230 {NSDebugDescription=Badly formed array around character 202.}
here is the JSON code:
[
{
"ID":1,
"name":"sometext",
"c":"sometext",
"city":"sometext",
"street":"sometext",
"a":32.914671,
"b":35.292417,
"Info":"sometext",
"imageAddress":"images/aroma.jpeg"
}
{
"ID":2,
"name":"sometext",
"c":"sometext",
"city":"sometext",
"street":"sometext",
"a":4.224,
"b":72.1234,
"Info":"sometext",
"imageAddress":"images/"
}
where the JSON not coded currently?
In your JSON, array objects are not separated by comma
[
{
"ID":1,
"name":"sometext",
"c":"sometext",
"city":"sometext",
"street":"sometext",
"a":32.914671,
"b":35.292417,
"Info":"sometext",
"imageAddress":"images/aroma.jpeg"
},
{
"ID":2,
"name":"sometext",
"c":"sometext",
"city":"sometext",
"street":"sometext",
"a":4.224,
"b":72.1234,
"Info":"sometext",
"imageAddress":"images/"
}
]
This should work.

Dynamic ckeditor toolbar [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to set ckeditor tool bar based on the user type and some condition.
Partialy I done as below:
switch(UserMode)
{
case "1":
config.toolbar_MyTool = [
['Find', 'SelectAll'], ['Anchor'], ['Maximize']
];
break;
case "2":
config.toolbar_MyTool = [
['Find'], ['Anchor'], ['Maximize']
];
break;
}
Code goes long based on the usermode
so I want to create a array and just I want to assign the toolbar
like as below:
config.toolbar_MyTool = myToolArray;
Also I want to check own post or other person post. If it is own post I want to add some tools additionally.
You would start by defining your different toolbars in the config.js
config.toolbar_MyToolUserMode1 = [
['Find', 'SelectAll'], ['Anchor'], ['Maximize']
];
config.toolbar_MyToolUserMode2 = [
['Find'], ['Anchor'], ['Maximize']
];
Those toolbar-definitions can then be used later in your page, but be aware that as soon as you create an instance of CKEditor, the toolbar layout CAN NOT be changed:
CKEDITOR.config.toolbar = "MyToolUserMode1";
var instance = CKEDITOR.appendTo(parentElement);
Solution 1:
You would have to create a new instance to change the toolbar dynamically:
switch(UserMode)
{
case "1":
if (instance) instance.destroy();
CKEDITOR.config.toolbar = "MyToolUserMode1";
instance = CKEDITOR.appendTo(parentElement);
break;
case "2":
if (instance) instance.destroy();
CKEDITOR.config.toolbar = "MyToolUserMode2";
instance = CKEDITOR.appendTo(parentElement);
break;
}
Solution 2:
However, if you are happy with showing the full toolbar also in usermode 2 and greying the SelectAll-Button, then the following could be your solution:
CKEDITOR.config.toolbar = "MyToolUserMode1";
var instance = CKEDITOR.appendTo(parentElement);
switch(UserMode)
{
case "1":
instance.getCommand('selectAll').enable();
break;
case "2":
instance.getCommand('selectAll').disable();
break;
}
[EDIT feb 15]
Solution 3:
According to your comment -> how to dynamically construct with array.push
No configuration needed in config.js
// your code
var myToolbarSection1 = new Array();
myToolbarSection1.push('Bold');
myToolbarSection1.push('Italic');
// attaching this section to toolbar
var myToolbar = new Array();
myToolbar.push(myToolbarSection1);
// setting the toolbar
CKEDITOR.config.toolbar_Dynamic = myToolbar;
CKEDITOR.config.toolbar = 'Dynamic';
var instance = CKEDITOR.appendTo('myDIVID');