Compare commits
14 Commits
es_rev9847
...
es_rev9852
| Author | SHA1 | Date | |
|---|---|---|---|
| a7f1f14b8a | |||
| fbda2c9eb2 | |||
| ff58593bff | |||
| c65f5765d6 | |||
| 19565b9c98 | |||
| 6716cb5575 | |||
| 75332c148d | |||
| b54fd85172 | |||
| bc07aad01b | |||
| ce4bb551d2 | |||
| 5ceb9d3dd3 | |||
| c1a5838320 | |||
| db697cec3e | |||
| 892f2331de |
@@ -8,7 +8,7 @@
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
</file_rule>
|
||||
<option debug="true" warning="true" full_class_checking="false" is_attached_by_default="true" void_safety="all" syntax="transitional">
|
||||
<option debug="true" warning="true" full_class_checking="false" is_attached_by_default="true" is_obsolete_routine_type="true" void_safety="all" syntax="transitional">
|
||||
<debug name="dbglog" enabled="true"/>
|
||||
</option>
|
||||
<setting name="executable_name" value="demo"/>
|
||||
@@ -28,6 +28,7 @@
|
||||
<library name="cms_demo_module" location="modules\demo\cms_demo_module-safe.ecf" readonly="false"/>
|
||||
<library name="cms_email_service" location="..\..\library\email\email-safe.ecf" readonly="false"/>
|
||||
<library name="cms_feed_aggregator_module" location="..\..\modules\feed_aggregator\feed_aggregator-safe.ecf" readonly="false"/>
|
||||
<library name="cms_files_module" location="..\..\modules\files\files-safe.ecf" readonly="false"/>
|
||||
<library name="cms_google_search_module" location="..\..\modules\google_search\google_search-safe.ecf" readonly="false" use_application_options="true"/>
|
||||
<library name="cms_model" location="..\..\library\model\cms_model-safe.ecf" readonly="false"/>
|
||||
<library name="cms_node_module" location="..\..\modules\node\node-safe.ecf" readonly="false"/>
|
||||
@@ -37,12 +38,9 @@
|
||||
<library name="cms_seo_module" location="..\..\modules\seo\seo-safe.ecf" readonly="false"/>
|
||||
<library name="cms_session_auth_module" location="..\..\modules\session_auth\cms_session_auth-safe.ecf" readonly="false"/>
|
||||
<library name="cms_taxnomy_module" location="..\..\modules\taxonomy\taxonomy-safe.ecf" readonly="false"/>
|
||||
<library name="persistence_sqlite3" location="..\..\library\persistence\sqlite3\sqlite3-safe.ecf" readonly="false">
|
||||
<option>
|
||||
<assertions/>
|
||||
</option>
|
||||
</library>
|
||||
<library name="persistence_sqlite3" location="..\..\library\persistence\sqlite3\sqlite3-safe.ecf" readonly="false"/>
|
||||
<!--
|
||||
By default, commented, since it depends on specific environment settings.
|
||||
<library name="persistence_store_odbc" location="..\..\library\persistence\store_odbc\store_odbc-safe.ecf"/>
|
||||
<library name="persistence_store_mysql" location="..\..\library\persistence\store_mysql\store_mysql-safe.ecf" />
|
||||
-->
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
port=9090
|
||||
#port=12345
|
||||
#verbose=true
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@echo off
|
||||
setlocal
|
||||
set ROC_CMD=call %~dp0..\..\tools\roc.bat
|
||||
set ROC_CMS_DIR=%~dp0
|
||||
@@ -16,3 +17,4 @@ set ROC_CMS_DIR=%~dp0
|
||||
%ROC_CMD% install --module ..\..\modules\seo --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\session_auth --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\taxonomy --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\files --dir %ROC_CMS_DIR%
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
#navigation.region=sidebar_first
|
||||
#navigation.condition=is_front
|
||||
management.conditions[]=path:admin*
|
||||
management.conditions[]=is_front
|
||||
#management.conditions[]=path:admin*
|
||||
#management.conditions[]=is_front
|
||||
|
||||
#Feeds
|
||||
feed.news.weight=3
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
{
|
||||
"subject": "Thank you for contacting us",
|
||||
"forms": {
|
||||
"registration": {
|
||||
"application_description": "Present yourself in a few lines, otherwise your application is likely to be rejected."
|
||||
}
|
||||
},
|
||||
"recaptcha": {
|
||||
"site_key":"6Lex9RMTAAAAAKleC4x6TaRlFcpLbEWgH_U7MSiD",
|
||||
"secret_key":"6Lex9RMTAAAAAAkBczvX5DUiyg_xoM_EthVVgRRx"
|
||||
|
||||
@@ -21,6 +21,6 @@
|
||||
|
||||
<p>To reject the registration, please click on the following link <p>
|
||||
|
||||
<p><a href="$rejection_url<">$rejection_url</a></p>
|
||||
<p><a href="$rejection_url">$rejection_url</a></p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -17,22 +17,21 @@
|
||||
<input type="email" id="email" name="email" value="{$email/}" required/>
|
||||
<label for="email">Email</label>
|
||||
{if isset="$error_email"}
|
||||
<span><i>{$error_email/}</i></span> <br>
|
||||
<span><i>{$error_email/}</i></span> <br/>
|
||||
{/if}
|
||||
</div>
|
||||
<div>
|
||||
<textarea rows="4" cols="50" name="personal_information" id="personal_information" required>
|
||||
{$personal_information/}
|
||||
</textarea>
|
||||
<textarea rows="4" cols="50" name="personal_information" id="personal_information" required>{$personal_information/}</textarea>
|
||||
<label for="personal_information">Tell us why you want to register an account</label>
|
||||
{if isset="$error_application"}
|
||||
<span><i>{$error_application/}</i></span> <br>
|
||||
<span><i>{$error_application/}</i></span><br/>
|
||||
{/if}
|
||||
{if isset="$application_description"}
|
||||
<br/>
|
||||
<p class="description">{$application_description/}</p>
|
||||
{/if}
|
||||
</div>
|
||||
{unless isempty="$recaptcha_site_key"}
|
||||
<div class="g-recaptcha" data-sitekey="{$recaptcha_site_key/}"></div>
|
||||
<br/>
|
||||
{/unless}
|
||||
{unless isempty="$recaptcha_site_key"}<div class="g-recaptcha" data-sitekey="{$recaptcha_site_key/}"></div><br/>{/unless}
|
||||
<button type="submit">Register</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{unless isset="$user"}
|
||||
<div class="login-box">
|
||||
<div class="description">The "Basic Auth" relies on the HTTP basic acces authentication.<br/>(see also: <a href="https://en.wikipedia.org/wiki/Basic_access_authentication">https://en.wikipedia.org/wiki/Basic_access_authentication</a> )</div>
|
||||
<div class="description">The "Basic Auth" relies on the HTTP basic access authentication.<br/>(see also: <a href="https://en.wikipedia.org/wiki/Basic_access_authentication">https://en.wikipedia.org/wiki/Basic_access_authentication</a> )</div>
|
||||
<h3>Login or <a href="{$site_url/}account/roc-register">Register</a></h3>
|
||||
<div>
|
||||
<form name="cms_basic_auth" action="{$site_url/}roc-basic-login" method="POST">
|
||||
|
||||
52
examples/demo/site/modules/files/files/css/files.css
Normal file
52
examples/demo/site/modules/files/files/css/files.css
Normal file
@@ -0,0 +1,52 @@
|
||||
.uploaded-files table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
border: 1px solid black;
|
||||
}
|
||||
.uploaded-files table th {
|
||||
padding: 3px 0 3px 5px;
|
||||
}
|
||||
.uploaded-files table td {
|
||||
padding: 3px 0 3px 5px;
|
||||
}
|
||||
.uploaded-files a.button {
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
border: solid 1px #999;
|
||||
background-color: #ddd;
|
||||
padding: 2px 4px 2px 4px;
|
||||
}
|
||||
.uploaded-files a.button:hover {
|
||||
color: black;
|
||||
border: solid 1px #06f;
|
||||
background-color: #cff;
|
||||
}
|
||||
|
||||
.upload-files .center {
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
}
|
||||
.upload-files a.button {
|
||||
margin: auto;
|
||||
width: 100px;
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
border: solid 1px #999;
|
||||
background-color: #ddd;
|
||||
padding: 2px 4px 2px 4px;
|
||||
}
|
||||
.upload-files a.button:hover {
|
||||
color: black;
|
||||
border: solid 1px #06f;
|
||||
background-color: #cff;
|
||||
}
|
||||
|
||||
/******************* Drop Zone *******************/
|
||||
.dropzone {
|
||||
width: 100%;
|
||||
border: 2px dashed blue;
|
||||
border-radius: 3px;
|
||||
text-align: center;
|
||||
padding-top: 15px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
BIN
examples/demo/site/modules/files/files/img/file-logo.png
Normal file
BIN
examples/demo/site/modules/files/files/img/file-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
1
examples/demo/site/modules/files/files/js/dropzone.css
Normal file
1
examples/demo/site/modules/files/files/js/dropzone.css
Normal file
File diff suppressed because one or more lines are too long
1763
examples/demo/site/modules/files/files/js/dropzone.js
Normal file
1763
examples/demo/site/modules/files/files/js/dropzone.js
Normal file
File diff suppressed because it is too large
Load Diff
78
examples/demo/site/modules/files/files/js/src/basic.scss
Normal file
78
examples/demo/site/modules/files/files/js/src/basic.scss
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* The MIT License
|
||||
* Copyright (c) 2012 Matias Meno <m@tias.me>
|
||||
*/
|
||||
|
||||
// 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.
|
||||
|
||||
.dropzone, .dropzone * {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.dropzone {
|
||||
|
||||
position: relative;
|
||||
|
||||
.dz-preview {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 120px;
|
||||
margin: 0.5em;
|
||||
|
||||
.dz-progress {
|
||||
display: block;
|
||||
height: 15px;
|
||||
border: 1px solid #aaa;
|
||||
.dz-upload {
|
||||
display: block;
|
||||
height: 100%;
|
||||
width: 0;
|
||||
background: green;
|
||||
}
|
||||
}
|
||||
|
||||
.dz-error-message {
|
||||
color: red;
|
||||
display: none;
|
||||
}
|
||||
&.dz-error {
|
||||
.dz-error-message, .dz-error-mark {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
&.dz-success {
|
||||
.dz-success-mark {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.dz-error-mark, .dz-success-mark {
|
||||
position: absolute;
|
||||
display: none;
|
||||
left: 30px;
|
||||
top: 30px;
|
||||
width: 54px;
|
||||
height: 58px;
|
||||
left: 50%;
|
||||
margin-left: -(54px/2);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
1590
examples/demo/site/modules/files/files/js/src/dropzone.coffee
Normal file
1590
examples/demo/site/modules/files/files/js/src/dropzone.coffee
Normal file
File diff suppressed because it is too large
Load Diff
413
examples/demo/site/modules/files/files/js/src/dropzone.scss
Normal file
413
examples/demo/site/modules/files/files/js/src/dropzone.scss
Normal file
@@ -0,0 +1,413 @@
|
||||
/*
|
||||
* The MIT License
|
||||
* Copyright (c) 2012 Matias Meno <m@tias.me>
|
||||
*/
|
||||
|
||||
// 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.
|
||||
|
||||
@mixin keyframes($name) {
|
||||
@-webkit-keyframes #{$name} {
|
||||
@content;
|
||||
}
|
||||
@-moz-keyframes #{$name} {
|
||||
@content;
|
||||
}
|
||||
@keyframes #{$name} {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@mixin prefix($map, $vendors: webkit moz ms o) {
|
||||
@each $prop, $value in $map {
|
||||
@if $vendors {
|
||||
@each $vendor in $vendors {
|
||||
#{"-" + $vendor + "-" + $prop}: #{$value};
|
||||
}
|
||||
}
|
||||
// Dump regular property anyway
|
||||
#{$prop}: #{$value};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@include keyframes(passing-through) {
|
||||
|
||||
0% {
|
||||
opacity: 0;
|
||||
@include prefix((transform: translateY(40px)));
|
||||
}
|
||||
|
||||
30%, 70% {
|
||||
opacity: 1;
|
||||
@include prefix((transform: translateY(0px)));
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0;
|
||||
@include prefix((transform: translateY(-40px)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@include keyframes(slide-in) {
|
||||
|
||||
0% {
|
||||
opacity: 0;
|
||||
@include prefix((transform: translateY(40px)));
|
||||
}
|
||||
|
||||
30% {
|
||||
opacity: 1;
|
||||
@include prefix((transform: translateY(0px)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@include keyframes(pulse) {
|
||||
|
||||
0% { @include prefix((transform: scale(1))); }
|
||||
10% { @include prefix((transform: scale(1.1))); }
|
||||
20% { @include prefix((transform: scale(1))); }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.dropzone, .dropzone * {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.dropzone {
|
||||
|
||||
$image-size: 120px;
|
||||
|
||||
$image-border-radius: 20px;
|
||||
|
||||
&.dz-clickable {
|
||||
cursor: pointer;
|
||||
|
||||
* {
|
||||
cursor: default;
|
||||
}
|
||||
.dz-message {
|
||||
&, * {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
min-height: 150px;
|
||||
border: 2px solid rgba(0, 0, 0, 0.3);
|
||||
background: white;
|
||||
padding: 20px 20px;
|
||||
|
||||
&.dz-started {
|
||||
.dz-message {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
&.dz-drag-hover {
|
||||
border-style: solid;
|
||||
.dz-message {
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
.dz-message {
|
||||
text-align: center;
|
||||
margin: 2em 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.dz-preview {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
|
||||
vertical-align: top;
|
||||
|
||||
margin: 16px;
|
||||
min-height: 100px;
|
||||
|
||||
&:hover {
|
||||
// Making sure that always the hovered preview element is on top
|
||||
z-index: 1000;
|
||||
.dz-details {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&.dz-file-preview {
|
||||
|
||||
.dz-image {
|
||||
border-radius: $image-border-radius;
|
||||
background: #999;
|
||||
background: linear-gradient(to bottom, #eee, #ddd);
|
||||
}
|
||||
|
||||
.dz-details {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&.dz-image-preview {
|
||||
background: white;
|
||||
.dz-details {
|
||||
@include prefix((transition: opacity 0.2s linear));
|
||||
}
|
||||
}
|
||||
|
||||
.dz-remove {
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover .dz-details {
|
||||
opacity: 1;
|
||||
}
|
||||
.dz-details {
|
||||
$background-color: #444;
|
||||
|
||||
z-index: 20;
|
||||
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
|
||||
opacity: 0;
|
||||
|
||||
font-size: 13px;
|
||||
min-width: 100%;
|
||||
max-width: 100%;
|
||||
padding: 2em 1em;
|
||||
text-align: center;
|
||||
color: rgba(0, 0, 0, 0.9);
|
||||
|
||||
$width: 120px;
|
||||
|
||||
line-height: 150%;
|
||||
|
||||
.dz-size {
|
||||
margin-bottom: 1em;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.dz-filename {
|
||||
|
||||
white-space: nowrap;
|
||||
|
||||
&:hover {
|
||||
span {
|
||||
border: 1px solid rgba(200, 200, 200, 0.8);
|
||||
background-color: rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
}
|
||||
&:not(:hover) {
|
||||
span {
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.dz-filename, .dz-size {
|
||||
span {
|
||||
background-color: rgba(255, 255, 255, 0.4);
|
||||
padding: 0 0.4em;
|
||||
border-radius: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.dz-image {
|
||||
// opacity: 0.8;
|
||||
img {
|
||||
@include prefix((transform: scale(1.05, 1.05))); // Getting rid of that white bleed-in
|
||||
@include prefix((filter: blur(8px)), webkit); // Getting rid of that white bleed-in
|
||||
}
|
||||
}
|
||||
}
|
||||
.dz-image {
|
||||
border-radius: $image-border-radius;
|
||||
overflow: hidden;
|
||||
width: $image-size;
|
||||
height: $image-size;
|
||||
position: relative;
|
||||
display: block;
|
||||
z-index: 10;
|
||||
|
||||
img {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&.dz-success {
|
||||
.dz-success-mark {
|
||||
@include prefix((animation: passing-through 3s cubic-bezier(0.770, 0.000, 0.175, 1.000)));
|
||||
}
|
||||
}
|
||||
&.dz-error {
|
||||
.dz-error-mark {
|
||||
opacity: 1;
|
||||
@include prefix((animation: slide-in 3s cubic-bezier(0.770, 0.000, 0.175, 1.000)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.dz-success-mark, .dz-error-mark {
|
||||
|
||||
$image-height: 54px;
|
||||
$image-width: 54px;
|
||||
|
||||
pointer-events: none;
|
||||
|
||||
opacity: 0;
|
||||
z-index: 500;
|
||||
|
||||
position: absolute;
|
||||
display: block;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin-left: -($image-width/2);
|
||||
margin-top: -($image-height/2);
|
||||
|
||||
svg {
|
||||
display: block;
|
||||
width: $image-width;
|
||||
height: $image-height;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&.dz-processing .dz-progress {
|
||||
opacity: 1;
|
||||
@include prefix((transition: all 0.2s linear));
|
||||
}
|
||||
&.dz-complete .dz-progress {
|
||||
opacity: 0;
|
||||
@include prefix((transition: opacity 0.4s ease-in));
|
||||
}
|
||||
|
||||
&:not(.dz-processing) {
|
||||
.dz-progress {
|
||||
@include prefix((animation: pulse 6s ease infinite));
|
||||
}
|
||||
}
|
||||
.dz-progress {
|
||||
|
||||
opacity: 1;
|
||||
z-index: 1000;
|
||||
|
||||
pointer-events: none;
|
||||
position: absolute;
|
||||
height: 16px;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
margin-top: -8px;
|
||||
|
||||
width: 80px;
|
||||
margin-left: -40px;
|
||||
|
||||
// border: 2px solid #333;
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
|
||||
// Fix for chrome bug: https://code.google.com/p/chromium/issues/detail?id=157218
|
||||
-webkit-transform: scale(1);
|
||||
|
||||
|
||||
border-radius: 8px;
|
||||
|
||||
overflow: hidden;
|
||||
|
||||
.dz-upload {
|
||||
background: #333;
|
||||
background: linear-gradient(to bottom, #666, #444);
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 0;
|
||||
@include prefix((transition: width 300ms ease-in-out));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
&.dz-error {
|
||||
.dz-error-message {
|
||||
display: block;
|
||||
}
|
||||
&:hover .dz-error-message {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.dz-error-message {
|
||||
$width: $image-size + 20px;
|
||||
$color: rgb(190, 38, 38);
|
||||
|
||||
pointer-events: none;
|
||||
z-index: 1000;
|
||||
position: absolute;
|
||||
display: block;
|
||||
display: none;
|
||||
opacity: 0;
|
||||
@include prefix((transition: opacity 0.3s ease));
|
||||
border-radius: 8px;
|
||||
font-size: 13px;
|
||||
top: $image-size + 10px;
|
||||
left: -10px;
|
||||
width: $width;
|
||||
background: $color;
|
||||
background: linear-gradient(to bottom, $color, darken($color, 5%));
|
||||
padding: 0.5em 1.2em;
|
||||
color: white;
|
||||
|
||||
// The triangle pointing up
|
||||
&:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -6px;
|
||||
left: $width / 2 - 6px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-left: 6px solid transparent;
|
||||
border-right: 6px solid transparent;
|
||||
border-bottom: 6px solid $color;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
63
examples/demo/site/modules/files/files/scss/files.scss
Normal file
63
examples/demo/site/modules/files/files/scss/files.scss
Normal file
@@ -0,0 +1,63 @@
|
||||
.uploaded-files {
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
border: 1px solid black;
|
||||
|
||||
th {
|
||||
padding: 3px 0 3px 5px;
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 3px 0 3px 5px;
|
||||
}
|
||||
}
|
||||
|
||||
a.button{
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
border: solid 1px #999;
|
||||
background-color: #ddd;
|
||||
padding: 2px 4px 2px 4px;
|
||||
&:hover {
|
||||
color: black;
|
||||
border: solid 1px #06f;
|
||||
background-color: #cff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.upload-files {
|
||||
.center {
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
}
|
||||
a.button{
|
||||
margin: auto;
|
||||
width: 100px;
|
||||
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
border: solid 1px #999;
|
||||
background-color: #ddd;
|
||||
padding: 2px 4px 2px 4px;
|
||||
&:hover {
|
||||
color: black;
|
||||
border: solid 1px #06f;
|
||||
background-color: #cff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************* Drop Zone *******************/
|
||||
|
||||
.dropzone {
|
||||
width: 100%;
|
||||
border: 2px dashed blue;
|
||||
border-radius: 3px;
|
||||
text-align: center;
|
||||
padding-top: 15px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
@@ -57,6 +57,9 @@ feature -- CMS modules
|
||||
a_setup.register_module (create {CMS_NODE_MODULE}.make (a_setup))
|
||||
a_setup.register_module (create {CMS_BLOG_MODULE}.make)
|
||||
|
||||
-- Files
|
||||
a_setup.register_module (create {CMS_FILES_MODULE}.make)
|
||||
|
||||
-- Contact
|
||||
a_setup.register_module (create {CMS_CONTACT_MODULE}.make)
|
||||
|
||||
@@ -76,6 +79,7 @@ feature -- CMS modules
|
||||
a_setup.register_module (create {GOOGLE_CUSTOM_SEARCH_MODULE}.make)
|
||||
a_setup.register_module (create {CMS_DEBUG_MODULE}.make)
|
||||
a_setup.register_module (create {CMS_DEMO_MODULE}.make)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -163,6 +163,22 @@ feature -- Security
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_title (a_title: detachable READABLE_STRING_GENERAL)
|
||||
-- Set `title' to `a_title' or `location'.
|
||||
do
|
||||
if a_title /= Void then
|
||||
title := a_title.as_string_32
|
||||
else
|
||||
title := location.as_string_32
|
||||
end
|
||||
end
|
||||
|
||||
set_location (a_loc: READABLE_STRING_8)
|
||||
-- Set `location' to `a_loc'.
|
||||
do
|
||||
location := a_loc
|
||||
end
|
||||
|
||||
set_weight (a_weight: INTEGER)
|
||||
-- Set `weight' to `a_weight'.
|
||||
do
|
||||
|
||||
@@ -18,6 +18,65 @@ feature -- Access
|
||||
deferred
|
||||
end
|
||||
|
||||
item_by_title (a_title: READABLE_STRING_GENERAL): detachable CMS_LINK
|
||||
-- First link with title `a_title' if any.
|
||||
do
|
||||
if attached items as l_items then
|
||||
across
|
||||
l_items as ic
|
||||
until
|
||||
Result /= Void
|
||||
loop
|
||||
Result := ic.item
|
||||
if not a_title.is_case_insensitive_equal (Result.title) then
|
||||
Result := Void
|
||||
end
|
||||
end
|
||||
end
|
||||
ensure
|
||||
coherent_result: Result /= Void implies Result.title.is_case_insensitive_equal_general (a_title)
|
||||
end
|
||||
|
||||
item_by_location (a_loc: READABLE_STRING_8): detachable CMS_LINK
|
||||
-- First link with location `a_loc' if any.
|
||||
do
|
||||
if attached items as l_items then
|
||||
across
|
||||
l_items as ic
|
||||
until
|
||||
Result /= Void
|
||||
loop
|
||||
Result := ic.item
|
||||
if not a_loc.same_string (Result.location) then
|
||||
Result := Void
|
||||
end
|
||||
end
|
||||
end
|
||||
ensure
|
||||
coherent_result: Result /= Void implies Result.location.same_string (a_loc)
|
||||
end
|
||||
|
||||
new_composite_item (a_title: detachable READABLE_STRING_GENERAL; a_location: READABLE_STRING_8): CMS_LINK_COMPOSITE
|
||||
-- If exists, item with location `a_location' or title `a_title',
|
||||
-- otherwise create new local link and extend to Current.
|
||||
local
|
||||
lnk: CMS_LOCAL_LINK
|
||||
do
|
||||
if attached {CMS_LINK_COMPOSITE} item_by_location (a_location) as l_parent then
|
||||
Result := l_parent
|
||||
elseif a_title /= Void and then attached {CMS_LINK_COMPOSITE} item_by_title (a_title) as l_parent then
|
||||
Result := l_parent
|
||||
else
|
||||
create lnk.make (a_title, a_location)
|
||||
extend (lnk)
|
||||
Result := lnk
|
||||
end
|
||||
if attached {CMS_LOCAL_LINK} Result as l_local_lnk and then not l_local_lnk.is_expanded then
|
||||
l_local_lnk.set_expandable (True)
|
||||
l_local_lnk.set_collapsed (True)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
extend (lnk: CMS_LINK)
|
||||
@@ -25,6 +84,16 @@ feature -- Element change
|
||||
deferred
|
||||
end
|
||||
|
||||
extend_into (lnk: CMS_LINK; a_parent_title: detachable READABLE_STRING_GENERAL; a_parent_location: READABLE_STRING_8)
|
||||
-- Extend `lnk' into local link with location `a_parent_location'.
|
||||
-- If the parent is not found, create it with title `a_parent_title'.
|
||||
local
|
||||
l_parent: CMS_LINK_COMPOSITE
|
||||
do
|
||||
l_parent := new_composite_item (a_parent_title, a_parent_location)
|
||||
l_parent.extend (lnk)
|
||||
end
|
||||
|
||||
remove (lnk: CMS_LINK)
|
||||
-- Remove link `lnk' from Current container.
|
||||
deferred
|
||||
@@ -68,6 +137,6 @@ feature -- status report
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
copyright: "2011-2016, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
|
||||
@@ -79,16 +79,6 @@ feature -- Security
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_title (a_title: detachable READABLE_STRING_GENERAL)
|
||||
-- Set `title' to `a_title' or `location'.
|
||||
do
|
||||
if a_title /= Void then
|
||||
title := a_title.as_string_32
|
||||
else
|
||||
title := location.as_string_32
|
||||
end
|
||||
end
|
||||
|
||||
add_link (lnk: CMS_LINK)
|
||||
-- <Precursor>
|
||||
local
|
||||
@@ -194,6 +184,6 @@ feature {NONE} -- Implementation
|
||||
invariant
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
copyright: "2011-2016, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
|
||||
@@ -104,6 +104,6 @@ feature -- Access
|
||||
invariant
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
copyright: "2011-2016, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
|
||||
@@ -103,7 +103,7 @@ feature -- Security
|
||||
-- List of permission ids, used by this module, and declared.
|
||||
do
|
||||
Result := Precursor
|
||||
Result.force ("manage admin")
|
||||
Result.force ("access admin")
|
||||
Result.force ("admin users")
|
||||
Result.force ("admin roles")
|
||||
Result.force ("admin modules")
|
||||
@@ -132,28 +132,35 @@ feature -- Hooks
|
||||
menu_system_alter (a_menu_system: CMS_MENU_SYSTEM; a_response: CMS_RESPONSE)
|
||||
local
|
||||
lnk: CMS_LOCAL_LINK
|
||||
admin_lnk: CMS_LINK_COMPOSITE
|
||||
do
|
||||
if
|
||||
a_response.has_permission ("manage " + {CMS_ADMIN_MODULE}.name) -- Note: admin user has all permissions enabled by default.
|
||||
then
|
||||
-- TODO: we should probably use more side menu and less primary_menu.
|
||||
create lnk.make ("Admin", "admin")
|
||||
lnk.set_permission_arguments (<<"manage " + {CMS_ADMIN_MODULE}.name>>)
|
||||
a_menu_system.management_menu.extend (lnk)
|
||||
|
||||
end
|
||||
if a_response.api.user_is_authenticated then
|
||||
admin_lnk := a_menu_system.management_menu.new_composite_item ("Admin", "admin")
|
||||
|
||||
create lnk.make ("Module", "admin/modules")
|
||||
lnk.set_permission_arguments (<<"manage module">>)
|
||||
a_menu_system.management_menu.extend (lnk)
|
||||
admin_lnk.extend (lnk)
|
||||
|
||||
-- Per module cache permission!
|
||||
create lnk.make ("Cache", "admin/cache")
|
||||
a_menu_system.management_menu.extend (lnk)
|
||||
admin_lnk.extend (lnk)
|
||||
|
||||
-- Per module export permission!
|
||||
create lnk.make ("Export", "admin/export")
|
||||
a_menu_system.management_menu.extend (lnk)
|
||||
admin_lnk.extend (lnk)
|
||||
|
||||
-- if
|
||||
-- a_response.has_permission ("access " + {CMS_ADMIN_MODULE}.name) -- Note: admin user has all permissions enabled by default.
|
||||
-- then
|
||||
-- lnk := admin_lnk
|
||||
-- lnk.set_title ("Admin")
|
||||
|
||||
-- a_menu_system.management_menu.extend (lnk)
|
||||
-- elseif admin_lnk.has_children then
|
||||
-- a_menu_system.management_menu.extend (admin_lnk)
|
||||
-- end
|
||||
-- admin_lnk.set_permission_arguments (<<"access " + {CMS_ADMIN_MODULE}.name>>)
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
|
||||
@@ -17,22 +17,58 @@ feature -- Process
|
||||
process
|
||||
local
|
||||
b: STRING
|
||||
l_admin_links: ARRAYED_LIST [TUPLE [package: READABLE_STRING_8; permissions: ARRAY [READABLE_STRING_GENERAL]; link: CMS_LINK; help: READABLE_STRING_GENERAL]]
|
||||
lst: detachable ARRAYED_LIST [TUPLE [permissions: ARRAY [READABLE_STRING_GENERAL]; link: CMS_LINK; help: READABLE_STRING_GENERAL]]
|
||||
categories: STRING_TABLE [ARRAYED_LIST [TUPLE [permissions: ARRAY [READABLE_STRING_GENERAL]; link: CMS_LINK; help: READABLE_STRING_GENERAL]]]
|
||||
l_package: READABLE_STRING_8
|
||||
do
|
||||
create l_admin_links.make (5)
|
||||
l_admin_links.force (["core", <<"admin users">>, local_link ("Users", "admin/users"), "View/Edit/Add Users"])
|
||||
l_admin_links.force (["core", <<"admin roles">>, local_link ("Roles", "admin/roles"), "View/Edit/Add Roles"])
|
||||
l_admin_links.force (["core", <<"admin modules">>, local_link ("Modules", "admin/modules"), "(un)Install modules"])
|
||||
l_admin_links.force (["support", <<"admin cache">>, local_link ("Cache", "admin/cache"), "Clear caches"])
|
||||
l_admin_links.force (["support", <<"admin export">>, local_link ("Export", "admin/export"), "Export CMS contents, and modules contents."])
|
||||
create categories.make_caseless (3)
|
||||
across
|
||||
l_admin_links as ic
|
||||
loop
|
||||
l_package := ic.item.package
|
||||
lst := categories.item (l_package)
|
||||
if lst = Void then
|
||||
create lst.make (1)
|
||||
categories.force (lst, l_package)
|
||||
end
|
||||
lst.force ([ic.item.permissions, ic.item.link, ic.item.help])
|
||||
end
|
||||
|
||||
create b.make_empty
|
||||
set_title (translation ("Admin Page", Void))
|
||||
b.append ("<ul id=%"content-types%">")
|
||||
fixme ("Check how to make it configurable")
|
||||
if has_permissions (<< "admin users">>) then
|
||||
b.append ("<li>" + link ("Users", "admin/users", Void))
|
||||
b.append ("<div class=%"description%">View/Edit/Add Users</div>")
|
||||
across
|
||||
categories as cats_ic
|
||||
loop
|
||||
lst := cats_ic.item
|
||||
b.append ("<h3>")
|
||||
b.append (html_encoded (cats_ic.key))
|
||||
b.append ("</h3>")
|
||||
b.append ("<ul>")
|
||||
across
|
||||
lst as ic
|
||||
loop
|
||||
if has_permissions (ic.item.permissions) then
|
||||
b.append ("<li>")
|
||||
if attached ic.item.link as lnk then
|
||||
b.append (link (lnk.title, lnk.location, Void))
|
||||
end
|
||||
b.append ("<div class=%"description%">")
|
||||
b.append (html_encoded (ic.item.help))
|
||||
b.append ("</div>")
|
||||
b.append ("</li>")
|
||||
end
|
||||
if has_permissions (<< "admin roles">>) then
|
||||
b.append ("<li>" + link ("Roles", "admin/roles", Void))
|
||||
b.append ("<div class=%"description%">View/Edit/Add Roles</div>")
|
||||
b.append ("</li>")
|
||||
end
|
||||
b.append ("</ul>")
|
||||
end
|
||||
|
||||
set_main_content (b)
|
||||
end
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ inherit
|
||||
|
||||
CMS_HOOK_MENU_SYSTEM_ALTER
|
||||
|
||||
CMS_HOOK_BLOCK_HELPER
|
||||
|
||||
SHARED_LOGGER
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
@@ -68,9 +70,9 @@ feature -- Hooks
|
||||
l_destination: READABLE_STRING_8
|
||||
do
|
||||
if attached {WSF_STRING} a_response.request.query_parameter ("destination") as p_destination then
|
||||
l_destination := p_destination.url_encoded_value
|
||||
l_destination := p_destination.value
|
||||
else
|
||||
l_destination := percent_encoded (a_response.location)
|
||||
l_destination := a_response.location
|
||||
end
|
||||
if is_authenticating (a_response) then
|
||||
|
||||
@@ -86,23 +88,4 @@ feature -- Hooks
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Helpers
|
||||
|
||||
template_block (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE): detachable CMS_SMARTY_TEMPLATE_BLOCK
|
||||
-- Smarty content block for `a_block_id'
|
||||
local
|
||||
p: detachable PATH
|
||||
do
|
||||
create p.make_from_string ("templates")
|
||||
p := p.extended ("block_").appended (a_block_id).appended_with_extension ("tpl")
|
||||
p := a_response.api.module_theme_resource_location (Current, p)
|
||||
if p /= Void then
|
||||
if attached p.entry as e then
|
||||
create Result.make (a_block_id, Void, p.parent, e)
|
||||
else
|
||||
create Result.make (a_block_id, Void, p.parent, p)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -112,6 +112,7 @@ feature -- Basic Operations / Contact
|
||||
l_message.replace_substring_all ("$host", a_host)
|
||||
l_message.replace_substring_all ("$sitename", parameters.utf_8_site_name)
|
||||
l_message.replace_substring_all ("$user", a_user.utf_8_name)
|
||||
l_message.replace_substring_all ("$email", a_to)
|
||||
send_message (contact_email_address, a_to, parameters.contact_subject_register, l_message)
|
||||
end
|
||||
|
||||
@@ -126,6 +127,7 @@ feature -- Basic Operations / Contact
|
||||
l_message.replace_substring_all ("$host", a_host)
|
||||
l_message.replace_substring_all ("$sitename", parameters.utf_8_site_name)
|
||||
l_message.replace_substring_all ("$link", a_link)
|
||||
l_message.replace_substring_all ("$email", a_to)
|
||||
send_message (contact_email_address, a_to, parameters.contact_subject_activate, l_message)
|
||||
end
|
||||
|
||||
@@ -137,7 +139,7 @@ feature -- Basic Operations / Contact
|
||||
l_message: STRING
|
||||
do
|
||||
create l_message.make_from_string (parameters.account_activation_confirmation)
|
||||
l_message.replace_substring_all ("$hot", a_host)
|
||||
l_message.replace_substring_all ("$host", a_host)
|
||||
l_message.replace_substring_all ("$sitename", parameters.utf_8_site_name)
|
||||
l_message.replace_substring_all ("$user", a_user.utf_8_name)
|
||||
l_message.replace_substring_all ("$email", a_to)
|
||||
|
||||
@@ -130,13 +130,13 @@ feature -- Access
|
||||
account_re_activation: STRING
|
||||
-- Account re_activation template email message.
|
||||
do
|
||||
Result := template_string ("accunt_re_activation.html", default_template_account_re_activation)
|
||||
Result := template_string ("account_re_activation.html", default_template_account_re_activation)
|
||||
end
|
||||
|
||||
account_rejected: STRING
|
||||
-- Account rejected template email message.
|
||||
do
|
||||
Result := template_string ("accunt_rejected.html", default_template_account_rejected)
|
||||
Result := template_string ("account_rejected.html", default_template_account_rejected)
|
||||
end
|
||||
|
||||
account_password: STRING
|
||||
@@ -277,7 +277,7 @@ feature {NONE} -- Message email
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>You requested has been rejected, your application does not conform our rules <a href="$host">$sitename</a></p>
|
||||
<p>Your account application is rejected, it does not conform our rules <a href="$host">$sitename</a></p>
|
||||
</body>
|
||||
</html>
|
||||
]"
|
||||
@@ -316,7 +316,7 @@ feature {NONE} -- Message email
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>You have required a new password at <a href="$host">$sitename</a></p>
|
||||
<p>You have requested a new password at <a href="$host">$sitename</a></p>
|
||||
|
||||
<p>To complete your request, please click on this link to generate a new password:<p>
|
||||
|
||||
@@ -337,7 +337,7 @@ feature {NONE} -- Message email
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>Welcome to<a href="...">$sitename</a></p>
|
||||
<p>Welcome to <a href="$host">$sitename</a>.</p>
|
||||
<p>Thank you for joining us.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
note
|
||||
description: "Module Auth"
|
||||
date: "$Date: 2015-05-20 06:50:50 -0300 (mi. 20 de may. de 2015) $"
|
||||
revision: "$Revision: 97328 $"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_AUTHENTICATION_MODULE
|
||||
@@ -21,6 +21,8 @@ inherit
|
||||
|
||||
CMS_HOOK_BLOCK
|
||||
|
||||
CMS_HOOK_BLOCK_HELPER
|
||||
|
||||
CMS_HOOK_MENU_SYSTEM_ALTER
|
||||
|
||||
SHARED_EXECUTION_ENVIRONMENT
|
||||
@@ -79,6 +81,10 @@ feature -- Access: docs
|
||||
|
||||
feature -- Router
|
||||
|
||||
roc_login_location: STRING = "account/roc-login"
|
||||
|
||||
roc_logout_location: STRING = "account/roc-logout"
|
||||
|
||||
setup_router (a_router: WSF_ROUTER; a_api: CMS_API)
|
||||
-- <Precursor>
|
||||
do
|
||||
@@ -97,8 +103,8 @@ feature -- Router
|
||||
a_router.map (m, a_router.methods_head_get)
|
||||
|
||||
|
||||
a_router.handle ("/account/roc-login", create {WSF_URI_AGENT_HANDLER}.make (agent handle_login(a_api, ?, ?)), a_router.methods_head_get)
|
||||
a_router.handle ("/account/roc-logout", create {WSF_URI_AGENT_HANDLER}.make (agent handle_logout(a_api, ?, ?)), a_router.methods_head_get)
|
||||
a_router.handle ("/" + roc_login_location, create {WSF_URI_AGENT_HANDLER}.make (agent handle_login(a_api, ?, ?)), a_router.methods_head_get)
|
||||
a_router.handle ("/" + roc_logout_location, create {WSF_URI_AGENT_HANDLER}.make (agent handle_logout(a_api, ?, ?)), a_router.methods_head_get)
|
||||
a_router.handle ("/account/roc-register", create {WSF_URI_AGENT_HANDLER}.make (agent handle_register(a_api, ?, ?)), a_router.methods_get_post)
|
||||
a_router.handle ("/account/activate/{token}", create {WSF_URI_TEMPLATE_AGENT_HANDLER}.make (agent handle_activation(a_api, ?, ?)), a_router.methods_head_get)
|
||||
a_router.handle ("/account/reject/{token}", create {WSF_URI_TEMPLATE_AGENT_HANDLER}.make (agent handle_reject(a_api, ?, ?)), a_router.methods_head_get)
|
||||
@@ -128,8 +134,35 @@ feature -- Hooks configuration
|
||||
|
||||
value_table_alter (a_value: CMS_VALUE_TABLE; a_response: CMS_RESPONSE)
|
||||
-- <Precursor>
|
||||
local
|
||||
l_destination: detachable READABLE_STRING_GENERAL
|
||||
l_url: STRING
|
||||
l_url_name: READABLE_STRING_GENERAL
|
||||
do
|
||||
a_value.force (a_response.user, "user")
|
||||
if attached {WSF_STRING} a_response.request.query_parameter ("destination") as p_destination then
|
||||
l_destination := p_destination.value
|
||||
else
|
||||
l_destination := a_response.location
|
||||
end
|
||||
if l_destination.starts_with ("account/auth/") then
|
||||
l_destination := Void
|
||||
end
|
||||
|
||||
if attached a_response.user as u then
|
||||
a_value.force (u, "user")
|
||||
|
||||
l_url_name := "site_sign_out_url"
|
||||
l_url := a_response.url (roc_logout_location, Void)
|
||||
else
|
||||
a_value.force (Void, "user")
|
||||
|
||||
l_url_name := "site_sign_in_url"
|
||||
l_url := a_response.url (roc_login_location, Void)
|
||||
end
|
||||
if l_destination /= Void then
|
||||
l_url.append ("?destination=" + percent_encoded (l_destination))
|
||||
end
|
||||
a_value.force (l_url, l_url_name)
|
||||
end
|
||||
|
||||
menu_system_alter (a_menu_system: CMS_MENU_SYSTEM; a_response: CMS_RESPONSE)
|
||||
@@ -143,14 +176,14 @@ feature -- Hooks configuration
|
||||
lnk.set_weight (97)
|
||||
a_menu_system.primary_menu.extend (lnk)
|
||||
|
||||
create lnk.make ("Logout", "account/roc-logout")
|
||||
create lnk.make ("Logout", roc_logout_location)
|
||||
else
|
||||
create lnk.make ("Login", "account/roc-login")
|
||||
create lnk.make ("Login", roc_login_location)
|
||||
end
|
||||
lnk.set_weight (98)
|
||||
if
|
||||
a_response.location.starts_with_general ("account/auth/")
|
||||
or a_response.location.starts_with_general ("account/roc-log")
|
||||
or a_response.location.starts_with_general ("account/roc-log") -- in ou out
|
||||
then
|
||||
-- ignore destination
|
||||
else
|
||||
@@ -161,7 +194,7 @@ feature -- Hooks configuration
|
||||
-- Add the link to the taxonomy to the main menu
|
||||
if a_response.has_permission ("admin registration") then
|
||||
create lnk.make ("Registration", "admin/pending-registrations/")
|
||||
a_menu_system.management_menu.extend (lnk)
|
||||
a_menu_system.management_menu.extend_into (lnk, "Admin", "admin")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -177,7 +210,7 @@ feature -- Handler
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api)
|
||||
create b.make_empty
|
||||
l_user := r.user
|
||||
if attached template_block ("account_info", r) as l_tpl_block then
|
||||
if attached template_block (Current, "account_info", api) as l_tpl_block then
|
||||
l_tpl_block.set_weight (-10)
|
||||
r.add_block (l_tpl_block, "content")
|
||||
else
|
||||
@@ -199,7 +232,7 @@ feature -- Handler
|
||||
r.set_main_content (b)
|
||||
|
||||
if l_user = Void then
|
||||
r.set_redirection ("account/roc-login")
|
||||
r.set_redirection (roc_login_location)
|
||||
end
|
||||
r.execute
|
||||
end
|
||||
@@ -215,7 +248,7 @@ feature -- Handler
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api)
|
||||
create b.make_empty
|
||||
l_user := r.user
|
||||
if attached template_block ("account_edit", r) as l_tpl_block then
|
||||
if attached template_block (Current, "account_edit", api) as l_tpl_block then
|
||||
l_tpl_block.set_weight (-10)
|
||||
r.add_block (l_tpl_block, "content")
|
||||
else
|
||||
@@ -800,7 +833,7 @@ feature -- Handler
|
||||
|
||||
block_list: ITERABLE [like {CMS_BLOCK}.name]
|
||||
do
|
||||
Result := <<"register", "reactivate", "new_password", "reset_password", "registration">>
|
||||
Result := <<"register", "reactivate", "new_password", "reset_password">>
|
||||
end
|
||||
|
||||
get_block_view (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE)
|
||||
@@ -816,8 +849,6 @@ feature -- Handler
|
||||
get_block_view_new_password (a_block_id, a_response)
|
||||
elseif a_block_id.is_case_insensitive_equal_general ("reset_password") and then loc.starts_with ("account/reset-password") then
|
||||
get_block_view_reset_password (a_block_id, a_response)
|
||||
elseif a_block_id.is_case_insensitive_equal_general ("registration") and then loc.starts_with ("admin/pending-registrations") then
|
||||
get_block_view_registration (a_block_id, a_response)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -892,32 +923,24 @@ feature {NONE} -- Token Generation
|
||||
Result := l_token
|
||||
end
|
||||
|
||||
feature {NONE} -- Helpers
|
||||
|
||||
template_block (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE): detachable CMS_SMARTY_TEMPLATE_BLOCK
|
||||
-- Smarty content block for `a_block_id'
|
||||
local
|
||||
p: detachable PATH
|
||||
do
|
||||
create p.make_from_string ("templates")
|
||||
p := p.extended ("block_").appended (a_block_id).appended_with_extension ("tpl")
|
||||
p := a_response.api.module_theme_resource_location (Current, p)
|
||||
if p /= Void then
|
||||
if attached p.entry as e then
|
||||
create Result.make (a_block_id, Void, p.parent, e)
|
||||
else
|
||||
create Result.make (a_block_id, Void, p.parent, p)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Block views
|
||||
|
||||
get_block_view_register (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE)
|
||||
do
|
||||
if a_response.has_permission ("account register") then
|
||||
if a_response.request.is_get_request_method then
|
||||
if attached template_block (a_block_id, a_response) as l_tpl_block then
|
||||
if
|
||||
a_response.request.is_get_request_method
|
||||
or else (
|
||||
a_response.values.has ("error_name")
|
||||
or else a_response.values.has ("error_email")
|
||||
)
|
||||
then
|
||||
if attached template_block (Current, a_block_id, a_response.api) as l_tpl_block then
|
||||
-- l_tpl_block.set_value (a_response.values.item ("error_name"), "error_name")
|
||||
-- l_tpl_block.set_value (a_response.values.item ("error_email"), "error_email")
|
||||
-- l_tpl_block.set_value (a_response.values.item ("email"), "email")
|
||||
-- l_tpl_block.set_value (a_response.values.item ("name"), "name")
|
||||
l_tpl_block.set_value (form_registration_application_description (a_response.api), "application_description")
|
||||
if attached recaptcha_site_key (a_response.api) as l_recaptcha_site_key then
|
||||
l_tpl_block.set_value (l_recaptcha_site_key, "recaptcha_site_key")
|
||||
end
|
||||
@@ -928,30 +951,13 @@ feature {NONE} -- Block views
|
||||
end
|
||||
end
|
||||
elseif a_response.request.is_post_request_method then
|
||||
if a_response.values.has ("error_name") or else a_response.values.has ("error_email") then
|
||||
if attached template_block (a_block_id, a_response) as l_tpl_block then
|
||||
-- l_tpl_block.set_value (a_response.values.item ("error_name"), "error_name")
|
||||
-- l_tpl_block.set_value (a_response.values.item ("error_email"), "error_email")
|
||||
-- l_tpl_block.set_value (a_response.values.item ("email"), "email")
|
||||
-- l_tpl_block.set_value (a_response.values.item ("name"), "name")
|
||||
if attached recaptcha_site_key (a_response.api) as l_recaptcha_site_key then
|
||||
l_tpl_block.set_value (l_recaptcha_site_key, "recaptcha_site_key")
|
||||
end
|
||||
if attached template_block (Current, "post_register", a_response.api) as l_tpl_block then
|
||||
a_response.add_block (l_tpl_block, "content")
|
||||
else
|
||||
debug ("cms")
|
||||
a_response.add_warning_message ("Error with block [" + a_block_id + "]")
|
||||
end
|
||||
end
|
||||
else
|
||||
if attached template_block ("post_register", a_response) as l_tpl_block then
|
||||
a_response.add_block (l_tpl_block, "content")
|
||||
else
|
||||
debug ("cms")
|
||||
a_response.add_warning_message ("Error with block [" + a_block_id + "]")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -959,7 +965,7 @@ feature {NONE} -- Block views
|
||||
get_block_view_reactivate (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE)
|
||||
do
|
||||
if a_response.request.is_get_request_method then
|
||||
if attached template_block (a_block_id, a_response) as l_tpl_block then
|
||||
if attached template_block (Current, a_block_id, a_response.api) as l_tpl_block then
|
||||
a_response.add_block (l_tpl_block, "content")
|
||||
else
|
||||
debug ("cms")
|
||||
@@ -968,7 +974,7 @@ feature {NONE} -- Block views
|
||||
end
|
||||
elseif a_response.request.is_post_request_method then
|
||||
if a_response.values.has ("error_email") or else a_response.values.has ("is_active") then
|
||||
if attached template_block (a_block_id, a_response) as l_tpl_block then
|
||||
if attached template_block (Current, a_block_id, a_response.api) as l_tpl_block then
|
||||
-- l_tpl_block.set_value (a_response.values.item ("error_email"), "error_email")
|
||||
-- l_tpl_block.set_value (a_response.values.item ("email"), "email")
|
||||
-- l_tpl_block.set_value (a_response.values.item ("is_active"), "is_active")
|
||||
@@ -979,7 +985,7 @@ feature {NONE} -- Block views
|
||||
end
|
||||
end
|
||||
else
|
||||
if attached template_block ("post_reactivate", a_response) as l_tpl_block then
|
||||
if attached template_block (Current, "post_reactivate", a_response.api) as l_tpl_block then
|
||||
a_response.add_block (l_tpl_block, "content")
|
||||
else
|
||||
debug ("cms")
|
||||
@@ -993,7 +999,7 @@ feature {NONE} -- Block views
|
||||
get_block_view_new_password (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE)
|
||||
do
|
||||
if a_response.request.is_get_request_method then
|
||||
if attached template_block (a_block_id, a_response) as l_tpl_block then
|
||||
if attached template_block (Current, a_block_id, a_response.api) as l_tpl_block then
|
||||
a_response.add_block (l_tpl_block, "content")
|
||||
else
|
||||
debug ("cms")
|
||||
@@ -1002,7 +1008,7 @@ feature {NONE} -- Block views
|
||||
end
|
||||
elseif a_response.request.is_post_request_method then
|
||||
if a_response.values.has ("error_email") or else a_response.values.has ("error_username") then
|
||||
if attached template_block (a_block_id, a_response) as l_tpl_block then
|
||||
if attached template_block (Current, a_block_id, a_response.api) as l_tpl_block then
|
||||
-- l_tpl_block.set_value (a_response.values.item ("error_email"), "error_email")
|
||||
-- l_tpl_block.set_value (a_response.values.item ("email"), "email")
|
||||
-- l_tpl_block.set_value (a_response.values.item ("error_username"), "error_username")
|
||||
@@ -1014,7 +1020,7 @@ feature {NONE} -- Block views
|
||||
end
|
||||
end
|
||||
else
|
||||
if attached template_block ("post_password", a_response) as l_tpl_block then
|
||||
if attached template_block (Current, "post_password", a_response.api) as l_tpl_block then
|
||||
a_response.add_block (l_tpl_block, "content")
|
||||
else
|
||||
debug ("cms")
|
||||
@@ -1028,7 +1034,7 @@ feature {NONE} -- Block views
|
||||
get_block_view_reset_password (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE)
|
||||
do
|
||||
if a_response.request.is_get_request_method then
|
||||
if attached template_block (a_block_id, a_response) as l_tpl_block then
|
||||
if attached template_block (Current, a_block_id, a_response.api) as l_tpl_block then
|
||||
-- l_tpl_block.set_value (a_response.values.item ("token"), "token")
|
||||
-- l_tpl_block.set_value (a_response.values.item ("error_token"), "error_token")
|
||||
a_response.add_block (l_tpl_block, "content")
|
||||
@@ -1039,7 +1045,7 @@ feature {NONE} -- Block views
|
||||
end
|
||||
elseif a_response.request.is_post_request_method then
|
||||
if a_response.values.has ("error_token") or else a_response.values.has ("error_password") then
|
||||
if attached template_block (a_block_id, a_response) as l_tpl_block then
|
||||
if attached template_block (Current, a_block_id, a_response.api) as l_tpl_block then
|
||||
-- l_tpl_block.set_value (a_response.values.item ("error_token"), "error_token")
|
||||
-- l_tpl_block.set_value (a_response.values.item ("error_password"), "error_password")
|
||||
-- l_tpl_block.set_value (a_response.values.item ("token"), "token")
|
||||
@@ -1050,7 +1056,7 @@ feature {NONE} -- Block views
|
||||
end
|
||||
end
|
||||
else
|
||||
if attached template_block ("post_reset", a_response) as l_tpl_block then
|
||||
if attached template_block (Current, "post_reset", a_response.api) as l_tpl_block then
|
||||
a_response.add_block (l_tpl_block, "content")
|
||||
else
|
||||
debug ("cms")
|
||||
@@ -1061,11 +1067,19 @@ feature {NONE} -- Block views
|
||||
end
|
||||
end
|
||||
|
||||
get_block_view_registration (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE)
|
||||
do
|
||||
end
|
||||
feature -- Access: configuration
|
||||
|
||||
feature -- Recaptcha
|
||||
form_registration_application_description (api: CMS_API): detachable READABLE_STRING_8
|
||||
-- Get recaptcha security key.
|
||||
local
|
||||
utf: UTF_CONVERTER
|
||||
do
|
||||
if attached api.module_configuration (Current, Void) as cfg then
|
||||
if attached cfg.text_item ("forms.registration.application_description") as l_desc and then not l_desc.is_whitespace then
|
||||
Result := utf.utf_32_string_to_utf_8_string_8 (l_desc)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
recaptcha_secret_key (api: CMS_API): detachable READABLE_STRING_8
|
||||
-- Get recaptcha security key.
|
||||
@@ -1098,6 +1112,7 @@ feature -- Response Alter
|
||||
a_response.add_javascript_url ("https://www.google.com/recaptcha/api.js")
|
||||
a_response.add_style (a_response.url ("/module/" + name + "/files/css/auth.css", Void), Void)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
is_captcha_verified (a_secret, a_response: READABLE_STRING_8): BOOLEAN
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"email": "webmaster@example.com",
|
||||
"subjet_register": "Thank you for regitering with us, activate account",
|
||||
"subjet_activate": "New account ativation token",
|
||||
"subjet_password": "Password Recovery!!!",
|
||||
"subjet_oauth": "Welcome",
|
||||
"smtp": "127.0.0.1"
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
{
|
||||
"subject": "Thank you for contacting us",
|
||||
"forms": {
|
||||
"registration": {
|
||||
"application_description": "Present yourself in a few lines, otherwise your application is likely to be rejected."
|
||||
}
|
||||
},
|
||||
"recaptcha": {
|
||||
"site_key":"6Lex9RMTAAAAAKleC4x6TaRlFcpLbEWgH_U7MSiD",
|
||||
"secret_key":"6Lex9RMTAAAAAAkBczvX5DUiyg_xoM_EthVVgRRx"
|
||||
|
||||
@@ -21,6 +21,6 @@
|
||||
|
||||
<p>To reject the registration, please click on the following link <p>
|
||||
|
||||
<p><a href="$rejection_url<">$rejection_url</a></p>
|
||||
<p><a href="$rejection_url">$rejection_url</a></p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -17,22 +17,21 @@
|
||||
<input type="email" id="email" name="email" value="{$email/}" required/>
|
||||
<label for="email">Email</label>
|
||||
{if isset="$error_email"}
|
||||
<span><i>{$error_email/}</i></span> <br>
|
||||
<span><i>{$error_email/}</i></span> <br/>
|
||||
{/if}
|
||||
</div>
|
||||
<div>
|
||||
<textarea rows="4" cols="50" name="personal_information" id="personal_information" required>
|
||||
{$personal_information/}
|
||||
</textarea>
|
||||
<textarea rows="4" cols="50" name="personal_information" id="personal_information" required>{$personal_information/}</textarea>
|
||||
<label for="personal_information">Tell us why you want to register an account</label>
|
||||
{if isset="$error_application"}
|
||||
<span><i>{$error_application/}</i></span> <br>
|
||||
<span><i>{$error_application/}</i></span><br/>
|
||||
{/if}
|
||||
{if isset="$application_description"}
|
||||
<br/>
|
||||
<p class="description">{$application_description/}</p>
|
||||
{/if}
|
||||
</div>
|
||||
{unless isempty="$recaptcha_site_key"}
|
||||
<div class="g-recaptcha" data-sitekey="{$recaptcha_site_key/}"></div>
|
||||
<br/>
|
||||
{/unless}
|
||||
{unless isempty="$recaptcha_site_key"}<div class="g-recaptcha" data-sitekey="{$recaptcha_site_key/}"></div><br/>{/unless}
|
||||
<button type="submit">Register</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@@ -118,7 +118,7 @@ feature {NONE} -- Implementation: routes
|
||||
r.add_error_message ("You are already signed in!")
|
||||
r.set_main_content (r.link ("Logout", "account/roc-logout", Void))
|
||||
else
|
||||
if attached template_block ("login", r) as l_tpl_block then
|
||||
if attached template_block (Current, "login", api) as l_tpl_block then
|
||||
r.add_javascript_url (r.url ("module/" + name + "/files/js/roc_basic_auth.js", Void))
|
||||
|
||||
create vals.make (1)
|
||||
@@ -170,7 +170,7 @@ feature {NONE} -- Block views
|
||||
local
|
||||
vals: CMS_VALUE_TABLE
|
||||
do
|
||||
if attached template_block (a_block_id, a_response) as l_tpl_block then
|
||||
if attached template_block (Current, a_block_id, a_response.api) as l_tpl_block then
|
||||
create vals.make (1)
|
||||
-- add the variable to the block
|
||||
a_response.api.hooks.invoke_value_table_alter (vals, a_response)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{unless isset="$user"}
|
||||
<div class="login-box">
|
||||
<div class="description">The "Basic Auth" relies on the HTTP basic acces authentication.<br/>(see also: <a href="https://en.wikipedia.org/wiki/Basic_access_authentication">https://en.wikipedia.org/wiki/Basic_access_authentication</a> )</div>
|
||||
<div class="description">The "Basic Auth" relies on the HTTP basic access authentication.<br/>(see also: <a href="https://en.wikipedia.org/wiki/Basic_access_authentication">https://en.wikipedia.org/wiki/Basic_access_authentication</a> )</div>
|
||||
<h3>Login or <a href="{$site_url/}account/roc-register">Register</a></h3>
|
||||
<div>
|
||||
<form name="cms_basic_auth" action="{$site_url/}roc-basic-login" method="POST">
|
||||
|
||||
@@ -181,7 +181,7 @@ feature -- Hooks
|
||||
if a_block_id.is_case_insensitive_equal_general ("contact") then
|
||||
-- "contact", "post_contact"
|
||||
if a_response.request.is_get_request_method then
|
||||
if attached template_block (Current, a_block_id, a_response) as l_tpl_block then
|
||||
if attached template_block (Current, a_block_id, a_response.api) as l_tpl_block then
|
||||
if attached recaptcha_site_key (a_response.api) as l_recaptcha_site_key then
|
||||
l_tpl_block.set_value (l_recaptcha_site_key, "recaptcha_site_key")
|
||||
end
|
||||
@@ -201,7 +201,7 @@ feature -- Hooks
|
||||
f: CMS_FORM
|
||||
do
|
||||
a_response.add_style (a_response.url ("/module/" + name + "/files/css/contact.css", Void), Void)
|
||||
if attached template_block (Current, "contact", a_response) as l_tpl_block then
|
||||
if attached template_block (Current, "contact", api) as l_tpl_block then
|
||||
if attached recaptcha_site_key (api) as l_recaptcha_site_key then
|
||||
l_tpl_block.set_value (l_recaptcha_site_key, "recaptcha_site_key")
|
||||
end
|
||||
@@ -339,7 +339,7 @@ feature -- Hooks
|
||||
r.values.force (True, "has_error")
|
||||
vars.put ("True", "has_error")
|
||||
end
|
||||
if attached template_block_with_values (Current, "post_contact", r, vars) as l_tpl_block then
|
||||
if attached template_block_with_values (Current, "post_contact", api, vars) as l_tpl_block then
|
||||
across
|
||||
r.values as tb
|
||||
loop
|
||||
@@ -354,7 +354,7 @@ feature -- Hooks
|
||||
-- send a bad request status code and redisplay the form with the previous data loaded.
|
||||
r.set_value (False, "error")
|
||||
r.set_status_code ({HTTP_STATUS_CODE}.bad_request)
|
||||
if attached template_block_with_values (Current, "contact", r, vars) as l_tpl_block then
|
||||
if attached template_block_with_values (Current, "contact", api, vars) as l_tpl_block then
|
||||
across
|
||||
r.values as tb
|
||||
loop
|
||||
@@ -377,7 +377,7 @@ feature -- Hooks
|
||||
write_error_log (generator + ".handle_post_contact: Internal Server error")
|
||||
r.values.force (True, "has_error")
|
||||
r.set_status_code ({HTTP_CONSTANTS}.internal_server_error)
|
||||
if attached template_block_with_values (Current, "post_contact", r, vars) as l_tpl_block then
|
||||
if attached template_block_with_values (Current, "post_contact", api, vars) as l_tpl_block then
|
||||
across
|
||||
r.values as tb
|
||||
loop
|
||||
@@ -422,18 +422,6 @@ feature {NONE} -- Helpers
|
||||
|
||||
feature {NONE} -- Contact Message
|
||||
|
||||
template_block_with_values (a_module: CMS_MODULE; a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE; a_values: STRING_TABLE [ANY]): like template_block
|
||||
do
|
||||
Result := template_block (a_module, a_block_id, a_response)
|
||||
if Result /= Void then
|
||||
across
|
||||
a_values as ic
|
||||
loop
|
||||
Result.set_value (ic.item, ic.key)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
email_html_message (a_message_id: READABLE_STRING_8; a_response: CMS_RESPONSE; a_html_encoded_values: STRING_TABLE [READABLE_STRING_8]): STRING
|
||||
-- html message related to `a_message_id'.
|
||||
local
|
||||
|
||||
@@ -346,9 +346,11 @@ feature -- Hook
|
||||
-- Hook execution on collection of menu contained by `a_menu_system'
|
||||
-- for related response `a_response'.
|
||||
do
|
||||
if a_response.is_authenticated then
|
||||
a_menu_system.navigation_menu.extend (create {CMS_LOCAL_LINK}.make ("Feeds", "feed_aggregation/"))
|
||||
if a_response.has_permission (permission__manage_feed_aggregator) then
|
||||
a_menu_system.management_menu.extend (create {CMS_LOCAL_LINK}.make ("Feeds (admin)", "admin/feed_aggregator/"))
|
||||
a_menu_system.management_menu.extend_into (create {CMS_LOCAL_LINK}.make ("Feeds (admin)", "admin/feed_aggregator/"), "Admin", "admin")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
69
modules/files/cms_file.e
Normal file
69
modules/files/cms_file.e
Normal file
@@ -0,0 +1,69 @@
|
||||
note
|
||||
description: "Interface representing any files under `{CMS_API}.files_location' ."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_FILE
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initializaion
|
||||
|
||||
make (a_relative_path: PATH; a_api: CMS_API)
|
||||
do
|
||||
cms_api := a_api
|
||||
relative_path := a_relative_path
|
||||
end
|
||||
|
||||
cms_api: CMS_API
|
||||
|
||||
feature -- Access
|
||||
|
||||
filename: STRING_32
|
||||
-- File name of Current file.
|
||||
local
|
||||
p: PATH
|
||||
do
|
||||
p := relative_path
|
||||
if attached p.entry as e then
|
||||
Result := e.name
|
||||
else
|
||||
Result := p.name
|
||||
end
|
||||
end
|
||||
|
||||
relative_path: PATH
|
||||
-- Path relative the `CMS_API.files_location'.
|
||||
|
||||
owner: detachable CMS_USER
|
||||
-- Optional owner.
|
||||
|
||||
feature -- Status report
|
||||
|
||||
is_directory: BOOLEAN
|
||||
local
|
||||
d: DIRECTORY
|
||||
do
|
||||
create d.make_with_path (cms_api.files_location.extended_path (relative_path))
|
||||
Result := d.exists
|
||||
end
|
||||
|
||||
is_file: BOOLEAN
|
||||
local
|
||||
f: RAW_FILE
|
||||
do
|
||||
create f.make_with_path (cms_api.files_location.extended_path (relative_path))
|
||||
Result := f.exists
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_owner (u: detachable CMS_USER)
|
||||
-- Set `owner' to `u'.
|
||||
do
|
||||
owner := u
|
||||
end
|
||||
|
||||
end
|
||||
57
modules/files/cms_file_metadata.e
Normal file
57
modules/files/cms_file_metadata.e
Normal file
@@ -0,0 +1,57 @@
|
||||
note
|
||||
description: "Metadata associated to a CMS_FILE."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_FILE_METADATA
|
||||
|
||||
create
|
||||
make,
|
||||
make_empty
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_empty
|
||||
do
|
||||
create date.make_now_utc
|
||||
end
|
||||
|
||||
make (f: CMS_FILE)
|
||||
do
|
||||
make_empty
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
user: detachable CMS_USER
|
||||
|
||||
date: detachable DATE_TIME
|
||||
|
||||
size: INTEGER
|
||||
|
||||
file_type: detachable READABLE_STRING_8
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_user (u: detachable CMS_USER)
|
||||
do
|
||||
user := u
|
||||
end
|
||||
|
||||
set_date (dt: detachable DATE_TIME)
|
||||
do
|
||||
date := dt
|
||||
end
|
||||
|
||||
set_size (a_size: INTEGER)
|
||||
do
|
||||
size := a_size
|
||||
end
|
||||
|
||||
set_file_type (a_type: detachable READABLE_STRING_8)
|
||||
do
|
||||
file_type := a_type
|
||||
end
|
||||
|
||||
end
|
||||
272
modules/files/cms_files_api.e
Normal file
272
modules/files/cms_files_api.e
Normal file
@@ -0,0 +1,272 @@
|
||||
note
|
||||
description: "API to manage files."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_FILES_API
|
||||
|
||||
inherit
|
||||
CMS_MODULE_API
|
||||
|
||||
REFACTORING_HELPER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Access : path
|
||||
|
||||
uploads_relative_path: PATH
|
||||
-- Path relative to `{CMS_API}.files_location'.
|
||||
do
|
||||
create Result.make_from_string (uploads_directory_name)
|
||||
end
|
||||
|
||||
uploads_directory: PATH
|
||||
do
|
||||
Result := cms_api.files_location.extended (uploads_directory_name)
|
||||
end
|
||||
|
||||
uploaded_file_path (f: READABLE_STRING_GENERAL): PATH
|
||||
do
|
||||
Result := uploads_directory.extended (f)
|
||||
end
|
||||
|
||||
thumbnail_directory: PATH
|
||||
do
|
||||
Result := uploads_directory.extended (thumbnail_directory_name)
|
||||
end
|
||||
|
||||
feature {CMS_FILES_MODULE} -- Access : metadata path
|
||||
|
||||
metadata_path (f: READABLE_STRING_GENERAL): PATH
|
||||
do
|
||||
Result := metadata_directory.extended (f).appended_with_extension ("cms-metadata")
|
||||
end
|
||||
|
||||
metadata_directory: PATH
|
||||
do
|
||||
Result := uploads_directory.extended (metadata_directory_name)
|
||||
end
|
||||
|
||||
feature -- Access : links
|
||||
|
||||
file_link (f: CMS_FILE): CMS_LOCAL_LINK
|
||||
local
|
||||
s: STRING
|
||||
do
|
||||
s := "files"
|
||||
across
|
||||
f.relative_path.components as ic
|
||||
loop
|
||||
s.append_character ('/')
|
||||
s.append (percent_encoded (ic.item.name))
|
||||
end
|
||||
create Result.make (f.filename, s)
|
||||
end
|
||||
|
||||
feature {NONE} -- Constants
|
||||
|
||||
uploads_directory_name: STRING = "uploads"
|
||||
|
||||
metadata_directory_name: STRING = ".metadata"
|
||||
|
||||
thumbnail_directory_name: STRING = ".thumbnails"
|
||||
|
||||
feature -- Factory
|
||||
|
||||
new_file (a_relative_path: PATH): CMS_FILE
|
||||
-- New CMS_FILE for path `a_relative_path' relative to `files' directory.
|
||||
do
|
||||
create Result.make (a_relative_path, cms_api)
|
||||
end
|
||||
|
||||
new_uploads_file (p: PATH): CMS_FILE
|
||||
-- New uploaded path from `p' relative to `uploads_directory'.
|
||||
do
|
||||
create Result.make (uploads_relative_path.extended_path (p), cms_api)
|
||||
end
|
||||
|
||||
feature -- Storage
|
||||
|
||||
delete_file (fn: READABLE_STRING_GENERAL)
|
||||
-- Delete file at `fn'.
|
||||
local
|
||||
p: PATH
|
||||
do
|
||||
error_handler.reset
|
||||
p := uploaded_file_path (fn)
|
||||
safe_delete (p)
|
||||
if not has_error then
|
||||
p := metadata_path (fn)
|
||||
safe_delete (p)
|
||||
end
|
||||
end
|
||||
|
||||
save_uploaded_file (uf: CMS_UPLOADED_FILE)
|
||||
local
|
||||
p: PATH
|
||||
ut: FILE_UTILITIES
|
||||
stored: BOOLEAN
|
||||
original_name: STRING_32
|
||||
n: INTEGER_32
|
||||
finished: BOOLEAN
|
||||
do
|
||||
reset_error
|
||||
create original_name.make_from_string (uf.filename)
|
||||
|
||||
p := uf.location
|
||||
if not p.is_absolute then
|
||||
p := uploads_directory.extended_path (p)
|
||||
end
|
||||
|
||||
if ut.file_path_exists (p) then
|
||||
|
||||
from
|
||||
n := 1
|
||||
until
|
||||
finished
|
||||
loop
|
||||
if ut.file_path_exists (p) then
|
||||
uf.set_new_location_with_number (n)
|
||||
p := uf.location
|
||||
if p.is_absolute then
|
||||
else
|
||||
p := uploads_directory.extended_path (p)
|
||||
end
|
||||
n := n + 1
|
||||
else
|
||||
finished := True
|
||||
end
|
||||
end
|
||||
stored := uf.move_to (p)
|
||||
else
|
||||
-- move file to path
|
||||
stored := uf.move_to (p)
|
||||
end
|
||||
|
||||
if stored then
|
||||
save_metadata_from_uploaded_file (uf, cms_api.user)
|
||||
else
|
||||
error_handler.add_custom_error (-1, "uploaded file storage failed", "Issue occurred when saving uploaded file!")
|
||||
end
|
||||
end
|
||||
|
||||
save_metadata_from_uploaded_file (a_uploaded_file: CMS_UPLOADED_FILE; u: detachable CMS_USER)
|
||||
local
|
||||
f: detachable RAW_FILE
|
||||
h_date: HTTP_DATE
|
||||
retried: BOOLEAN
|
||||
do
|
||||
if retried then
|
||||
-- FIXME: Report error?
|
||||
if f /= Void and then not f.is_closed then
|
||||
f.close
|
||||
end
|
||||
else
|
||||
-- create a file for metadata
|
||||
create f.make_with_path (metadata_path (a_uploaded_file.filename))
|
||||
|
||||
if f.exists then
|
||||
f.open_write
|
||||
else
|
||||
f.create_read_write
|
||||
end
|
||||
-- insert username
|
||||
if u /= Void then
|
||||
f.put_string (u.id.out)
|
||||
f.put_new_line
|
||||
-- f.put_string (utf.utf_32_string_to_utf_8_string_8 (u.name))
|
||||
-- f.put_new_line
|
||||
else
|
||||
f.put_new_line
|
||||
f.put_new_line
|
||||
end
|
||||
-- insert uploaded_time
|
||||
create h_date.make_now_utc
|
||||
f.put_string (h_date.timestamp.out)
|
||||
f.put_new_line
|
||||
|
||||
-- insert size of file
|
||||
f.put_string (a_uploaded_file.size.out)
|
||||
f.put_new_line
|
||||
|
||||
-- insert file type
|
||||
if attached a_uploaded_file.type as type then
|
||||
f.put_string (type.out)
|
||||
f.put_new_line
|
||||
end
|
||||
|
||||
f.close
|
||||
end
|
||||
rescue
|
||||
retried := True
|
||||
retry
|
||||
end
|
||||
|
||||
metadata (a_cms_file: CMS_FILE): detachable CMS_FILE_METADATA
|
||||
local
|
||||
f: RAW_FILE
|
||||
s: READABLE_STRING_8
|
||||
do
|
||||
if attached metadata_path (a_cms_file.filename) as p then
|
||||
create f.make_with_path (p)
|
||||
if f.exists and then f.is_access_readable then
|
||||
create Result.make_empty
|
||||
|
||||
f.open_read
|
||||
|
||||
f.read_line
|
||||
s := f.last_string
|
||||
if s.is_integer_64 then
|
||||
Result.set_user (cms_api.user_api.user_by_id (s.to_integer_64))
|
||||
else
|
||||
Result.set_user (cms_api.user_api.user_by_name (s))
|
||||
end
|
||||
|
||||
f.read_line
|
||||
s := f.last_string
|
||||
if s.is_integer_64 then
|
||||
Result.set_date ((create {HTTP_DATE}.make_from_timestamp (s.to_integer_64)).date_time)
|
||||
end
|
||||
|
||||
f.read_line
|
||||
s := f.last_string
|
||||
if s.is_integer_32 then
|
||||
Result.set_size (s.to_integer_32)
|
||||
else
|
||||
Result.set_size (-1)
|
||||
end
|
||||
|
||||
if not f.end_of_file then
|
||||
f.read_line
|
||||
Result.set_file_type (f.last_string)
|
||||
end
|
||||
f.close
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
safe_delete (p: PATH)
|
||||
-- Safe remove file at path `p'.
|
||||
local
|
||||
f: RAW_FILE
|
||||
retried: BOOLEAN
|
||||
do
|
||||
if retried then
|
||||
error_handler.add_custom_error (-1, "Can not delete file", {STRING_32} "Can not delete file %"" + p.name + "%"")
|
||||
else
|
||||
create f.make_with_path (p)
|
||||
if f.exists then
|
||||
f.delete
|
||||
else
|
||||
-- Not considered as failure.
|
||||
end
|
||||
end
|
||||
rescue
|
||||
retried := True
|
||||
retry
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
504
modules/files/cms_files_module.e
Normal file
504
modules/files/cms_files_module.e
Normal file
@@ -0,0 +1,504 @@
|
||||
note
|
||||
description: "files module."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_FILES_MODULE
|
||||
|
||||
inherit
|
||||
CMS_MODULE
|
||||
rename
|
||||
module_api as files_api
|
||||
redefine
|
||||
install,
|
||||
initialize,
|
||||
setup_hooks,
|
||||
permissions,
|
||||
files_api
|
||||
end
|
||||
|
||||
CMS_HOOK_MENU_SYSTEM_ALTER
|
||||
|
||||
SHARED_EXECUTION_ENVIRONMENT
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
name := "files"
|
||||
version := "1.0"
|
||||
description := "Service to upload files, and manage them."
|
||||
package := "file"
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING
|
||||
|
||||
permissions: LIST [READABLE_STRING_8]
|
||||
-- List of permission ids, used by this module, and declared.
|
||||
do
|
||||
Result := Precursor
|
||||
Result.force (admin_files_permission)
|
||||
Result.force (upload_files_permission)
|
||||
Result.force (browse_files_permission)
|
||||
end
|
||||
|
||||
admin_files_permission: STRING = "admin files"
|
||||
upload_files_permission: STRING = "upload files"
|
||||
browse_files_permission: STRING = "browse files"
|
||||
|
||||
feature {CMS_API} -- Module Initialization
|
||||
|
||||
initialize (api: CMS_API)
|
||||
-- <Precursor>
|
||||
do
|
||||
Precursor (api)
|
||||
if files_api = Void then
|
||||
create files_api.make (api)
|
||||
end
|
||||
end
|
||||
|
||||
feature {CMS_API}-- Module management
|
||||
|
||||
install (api: CMS_API)
|
||||
-- install the module
|
||||
local
|
||||
l_files_api: like files_api
|
||||
d: DIRECTORY
|
||||
do
|
||||
create l_files_api.make (api)
|
||||
create d.make_with_path (l_files_api.uploads_directory)
|
||||
if not d.exists then
|
||||
d.recursive_create_dir
|
||||
end
|
||||
create d.make_with_path (l_files_api.metadata_directory)
|
||||
if not d.exists then
|
||||
d.recursive_create_dir
|
||||
end
|
||||
|
||||
files_api := l_files_api
|
||||
Precursor (api)
|
||||
end
|
||||
|
||||
feature {CMS_API} -- Access: API
|
||||
|
||||
files_api: detachable CMS_FILES_API
|
||||
-- <Precursor>
|
||||
|
||||
feature -- Access: router
|
||||
|
||||
setup_router (a_router: WSF_ROUTER; a_api: CMS_API)
|
||||
-- <Precursor>
|
||||
do
|
||||
map_uri_template_agent (a_router, "/" + uploads_location, agent execute_upload (?, ?, a_api), Void) -- Accepts any method GET, HEAD, POST, PUT, DELETE, ...
|
||||
map_uri_template_agent (a_router, "/" + uploads_location + "{filename}", agent display_uploaded_file_info (?, ?, a_api), a_router.methods_get)
|
||||
map_uri_template_agent (a_router, "/" + uploads_location + "remove/{filename}", agent remove_file (?, ?, a_api), a_router.methods_get)
|
||||
end
|
||||
|
||||
uploads_location: STRING = "upload/"
|
||||
|
||||
feature -- Hooks
|
||||
|
||||
setup_hooks (a_hooks: CMS_HOOK_CORE_MANAGER)
|
||||
do
|
||||
a_hooks.subscribe_to_menu_system_alter_hook (Current)
|
||||
end
|
||||
|
||||
menu_system_alter (a_menu_system: CMS_MENU_SYSTEM; a_response: CMS_RESPONSE)
|
||||
local
|
||||
link: CMS_LOCAL_LINK
|
||||
do
|
||||
-- login in demo did somehow not work
|
||||
if a_response.has_permission (upload_files_permission) then
|
||||
create link.make ("Upload files", uploads_location)
|
||||
a_menu_system.navigation_menu.extend (link)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Handler
|
||||
|
||||
execute_not_found_handler (uri: READABLE_STRING_8; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- `uri' is not found, redirect to default page
|
||||
do
|
||||
res.redirect_now_with_content (req.script_url ("/"), uri + ": not found. %N Redirection to" + req.script_url ("/"), "text/html")
|
||||
end
|
||||
|
||||
display_uploaded_file_info (req: WSF_REQUEST; res: WSF_RESPONSE; api: CMS_API)
|
||||
-- Display information related to a cms uploaded file.
|
||||
local
|
||||
body: STRING_8
|
||||
r: CMS_RESPONSE
|
||||
f: CMS_FILE
|
||||
md: detachable CMS_FILE_METADATA
|
||||
fn: READABLE_STRING_32
|
||||
do
|
||||
check req.is_get_request_method end
|
||||
if not api.has_permission (browse_files_permission) then
|
||||
create {FORBIDDEN_ERROR_CMS_RESPONSE} r.make (req, res, api)
|
||||
r.add_error_message ("You are not allowed to browse CMS files!")
|
||||
elseif attached {WSF_STRING} req.path_parameter ("filename") as p_filename then
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api)
|
||||
|
||||
-- add style
|
||||
r.add_style (r.url ("/module/" + name + "/files/css/files.css", Void), Void)
|
||||
|
||||
create body.make_empty
|
||||
|
||||
fn := p_filename.value
|
||||
r.set_page_title ({STRING_32} "File %"" + fn + {STRING_32} "%"")
|
||||
body.append ("<div class=%"uploaded-files%">%N") -- To ease css customization.
|
||||
if attached files_api as l_files_api then
|
||||
f := l_files_api.new_uploads_file (create {PATH}.make_from_string (fn))
|
||||
|
||||
body.append ("<div class=%"metadata%">")
|
||||
|
||||
md := l_files_api.metadata (f)
|
||||
|
||||
--| Uploader user
|
||||
body.append ("<strong>User: </strong>")
|
||||
if md /= Void and then attached md.user as meta_user then
|
||||
body.append (api.html_encoded (meta_user.name))
|
||||
else
|
||||
body.append ("unknown user")
|
||||
end
|
||||
body.append ("<br/>%N")
|
||||
|
||||
--| Uploaded date
|
||||
body.append ("<strong>Upload Time: </strong>")
|
||||
if md /= Void and then attached md.date as meta_time then
|
||||
body.append (meta_time.out)
|
||||
else
|
||||
body.append ("NA")
|
||||
end
|
||||
body.append ("<br/>%N")
|
||||
|
||||
--| File size
|
||||
body.append ("<strong> File Size: </strong>")
|
||||
if md /= Void and then md.size > 0 then
|
||||
body.append (file_size_human_string (md.size))
|
||||
else
|
||||
body.append ("NA")
|
||||
end
|
||||
body.append ("<br/>%N")
|
||||
|
||||
--| File type
|
||||
body.append ("<strong>File Type: </strong>")
|
||||
if md /= Void and then attached md.file_type as meta_type then
|
||||
body.append (meta_type)
|
||||
else
|
||||
body.append ("NA")
|
||||
end
|
||||
body.append ("<br/><br/>%N")
|
||||
|
||||
body.append ("<a class=%"button%" href=%"" + req.script_url ("/" + l_files_api.file_link (f).location) + "%">Download</a>%N")
|
||||
body.append ("<a class=%"button%" href=%"" + req.script_url ("/" + uploads_location + "remove/" + f.filename) + "%">Remove</a>%N")
|
||||
body.append ("</div>%N") -- metadata
|
||||
|
||||
body.append ("<div class=%"overview%">")
|
||||
if
|
||||
attached f.relative_path.extension as ext and then
|
||||
(
|
||||
ext.is_case_insensitive_equal_general ("png")
|
||||
or ext.is_case_insensitive_equal_general ("jpg")
|
||||
or ext.is_case_insensitive_equal_general ("gif")
|
||||
)
|
||||
then
|
||||
body.append ("<img src=%"" + req.script_url ("/" + l_files_api.file_link (f).location) + "%" />")
|
||||
else
|
||||
-- add default thumbnail
|
||||
body.append ("<img src=%"" + req.script_url ("/module/" + name + "/files/img/file-logo.png") + "%" />")
|
||||
end
|
||||
body.append ("</div>%N") -- Overview
|
||||
end
|
||||
body.append ("</div>%N")
|
||||
|
||||
r.add_to_primary_tabs (create {CMS_LOCAL_LINK}.make ("Uploaded files", uploads_location))
|
||||
r.set_main_content (body)
|
||||
else
|
||||
create {BAD_REQUEST_ERROR_CMS_RESPONSE} r.make (req, res, api)
|
||||
r.set_main_content ("Missing 'filename' field value!")
|
||||
end
|
||||
r.execute
|
||||
end
|
||||
|
||||
execute_upload (req: WSF_REQUEST; res: WSF_RESPONSE; api: CMS_API)
|
||||
local
|
||||
body: STRING_8
|
||||
r: CMS_RESPONSE
|
||||
do
|
||||
if req.is_get_head_request_method or req.is_post_request_method then
|
||||
create body.make_empty
|
||||
body.append ("<h1> Upload files </h1>%N")
|
||||
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api)
|
||||
|
||||
-- set style
|
||||
r.add_style (r.url ("/module/" + name + "/files/css/files.css", void), void)
|
||||
|
||||
-- add JS for dropzone
|
||||
r.add_javascript_url (r.url ("/module/" + name + "/files/js/dropzone.js", void))
|
||||
r.add_style (r.url ("/module/" + name + "/files/js/dropzone.css", void), void)
|
||||
|
||||
if api.has_permission (upload_files_permission) then
|
||||
-- create body
|
||||
body.append ("<p>Please choose some file(s) to upload.</p>")
|
||||
|
||||
-- create form to choose files and upload them
|
||||
body.append ("<div class=%"upload-files%">")
|
||||
body.append ("<form action=%"" + r.url (uploads_location, Void) + "%" class=%"dropzone%">")
|
||||
body.append ("</form>%N")
|
||||
body.append ("<div class=%"center%"><a class=%"button%" href=%""+ r.url (uploads_location, Void) +"%">Upload Files</a></div>")
|
||||
body.append ("</div>")
|
||||
if req.is_post_request_method then
|
||||
process_uploaded_files (req, api, body)
|
||||
end
|
||||
else
|
||||
create {FORBIDDEN_ERROR_CMS_RESPONSE} r.make (req, res, api)
|
||||
end
|
||||
|
||||
-- Build the response.
|
||||
if r.has_permission (browse_files_permission) then
|
||||
append_uploaded_file_album_to (req, api, body)
|
||||
else
|
||||
r.add_warning_message ("You are not allowed to browse files!")
|
||||
end
|
||||
|
||||
r.set_main_content (body)
|
||||
else
|
||||
create {BAD_REQUEST_ERROR_CMS_RESPONSE} r.make (req, res, api)
|
||||
end
|
||||
r.execute
|
||||
end
|
||||
|
||||
process_uploaded_files (req: WSF_REQUEST; api: CMS_API; a_output: STRING)
|
||||
-- Process http request uploaded files.
|
||||
require
|
||||
has_permission: api.has_permission (upload_files_permission)
|
||||
local
|
||||
l_uploaded_file: CMS_UPLOADED_FILE
|
||||
uf: WSF_UPLOADED_FILE
|
||||
do
|
||||
if attached files_api as l_files_api then
|
||||
-- if has uploaded files, then store them
|
||||
if req.has_uploaded_file then
|
||||
a_output.append ("<strong>Newly uploaded file(s): </strong>%N")
|
||||
a_output.append ("<ul class=%"uploaded-files%">")
|
||||
across
|
||||
req.uploaded_files as ic
|
||||
loop
|
||||
uf := ic.item
|
||||
create l_uploaded_file.make_with_uploaded_file (l_files_api.uploads_directory, uf)
|
||||
a_output.append ("<li>")
|
||||
a_output.append (api.html_encoded (l_uploaded_file.filename))
|
||||
|
||||
-- create medadata file
|
||||
l_uploaded_file.set_size (uf.size)
|
||||
l_uploaded_file.set_type (uf.content_type)
|
||||
|
||||
-- store the just uploaded file
|
||||
l_files_api.save_uploaded_file (l_uploaded_file)
|
||||
|
||||
if l_files_api.has_error then
|
||||
a_output.append (" <span class=%"error%">: upload failed!</span>")
|
||||
end
|
||||
a_output.append ("</li>")
|
||||
end
|
||||
a_output.append ("</ul>%N")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
append_uploaded_file_album_to (req: WSF_REQUEST; api: CMS_API; a_output: STRING)
|
||||
local
|
||||
d: DIRECTORY
|
||||
f: CMS_FILE
|
||||
p: PATH
|
||||
rel: PATH
|
||||
md: detachable CMS_FILE_METADATA
|
||||
do
|
||||
if attached files_api as l_files_api then
|
||||
rel := l_files_api.uploads_relative_path
|
||||
p := l_files_api.uploads_directory
|
||||
|
||||
a_output.append ("<div class=%"uploaded-files%">%N")
|
||||
a_output.append ("<strong>Uploaded files:</strong>%N")
|
||||
a_output.append ("<table>%N")
|
||||
a_output.append ("<tr><th>Filename</th><th>Uploading Time</th><th>User</th><th>Size</th><th></th><th></th></tr>%N")
|
||||
|
||||
create d.make_with_path (p)
|
||||
if d.exists then
|
||||
across
|
||||
d.entries as ic
|
||||
loop
|
||||
|
||||
if ic.item.is_current_symbol then
|
||||
-- Ignore
|
||||
elseif ic.item.is_parent_symbol then
|
||||
-- Ignore for now.
|
||||
else
|
||||
f := l_files_api.new_file (rel.extended_path (ic.item))
|
||||
|
||||
-- check if f is directory -> yes, then do not show
|
||||
if not f.is_directory then
|
||||
a_output.append ("<tr>")
|
||||
|
||||
-- add filename
|
||||
a_output.append ("<td class=%"filename%">")
|
||||
a_output.append ("<a href=%"" + api.percent_encoded (f.filename) + "%">")
|
||||
a_output.append (api.html_encoded (f.filename))
|
||||
a_output.append ("</a>")
|
||||
a_output.append ("</td>%N")
|
||||
|
||||
md := l_files_api.metadata (f)
|
||||
if md = Void then
|
||||
a_output.append ("<td class=%"date%"></td>%N")
|
||||
a_output.append ("<td class=%"user%"></td>%N")
|
||||
a_output.append ("<td class=%"size%"></td>%N")
|
||||
else
|
||||
|
||||
-- add uploading time
|
||||
a_output.append ("<td class=%"date%">")
|
||||
if attached md.date as meta_time then
|
||||
a_output.append (meta_time.out)
|
||||
end
|
||||
a_output.append ("</td>%N")
|
||||
|
||||
-- add user
|
||||
a_output.append ("<td class=%"user%">")
|
||||
if attached md.user as u then
|
||||
a_output.append (api.html_encoded (u.name))
|
||||
end
|
||||
a_output.append ("</td>%N")
|
||||
|
||||
-- add size
|
||||
a_output.append ("<td class=%"size%">")
|
||||
if md.size > 0 then
|
||||
a_output.append (file_size_human_string (md.size))
|
||||
else
|
||||
a_output.append ("NA")
|
||||
end
|
||||
a_output.append ("</td>%N")
|
||||
end
|
||||
|
||||
-- add download link
|
||||
a_output.append ("<td>")
|
||||
a_output.append ("<a class=%"button%" href=%"" + req.script_url ("/" + l_files_api.file_link (f).location) + "%" download>Download</a>%N")
|
||||
a_output.append ("</td>%N")
|
||||
|
||||
-- add remove button
|
||||
a_output.append ("<td>")
|
||||
a_output.append ("<a class=%"button%" href=%"" + req.script_url ("/" + uploads_location + "remove/" + f.filename) + "%">Remove</a>%N")
|
||||
a_output.append ("</td>%N")
|
||||
|
||||
a_output.append ("</tr>%N")
|
||||
else
|
||||
if f.relative_path.is_current_symbol or f.relative_path.is_parent_symbol then
|
||||
-- Ignore "." and ".."
|
||||
else
|
||||
|
||||
-- folder support not yet supported
|
||||
|
||||
-- -- add directory identifier
|
||||
-- a_output.append ("<td>[dir]</td>%N")
|
||||
|
||||
-- a_output.append ("<td>")
|
||||
-- a_output.append ("<a href=%"" + api.percent_encoded (f.filename) + "%">")
|
||||
-- a_output.append (api.html_encoded (f.filename))
|
||||
-- a_output.append ("</a>")
|
||||
-- a_output.append ("</td>%N")
|
||||
|
||||
-- a_output.append ("<td></td><td></td><td></td><td></td><td></td>")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
a_output.append ("</table>%N")
|
||||
a_output.append ("</div>%N")
|
||||
end
|
||||
end
|
||||
|
||||
remove_file (req: WSF_REQUEST; res: WSF_RESPONSE; api: CMS_API)
|
||||
local
|
||||
body: STRING
|
||||
r: CMS_RESPONSE
|
||||
err: BOOLEAN
|
||||
do
|
||||
if attached files_api as l_files_api then
|
||||
if not api.has_permission (admin_files_permission) then
|
||||
create {FORBIDDEN_ERROR_CMS_RESPONSE} r.make (req, res, api)
|
||||
r.add_error_message ("You are not allowed to remove file!")
|
||||
elseif attached {WSF_STRING} req.path_parameter ("filename") as p_filename then
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api)
|
||||
|
||||
l_files_api.delete_file (p_filename.value)
|
||||
err := l_files_api.has_error
|
||||
l_files_api.reset_error
|
||||
create body.make_empty
|
||||
|
||||
if err then
|
||||
body.append ("<h3>The file has been removed successfully!</h3>")
|
||||
else
|
||||
body.append ("<h3>The file removal failed!</h3>")
|
||||
end
|
||||
|
||||
r.add_to_primary_tabs (create {CMS_LOCAL_LINK}.make ("Uploaded files", uploads_location))
|
||||
r.set_main_content (body)
|
||||
else
|
||||
create {BAD_REQUEST_ERROR_CMS_RESPONSE} r.make (req, res, api)
|
||||
r.add_error_message ("Missing 'filename' parameter!")
|
||||
end
|
||||
else
|
||||
create {INTERNAL_SERVER_ERROR_CMS_RESPONSE} r.make (req, res, api)
|
||||
r.set_main_content ("Removal of file failed due to internal server error!")
|
||||
end
|
||||
r.execute
|
||||
end
|
||||
|
||||
feature -- Helpers
|
||||
|
||||
file_size_human_string (a_size: INTEGER): STRING
|
||||
local
|
||||
size: INTEGER
|
||||
do
|
||||
size := a_size
|
||||
if size >= 1000000 then
|
||||
size := size // 1000000
|
||||
Result := size.out + " MB"
|
||||
else
|
||||
if size >= 1000 then
|
||||
size := size // 1000
|
||||
Result := size.out + " kB"
|
||||
else
|
||||
Result := size.out + " bytes"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Mapping helper: uri template agent (analogue to the demo-module)
|
||||
|
||||
map_uri_template (a_router: WSF_ROUTER; a_tpl: STRING; h: WSF_URI_TEMPLATE_HANDLER; rqst_methods: detachable WSF_REQUEST_METHODS)
|
||||
-- Map `h' as handler for `a_tpl', according to `rqst_methods'.
|
||||
require
|
||||
a_tpl_attached: a_tpl /= Void
|
||||
h_attached: h /= Void
|
||||
do
|
||||
a_router.map (create {WSF_URI_TEMPLATE_MAPPING}.make (a_tpl, h), rqst_methods)
|
||||
end
|
||||
|
||||
map_uri_template_agent (a_router: WSF_ROUTER; a_tpl: READABLE_STRING_8; proc: PROCEDURE [TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]]; rqst_methods: detachable WSF_REQUEST_METHODS)
|
||||
-- Map `proc' as handler for `a_tpl', according to `rqst_methods'.
|
||||
require
|
||||
a_tpl_attached: a_tpl /= Void
|
||||
proc_attached: proc /= Void
|
||||
do
|
||||
map_uri_template (a_router, a_tpl, create {WSF_URI_TEMPLATE_AGENT_HANDLER}.make (proc), rqst_methods)
|
||||
end
|
||||
|
||||
end
|
||||
105
modules/files/cms_uploaded_file.e
Normal file
105
modules/files/cms_uploaded_file.e
Normal file
@@ -0,0 +1,105 @@
|
||||
note
|
||||
description: "Summary description for {CMS_UPLOADED_FILE}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_UPLOADED_FILE
|
||||
|
||||
create
|
||||
make_with_uploaded_file
|
||||
|
||||
feature {NONE} -- Initializaion
|
||||
|
||||
make_with_uploaded_file (a_uploads_directory: PATH; uf: WSF_UPLOADED_FILE)
|
||||
do
|
||||
uploads_directory := a_uploads_directory
|
||||
uploaded_file := uf
|
||||
location := a_uploads_directory.extended (uf.safe_filename)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
uploaded_file: WSF_UPLOADED_FILE
|
||||
|
||||
uploads_directory: PATH
|
||||
|
||||
filename: STRING_32
|
||||
-- File name of Current file.
|
||||
local
|
||||
p: PATH
|
||||
do
|
||||
p := location
|
||||
if attached p.entry as e then
|
||||
Result := e.name
|
||||
else
|
||||
Result := p.name
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
location: PATH
|
||||
-- Absolute path, or relative path to the `CMS_API.files_location'.
|
||||
|
||||
owner: detachable CMS_USER
|
||||
-- Optional owner.
|
||||
|
||||
upload_time: detachable DATE_TIME
|
||||
-- time when the file was uploaded
|
||||
|
||||
size: detachable INTEGER_32
|
||||
-- file size
|
||||
|
||||
type: detachable STRING
|
||||
-- file type
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_owner (u: detachable CMS_USER)
|
||||
-- Set `owner' to `u'.
|
||||
do
|
||||
owner := u
|
||||
end
|
||||
|
||||
set_time (a_time: detachable DATE_TIME)
|
||||
-- Set `upload_time' to `a_time'
|
||||
do
|
||||
upload_time := a_time
|
||||
end
|
||||
|
||||
set_size (a_size: detachable INTEGER_32)
|
||||
-- Set `size' to `a_size'
|
||||
do
|
||||
size := a_size
|
||||
end
|
||||
|
||||
set_type (a_type: detachable STRING)
|
||||
-- Set `type' to `a_type'
|
||||
do
|
||||
type := a_type
|
||||
end
|
||||
|
||||
set_new_location_with_number (a_number: INTEGER_32)
|
||||
-- sets `a_number' after the name. This is done when the file was already uploaded
|
||||
local
|
||||
position: INTEGER_32
|
||||
new_name: STRING_8
|
||||
do
|
||||
position := uploaded_file.string_representation.index_of ('.', 1)
|
||||
create new_name.make_empty
|
||||
|
||||
new_name := uploaded_file.string_representation.head (position-1)
|
||||
new_name.append ("_(" + a_number.out + ")")
|
||||
new_name.append (uploaded_file.string_representation.substring (position, uploaded_file.string_representation.count))
|
||||
|
||||
location := uploads_directory.extended (new_name)
|
||||
end
|
||||
|
||||
feature -- Basic operation
|
||||
|
||||
move_to (p: PATH): BOOLEAN
|
||||
do
|
||||
Result := uploaded_file.move_to (p.name)
|
||||
end
|
||||
|
||||
end
|
||||
21
modules/files/files-safe.ecf
Normal file
21
modules/files/files-safe.ecf
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-15-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-15-0 http://www.eiffel.com/developers/xml/configuration-1-15-0.xsd" name="files_module" uuid="795C88E5-9218-4F35-A985-5501340E2D9D" library_target="files_module">
|
||||
<target name="files_module">
|
||||
<root all_classes="true" />
|
||||
<file_rule>
|
||||
<exclude>/.svn$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="cms" location="..\..\cms-safe.ecf"/>
|
||||
<library name="cms_model" location="..\..\library\model\cms_model-safe.ecf"/>
|
||||
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
|
||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
|
||||
<library name="wsf_encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf"/>
|
||||
<cluster name="src" location=".\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
22
modules/files/files.ecf
Normal file
22
modules/files/files.ecf
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-15-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-15-0 http://www.eiffel.com/developers/xml/configuration-1-15-0.xsd" name="files_module" uuid="795C88E5-9218-4F35-A985-5501340E2D9D" library_target="files_module">
|
||||
<target name="files_module">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/.svn$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" void_safety="none" syntax="standard">
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="cms" location="..\..\cms.ecf"/>
|
||||
<library name="cms_model" location="..\..\library\model\cms_model.ecf"/>
|
||||
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http.ecf"/>
|
||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
|
||||
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf.ecf"/>
|
||||
<library name="wsf_encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder.ecf"/>
|
||||
<cluster name="src" location=".\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
52
modules/files/site/files/css/files.css
Normal file
52
modules/files/site/files/css/files.css
Normal file
@@ -0,0 +1,52 @@
|
||||
.uploaded-files table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
border: 1px solid black;
|
||||
}
|
||||
.uploaded-files table th {
|
||||
padding: 3px 0 3px 5px;
|
||||
}
|
||||
.uploaded-files table td {
|
||||
padding: 3px 0 3px 5px;
|
||||
}
|
||||
.uploaded-files a.button {
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
border: solid 1px #999;
|
||||
background-color: #ddd;
|
||||
padding: 2px 4px 2px 4px;
|
||||
}
|
||||
.uploaded-files a.button:hover {
|
||||
color: black;
|
||||
border: solid 1px #06f;
|
||||
background-color: #cff;
|
||||
}
|
||||
|
||||
.upload-files .center {
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
}
|
||||
.upload-files a.button {
|
||||
margin: auto;
|
||||
width: 100px;
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
border: solid 1px #999;
|
||||
background-color: #ddd;
|
||||
padding: 2px 4px 2px 4px;
|
||||
}
|
||||
.upload-files a.button:hover {
|
||||
color: black;
|
||||
border: solid 1px #06f;
|
||||
background-color: #cff;
|
||||
}
|
||||
|
||||
/******************* Drop Zone *******************/
|
||||
.dropzone {
|
||||
width: 100%;
|
||||
border: 2px dashed blue;
|
||||
border-radius: 3px;
|
||||
text-align: center;
|
||||
padding-top: 15px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
BIN
modules/files/site/files/img/file-logo.png
Normal file
BIN
modules/files/site/files/img/file-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
1
modules/files/site/files/js/dropzone.css
Normal file
1
modules/files/site/files/js/dropzone.css
Normal file
File diff suppressed because one or more lines are too long
1763
modules/files/site/files/js/dropzone.js
Normal file
1763
modules/files/site/files/js/dropzone.js
Normal file
File diff suppressed because it is too large
Load Diff
78
modules/files/site/files/js/src/basic.scss
Normal file
78
modules/files/site/files/js/src/basic.scss
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* The MIT License
|
||||
* Copyright (c) 2012 Matias Meno <m@tias.me>
|
||||
*/
|
||||
|
||||
// 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.
|
||||
|
||||
.dropzone, .dropzone * {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.dropzone {
|
||||
|
||||
position: relative;
|
||||
|
||||
.dz-preview {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 120px;
|
||||
margin: 0.5em;
|
||||
|
||||
.dz-progress {
|
||||
display: block;
|
||||
height: 15px;
|
||||
border: 1px solid #aaa;
|
||||
.dz-upload {
|
||||
display: block;
|
||||
height: 100%;
|
||||
width: 0;
|
||||
background: green;
|
||||
}
|
||||
}
|
||||
|
||||
.dz-error-message {
|
||||
color: red;
|
||||
display: none;
|
||||
}
|
||||
&.dz-error {
|
||||
.dz-error-message, .dz-error-mark {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
&.dz-success {
|
||||
.dz-success-mark {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.dz-error-mark, .dz-success-mark {
|
||||
position: absolute;
|
||||
display: none;
|
||||
left: 30px;
|
||||
top: 30px;
|
||||
width: 54px;
|
||||
height: 58px;
|
||||
left: 50%;
|
||||
margin-left: -(54px/2);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
1590
modules/files/site/files/js/src/dropzone.coffee
Normal file
1590
modules/files/site/files/js/src/dropzone.coffee
Normal file
File diff suppressed because it is too large
Load Diff
413
modules/files/site/files/js/src/dropzone.scss
Normal file
413
modules/files/site/files/js/src/dropzone.scss
Normal file
@@ -0,0 +1,413 @@
|
||||
/*
|
||||
* The MIT License
|
||||
* Copyright (c) 2012 Matias Meno <m@tias.me>
|
||||
*/
|
||||
|
||||
// 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.
|
||||
|
||||
@mixin keyframes($name) {
|
||||
@-webkit-keyframes #{$name} {
|
||||
@content;
|
||||
}
|
||||
@-moz-keyframes #{$name} {
|
||||
@content;
|
||||
}
|
||||
@keyframes #{$name} {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@mixin prefix($map, $vendors: webkit moz ms o) {
|
||||
@each $prop, $value in $map {
|
||||
@if $vendors {
|
||||
@each $vendor in $vendors {
|
||||
#{"-" + $vendor + "-" + $prop}: #{$value};
|
||||
}
|
||||
}
|
||||
// Dump regular property anyway
|
||||
#{$prop}: #{$value};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@include keyframes(passing-through) {
|
||||
|
||||
0% {
|
||||
opacity: 0;
|
||||
@include prefix((transform: translateY(40px)));
|
||||
}
|
||||
|
||||
30%, 70% {
|
||||
opacity: 1;
|
||||
@include prefix((transform: translateY(0px)));
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0;
|
||||
@include prefix((transform: translateY(-40px)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@include keyframes(slide-in) {
|
||||
|
||||
0% {
|
||||
opacity: 0;
|
||||
@include prefix((transform: translateY(40px)));
|
||||
}
|
||||
|
||||
30% {
|
||||
opacity: 1;
|
||||
@include prefix((transform: translateY(0px)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@include keyframes(pulse) {
|
||||
|
||||
0% { @include prefix((transform: scale(1))); }
|
||||
10% { @include prefix((transform: scale(1.1))); }
|
||||
20% { @include prefix((transform: scale(1))); }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.dropzone, .dropzone * {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.dropzone {
|
||||
|
||||
$image-size: 120px;
|
||||
|
||||
$image-border-radius: 20px;
|
||||
|
||||
&.dz-clickable {
|
||||
cursor: pointer;
|
||||
|
||||
* {
|
||||
cursor: default;
|
||||
}
|
||||
.dz-message {
|
||||
&, * {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
min-height: 150px;
|
||||
border: 2px solid rgba(0, 0, 0, 0.3);
|
||||
background: white;
|
||||
padding: 20px 20px;
|
||||
|
||||
&.dz-started {
|
||||
.dz-message {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
&.dz-drag-hover {
|
||||
border-style: solid;
|
||||
.dz-message {
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
.dz-message {
|
||||
text-align: center;
|
||||
margin: 2em 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.dz-preview {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
|
||||
vertical-align: top;
|
||||
|
||||
margin: 16px;
|
||||
min-height: 100px;
|
||||
|
||||
&:hover {
|
||||
// Making sure that always the hovered preview element is on top
|
||||
z-index: 1000;
|
||||
.dz-details {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&.dz-file-preview {
|
||||
|
||||
.dz-image {
|
||||
border-radius: $image-border-radius;
|
||||
background: #999;
|
||||
background: linear-gradient(to bottom, #eee, #ddd);
|
||||
}
|
||||
|
||||
.dz-details {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&.dz-image-preview {
|
||||
background: white;
|
||||
.dz-details {
|
||||
@include prefix((transition: opacity 0.2s linear));
|
||||
}
|
||||
}
|
||||
|
||||
.dz-remove {
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover .dz-details {
|
||||
opacity: 1;
|
||||
}
|
||||
.dz-details {
|
||||
$background-color: #444;
|
||||
|
||||
z-index: 20;
|
||||
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
|
||||
opacity: 0;
|
||||
|
||||
font-size: 13px;
|
||||
min-width: 100%;
|
||||
max-width: 100%;
|
||||
padding: 2em 1em;
|
||||
text-align: center;
|
||||
color: rgba(0, 0, 0, 0.9);
|
||||
|
||||
$width: 120px;
|
||||
|
||||
line-height: 150%;
|
||||
|
||||
.dz-size {
|
||||
margin-bottom: 1em;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.dz-filename {
|
||||
|
||||
white-space: nowrap;
|
||||
|
||||
&:hover {
|
||||
span {
|
||||
border: 1px solid rgba(200, 200, 200, 0.8);
|
||||
background-color: rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
}
|
||||
&:not(:hover) {
|
||||
span {
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.dz-filename, .dz-size {
|
||||
span {
|
||||
background-color: rgba(255, 255, 255, 0.4);
|
||||
padding: 0 0.4em;
|
||||
border-radius: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.dz-image {
|
||||
// opacity: 0.8;
|
||||
img {
|
||||
@include prefix((transform: scale(1.05, 1.05))); // Getting rid of that white bleed-in
|
||||
@include prefix((filter: blur(8px)), webkit); // Getting rid of that white bleed-in
|
||||
}
|
||||
}
|
||||
}
|
||||
.dz-image {
|
||||
border-radius: $image-border-radius;
|
||||
overflow: hidden;
|
||||
width: $image-size;
|
||||
height: $image-size;
|
||||
position: relative;
|
||||
display: block;
|
||||
z-index: 10;
|
||||
|
||||
img {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&.dz-success {
|
||||
.dz-success-mark {
|
||||
@include prefix((animation: passing-through 3s cubic-bezier(0.770, 0.000, 0.175, 1.000)));
|
||||
}
|
||||
}
|
||||
&.dz-error {
|
||||
.dz-error-mark {
|
||||
opacity: 1;
|
||||
@include prefix((animation: slide-in 3s cubic-bezier(0.770, 0.000, 0.175, 1.000)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.dz-success-mark, .dz-error-mark {
|
||||
|
||||
$image-height: 54px;
|
||||
$image-width: 54px;
|
||||
|
||||
pointer-events: none;
|
||||
|
||||
opacity: 0;
|
||||
z-index: 500;
|
||||
|
||||
position: absolute;
|
||||
display: block;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin-left: -($image-width/2);
|
||||
margin-top: -($image-height/2);
|
||||
|
||||
svg {
|
||||
display: block;
|
||||
width: $image-width;
|
||||
height: $image-height;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&.dz-processing .dz-progress {
|
||||
opacity: 1;
|
||||
@include prefix((transition: all 0.2s linear));
|
||||
}
|
||||
&.dz-complete .dz-progress {
|
||||
opacity: 0;
|
||||
@include prefix((transition: opacity 0.4s ease-in));
|
||||
}
|
||||
|
||||
&:not(.dz-processing) {
|
||||
.dz-progress {
|
||||
@include prefix((animation: pulse 6s ease infinite));
|
||||
}
|
||||
}
|
||||
.dz-progress {
|
||||
|
||||
opacity: 1;
|
||||
z-index: 1000;
|
||||
|
||||
pointer-events: none;
|
||||
position: absolute;
|
||||
height: 16px;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
margin-top: -8px;
|
||||
|
||||
width: 80px;
|
||||
margin-left: -40px;
|
||||
|
||||
// border: 2px solid #333;
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
|
||||
// Fix for chrome bug: https://code.google.com/p/chromium/issues/detail?id=157218
|
||||
-webkit-transform: scale(1);
|
||||
|
||||
|
||||
border-radius: 8px;
|
||||
|
||||
overflow: hidden;
|
||||
|
||||
.dz-upload {
|
||||
background: #333;
|
||||
background: linear-gradient(to bottom, #666, #444);
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 0;
|
||||
@include prefix((transition: width 300ms ease-in-out));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
&.dz-error {
|
||||
.dz-error-message {
|
||||
display: block;
|
||||
}
|
||||
&:hover .dz-error-message {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.dz-error-message {
|
||||
$width: $image-size + 20px;
|
||||
$color: rgb(190, 38, 38);
|
||||
|
||||
pointer-events: none;
|
||||
z-index: 1000;
|
||||
position: absolute;
|
||||
display: block;
|
||||
display: none;
|
||||
opacity: 0;
|
||||
@include prefix((transition: opacity 0.3s ease));
|
||||
border-radius: 8px;
|
||||
font-size: 13px;
|
||||
top: $image-size + 10px;
|
||||
left: -10px;
|
||||
width: $width;
|
||||
background: $color;
|
||||
background: linear-gradient(to bottom, $color, darken($color, 5%));
|
||||
padding: 0.5em 1.2em;
|
||||
color: white;
|
||||
|
||||
// The triangle pointing up
|
||||
&:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -6px;
|
||||
left: $width / 2 - 6px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-left: 6px solid transparent;
|
||||
border-right: 6px solid transparent;
|
||||
border-bottom: 6px solid $color;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
63
modules/files/site/files/scss/files.scss
Normal file
63
modules/files/site/files/scss/files.scss
Normal file
@@ -0,0 +1,63 @@
|
||||
.uploaded-files {
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
border: 1px solid black;
|
||||
|
||||
th {
|
||||
padding: 3px 0 3px 5px;
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 3px 0 3px 5px;
|
||||
}
|
||||
}
|
||||
|
||||
a.button{
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
border: solid 1px #999;
|
||||
background-color: #ddd;
|
||||
padding: 2px 4px 2px 4px;
|
||||
&:hover {
|
||||
color: black;
|
||||
border: solid 1px #06f;
|
||||
background-color: #cff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.upload-files {
|
||||
.center {
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
}
|
||||
a.button{
|
||||
margin: auto;
|
||||
width: 100px;
|
||||
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
border: solid 1px #999;
|
||||
background-color: #ddd;
|
||||
padding: 2px 4px 2px 4px;
|
||||
&:hover {
|
||||
color: black;
|
||||
border: solid 1px #06f;
|
||||
background-color: #cff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************* Drop Zone *******************/
|
||||
|
||||
.dropzone {
|
||||
width: 100%;
|
||||
border: 2px dashed blue;
|
||||
border-radius: 3px;
|
||||
text-align: center;
|
||||
padding-top: 15px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ feature -- Handler
|
||||
attached l_search.last_result as l_result and then
|
||||
l_result.status = 200
|
||||
then
|
||||
if attached template_block (Current, "search", r) as l_tpl_block then
|
||||
if attached template_block (Current, "search", api) as l_tpl_block then
|
||||
l_tpl_block.set_value (l_result, "result")
|
||||
r.add_block (l_tpl_block, "content")
|
||||
end
|
||||
|
||||
@@ -243,7 +243,7 @@ feature -- Hooks
|
||||
a_response.location.same_string ("account")
|
||||
then
|
||||
if
|
||||
attached template_block ("account_info", a_response) as l_tpl_block and then
|
||||
attached template_block (Current, "account_info", a_response.api) as l_tpl_block and then
|
||||
attached a_response.user as l_user
|
||||
then
|
||||
associate_account (l_user, a_response.values)
|
||||
@@ -323,7 +323,7 @@ feature {NONE} -- Block views
|
||||
local
|
||||
vals: CMS_VALUE_TABLE
|
||||
do
|
||||
if attached template_block (a_block_id, a_response) as l_tpl_block then
|
||||
if attached template_block (Current, a_block_id, a_response.api) as l_tpl_block then
|
||||
create vals.make (1)
|
||||
-- add the variable to the block
|
||||
a_response.api.hooks.invoke_value_table_alter (vals, a_response)
|
||||
|
||||
@@ -270,7 +270,7 @@ feature {NONE} -- Block views
|
||||
local
|
||||
vals: CMS_VALUE_TABLE
|
||||
do
|
||||
if attached template_block (a_block_id, a_response) as l_tpl_block then
|
||||
if attached template_block (Current, a_block_id, a_response.api) as l_tpl_block then
|
||||
create vals.make (1)
|
||||
-- add the variable to the block
|
||||
a_response.api.hooks.invoke_value_table_alter (vals, a_response)
|
||||
|
||||
@@ -141,7 +141,7 @@ feature {NONE} -- Implementation: routes
|
||||
if api.user_is_authenticated then
|
||||
r.add_error_message ("You are already signed in!")
|
||||
else
|
||||
if attached template_block ("login", r) as l_tpl_block then
|
||||
if attached template_block (Current, "login", api) as l_tpl_block then
|
||||
create vals.make (1)
|
||||
-- add the variable to the block
|
||||
l_tpl_block.set_value (api.user, "user")
|
||||
@@ -223,7 +223,7 @@ feature {NONE} -- Implementation: routes
|
||||
end
|
||||
else
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api)
|
||||
if attached template_block ("login", r) as l_tpl_block then
|
||||
if attached template_block (Current, "login", api) as l_tpl_block then
|
||||
l_tpl_block.set_value (l_username.value, "username")
|
||||
l_tpl_block.set_value ("Wrong: Username or password ", "error")
|
||||
r.add_block (l_tpl_block, "content")
|
||||
@@ -232,7 +232,7 @@ feature {NONE} -- Implementation: routes
|
||||
r.execute
|
||||
else
|
||||
create {BAD_REQUEST_ERROR_CMS_RESPONSE} r.make (req, res, api)
|
||||
if attached template_block ("login", r) as l_tpl_block then
|
||||
if attached template_block (Current, "login", api) as l_tpl_block then
|
||||
if attached {WSF_STRING} req.form_parameter ("username") as l_username then
|
||||
l_tpl_block.set_value (l_username.value, "username")
|
||||
end
|
||||
@@ -272,7 +272,7 @@ feature {NONE} -- Block views
|
||||
local
|
||||
vals: CMS_VALUE_TABLE
|
||||
do
|
||||
if attached template_block (a_block_id, a_response) as l_tpl_block then
|
||||
if attached template_block (Current, a_block_id, a_response.api) as l_tpl_block then
|
||||
create vals.make (1)
|
||||
-- add the variable to the block
|
||||
a_response.api.hooks.invoke_value_table_alter (vals, a_response)
|
||||
|
||||
@@ -187,7 +187,7 @@ feature -- Hooks
|
||||
-- Add the link to the taxonomy to the main menu
|
||||
if a_response.has_permission ("admin taxonomy") then
|
||||
create lnk.make ("Taxonomy", "admin/taxonomy/")
|
||||
a_menu_system.management_menu.extend (lnk)
|
||||
a_menu_system.management_menu.extend_into (lnk, "Admin", "admin")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
48
package.iron
48
package.iron
@@ -1,14 +1,8 @@
|
||||
package ROC
|
||||
package roc
|
||||
|
||||
project
|
||||
cms = "cms-safe.ecf"
|
||||
cms = "cms.ecf"
|
||||
app_env = "library/app_env/app_env-safe.ecf"
|
||||
app_env = "library/app_env/app_env.ecf"
|
||||
config = "library/configuration/config-safe.ecf"
|
||||
config = "library/configuration/config.ecf"
|
||||
app_env = "library/layout/layout-safe.ecf"
|
||||
app_env = "library/layout/layout.ecf"
|
||||
cms_model = "library/model/cms_model-safe.ecf"
|
||||
cms_model = "library/model/cms_model.ecf"
|
||||
persistence_mysql = "library/persistence/mysql/persistence_mysql-safe.ecf"
|
||||
@@ -20,13 +14,8 @@ project
|
||||
node = "modules/node/node-safe.ecf"
|
||||
node = "modules/node/node.ecf"
|
||||
demo = "examples/demo/demo-safe.ecf"
|
||||
cms_demo_module = "examples/demo/modules/demo/cms_demo_module-safe.ecf"
|
||||
config_tests = "library/configuration/tests/config_tests-safe.ecf"
|
||||
email_service = "library/email/email-safe.ecf"
|
||||
persistence_sqlite3 = "library/persistence/sqlite3/persistence_sqlite3-safe.ecf"
|
||||
store_mysql = "library/persistence/store_mysql/store_mysql-safe.ecf"
|
||||
persistence_store_odbc = "library/persistence/store_odbc/store_odbc-safe.ecf"
|
||||
tests_store_odbc = "library/persistence/store_odbc/tests/tests-safe.ecf"
|
||||
admin = "modules/admin/admin-safe.ecf"
|
||||
auth_module = "modules/auth/auth-safe.ecf"
|
||||
cms_blog_module = "modules/blog/cms_blog_module-safe.ecf"
|
||||
@@ -34,14 +23,39 @@ project
|
||||
oauth_module = "modules/oauth20/oauth20-safe.ecf"
|
||||
openid_module = "modules/openid/openid-safe.ecf"
|
||||
recent_changes = "modules/recent_changes/recent_changes-safe.ecf"
|
||||
gcse = "library/gcse/gcse-safe.ecf"
|
||||
gcse = "library/gcse/gcse.ecf"
|
||||
persistence_sqlite3 = "library/persistence/sqlite3/sqlite3-safe.ecf"
|
||||
recaptcha = "library/recaptcha/recaptcha-safe.ecf"
|
||||
recaptcha = "library/recaptcha/recaptcha.ecf"
|
||||
contact = "modules/contact/contact-safe.ecf"
|
||||
google_search = "modules/google_search/google_search-safe.ecf"
|
||||
google_search = "modules/google_search/google_search.ecf"
|
||||
recent_changes = "modules/recent_changes/recent_changes.ecf"
|
||||
seo = "modules/seo/seo-safe.ecf"
|
||||
session_auth = "modules/session_auth/cms_session_auth-safe.ecf"
|
||||
cms_taxonomy_module = "modules/taxonomy/taxonomy-safe.ecf"
|
||||
cms_taxonomy_module = "modules/taxonomy/taxonomy.ecf"
|
||||
|
||||
note
|
||||
title: ROC CMS
|
||||
description: CMS written with Eiffel
|
||||
tags: cms, web, rest, api
|
||||
license: Eiffel Forum v2
|
||||
copyright: Jocelyn Fiat, Javier Velilla, Eiffel Software
|
||||
description: "[
|
||||
Eiffel ROC CMS library is build with [EWF](http://eiffelwebframework.github.io/EWF/) and inspired by [Drupal](https://www.drupal.org/).
|
||||
|
||||
The goal of the library is to provide the following features.
|
||||
- content type
|
||||
- user management
|
||||
- node management
|
||||
- module design
|
||||
- theme
|
||||
- API
|
||||
- ...
|
||||
]"
|
||||
tags: cms,user, web, rest, api,node,module,theme,authentication
|
||||
copyright: 2011-2016, Jocelyn Fiat, Javier Velilla, Eiffel Software and others
|
||||
license: "Eiffel Forum License v2 (see https://www.eiffel.com/licensing/forum.txt)"
|
||||
link[license]: https://www.eiffel.com/licensing/forum.txt
|
||||
link[source]: "Github" https://github.com/EiffelWebFramework/ROC.git
|
||||
-- link[doc]: "Documentation" http://
|
||||
link[doc]: "Documentation" https://github.com/EiffelWebFramework/ROC/blob/master/doc/readme.md
|
||||
|
||||
end
|
||||
|
||||
@@ -26,6 +26,6 @@ feature -- Hook
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
|
||||
@@ -6,17 +6,17 @@ note
|
||||
deferred class
|
||||
CMS_HOOK_BLOCK_HELPER
|
||||
|
||||
feature -- Factory
|
||||
feature {NONE} -- Factory
|
||||
|
||||
template_block (a_module: CMS_MODULE; a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE): detachable CMS_SMARTY_TEMPLATE_BLOCK
|
||||
-- Smarty content block for `a_block_id' in the context of `a_module' and `a_response'.
|
||||
template_block (a_module: CMS_MODULE; a_block_id: READABLE_STRING_8; a_cms_api: CMS_API): detachable CMS_SMARTY_TEMPLATE_BLOCK
|
||||
-- Smarty content block for `a_block_id' in the context of `a_module' and `a_cms_api'.
|
||||
local
|
||||
res: PATH
|
||||
p: detachable PATH
|
||||
do
|
||||
create res.make_from_string ("templates")
|
||||
res := res.extended ("block_").appended (a_block_id).appended_with_extension ("tpl")
|
||||
p := a_response.api.module_theme_resource_location (a_module, res)
|
||||
p := a_cms_api.module_theme_resource_location (a_module, res)
|
||||
if p /= Void then
|
||||
if attached p.entry as e then
|
||||
create Result.make (a_block_id, Void, p.parent, e)
|
||||
@@ -26,6 +26,20 @@ feature -- Factory
|
||||
end
|
||||
end
|
||||
|
||||
template_block_with_values (a_module: CMS_MODULE; a_block_id: READABLE_STRING_8; a_cms_api: CMS_API; a_values: STRING_TABLE [ANY]): like template_block
|
||||
-- Smarty content block for `a_block_id' in the context of `a_module' and `a_cms_api',
|
||||
-- With additional `a_values'.
|
||||
do
|
||||
Result := template_block (a_module, a_block_id, a_cms_api)
|
||||
if Result /= Void then
|
||||
across
|
||||
a_values as ic
|
||||
loop
|
||||
Result.set_value (ic.item, ic.key)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
|
||||
@@ -10,14 +10,14 @@ deferred class
|
||||
feature -- Initialisation
|
||||
|
||||
load_assets: STRING
|
||||
-- Loads all assest needed to show the editor
|
||||
-- Loads all assest needed to show the editor.
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Javascript
|
||||
|
||||
javascript_replace_textarea (a_textarea: WSF_FORM_TEXTAREA): STRING
|
||||
-- Javascript code that replaces a textarea with the editor. The editor instance should be saved in editor_variable
|
||||
-- Javascript code that replaces a textarea with the editor. The editor instance should be saved in editor_variable.
|
||||
deferred
|
||||
end
|
||||
|
||||
@@ -27,13 +27,13 @@ feature -- Javascript
|
||||
end
|
||||
|
||||
javascript_textarea_to_editor (a_textarea: WSF_FORM_TEXTAREA): STRING
|
||||
-- Javascript code to display the textarea as a WYSIWIG editor as soon as the document is loaded
|
||||
-- Javascript code to display the textarea as a WYSIWIG editor as soon as the document is loaded.
|
||||
do
|
||||
Result := javascript_ready (javascript_replace_textarea (a_textarea))
|
||||
end
|
||||
|
||||
javascript_textarea_to_editor_if_selected (a_textarea: WSF_FORM_TEXTAREA; a_select_field: WSF_FORM_SELECT; a_value: STRING): STRING
|
||||
-- Javascript code to display the textarea as a WYSIWIG editor if a_select_field has a_value
|
||||
-- Javascript code to display the textarea as a WYSIWIG editor if a_select_field has a_value,
|
||||
local
|
||||
initial_replace_code, on_select_replace_code: STRING
|
||||
do
|
||||
@@ -56,38 +56,40 @@ feature -- Javascript
|
||||
end
|
||||
|
||||
javascript_init_editor_variable (a_textarea: WSF_FORM_TEXTAREA): STRING
|
||||
-- Returns the javascript code that initializes a local variable to store the editor instance
|
||||
-- Returns the javascript code that initializes a local variable to store the editor instance.
|
||||
do
|
||||
Result := "var " + editor_variable (a_textarea) + "; "
|
||||
end
|
||||
|
||||
javascript_if_selected (a_select_field: WSF_FORM_SELECT; a_value: STRING; a_code: STRING): STRING
|
||||
-- Javascript that executes a_code if a_value is selected at a_select_field
|
||||
-- Javascript that executes a_code if a_value is selected at a_select_field.
|
||||
do
|
||||
Result := "if($('#" + field_id (a_select_field) + "').val() == %"" + a_value + "%"){ " + a_code + " }"
|
||||
end
|
||||
|
||||
javascript_ready (a_code: STRING): STRING
|
||||
-- Wraps the given javascript code with a ready statement, such that it's executed when the document has loaded
|
||||
-- Wraps the given javascript code with a ready statement,
|
||||
-- such that it's executed when the document has loaded.
|
||||
do
|
||||
Result := "$(function() { " + a_code + " });"
|
||||
end
|
||||
|
||||
javascript_on_select (a_select_field: WSF_FORM_SELECT; a_value: STRING; a_then: STRING; a_else: STRING): STRING
|
||||
-- Javascript code that executes a_then if at the given select_field the given string value is selected, otherwise it executes a_else
|
||||
-- Javascript code that executes `a_then' if at the given `a_select_field'
|
||||
-- the given string `a_value' is selected, otherwise it executes `a_else'.
|
||||
do
|
||||
Result := "$('#" + field_id (a_select_field) + "').change(function(){" +
|
||||
javascript_if_selected (a_select_field, a_value, a_then) +
|
||||
"else{" +
|
||||
a_else +
|
||||
"}" +
|
||||
"});"
|
||||
Result := "$('#" + field_id (a_select_field) + "').change(function(){"
|
||||
+ javascript_if_selected (a_select_field, a_value, a_then)
|
||||
+ "else{"
|
||||
+ a_else
|
||||
+ "}"
|
||||
+ "});"
|
||||
end
|
||||
|
||||
feature -- Helper
|
||||
|
||||
field_id (a_select_field: WSF_FORM_SELECT): STRING
|
||||
-- Returns the id of the given field
|
||||
-- Id of the given field.
|
||||
do
|
||||
if attached a_select_field.css_id as a_id then
|
||||
Result := a_id
|
||||
@@ -103,6 +105,6 @@ feature -- Helper
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
|
||||
@@ -23,7 +23,8 @@ feature -- Javascript
|
||||
javascript_replace_textarea (a_textarea: WSF_FORM_TEXTAREA): STRING
|
||||
-- <Precursor>
|
||||
do
|
||||
-- Replaces the textarea with an editor instance. Save the instance in a variable
|
||||
-- Replaces the textarea with an editor instance.
|
||||
-- Save the instance in a variable.
|
||||
Result := "$(%"textarea[name="+ a_textarea.name +"]%").each(function() {"
|
||||
Result.append (editor_variable (a_textarea) + " = CKEDITOR.replace(this);")
|
||||
Result.append ("});")
|
||||
@@ -32,11 +33,12 @@ feature -- Javascript
|
||||
javascript_restore_textarea (a_textarea: WSF_FORM_TEXTAREA): STRING
|
||||
-- <Precursor>
|
||||
do
|
||||
-- Replaces the textarea with an editor instance. Save the instance in a variable
|
||||
-- Replaces the textarea with an editor instance.
|
||||
-- Save the instance in a variable.
|
||||
Result := "if (" + editor_variable (a_textarea) + " != undefined) " + editor_variable (a_textarea) + ".destroy();"
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
|
||||
@@ -282,7 +282,9 @@ feature -- Head customization
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<link rel=%"stylesheet%" href=%""+ a_href + "%" type=%"text/css%""
|
||||
create s.make_from_string ("<link rel=%"stylesheet%" href=%"")
|
||||
s.append (a_href)
|
||||
s.append ("%" type=%"text/css%"")
|
||||
if a_media /= Void then
|
||||
s.append (" media=%""+ a_media + "%"")
|
||||
end
|
||||
@@ -290,11 +292,24 @@ feature -- Head customization
|
||||
add_additional_head_line (s, False)
|
||||
end
|
||||
|
||||
add_style_content (a_style_content: STRING)
|
||||
-- Add style content `a_style_content' in the head, using <style> tag.
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
create s.make_from_string ("<style>%N")
|
||||
s.append (a_style_content)
|
||||
s.append ("%N</style>")
|
||||
add_additional_head_line (s, True)
|
||||
end
|
||||
|
||||
add_javascript_url (a_src: STRING)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<script type=%"text/javascript%" src=%"" + a_src + "%"></script>"
|
||||
create s.make_from_string ("<script type=%"text/javascript%" src=%"")
|
||||
s.append (a_src)
|
||||
s.append ("%"></script>")
|
||||
add_additional_head_line (s, False)
|
||||
end
|
||||
|
||||
@@ -302,7 +317,9 @@ feature -- Head customization
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<script type=%"text/javascript%">%N" + a_script + "%N</script>"
|
||||
create s.make_from_string ("<script type=%"text/javascript%">%N")
|
||||
s.append (a_script)
|
||||
s.append ("%N</script>")
|
||||
add_additional_head_line (s, True)
|
||||
end
|
||||
|
||||
|
||||
@@ -144,12 +144,17 @@ feature -- Element change
|
||||
title := s
|
||||
end
|
||||
|
||||
add_additional_head_line (s: READABLE_STRING_8)
|
||||
do
|
||||
head_lines.extend (s)
|
||||
end
|
||||
|
||||
add_meta_name_content (a_name: STRING; a_content: STRING)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<meta name=%"" + a_name + "%" content=%"" + a_content + "%" />"
|
||||
head_lines.extend (s)
|
||||
add_additional_head_line (s)
|
||||
end
|
||||
|
||||
add_meta_http_equiv (a_http_equiv: STRING; a_content: STRING)
|
||||
@@ -157,39 +162,56 @@ feature -- Element change
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<meta http-equiv=%"" + a_http_equiv + "%" content=%"" + a_content + "%" />"
|
||||
head_lines.extend (s)
|
||||
add_additional_head_line (s)
|
||||
end
|
||||
|
||||
add_style (a_href: STRING; a_media: detachable STRING)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<link rel=%"stylesheet%" href=%""+ a_href + "%" type=%"text/css%""
|
||||
create s.make_from_string ("<link rel=%"stylesheet%" href=%"")
|
||||
s.append (a_href)
|
||||
s.append ("%" type=%"text/css%"")
|
||||
if a_media /= Void then
|
||||
s.append (" media=%""+ a_media + "%"")
|
||||
end
|
||||
s.append ("/>")
|
||||
head_lines.extend (s)
|
||||
add_additional_head_line (s)
|
||||
end
|
||||
|
||||
add_style_content (a_style_content: STRING)
|
||||
-- Add style content `a_style_content' in the head, using <style> tag.
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
create s.make_from_string ("<style>%N")
|
||||
s.append (a_style_content)
|
||||
s.append ("%N</style>")
|
||||
add_additional_head_line (s)
|
||||
end
|
||||
|
||||
add_javascript_url (a_src: STRING)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<script type=%"text/javascript%" src=%"" + a_src + "%"></script>"
|
||||
head_lines.extend (s)
|
||||
create s.make_from_string ("<script type=%"text/javascript%" src=%"")
|
||||
s.append (a_src)
|
||||
s.append ("%"></script>")
|
||||
add_additional_head_line (s)
|
||||
end
|
||||
|
||||
add_javascript_content (a_script: STRING)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<script type=%"text/javascript%">%N" + a_script + "%N</script>"
|
||||
head_lines.extend (s)
|
||||
create s.make_from_string ("<script type=%"text/javascript%">%N")
|
||||
s.append (a_script)
|
||||
s.append ("%N</script>")
|
||||
add_additional_head_line (s)
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
|
||||
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
@@ -30,7 +30,7 @@ set ROC_TOOL_PATH=%~dp0
|
||||
goto START
|
||||
|
||||
:START
|
||||
echo Calling %ROC_TOOL_PATH%roc.exe %*
|
||||
rem echo Calling %ROC_TOOL_PATH%roc.exe %*
|
||||
call %ROC_TOOL_PATH%roc.exe %*
|
||||
goto END
|
||||
|
||||
|
||||
Reference in New Issue
Block a user