Template Editor CssFileBox little change

More
3 years 2 months ago - 3 years 2 months ago #112773 by HyperBuzz
HyperBuzz created the topic: Template Editor CssFileBox little change
Hello
i've changed a little thing in the templates.php (/.../application/controllers/admin)
So now all uploaded Css/Js Files are listet in the css &JavaScript listbox
and can open with the editor.
perhaps somenone find it usefull ;)

its on Line 1226 in the php file
// Get list of 'otherfiles'
        $otherfiles = array();
        if ($handle = opendir($templatedir)) {
            while (false !== ($file = readdir($handle)))
            {
		// check for css/js files and put in the right array!
		if (!is_dir($templatedir . DIRECTORY_SEPARATOR . $file)) {
			$extens=substr(strrchr($file, '.'), 1);
			switch ($extens)
			{
			case 'js':
			case 'css':
				if (!array_search($file, $cssfiles)) {
					$cssfiles[] = array('name' => $file);
				}
				break;
			default:
				if (!array_search($file, $normalfiles)) {
					$otherfiles[] = array("name" => $file);
				}
				break;
			}
		}
            }
            closedir($handle);
        }
Attachments:
Last Edit: 3 years 2 months ago by HyperBuzz.

Please Log in to join the conversation.

More
3 years 2 months ago - 3 years 2 months ago #112779 by HyperBuzz
HyperBuzz replied the topic: Template Editor CssFileBox little change

HyperBuzz wrote: Hello
i've changed a little thing in the templates.php (/.../application/controllers/admin)
So now all uploaded Css/Js Files are listet in the css &JavaScript listbox
and can open with the editor.
perhaps somenone find it usefull ;)

its on Line 1226 in the php file

// Get list of 'otherfiles'
        $otherfiles = array();
        if ($handle = opendir($templatedir)) {
            while (false !== ($file = readdir($handle)))
            {
		// check for css/js files and put in the right array!
		if (!is_dir($templatedir . DIRECTORY_SEPARATOR . $file)) {
			$extens=substr(strrchr($file, '.'), 1);
			switch ($extens)
			{
			case 'js':
			case 'css':
				if (!array_search($file, $cssfiles)) {
					$cssfiles[] = array('name' => $file);
				}
				break;
			default:
				if (!array_search($file, $normalfiles)) {
					$otherfiles[] = array("name" => $file);
				}
				break;
			}
		}
            }
            closedir($handle);
        }

I'm Sorry ther was an Error because of the rang of the codesegment, i've korrect it th zip file is actually...
here's the changed example, so it works
$myoutput[] = "</html>";
 
		// Get list of 'otherfiles'
        $otherfiles = array();
        if ($handle = opendir($templatedir)) {
            while (false !== ($file = readdir($handle)))
            {
				if (!is_dir($templatedir . DIRECTORY_SEPARATOR . $file)) {
				$otherfiles[] = array("name" => $file);
					$extens=substr(strrchr($file, '.'), 1);
					switch ($extens)
					{
					case 'js':
					case 'css':
						if (!array_search($file, $normalfiles)) {
							$cssfiles[] = array('name' => $file);
						}
						break;
					default:
						if (!array_search($file, $normalfiles)) {
							$otherfiles[] = array("name" => $file);
							}
						break;
					}
				}
            }
            closedir($handle);
        }
 
        if (is_array($files)) {
            $match = 0;
            foreach ($files as $f)
                if ($editfile == $f["name"])
                    $match = 1;
 
                foreach ($cssfiles as $f)
                if ($editfile == $f["name"])
                    $match = 1;
 
                if ($match == 0)
                if (count($files) > 0)
                    $editfile = $files[0]["name"];
                else
                    $editfile = "";
        }
        $aData['clang'] = $this->getController()->lang;
Last Edit: 3 years 2 months ago by HyperBuzz.

Please Log in to join the conversation.

More
3 years 2 months ago #112804 by DenisChenu
DenisChenu replied the topic: Template Editor CssFileBox little change
Hi,

Don't know if we include it in core or in a external plugin, but you can:
- Make a feature request
- Make a pull request : github.com/LimeSurvey/LimeSurvey/pulls

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
The following user(s) said Thank You: HyperBuzz

Please Log in to join the conversation.

More
3 years 2 months ago #112807 by HyperBuzz
HyperBuzz replied the topic: Template Editor CssFileBox little change
thank you, i've posted it on the feature request
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

More
3 years 2 months ago #112826 by DenisChenu
DenisChenu replied the topic: Template Editor CssFileBox little change

HyperBuzz wrote: thank you, i've posted it on the feature request

Yep, and i vote strong support ;)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!