rejetto forum

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

Offline bmartino1

  • Tireless poster
  • ****
  • Posts: 901
  • 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]
COMMENT this option causes your file list to be paged by default

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>
{.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=''>{.!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});
{.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>

and script codes that run form action:

Code: [Select]
[ajax.mkdir|no log]
{.check session.}
{.break|if={.not|{.can mkdir.}.}|result=not authorized.}
{.set|x|{.force ansi|%folder%{.^x.}.}.}
{.add to log|User %user% created folder "{.^x.}".}

[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.}
{.add to log|User %user% renamed "{.^x.}" to "{.^y.}".}

[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.}.}
    {.if not |{.exists|{.^x.}.}|{.^x.}: {.!not found.}|{:
        {.if|{.exists|{.^y.}.}|{.^y.}: {.!already exists.}|{:
            {.if|{.length|{.move|{.^x.}|{.^y.}.}.} |{:
            :} | {:
                {.set|log|{.chr|13.}{.^fn.} (failed)|mode=append.}
                {.maybe utf8|{.^fn.}.}: {.!not moved.}
{.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.}.}.}.}

[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.}

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]
<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-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=""/>.}
<div><a href="%item-url%" title="Click to Enter">%item-name%</a><span>%item-added%</span></div>

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


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

your better off grabbing a better - diofferent template:
« Last Edit: April 28, 2018, 08:12:26 PM by bmartino1 »
Files i try to keep and share can be found on my google drive:

Follow members gave a thank to your post:

Thank-o-Matic 3.0 By Adk Team