Skip to content

Commit

Permalink
Version 3.5.09
Browse files Browse the repository at this point in the history
Restored IE 8+ support!
Create_Table_for_Listing: id=DIRECTORY_FOOTER moved from <TR> to <TD>
Send_data_to_js_and_display: added DIRECTORY_ITEMS js global var
Added Init_Dir_table_rows() js function.
Assemble_row() is now Assemble_Insert_row()
Build_Directory() redone for Assemble_Insert_row(), cleaned up.
Directory_Summary(): no longer genrerates <td></td> here.
Sort_and_Show(): minor adjustment for new Build_Directory().
Some css adjustments for the above, and some general tweaks.
  • Loading branch information
Self-Evident committed Mar 22, 2014
1 parent d01d963 commit f034a78
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 95 deletions.
5 changes: 3 additions & 2 deletions info/OneFileCMS_structure.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
OneFileCMS Version 3.5.08 structure/layout
OneFileCMS Version 3.5.09 structure/layout

LICENSE

Expand Down Expand Up @@ -101,9 +101,10 @@ JAVASCRIPT FUNCTIONS:
Index_Page_scripts()
Sort_FOlder_First()
sort_DIRECTORY()
Init_Dir_table_rows()
Assemble_row()
Directory_Summary()
Build_Directory
Directory_Summary()
Sort_and_Show()
Select_All()
Confirm_Submit()
Expand Down
5 changes: 5 additions & 0 deletions info/changelog.markdown
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# OneFileCMS Change Log

### v3.5.09 (2014-03-22)

- Restored IE 8+ support.
- And, you know, tweaked some css...

### v3.5.08 (2014-03-21)

- Mostly just some code improvements/cleanup.
Expand Down
187 changes: 97 additions & 90 deletions onefilecms.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// OneFileCMS - github.com/Self-Evident/OneFileCMS

$OFCMS_version = '3.5.08';
$OFCMS_version = '3.5.09';

/*******************************************************************************
Except where noted otherwise:
Expand Down Expand Up @@ -1797,7 +1797,7 @@ function Create_Table_for_Listing() { //****************************************

<?php //Directory & footer content will be inserted later. ?>
<tbody id=DIRECTORY_LISTING></tbody>
<tr id=DIRECTORY_FOOTER></tr>
<tr><td id=DIRECTORY_FOOTER colspan=7></td</tr>
</table>
<?php
}//Create_Table_for_Listing() //************************************************
Expand Down Expand Up @@ -1893,6 +1893,7 @@ function Send_data_to_js_and_display() {//**************************************
}//end for x

//Initial sort & display of the directory, by (filename, ascending).
$data_for_js .= "var DIRECTORY_ITEMS = DIRECTORY_DATA.length;\n";
$data_for_js .= 'Sort_and_Show();'."\n";

$data_for_js .= "</script>\n";
Expand Down Expand Up @@ -1931,7 +1932,7 @@ function Index_Page_buttons_top($file_count) { //*******************************



function Index_Page(){ //*******************************************************
function Index_Page() { //******************************************************
global $ONESCRIPT, $ipath_OS, $param1;

init_ICONS_js();
Expand Down Expand Up @@ -3076,32 +3077,91 @@ function sort_DIRECTORY(col, direction) { //**************************



function Init_Dir_table_rows(DIR_LIST) { //***************************

var row, cell, cells, tr, td;

for (row = 0; row < DIRECTORY_ITEMS; row++){

//initialize <tr> with empty <td>'s
tr = DIR_LIST.insertRow(row);
for (cell = 0; cell < 7; cell++) {td = tr.insertCell(-1);}
cells = tr.cells;

//assign css classes
cells[4].className = 'file_name';
cells[5].className = 'file_size meta_T';
cells[6].className = 'file_time meta_T';
}
}//end Init_Dir_table_rows() { //*************************************




//********************************************************************
function Assemble_row(x, HREF_params, f_or_f, filename, file_name, file_time, file_size){
var TABLE_ROW = '';
function Assemble_Insert_row(IS_OFCMS, trow, href, f_or_f, filename, file_name, file_size, file_time){

//Assemble cell contents: [move] [copy] [delete] [x] <a>file name</a> etc...
var ren_mov = '<a href="' + HREF_params + '&amp;p=rename' + f_or_f + '" title="<?php echo hsc($_['Ren_Move']) ?>">' + ICONS['ren_mov'] + '</a>';
var copy = '<a href="' + HREF_params + '&amp;p=copy' + f_or_f + '" title="<?php echo hsc($_['Copy']) ?>">' + ICONS['copy'] + '</a>';
var del = '<a href="' + HREF_params + '&amp;p=delete' + f_or_f + '" title="<?php echo hsc($_['Delete']) ?>">' + ICONS['delete'] + '</a>';
//Assemble [move] [copy] [delete] [x]
var ren_mov = '<a href="' + href + '&amp;p=rename' + f_or_f + '" title="<?php echo hsc($_['Ren_Move']) ?>">' + ICONS['ren_mov'] + '</a>';
var copy = '<a href="' + href + '&amp;p=copy' + f_or_f + '" title="<?php echo hsc($_['Copy']) ?>">' + ICONS['copy'] + '</a>';
var del = '<a href="' + href + '&amp;p=delete' + f_or_f + '" title="<?php echo hsc($_['Delete']) ?>">' + ICONS['delete'] + '</a>';
var checkbox = '<div class="ckbox"><INPUT TYPE=checkbox class=select_file NAME="files[]" VALUE="'+ hsc(filename) +'"></div>';

//Don't show remove, delete, or checkbox options for active copy of OneFileCMS.
var IS_OFCMS = DIRECTORY_DATA[x][4];
if (IS_OFCMS) { ren_mov = del = checkbox = ''; }

TABLE_ROW += "<tr>";
TABLE_ROW += '<td>' + ren_mov + '</td>';
TABLE_ROW += '<td>' + copy + '</td>';
TABLE_ROW += '<td>' + del + '</td>';
TABLE_ROW += '<td>' + checkbox + '</td>';
TABLE_ROW += '<td class="file_name" >' + file_name + '</td>';
TABLE_ROW += '<td class="meta_T file_size">' + file_size + '</td>';
TABLE_ROW += '<td class="meta_T file_time">' + file_time + '</td>';
TABLE_ROW += "</tr>\n";
//fill the <td>'s
cells = trow.cells;
cells[0].innerHTML = ren_mov;
cells[1].innerHTML = copy;
cells[2].innerHTML = del;
cells[3].innerHTML = checkbox;
cells[4].innerHTML = file_name;
cells[5].innerHTML = file_size;
cells[6].innerHTML = file_time;

}//end Assemble_Insert_row() //***************************************




return TABLE_ROW;
}//end Assemble_row() //**********************************************
function Build_Directory() { //***************************************

var DIR_LIST = document.getElementById("DIRECTORY_LISTING");

if (DIR_LIST.rows.length < 1) {Init_Dir_table_rows(DIR_LIST);}

for (var row = 0; row < DIRECTORY_ITEMS; row++) {

var filetype = DIRECTORY_DATA[row][0];
var filename = DIRECTORY_DATA[row][1];
var filesize = DIRECTORY_DATA[row][2];
var filetime = DIRECTORY_DATA[row][3];

//folder or file?
if (filetype == "dir"){
var DS = ' /';
var f_or_f = 'folder';
var href = ONESCRIPT + PARAM1 + encodeURIComponent(filename);
var file_size = '';
} else {
var DS = '';
var f_or_f = 'file';
var href = ONESCRIPT + PARAM1 + '&amp;f=' + encodeURIComponent(filename) + '&amp;p=edit';
var file_size = format_number(filesize) + ' B';
}

var file_name = '<a href="' + href + '"';
file_name += ' title="<?php echo hsc($_['Edit_View']) ?>: ' + hsc(filename) + '" >';
file_name += ICONS[filetype] + '&nbsp;' + hsc(filename) + DS + '</a>';
var file_time = FileTimeStamp(filetime, 1, 0, 0);

var IS_OFCMS = DIRECTORY_DATA[row][4];
var trow = DIR_LIST.rows[row];

Assemble_Insert_row(IS_OFCMS, trow, href, f_or_f, filename, file_name, file_size, file_time);
}//end for (row...
}//end Build_Directory() //*******************************************



Expand All @@ -3122,10 +3182,9 @@ function Directory_Summary() { //*************************************
}

//Directory Summary
SUMMARY += '<td colspan=7>';
SUMMARY += folder_count + " <?php echo hsc($_['folders']) ?>, &nbsp; ";
SUMMARY += total_items - folder_count + ' <?php echo hsc($_['files']) ?>, ';
SUMMARY += '&nbsp; ' + format_number(total_bytes) + " <?php echo hsc($_['bytes']) ?></td>";
SUMMARY += '&nbsp; ' + format_number(total_bytes) + " <?php echo hsc($_['bytes']) ?>";

return SUMMARY;

Expand All @@ -3134,72 +3193,19 @@ function Directory_Summary() { //*************************************



function Build_Directory() { //***************************************
//Build data from DIRECTORY_DATA into a set of <tr>'s

//raw directory info
var DIRECTORY_LIST = "";
var filetype = '';
var filename = '';
var filesize = 0;
var filetime = '';

//formatted and/or marked up directory info
var file_name = '';
var file_size = '';
var file_time = '';

var DS = ''; // ' /' for folders, blank otherwise.
var f_or_f = ''; // 'file' or 'folder'
var HREF_params = ''; // <a href=HREF_params>file_name</a>

for (var x=0; x < DIRECTORY_DATA.length; x++) {

filetype = DIRECTORY_DATA[x][0];
filename = DIRECTORY_DATA[x][1];
filesize = DIRECTORY_DATA[x][2];
filetime = DIRECTORY_DATA[x][3]

//folder or file? And file_size
if (filetype == "dir"){
DS = ' /';
f_or_f = 'folder';
HREF_params = ONESCRIPT + PARAM1 + encodeURIComponent(filename);
file_size = '';
} else {
DS = '';
f_or_f = 'file';
HREF_params = ONESCRIPT + PARAM1 + '&amp;f=' + encodeURIComponent(filename) + '&amp;p=edit';
file_size = format_number(filesize) + ' B';
}

file_name = '<a href="' + HREF_params + '"';
file_name += ' title="<?php echo hsc($_['Edit_View']) ?>: ' + hsc(filename) + '" >';
file_name += ICONS[filetype] + '&nbsp;' + hsc(filename) + DS + '</a>';
file_time = FileTimeStamp(filetime, 1, 0, 0);

DIRECTORY_LIST += Assemble_row(x, HREF_params, f_or_f, filename, file_name, file_time, file_size)

}//end for x

return DIRECTORY_LIST;

} //end Build_Directory() //******************************************



function Sort_and_Show(col, direction) { //***************************

sort_DIRECTORY(col, direction); //Sort DIRECTORY_DATA

document.getElementById('DIRECTORY_LISTING').innerHTML = Build_Directory();
Build_Directory();

document.getElementById('DIRECTORY_FOOTER').innerHTML = Directory_Summary();

}//end Sort_and_Show() { //*******************************************




function Select_All() { //*******************************************

//Does not work in IE if the variable name is spelled the same as the Element Id
Expand Down Expand Up @@ -3743,7 +3749,7 @@ function style_sheet(){ //******************************************************

.meta_T { padding-right: 4px; text-align: right; font-family: courier; font-size: .9em; color: #222; }

#DIRECTORY_FOOTER td {text-align: center; font-size: .9em; color: #333; padding: 3px 0 0 0; }
#DIRECTORY_FOOTER {text-align: center; font-size: .9em; color: #333; padding: 3px 0 0 0; }


/*** front_links: [New File] [New Folder] [Upload File] ***/
Expand All @@ -3762,9 +3768,9 @@ function style_sheet(){ //******************************************************

/*These must go after .front_links and other style that affect <a> tags*/
a { border: 1px solid transparent; text-decoration: none; } /*color: rgb(100,45,0);*/
a:focus { border: 1px solid #777; background-color: rgb(255,250,150); }
a:hover { border: 1px solid #777; background-color: rgb(255,250,150); }
a:active { border: 1px solid #777; background-color: rgb(245,245,50); }
a:focus { border: 1px solid #333; background-color: rgb(255,250,150); }
a:hover { border: 1px solid #333; background-color: rgb(255,250,150); }
a:active { border: 1px solid #333; background-color: rgb(245,245,50); }


/*** [Move] [Copy] [Delete] ***/
Expand All @@ -3784,9 +3790,9 @@ function style_sheet(){ //******************************************************
background-color: #EEE;
}

#mcd_submit button:focus { background-color: rgb(255,250,150); }
#mcd_submit button:hover { background-color: rgb(255,250,150); }
#mcd_submit button:active { background-color: rgb(245,245,50); }
#mcd_submit button:focus { border: 1px solid #333; background-color: rgb(255,250,150); }
#mcd_submit button:hover { border: 1px solid #333; background-color: rgb(255,250,150); }
#mcd_submit button:active { border: 1px solid #333; background-color: rgb(245,245, 50); }

.buttons_right { float: right; }
.buttons_right .button { margin-left: .5em; }
Expand All @@ -3811,14 +3817,15 @@ function style_sheet(){ //******************************************************

.nav { float: right; display: inline-block; margin-top: 1.35em; font-size : 1em; }
.nav a { border: 1px solid transparent; font-weight: bold; padding: .2em .6em .1em .6em; }
.nav a:hover { border: 1px solid #777; }
.nav a:focus { border: 1px solid #777; }
.nav a:active { border: 1px solid #777; }
.nav a:hover { border: 1px solid #333; }
.nav a:focus { border: 1px solid #333; }
.nav a:active { border: 1px solid #333; }


/* --- edit --- */

#edit_header {margin: .5em 0 0 0;}
#edit_header a:hover { border: 1px solid #000; }

#edit_form {margin: 0;}

Expand Down Expand Up @@ -3973,7 +3980,7 @@ function style_sheet(){ //******************************************************
font-weight: normal;
padding: 0 .5em 0 0;
margin: .5em 0 0 0;
}
}

#path_header a {
outline: none;
Expand All @@ -3982,7 +3989,7 @@ function style_sheet(){ //******************************************************
border-right: solid 1px transparent;
display: inline-block;
padding: 1px 5px 0 5px;
}
}

#path_header a:hover { border-left : solid 1px #777; border-right: solid 1px #777; background-color: rgb(255,250,150); }
#path_header a:focus { border-left : solid 1px #777; border-right: solid 1px #777; background-color: rgb(255,250,150); }
Expand Down
4 changes: 1 addition & 3 deletions readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ OneFileCMS can be configured to work with [TinyMCE](http://tinymce.moxiecode.com
(Only tested on versions 5.2.8, 5.2.17, 5.3.3, and 5.4 + )
- File permission privileges on your host.
- A Javascript enabled browswer.
- Most* modern browsers probably work, but I only test on Firefox and Chrome.
*IE, however, is currently a no go, as of OneFileCMS v3.4.23. [v3.4.22 is available here](http://self-evident.github.com/OneFileCMS/onefilecms_3.4.22.zip)
- Most* modern browsers probably work, but I only test on Firefox, Chrome, and IE 8.
- And- but only if you wish to see the icons- a browser that supports inline SVG.
(If your browser doesn't support inline SVG, OneFileCMS will still work, just without any icons.)

Expand All @@ -118,7 +117,6 @@ OneFileCMS can be configured to work with [TinyMCE](http://tinymce.moxiecode.com

##Needed/potential improvements

- As of v3.4.23, doesn't work in IE. It seems IE doesn't support changing the innerHTML of some tags. OneFile builds the directory in javascript, then displays it by changing the innerHTML of a &lt;tbody> tag of an existing &lt;table>. And, since the alternative/fix/workaround would be a whole bunch more work, IE is currently not supported.
- With Chrome, and possibly Safari, issue with Edit page: Clicking browser [back] & then browser [forward], with file changed and not saved. On return (after [forward] clicked), file still has changes, but indicators are green (saved/unchanged). Does not affect FF 7+ or IE 8+.
- The connection is not encrypted (doesn't use SSL), so passwords & usernames are sent in clear text* during login. However, this is true of most online login systems, unless SSL or the like is employed.
*As of version 3.4.15, a client-side hash of the user's "plain-text" password is sent to the server. So, while this client-side hash is still a "plain-text" password as far as the server is concerned, the user's actual raw password is protected from immediate exposure.
Expand Down

0 comments on commit f034a78

Please sign in to comment.