rejetto forum

Author Topic: Live 3 With Delete, Rename, New Folder, and Change User Pass  (Read 51057 times)

Offline bmartino1

  • Tireless poster
  • ****
  • Posts: 910
  • I'm only trying to help i mean no offense.
    • View Profile
    • My HFS Google Drive Shared Link
TSG, would be faster / better or dj ...

sorry was looking at  the orginal live v3,  different realize this is an old post for a file no longer aviabale... for a modded template version of live...

we will have to add stuff to the orginal template and recode it

I'm just pulling the code form the default template, i have not edited nor added code, and will take me some time to code it up. I have very little time with current occupations :( ....

IN the end,
there will need to be an account setup with access and delete permision

and code copied form the default template to the live template to run the script for the desired actions....

live has diffent names and different script run then the default so we will have to read code and change the arcordingly....
those button will only work on 1 file not multple selected (so the4re will be bad code adn posible bug hangup even if teh template is codced corectly for one file use....

How to start:

first hfs default code and special string added to the special stings section to the live template
Code: [Select]
[+special:strings]
option.paged=1
COMMENT this option causes your file list to be paged by default

option.newfolder=1
option.move=1
option.comment=1
option.rename=1
COMMENT with these you can disable some features of the template. Please note this is not about user permissions, this is global!

next the button to click form the hfs default:
box actions

Code: [Select]
<fieldset id='actions'>
<legend><img src="/~img18"> {.!Actions.}</legend>
<center>
{.if|{.can mkdir.}|
<button id='newfolderBtn' onclick='ezprompt(this.innerHTML, {type:"text"}, function(s){
ajax("mkdir", {name:s});
    });'>{.!New folder.}</button>
.}
{.if|{.can comment.}|
<button id='commentBtn' onclick='setComment.call(this)'>{.!Comment.}</button>
.}
{.if|{.get|can delete.}|
<button id='deleteBtn' onclick='if (confirm("{.!confirm.}")) submit({action:"delete"}, "{.get|url.}")'>{.!Delete.}</button>

{.if|{.and|{.!option.move.}|{.can move.}.}| <button id='moveBtn' onclick='moveClicked()'>{.!Move.}</button> .}
.}
{.if|{.can rename.}|
<button id='renameBtn' onclick='
            var a = selectedItems();
                if (a.size() != 1)
return alert("You must select a single item to rename");
ezprompt(this.innerHTML, {type:"text"}, function(s){
ajax("rename", {from:getItemName(a[0]), to:s});
    });'>{.!Rename.}</button>
.}
{.if|{.get|can archive.}|
<button id='archiveBtn' onclick='if (confirm("{.!confirm.}")) submit({}, "{.get|url|mode=archive|recursive.}")'>{.!Archive.}</button>
.}
<a href="{.get|url|tpl=list|sort=|{.if not|{.length|{.?search.}.}|{:folders-filter=\|recursive:}.}.}">{.!Get list.}</a>
</center>
</fieldset>

and script codes that run form action:

Code: [Select]
[ajax.mkdir|no log]
{.check session.}
{.set|x|{.postvar|name.}.}
{.break|if={.pos|\|var=x.}{.pos|/|var=x.}|result=forbidden.}
{.break|if={.not|{.can mkdir.}.}|result=not authorized.}
{.set|x|{.force ansi|%folder%{.^x.}.}.}
{.break|if={.exists|{.^x.}.}|result=exists.}
{.break|if={.not|{.length|{.mkdir|{.^x.}.}.}.}|result=failed.}
{.add to log|User %user% created folder "{.^x.}".}
{.pipe|ok.}

[ajax.rename|no log]
{.check session.}
{.break|if={.not|{.can rename.}.}|result=forbidden.}
{.break|if={.is file protected|{.postvar|from.}.}|result=forbidden.}
{.break|if={.is file protected|{.postvar|to.}.}|result=forbidden.}
{.set|x|{.force ansi|%folder%{.postvar|from.}.}.}
{.set|y|{.force ansi|%folder%{.postvar|to.}.}.}
{.break|if={.not|{.exists|{.^x.}.}.}|result=not found.}
{.break|if={.exists|{.^y.}.}|result=exists.}
{.break|if={.not|{.length|{.rename|{.^x.}|{.^y.}.}.}.}|result=failed.}
{.add to log|User %user% renamed "{.^x.}" to "{.^y.}".}
{.pipe|ok.}

[ajax.move|no log]
{.check session.}
{.set|dst|{.force ansi|{.postvar|dst.}.}.}
{.break|if={.not|{.and|{.can move.}|{.get|can delete.}|{.get|can upload|path={.^dst.}.}/and.}.} |result={.!forbidden.}.}
{.set|log|{.!Moving items to.} {.^dst.}.}
{.for each|fn|{.replace|:|{.no pipe||.}|{.force ansi|{.postvar|files.}.}.}|{:
{.break|if={.is file protected|var=fn.}|result=forbidden.}
    {.set|x|{.force ansi|%folder%.}{.^fn.}.}
    {.set|y|{.^dst.}/{.^fn.}.}
    {.if not |{.exists|{.^x.}.}|{.^x.}: {.!not found.}|{:
        {.if|{.exists|{.^y.}.}|{.^y.}: {.!already exists.}|{:
            {.if|{.length|{.move|{.^x.}|{.^y.}.}.} |{:
                {.set|log|{.chr|13.}{.^fn.}|mode=append.}
                {.move|{.^x.}.md5|{.^y.}.md5.}
                {.move|{.^x.}.comment|{.^y.}.comment.}
            :} | {:
                {.set|log|{.chr|13.}{.^fn.} (failed)|mode=append.}
                {.maybe utf8|{.^fn.}.}: {.!not moved.}
            :}/if.}
        :}/if.}
    :}.}
    ;
:}.}
{.add to log|{.^log.}.}

[ajax.comment|no log]
{.check session.}
{.break|if={.not|{.can comment.}.} |result=forbidden.}
{.for each|fn|{.replace|:|{.no pipe||.}|{.postvar|files.}.}|{:
{.break|if={.is file protected|var=fn.}|result=forbidden.}
    {.set item|{.force ansi|%folder%{.^fn.}.}|comment={.encode html|{.force ansi|{.postvar|text.}.}.}.}
:}.}
{.pipe|ok.}

[ajax.changepwd|no log]
{.check session.}
{.break|if={.not|{.can change pwd.}.} |result=forbidden.}
{.if|{.length|{.set account||password={.force ansi|{.postvar|new.}.}.}/length.}|ok|failed.}

[special:alias]
check session=if|{.{.cookie|HFS_SID_.} != {.postvar|token.}.}|{:{.cookie|HFS_SID_|value=|expires=-1.} {.break|result=bad session}:}
can mkdir=and|{.get|can upload.}|{.!option.newfolder.}
can comment=and|{.get|can upload.}|{.!option.comment.}
can rename=and|{.get|can delete.}|{.!option.rename.}
can change pwd=member of|can change password
can move=or|1
escape attr=replace|"|&quot;|$1
commentNL=if|{.pos|<br|$1.}|$1|{.replace|{.chr|10.}|<br />|$1.}
add bytes=switch|{.cut|-1||$1.}|,|0,1,2,3,4,5,6,7,8,9|$1 bytes|K,M,G,T|$1bytes

!!! Don't just add code form the default to the live tempalte ... You will have to recode certtain areas, this is teh defautl tempalte code and button when cliced action

you will have to find the live template code where the lock icon and delete icon and add a folder and etc function you want form the default.


as you can see hfs looks at
Code: [Select]
info in a  " [ " and  " ] " if live already has a name then in the " [ " and  " ] " then we can add code form the default and thoruw them in there respeted areas...

live breaks parts of it webpage and uses javascrip and ohter to form its web page

there is a blank section of " [ " and  " ] "
that just load the basic html side

then there brackets in live like this code:

Code: [Select]
[folder]
<div class="item folder {.if not|{.or|{.get|can archive.}|{.get|can delete.}.}| off .}"
item-access="{.if|{.get|can access.}| You can access this item! | This item is protected. .}"
item-added="%item-added%"
item-dl-count="%item-dl-count%"
item-comment="{.replace|>| &gt; |<| &lt; |"|&#38;#38;#34;|%item-comment%.}">
<a href="%item-url%" title="Click to Enter">
<img src="/template/{.!theme.}/images/icons/folder.gif" alt=""/>
{.if|{.get|is new.}|<img class="new" src="/template/{.!theme.}/images/new.png" alt=""/>.}
</a>
<div><a href="%item-url%" title="Click to Enter">%item-name%</a><span>%item-added%</span></div>
</div>

this code efect folder and only folders
we will be adding data to this area and files and much more...

(ALOT OF TIRAL AND ERROR!)

witch is why it is not a fast nor easy insert code here:....

your better off grabbing a better - diofferent template: https://rawr.thatstevensguy.com/
« Last Edit: April 28, 2018, 08:12:26 PM by bmartino1 »
Files I have snagged and share can be found on my google drive:

https://drive.google.com/drive/folders/1qb4INX2pzsjmMT06YEIQk9Nv5jMu33tC?usp=sharing

Follow members gave a thank to your post:


Thank-o-Matic 3.0 By Adk Team