Skip to content

Import #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Import files from another server/.debug
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version='1.0' encoding='UTF-8'?>
<ExtensionList>
<Extension Id="com.cep.import.panel">
<HostList>
<Host Name="PHXS" Port="8088" />
<Host Name="IDSN" Port="8087" />
<Host Name="AICY" Port="8086" />
<Host Name="ILST" Port="8085" />
<Host Name="PPRO" Port="8084" />
<Host Name="AEFT" Port="8083" />
<Host Name="PRLD" Port="8082" />
<Host Name="FLPR" Port="8081" />
<Host Name="DRWV" Port="8080" />
</HostList>
</Extension>
<Extension Id="com.cep.import.localserver">
<HostList>
<Host Name="PHXS" Port="8188" />
<Host Name="IDSN" Port="8187" />
<Host Name="AICY" Port="8186" />
<Host Name="ILST" Port="8185" />
<Host Name="PPRO" Port="8184" />
<Host Name="AEFT" Port="8183" />
<Host Name="PRLD" Port="8182" />
<Host Name="FLPR" Port="8181" />
<Host Name="DRWV" Port="8180" />
</HostList>
</Extension>
</ExtensionList>
3 changes: 3 additions & 0 deletions Import files from another server/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
node_modules
client/js/lib/CSInterface.js
75 changes: 75 additions & 0 deletions Import files from another server/com.cep.import/CSXS/manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version='1.0' encoding='UTF-8'?>
<ExtensionManifest ExtensionBundleId="com.cep.import" ExtensionBundleVersion="1.0.0" Version="7.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ExtensionList>
<Extension Id="com.cep.import.panel" Version="1.0.0" />
<Extension Id="com.cep.import.localserver" Version="1.0.0" />
</ExtensionList>
<ExecutionEnvironment>
<HostList>
<Host Name="PHSP" Version="19" />
<Host Name="PHXS" Version="19" />
</HostList>
<LocaleList>
<Locale Code="All" />
</LocaleList>
<RequiredRuntimeList>
<RequiredRuntime Name="CSXS" Version="7.0" />
</RequiredRuntimeList>
</ExecutionEnvironment>
<DispatchInfoList>
<Extension Id="com.cep.import.panel">
<DispatchInfo>
<Resources>
<MainPath>./client/index.html</MainPath>
<ScriptPath>./host/index.jsx</ScriptPath>
</Resources>
<Lifecycle>
<AutoVisible>true</AutoVisible>
</Lifecycle>
<UI>
<Type>Panel</Type>
<Menu>Panel Import Example</Menu>
<Geometry>
<Size>
<Height>500</Height>
<Width>350</Width>
</Size>
<MinSize>
<Height>200</Height>
<Width>200</Width>
</MinSize>
<MaxSize>
<Height>600</Height>
<Width>400</Width>
</MaxSize>
</Geometry>
<Icons />
</UI>
</DispatchInfo>
</Extension>
<Extension Id="com.cep.import.localserver">
<DispatchInfo>
<Resources>
<MainPath>./client/localServer.html</MainPath>
<CEFCommandLine>
<Parameter>--enable-nodejs</Parameter>
<Parameter>--mixed-context</Parameter>
</CEFCommandLine>
</Resources>
<Lifecycle>
<AutoVisible>false</AutoVisible>
</Lifecycle>
<UI>
<Type>Custom</Type>
<Geometry>
<Size>
<Height>500</Height>
<Width>350</Width>
</Size>
</Geometry>
<Icons />
</UI>
</DispatchInfo>
</Extension>
</DispatchInfoList>
</ExtensionManifest>
19 changes: 19 additions & 0 deletions Import files from another server/com.cep.import/client/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Import Example Panel</title>
</head>
<body>
<h1>Import Example Panel</h1>
<button id="import-button">Import from external server</button>
<div id="download-options" style="display:none">
<p>Choose your download location</p>
<button id="documents-button">My Documents</button>
<button id="extension-button">Panel Folder</button>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="js/lib/CSInterface.js"></script>
<script src="index.js"></script>
</body>
</html>
69 changes: 69 additions & 0 deletions Import files from another server/com.cep.import/client/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
CSInterface
*/
var csInterface = new CSInterface();

/*
UI Elements
*/
var importButton = document.querySelector("#import-button");
var documentsButton = document.querySelector("#documents-button");
var extensionButton = document.querySelector("#extension-button");
var downloadOptions = document.querySelector("#download-options");

/*
Event listeners
*/
importButton.addEventListener("click", importToggle);
documentsButton.addEventListener("click", function(){importTo('documents');}, false);
extensionButton.addEventListener("click", function(){importTo('extension');}, false);

/*
User folder paths
*/
var extensionDirectory = csInterface.getSystemPath("extension");
var documentsDirectory = csInterface.getSystemPath("myDocuments");

/*
Starting Node JS
*/
csInterface.requestOpenExtension("com.cep.import.localserver", "");

/*
Helper methods
*/
function importToggle() {
if (downloadOptions.style.display === "none") {
downloadOptions.style.display = "block";
importButton.innerText = "Cacel";
} else {
downloadOptions.style.display = "none";
importButton.innerText = "Import from external server";
}
}

function importTo(location) {
var directory = location == "documents" ? documentsDirectory : extensionDirectory;
var url = "http://localhost:3200/import";

$.ajax({
type: "GET",
url: url,
headers: {
"directory": directory
},
success: response => {
downloadOptions.style.display = "none";
importButton.innerText = "Import from external server";
alert(`File imported. Location: ${response}`);
csInterface.evalScript(`displayFile("${response}")`);
},
error: (jqXHR, textStatus, errorThrown) => {
console.log("error");
alert(errorThrown, jqXHR.responseJSON);
}
})

}


Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## Access Adobe CEP Repository at https://github.com./Adobe-CEP/CEP-Resources/
## Copy and paste the newest version of CSInterface.js that's compatible with your version of Creative Cloud
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script>
var localServ = cep_node.require(__dirname + '/server/main.js')();
</script>
<title>Import Example App</title>
</head>
<body>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function displayFile(path) {
if (app.name == "Adobe Photoshop") {
var fileRef = new File(path)
app.open(fileRef)
}
}
Loading