-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* additons for creating user styles * updates to admin.php * Updates admin.php to accept input for alternate template * Set up path to alternate template * new message function; tied alternate template to css6 * Replace text input with drop-down menu list for selecting alternate templates * removed non-writable directories from template drop-down list * Adds option to copy of default _style.css to ckeditor/css * Adding setting for using alternate style sheet. * adds info to aadmin.php * Includes function alt_style_sheet() in edit.php to check for alternate style sheet in ckeditor/css. * Chagned function name tfunc to ckg_admininfo, proof against naming ocnflicts * fix for compressed files which remove comments, hence header with template name from _style.css * Localization for Info button in admin.php, enabling exact comparison for toggle function ckg_admininfo
- Loading branch information
Showing
9 changed files
with
729 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<?php | ||
|
||
|
||
/** | ||
* @author Myron Turner <turnermm02@shaw.ca> | ||
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html | ||
*/ | ||
|
||
require_once(DOKU_INC . 'lib/plugins/ckgedit/scripts/css6.php'); | ||
class admin_plugin_ckgedit extends DokuWiki_Admin_Plugin { | ||
|
||
private $tpl_inc; | ||
private $template; | ||
private $alt; | ||
function __construct() { | ||
global $conf; | ||
$this->template = $conf['template']; | ||
$this->tpl_inc = tpl_incdir(); | ||
} | ||
|
||
function handle() { | ||
|
||
if (!isset($_REQUEST['cmd'])) return; // first time - nothing to do | ||
|
||
$this->output = 'invalid'; | ||
|
||
if (!checkSecurityToken()) return; | ||
if (!is_array($_REQUEST['cmd'])) return; | ||
|
||
switch (key($_REQUEST['cmd'])) { | ||
case 'stylesheet' : { | ||
$this->alt = ""; | ||
$this->output = 'style_sheet_msg'; | ||
break; | ||
} | ||
case 'alt_stylesheet' : { | ||
$this->alt = $_REQUEST['templates']; | ||
$this->output = 'alt_style_sheet_msg'; | ||
break; | ||
} | ||
} | ||
|
||
|
||
} | ||
|
||
/** | ||
* output appropriate html | ||
*/ | ||
function html() { | ||
ptln('<div id = "ckg_styl_sheet" style = "display:none">'); | ||
echo $this->locale_xhtml('style'); | ||
ptln('</div>'); | ||
ptln('<button type = "button" id = "Infobut" onclick="jQuery(\'#ckg_styl_sheet\').toggle(800,ckg_admininfo(this));">'); | ||
echo $this->getLang('stylesheet_oinfo'); | ||
ptln('</button>'); | ||
|
||
ptln('<form action="'.wl($ID).'" method="post">'); | ||
// output hidden values to ensure dokuwiki will return back to this plugin | ||
ptln(' <input type="hidden" name="do" value="admin" />'); | ||
ptln(' <input type="hidden" name="page" value="'.$this->getPluginName().'" />'); | ||
formSecurityToken(); | ||
|
||
//Current style sheet | ||
ptln('<p style = "line-height: 200%;">' . $this->getLang('default_stylesheet') . ': (' .$this->template . ')<br />'); | ||
ptln('<label for="ckg_save_ss">' .$this->getLang('checkbox').'</label>'); | ||
ptln('<input type="checkbox" name="ckg_save_ss"> '); | ||
ptln('<input type="submit" name="cmd[stylesheet]" value="'.$this->getLang('style_sheet').'" /></p>'); | ||
|
||
// Other style sheet | ||
$alt_val = isset($this->alt)?$this->alt: "" ; | ||
ptln('<p style = "line-height: 200%;">' . $this->getLang('alt_stylesheet') .'<br />'); | ||
ptln('<select name="templates" style = "line-height:100%">'); | ||
echo $this->templates( $alt_val ); | ||
ptln('</select>'); | ||
ptln('<input type="submit" name="cmd[alt_stylesheet]" value="'.$this->getLang('style_sheet').'" />'); | ||
ptln('</form></p>'); | ||
|
||
if($this->output && $this->output == 'style_sheet_msg') { | ||
$path = $this->tpl_inc; | ||
ptln(htmlspecialchars($this->getLang($this->output)). " " .$this->template); | ||
$retv = css_ckg_out($path); | ||
$this->message($path, $retv); | ||
|
||
} | ||
else if($this->output && $this->output == 'alt_style_sheet_msg') { | ||
ptln(htmlspecialchars($this->getLang($this->output)). " " .$this->alt); | ||
$path = str_replace('tpl/'.$this->template, 'tpl/'.$this->alt,$this->tpl_inc); | ||
$retv = css_ckg_out($path,$this->alt); | ||
$this->message($path, $retv); | ||
} | ||
|
||
} | ||
|
||
function message($path, $which) { | ||
$messages = array( | ||
"Stylesheet saved to $path" . 'Styles/_style.css', | ||
"Failed to save stylesheet to $path" . 'Styles/_style.css' | ||
); | ||
$color = $which == 0? '#333': 'blue'; | ||
ptln('<br /><span style = "color:'.$color. ';">'.htmlspecialchars($messages[$which]).'</span>'); | ||
|
||
} | ||
|
||
function templates($selected="") { | ||
$dir = dirname($this->tpl_inc); | ||
$files = scandir($dir); | ||
$dir .= '/'; | ||
$list = "<option value='' >Select</option>"; | ||
foreach ($files AS $file) { | ||
if($file == '.' || $file == '..' || $file == $this->template) continue; | ||
$entry = $dir . $file; | ||
if(!is_writable($entry)) continue; | ||
if(is_dir ($entry ) ) { | ||
if($file == $selected) { | ||
$list .= "<option value='$file' selected>$file</option>"; | ||
} | ||
else $list .= "<option value='$file' >$file</option>"; | ||
} | ||
} | ||
|
||
return $list; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,5 +40,8 @@ | |
$conf['preserve_enc'] = 0; | ||
$conf['gui'] = 'moono'; | ||
$conf['rel_links'] = 0; | ||
$conf['style_sheet'] = 0; | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
**Current Template** \\ | ||
With this app you can create a style sheet for the CKEditor's editing window that is based on your template. It will place the style sheet in your template folder in the directory named **Styles**, which will be created when the style sheet is saved. The style sheet will be named **_styles.css**. To activate this style sheet two things must be done: | ||
|
||
- it must be placed in **ckgedit/ckeditor/css**. This will automatically be done for you if you check off the checkbox labeled **Copy to ckeditor/css.** | ||
- The **style_sheet** option in the ''Configuration Settings'' must be set to **true**. | ||
|
||
**Other templates: installed but not activate** \\ You can also create additional style sheets for other templates which you might have stored in your **tpl** folder. These will be copied to the Styles folder of the respective templates but not to **ckeditor/css**. | ||
|
||
---- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.