Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Mars

Pages: [1] 2 3 ... 8
1
HFS ~ HTTP File Server / MOVED: Send via email
« on: October 21, 2013, 07:00:31 PM »

3
HTML & templates / MOVED: linebreaks for comments
« on: October 12, 2013, 03:25:56 PM »

4
HFS ~ HTTP File Server / MOVED: Error: no response was received
« on: September 16, 2013, 06:57:45 AM »

7
Bug reports / How putting in check of hfs
« on: March 24, 2011, 08:57:01 PM »
Quote from: Used reference text
procedure keepTplUpdated();
begin
if fileExists(tplFilename) then
  if newMtime(tplFilename, tplLast) then
    setTplText(loadFile(tplFilename))
  else
else
  if tplLast <> 0 then
    begin
    tplLast:=0; // we have no modified-time in this case, but this will stop the refresh
    setTplText(defaultTpl);
    end;
end; // keepTplUpdated

1) Execute hfs with a personalized template

2) Verify the web page by means of the browser

3) Rename the template filename without closing hfs

4) Refresh the web page of the browser, the default template is used on the place of the other one

5) close hfs with saving options

6) Relaunch hfs and refresh the web page

The shown page is of one such whiteness  :D ;D

if you restore the personalized template, everything becomes again normal

Conclusion: To resolve this loss of external template it is enough to settle by adding a line

Quote from: main.pas
......
    if h = 'tpl-file' then tplFilename:=l;
    if h = 'tpl-editor' then tplEditor:=l;
      if h = 'graph-visible' then
      if yes then showGraph()
      else hideGraph();
   // extra commands for external use
     if h = 'load-tpl-from' then setNewTplFile(l);  //WARNING TO REJETTO This line is not any more used
  except end;
  end;

if not fileExists(tplFilename) then tplfilename:='' end;


if not alreadyStarted then
 // i was already seeing all the stuff, so please don't hide it
  if (build > '') and (build < '006') then easyMode:=FALSE;



******************
other bug with his solution

 if you replace the external template by one with the same name, the modification is not taken into account in hfs because of the following line in classeslib.pas:

result:=o.tpl;
if getMtime(fn) <= o.ts then exit;  //remove the < char
o.ts:=getMtime(fn);


8
HTML & templates / MOVED: magnifying glass???
« on: December 30, 2010, 10:58:43 AM »

10
Programmers corner / build 272 what is wrong or missing
« on: December 18, 2010, 08:21:53 PM »
Already indicated
Quote
 procedure handleItem(f:Tfile);  //main.pas
  var
    type_, s, url, fingerprint, itemFolder: string;
    nonPerc: TStringDynArray;
  begin
  //We have to make an exception with virtual links
  if not f.isLink and ansiContainsStr(f.resource, '?') then exit; // unicode filename?

  if f.size > 0 then inc(totalBytes, f.size);

New: The rerouting login is wrong  when the destination does not exist,It was necessary to me to erase cookies concerning HFS under firefox to obtain the web page because hfs jammed because of it.

Quote
   function getAccountRedirect():string;   //main.pas
    var
      acc: Paccount;
    begin
    result:='';
    acc:=accountRecursion(data.account, ARSC_REDIR);
    if acc = NIL then exit;
    result:=acc.redir;
    if (result = '')  or ansiContainsStr(result, '://') then exit;
    // if it's not a complete url, it may require some fixing
    if not ansiStartsStr('/', result) then result:='/'+result;
    result:=xtpl(result,['\','/']);
//add by mars 18/12/2010
   if fileExistsByURL(result) then exit;
    add2log('Error on redirect with account '+acc.user+crlf+'The path is invalid :'+ result);
    result:='';

    end; // getAccountRedirect

this can help the admin to detect bad redirect path under accounts dialogbox
Quote
procedure ToptionsFrm.loadAccountProperties(); //optionsdlg.pas
....
redirBox.Text:=a.redir;
notesBox.text:=a.notes;
//add by mars 18/12/20010
redirBox.color:=clWindow;
if (a.redir>'') and not fileExistsByURL(a.redir) then redirBox.color:=clRed;


groupsBtn.enabled:=FALSE;
for i:=0 to length(tempAccounts)-1 do
  if tempAccounts.group and (i <> accountsBox.itemIndex) then
    groupsBtn.enabled:=TRUE;

updateAccessBox();
accountsBox.invalidate();
end; // loadAccountProperties


procedure ToptionsFrm.applyBtnClick(Sender: TObject);
begin
  saveValues();
// this is necessary to refresh the account box when we click on the apply button
 selectAccount(accountsBox.itemIndex);  //add by mars 18/12/2010
end;


11
on import the template create a new group ""can change redirect"

each user which belong this group can define the current folder as default on redirect login

after login, click on the user name allow to display the commands submenu
 ;)

template attached

Quote
[]
......
   <fieldset id='login'>
      <legend><img src="/~img27"> {.!User.}</legend>
      <center>
      {.if not| %user% |<a href="~login">Login</a>|{:
         <div><a href="#" style='font-size:medium;position:relative; top:5px; left:middle;'>%user%</a></div>
         <div style='margin-top:0.5em;' class='hidden popup'>
            <div id='folder-stats'></div>
         {.if|{.can change pwd.} |{:
            <button onclick='changePwd.call(this)' style='font-size:x-small;cursor:pointer;'>{.!Change password.}</button>
         :}/if.}
         {.if|{.can redirect.}|{:
            <button onclick='var s=("{.encodeURI|%folder%.}");
               $.post("?mode=section&id=ajax.changeredirect",{"redirect":s},getStdAjaxCB());'
               style='font-size:x-small;cursor:pointer;'>{.!Set folder as default on login.}</button>
            :}/if.}
         </div>
      :}/if not.}
      </center>
   </fieldset>
......

**********************************************************************************

[+special:alias]
can redirect=member of|can change redirect

[ajax.changeredirect|no log]
{.break|if={.not|{.can redirect.}.}|result=forbidden.}
{.if|{.postvar|redirect.}|
   {:{.if|{.length|{.set account||redirect={.decodeuri|{.postvar|redirect.}.}.}/length.}|ok|failed.}:}
    |failed
.}

**********************************************************************************

.......
    // login menu appear when it gets focus
    $('#login').focusin(function(evt){
        inLogin = 1;
        if (evt.target.getAttribute('type') == 'submit') return; // the submitter button won't expand the popup, but sets the flag to avoid the popup to be closed
        $("#login .popup").slideDown();
    }).focusout(function(evt){
        inLogin = 0;
        setTimeout(function(){
            if (!inLogin)
                $("#login .popup").fadeOut();
        });
    });

   // search options appear when it gets focus
........



12
Programmers corner / tray.balloon
« on: September 14, 2010, 02:21:08 PM »
@rejetto

with a little update , it's posible to use the NOTIFY MESSAGE not only with the macro notify

With a small update, it is possible to use the NOTIFY messages except the notify macro

Quote
SCRIPTLIB.PAS

    if name = 'notify' then
      begin
      tray.balloon(p, par('type'), par('title'), parF('timeout',3));
      result:='';
      end;

Quote
TRAYLIB.PAS

      function  balloon(msg:string; MessageType:string=''; title:string=''; secondsTimeout:real=3):boolean; OVERLOAD;
      function  balloon(msg:string; secondsTimeout:real):boolean; OVERLOAD;

.........

function TmyTrayIcon.balloon(msg:string; MessageType:string; title:string; secondsTimeout:real):boolean;
  var kind:TtrayMessageType;
  function stringTotrayMessageType(s:string):TtrayMessageType;
    begin
    if compareText(s,'warning') = 0 then
      result:=TM_WARNING
    else if compareText(s,'error') = 0 then
      result:=TM_ERROR
    else if compareText(s,'info') = 0 then
      result:=TM_INFO
    else
      result:=TM_NONE
    end; // stringTotrayMessageType


begin
kind:=stringTotrayMessageType(MessageType);
case kind of
  TM_WARNING: icondata.dwInfoFlags:=NIIF_WARNING;
  TM_ERROR: icondata.dwInfoFlags:=NIIF_ERROR;
  TM_INFO: icondata.dwInfoFlags:=NIIF_INFO;
  else icondata.dwInfoFlags:=NIIF_NONE;
end;
strPLCopy(icondata.szInfo, msg, sizeOf(icondata.szInfo)-1);
strPLCopy(icondata.szInfoTitle, title, sizeOf(icondata.szInfoTitle)-1);
icondata.uVersion:=round(secondsTimeout*1000);
icondata.uFlags := icondata.uFlags or NIF_INFO;
update();
icondata.uFlags := icondata.uFlags and not NIF_INFO;
result:=TRUE;
end;

function TmyTrayIcon.balloon(msg:string; secondsTimeout:real):boolean;
begin
balloon(msg,'','',secondsTimeout);
end; // balloon

This modification is great important because it will be in the French version, and because if it it is not resumed in the build 270, the silentpliz will not be really satisfied  >:( :( :-\ :'( :-[, because it is him who had the idea. ;) :D

example:

Quote
var
  s: string;
begin
if externalIP = '' then exit;
mainfrm.setStatusBarText('Updating dynamic DNS...', 5);
tray.balloon('Updating dynamic DNS...', 5);

dyndns.lastTime:=now();
try s:=httpGet(xtpl(dyndns.url, ['%ip%', externalIP]));

........

procedure TmainFrm.Restoredefault1Click(Sender: TObject);
begin
if msgDlg('Continue?', MB_ICONQUESTION+MB_YESNO) = MRNO then exit;
tplFilename:='';
tplLast:=-1;
tplImport:=TRUE;
setStatusBarText('The template has been reset');
tray.balloon('The template has been reset', 5);
end;
and some others..  ;)

13
Beta / BEFORE THE NEXT BUILD 263: We so much hope to have...
« on: July 13, 2010, 02:33:55 PM »
I would like this possibility in main.pas

Quote from:  main.pas
INITIALIZATION
....
if fileExists(exepath+'default.tpl') then
  defaultTpl:=loadfile('default.tpl')
else

  defaultTpl:=getRes('defaultTpl');
....
when i test a new tpl, then i can have the possibility to restore my default tpl, not necessary the internal
 ;)

I just watched the contents of default.tpl, this has nothing to do with the philosophy of hfs with its macros available, there are more than javascript, which increases dramatically the load time of pages , especially since it is necessary to use an external library. the relocation of features of this template in others is almost impossible, as some of the players in the last rawr template.
 >:(

like in the kitchen, trying too hard to spice up a dish, you lose the flavor of the main ingredient, hfs has lost the flavor of its simplicity ;)

14
The bug here is which appeared since the section [special:import] is active in the template by default, about is the template in the course of use, the concerned section is systematically executed, to convince itself, it is enough to choose a personalized template and to delete the group ' can exchange password ', then we save the options (in any configuration) and we restart HFS, it damned counts re-appears as if by magic.

With the following small modifications, everything becomes again normal:

The section is executed during  restore  the default template, and so only during a first installation of hfs, or in case hfs.ini is deleted and in case the base of register of hfs is empty.



Quote
function Tmainfrm.finalInit():boolean;
......
// CTRL avoids the only1instance setting
if not holdingKey(VK_CONTROL)
and only1instanceChk.checked and not mono.master then
  begin
  result:=FALSE;
  quitASAP:=TRUE;
  end;
//disable the two next lines, they are moved
//tplImport:=TRUE;  //execute import script if any
// setTplText(defaultTpl);

processParams_before(params);

.....................................

procedure TmainFrm.Restoredefault1Click(Sender: TObject);
begin
if msgDlg('Continue?', MB_ICONQUESTION+MB_YESNO) = MRNO then exit;
tplFilename:='';
tplLast:=-1;
tplImport:=TRUE; // execute import script if any   //this line was missing here
setStatusBarText('The template has been reset');
end;

.....................................

function loadCfg(var ini,tpl:string):boolean;
....
begin
result:=TRUE;
ipsEverConnected.text:=loadfile(IPS_FILE);
.......
//mars the two lines moved here
tplImport:=TRUE; // execute import script if any
setTplText(defaultTpl);
result:=FALSE;
end; // loadCfg

15
Programmers corner / Alias and Macros
« on: May 10, 2010, 05:51:15 PM »
With Silentpliz, we set up craftiness in the French version which allows to force the use of the internal macro of hfs (not the alias), even in case a macro is overloaded by one alias.

The adaptation is simple:

It is enough to make precede the name of the macro with the character _ as in this example


[special:alias]
comment={.add to log|this is an alias : $1.}


[]
{.comment|comment one.}
{._comment|comment two.}

Quote
    // here we try to handle some shortcuts.
    // it's a special starting character that identifies the macro, and the rest of the name is a parameter.
    p:=copy(name,2,MAXINT);

    if name[1] = '$' then
      try section(0); exit; except end;

    if name[1] = '!' then
      // we look for p (they key) in {.^special:strings.} then in [special:strings]. If no luck, we try to output an eventual parameter, or the key itself.
      try result:=first([fromTable('special:strings',p), md.tpl.getStrByID(p), par(0), p]); exit; except end;

    if name[1] = '^' then
      try call(getVar(p), 0); exit; except end;

    if name[1] = '?' then  // shortcut for 'urlvar'
      try result:=urlvar(p); exit; except end;


    // handle aliases //moved
    if assigned(md.aliases) and not (name[1] = '_') then

      begin
      s:=md.aliases.values[name];
      if s > '' then
        begin
        if not AnsiStartsStr(MARKER_OPEN, s) then
          s:=MARKER_OPEN+s+MARKER_CLOSE;
        call(s, 0);
        exit;
        end;
      end;

    if name[1] = '_' then name:=copy(name,2,MAXINT);

    p:=par(0); // a handy shortcut for the first parameter

Pages: [1] 2 3 ... 8