This is my IDE to progam PHP, HTML and CSS Files on my Server.
Sure there are better tools, but I love easy IDE with big fonts and nice colors
Sure there are better tools, but I love easy IDE with big fonts and nice colors
B4X:
Sub Process_Globals
Dim ftp1 As FTP
Private fx As JFX
Private MainForm As Form
Dim TextAreaLeft,TextAreaRight As TextArea
Dim iSearchCounterLeft,iSearchCounterRight As Int
Dim TSearch As TextField
Dim TFileLeft As TextField
Dim TFileRight As TextField
Dim BloadFileLeft As Button
Dim BloadFileRight As Button
Dim BSearchLeft As Button
Dim BSearchRight As Button
Dim BUploadFiles As Button
Dim BSaveFiles As Button
Dim BEnd As Button
Dim pToolBar As Pane
Dim BackupPath="w:\ServerFileBackup\"
Dim sFileLeft="w:\index.php" As String
Dim sFileRight="w:\style.css" As String
Dim sServer="ftp.myserver.de" As String
Dim sUser="www-data" As String
Dim sPassword="*********" As String
End Sub
Sub AppStart (Form1 As Form, Args() As String)
If File.Exists("",BackupPath)=False Then File.MakeDir("",BackupPath)
If File.Exists(File.DirApp,"textFileNameLeft.txt") Then sFileLeft=File.ReadString(File.DirApp,"textFileNameLeft.txt")
If File.Exists(File.DirApp,"textFileNameRight.txt") Then sFileRight=File.ReadString(File.DirApp,"textFileNameRight.txt")
MainForm = Form1
Dim jmf As JavaObject = MainForm
Dim stage As JavaObject = jmf.GetField("stage")
stage.RunMethod("setFullScreen", Array As Object(True))
MainForm.Show
Dim sFontName As String
Dim lFonts As List
TSearch.Initialize("TSearch")
TFileLeft.Initialize("TFileLeft")
TFileRight.Initialize("TFileRight")
TFileLeft.Text=sFileLeft
TFileRight.Text=sFileRight
BloadFileLeft.Initialize("BloadFileLeft")
BloadFileLeft.text="load"
BloadFileRight.Initialize("BloadFileRight")
BloadFileRight.text="load"
BSearchLeft.Initialize("BSearchLeft")
BSearchLeft.Text="suc"
BSearchRight.Initialize("BSearchRight")
BSearchRight.Text="hen"
BUploadFiles.Initialize("BUploadFiles")
BUploadFiles.Text="upload"
BSaveFiles.Initialize("BSaveFiles")
BSaveFiles.Text="save"
BEnd.Initialize("BEnd")
BEnd.Text="end"
'select font Nr 23
lFonts=fx.GetAllFontFamilies
sFontName=lFonts.Get(23)
TextAreaLeft.Initialize("TextAreaLeft")
If File.Exists("",sFileLeft) Then TextAreaLeft.Text=File.ReadString("",sFileLeft)
TextAreaLeft.Style="-fx-font-weight:bold;-fx-background-color: linear-gradient(#2211FF, #4433DE);-fx-text-fill: cyan;-fx-font-size:21;-fx-font-family:'"&sFontName&"'"
MainForm.RootPane.AddNode(TextAreaLeft,0,0,MainForm.Width/2.1,MainForm.Height)
TextAreaRight.Initialize("TextAreaRight")
If File.Exists("",sFileRight) Then TextAreaRight.Text=File.ReadString("",sFileRight)
TextAreaRight.Style="-fx-font-weight:bold;-fx-background-color: linear-gradient(#2211FF, #4433DE);-fx-text-fill: cyan;-fx-font-size:21;-fx-font-family:'"&sFontName&"'"
MainForm.RootPane.AddNode(TextAreaRight,MainForm.Width/1.93,0,MainForm.Width/2.1,MainForm.Height)
pToolBar.Initialize("")
pToolBar.Style="-fx-background-color: linear-gradient(#2211FF, #ff33DE);"
MainForm.RootPane.AddNode(pToolBar,MainForm.Width/2.1,0,77,MainForm.Height)
pToolBar.AddNode(TSearch,0,0,77,22)
pToolBar.AddNode(TFileLeft,0,210,77,22)
pToolBar.AddNode(BloadFileLeft,0,183,47,22)
pToolBar.AddNode(BloadFileRight,30,273,47,22)
pToolBar.AddNode(TFileRight,0,250,77,22)
pToolBar.AddNode(BSearchLeft,0,30,38,22)
pToolBar.AddNode(BSearchRight,38,30,38,22)
pToolBar.AddNode(BSaveFiles,0,60,77,22)
pToolBar.AddNode(BUploadFiles,0,90,77,22)
pToolBar.AddNode(BEnd,0,MainForm.Height-33,77,22)
End Sub
Sub BloadFileLeft_MouseClicked (EventData As MouseEvent)
sFileLeft=TFileLeft.Text
File.writeString(File.DirApp,"textFileNameLeft.txt",sFileLeft)
TextAreaLeft.Text=File.ReadString("",sFileLeft)
End Sub
Sub BloadFileRight_MouseClicked (EventData As MouseEvent)
sFileRight=TFileRight.Text
File.writeString(File.DirApp,"textFileNameRight.txt",sFileRight)
TextAreaRight.Text=File.ReadString("",sFileRight)
End Sub
Sub TSearch_TextChanged (Old As String, New As String)
iSearchCounterRight=0
iSearchCounterLeft=0
End Sub
Sub BSearchRight_MouseClicked (EventData As MouseEvent)
Dim d2 = TextAreaRight.Text As String
Dim uu As Int
Dim nn=TSearch.Text As String
d2=d2.ToLowerCase
nn=nn.ToLowerCase
uu=d2.IndexOf2(nn,iSearchCounterRight)
iSearchCounterRight=uu
TextAreaRight.SetSelection(iSearchCounterRight,iSearchCounterRight+nn.Length)
iSearchCounterRight=iSearchCounterRight+1
End Sub
Sub BSearchLeft_MouseClicked (EventData As MouseEvent)
Dim d1 = TextAreaLeft.Text As String
Dim uu As Int
Dim nn=TSearch.Text As String
d1=d1.ToLowerCase
nn=nn.ToLowerCase
uu=d1.IndexOf2(nn,iSearchCounterLeft)
iSearchCounterLeft=uu
TextAreaLeft.SetSelection(iSearchCounterLeft,iSearchCounterLeft+nn.Length)
iSearchCounterLeft=iSearchCounterLeft+1
End Sub
Sub BSaveFiles_MouseClicked (EventData As MouseEvent)
Dim d1 = TextAreaLeft.Text As String
Dim d2 = TextAreaRight.Text As String
File.WriteString("",sFileLeft,d1)
File.WriteString("",sFileRight,d2)
End Sub
Sub BEnd_MouseClicked (EventData As MouseEvent)
ExitApplication
End Sub
Sub BUploadFiles_MouseClicked (EventData As MouseEvent)
Dim ff As String
ftp1.Initialize("ftp1",sServer,21,sUser,sPassword)
Dim d1 = TextAreaLeft.Text As String
Dim d2 = TextAreaRight.Text As String
Dim f1 =sFileLeft.SubString(3) As String
Dim f2 =sFileRight.SubString(3)
'make Backup in the BackupPath\DateTime-Path
Dim titi = DateTime.Now As Long
ff=DateTime.GetYear(titi)&DateTime.GetMonth(titi)&DateTime.GetDayOfMonth(titi)&"_"&DateTime.GetHour(titi)&"-"&DateTime.GetMinute(titi)&"-"&DateTime.GetSecond(titi)
File.MakeDir(BackupPath,ff)
File.WriteString(BackupPath&ff,f1,d1)
File.WriteString(BackupPath&ff,f2,d2)
'Write Local
File.WriteString("",sFileLeft,d1)
File.WriteString("",sFileRight,d2)
ftp1.UploadFile("",sFileLeft, True, f1)
ftp1.UploadFile("",sFileRight, True, f2)
End Sub
Sub FTP1_UploadProgress (ServerPath As String, TotalUploaded As Long, Total As Long)
'If Total > 0 Then s = s & " out of " & Round(Total / 1000) & "KB"
'Log(s)
End Sub
Sub FTP1_UploadCompleted (ServerPath As String, Success As Boolean)
Log(ServerPath & ", Success=" & Success)
If Success = False Then Log(LastException.Message)
End Sub
Attachments
Last edited: