Project cleanup

removed old ‘webcomponents’ folder from demo shell project
This commit is contained in:
Denys Vuika 2016-04-29 20:58:03 +01:00
parent 6de51e098e
commit d780292ac0
22 changed files with 0 additions and 1822 deletions

View File

@ -1,19 +0,0 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org
root = true
[*]
# Change these settings to your own preference
indent_style = space
indent_size = 4
# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

View File

@ -1,2 +0,0 @@
bower_components/
node_modules/

View File

@ -1,105 +0,0 @@
# <alfresco-file-list>
> Alfresco files and Folders viewver list
## Demo
[Check it live!](http://eromano.github.io/alfresco-file-list)
## Install
Install the component using [Bower](http://bower.io/):
```sh
$ bower install alfresco-file-list --save
```
Or [download as ZIP](https://github.com/eromano/alfresco-file-list/archive/master.zip).
## Usage
1. Import Web Components' polyfill:
```html
<script src="bower_components/webcomponentsjs/webcomponents.min.js"></script>
```
2. Import Custom Element:
```html
<link rel="import" href="bower_components/alfresco-file-list/dist/alfresco-file-list.html">
```
3. Start using it!
```html
<alfresco-file-list></alfresco-file-list>
```
## Options
Attribute | Options | Default | Description
--- | --- | --- | ---
`foo` | *string* | `bar` | Lorem ipsum dolor.
## Methods
Method | Parameters | Returns | Description
--- | --- | --- | ---
`unicorn()` | None. | Nothing. | Magic stuff appears.
## Events
Event | Description
--- | ---
`onsomething` | Triggers when something happens.
## Development
In order to run it locally you'll need to fetch some dependencies and a basic server setup.
* Install [Bower](http://bower.io/) & [Grunt](http://gruntjs.com/):
```sh
$ [sudo] npm install -g bower grunt-cli
```
* Install local dependencies:
```sh
$ bower install && npm install
```
* To test your project, start the development server and open `http://localhost:8000`.
```sh
$ grunt server
```
* To build the distribution files before releasing a new version.
```sh
$ grunt build
```
* To provide a live demo, send everything to `gh-pages` branch.
```sh
$ grunt deploy
```
## Contributing
1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -m 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D
## History
For detailed changelog, check [Releases](https://github.com/eromano/alfresco-file-list/releases).
## License
[MIT License](http://opensource.org/licenses/MIT)

View File

@ -1,29 +0,0 @@
{
"name": "alfresco-file-list",
"version": "0.0.0",
"description": "Alfresco files and Folders viewver list ",
"license": "MIT",
"main": "dist/alfresco-file-list.html",
"keywords": [
"polymer",
"web-components"
],
"ignore": [
"**/.*",
"node_modules",
"bower_components"
],
"dependencies": {
"polymer": "Polymer/polymer#^1.4.0",
"iron-list": "PolymerElements/iron-list#^1.2.8",
"iron-ajax": "PolymerElements/iron-ajax#^1.2.0",
"iron-flex-layout": "PolymerElements/iron-flex-layout#^1.3.1",
"paper-styles": "PolymerElements/paper-styles#^1.1.4",
"paper-icon-button": "PolymerElements/paper-icon-button#^1.0.7",
"paper-badge": "PolymerElements/paper-badge#^1.1.1",
"iron-icons": "PolymerElements/iron-icons#^1.1.3",
"app-layout": "PolymerLabs/app-layout#^0.0.14",
"paper-menu": "PolymerElements/paper-menu#^1.2.2",
"paper-item": "PolymerElements/paper-item#^1.1.4"
}
}

View File

@ -1,19 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>&lt;alfresco-file-list&gt;</title>
<!-- Importing Web Component's Polyfill -->
<script src="bower_components/webcomponentsjs/webcomponents.min.js"></script>
<!-- Importing Custom Elements -->
<link rel="import" href="src/alfresco-file-list.html">
</head>
<body>
<div style="height: 900px">
<!-- Using Custom Elements -->
<alfresco-file-list></alfresco-file-list>
</div>
</body>
</html>

View File

@ -1,19 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>&lt;alfresco-file-list&gt;</title>
<!-- Importing Web Component's Polyfill -->
<script src="bower_components/webcomponentsjs/webcomponents.min.js"></script>
<!-- Importing Custom Elements -->
<link rel="import" href="src/alfresco-file-list.html">
</head>
<body>
<div style="height: 900px">
<!-- Using Custom Elements -->
<alfresco-file-list></alfresco-file-list>
</div>
</body>
</html>

View File

@ -1,10 +0,0 @@
{
"private": true,
"devDependencies": {
"grunt": "~0.4.1",
"grunt-cli": "~0.1.9",
"grunt-contrib-connect": "~0.9.0",
"grunt-gh-pages": "~0.9.1",
"grunt-text-replace": "~0.4.0"
}
}

View File

@ -1,282 +0,0 @@
<link rel="import" href="../../../bower_components/polymer/polymer.html">
<link rel="import" href="../../../bower_components/iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="../../../bower_components/iron-ajax/iron-ajax.html">
<link rel="import" href="../../../bower_components/iron-list/iron-list.html">
<link rel="import" href="../../../bower_components/paper-styles/color.html">
<link rel="import" href="../../../bower_components/paper-styles/typography.html">
<link rel="import" href="../../../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../../../bower_components/iron-icon/iron-icon.html">
<link rel="import" href="../../../bower_components/paper-badge/paper-badge.html">
<link rel="import" href="../../../bower_components/paper-item/paper-item.html">
<link rel="import" href="../../../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
<link rel="import" href="../../../bower_components/iron-signals/iron-signals.html">
<style>
.pad {
@apply(--layout-flex);
@apply(--layout-vertical);
padding: 0 16px;
}
.dim {
color: gray;
}
paper-badge {
-webkit-transition: all 0.1s;
transition: all 0.1s;
opacity: 1;
margin-top: 5px;
}
paper-badge[label="0"] {
opacity: 0;
}
paper-item {
white-space: nowrap;
cursor: pointer;
position: relative;
}
paper-item:hover::after {
content: "";
width: 16px;
height: 16px;
display: block;
border-radius: 50% 50%;
background-color: var(--google-red-300);
margin-left: 10px;
line-height: 16px;
text-align: center;
color: white;
font-weight: bold;
text-decoration: none;
position: absolute;
right: 15px;
top: calc(50% - 8px);
}
.iron-list ul { list-style-type: none; overflow: hidden; margin:10px}
.iron-list ul li div.text{ float:left; text-align: left;height: 55px }
.iron-list ul li div.folder-container{ float:left; width: 70px;text-align: left ;height: 55px}
.iron-list ul li:hover { background: #eeeeee; height: 55px}
.file{
width: 52px;
height: 52px;
}
.folder {
height: 52px;
box-sizing: border-box;
cursor: pointer;
}
.primary {
font-size: 16px;
line-height: 20px;
font-family: sans-serif;
}
.secondary {
font-size: 12px;
line-height: 20px;
color: gray;
font-family: sans-serif;
}
.pull-right{
float: right;
}
.iron-list ul{
padding: 0px;
}
.breadcrumb {
font-family: sans-serif;
font-size: 12px;
padding-left: 11px;
height: 28px;
width: auto;
}
.folder-breadcrumb-img{
float: left;
text-align: left;
height: 15px;
padding: 0px 10px 0px 0px;
}
.folder-breadcrumb-text {
float: left;
text-align: left;
height: 25px;
padding: 0px 10px 0px 0px;
}
.folder-breadcrumb-text:hover {
text-decoration: underline;
}
.folder-breadcrumb-container{
float: left;
cursor: pointer;
}
paper-dropdown-menu.custom {
overflow: visible;
--paper-input-container-label: {
color: white;
background-color: var(--paper-pink-500);
font-style: italic;
text-align: center;
font-weight: bold;
};
--paper-input-container-input: {
color: var(--paper-indigo-500);
font-style: normal;
font-family: serif;
text-transform: uppercase;
}
/* no underline */
--paper-input-container-underline: {
display: none;
};
}
</style>
<dom-module id="alfresco-file-list">
<template>
<div class="breadcrumb">
<template is="dom-repeat" items="{{breadcrumbs}}">
<div on-click="goToFolderBreadcrumbs" data-name="[[item]]" class="folder-breadcrumb-container">
<img class="folder-breadcrumb-img" src="img/folder.svg">
<div class="folder-breadcrumb-text">[[item]]</div>
</div>
</template>
</div>
<hr>
<!-- Main List for the items -->
<iron-list id="itemsList" items="{{data}}" selected-items="{{selectedItems}}" selection-enabled>
<template>
<div>
<ul tabindex$="[[tabIndex]]" aria-label$="Select/Deselect [[item.name]]" class$="[[_computedClass(selected)]]">
<li>
<div class="folder-container" on-click="goToFolder">
<template is="dom-if" if="{{item.isFolder}}">
<img class="folder" src="img/folder.svg">
</template>
<template is="dom-if" if="{{!item.isFolder}}">
<img class="file" src="{{getThumbnailUrl(item)}}">
</template>
</div>
<div class="text">
<div class="pad">
<div class="primary">
[[item.displayName]]
</div>
<div class="secondary dim">
[[item.node.description]]
</div>
<div class="secondary dim">
Modified [[item.modifiedOn]] by [[item.modifiedBy]]
</div>
</div>
</div>
<div lass="dropdowm menu">
<paper-dropdown-menu class="custom pull-right" label="Actions" no-label-float>
<paper-listbox class="dropdown-content">
<paper-item>Download as Zip</paper-item>
<paper-item>View Details</paper-item>
<paper-item>Edit Properties</paper-item>
<paper-item>Copy To...</paper-item>
<paper-item>Move To...</paper-item>
</paper-listbox>
</paper-dropdown-menu>
</div>
</li>
</ul>
<div class="border"></div>
</div>
</template>
</iron-list>
</template>
<script>
HTMLImports.whenReady(function() {
Polymer({
is: "alfresco-file-list",
host: 'http://192.168.99.100:8080',
baseUrl: function(){
return this.host + '/alfresco/service/slingshot/doclib/doclist/all/site/';
},
properties: {
showSelection: {
type: Boolean,
value: true,
observer: '_showSelectionChanged'
}
},
goToFolder: function (event) {
this.container = event.model.item.location.container;
var path = event.model.item.location.path !== '/' ? (event.model.item.location.path + '/' ) : '/';
var relativePath = this.container + path + event.model.item.fileName;
var slug = event.model.item.location.site + '/' + relativePath;
this.breadcrumbs = relativePath.split('/');
this.fetchFolderFolder(slug);
},
goToFolderBreadcrumbs: function (event) {
var currentRelative = event.model.__data__.item;
var currentRelativeIndexInSlug = this.lastSlug.indexOf(currentRelative);
var slug = this.lastSlug.substr(0, currentRelativeIndexInSlug + currentRelative.length);
this.breadcrumbs = slug.substr(6,slug.length).split('/');
this.fetchFolderFolder(slug);
},
ready: function() {
this.breadcrumbs = ['documentLibrary'];
var initialFolder = 'swsdp/documentLibrary';
this.fetchFolderFolder(initialFolder);
var self = this;
if(document.querySelector("#alfresco-app")) {
document.querySelector("#alfresco-app").uploadedSignal = function () {
self.fetchFolderFolder(initialFolder);
};
}
},
fetchFolderFolder: function(slug) {
function error () {
console.log("error");
}
var xhr = new XMLHttpRequest();
xhr.addEventListener("load", (XMLHttpRequestProgressEvent)=>{
this.data =JSON.parse(XMLHttpRequestProgressEvent.currentTarget.response).items;
});
xhr.addEventListener("error", error);
this.lastSlug = slug;
xhr.open("GET", (this.baseUrl() + slug));
xhr.withCredentials = true;
xhr.setRequestHeader("Authorization", 'Basic ' + btoa('admin:admin'));
xhr.send();
},
thumbBaseUrl: function () {
return this.host + '/alfresco/service/';
},
getThumbnailUrl: function(item) {
return this.host + '/alfresco/service/api/node/' + item.nodeRef.replace('://', '/') + '/content/thumbnails/doclib?c=queue&amp;ph=true&amp;lastModified=1';
}
});
});
</script>
</dom-module>

View File

@ -1,283 +0,0 @@
{
"totalRecords": 4,
"startIndex": 0,
"metadata": {
"repositoryId": "302393f7-5fad-4c61-ab75-05e990bd86d6",
"container": "workspace://SpacesStore/8f2105b4-daaf-4874-9e8a-2152569d109b",
"parent": {
"nodeRef": "workspace://SpacesStore/8f2105b4-daaf-4874-9e8a-2152569d109b",
"permissions": {
"userAccess": {
"create": true,
"edit": true,
"delete": true,
"cancel-checkout": false,
"permissions": true
}
}
},
"onlineEditing": false,
"itemCounts": {
"folders": 4,
"documents": 0
}
},
"items": [
{
"nodeRef": "workspace://SpacesStore/8bb36efb-c26d-4d2b-9199-ab6922f53c28",
"nodeType": "cm:folder",
"type": "folder",
"mimetype": "",
"isFolder": true,
"isLink": false,
"fileName": "Agency Files",
"displayName": "Agency Files",
"status": "",
"title": "Agency related files",
"description": "This folder holds the agency related files for the project",
"author": "",
"createdOn": "2011-02-15T20:47:03.951Z",
"createdBy": "Mike Jackson",
"createdByUser": "mjackson",
"modifiedOn": "2011-02-15T21:00:43.616Z",
"modifiedBy": "Mike Jackson",
"modifiedByUser": "mjackson",
"lockedBy": "",
"lockedByUser": "",
"size": "0",
"version": "1.0",
"contentUrl": "api/node/content/workspace/SpacesStore/8bb36efb-c26d-4d2b-9199-ab6922f53c28/Agency%20Files",
"webdavUrl": "/webdav/Sites/swsdp/documentLibrary/Agency%20Files",
"actionSet": "folder",
"tags": [],
"activeWorkflows": "",
"likes": {
"isLiked": false,
"totalLikes": 0
},
"location": {
"repositoryId": "302393f7-5fad-4c61-ab75-05e990bd86d6",
"site": "swsdp",
"siteTitle": "Sample: Web Site Design Project",
"container": "documentLibrary",
"path": "/",
"file": "Agency Files",
"parent": {
"nodeRef": "workspace://SpacesStore/8f2105b4-daaf-4874-9e8a-2152569d109b"
}
},
"permissions": {
"inherited": true,
"roles": [
"ALLOWED;GROUP_site_swsdp_SiteCollaborator;SiteCollaborator;INHERITED",
"ALLOWED;GROUP_EVERYONE;SiteConsumer;INHERITED",
"ALLOWED;GROUP_EVERYONE;ReadPermissions;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteContributor;SiteContributor;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteConsumer;SiteConsumer;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteManager;SiteManager;INHERITED"
],
"userAccess": {
"create": true,
"edit": true,
"delete": true,
"cancel-checkout": false,
"permissions": true
}
},
"custom": {},
"actionLabels": {}
},
{
"nodeRef": "workspace://SpacesStore/8ab12916-4897-47fb-94eb-1ab699822ecb",
"nodeType": "cm:folder",
"type": "folder",
"mimetype": "",
"isFolder": true,
"isLink": false,
"fileName": "Budget Files",
"displayName": "Budget Files",
"status": "",
"title": "Project finance files",
"description": "This folder holds the project budget and invoices",
"author": "",
"createdOn": "2011-02-15T20:50:25.839Z",
"createdBy": "Mike Jackson",
"createdByUser": "mjackson",
"modifiedOn": "2011-02-15T21:08:20.590Z",
"modifiedBy": "Mike Jackson",
"modifiedByUser": "mjackson",
"lockedBy": "",
"lockedByUser": "",
"size": "0",
"version": "1.0",
"contentUrl": "api/node/content/workspace/SpacesStore/8ab12916-4897-47fb-94eb-1ab699822ecb/Budget%20Files",
"webdavUrl": "/webdav/Sites/swsdp/documentLibrary/Budget%20Files",
"actionSet": "folder",
"tags": [],
"activeWorkflows": "",
"likes": {
"isLiked": false,
"totalLikes": 0
},
"location": {
"repositoryId": "302393f7-5fad-4c61-ab75-05e990bd86d6",
"site": "swsdp",
"siteTitle": "Sample: Web Site Design Project",
"container": "documentLibrary",
"path": "/",
"file": "Budget Files",
"parent": {
"nodeRef": "workspace://SpacesStore/8f2105b4-daaf-4874-9e8a-2152569d109b"
}
},
"permissions": {
"inherited": true,
"roles": [
"ALLOWED;GROUP_site_swsdp_SiteCollaborator;SiteCollaborator;INHERITED",
"ALLOWED;GROUP_EVERYONE;SiteConsumer;INHERITED",
"ALLOWED;GROUP_EVERYONE;ReadPermissions;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteContributor;SiteContributor;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteConsumer;SiteConsumer;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteManager;SiteManager;INHERITED"
],
"userAccess": {
"create": true,
"edit": true,
"delete": true,
"cancel-checkout": false,
"permissions": true
}
},
"custom": {},
"actionLabels": {}
},
{
"nodeRef": "workspace://SpacesStore/a211774d-ba6d-4a35-b97f-dacfaac7bde3",
"nodeType": "cm:folder",
"type": "folder",
"mimetype": "",
"isFolder": true,
"isLink": false,
"fileName": "Meeting Notes",
"displayName": "Meeting Notes",
"status": "",
"title": "Project meeting notes",
"description": "This folder holds notes from the project review meetings",
"author": "",
"createdOn": "2011-02-15T21:16:26.500Z",
"createdBy": "Mike Jackson",
"createdByUser": "mjackson",
"modifiedOn": "2011-02-15T21:16:26.500Z",
"modifiedBy": "Mike Jackson",
"modifiedByUser": "mjackson",
"lockedBy": "",
"lockedByUser": "",
"size": "0",
"version": "1.0",
"contentUrl": "api/node/content/workspace/SpacesStore/a211774d-ba6d-4a35-b97f-dacfaac7bde3/Meeting%20Notes",
"webdavUrl": "/webdav/Sites/swsdp/documentLibrary/Meeting%20Notes",
"actionSet": "folder",
"tags": [],
"activeWorkflows": "",
"likes": {
"isLiked": false,
"totalLikes": 0
},
"location": {
"repositoryId": "302393f7-5fad-4c61-ab75-05e990bd86d6",
"site": "swsdp",
"siteTitle": "Sample: Web Site Design Project",
"container": "documentLibrary",
"path": "/",
"file": "Meeting Notes",
"parent": {
"nodeRef": "workspace://SpacesStore/8f2105b4-daaf-4874-9e8a-2152569d109b"
}
},
"permissions": {
"inherited": true,
"roles": [
"ALLOWED;GROUP_site_swsdp_SiteCollaborator;SiteCollaborator;INHERITED",
"ALLOWED;GROUP_EVERYONE;SiteConsumer;INHERITED",
"ALLOWED;GROUP_EVERYONE;ReadPermissions;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteContributor;SiteContributor;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteConsumer;SiteConsumer;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteManager;SiteManager;INHERITED"
],
"userAccess": {
"create": true,
"edit": true,
"delete": true,
"cancel-checkout": false,
"permissions": true
}
},
"custom": {},
"actionLabels": {}
},
{
"nodeRef": "workspace://SpacesStore/38745585-816a-403f-8005-0a55c0aec813",
"nodeType": "cm:folder",
"type": "folder",
"mimetype": "",
"isFolder": true,
"isLink": false,
"fileName": "Presentations",
"displayName": "Presentations",
"status": "",
"title": "Project presentations",
"description": "This folder holds presentations from the project",
"author": "",
"createdOn": "2011-02-15T21:18:38.144Z",
"createdBy": "Mike Jackson",
"createdByUser": "mjackson",
"modifiedOn": "2011-02-15T21:18:38.144Z",
"modifiedBy": "Mike Jackson",
"modifiedByUser": "mjackson",
"lockedBy": "",
"lockedByUser": "",
"size": "0",
"version": "1.0",
"contentUrl": "api/node/content/workspace/SpacesStore/38745585-816a-403f-8005-0a55c0aec813/Presentations",
"webdavUrl": "/webdav/Sites/swsdp/documentLibrary/Presentations",
"actionSet": "folder",
"tags": [],
"activeWorkflows": "",
"likes": {
"isLiked": false,
"totalLikes": 0
},
"location": {
"repositoryId": "302393f7-5fad-4c61-ab75-05e990bd86d6",
"site": "swsdp",
"siteTitle": "Sample: Web Site Design Project",
"container": "documentLibrary",
"path": "/",
"file": "Presentations",
"parent": {
"nodeRef": "workspace://SpacesStore/8f2105b4-daaf-4874-9e8a-2152569d109b"
}
},
"permissions": {
"inherited": true,
"roles": [
"ALLOWED;GROUP_site_swsdp_SiteCollaborator;SiteCollaborator;INHERITED",
"ALLOWED;GROUP_EVERYONE;SiteConsumer;INHERITED",
"ALLOWED;GROUP_EVERYONE;ReadPermissions;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteContributor;SiteContributor;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteConsumer;SiteConsumer;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteManager;SiteManager;INHERITED"
],
"userAccess": {
"create": true,
"edit": true,
"delete": true,
"cancel-checkout": false,
"permissions": true
}
},
"custom": {},
"actionLabels": {}
}
]
}

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 64 64" width="64" height="64" style="enable-background:new 0 0 64 64;" xml:space="preserve">
<style type="text/css">
.st0{fill:#0C79BF;}
</style>
<g>
<path class="st0" d="M0,27.9v29.9c0,1.4,1.1,2.5,2.5,2.5h59.1c1.4,0,2.5-1.1,2.5-2.5V27.9H0z"/>
<path class="st0" d="M0,23.7h64V13.5c0-1.4-1.1-2.5-2.5-2.5H30l-6.2-6.5C23.3,4,22.7,3.7,22,3.7H0V23.7z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 639 B

View File

@ -1,23 +0,0 @@
{
"name": "alfresco-login",
"description": "Provide the Alfresco login .",
"keywords": [
"web-component",
"web-components",
"polymer",
"alfresco"
],
"main": "alfresco-login.html",
"license": "MIT",
"ignore": [
"/.*",
"/test/",
"/demo/",
"/bower_components/"
],
"dependencies": {
"polymer": "Polymer/polymer#^1.0.0"
},
"_originalSource": "alfresco-login",
"_direct": true
}

View File

@ -1,96 +0,0 @@
# Introduction
This repository contains an element for the Alfresco login REST API. The element is designed for use in Polymer 1.0.
## Install
Install the component using [Bower](http://bower.io/):
```sh
$ bower install alfresco-login --save
```
Or [download as ZIP](https://github.com/TODO/master.zip).
## Usage
1. Import Web Components' polyfill:
```html
<script src="bower_components/webcomponentsjs/webcomponents.min.js"></script>
```
2. Import Custom Element:
```html
<link rel="import" href="bower_components/alfresco-login/alfresco-login.html">
```
3. Start using it!
```html
<alfresco-login></alfresco-login>
```
## Options
Attribute | Options | Default | Description
--- | --- | --- | ---
`method` | *string* | `GET` | Type of HTTP Request.
## Events
Event | Description
--- | ---
`onsubmit` | The event is fired if a user signs in Alfresco successfully.
--- | ---
`onerror` | The event is fired if a user is not signed into Alfresco..
## Development
In order to run it locally you'll need to fetch some dependencies and a basic server setup.
* Install [Bower](http://bower.io/) & [Grunt](http://gruntjs.com/):
```sh
$ [sudo] npm install -g bower grunt-cli
```
* Install local dependencies:
```sh
$ bower install && npm install
```
* To test your project, start the development server and open `http://localhost:8000`.
```sh
$ grunt server
```
* To build the distribution files before releasing a new version.
```sh
$ grunt build
```
* To provide a live demo, send everything to `gh-pages` branch.
```sh
$ grunt deploy
```
## Contributing
1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -m 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D
## History
For detailed changelog, check [Releases](https://github.com/TODO/alfresco-file-list/releases).
## License
[MIT License](http://opensource.org/licenses/MIT)

View File

@ -1,135 +0,0 @@
<link rel="import" href="../polymer/polymer.html">
<!--
An element providing a solution to the login.
Example:
<alfresco-login method="GET" onsubmit="methodSuccess" onerror="methodError"></alfresco-login>
@demo
-->
<link rel="import" href="../paper-input/paper-input.html">
<link rel="import" href="../paper-button/paper-button.html">
<dom-module id="alfresco-login">
<style type="text/css">
:host([invalid]) input {
border-color: red;
}
</style>
<template>
<form id="login">
<paper-input name="username" id="username" label="Username"></paper-input>
<paper-input label="password input" name="password" id="password" type="password"></paper-input>
<button type="submit" class="btn btn-default" on-click="_submit">Login</button>
</form>
</template>
</dom-module>
<script>
Polymer({
is: 'alfresco-login',
behaviors: [
Polymer.IronValidatableBehavior
],
/**
* The submit event is fired if a user
* signs in Alfresco successfully.
*
* @event submit
*/
/**
* The error event is fired if a
* user is not signed into Alfresco.
*
* @event error
*/
properties: {
method: {
type: String,
value: 'GET'
},
headers: {
type: Object,
value: {}
}
},
ready: function(){
},
fireSubmit: function(token) {
this.fire("submit", {ticket: token});
},
/**
* Login Alfesco
*
* @param {object}
*/
_submit: function(event) {
if(event) {
event.preventDefault();
}
var self = this;
var xhr = new XMLHttpRequest();
var url = 'http://192.168.99.100:8080/alfresco/service/api/login';
var parameterJson = '';
if (this.method === 'POST') {
parameterJson = JSON.stringify({username: username.value, password: password.value});
} else {
url += '?u='+username.value+'&pw='+password.value;
}
xhr.open(this.method, url, true);
for (key in this.headers) {
if (this.headers.hasOwnProperty(key)) {
xhr.setRequestHeader(key, this.headers[key]);
}
}
xhr.onload = function(e) {
e.preventDefault();
if (xhr.status === 200) {
var token = '';
if (xhr.responseXML) {
token = xhr.responseXML.children[0].childNodes[0].nodeValue;
} else {
token = JSON.parse(xhr.responseText).data.ticket;
}
if (token) {
self.fireSubmit(token);
} else {
self.fire("error", {error:'Token error'});
}
} else {
self.fire("error", {error:'Login error'});
}
};
xhr.send(parameterJson);
return xhr;
}
});
</script>

View File

@ -1,32 +0,0 @@
{
"name": "alfresco-login",
"description": "Provide the Alfresco login .",
"keywords": [
"web-component",
"web-components",
"polymer",
"alfresco"
],
"main": "alfresco-login.html",
"license": "MIT",
"ignore": [
"/.*",
"/test/",
"/demo/",
"/bower_components/"
],
"dependencies": {
"polymer": "Polymer/polymer#^1.0.0",
"paper-input": "~1.1.10"
},
"devDependencies": {
"iron-component-page": "polymerelements/iron-component-page#^1.0.0",
"iron-image": "polymerelements/iron-image#^1.0.0",
"paper-styles": "polymerelements/paper-styles#^1.0.0",
"test-fixture": "polymerelements/test-fixture#^1.0.0",
"web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"_originalSource": "alfresco-login",
"_direct": true
}

View File

@ -1,16 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="alfresco-login.html">
</head>
<body>
<alfresco-login method="GET"></alfresco-login>
</body>
</html>

View File

@ -1,79 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script src="../bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<script src="../bower_components/web-component-tester/browser.js"></script>
<!-- import the element to test -->
<link rel="import" href="../alfresco-login.html">
</head>
<body>
<!-- use the document as a place to set up your fixtures -->
<test-fixture id="alfresco-login-fixture">
<template>
<alfresco-login>
</alfresco-login>
</template>
</test-fixture>
<script>
suite('<alfresco-login>', function() {
var myEl;
setup(function() {
myEl = fixture('alfresco-login-fixture');
});
test('defines the "method" property', function() {
assert.equal(myEl.method, 'GET');
});
test('fires submit', function(done) {
myEl.addEventListener('submit', function(event) {
assert.equal(event.detail.ticket, 'TICKET_mock');
done();
});
myEl.fireSubmit('TICKET_mock');
});
});
suite('<alfresco-login-submit>', function() {
var ajax;
var request;
var server;
var responseHeaders = {
json: { 'Content-Type': 'application/json' }
};
setup(function() {
server = sinon.fakeServer.create();
server.respondWith(
'GET',
/\/alfresco.*/, [
200,
responseHeaders.json,
'{ "data": { "ticket":"TICKET_mock" } }'
]
);
});
teardown(function() {
server.restore();
});
suite('when making simple GET requests for JSON', function() {
setup(function() {
// get fresh instance of iron-ajax before every test
ajax = fixture('alfresco-login-fixture');
});
test('has sane defaults that love you', function() {
request = ajax._submit();
server.respond();
expect(request.response).to.be.ok;
expect(request.response).to.be.equal('{ "data": { "ticket":"TICKET_mock" } }');
});
test('has the correct xhr method', function() {
request = ajax._submit();
expect(request.method).to.be.equal('GET');
});
});
});
</script>
</body>
</html>

View File

@ -1,33 +0,0 @@
{
"name": "file-upload",
"version": "1.6.4",
"authors": [
"Winston Howes <winstonhowes@gmail.com>"
],
"description": "An element for using ajax to upload files.",
"keywords": [
"web-component",
"web-components",
"polymer",
"file",
"ajax",
"upload"
],
"main": "file-upload.html",
"license": "MIT",
"homepage": "https://github.com/winhowes/file-upload/",
"ignore": [
"/.*",
"/test/",
"/demo/",
"/bower_components/"
],
"dependencies": {
"polymer": "Polymer/polymer#^1.0.0",
"paper-progress": "PolymerElements/paper-progress#^1.0.0"
},
"devDependencies": {
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"web-component-tester": "*"
}
}

View File

@ -1,43 +0,0 @@
{
"name": "file-upload",
"version": "1.6.4",
"authors": [
"Winston Howes <winstonhowes@gmail.com>"
],
"description": "An element for using ajax to upload files.",
"keywords": [
"web-component",
"web-components",
"polymer",
"file",
"ajax",
"upload"
],
"main": "file-upload.html",
"license": "MIT",
"homepage": "https://github.com/winhowes/file-upload/",
"ignore": [
"/.*",
"/test/",
"/demo/",
"/bower_components/"
],
"dependencies": {
"polymer": "Polymer/polymer#^1.0.0",
"paper-progress": "PolymerElements/paper-progress#^1.0.0"
},
"devDependencies": {
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"web-component-tester": "*"
},
"_release": "1.6.4",
"_resolution": {
"type": "version",
"tag": "v1.6.4",
"commit": "eeaa8d62ac0d7ae2f5adb9531c427bfba3952f1c"
},
"_source": "git://github.com/winhowes/file-upload.git",
"_target": "~1.6.4",
"_originalSource": "file-upload",
"_direct": true
}

View File

@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2015 Winston Howes
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,10 +0,0 @@
# Introduction
This repository contains an element for file uploads using ajax. It supports multi-file selection as well as optional drop zones for drag-and-drop. The element is designed for use in Polymer 1.0.
Check out the demo and docs here: https://winhowes.github.io/file-upload/components/file-upload/.
# Installation
To install simply run:
```
bower install --save file-upload
```

View File

@ -1,529 +0,0 @@
<!--
@license
Copyright (c) 2015 Winston Howes. All rights reserved.
This code may only be used under the MIT license found at https://github.com/winhowes/file-upload/blob/master/LICENSE
-->
<link rel="import" href="../../bower_components/polymer/polymer.html">
<!--
An element providing a solution to no problem in particular.
Example:
<file-upload target="/path/to/destination"></file-upload>
@demo
-->
<link rel="import" href="../../bower_components/paper-button/paper-button.html">
<link rel="import" href="../../bower_components/paper-progress/paper-progress.html">
<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
<link rel="import" href="../../bower_components/iron-signals/iron-signals.html">
<dom-module id="file-upload">
<style type="text/css">
:host {
width: 100%;
display: inline-block;
}
.file-upload-0 paper-button#button.file-upload{
float:left;
}
.file{
width: 100%;
}
.name{
width: 100%;
}
.enabled {
border: 1px dashed #555;
@apply(--file-upload-upload-border-enabled);
}
.hover {
opacity: .7;
border: 1px dashed #111;
@apply(--file-upload-upload-border-hover);
}
#UploadBorder{
width: 80%;
vertical-align: middle;
color: #555;
padding: 20px;
max-height: 300px;
overflow-y: auto;
display: inline-block;
@apply(--file-upload-upload-border);
}
#dropArea {
text-align: center;
@apply(--file-upload-drop-area);
}
paper-button#button {
font: 13px/1.231 Open Sans,arial,helvetica,clean,sans-serif;
margin-bottom: 20px;
@apply(--file-upload-button);
}
.file {
padding: 10px 0px;
@apply(--file-upload-file);
}
.commands {
float: right;
@apply(--file-upload-commands);
}
.commands iron-icon:not([icon="check-circle"]) {
cursor: pointer;
opacity: .9;
@apply(--file-upload-commands-faded);
}
.commands iron-icon:hover {
opacity: 1;
@apply(--file-upload-commands-hovered);
}
[hidden] {
display: none;
}
.error {
color: #f40303;
font-size: 11px;
margin: 2px 0px -3px;
@apply(--file-upload-error);
}
paper-progress {
--paper-progress-active-color: #03a9f4;
}
paper-progress[error] {
--paper-progress-active-color: #f40303;
}
paper-button#button {
margin-bottom: 20px;
background-color: rgba(255, 152, 0, 0.75);
}
</style>
<template>
<div>
<paper-button id="button" icon="file-upload" class="blue" on-click="_fileClick">
<iron-icon icon="icons:add" class="x-scope iron-icon-1"></iron-icon>
<span data-reactid=".0.0.0.0.1"> Add File</span>
</paper-button>
<div id='UploadBorder'>
<div id="dropArea" hidden$="{{!_shownDropText}}">{{droptext}}</div>
<template is="dom-repeat" items="{{files}}">
<div class="file">
<div class="name">
<span>{{item.name}}</span>
<div class="commands">
<iron-icon icon="autorenew" title="{{retryText}}" on-click="_retryUpload" hidden$="{{!item.error}}"></iron-icon>
<iron-icon icon="cancel" title="{{removeText}}" on-click="_cancelUpload" hidden$="{{item.complete}}"></iron-icon>
<iron-icon icon="check-circle" title="{{successText}}" hidden$="{{!item.complete}}"></iron-icon>
</div>
</div>
<div class="error" hidden$="{{!item.error}}">{{errorText}}</div>
<div hidden$={{progressHidden}}>
<paper-progress value$="{{item.progress}}" error$="{{item.error}}"></paper-progress>
</div>
</div>
</template>
</div>
</div>
<input type="file" id="fileInput" on-change="_fileChange" hidden multiple="{{multi}}" accept="{{accept}}">
<!--<paper-toast id="toastSuccess" text="File uploaded successfully!"></paper-toast>
<paper-toast id="toastFail" text="Error uploading file!"></paper-toast>-->
</template>
</dom-module>
<script>
Polymer({
is: 'file-upload',
/**
* Fired when a response is received status code 200.
*
* @event success
*/
/**
* Fired when a response is received other status code.
*
* @event error
*/
/**
* Fired when a file is about to be uploaded.
*
* @event before-upload
*/
properties: {
/**
* `target` is the target url to upload the files to.
* Additionally by adding "<name>" in your url, it will be replaced by
* the file name.
*/
target: {
type: String,
value: ""
},
/**
* `accept` is the set of comma separated file extensions or mime types
* to filter as accepted.
*/
accept: {
type: String,
value: ""
},
/**
* `progressHidden` indicates whether or not the progress bar should be hidden.
*/
progressHidden: {
type: Boolean,
value: false
},
/**
* `droppable` indicates whether or not to allow file drop.
*/
droppable: {
type: Boolean,
value: false,
observer: 'init'
},
/**
* `droptext` is the text to display in the file drop area.
*/
droptext: {
type: String,
value: ""
},
/**
* `multi` indicates whether or not to allow multiple files to be uploaded.
*/
multi: {
type: Boolean,
value: false
},
/**
* `files` is the list of files to be uploaded
*/
files: {
type: Array,
value: function() {
return [];
}
},
/**
* `method` is the http method to be used during upload
*/
method: {
type: String,
value: "POST"
},
/**
* `raised` indicates whether or not the button should be raised
*/
raised: {
type: Boolean,
value: false
},
/**
* `noink` indicates that the button should not have an ink effect
*/
noink: {
type: Boolean,
value: false
},
/**
* `headers` is a key value map of header names and values
*/
headers: {
type: Object,
value: {},
},
/**
* `retryText` is the text for the tooltip to retry an upload
*/
retryText: {
type: String,
value: 'Retry Upload'
},
/**
* `removeText` is the text for the tooltip to remove an upload
*/
removeText: {
type: String,
value: 'Remove'
},
/**
* `successText` is the text for the tooltip of a successful upload
*/
successText: {
type: String,
value: 'Success'
},
/**
* `errorText` is the text to display for a failed upload
*/
errorText: {
type: String,
value: 'Error uploading file...'
},
/**
* `_shownDropText` indicates whether or not the drop text should be shown
*/
_shownDropText: {
type: Boolean,
value: false
},
site: {
type: String,
value: 'swsdp'
},
container: {
type: String,
value: 'documentLibrary'
},
},
/**
* Clears the list of files
*/
clear: function() {
this.set("files", []);
this._showDropText();
},
ready: function() {
},
init: function() {
if (this.raised) {
this.toggleAttribute("raised", true, this.$.button);
}
if (this.noink) {
this.toggleAttribute("noink", true, this.$.button);
}
if (this.droppable === 'true') {
this._showDropText();
this.setupDrop();
} else {
this._hideDropText();
}
},
/**
* A function to set up a drop area for drag-and-drop file uploads
*/
setupDrop: function() {
var uploadBorder = this.$.UploadBorder;
this.toggleClass("enabled", true, uploadBorder);
this.ondragover = function(e) {
e.stopPropagation();
this.toggleClass("hover", true, uploadBorder);
return false;
}
this.ondragleave = function() {
this.toggleClass("hover", false, uploadBorder);
return false;
}
this.ondrop = function(event) {
this.toggleClass("hover", false, uploadBorder);
event.preventDefault();
var length = event.dataTransfer.files.length;
for (var i = 0; i < length; i++) {
var file = event.dataTransfer.files[i];
// Check if multiple upload is allowed
if (!this.multi && this.files.length !== 0) {
return;
}
// Check if filetype is accepted
var mimeType = ((file.type !== '') ? file.type.match(/^[^\/]*\//)[0] : null);
var fileType = file.name.match(/\.[^\.]*$/)[0];
if (this.accept !== '' && !(this.accept.indexOf(mimeType) > -1 || this.accept.indexOf(fileType) > -1)) {
return;
}
file.progress = 0;
file.error = false;
file.complete = false;
this.push("files", file);
this.uploadFile(file);
}
}
},
/**
* Clicks the invisible file input
*/
_fileClick: function() {
var elem = this.$.fileInput;
if (elem && document.createEvent) { // sanity check
var evt = document.createEvent("MouseEvents");
evt.initEvent("click", true, false);
elem.dispatchEvent(evt);
}
},
/**
* Called whenever the list of selected files changes
*/
_fileChange: function(e) {
var length = e.target.files.length;
for (var i = 0; i < length; i++) {
var file = e.target.files[i];
file.progress = 0;
file.error = false;
file.complete = false;
this.push("files", file);
this.uploadFile(file);
}
},
/**
* Cancels the file upload for a specific file
*
* @param {object} a file, an element of the files array
*/
cancel: function(file) {
if (file && file.xhr) {
file.xhr.abort();
this.splice("files", this.files.indexOf(file), 1);
this._showDropText();
}
},
/**
* Cancels the file upload
*
* @param {object}, an event object
*/
_cancelUpload: function(e) {
this.cancel(e.model.__data__.item);
},
/**
* Retries to upload the file
*
* @param {object}, an event object
*/
_retryUpload: function(e) {
e.model.set("item.error", false);
e.model.set("item.progress", 0);
// The async helps give visual feedback of a retry occurring, even though it's less efficient.
var self = this;
this.async(function() {
self.uploadFile(e.model.__data__.item);
}, 50);
},
/**
* Whether or not to display the drop text
*/
_showDropText: function() {
this.set("_shownDropText", true);
},
_hideDropText: function() {
this.set("_shownDropText", false);
var uploadBorder = this.$.UploadBorder;
this.toggleClass("enabled", false, uploadBorder);
this.toggleClass("hover", false, uploadBorder);
},
/**
* Uploads a file
*
* @param {object} a file, an element of the files array
*/
uploadFile: function(file) {
if (!file) {
return;
}
this.fire('before-upload');
this._showDropText();
var prefix = "files." + this.files.indexOf(file);
var self = this;
var formData = new FormData();
formData.append("filedata", file, file.name);
formData.append('siteid', this.site);
formData.append('containerid', this.container);
var xhr = file.xhr = new XMLHttpRequest();
xhr.upload.onprogress = function(e) {
var done = e.loaded, total = e.total;
self.set(prefix + ".progress", Math.floor((done/total)*1000)/10);
};
var url = this.target.replace("<name>", file.name);
xhr.open(this.method, url, true);
for (key in this.headers) {
if (this.headers.hasOwnProperty(key)) {
xhr.setRequestHeader(key, this.headers[key]);
}
}
xhr.setRequestHeader("Authorization", 'Basic ' + btoa('admin:admin'))
xhr.onload = function(e) {
if (xhr.status === 200) {
self.fire("success", {xhr: xhr});
self.set(prefix + ".complete", true);
if(document.querySelector("#alfresco-app")) {
document.querySelector('#alfresco-app').fire('iron-signal', {name: "uploaded", data: "uploaded!"});
}
} else {
self.set(prefix + ".error", true);
self.set(prefix + ".complete", false);
self.set(prefix + ".progress", 100);
self.updateStyles();
self.fire("error", {xhr:xhr});
}
};
xhr.send(formData);
}
});
</script>

View File

@ -1,25 +0,0 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 Winston Howes. All rights reserved.
This code may only be used under the MIT license found at https://github.com/winhowes/file-upload/blob/master/LICENSE
-->
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../iron-component-page/iron-component-page.html">
</head>
<body>
<!-- Note: if the main element for this repository doesn't
match the folder name, add a src="&lt;main-component&gt;.html" attribute,
where &lt;main-component&gt;.html" is a file that imports all of the
components you want documented. -->
<iron-component-page></iron-component-page>
</body>
</html>