Skip to content

Commit

Permalink
Added a readme file and various files
Browse files Browse the repository at this point in the history
Added a readme, the glz_custom_fields plugin and screenshots of the
settings for creating and using the custom fields
  • Loading branch information
Jonathan Stubbs authored and Jonathan Stubbs committed Feb 17, 2013
1 parent 4925350 commit 8eaeaf2
Show file tree
Hide file tree
Showing 22 changed files with 2,951 additions and 0 deletions.
Binary file not shown.
38 changes: 38 additions & 0 deletions plugins/glz_custom_fields-1.4.0-beta1/CHANGELOG.md
@@ -0,0 +1,38 @@
### What's new in v1.4.0

All users tracking (livestats) has been completely removed. The feature
didn't prove as useful as I've hoped, there was no point in keeping it
around.

Textpattern 4.5 compatibility.



### What's new in v1.3.0

As a word of caution, all existing plugin preferences will be
overwritten on install. This is related to the way path/urls are now
saved in the db.

Also, the scripts folder has now been renamed to plugins. You should use
it for all other TXP plugins that you don't want to store in the db.
Plugins is more descriptive to its purpose.

There is a livestats functionality which is disabled by default. You
can follow the controversy that it raised starting with this forum post:
http://forum.textpattern.com/viewtopic.php?pid=250362#p250362

You can enable it from the plugin preferences page.

Now for the fixes:

* no longer checking if jQuery is present - has been present in TXP
for a very long time now
* fixed installation issues on TXP 4.4.1
* include\_once fix for custom scripts
* CSS & JS loads on the default page, right after user logs in GH-21
* fixed editing of custom script names
* CSS & JS code now in separate files
* fixes duplicate excerpt bug when used together with MLP GH-23
* disabling excerpts won't affect textarea custom fields, they are now
placed right after the article body GH-26
32 changes: 32 additions & 0 deletions plugins/glz_custom_fields-1.4.0-beta1/INSTALL.md
@@ -0,0 +1,32 @@
This version of the plugin is for **Textpattern 4.4.x**,
it will most probably not work properly on previous versions.

#### BACKUP YOUR DATABASE

**This is not optional**. The plugin won't delete anything automatically,
but if something goes wrong, you might end up losing all your custom fields data.

#### PLUGINS FOLDER

Place the `glz_custom_fields` folder from the archive into your website's
plugins folder. You should end up with something similar to:

.
|-- HISTORY.txt
|-- README.txt
|-- index.php
|-- ...........
|-- plugins
| `-- glz_custom_fields <<< THIS IS THE FOLDER THAT YOU NEED TO ADD
|-- ...........
`-- textpattern
|-- checksums.txt
|-- config-dist.php
|..................

#### INSTALL PLUGIN

Now delete your existing `glz_custom_fields` plugin, and install the
version included in this folder. That's it!

## [Issues](https://github.com/gerhard/glz_custom_fields_public/issues) ::: [Tips](https://github.com/gerhard/glz_custom_fields_public/wiki) ::: [Github](https://github.com/gerhard/glz_custom_fields_public)
344 changes: 344 additions & 0 deletions plugins/glz_custom_fields-1.4.0-beta1/glz_custom_fields-1.4.0-beta1

Large diffs are not rendered by default.

@@ -0,0 +1,132 @@
/* - - - - - - - - - - - - - - - - - - - - -
### TEXTPATTERN CUSTOM FIELDS ###
Title : glz_custom_fields stylesheet
Author : Gerhard Lazu
URL : http://www.gerhardlazu.com/
Created : 14th May 2007
Last modified: 28th September 2009
- - - - - - - - - - - - - - - - - - - - - */

/* CLASSES
-------------------------------------------------------------- */
.green {
color: #6B3;
}
.red {
color: #C00;
}
.grey {
color: #777;
}
.left {
float: left;
}
.right {
float: right;
}


/* TABLE
-------------------------------------------------------------- */
.glz_custom_fields {
margin: 0 auto;
width: 600px;
}

.glz_custom_fields td {
vertical-align: middle;
}
.glz_custom_fields td.custom_set_position {
text-align: right;
width: 10%;
}
.glz_custom_fields td.custom_set_name {
width: 30%;
}
.glz_custom_fields td.type {
width: 30%;
}
.glz_custom_fields td.events {
width: 30%;
text-align: right;
}

.glz_custom_fields_prefs {
width: 500px;
}
.glz_custom_fields_prefs#list tr th {
font-weight: normal;
text-align: right;
vertical-align: top;
width: 50%;
}
.glz_custom_fields_prefs#list tr.heading td {
padding-top: 30px;
}
.glz_custom_fields_prefs#list tr.heading td h2 {
margin-top: 0
}
.glz_custom_fields_prefs tr td select,
.glz_custom_fields_prefs tr td input {
width: 100%;
}
.glz_custom_fields_prefs tr td input.publish {
margin-left: 51%;
width: auto;
}



/* FORMS
-------------------------------------------------------------- */
.glz_custom_fields td.events form {
display: inline;
}

#add_edit_custom_field {
width: 600px;
margin: 2em auto 0 auto;
}
#add_edit_custom_field label {
width: 20%;
font-weight: 700;
}
#add_edit_custom_field p input,
#add_edit_custom_field p select {
width: 50%;
}
#add_edit_custom_field p textarea {
font-size: 0.9em;
padding: 1px 0 1px 3px;
width: 50%; height: 100px;
}
#add_edit_custom_field p span {
padding-top: 3px;
width: 27%;
}
#add_edit_custom_field p em,
.glz_custom_fields_prefs tr em {
font-size: 0.9em;
font-weight: 500;
}
#add_edit_custom_field input.submit {
margin-left: 21%;
margin-bottom: 1em;
}

/* select on write tab for the custom fields */
td#article-col-1 #advanced p select.list,
td#article-col-1 #custom_field_group select.list {
width: 100%;
}

td#article-col-1 #advanced p input.radio,
td#article-col-1 #custom_field_group input.radio,
td#article-col-1 #advanced p input.checkbox,
td#article-col-1 #custom_field_group input.checkbox {
width: auto;
}
@@ -0,0 +1,105 @@
$(function() {
// creating a global object to store variables, functions etc.
var GLZ_CUSTOM_FIELDS;
if (GLZ_CUSTOM_FIELDS == undefined)
GLZ_CUSTOM_FIELDS = {};
GLZ_CUSTOM_FIELDS.special_custom_types = ["date-picker", "time-picker"];
GLZ_CUSTOM_FIELDS.no_value_custom_types = ["text_input", "textarea"];
GLZ_CUSTOM_FIELDS.messages = {
'textarea' : "<em>Each value on a separate line</em><br /><em>One {default} value allowed</em>",
'script' : "<em>File name in your custom scripts path</em>"
}

// disable all custom field references in Advanced Prefs
// prefs_ui doesn't offer support for this, getting the custom fields to display right here is not crucial at this point
var custom_field_tr = $("tr[id*=prefs-custom], tr[id*=custom_fields], tr:has(h3[class*=custom-prefs])");
if ( custom_field_tr ) {
$.each (custom_field_tr, function() {
$(this).hide();
});
}

// toggle custom field value based on its type
toggle_type_link();
if ( $.inArray($("select#custom_set_type :selected").attr("value"), [].concat(GLZ_CUSTOM_FIELDS.special_custom_types, GLZ_CUSTOM_FIELDS.no_value_custom_types)) != -1 ) {
custom_field_value_off();
}
else if ( $("select#custom_set_type :selected").attr("value") == "custom-script" )
custom_field_value_path();

$("select#custom_set_type").change( function() {
toggle_type_link();
if ( $.inArray($("select#custom_set_type :selected").attr("value"), [].concat(GLZ_CUSTOM_FIELDS.special_custom_types, GLZ_CUSTOM_FIELDS.no_value_custom_types)) != -1 ) {
custom_field_value_off();
}
else if ( $("select#custom_set_type :selected").attr("value") == "custom-script" )
custom_field_value_path();
else {
custom_field_value_on();
}
});

// add a reset link to all radio custom fields
if ($(".glz_custom_radio_field").length > 0) {
$(".glz_custom_radio_field").each(function() {
custom_field_to_reset = $(this).find("input:first").attr("name");
$(this).find("label:first").after(" <span class=\"small\">[<a href=\"#\" class=\"glz_custom_field_reset\" name=\"" + custom_field_to_reset +"\">Reset</a>]</span>");
});

// catch the reset action for the above link
$(".glz_custom_field_reset").click(function() {
custom_field_to_reset = $(this).attr("name");
// reset our radio input
$("input[name=" + custom_field_to_reset + "]").attr("checked", false);
// add an empty value with the same ID so that it saves the value as empty in the db
$(this).after("<input type=\"hidden\" value=\"\" name=\""+ custom_field_to_reset +"\" />");
return false;
});
}

// ### RE-USABLE FUNCTIONS ###

function custom_field_value_off() {
if ($("textarea#value").length) {
GLZ_CUSTOM_FIELDS.textarea_value = $("textarea#value").html();
$("textarea#value + span.right").html('');
$("textarea#value").remove();
}

if (!$("input#value").length)
$("label[for=value]").after('<input type="text" id="value" name="value" class="left" />');
$("input#value").attr('value', "no value allowed").attr('disabled', true);
$("input#value + span.right").html('');
}

function custom_field_value_on() {
if ( $("input#value").length )
$("input#value").remove();
if ( !$("textarea#value").length ) {
$("label[for=value]").after('<textarea id="value" name="value" class="left"></textarea>');
$("textarea#value + span.right").html(GLZ_CUSTOM_FIELDS.messages['textarea']);
}
if ( GLZ_CUSTOM_FIELDS.textarea_value )
$("textarea#value").html(GLZ_CUSTOM_FIELDS.textarea_value);
}

function custom_field_value_path() {
if ($("textarea#value").length) {
$("textarea#value + span.right").html('');
$("textarea#value").remove();
}
if (!$("input#value").length)
$("label[for=value]").after('<input type="text" id="value" name="value" class="left" />');
if ( $.inArray($("input#value").attr('value'), ["", "no value allowed"]) != -1 )
$("input#value").attr('value', "");
$("input#value").attr('disabled', false);
$("input#value + span.right").html(GLZ_CUSTOM_FIELDS.messages['script']);
}

function toggle_type_link() {
$("select#custom_set_type").parent().find('span').remove();
if ( $.inArray($("select#custom_set_type :selected").attr("value"), [].concat(GLZ_CUSTOM_FIELDS.special_custom_types, ["multi-select", "custom-script"])) != -1 )
$("select#custom_set_type").after("<span class=\"right\"><em><a href=\"http://"+window.location.host+window.location.pathname+"?event=plugin_prefs.glz_custom_fields\">Configure glz_custom_fields</a></em></span>");
}

});
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8eaeaf2

Please sign in to comment.